Skip to content

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

fix(surface): lent-computer line drops the no-screen wording; only computers still lent

AdityaUmale04c42b319878
diff --git a/server/index.ts b/server/index.ts
index 124222eabc..72e82e8d2d 100644
--- a/server/index.ts
+++ b/server/index.ts
@@ -887,7 +887,7 @@ function sharedComputerPrincipal(capability: Pick<InternalCapability, "botId" |
if (CLOUD_HOME) return cloudLendingRefusal(capability) === null ? CLOUD_HOME_LENDER : null;
return lendingPerson(provenRequestPerson(directRequestOwners.get(capability.threadId), capability.generation,
(messageId) => linePersonKey(store.messagesFor(capability.threadId).find((message) => message.id === messageId))), ownHome.ownServer(), () => sessions.list());
-} /** On a self-hosted server, the computers lent to it by the person this turn provably acts for. */ function lentToServer(agents: unknown, turn: Pick<InternalCapability, "botId" | "threadId" | "generation">) { return CLOUD_HOME || CLOUD_TEAM || DESKTOP_MANAGED || !agents || !botLending() ? undefined : sharedComputers.known(sharedComputerPrincipal(turn)); }
+} /** On a self-hosted server, the computers lent to it by the person this turn provably acts for. */ function lentToServer(agents: unknown, turn: Pick<InternalCapability, "botId" | "threadId" | "generation">) { return CLOUD_HOME || CLOUD_TEAM || DESKTOP_MANAGED || !agents || !botLending() ? undefined : sharedComputers.known(sharedComputerPrincipal(turn)).filter((computer) => computer.lent); }
/** The only conversations that may feed a bot's memory, daily log, recall or brief; dropped whenever a session is revoked. */
const ownerOnlyCache = new Map<string, { length: number; last?: string; owner: boolean }>();
@@ -10057,7 +10057,7 @@ async function runClaimedGroupMemberTurn(
{ id: "mcp", label: "MCP servers", text: customMcpPrompt(Object.keys(integrations.custom ?? {}), mcpServersHost.off(bot)) + teamConnections.prompt(threadId, internalGeneration, integrations) },
{ 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, lentToServer: lentToServer(integrations.agents, { botId: bot.id, threadId, generation: internalGeneration }) }) },
+ { 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: "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 ?? ""}`) : "" },
diff --git a/server/surface.test.ts b/server/surface.test.ts
index 2a57425cfe..e662e91696 100644
--- a/server/surface.test.ts
+++ b/server/surface.test.ts
@@ -440,6 +440,11 @@ describe("surfacePrompt", () => {
expect(surfacePrompt(mounted, { ...opts, lentToServer: [] })).toBe(surfacePrompt(mounted, opts));
expect(surfacePrompt(mounted, { ...opts, cloudHome: true, lentToServer: lent })).toBe(surfacePrompt(mounted, { ...opts, cloudHome: true }));
}
+ // Nothing mounted: the lent computer is still reachable, so the paragraph never says no screen can be reached.
+ const none = surfacePrompt({ computer: null, browser: false }, { lentToServer: lent });
+ expect(none).not.toContain("You cannot open apps, click, or inspect a screen through OpenMausBot.");
+ expect(none).toContain("No place's tools can open apps, click, or inspect a screen this turn.");
+ expect(surfacePrompt({ computer: "local", browser: false }, { lentToServer: lent })).toContain("Their Mac (Studio) is reached only through shared_computer");
});
});
diff --git a/server/surface.ts b/server/surface.ts
index 5da857c59b..36f64da8c0 100644
--- a/server/surface.ts
+++ b/server/surface.ts
@@ -338,7 +338,10 @@ export function surfacePrompt(
for (const [nowhere, places] of OWN_COMPUTER_WORDING) text = text.replace(nowhere, places);
text = text.replace(UNREACHABLE_OWN, `${theirComputer(opts.ownComputer).theirs} is not one of these places`) + ownComputerSentence(opts.ownComputer, computer);
}
- if (!opts.cloudHome && opts.lentToServer?.length) text += ownComputerSentence(opts.lentToServer, computer);
+ if (!opts.cloudHome && opts.lentToServer?.length) {
+ for (const [nowhere, places] of OWN_COMPUTER_WORDING) text = text.replace(nowhere, places);
+ text += ownComputerSentence(opts.lentToServer, computer);
+ }
if (opts.thisComputer && !opts.cloudHome && !reportBack && mounted.computer !== "local") {
text += ownFilesSentence(opts.thisComputer, mounted.computer, Boolean(opts.canSelect));
}