Ship Composio as a built-in integration and trim Settings

- Resolve the API key from cred.txt at the project root in development
  and the packaged resources directory in production; the file is the
  source of truth, so a rotated key replaces the stored one. Fixes the
  401 packaged builds hit when a stale database key won.
- Remove the user-facing Composio key editor; the key ships with the
  product and is not configurable.
- Remove the Migration console from Settings.
- Remove the Connectors and Home refresh buttons; connector statuses
  sync when the page opens.
This commit is contained in:
ZacharyZhang-NY committed 2026-07-07 01:20:21 -04:00
1 parent 947cd8605b
commit 256e0680c6
16 files changed
+53 -396

No files matched your search

+1 -22
View File
@@ -3,7 +3,6 @@ import { mkdirSync, writeFileSync } from "node:fs";
import { tmpdir } from "node:os";
import { join, resolve } from "node:path";
import { randomUUID } from "node:crypto";
import { DatabaseSync } from "node:sqlite";
test("onboards, hires, and creates work in the Electron shell", async () => {
const profileDir = join(tmpdir(), `agentcompany-new-e2e-${randomUUID()}`);
@@ -115,7 +114,7 @@ test("onboards, hires, and creates work in the Electron shell", async () => {
// is reachable from the test machine.
await page.getByRole("button", { name: "Connectors", exact: true }).click();
await expect(page.getByRole("heading", { name: "Connectors" })).toBeVisible();
await expect(page.getByRole("button", { name: "Refresh" })).toBeVisible();
await expect(page.getByRole("button", { name: "Refresh" })).toHaveCount(0);
await page.getByRole("button", { name: "Settings" }).click();
await expect(page.getByText("AI CEO", { exact: true })).toBeVisible();
@@ -130,7 +129,6 @@ test("onboards, hires, and creates work in the Electron shell", async () => {
await expect(page.getByRole("button", { name: "Background" })).toBeVisible();
await page.getByLabel("Request prompt").fill("Draft a provider control memo.");
await page.getByLabel("Request instructions").fill("Use direct language.");
await expect(page.getByLabel("Composio API key")).toBeVisible();
await page.getByRole("button", { name: "Providers" }).click();
await page.getByLabel("OpenAI data policy").selectOption("zero_data_retention");
@@ -147,17 +145,6 @@ test("onboards, hires, and creates work in the Electron shell", async () => {
await expect(page.getByText("Never run").first()).toBeVisible();
await page.getByRole("button", { name: "Run tests" }).click();
await expect(page.getByText("1/1 passed").first()).toBeVisible();
const legacyPath = createLegacyDatabase();
await page.getByRole("button", { name: "Advanced" }).click();
await page.getByRole("button", { name: "Report" }).click();
await page.getByLabel("Source database path").fill(legacyPath);
await page.locator(".modal").getByRole("button", { name: "Create" }).click();
await expect(page.getByText("organizations: 1").first()).toBeVisible();
await page.getByRole("button", { name: "Snapshot" }).click();
await expect(page.getByText("Rollback snapshots", { exact: true })).toBeVisible();
await expect(page.getByText(/\d+ workspaces/).first()).toBeVisible();
await page.getByRole("button", { name: "Set", exact: true }).click();
await expect(page.getByRole("button", { name: "active", exact: true })).toBeDisabled();
// Virtual office page
await page.getByRole("button", { name: "Office" }).click();
@@ -176,14 +163,6 @@ test("onboards, hires, and creates work in the Electron shell", async () => {
}
});
function createLegacyDatabase(): string {
const legacyPath = join(tmpdir(), `agentcompany-legacy-${randomUUID()}.db`);
const legacy = new DatabaseSync(legacyPath);
legacy.exec("create table organizations(id text primary key); insert into organizations(id) values ('legacy-org');");
legacy.close();
return legacyPath;
}
function createSkillDirectory(): string {
const root = join(tmpdir(), `agentcompany-skill-${randomUUID()}`);
mkdirSync(join(root, "checks"), { recursive: true });
+14 -5
View File
@@ -40,30 +40,39 @@ describe("composio credential resolution", () => {
test("seeds the database from the credential file", () => {
const h = harness();
writeCred(h, "ak_first");
expect(resolveComposioApiKey(h.connection.db, h.orgId, h.credDir)).toBe("ak_first");
expect(resolveComposioApiKey(h.connection.db, h.orgId, [h.credDir])).toBe("ak_first");
expect(storedKey(h)).toBe("ak_first");
});
test("a rotated credential file replaces the stale stored key", () => {
const h = harness();
writeCred(h, "ak_old");
resolveComposioApiKey(h.connection.db, h.orgId, h.credDir);
resolveComposioApiKey(h.connection.db, h.orgId, [h.credDir]);
writeCred(h, "ak_rotated");
expect(resolveComposioApiKey(h.connection.db, h.orgId, h.credDir)).toBe("ak_rotated");
expect(resolveComposioApiKey(h.connection.db, h.orgId, [h.credDir])).toBe("ak_rotated");
expect(storedKey(h)).toBe("ak_rotated");
});
test("finds the credential file in a later directory when the first has none", () => {
const h = harness();
writeCred(h, "ak_resources");
const emptyDir = join(tmpdir(), `ac-cred-empty-${randomUUID()}`);
mkdirSync(emptyDir, { recursive: true });
expect(resolveComposioApiKey(h.connection.db, h.orgId, [emptyDir, h.credDir])).toBe("ak_resources");
expect(storedKey(h)).toBe("ak_resources");
});
test("without a credential file the stored key stands", () => {
const h = harness();
const now = new Date().toISOString();
h.connection.db.prepare(
"insert into composio_settings(org_id, key, value, updated_at) values (?, 'api_key', 'ak_settings', ?)",
).run(h.orgId, now);
expect(resolveComposioApiKey(h.connection.db, h.orgId, h.credDir)).toBe("ak_settings");
expect(resolveComposioApiKey(h.connection.db, h.orgId, [h.credDir])).toBe("ak_settings");
});
test("no file and no stored key yields null", () => {
const h = harness();
expect(resolveComposioApiKey(h.connection.db, h.orgId, h.credDir)).toBeNull();
expect(resolveComposioApiKey(h.connection.db, h.orgId, [h.credDir])).toBeNull();
});
});