Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
Tell bots a Cloud is off the person's network (#5108)
Milind Soniff0ca1c7aac0
diff --git a/server/system-prompt.test.ts b/server/system-prompt.test.tsindex 11ae876164..e36e73ba2a 100644--- a/server/system-prompt.test.ts+++ b/server/system-prompt.test.ts@@ -382,6 +382,18 @@ describe("composioSystemPrompt", () => {});describe("cloudHomePrompt", () => {+ it("says the Cloud is off their network, whatever memory says, and sends ssh through the lent computer", () => {+ const lent = cloudHomePrompt(true, [], [{ name: "ASH-PC", platform: "win32" }]);+ expect(lent).toContain("This Cloud is not on their network");+ expect(lent).toContain("100.x.x.x, *.ts.net");+ expect(lent).toContain("even when your memory or notes give the address");+ expect(lent).toContain("run the command (ssh too) on their PC (ASH-PC) with shared_computer's run_command, and never from a shell here");+ expect(lent).toContain("without their SSH agent");+ const none = cloudHomePrompt(false, [], [{ name: "ASH-PC", platform: "win32" }]);+ expect(none).toContain("This Cloud is not on their network");+ expect(none).toContain("say so in one sentence");+ expect(none).not.toMatch(/run_command|shared_computer/u);+ });it("says the bot runs in the cloud, offers what works there, and never asks for a place that cannot exist", () => {for (const tools of [true, false]) {const text = cloudHomePrompt(tools);diff --git a/server/system-prompt.ts b/server/system-prompt.tsindex d807fda02b..62c8fa7245 100644--- a/server/system-prompt.ts+++ b/server/system-prompt.ts@@ -188,12 +188,19 @@ export function cloudHomePrompt(sharedComputerTools: boolean, synced: ReadonlyAr? ` If they ask for something on ${theirs}, check list_shared_computers: a computer they share with the Cloud is reachable through shared_computer, within the folders and apps it allows.${unavailable}${device === "computer" ? " Call it their computer: never assume it is a Mac." : ` It is a ${device}: call it that, never a Mac unless it is one.`}`+ ` While that ${device} is away, each folder it lends that the Cloud keeps a copy of still works from that copy: list_shared_computers lists them under away_computers (copy null means a folder only on the ${device}), every read says how fresh the copy is, and a write to a folder lent with editing is saved here and reaches the ${device} when it's on (tell them so in a few words). A file or folder that isn't in the copy is only on the ${device}: say you'll get it when it's on.`: ` You cannot see or use ${theirs}, its screen or its files from here. If they ask for something on it, say so in one sentence.`)+ + offTheirNetwork(sharedComputerTools, theirs)+ (asks ? " For work that doesn't need their own computer, use what works here:" : " Offer what works here:")+ " the built-in browser and their cloud computer, a desktop in the cloud. Call it their cloud computer, as the app does. Never ask them to set up this computer or a Local VM; neither exists here."+ CLOUD_ENGINES_HERE+ syncedFoldersPrompt(synced);}+function offTheirNetwork(sharedComputerTools: boolean, theirs: string): string {+ const facts = " This Cloud is not on their network: a Tailscale name or address (100.x.x.x, *.ts.net), a home or office LAN address, or an SSH host that works from their own computer does not work from here, even when your memory or notes give the address.";+ if (!sharedComputerTools) return `${facts} If they ask for something that needs one, say so in one sentence.`;+ return `${facts} To reach one, run the command (ssh too) on ${theirs} with shared_computer's run_command, and never from a shell here. It runs there without their SSH agent, so a key that needs the agent fails on sign-in: if it does, say so in one sentence instead of trying other keys.`;+}+function syncedFoldersPrompt(synced: ReadonlyArray<{ computerName: string; pcPath: string; cloudPath: string }>): string {if (!synced.length) return "";// eslint-disable-next-line no-control-regex