Files
AgentCompany/tests/unit/integration-key-store.test.ts
T
ZacharyZhang-NYandClaude Opus 5.5 245ff66336
Build Release Installers / Release for the tag (push) Successful in 16s
Build Release Installers / Windows installer (NSIS x64) (push) Successful in 1m48s
Build Release Installers / Linux packages (AppImage + deb x64) (push) Successful in 2m21s
CI / Typecheck, lint, tests, e2e (push) Successful in 3m52s
Build Release Installers / macOS installers (dmg + zip, x64 + arm64) (push) Successful in 7m15s
1.5.1: refined office, chat in the app language, current OpenAI models, own connector keys
- Home: the goal title box is two line boxes tall (2.8em), so a third line no longer peeks out.
- Chat messages, reply fallbacks and assignment DMs follow the app display language; tasks and documents keep the working language.
- OpenAI and GPT-account model lists match OpenAI's current line-up; default gpt-6.1-sol.
- Onboarding connectors step takes the operator's Composio and logo.dev keys, then lists the toolkits the Composio project enables; without a key Connectors leaves the sidebar.
- Google Antigravity removed end to end (migration 111), with the remote-revocation path only it used.
- Office: 2x pixel people with outlines, rim light, walk, typing and blink; dithered real-clock lighting; detailed furniture and floors.
- Per-agent model picker lists the provider's whole model list, live when connected.
- Chat wake context breaks same-millisecond ties by insertion order; the mid-run inbox dedupes by message id.
- The stored "clock" theme reads back instead of falling to "system".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 21:12:19 -04:00

59 lines
2.4 KiB
TypeScript

import { randomUUID } from "node:crypto";
import { tmpdir } from "node:os";
import { join } from "node:path";
import { describe, expect, test } from "vitest";
import { DatabaseConnection } from "../../src/main/database/connection";
import { IntegrationKeyStore } from "../../src/main/services/integration-key-store";
import type { IntegrationKeyName } from "../../src/shared/commands";
const reversingVault = {
encryptSecret: (secret: string) => Buffer.from([...secret].reverse().join(""), "utf8"),
decryptSecret: (ciphertext: Buffer) => [...ciphertext.toString("utf8")].reverse().join(""),
};
function openStore() {
const connection = new DatabaseConnection(join(tmpdir(), `ac-keys-${randomUUID()}.db`));
return { connection, store: new IntegrationKeyStore(connection.db, reversingVault) };
}
describe("integration key store", () => {
test("saves trimmed keys through the vault and reads them back", () => {
const { connection, store } = openStore();
store.write("composio", " ak_123 ");
const row = connection.db.prepare("select ciphertext from integration_keys where name = 'composio'").get() as { ciphertext: Uint8Array };
expect(Buffer.from(row.ciphertext).toString("utf8")).toBe("321_ka");
expect(store.read("composio")).toBe("ak_123");
expect(store.read("logo_dev")).toBeNull();
connection.close();
});
test("statuses list every known key in order with configured flags", () => {
const { connection, store } = openStore();
store.write("logo_dev", "pk_1");
const statuses = store.statuses();
expect(statuses.map((status) => [status.name, status.configured])).toEqual([
["composio", false],
["logo_dev", true],
]);
expect(statuses[1].updatedAt).toMatch(/^\d{4}-\d{2}-\d{2}T/);
connection.close();
});
test("clear removes a key and overwrite replaces it", () => {
const { connection, store } = openStore();
store.write("composio", "ak_old");
store.write("composio", "ak_new");
expect(store.read("composio")).toBe("ak_new");
store.clear("composio");
expect(store.read("composio")).toBeNull();
connection.close();
});
test("rejects blank values and unknown names", () => {
const { connection, store } = openStore();
expect(() => store.write("composio", " ")).toThrow("cannot be blank");
expect(() => store.write("stripe" as IntegrationKeyName, "x")).toThrow('Unknown integration key "stripe"');
connection.close();
});
});