Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
Email: the tests that pin the tool inventory, the credential card's fields and the Apps grid follow the email card
milind-sonie42add7a3f75
diff --git a/server/drivers/agents-proxy.test.ts b/server/drivers/agents-proxy.test.tsindex 8e2d4f0667..4eb7481270 100644--- a/server/drivers/agents-proxy.test.ts+++ b/server/drivers/agents-proxy.test.ts@@ -702,7 +702,8 @@ describe("agents-proxy MCP surface", () => {expect(credential.description).toContain("on a secure card in the app or a QR-paired phone, never in chat");expect(credential.description).toContain("onePasswordToken: a 1Password service account token");expect(credential.description).toContain("You never see the value");- expect(Object.keys(credential.inputSchema.properties)).toEqual(["credential_id", "label", "reason", "placeholder", "delivery"]);+ expect(Object.keys(credential.inputSchema.properties)).toEqual(["credential_id", "address", "label", "reason", "placeholder", "delivery"]);+ expect(credential.inputSchema.properties.address.description).toMatch(/^credential_id email only/);expect(credential.inputSchema.required).toBeUndefined();});diff --git a/server/email/client.test.ts b/server/email/client.test.tsindex 33dabcec59..63d44b4176 100644--- a/server/email/client.test.ts+++ b/server/email/client.test.ts@@ -115,7 +115,7 @@ describe("an attachment's file", () => {const first = saveAttachment(folder, "note.pdf", Buffer.from("one"));const second = saveAttachment(folder, "note.pdf", Buffer.from("two"));expect([readFileSync(first, "utf8"), readFileSync(second, "utf8")]).toEqual(["one", "two"]);- expect(statSync(first).mode & 0o077).toBe(0);+ if (process.platform !== "win32") expect(statSync(first).mode & 0o077).toBe(0);const secret = join(root, "config.json");execFileSync("sh", ["-c", `printf keep > '${secret}'`]);symlinkSync(secret, join(folder, "planted.pdf"));diff --git a/server/email/service.test.ts b/server/email/service.test.tsindex f938784957..17ccb222d2 100644--- a/server/email/service.test.ts+++ b/server/email/service.test.ts@@ -121,7 +121,8 @@ describe("connecting a mailbox", () => {await email.connect({ address: "[email protected]", password: PASSWORD });for (const name of readdirSync(dataDir)) {expect(readFileSync(join(dataDir, name)).toString("latin1"), name).not.toContain(PASSWORD);- expect(statSync(join(dataDir, name)).mode & 0o077, name).toBe(0);+ // Windows has no POSIX mode bits; its files are private to the user by their folder.+ if (process.platform !== "win32") expect(statSync(join(dataDir, name)).mode & 0o077, name).toBe(0);}expect(service(() => ({ messages: 1 }), undefined, { dataDir }).email.store.get("[email protected]")?.password).toBe(PASSWORD);});diff --git a/server/index.test.ts b/server/index.test.tsindex 661169ca4d..c76e7374c2 100644--- a/server/index.test.ts+++ b/server/index.test.ts@@ -1,5 +1,6 @@// The config pins one deliberately unknown driver, so the suite is deterministic with or without agent CLIs installed.import { HIGHLEVEL_TOOLS } from "./highlevel/tools.js";+import { EMAIL_TOOLS } from "./email/tools.ts";import { spawn, type ChildProcess } from "node:child_process";import { createHash, randomUUID } from "node:crypto";import { once } from "node:events";@@ -12559,6 +12560,8 @@ describe("harness HTTP API", () => {slack: [{ name: "SLACK_POST_MESSAGE", description: "a".repeat(240) }],// HighLevel's tools are listed whenever its relay is configured, so grants can be set before connecting.highlevel: HIGHLEVEL_TOOLS.map(({ name, description }) => ({ name, description })),+ // So are email's, wherever a mailbox can be connected here.+ email: EMAIL_TOOLS.map(({ name, description }) => ({ name, description })),},});});diff --git a/src/components/PluginsPanel.navigation.test.ts b/src/components/PluginsPanel.navigation.test.tsindex 32a12f9ac4..575731afa5 100644--- a/src/components/PluginsPanel.navigation.test.ts+++ b/src/components/PluginsPanel.navigation.test.ts@@ -58,6 +58,9 @@ vi.mock("./XCard", () => ({X_CARD_SEARCH: "x twitter treg tweets posts",XCard: () => createElement("div", { "data-x-card": true }, "X (Twitter)"),}));+vi.mock("./EmailCard", () => ({+ EmailCard: () => createElement("div", { "data-email-card": true }, "Email"),+}));vi.mock("./PostizCard", () => ({PostizCard: () => createElement("div", { "data-postiz-card": true }, "Postiz"),}));@@ -74,6 +77,7 @@ const HIGHLEVEL_CONNECTED = 21;const X_CONNECTED = 22;const CATEGORY = 20;const POSTIZ_CONNECTED = 23;+const EMAIL_CONNECTED = 24;const MODE = 4;const SEARCH = 15;const HOSTED_CONNECTED = 18;@@ -233,6 +237,24 @@ describe("Apps pop-up", () => {fixture.overrides.set(SEARCH, "gmail");expect(wrapper(render().nodes).props.className).toBe("hidden");});+ it("shows the email card in the grid for every install and counts it once a mailbox is connected", () => {+ const wrapper = (tree: Node[]) => tree.find((node) => node.props["data-native-card"] === "email")!;+ const { html, nodes: tree } = render();+ expect(nodes(wrapper(tree)).some((node) => node.props.onConnection !== undefined && node.props.refreshKey !== undefined)).toBe(true);+ expect(wrapper(tree).props.className).toBe("contents");+ expect(html).toContain("1 connected");+ fixture.overrides.set(EMAIL_CONNECTED, true);+ expect(render().html).toContain("2 connected");+ fixture.overrides.set(TAB, "connected");+ expect(wrapper(render().nodes).props.className).toBe("contents");+ fixture.overrides.set(EMAIL_CONNECTED, false);+ expect(wrapper(render().nodes).props.className).toBe("hidden");+ fixture.overrides.set(TAB, "marketplace");+ fixture.overrides.set(SEARCH, "imap");+ expect(wrapper(render().nodes).props.className).toBe("contents");+ fixture.overrides.set(SEARCH, "twitter");+ expect(wrapper(render().nodes).props.className).toBe("hidden");+ });it("leaves out the managed install's dead Twitter tile, which the X card replaces, unless it is already connected", () => {const tile = (tree: Node[]) => tree.find((node) => node.props["data-app-tile"] === "twitter");fixture.overrides.set(CARDS, [card("gmail"), card("twitter")]);diff --git a/src/components/PluginsPanel.tsx b/src/components/PluginsPanel.tsxindex de7515f318..013f7d981d 100644--- a/src/components/PluginsPanel.tsx+++ b/src/components/PluginsPanel.tsx@@ -155,9 +155,9 @@ export function PluginsPanel() {const [category, setCategory] = useState<string | null>(null);// Appended after the older state so tests that seed state by call order keep their indices.const [highLevelConnected, setHighLevelConnected] = useState<boolean | null>(null);- const [emailConnected, setEmailConnected] = useState<boolean | null>(null);const [xConnected, setXConnected] = useState<boolean | null>(null);const [postizConnected, setPostizConnected] = useState<boolean | null>(null);+ const [emailConnected, setEmailConnected] = useState<boolean | null>(null);const polls = useRef(new Map<string, () => void>());const statusGenerations = useRef(new Map<string, number>());