Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
The cap's end-to-end test counts only calls that reach the app, and gives its routine a start time
milind-soni11d5819ecb9a
diff --git a/server/trust-controls.e2e.test.ts b/server/trust-controls.e2e.test.tsindex 2548d2c202..11c48b5401 100644--- a/server/trust-controls.e2e.test.ts+++ b/server/trust-controls.e2e.test.ts@@ -384,25 +384,26 @@ it("sends 25 a day at Full access with no sending rule, refuses the 26th, and aconst email = (to: string) => ({ recipient_email: to, subject: "Reminder", body: "See you at nine." });const token = await mint(b.id, b.threadId);const before = relayed.length;- for (let sent = 0; sent < 25; sent++) expect((await relay(token, "GMAIL_SEND_EMAIL", email(`person${sent}@example.test`))).body.result.isError).not.toBe(true);- expect(relayed).toHaveLength(before + 25);+ const sent = () => relayed.slice(before).filter((frame: any) => frame.method === "tools/call").length;+ for (let count = 0; count < 25; count++) expect((await relay(token, "GMAIL_SEND_EMAIL", email(`person${count}@example.test`))).body.result.isError).not.toBe(true);+ expect(sent()).toBe(25);expect((await api("GET", `/api/bots/${b.id}/outbound`)).body.today).toBe(25);const refused = (await relay(token, "GMAIL_SEND_EMAIL", email("[email protected]"))).body.result;expect(refused.isError).toBe(true);expect(refused.content[0].text).toMatch(/did not send this\. Full default cap fixture has reached its daily limit of 25 outbound actions at Full access/);- expect(relayed, "nothing was sent").toHaveLength(before + 25);+ expect(sent(), "nothing was sent").toBe(25);expect((await api("PATCH", `/api/bots/${b.id}`, { modelSelection: { instanceId: "gmailFixture", model: "claude-sonnet-5" }, threadId: b.threadId })).status).toBe(200);writeFileSync(join(fixture.info.dataDir, "gmail-plan.json"), JSON.stringify({ [b.id]: { timeoutMs: 60_000,steps: [{ server: "composio", tool: "GMAIL_SEND_EMAIL", arguments: email("[email protected]"), expectError: true }],reply: "Report: the reminder was not sent, the daily sending limit is reached." } }));- const created = await api("POST", "/api/routines", { name: "Morning reminder", prompt: "Send the morning reminder email to the team.", botId: b.id, schedule: { type: "interval", everyMinutes: 1440 } });+ const created = await api("POST", "/api/routines", { name: "Morning reminder", prompt: "Send the morning reminder email to the team.", botId: b.id, schedule: { type: "interval", everyMinutes: 1440, anchorAt: Date.now() + 86_400_000 } });expect(created.status, JSON.stringify(created.body)).toBe(201);const { run } = (await api("POST", `/api/routines/${created.body.routine.id}/run`)).body;let finished: any;await expect.poll(async () => (finished = (await api("GET", "/api/routines")).body.runs.find((item: any) => item.id === run.id))?.status, { timeout: 45_000 }).toBe("completed");expect(finished.output).toContain("Report: the reminder was not sent");- expect(relayed).toHaveLength(before + 25);+ expect(sent()).toBe(25);const threads = (await api("GET", "/api/bots")).body.bots.find((bot: any) => bot.id === b.id).tasks.map((task: any) => task.threadId);for (const thread of threads) expect((await cards(thread)).filter((row: any) => row.card?.outboundRequest), "no card waits on anyone").toEqual([]);}, 90_000);