Skip to content

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

Let client-scoped users and paired devices save a page

Krishna Dobhal8191d172b527
diff --git a/companion/src/routes.ts b/companion/src/routes.ts
index 54886462cb..6e583d1bba 100644
--- a/companion/src/routes.ts
+++ b/companion/src/routes.ts
@@ -165,7 +165,7 @@ const ALLOWED: ReadonlyArray<{ method: string; path: RegExp }> = [
{ method: "GET", path: /^\/api\/threads\/[\w-]+\/messages\/[\w-]+\/tool$/ },
// An app row's document is transcript data, scoped to its thread. `rpc` reaches only the app's own MCP
// server, under the bot's tool selection and approval rules; `context` is bounded text.
- { method: "GET", path: /^\/api\/threads\/[\w-]+\/messages\/[\w-]+\/app$/ },
+ { method: "GET", path: /^\/api\/threads\/[\w-]+\/messages\/[\w-]+\/app(?:\/download)?$/ },
{ method: "POST", path: /^\/api\/bots\/[\w-]+\/apps\/[\w-]+\/rpc$/ },
{ method: "POST", path: /^\/api\/bots\/[\w-]+\/apps\/[\w-]+\/context$/ },
MESSAGE_FILE_ROUTE,
diff --git a/companion/test/routes.test.ts b/companion/test/routes.test.ts
index 7dc47770bb..b1330b85c2 100644
--- a/companion/test/routes.test.ts
+++ b/companion/test/routes.test.ts
@@ -90,6 +90,7 @@ describe("what the app may do", () => {
["GET", "/api/threads/th_1/messages/msg_2/image"],
["GET", "/api/threads/th_1/messages/msg_2/tool"],
["GET", "/api/threads/th_1/messages/msg_2/app"],
+ ["GET", "/api/threads/th_1/messages/msg_2/app/download"],
["POST", "/api/bots/bot_123/apps/msg_2/rpc"],
["POST", "/api/bots/bot_123/apps/msg_2/context"],
["POST", "/api/threads/th_1/messages/msg_2/file"],
diff --git a/server/request-auth.test.ts b/server/request-auth.test.ts
index e66fbc1ff9..496b77c92e 100644
--- a/server/request-auth.test.ts
+++ b/server/request-auth.test.ts
@@ -144,7 +144,7 @@ describe("scopes", () => {
["POST", "/api/bots/x/sign-in-cards/m/done"], ["POST", "/api/bots/x/sign-in-cards/m/cancel"], ["POST", "/api/bots/x/sign-in-cards/m/save-login"],
["GET", "/api/bots/x/sign-in-cards/m/save-login"],
["GET", "/api/bots/x/browser/live"], ["POST", "/api/bots/x/browser/action"],
- ["GET", "/api/threads/t/messages/m/app"], ["POST", "/api/bots/x/apps/m/rpc"], ["POST", "/api/bots/x/apps/m/context"],
+ ["GET", "/api/threads/t/messages/m/app"], ["GET", "/api/threads/t/messages/m/app/download"], ["POST", "/api/bots/x/apps/m/rpc"], ["POST", "/api/bots/x/apps/m/context"],
["POST", "/api/bots/x/queue/q/steer"], ["POST", "/api/groups/g/queue/q/steer"],
] as const) expect(requiredScope(method, path), `${method} ${path}`).toBe("client");
for (const [method, path] of [
diff --git a/server/request-auth.ts b/server/request-auth.ts
index de6a89e7c0..8ac28360c8 100644
--- a/server/request-auth.ts
+++ b/server/request-auth.ts
@@ -311,7 +311,7 @@ export const CLIENT_ALLOW: ReadonlyArray<{ methods: readonly string[]; path: Reg
{ methods: ["GET"], path: /^\/api\/threads\/[\w-]+\/messages\/[\w-]+\/image$/ },
{ methods: ["GET"], path: /^\/api\/threads\/[\w-]+\/messages\/[\w-]+\/tool$/ },
// an app row's document is transcript data, read under the transcript's rules
- { methods: ["GET"], path: /^\/api\/threads\/[\w-]+\/messages\/[\w-]+\/app$/ },
+ { methods: ["GET"], path: /^\/api\/threads\/[\w-]+\/messages\/[\w-]+\/app(?:\/download)?$/ },
{ methods: ["GET"], path: /^\/api\/threads\/[\w-]+\/export$/ },
{ methods: ["GET"], path: /^\/api\/threads\/[\w-]+\/evidence(?:\.tar|\/[A-Za-z0-9-]{8,64}\/step-\d{6,12}\.jpg)?$/ },
{ methods: ["GET", "POST"], path: /^\/api\/threads\/[\w-]+\/messages\/[\w-]+\/file$/ },