Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

fix(rooms): include connected apps composio prompt in room member turns

Prit Patel49b9ec2b526a
diff --git a/server/connected-app-tools.e2e.test.ts b/server/connected-app-tools.e2e.test.ts
index 9c137526f0..fe45b321a9 100644
--- a/server/connected-app-tools.e2e.test.ts
+++ b/server/connected-app-tools.e2e.test.ts
@@ -190,3 +190,42 @@ it("a bot's Google Drive upload of a file in its working folder reaches Composio
rmSync(scratch, { recursive: true, force: true });
}
}, 120_000);
+
+it("a bot in a room receives the composio connected apps instructions and connector scopes", async () => {
+ const apps = await startFakeConnectedApps();
+ apps.connected = { gmail: true };
+ const scratch = mkdtempSync(join(tmpdir(), "omb-app-tools-"));
+ const gate = join(scratch, "finish");
+ const fixture = await launchVerificationServer({
+ ...process.env, OMB_COMPOSIO_BROKER_URL: apps.url, OMB_COMPOSIO_BROKER_TOKEN: apps.token,
+ FAKE_CLAUDE_MODE: "slow", FAKE_CLAUDE_SLOW_FINISH_GATE: gate,
+ });
+ const api = apiOn(fixture.info.url);
+ try {
+ const bot = (await api("POST", "/api/bots", { name: "RoomBot" }, 201)).bot;
+ await api("PATCH", `/api/bots/${bot.id}`, { composio: true, connectorTools: { gmail: { tools: "*" } }, connectorScopes: { apps: { gmail: "read" } } });
+ const channel = (await api("POST", "/api/groups", {
+ name: "App room",
+ memberIds: [bot.id],
+ setup: { bulletin: "", defaultResponder: { kind: "mentions" } },
+ }, 201)).group;
+
+ await api("POST", `/api/groups/${channel.id}/messages`, { text: "@RoomBot check inbox" }, 202);
+ let dump: any;
+ await expect.poll(() => {
+ try { dump = JSON.parse(readFileSync(fixture.fixtureDumpPath, "utf8")); } catch { return false; }
+ return Boolean(dump.systemPrompt);
+ }, { timeout: 20_000 }).toBe(true);
+
+ const system = String(dump.systemPrompt ?? "");
+ expect(system).toContain("gmail.search_emails");
+ expect(system).toContain("This bot may use only these connected apps: gmail (read only)");
+ expect(system).toContain("COMPOSIO_SEARCH_TOOLS");
+ writeFileSync(gate, "");
+ } finally {
+ await fixture.close();
+ await apps.close();
+ rmSync(scratch, { recursive: true, force: true });
+ }
+}, 120_000);
+
diff --git a/server/index.ts b/server/index.ts
index a91036467f..32dd56f5e5 100644
--- a/server/index.ts
+++ b/server/index.ts
@@ -10026,7 +10026,7 @@ async function runClaimedGroupMemberTurn(
{ id: "computer", label: "Computer", text: computerPrompt(roomComputerPromptKind) },
{ id: "team-computer", label: "Team computer", text: teamComputerPrompt(roomTeamComputer) },
{ id: "plan", label: "Surface", text: surfacePrompt({ computer: roomTeamComputer ? "cloud" : roomVmTarget ? "vm" : surfaceOfComputerKind(roomComputerKind), browser: Boolean(integrations.browser) }, { note: roomPlan.note, cloudHome: Boolean(CLOUD_HOME), ownComputer: CLOUD_HOME && integrations.agents && lendingEnabled() ? sharedComputers.known(CLOUD_HOME_LENDER) : undefined }) },
- { id: "cloud-home", label: "My Cloud", text: CLOUD_HOME ? cloudHomePrompt(Boolean(integrations.agents) && lendingEnabled(), syncedFolders(DATA_DIR), sharedComputers.known(CLOUD_HOME_LENDER), CLOUD_PERSONAL) : "" }, phoneLinkPart(),
+ { id: "cloud-home", label: "My Cloud", text: CLOUD_HOME ? cloudHomePrompt(Boolean(integrations.agents) && lendingEnabled(), syncedFolders(DATA_DIR), sharedComputers.known(CLOUD_HOME_LENDER), CLOUD_PERSONAL) : "" }, phoneLinkPart(), { id: "composio", label: "Connected apps", text: integrations.composio ? composioSystemPrompt(readyBot.connectorTools) + describeConnectorScopes(readyBot.connectorScopes) : "" },
{ id: "browser", label: "Browser", text: integrations.browser ? browserPromptFor(bot, Boolean(integrations.agents)) : "" },
{ id: "data", label: "Data", text: integrations.data ? dataPrompt(readyBot.id, threadId, `${roomContext}\n${latestUser?.text ?? ""}`) : "" },
{ id: "email", label: "Email", text: instance.adapter.capabilities.emailMcp === true ? emailHost.prompt(readyBot) : "" }, toolsOffPart(readyBot),