Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
Team: a new member's first bot list shows their own MausBot whole
milind-soni9b0c7bbac985
diff --git a/server/cloud-team-first-look.e2e.test.ts b/server/cloud-team-first-look.e2e.test.tsnew file mode 100644index 0000000000..c48f657aa7--- /dev/null+++ b/server/cloud-team-first-look.e2e.test.ts@@ -0,0 +1,32 @@+// A new member's first look at a Team Cloud: the list that makes their own MausBot shows it whole, its main chat+// included, the first time. Disposable homes and a synthetic Claude CLI; nothing leaves this machine.+import { randomBytes } from "node:crypto";+import { afterAll, beforeAll, expect, it } from "vitest";++import { launchCloudSendFixture, type CloudSendFixture, type CloudTeamFixture } from "../scripts/testing/cloud-send-fixture.ts";+import { hostTimeout } from "./testing/host-timeout.ts";++type Bot = { id: string; threadId?: string; mainThreadId?: string; defaultBot?: { person?: string }; tasks?: Array<{ threadId: string }>; messages?: Array<{ text?: string }> };++let fx: CloudSendFixture, team: CloudTeamFixture;++beforeAll(async () => {+ fx = await launchCloudSendFixture({ onePasswordToken: `ops_fake-team-${randomBytes(8).toString("hex")}`, team: { id: "team-acme-7", name: "Acme", engine: "" } });+ team = fx.team!;+}, hostTimeout(120_000));++afterAll(async () => {+ await fx?.close();+});++it("the first list a new member asks for shows their own MausBot with its main chat and its hello", async () => {+ const mira = (await team.pair({ email: "[email protected]", role: "member" })).token!;+ const first = await team.as(mira, "GET", "/api/bots?messages=20");+ expect(first.status).toBe(200);+ const own = (first.body.bots as Bot[]).find((bot) => bot.defaultBot?.person === "[email protected]");+ expect(own, "their own MausBot is in the first list").toBeDefined();+ expect(own!.threadId).toBeTruthy();+ expect(own!.tasks?.map((task) => task.threadId)).toContain(own!.threadId);+ expect(own!.messages?.length, "its hello is there").toBeGreaterThan(0);+ expect((await team.as(mira, "GET", `/api/threads/${own!.threadId}/messages?limit=5`)).status).toBe(200);+}, hostTimeout(60_000));diff --git a/server/index.ts b/server/index.tsindex 138529fcba..7410f196cc 100644--- a/server/index.ts+++ b/server/index.ts@@ -12895,8 +12895,8 @@ const handleRequest = async (req: IncomingMessage, res: ServerResponse) => {const subject = visible.everything ? null : pathSubject(path);const hidden = subject && !subjectVisible(subject, visible) ? notFoundFor(subject) : hiddenThreadRefusal(req, path, url.searchParams, visible, (botId) => store.bot(botId)?.threadId);if (hidden) return json(res, 404, { error: hidden }); const refused = botAccess.accessRefusal(req, auth, method, path, visible); if (refused) return json(res, 403, { error: refused });- // Every bot a member is sent (on a Team Cloud an admin's too) comes narrowed to what they may see (memberBot).- if (viewer.kind === "member" || visible.filtersThreads) onJsonBody(res, (body) => memberBody(body, visible));+ // Every bot a member is sent (on a Team Cloud an admin's too) comes narrowed to what they may see once the request is done (memberBot).+ if (viewer.kind === "member" || visible.filtersThreads) onJsonBody(res, (body) => memberBody(body, visibleTo(viewer)));beginAdminAudit(req, res, method, path, auth);if (method === "POST" && path === "/api/workspace-backup/restore" && teamComputers.list().some(computer => computer.section !== null)) {