Skip to content

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

Say what stays behind when the bots move to My Cloud, and carry uvx connectors

milind-sonie542c39f6e8b
diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml
index dfa2506adc..181a593af0 100644
--- a/.github/workflows/docker.yml
+++ b/.github/workflows/docker.yml
@@ -364,7 +364,7 @@ jobs:
docker save omb-cloud-home:ci -o "$RUNNER_TEMP/home.tar"
python3 - "$RUNNER_TEMP/server.tar" "$RUNNER_TEMP/home.tar" <<'PY'
import json, re, sys, tarfile
- cache = re.compile(r"^(root/\.npm|tmp/(npm-cache|omb-build-home|node-compile-cache|grok-install))/")
+ cache = re.compile(r"^(root/\.npm|tmp/(npm-cache|omb-build-home|node-compile-cache|grok-install|uv-install))/")
for path in sys.argv[1:]:
files = {}
with tarfile.open(path) as image:
diff --git a/Dockerfile b/Dockerfile
index f429fbb563..17ba3ff51d 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -124,12 +124,21 @@ FROM runtime AS cloud-home
# runs every bot turn in its own namespaces, socat bridges a box's loopback
# ports to the server's gates. Their own layer, so the Chrome layers beneath
# stay cached. pnpm, so a bot's shell can install what its project asks for.
+# uv and uvx, so a connector someone runs with uvx comes along when they move here
+# (server/cloud-connections.ts) as an npx one does: about 32 MB, on every user's
+# PATH and out of the volume. What it downloads lives in the volume's cache.
+ARG UV_VERSION=0.13.4
+ARG TARGETARCH
RUN apt-get update \
&& apt-get install -y --no-install-recommends python3 poppler-utils unzip bubblewrap socat \
&& rm -rf /var/lib/apt/lists/* \
&& HOME=/tmp/omb-build-home npm install -g [email protected] \
- && bwrap --version && socat -V | head -1 && HOME=/tmp/omb-build-home pnpm --version \
- && rm -rf /tmp/omb-build-home /tmp/node-compile-cache
+ && uv_arch=x86_64 && if [ "$TARGETARCH" = arm64 ]; then uv_arch=aarch64; fi \
+ && mkdir -p /tmp/uv-install \
+ && curl -fsSL "https://github.com/astral-sh/uv/releases/download/${UV_VERSION}/uv-${uv_arch}-unknown-linux-gnu.tar.gz" | tar -xz -C /tmp/uv-install --strip-components=1 \
+ && install -m 0755 /tmp/uv-install/uv /tmp/uv-install/uvx /usr/local/bin/ \
+ && bwrap --version && socat -V | head -1 && HOME=/tmp/omb-build-home pnpm --version && uv --version | grep -qF "uv ${UV_VERSION}" \
+ && rm -rf /tmp/omb-build-home /tmp/uv-install /tmp/node-compile-cache
# Caddy and Grok are pinned, so they sit beneath the engines, which change
# more often.
COPY --from=edge /caddy /usr/local/bin/caddy
diff --git a/electron/cloud-connections.d.mts b/electron/cloud-connections.d.mts
index ec40550869..7799217528 100644
--- a/electron/cloud-connections.d.mts
+++ b/electron/cloud-connections.d.mts
@@ -34,7 +34,7 @@ export interface HeldSignIn { id: string; label: string; digest: string }
export interface ConnectionsMoved {
moved: Array<{ id: string; label: string }>;
- runsHere: Array<{ id: string; label: string; needs?: string }>;
+ runsHere: Array<{ id: string; label: string; needs?: string; off?: true }>;
kept: Array<{ id: string; label: string }>;
missing: Array<{ slug: string }>;
failed: Array<{ id: string; label: string; message: string; final: boolean }>;
diff --git a/electron/cloud-connections.mjs b/electron/cloud-connections.mjs
index fabf986665..a5c63d34d9 100644
--- a/electron/cloud-connections.mjs
+++ b/electron/cloud-connections.mjs
@@ -153,7 +153,7 @@ export async function adoptComposioId(target, { local, here, there, managedApps
* With `signIns: false`, a sign-in that refreshes itself stays here for a later pass (`later`), and the rest goes.
*
* Returns { moved, runsHere, kept, missing, failed, release, later, held }: what My Cloud has now; what went marked as
- * running here (`needs`: a program My Cloud lacks); what My Cloud kept of its own (its own sign-in, its own connected
+ * running here (`needs`: a program My Cloud lacks; `off`: it was switched off here too); what My Cloud kept of its own (its own sign-in, its own connected
* apps); the connected apps of this computer's that My Cloud then lacks; what failed (`final`: trying again can't fix
* it); the sign-ins My Cloud took that this computer still holds; the sign-ins left for a later pass; and the keys a
* trial's Cloud keeps unused while its Claude credit lasts.
@@ -202,7 +202,7 @@ export async function sendConnections(collected, target, { local, release = true
if (saved.ok && enabled === true) saved = await target.call("PATCH", `/api/mcp/servers/${name}`, { enabled: true });
}
if (!saved.ok) throw refused(saved, `My Cloud did not take ${item.label}.`);
- if (runsOn) return void result.runsHere.push({ id: item.id, label: item.label, ...(missing && !item.runsHere && !record(marked) ? { needs: missing } : {}) });
+ if (runsOn) return void result.runsHere.push({ id: item.id, label: item.label, ...(missing && !item.runsHere && !record(marked) ? { needs: missing } : {}), ...(enabled === true ? {} : { off: true }) });
done(item);
if (record(signIn)) {
if (!digest) throw new ConnectionMoveError("local", `${item.label}'s sign-in could not be read on this computer.`);
diff --git a/electron/cloud-connections.node-test.mjs b/electron/cloud-connections.node-test.mjs
index 946732356e..e4ba51088f 100644
--- a/electron/cloud-connections.node-test.mjs
+++ b/electron/cloud-connections.node-test.mjs
@@ -115,7 +115,7 @@ test("a server that needs this computer goes marked as running on it, and a serv
assert.deepEqual(added, [["notes", COMPUTER], ["fetch", COMPUTER], ["lent", { environmentId: "env-other", label: "Studio iMac" }]]);
assert.deepEqual(body("/api/mcp/servers/docs"), { type: "http", url: "https://docs.example/mcp", headers: {}, enabled: true, runsOn: null });
assert.equal(target.calls.some(([method, route]) => method === "PATCH" && route === "/api/mcp/servers/fetch"), false, "a server switched off here stays off there");
- assert.deepEqual(result.runsHere, [{ id: "mcp:notes", label: "notes" }, { id: "mcp:fetch", label: "fetch", needs: "uvx" }, { id: "mcp:lent", label: "lent" }]);
+ assert.deepEqual(result.runsHere, [{ id: "mcp:notes", label: "notes" }, { id: "mcp:fetch", label: "fetch", needs: "uvx", off: true }, { id: "mcp:lent", label: "lent" }]);
assert.deepEqual(result.moved.map((item) => item.id), ["mcp:docs"]);
});
diff --git a/electron/cloud-send.mjs b/electron/cloud-send.mjs
index e6cc6e5b97..7577f2ffcf 100644
--- a/electron/cloud-send.mjs
+++ b/electron/cloud-send.mjs
@@ -461,6 +461,7 @@ export function createCloudSend({ local, cloud, handoff, store, onChange = () =>
result.connections += moved.moved.length + moved.runsHere.length;
for (const failure of moved.failed) failed(failure.id, failure.label, failure.message, failure.final);
for (const held of moved.held ?? []) result.notes.push({ kind: "held", connection: held.label });
+ for (const stayed of moved.runsHere) if (!stayed.off) result.notes.push({ kind: "stayed", connection: stayed.label, ...(stayed.needs ? { needs: stayed.needs } : {}) });
if (moved.release.length) {
kept.release = [...kept.release.filter((held) => !moved.release.some((next) => next.id === held.id)), ...moved.release];
persist();
diff --git a/electron/one-home.d.mts b/electron/one-home.d.mts
index 70cb3269ce..4101001101 100644
--- a/electron/one-home.d.mts
+++ b/electron/one-home.d.mts
@@ -4,6 +4,8 @@ export type OneHomeView = OneHomePhase & { place?: string };
/** Something a move could not carry, by its name, and why. */
export type OneHomeNotCarried = { label: string; error: string };
export type OneHomeFailing = { error: string | null; items?: OneHomeNotCarried[] };
+/** A connector that stayed on this computer. */
+export type OneHomeStayed = { name: string; needs?: string };
type OneHomePhase =
/** `chats`: conversations gone of those to go; `failing`: it has failed for a day, or its check found things missing pass
* after pass, with why and what did not go; `updating`: My Cloud is too old
@@ -13,8 +15,8 @@ type OneHomePhase =
* neither while it waits for a quiet moment or has not asked yet. */
| { phase: "wait"; waitingFor?: string; waitingWhat?: "bot" | "room" | "sign-in"; failing?: OneHomeFailing }
| { phase: "finishing"; failing?: OneHomeFailing }
- /** What arrived, checked on both sides; `at`: when the move was done; `phone`: a phone was paired with this computer; `held`: keys a trial's Cloud keeps unused while its Claude credit lasts; `left`: what My Cloud refused for good, which stayed where it was. */
- | { phase: "done"; at?: number; counts?: OneHomeCounts; phone: boolean; held: string[]; left?: OneHomeNotCarried[] }
+ /** What arrived, checked on both sides; `at`: when the move was done; `phone`: a phone was paired with this computer; `held`: keys a trial's Cloud keeps unused while its Claude credit lasts; `left`: what My Cloud refused for good, which stayed where it was; `stayed`: connectors that work only on this computer (`needs`: a program My Cloud lacks). */
+ | { phase: "done"; at?: number; counts?: OneHomeCounts; phone: boolean; held: string[]; left?: OneHomeNotCarried[]; stayed?: OneHomeStayed[] }
/** This computer's bots are on their way home from a My Cloud that goes on, because the person keeps them here;
* `updating`: My Cloud is too old to stop their automations and updates first. */
| { phase: "keeping"; updating?: true }
diff --git a/electron/one-home.mjs b/electron/one-home.mjs
index 2bf8b609c1..33119044ba 100644
--- a/electron/one-home.mjs
+++ b/electron/one-home.mjs
@@ -214,7 +214,7 @@ export function createOneHome(deps) {
const journal = read();
if (!journal || journal.paused || (journal.told && journal.phase !== "keeping")) return null;
if (journal.phase === "done") return { phase: "done", ...(Number.isSafeInteger(journal.doneAt) ? { at: journal.doneAt } : {}), ...(journal.counts ? { counts: journal.counts } : {}), phone: journal.phone === true, held: journal.held ?? [],
- ...(journal.left?.length ? { left: journal.left } : {}) };
+ ...(journal.left?.length ? { left: journal.left } : {}), ...(journal.stayed?.length ? { stayed: journal.stayed } : {}) };
if (journal.phase === "keeping") return { phase: "keeping", ...(journal.updating ? { updating: true } : {}) };
if (journal.phase === "home-again" || journal.phase === "back") {
return { phase: journal.phase, ...(journal.lost ? { lost: true } : {}), ...(journal.elsewhere ? { elsewhere: journal.elsewhere } : {}), ...(journal.kept ? { kept: true } : {}),
@@ -358,7 +358,9 @@ export function createOneHome(deps) {
const sent = deps.send.snapshot?.();
const held = (sent?.whole?.result?.notes ?? []).filter((note) => note?.kind === "held" && typeof note.connection === "string").map((note) => note.connection);
const left = notCarried(sent, true);
- const done = write({ ...journal, phase: "done", switched, doneAt: now(), version: deps.version ?? null, phone: deps.phone?.paired() === true, held, ...(left.length ? { left } : {}),
+ const stayed = (sent?.whole?.result?.notes ?? []).filter((note) => note?.kind === "stayed" && typeof note.connection === "string").slice(0, NAMED_MAX)
+ .map((note) => ({ name: note.connection, ...(typeof note.needs === "string" ? { needs: note.needs } : {}) }));
+ const done = write({ ...journal, phase: "done", switched, doneAt: now(), version: deps.version ?? null, phone: deps.phone?.paired() === true, held, ...(left.length ? { left } : {}), ...(stayed.length ? { stayed } : {}),
error: undefined, failingSince: undefined, retryAt: undefined, tries: undefined, failure: undefined });
await settle(done);
deps.openHome?.();
diff --git a/electron/one-home.node-test.mjs b/electron/one-home.node-test.mjs
index 7069dac39c..6bfbbed1db 100644
--- a/electron/one-home.node-test.mjs
+++ b/electron/one-home.node-test.mjs
@@ -44,7 +44,7 @@ function world({ cloud = {}, switches = { "routine:r1": true, "routine:r2": fals
},
async check() { w.checked++; return { ok: checks.shift() ?? true }; },
switches: () => switches,
- snapshot: () => ({ running: w.running ?? null, whole: { result: { notes: [{ kind: "held", connection: "OpenRouter" }], failed: w.failed ?? [] } } }),
+ snapshot: () => ({ running: w.running ?? null, whole: { result: { notes: w.notes ?? [{ kind: "held", connection: "OpenRouter" }], failed: w.failed ?? [] } } }),
},
local: {
async freeze() {
@@ -203,6 +203,17 @@ test("a check that still finds things missing after three passes says so at once
{ label: "Reply to email", error: "This app automation stays on the computer it came from." }] } });
});
+test("a move done while a connector stayed on this computer names it on the done line, with what it needs", async () => {
+ const w = world();
+ w.notes = [{ kind: "stayed", connection: "fetch", needs: "uvx" }, { kind: "stayed", connection: "easy" }, { kind: "held", connection: "OpenRouter" }];
+ await w.home.kick();
+ assert.equal(w.journal.phase, "done");
+ assert.deepEqual(w.home.view().stayed, [{ name: "fetch", needs: "uvx" }, { name: "easy" }]);
+ assert.deepEqual(w.home.view().held, ["OpenRouter"]);
+ w.notes = [];
+ assert.deepEqual(w.home.view().stayed, [{ name: "fetch", needs: "uvx" }, { name: "easy" }], "kept with the move, not read again");
+});
+
test("a move done without what My Cloud refused for good names it on the done line", async () => {
const w = world();
w.failed = [{ key: "app-event:e1", kind: "app-event", label: "Reply to email", error: "This app automation stays on the computer it came from.", final: true }];
diff --git a/scripts/docker-image.test.ts b/scripts/docker-image.test.ts
index 3a565ac94b..8ae999f3ea 100644
--- a/scripts/docker-image.test.ts
+++ b/scripts/docker-image.test.ts
@@ -136,7 +136,7 @@ describe("container images", () => {
const cache = new RegExp(/cache = re\.compile\(r"(.*)"\)/.exec(scan)![1]);
const removed = shipped().flatMap(step => [...step.args.matchAll(/\brm -rf ([^;&|]+)/g)].flatMap(match => match[1].trim().split(/\s+/)));
const throwaway = [...new Set(removed.filter(path => path.startsWith("/tmp/")))].sort();
- expect(throwaway).toEqual(["/tmp/grok-install", "/tmp/node-compile-cache", "/tmp/npm-cache", "/tmp/omb-build-home"]);
+ expect(throwaway).toEqual(["/tmp/grok-install", "/tmp/node-compile-cache", "/tmp/npm-cache", "/tmp/omb-build-home", "/tmp/uv-install"]);
for (const path of throwaway) expect(cache.test(`${path.slice(1)}/leftover`), path).toBe(true);
expect(scan).toContain('grok = files["usr/local/bin/grok"]');
});
diff --git a/server/cloud-connections-host.ts b/server/cloud-connections-host.ts
index ff893857c1..96acfbef58 100644
--- a/server/cloud-connections-host.ts
+++ b/server/cloud-connections-host.ts
@@ -2,9 +2,11 @@
// (routes/cloud-connections.ts), the private port's answers to the desktop's main process (login-handoff.ts), and what
// a bot on My Cloud is told about connections that need the person there (cloud-connections-prompt.ts).
import { hostname } from "node:os";
+import { join } from "node:path";
import { answerConnection, connectionFingerprints, highlevelDigest, launchersOnPath, listConnections, releaseConnection, signInDigest } from "./cloud-connections.ts";
import { createConnectionPrompt, type ConnectionPromptBot } from "./cloud-connections-prompt.ts";
+import { createStayedNotices, type StayedNoticesDeps } from "./cloud-connections-stayed.ts";
import { movedFrom } from "./cloud-send-arrived.ts";
import * as composio from "./composio.ts";
import { brokerAccess } from "./composio-broker-access.ts";
@@ -34,6 +36,8 @@ export interface CloudConnectionsHostDeps {
heldKeys?: { hold(engines: readonly string[]): boolean } | null;
/** This server's data folder, where a Cloud home keeps the computer its bots moved from. */
dataDir?: string;
+ /** How the person hears what stayed on their computer; a Cloud home only. */
+ stayedNotices?: Pick<StayedNoticesDeps, "bots" | "say" | "notify" | "language">;
}
const managedService = (): boolean => { try { return brokerAccess() !== null; } catch { return false; } };
@@ -46,8 +50,10 @@ export function createCloudConnectionsHost(deps: CloudConnectionsHostDeps) {
const sources = () => ({ config: deps.config(), mcpSignIn: (name: string, url: string) => deps.mcpOAuth.signInRecord(name, url), highlevel: () => deps.highlevel.store.get() });
const composioConnected = async (slugs: string[]) =>
Object.fromEntries(Object.entries(await composio.connectionStatus(deps.config(), slugs)).map(([slug, state]) => [slug, state.connected]));
- const prompt = deps.cloudHome ? createConnectionPrompt({ mcpServers: () => deps.config().mcpServers, mcpAuth,
+ const programs = () => (commands ??= launchersOnPath());
+ const prompt = deps.cloudHome ? createConnectionPrompt({ mcpServers: () => deps.config().mcpServers, mcpAuth, programs,
highlevelConnected: () => deps.highlevel.connected(), composioConnected, movedFrom: () => (deps.dataDir ? movedFrom(deps.dataDir)?.computer ?? null : null) }, deps.cloudHome.publicOrigin) : null;
+ const stayed = deps.cloudHome && deps.dataDir && deps.stayedNotices ? createStayedNotices({ ...deps.stayedNotices, file: join(deps.dataDir, "connectors-stayed-told.json"), servers: () => deps.config().mcpServers, programs }) : null;
const connections = async () => {
const cfg = deps.config();
return listConnections({ config: cfg, mcpAuth, composio: await composioIdentity(cfg).catch(() => null), highlevel: () => deps.highlevel.store.get() });
@@ -61,7 +67,7 @@ export function createCloudConnectionsHost(deps: CloudConnectionsHostDeps) {
...(deps.ownHome ? { ownHome: deps.ownHome } : {}),
...(deps.cloudHome?.team ? { personalRefusal: (what: string) => personalConnectionRefusal(deps.cloudHome!.team!, what) } : {}),
async list() {
- return { computer, connections: await connections(), engines: await deps.engines().catch((): string[] => []), commands: commands ??= launchersOnPath(),
+ return { computer, connections: await connections(), engines: await deps.engines().catch((): string[] => []), commands: programs(),
...(deps.cloudHome === null && !managedService() ? { managedApps: false as const } : {}) };
},
adoptShare: adoptComposioShare,
@@ -93,5 +99,8 @@ export function createCloudConnectionsHost(deps: CloudConnectionsHostDeps) {
},
prompt: (bot: ConnectionPromptBot): string => prompt?.(bot) ?? "",
+ /** What stayed on the person's computer: said when the move ends, and in the first conversation with each bot. */
+ moved: (language?: string): void => stayed?.moved(language),
+ personTurn: (bot: Parameters<NonNullable<typeof stayed>["personTurn"]>[0], threadId: string): void => stayed?.personTurn(bot, threadId),
};
}
diff --git a/server/cloud-connections-prompt.test.ts b/server/cloud-connections-prompt.test.ts
index 8ca9340fc6..6dc1b5b401 100644
--- a/server/cloud-connections-prompt.test.ts
+++ b/server/cloud-connections-prompt.test.ts
@@ -29,8 +29,8 @@ describe("what a bot on My Cloud is told about connections that need the person"
expect(prompt({})).toBe(
" Not connected on My Cloud yet: linear (sign in here: https://omb-u-1.fly.dev/?connect=mcp%3Alinear); jira (sign in here: https://omb-u-1.fly.dev/?connect=mcp%3Ajira)."
+ " When a task needs one, say in plain words that it needs the person once on My Cloud and give its link; do not try another way."
- + " Runs only on the person's computer Milind's MacBook, not on My Cloud: notes. If a task needs one, say so in plain words.");
- expect(prompt({ mcpServers: ["dodo", "notes"] })).toBe(" Runs only on the person's computer Milind's MacBook, not on My Cloud: notes. If a task needs one, say so in plain words.");
+ + " Runs only on the person's computer Milind's MacBook, not on My Cloud: notes (it uses files or an address only Milind's MacBook has). It worked there before the bots moved here. If a task needs one, tell the person in plain words that it stayed on Milind's MacBook and why, not that it was never set up, and do not write your own replacement.");
+ expect(prompt({ mcpServers: ["dodo", "notes"] })).toBe(" Runs only on the person's computer Milind's MacBook, not on My Cloud: notes (it uses files or an address only Milind's MacBook has). It worked there before the bots moved here. If a task needs one, tell the person in plain words that it stayed on Milind's MacBook and why, not that it was never set up, and do not write your own replacement.");
expect(prompt({ mcpServers: ["dodo", "off"] })).toBe("");
});
diff --git a/server/cloud-connections-prompt.ts b/server/cloud-connections-prompt.ts
index 52280ed544..08fb1667b0 100644
--- a/server/cloud-connections-prompt.ts
+++ b/server/cloud-connections-prompt.ts
@@ -7,6 +7,7 @@ import type { ConnectorToolGrant } from "../shared/wire.ts";
import { toolkitName } from "./activity.ts";
import type { McpAuthState } from "./mcp-oauth.ts";
import { isRemoteMcpServer, parseStoredMcpServer } from "./mcp-registry.ts";
+import { stayedConnectors, stayedWhyText } from "./cloud-connections-stayed.ts";
const COMPOSIO_TTL_MS = 20_000;
const SLUG = /^[a-z0-9_][a-z0-9_-]{0,80}$/u;
@@ -19,6 +20,8 @@ export interface ConnectionPromptSources {
composioConnected(slugs: string[]): Promise<Record<string, boolean>>;
/** The computer the bots moved here from, once a move is done. */
movedFrom?(): string | null;
+ /** The programs this Cloud has. */
+ programs?(): readonly string[];
}
export type ConnectionPromptBot = { mcpServers?: string[]; composio?: boolean; connectorTools?: Record<string, ConnectorToolGrant> };
@@ -47,13 +50,16 @@ export function createConnectionPrompt(sources: ConnectionPromptSources, origin:
return (bot) => {
const toConnect: string[] = [];
const elsewhere = new Map<string, string[]>();
+ for (const stayed of stayedConnectors(sources.mcpServers(), sources.programs?.() ?? [])) {
+ if (bot.mcpServers !== undefined && !bot.mcpServers.includes(stayed.name)) continue;
+ elsewhere.set(stayed.computer, [...elsewhere.get(stayed.computer) ?? [], `${stayed.name} (${stayedWhyText(stayed)})`]);
+ }
for (const [name, raw] of Object.entries(sources.mcpServers() ?? {})) {
if (bot.mcpServers !== undefined && !bot.mcpServers.includes(name)) continue;
const parsed = parseStoredMcpServer(name, raw);
if (!parsed.ok || !parsed.server.enabled) continue;
const server = parsed.server;
- if (server.runsOn) elsewhere.set(server.runsOn.label, [...elsewhere.get(server.runsOn.label) ?? [], name]);
- else if (isRemoteMcpServer(server)) {
+ if (!server.runsOn && isRemoteMcpServer(server)) {
const auth = sources.mcpAuth(name, server.url);
if (auth === "needs-sign-in" || (auth === "none" && server.oauth)) toConnect.push(`${name} (sign in here: ${link(`mcp:${name}`)})`);
}
@@ -66,7 +72,7 @@ export function createConnectionPrompt(sources: ConnectionPromptSources, origin:
from ? ` You moved to My Cloud from the person's computer ${from}, with everything in OpenMausBot. What lives outside OpenMausBot stayed on ${from}: its other folders and files, passkeys, the person's own browser sessions and apps, Local VM disks and model servers on its home network. When a task needs one, use ${from} if it is lent to My Cloud and online; otherwise say in plain words that it stayed there.` : "",
toConnect.length ? ` Not connected on My Cloud yet: ${toConnect.join("; ")}. When a task needs one, say in plain words that it needs the person once on My Cloud and give its link; do not try another way.` : "",
apps.length ? ` Assigned to this bot but not connected on My Cloud yet: ${apps.join(", ")}. When a task needs one, call COMPOSIO_MANAGE_CONNECTIONS for it, which shows the person a card to connect it, and end the turn.` : "",
- ...[...elsewhere].map(([computer, names]) => ` Runs only on the person's computer ${computer}, not on My Cloud: ${names.join(", ")}. If a task needs one, say so in plain words.`),
+ ...[...elsewhere].map(([computer, names]) => ` Runs only on the person's computer ${computer}, not on My Cloud: ${names.join("; ")}. It worked there before the bots moved here. If a task needs one, tell the person in plain words that it stayed on ${computer} and why, not that it was never set up, and do not write your own replacement.`),
].join("");
};
}
diff --git a/server/cloud-connections-stayed.test.ts b/server/cloud-connections-stayed.test.ts
new file mode 100644
index 0000000000..eccd1158cf
--- /dev/null
+++ b/server/cloud-connections-stayed.test.ts
@@ -0,0 +1,123 @@
+import { mkdtempSync, rmSync } from "node:fs";
+import { tmpdir } from "node:os";
+import { join } from "node:path";
+import { afterEach, describe, expect, it } from "vitest";
+
+import { createStayedNotices, stayedConnectors, stayedLine } from "./cloud-connections-stayed.ts";
+import { isMailConnector, runsHere } from "./cloud-connections.ts";
+
+const MAC = { environmentId: "env-1", label: "Mac mini" };
+const stdio = (command: string, args: string[], extra: Record<string, unknown> = {}) => ({ command, args, env: {}, enabled: true, ...extra });
+const SERVERS = {
+ easy: stdio("uvx", ["mcp-email-server", "stdio"], { runsOn: MAC }),
+ fetch: stdio("uvx", ["mcp-server-fetch"], { runsOn: MAC }),
+ notes: stdio("node", ["/Users/someone/notes.js"], { runsOn: MAC }),
+ off: stdio("uvx", ["mcp-server-time"], { runsOn: MAC, enabled: false }),
+ dodo: stdio("npx", ["-y", "dodopayments-mcp"]),
+};
+
+const dirs: string[] = [];
+afterEach(() => { for (const dir of dirs.splice(0)) rmSync(dir, { recursive: true, force: true }); });
+
+function fixture(bots: Array<{ id: string; name: string; threadId: string; chiefOfStaff?: boolean; mcpServers?: string[]; toolScope?: unknown }>, servers: Record<string, unknown> = SERVERS, file?: string) {
+ const dir = mkdtempSync(join(tmpdir(), "omb-stayed-")); dirs.push(dir);
+ const said: Array<{ threadId: string; text: string; kind: string }> = [];
+ const notified: Array<{ text: string; bot: string; threadId: string }> = [];
+ const notices = createStayedNotices({
+ file: file ?? join(dir, "told.json"), servers: () => servers, programs: () => ["npx", "node", "python3"], bots: () => bots, language: () => undefined,
+ say: (threadId, text, kind) => { said.push({ threadId, text, kind }); },
+ notify: (text, bot, threadId) => { notified.push({ text, bot: bot.id, threadId }); },
+ });
+ return { notices, said, notified, file: file ?? join(dir, "told.json") };
+}
+
+describe("what stayed on the person's computer", () => {
+ it("names each connector that runs elsewhere with why, and leaves out one that was off anyway", () => {
+ expect(stayedConnectors(SERVERS, ["npx", "node", "python3"])).toEqual([
+ { name: "easy", computer: "Mac mini", why: { kind: "mail" } },
+ { name: "fetch", computer: "Mac mini", why: { kind: "program", program: "uvx" } },
+ { name: "notes", computer: "Mac mini", why: { kind: "here" } },
+ ]);
+ });
+
+ it("says it in plain words: the program it needs, or that its mail stays there", () => {
+ const [easy, fetch, notes] = stayedConnectors(SERVERS, ["npx", "node", "python3"]);
+ expect(stayedLine(undefined, easy!)).toBe("easy stayed on Mac mini when your bots moved to My Cloud, so bots here can't read or send mail through it. It keeps its accounts on Mac mini, and it can't reach a mail server from here.");
+ expect(stayedLine(undefined, fetch!)).toBe("fetch stayed on Mac mini when your bots moved to My Cloud, so bots here can't use it. It needs uvx, which My Cloud doesn't have.");
+ expect(stayedLine(undefined, notes!)).toBe("notes stayed on Mac mini when your bots moved to My Cloud, so bots here can't use it. It uses files or an address only Mac mini has.");
+ });
+
+ it("when the move ends one bot says all of it, once, and the person is told outside the chat too", () => {
+ const { notices, said, notified } = fixture([{ id: "a", name: "Ada", threadId: "t-a" }, { id: "c", name: "Chief", threadId: "t-c", chiefOfStaff: true }]);
+ notices.moved();
+ expect(said).toHaveLength(1);
+ expect(said[0]).toMatchObject({ threadId: "t-c", kind: "line" });
+ expect(said[0]!.text.split("\n\n").map((line) => line.split(" ")[0])).toEqual(["easy", "fetch", "notes"]);
+ expect(notified).toEqual([{ text: said[0]!.text, bot: "c", threadId: "t-c" }]);
+ notices.moved();
+ expect(said, "a move resumed after a crash says nothing twice").toHaveLength(1);
+ });
+
+ it("the first conversation with each other bot that could have used it says so once, in that conversation", () => {
+ const { notices, said } = fixture([{ id: "a", name: "Ada", threadId: "t-a" }, { id: "c", name: "Chief", threadId: "t-c", chiefOfStaff: true }, { id: "n", name: "Nora", threadId: "t-n", mcpServers: ["dodo"] }]);
+ notices.moved();
+ said.length = 0;
+ notices.personTurn({ id: "c", name: "Chief", threadId: "t-c", chiefOfStaff: true }, "t-c-2");
+ expect(said, "the bot that said it at the move does not repeat it").toEqual([]);
+ notices.personTurn({ id: "a", name: "Ada", threadId: "t-a" }, "t-a-7");
+ expect(said.map(({ threadId, kind, text }) => [threadId, kind, text.split(" ")[0]])).toEqual([["t-a-7", "row", "easy"], ["t-a-7", "row", "fetch"], ["t-a-7", "row", "notes"]]);
+ said.length = 0;
+ notices.personTurn({ id: "a", name: "Ada", threadId: "t-a" }, "t-a-8");
+ expect(said, "once per bot").toEqual([]);
+ notices.personTurn({ id: "n", name: "Nora", threadId: "t-n", mcpServers: ["dodo"] }, "t-n-1");
+ expect(said, "a bot that never had it hears nothing").toEqual([]);
+ });
+
+ it("someone who moved before this existed is told too, on their first line", () => {
+ const { notices, said } = fixture([{ id: "a", name: "Ada", threadId: "t-a" }]);
+ notices.personTurn({ id: "a", name: "Ada", threadId: "t-a" }, "t-a");
+ expect(said.map((line) => line.text.split(" ")[0])).toEqual(["easy", "fetch", "notes"]);
+ });
+
+ it("what was said is kept across a restart", () => {
+ const first = fixture([{ id: "a", name: "Ada", threadId: "t-a" }]);
+ first.notices.personTurn({ id: "a", name: "Ada", threadId: "t-a" }, "t-a");
+ const again = fixture([{ id: "a", name: "Ada", threadId: "t-a" }], SERVERS, first.file);
+ again.notices.personTurn({ id: "a", name: "Ada", threadId: "t-a" }, "t-a");
+ expect(again.said).toEqual([]);
+ });
+
+ it("a bot's own connector is said only to that bot, and a tool selection without it says nothing", () => {
+ const servers = { own: stdio("uvx", ["mcp-server-own"], { runsOn: MAC, bot: "a" }) };
+ const { notices, said } = fixture([{ id: "b", name: "Bea", threadId: "t-b" }, { id: "a", name: "Ada", threadId: "t-a", toolScope: { mode: "selected", mcp: {} } }], servers);
+ notices.personTurn({ id: "b", name: "Bea", threadId: "t-b" }, "t-b");
+ expect(said).toEqual([]);
+ });
+
+ it("nothing is said where nothing stayed", () => {
+ const { notices, said, notified } = fixture([{ id: "a", name: "Ada", threadId: "t-a" }], { dodo: SERVERS.dodo });
+ notices.moved();
+ notices.personTurn({ id: "a", name: "Ada", threadId: "t-a" }, "t-a");
+ expect(said).toEqual([]);
+ expect(notified).toEqual([]);
+ });
+});
+
+describe("a mail connector stays where its accounts are", () => {
+ it.each([
+ [stdio("uvx", ["mcp-email-server", "stdio"]), true],
+ [stdio("npx", ["-y", "imap-mcp"]), true],
+ [stdio("uvx", ["mcp-server-smtp"]), true],
+ [stdio("npx", ["himalaya-mcp"]), true],
+ [stdio("npx", ["-y", "@scope/mail-tools"]), false],
+ [stdio("npx", ["-y", "gmail-mcp"]), false],
+ [stdio("uvx", ["mcp-server-fetch"]), false],
+ ])("%j: %s", (server, expected) => {
+ expect(isMailConnector(server)).toBe(expected);
+ expect(runsHere(server)).toBe(expected);
+ });
+
+ it("a connector reached by its address is never one", () => {
+ expect(isMailConnector({ type: "http", url: "https://imap.example.com/mcp", headers: {}, enabled: true })).toBe(false);
+ });
+});
diff --git a/server/cloud-connections-stayed.ts b/server/cloud-connections-stayed.ts
new file mode 100644
index 0000000000..57b0b0ff15
--- /dev/null
+++ b/server/cloud-connections-stayed.ts
@@ -0,0 +1,107 @@
+// What stayed on the person's computer when the bots moved to My Cloud: said to the person in their own words, once when
+// the move ends and once in the first conversation they start with each bot that could have used it. A bot's prompt
+// says the same (cloud-connections-prompt.ts), but a line from the server is not left to a model.
+import { readFileSync } from "node:fs";
+
+import { canUseMcpServer } from "../shared/tool-scope.ts";
+import { writeFileAtomic } from "./atomic.ts";
+import { isMailConnector, launcherOf } from "./cloud-connections.ts";
+import { isRemoteMcpServer, parseStoredMcpServer } from "./mcp-registry.ts";
+import { serverLine } from "./server-lines.ts";
+
+export type StayedWhy = { kind: "mail" } | { kind: "program"; program: string } | { kind: "here" };
+
+export interface StayedConnector {
+ name: string;
+ /** The computer it runs on, by the name the person knows it by. */
+ computer: string;
+ why: StayedWhy;
+ /** The one bot it serves, when it is that bot's own. */
+ bot?: string;
+}
+
+/** The connectors on this Cloud that run on another computer, each with why. One switched off was not working anyway. */
+export function stayedConnectors(servers: Record<string, unknown> | undefined, programs: readonly string[]): StayedConnector[] {
+ return Object.entries(servers ?? {}).flatMap(([name, raw]): StayedConnector[] => {
+ const parsed = parseStoredMcpServer(name, raw);
+ if (!parsed.ok || !parsed.server.enabled || !parsed.server.runsOn) return [];
+ const server = parsed.server;
+ const remote = isRemoteMcpServer(server);
+ const program = remote ? "" : launcherOf(server.command);
+ const why: StayedWhy = isMailConnector(server) ? { kind: "mail" } : !remote && !/[\\/]/u.test(server.command) && !programs.includes(program) ? { kind: "program", program } : { kind: "here" };
+ return [{ name, computer: server.runsOn!.label, why, ...(!remote && server.bot ? { bot: server.bot } : {}) }];
+ });
+}
+
+/** Why, as a model reads it: words a bot can pass on. */
+export function stayedWhyText(stayed: StayedConnector): string {
+ if (stayed.why.kind === "mail") return `a mail connector keeps its accounts on ${stayed.computer}, and a bot here cannot reach a mail server through it`;
+ if (stayed.why.kind === "program") return `it needs ${stayed.why.program}, which this Cloud does not have`;
+ return `it uses files or an address only ${stayed.computer} has`;
+}
+
+/** The person's line about one connector. */
+export function stayedLine(language: string | undefined, stayed: StayedConnector): string {
+ const { name, computer, why } = stayed;
+ if (why.kind === "mail") return serverLine(language, "server.moves.connectorStayedMail", { name, computer });
+ if (why.kind === "program") return serverLine(language, "server.moves.connectorStayedProgram", { name, computer, program: why.program });
+ return serverLine(language, "server.moves.connectorStayedHere", { name, computer });
+}
+
+type Bot = { id: string; name: string; threadId: string; chiefOfStaff?: unknown; mcpServers?: string[]; toolScope?: unknown };
+
+export interface StayedNoticesDeps {
+ /** Who has been told what, by connector and bot. */
+ file: string;
+ servers(): Record<string, unknown> | undefined;
+ programs(): readonly string[];
+ bots(): readonly Bot[];
+ /** A line in a bot's own chat, in the conversation the person is looking at. */
+ say(threadId: string, text: string, kind: "line" | "row"): void;
+ /** The person hears of it outside the chat too, when the move ends. */
+ notify(text: string, bot: Bot, threadId: string): void;
+ language(threadId: string): string | undefined;
+}
+
+export function createStayedNotices(deps: StayedNoticesDeps) {
+ let told: Record<string, string[]> | null = null;
+ const record = (): Record<string, string[]> => {
+ if (told) return told;
+ try { told = JSON.parse(readFileSync(deps.file, "utf8")) as Record<string, string[]>; } catch { told = {}; }
+ return told;
+ };
+ const key = (stayed: StayedConnector) => `${stayed.computer}\u0000${stayed.name}`;
+ const known = (stayed: StayedConnector, bot: Bot) => record()[key(stayed)]?.includes(bot.id) === true;
+ const remember = (stayed: StayedConnector, bot: Bot) => {
+ const all = record();
+ (all[key(stayed)] ??= []).push(bot.id);
+ try { writeFileAtomic(deps.file, JSON.stringify(all), { mode: 0o600 }); } catch (error) { console.warn("[connections] could not save what was said about what stayed:", error); }
+ };
+ const stayed = () => stayedConnectors(deps.servers(), deps.programs());
+ const serves = (bot: Bot, connector: StayedConnector) => (connector.bot ? connector.bot === bot.id : !bot.mcpServers || bot.mcpServers.includes(connector.name)) && canUseMcpServer(bot.toolScope, connector.name);
+
+ return {
+ /** The move ended: one bot says what stayed, in its own chat, and the person is told outside the chat too. */
+ moved(language?: string): void {
+ const left = stayed().filter((connector) => !deps.bots().some((bot) => known(connector, bot)));
+ if (!left.length) return;
+ const bots = deps.bots();
+ const speaker = bots.find((bot) => bot.chiefOfStaff && left.some((connector) => serves(bot, connector))) ?? bots.find((bot) => left.some((connector) => serves(bot, connector)));
+ if (!speaker) return;
+ const lines = left.filter((connector) => serves(speaker, connector));
+ const text = lines.map((connector) => stayedLine(language ?? deps.language(speaker.threadId), connector)).join("\n\n");
+ for (const connector of lines) remember(connector, speaker);
+ deps.say(speaker.threadId, text, "line");
+ deps.notify(text, speaker, speaker.threadId);
+ },
+
+ /** A person started a turn with this bot: what it could have used and has not been said here yet, once per bot. */
+ personTurn(bot: Bot, threadId: string): void {
+ for (const connector of stayed()) {
+ if (!serves(bot, connector) || known(connector, bot)) continue;
+ remember(connector, bot);
+ deps.say(threadId, stayedLine(deps.language(threadId), connector), "row");
+ }
+ },
+ };
+}
diff --git a/server/cloud-connections.e2e.test.ts b/server/cloud-connections.e2e.test.ts
index 61bbb1c78a..4cefb061da 100644
--- a/server/cloud-connections.e2e.test.ts
+++ b/server/cloud-connections.e2e.test.ts
@@ -100,6 +100,7 @@ it("moves the MCP servers with their secrets and sign-ins, the keys and the conn
{ name: "docs", type: "http", url: "https://mcp.docs.example.test/mcp", headers: { Authorization: `Bearer ${DOCS_TOKEN}` } },
{ name: "linear", type: "http", url: LINEAR_URL, oauth: { clientId: "omb-fixture-client", clientSecret: CLIENT_SECRET } },
{ name: "notes", type: "http", url: "http://127.0.0.1:9/mcp" },
+ { name: "easy", command: "uvx", args: ["mcp-email-server", "stdio"] },
]) {
expect((await local("POST", "/api/mcp/servers", server)).status).toBe(201);
expect((await local("PATCH", `/api/mcp/servers/${server.name}`, { enabled: true })).status).toBe(200);
@@ -116,7 +117,7 @@ it("moves the MCP servers with their secrets and sign-ins, the keys and the conn
const refreshToken = [...relay.refreshTokens][0]!;
const collected = await collectConnections(asLocal(fx));
- expect(collected.connections.map((item) => item.id)).toEqual(["mcp:dodo", "mcp:docs", "mcp:linear", "mcp:notes", "key:openrouter", "composio", "highlevel"]);
+ expect(collected.connections.map((item) => item.id)).toEqual(["mcp:dodo", "mcp:docs", "mcp:linear", "mcp:notes", "mcp:easy", "key:openrouter", "composio", "highlevel"]);
expect(collected.connections.find((item) => item.id === "highlevel")).toMatchObject({ signIn: true });
expect(collected.connections.find((item) => item.id === "mcp:linear")).toMatchObject({ signIn: true });
expect(collected.connections.find((item) => item.id === "mcp:notes")).toMatchObject({ runsHere: true });
@@ -126,14 +127,14 @@ it("moves the MCP servers with their secrets and sign-ins, the keys and the conn
const result = await sendConnections(collected, asTarget(fx), { local: asLocal(fx), onProgress: ({ label }) => progress.push(label) });
expect(result.failed).toEqual([]);
expect(result.moved.map((item) => item.id)).toEqual(["key:openrouter", "mcp:dodo", "mcp:docs", "mcp:linear", "highlevel", "composio"]);
- expect(result.runsHere).toEqual([{ id: "mcp:notes", label: "notes" }]);
+ expect(result.runsHere).toEqual([{ id: "mcp:notes", label: "notes" }, { id: "mcp:easy", label: "easy" }]);
expect(result.kept).toEqual([]);
expect(result.release).toEqual([]);
- expect(progress).toEqual(["OpenRouter", "dodo", "docs", "linear", "notes", "HighLevel", "Connected apps"]);
+ expect(progress).toEqual(["OpenRouter", "dodo", "docs", "linear", "notes", "easy", "HighLevel", "Connected apps"]);
// The MCP servers arrived with their secrets, on, and the command-line one works there with its key.
const servers = (await onCloud("GET", "/api/mcp/servers")).body.servers as Array<Record<string, unknown>>;
- expect(servers.map((server) => server.name).sort()).toEqual(["docs", "dodo", "linear", "notes"]);
+ expect(servers.map((server) => server.name).sort()).toEqual(["docs", "dodo", "easy", "linear", "notes"]);
expect(servers.find((server) => server.name === "dodo")).toMatchObject({ enabled: true, envKeys: ["DODO_PAYMENTS_API_KEY", "DODO_PAYMENTS_ENVIRONMENT"] });
expect(servers.find((server) => server.name === "docs")).toMatchObject({ enabled: true, headerKeys: ["Authorization"] });
expect(servers.find((server) => server.name === "linear")).toMatchObject({ auth: "signed-in", oauth: { clientId: "omb-fixture-client", clientSecretConfigured: true } });
@@ -141,6 +142,7 @@ it("moves the MCP servers with their secrets and sign-ins, the keys and the conn
// The server that needs this computer is kept there, marked as running here, and never started there.
expect(servers.find((server) => server.name === "notes")).toMatchObject({ enabled: true, runsOn: collected.computer });
+ expect(servers.find((server) => server.name === "easy"), "a mail connector stays with its accounts, whatever programs My Cloud has").toMatchObject({ enabled: true, runsOn: collected.computer });
const notesTest = await onCloud("POST", "/api/mcp/servers/notes/test");
expect(notesTest).toMatchObject({ status: 409, body: { error: `This server runs on ${collected.computer.label}, so it isn't started here.` } });
@@ -172,7 +174,7 @@ it("moves the MCP servers with their secrets and sign-ins, the keys and the conn
expect((await onCloud("PATCH", `/api/bots/${bot.id}`, { mcpServers: ["dodo", "docs", "linear", "notes"] })).status).toBe(200);
const sections = (await onCloud("GET", `/api/bots/${bot.id}/system-prompt`)).body.sections as Array<{ id: string; text?: string }>;
expect(sections.find((section) => section.id === "to-connect")?.text)
- .toBe(` Runs only on the person's computer ${collected.computer.label}, not on My Cloud: notes. If a task needs one, say so in plain words.`);
+ .toBe(` Runs only on the person's computer ${collected.computer.label}, not on My Cloud: notes (it uses files or an address only ${collected.computer.label} has). It worked there before the bots moved here. If a task needs one, tell the person in plain words that it stayed on ${collected.computer.label} and why, not that it was never set up, and do not write your own replacement.`);
// Moving again changes nothing and spends nothing.
const again = await sendConnections(await collectConnections(asLocal(fx)), asTarget(fx), { local: asLocal(fx) });
diff --git a/server/cloud-connections.ts b/server/cloud-connections.ts
index 2124a668bb..252600cde2 100644
--- a/server/cloud-connections.ts
+++ b/server/cloud-connections.ts
@@ -103,10 +103,20 @@ export function launcherOf(command: string): string {
return basename(command.replaceAll("\\", "/")).toLowerCase().replace(/\.(?:exe|cmd|bat|ps1)$/u, "");
}
-/** A server that needs this computer: it starts a program by path, reads a file or folder here, or calls an address
- * only this computer reaches. */
+const MAIL_PROGRAM = /(?:^|[^a-z])(?:imap|smtp|e-?mail|himalaya)(?:[^a-z]|$)/iu;
+
+/** A command-line connector that talks to a mail server itself. It keeps its accounts on the computer it was set up on,
+ * outside anything its command line names, and in a bot's box a mail server is out of reach: the box's only way out is
+ * its HTTP proxy, which such a program does not use. So it starts on My Cloud, lists its tools, and reads no mail. */
+export function isMailConnector(server: StoredMcpServer): boolean {
+ return !isRemoteMcpServer(server) && [server.command, ...server.args].some((value) => MAIL_PROGRAM.test(value));
+}
+
+/** A server that needs this computer: it starts a program by path, reads a file or folder here, calls an address only
+ * this computer reaches, or is a mail connector. */
export function runsHere(server: StoredMcpServer): boolean {
if (isRemoteMcpServer(server)) return addressHere(server.url);
+ if (isMailConnector(server)) return true;
const command = server.command.trim();
if (/[\\/]/u.test(command) || command.startsWith("~") || command.startsWith(".")) return true;
return [...server.args, ...Object.values(server.env)].some(pathHere);
diff --git a/server/cloud-home.test.ts b/server/cloud-home.test.ts
index e5733b2b4d..f9e5d67577 100644
--- a/server/cloud-home.test.ts
+++ b/server/cloud-home.test.ts
@@ -463,6 +463,10 @@ it("ships an edge and a Fly template that keep the server private", () => {
expect(image).toMatch(/apt-get install -y --no-install-recommends [^\n]*\bbubblewrap\b[^\n]*\bsocat\b/);
expect(image).toMatch(/npm install -g pnpm@10\.33\.0/);
expect(image).toContain("bwrap --version && socat -V");
+ // uvx, so a connector someone runs with it can come along when they move here (server/cloud-connections.ts).
+ expect(image).toMatch(/ARG UV_VERSION=\d+\.\d+\.\d+/);
+ expect(image).toContain("install -m 0755 /tmp/uv-install/uv /tmp/uv-install/uvx /usr/local/bin/");
+ expect(image).toContain('uv --version | grep -qF "uv ${UV_VERSION}"');
const fly = readFileSync(join(import.meta.dirname, "../deploy/fly/fly.toml"), "utf8");
expect(fly).toMatch(/internal_port = 8080/);
expect(fly).toMatch(/destination = "\/data"/);
diff --git a/server/cloud-send-arrived.test.ts b/server/cloud-send-arrived.test.ts
index ca6f8e9a2e..4905d80980 100644
--- a/server/cloud-send-arrived.test.ts
+++ b/server/cloud-send-arrived.test.ts
@@ -26,10 +26,18 @@ function cloud(owner = true, language?: string) {
json: (_res: unknown, status: number, value: unknown) => { answered = { status, body: value }; }, readBody: async () => body } as never);
return answered!;
};
- return { dataDir, lines, ask };
+ return { dataDir, lines, ask, deps };
}
describe("POST /api/cloud-send/arrived", () => {
+ it("has the person told what stayed behind, in their language, once the move is recorded", async () => {
+ const { dataDir, ask, deps } = cloud(true, "de");
+ const told: Array<string | undefined> = [];
+ (deps as { stayed?: (language?: string) => void }).stayed = (language) => { told.push(language); expect(movedFrom(dataDir)?.computer).toBe("MacBook Air"); };
+ expect((await ask({ v: 1, computer: "MacBook Air", webhooks: [] })).status).toBe(200);
+ expect(told).toEqual(["de"]);
+ });
+
it("keeps the computer the bots came from, and each webhook's bot says its new address is on its card, once", async () => {
const { dataDir, lines, ask } = cloud();
expect(await ask({ v: 1, computer: "MacBook Air", webhooks: ["w1", "w2", "w9"] })).toEqual({ status: 200, body: { v: 1, told: 1 } });
diff --git a/server/cloud-send-arrived.ts b/server/cloud-send-arrived.ts
index b255dce30a..500a46f84d 100644
--- a/server/cloud-send-arrived.ts
+++ b/server/cloud-send-arrived.ts
@@ -40,6 +40,8 @@ export interface ArrivedDeps {
webhooks(): Pick<WebhookManager, "list"> | null;
owner(auth: RequestAuth): CloudOwner | null;
lineLanguage?: LineLanguage;
+ /** The person hears what stayed on the computer the bots came from (cloud-connections-stayed.ts). */
+ stayed?(language?: string): void;
}
const arrivedBody = z.object({ v: z.literal(1), computer: z.string().trim().min(1).max(120), webhooks: z.array(z.string().regex(/^[\w-]{1,128}$/u)).max(500),
@@ -66,6 +68,7 @@ export async function arrivedRoute(deps: ArrivedDeps, { req, res, path, method,
// Recorded before the lines go: a move cut short here never has a bot say it twice.
writeFileAtomic(join(deps.dataDir, FILE), JSON.stringify({ computer: body.data.computer, at: kept?.at ?? Date.now(), told: [...told] }), { mode: 0o600 });
for (const line of telling) deps.store.appendMessage(line.threadId, { role: "bot", kind: "text", text: webhookMovedLine(line.name, body.data.place, deps.lineLanguage?.(owner.person)) });
+ deps.stayed?.(deps.lineLanguage?.(owner.person));
json(res, 200, { v: 1, told: telling.length });
return true;
}
diff --git a/server/connector-stayed.e2e.test.ts b/server/connector-stayed.e2e.test.ts
new file mode 100644
index 0000000000..b3085a112a
--- /dev/null
+++ b/server/connector-stayed.e2e.test.ts
@@ -0,0 +1,82 @@
+// A move that leaves a connector behind says so, end to end: this computer's server and a Cloud home, main's own wiring
+// between them, and My Cloud's fake engine. The person is told when the move ends, and once in the first conversation with
+// each other bot that could have used it, in words of the server's own, not a model's. Disposable homes; no network.
+import { randomBytes } from "node:crypto";
+import { existsSync, readFileSync } from "node:fs";
+import { delimiter, dirname } from "node:path";
+import { afterAll, beforeAll, expect, it } from "vitest";
+import { launchCloudSendFixture, type CloudSendFixture } from "../scripts/testing/cloud-send-fixture.ts";
+import { hostTimeout } from "./testing/host-timeout.ts";
+
+let fx: CloudSendFixture;
+const sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms));
+const phase = () => (existsSync(fx.journalFile) ? (JSON.parse(readFileSync(fx.journalFile, "utf8")) as { phase: string }).phase : null);
+
+beforeAll(async () => {
+ // A PATH with no uvx: this Cloud lacks it, as the image did before it carried uv.
+ fx = await launchCloudSendFixture({ onePasswordToken: `ops_fake-stayed-${randomBytes(8).toString("hex")}`, env: { OMB_ENVIRONMENT_LABEL: "Mac mini", PATH: [dirname(process.execPath), "/usr/bin", "/bin"].join(delimiter) } });
+}, hostTimeout(120_000));
+afterAll(async () => { await fx?.close(); });
+
+type Row = { kind?: string; role: string; text?: string; tool?: { name?: string } };
+const rows = async (threadId: string) => (await fx.onCloud("GET", `/api/threads/${threadId}/messages?limit=500`)).body.messages as Row[];
+const lines = (messages: Row[]) => messages.flatMap((message) => [message.text ?? "", message.tool?.name ?? ""]).filter((text) => text.includes(" stayed on Mac mini"));
+
+it("what stayed on the computer is told when the move ends and in the first conversation with each bot, and the move never says everything is here", async () => {
+ const { local, onCloud } = fx;
+ // A bot nobody touched yet doesn't move: each has a job.
+ const made = async (name: string) => {
+ const bot = (await local("POST", "/api/bots", { name, modelSelection: { instanceId: "claude", model: "claude-sonnet-5" } })).body.bot as { id: string };
+ expect((await local("PATCH", `/api/bots/${bot.id}`, { description: `${name}'s job` })).status).toBe(200);
+ return bot;
+ };
+ await made("Scout");
+ await made("Pip");
+ const narrow = await made("Narrow");
+ for (const server of [{ name: "fetch", command: "uvx", args: ["mcp-server-fetch"] }, { name: "easy", command: "uvx", args: ["mcp-email-server", "stdio"] }, { name: "idle", command: "uvx", args: ["mcp-server-time"] }]) {
+ expect((await local("POST", "/api/mcp/servers", server)).status).toBe(201);
+ if (server.name !== "idle") expect((await local("PATCH", `/api/mcp/servers/${server.name}`, { enabled: true })).status).toBe(200);
+ }
+ expect((await local("PATCH", `/api/bots/${narrow.id}`, { mcpServers: [] })).status).toBe(200);
+
+ fx.account.state = { ...fx.account.state, deviceId: "device-mini", machine: { status: "ready", origin: fx.cloudBase, moves: true } };
+ for (const until = Date.now() + 150_000; phase() !== "done" && Date.now() < until;) { await fx.oneHome.kick(); if (phase() !== "done") await sleep(500); }
+ expect(phase(), `${existsSync(fx.journalFile) ? readFileSync(fx.journalFile, "utf8") : "no journal"}\n${fx.logs().slice(-3000)}`).toBe("done");
+
+ // What the move's own line names (src/lib/cloud-send.ts), where it said "Everything from this computer is here".
+ expect(fx.oneHome.view()).toMatchObject({ phase: "done", stayed: [{ name: "fetch", needs: "uvx" }, { name: "easy" }] });
+
+ // One bot says all of it in its own chat, and the person is told outside the chat too.
+ const bots = (await onCloud("GET", "/api/bots")).body.bots as Array<{ id: string; name: string; threadId: string }>;
+ const threads = new Map(bots.map((bot) => [bot.id, bot.threadId]));
+ const told = await Promise.all(bots.map(async (bot) => ({ bot, said: lines(await rows(bot.threadId)) })));
+ const speakers = told.filter(({ said }) => said.length);
+ expect(speakers).toHaveLength(1);
+ expect(speakers[0]!.said.join("\n")).toContain("fetch stayed on Mac mini when your bots moved to My Cloud, so bots here can't use it. It needs uvx, which My Cloud doesn't have.");
+ expect(speakers[0]!.said.join("\n")).toContain("easy stayed on Mac mini when your bots moved to My Cloud, so bots here can't read or send mail through it.");
+ expect(speakers[0]!.said.join("\n"), "one switched off was not working anyway").not.toContain("idle");
+ const notices = (await onCloud("GET", "/api/notifications")).body.notifications as Array<{ kind: string; body: string }>;
+ expect(notices.filter((notice) => notice.kind === "notice" && notice.body.includes("stayed on Mac mini"))).toHaveLength(1);
+
+ // A person's first line to another bot that could have used it: a row, once, in that conversation.
+ const other = bots.find((bot) => bot.id !== speakers[0]!.bot.id && bot.id !== narrow.id)!;
+ expect(other, JSON.stringify({ bots: bots.map((bot) => [bot.id, bot.name]), speaker: speakers[0]!.bot.name, narrow: narrow.id })).toBeDefined();
+ const say = async (bot: { id: string }, text: string) => {
+ const threadId = threads.get(bot.id)!;
+ expect((await onCloud("POST", `/api/bots/${bot.id}/messages`, { text, threadId })).status).toBe(202);
+ await expect.poll(async () => (await rows(threadId)).some((row) => row.role === "user" && row.text === text), { timeout: 30_000, interval: 100 }).toBe(true);
+ };
+ await say(other, "emails abrufen");
+ await expect.poll(async () => lines(await rows(other.threadId)).length, { timeout: 30_000, interval: 100 }).toBe(2);
+ await expect.poll(async () => (await onCloud("GET", "/api/bots")).body.bots.every((entry: { busy?: boolean }) => !entry.busy), { timeout: 60_000, interval: 200 }).toBe(true);
+ await say(other, "noch einmal");
+ await sleep(500);
+ expect(lines(await rows(other.threadId)), "once per bot").toHaveLength(2);
+
+ // A bot that never had it hears nothing, and the one that said it at the move does not repeat it.
+ await say(narrow, "hello");
+ await say(speakers[0]!.bot, "hello");
+ await sleep(500);
+ expect(lines(await rows(threads.get(narrow.id)!))).toEqual([]);
+ expect(lines(await rows(speakers[0]!.bot.threadId))).toHaveLength(speakers[0]!.said.length);
+}, hostTimeout(240_000));
diff --git a/server/host/mcp-servers-host.test.ts b/server/host/mcp-servers-host.test.ts
index 163c028daf..3a365ef486 100644
--- a/server/host/mcp-servers-host.test.ts
+++ b/server/host/mcp-servers-host.test.ts
@@ -4,7 +4,7 @@ import { join } from "node:path";
import { afterEach, expect, it } from "vitest";
import type { AppConfig } from "../config.ts";
-import { claimedNotice, createMcpServersHost } from "./mcp-servers-host.ts";
+import { claimedNotice, createMcpServersHost, startCheckTimeout } from "./mcp-servers-host.ts";
const dirs: string[] = [];
afterEach(() => { for (const dir of dirs.splice(0)) rmSync(dir, { recursive: true, force: true }); });
@@ -116,3 +116,8 @@ it("tests a command server as its bot's turns start it, from that bot's own fold
mkdirSync(join(data, "workspaces", "iris"), { recursive: true });
expect(host.probeAs({ bot: "iris" })).toEqual({ id: "iris", cwd: join(data, "workspaces", "iris") });
});
+
+it("a package runner's first check waits for its download; any other program's keeps the short wait", () => {
+ for (const command of ["uvx", "npx", "/opt/homebrew/bin/uvx", "npx.cmd"]) expect(startCheckTimeout(command), command).toBe(120_000);
+ for (const command of ["node", "python3", "/usr/local/bin/my-server"]) expect(startCheckTimeout(command), command).toBeUndefined();
+});
diff --git a/server/host/mcp-servers-host.ts b/server/host/mcp-servers-host.ts
index b6c69ca5fc..eb62fdd467 100644
--- a/server/host/mcp-servers-host.ts
+++ b/server/host/mcp-servers-host.ts
@@ -4,6 +4,7 @@ import { join } from "node:path";
import { writeFileAtomic } from "../atomic.ts";
import type { AppConfig } from "../config.ts";
+import { launcherOf } from "../cloud-connections.ts";
import { customMcpServers } from "../config.ts";
import type { McpServerSpec, StdioMcpSpec } from "../contracts.ts";
import { addBotMcpServer, claimBotMcpServers, keepForBot, withoutBotMcpServers, type BotKept, type BotMcpServerAdd } from "../mcp-bot-servers.ts";
@@ -32,6 +33,11 @@ export interface McpServersHostDeps {
const CLAIMED_FILE = (dataDir: string) => join(dataDir, "mcp-bot-servers.json");
+/** A package runner fetches its program the first time it starts, and later starts are quick: its check waits for that. */
+const PACKAGE_RUNNERS: ReadonlySet<string> = new Set(["uvx", "npx", "bunx", "pipx", "pnpm", "uv"]);
+const PACKAGE_START_MS = 120_000;
+export const startCheckTimeout = (command: string): number | undefined => (PACKAGE_RUNNERS.has(launcherOf(command)) ? PACKAGE_START_MS : undefined);
+
/** What the person hears once when servers in one bot's folder became that bot's own. */
export function claimedNotice(botName: string, names: readonly string[]): string {
const tools = names.toSorted().map(toolLabel);
@@ -61,7 +67,7 @@ export function createMcpServersHost(deps: McpServersHostDeps) {
return { id: botId, cwd: existsSync(own) ? own : deps.dataDir };
};
const start: McpHealthDeps["start"] = deps.start ?? (async (_name, server, botId) => {
- const result = await probeMcpServer({ ...server, enabled: true }, undefined, undefined, { asBot: asBot(botId) });
+ const result = await probeMcpServer({ ...server, enabled: true }, startCheckTimeout(server.command), undefined, { asBot: asBot(botId) });
return result.ok ? { ok: true } : { ok: false, error: result.error };
});
const health = createMcpHealth({
diff --git a/server/index.ts b/server/index.ts
index 8104d276fa..9f6441dea8 100644
--- a/server/index.ts
+++ b/server/index.ts
@@ -2899,7 +2899,7 @@ const creditMoves = cloudCredit && createCreditMoves({ credit: cloudCredit, stor
const routineHolds = CLOUD_HOME ? createRoutineHoldsHost({ dataDir: DATA_DIR, store, mcpServers: () => Object.keys(cfg.mcpServers ?? {}).length, log: (line) => console.warn(line),
appsConnected: async () => composio.configured(cfg) ? Object.values(await composio.connectedServices(cfg)).some((service) => service.connected) : false }) : null;
const skillsHost = createSkillsLibraryHost({ store, cfg, appendSkillRequestCard, engineConfig: (instanceId) => providerConfigs()[instanceId], instanceOf: (instanceId) => { const instance = registry.get(instanceId); return instance ? { instanceId, driverKind: instance.driverKind } : undefined; } });
-const { listBotSkills, readBotSkillFile } = skillsHost; const cloudConnections = createCloudConnectionsHost({ cloudHome: CLOUD_HOME, ownHome: ownHome.owner, config: () => cfg, environmentId: ENVIRONMENT_ID, mcpOAuth, highlevel, heldKeys, dataDir: DATA_DIR, engines: async () => selectableInstances(await registry.describe()).filter((instance) => readyToRun(instance, selectionContext)).map((instance) => instance.instanceId) });
+const { listBotSkills, readBotSkillFile } = skillsHost; const cloudConnections = createCloudConnectionsHost({ cloudHome: CLOUD_HOME, ownHome: ownHome.owner, config: () => cfg, environmentId: ENVIRONMENT_ID, mcpOAuth, highlevel, heldKeys, dataDir: DATA_DIR, stayedNotices: { bots: () => store.bots, language: (threadId) => threadLanguage(threadId), say: (threadId, text, kind) => { store.appendMessage(threadId, kind === "line" ? { role: "bot", kind: "text", text } : { role: "bot", kind: "activity", tool: { name: `notice: ${text}`, ok: true } }); }, notify: (text, bot, threadId) => notify(buildNoticeNotification(bot, threadId, text)) }, engines: async () => selectableInstances(await registry.describe()).filter((instance) => readyToRun(instance, selectionContext)).map((instance) => instance.instanceId) });
const highlevelHost = createHighLevelHost({ service: highlevel, dataDir: DATA_DIR, bot: (id) => store.bot(id),
inRoom: (threadId) => Boolean(store.groupByThread(threadId)), appendMessage: (threadId, message) => { store.appendMessage(threadId, message as Parameters<typeof store.appendMessage>[1]); } });
const phones = createPhones({
@@ -7824,7 +7824,7 @@ async function beginTurn(
});
}
const personLine = !opts?.coordination && !opts?.cardContinuation && !opts?.automationSource && !opts?.compactOnly
- && !opts?.computerSelectionContinuation && !opts?.editedMessageId && !commsDepth && !opts?.peerAsk && !userMessage.peerAsk;
+ && !opts?.computerSelectionContinuation && !opts?.editedMessageId && !commsDepth && !opts?.peerAsk && !userMessage.peerAsk; if (personLine) cloudConnections.personTurn(bot, threadId);
if (personLine && !userMessage.relayed && (coordinator.answer(threadId, text) || signInSettle.answerInChat(bot.id, threadId, text))) {
askCards.answeredInWords(threadId, text);
store.appendMessage(threadId, { role: "bot", kind: "activity", tool: { name: serverLine(threadLanguage(threadId), "server.teammates.answerPassed"), ok: true } });
@@ -12352,7 +12352,7 @@ ROUTES.push(createBotMemoryRoutes({
broadcast({ kind: "config", ...configStatus() });
},
}));
-const teamMoveIn = CLOUD_TEAM ? createTeamMoveIn({ team: CLOUD_TEAM, dataDir: DATA_DIR, sessions, store, routines: () => routines, library: () => readSkillLibraryIndex(), starters: threadStarters }) : null; const cloudSendOwner = (auth: RequestAuth) => teamMoveIn ? teamMoveIn.owner(auth) : (CLOUD_HOME && auth.kind === "session" && auth.scopes.includes("admin")) || ownHome.owner(auth) ? { person: actorKey(auth as RequestAuth & { kind: "session" }), name: cfg.profile?.name?.trim() || "User" } : null; const botMoves = CLOUD_PERSONAL ? createBotMoves({ store, routines: () => routines, webhooks: () => webhooks, appEvents: () => appTriggers.manager, waits: () => botWaits, busy: (id) => botHasActiveTurn(id) || Boolean(routines?.activeRunForBot(id)) }) : null; ROUTES.push(createBotMoveRoutes({ moves: botMoves, enabled: CLOUD_PERSONAL })); if (teamMoveIn) { ROUTES.unshift(teamMoveIn.guard); ROUTES.push(teamMoveIn.routes); teamOwners.backfill(teamMoveIn.list()); } ROUTES.push(createDeciderRoutes({ decider, extractor, config: () => cfg }), createTtsRoutes({ config: () => cfg }), createHelperSuggestionRoutes({ notNow: proactive.suggestionNotNow }), createSetupRequestRoutes({ store, language: () => appLanguage() ?? Intl.DateTimeFormat().resolvedOptions().locale, sendRefusal: cloudGuestSendRefusal, presser: (auth) => setupPresser(sharedMembership(), auth, messageSender(auth)), canSetUp: (botId, threadId) => registry.get(store.projectBotForTask(botId, threadId)?.modelSelection.instanceId ?? "")?.adapter.capabilities.agentsMcp === true, send: (auth, botId, threadId, text) => acceptDirectSend({ botId, threadId, text, sender: messageSender(auth), trigger: usageTriggerFor(auth), personPresent: auth.kind === "session" || DESKTOP_MANAGED }) }), createNotificationRoutes(undefined, threadShown, CLOUD_TEAM ? (auth, entry) => teamOwners.routing.notificationReaches(teamOwners.viewer(auth), entry) : undefined), createUpdateCheckRoutes({ check: serverUpdateChecker({ desktopManaged: DESKTOP_MANAGED, managed: Boolean(CLOUD_HOME || HOSTED_WORKSPACE) }) }), createTimeZoneRoutes({ adopts: Boolean(CLOUD_HOME), dataDir: DATA_DIR, changed: () => routines?.rescheduleLocalTimes() }), createCloudSendRoutes({ appVersion: serverVersion(), ...(CLOUD_TEAM ? { refusal: personalMoveRefusal(CLOUD_TEAM), scope: (auth) => teamMoveIn?.scope(auth) ?? null } : {}), bots: () => store.bots, messagesTail: (threadId, limit) => store.messagesTail(threadId, limit), skills: (bot) => listSkills(bot.id), logins, config: () => cfg, lineLanguage: personLanguages.forLine, chats: { store, dataDir: DATA_DIR, owner: cloudSendOwner, ...(CLOUD_OWNER_KEY ? { ownerKey: CLOUD_OWNER_KEY } : {}), stamped: (threadId) => ownerOnlyCache.delete(threadId), instanceExists: (id) => Boolean(registry.get(id)), approvalSupported: (selection, mode) => supportsApprovalMode(selection, mode) }, cloudHome: Boolean(CLOUD_HOME), ownHome: ownHome.owner, automations: { routines: () => routines, calls: () => calendarCalls, webhooks: () => webhooks, appEvents: () => appTriggers.manager, waits: () => botWaits }, connections: () => cloudConnections.connections(), connectionFingerprints: (nonce) => cloudConnections.fingerprints(nonce), move: { dataDir: DATA_DIR, store, routines: () => routines, calls: () => calendarCalls, webhooks: () => webhooks, appEvents: () => appTriggers.manager, claudeCodeSkills: () => (claudeUserSkillsEnabled(cfg) ? claudeCodeSkillInputs() : []), instanceExists: (id) => Boolean(registry.get(id)), owner: cloudSendOwner, ownRoutine: (routine, person) => { cloudRoutineAuthors?.record(routine.id, routine); cloudRoutineAuthors?.wrote(routine.id, person); }, arrived: () => ownerOnlyCache.clear(), teamMemory, aboutMe: () => cfg.profile?.aboutMe ?? "", saveAboutMe: (text) => { saveConfig({ profile: { ...cfg.profile, aboutMe: text } }); Object.assign(cfg, loadConfig()); broadcast({ kind: "config", ...configStatus() }); } } }), cloudConnections.routes, createTodayRoutes({ visibleFor: (auth) => visibleTo(viewerFor(auth)), ...(teamOwners.asks ? { asks: teamOwners.asks, messages: teamMessages.needsYou } : {}), sources: () => ({ bots: store.bots, groups: store.groups, routines, parked: coordinator.active(), engines: registry.instances().map((instance) => ({ instanceId: instance.instanceId, snapshot: registry.lastSnapshot(instance.instanceId) })) }) }), createInboxRoutes(teamMessages));
+const teamMoveIn = CLOUD_TEAM ? createTeamMoveIn({ team: CLOUD_TEAM, dataDir: DATA_DIR, sessions, store, routines: () => routines, library: () => readSkillLibraryIndex(), starters: threadStarters }) : null; const cloudSendOwner = (auth: RequestAuth) => teamMoveIn ? teamMoveIn.owner(auth) : (CLOUD_HOME && auth.kind === "session" && auth.scopes.includes("admin")) || ownHome.owner(auth) ? { person: actorKey(auth as RequestAuth & { kind: "session" }), name: cfg.profile?.name?.trim() || "User" } : null; const botMoves = CLOUD_PERSONAL ? createBotMoves({ store, routines: () => routines, webhooks: () => webhooks, appEvents: () => appTriggers.manager, waits: () => botWaits, busy: (id) => botHasActiveTurn(id) || Boolean(routines?.activeRunForBot(id)) }) : null; ROUTES.push(createBotMoveRoutes({ moves: botMoves, enabled: CLOUD_PERSONAL })); if (teamMoveIn) { ROUTES.unshift(teamMoveIn.guard); ROUTES.push(teamMoveIn.routes); teamOwners.backfill(teamMoveIn.list()); } ROUTES.push(createDeciderRoutes({ decider, extractor, config: () => cfg }), createTtsRoutes({ config: () => cfg }), createHelperSuggestionRoutes({ notNow: proactive.suggestionNotNow }), createSetupRequestRoutes({ store, language: () => appLanguage() ?? Intl.DateTimeFormat().resolvedOptions().locale, sendRefusal: cloudGuestSendRefusal, presser: (auth) => setupPresser(sharedMembership(), auth, messageSender(auth)), canSetUp: (botId, threadId) => registry.get(store.projectBotForTask(botId, threadId)?.modelSelection.instanceId ?? "")?.adapter.capabilities.agentsMcp === true, send: (auth, botId, threadId, text) => acceptDirectSend({ botId, threadId, text, sender: messageSender(auth), trigger: usageTriggerFor(auth), personPresent: auth.kind === "session" || DESKTOP_MANAGED }) }), createNotificationRoutes(undefined, threadShown, CLOUD_TEAM ? (auth, entry) => teamOwners.routing.notificationReaches(teamOwners.viewer(auth), entry) : undefined), createUpdateCheckRoutes({ check: serverUpdateChecker({ desktopManaged: DESKTOP_MANAGED, managed: Boolean(CLOUD_HOME || HOSTED_WORKSPACE) }) }), createTimeZoneRoutes({ adopts: Boolean(CLOUD_HOME), dataDir: DATA_DIR, changed: () => routines?.rescheduleLocalTimes() }), createCloudSendRoutes({ appVersion: serverVersion(), ...(CLOUD_TEAM ? { refusal: personalMoveRefusal(CLOUD_TEAM), scope: (auth) => teamMoveIn?.scope(auth) ?? null } : {}), bots: () => store.bots, messagesTail: (threadId, limit) => store.messagesTail(threadId, limit), skills: (bot) => listSkills(bot.id), logins, config: () => cfg, lineLanguage: personLanguages.forLine, chats: { store, dataDir: DATA_DIR, owner: cloudSendOwner, ...(CLOUD_OWNER_KEY ? { ownerKey: CLOUD_OWNER_KEY } : {}), stamped: (threadId) => ownerOnlyCache.delete(threadId), instanceExists: (id) => Boolean(registry.get(id)), approvalSupported: (selection, mode) => supportsApprovalMode(selection, mode) }, cloudHome: Boolean(CLOUD_HOME), ownHome: ownHome.owner, automations: { routines: () => routines, calls: () => calendarCalls, webhooks: () => webhooks, appEvents: () => appTriggers.manager, waits: () => botWaits }, connectionsMoved: (language) => cloudConnections.moved(language), connections: () => cloudConnections.connections(), connectionFingerprints: (nonce) => cloudConnections.fingerprints(nonce), move: { dataDir: DATA_DIR, store, routines: () => routines, calls: () => calendarCalls, webhooks: () => webhooks, appEvents: () => appTriggers.manager, claudeCodeSkills: () => (claudeUserSkillsEnabled(cfg) ? claudeCodeSkillInputs() : []), instanceExists: (id) => Boolean(registry.get(id)), owner: cloudSendOwner, ownRoutine: (routine, person) => { cloudRoutineAuthors?.record(routine.id, routine); cloudRoutineAuthors?.wrote(routine.id, person); }, arrived: () => ownerOnlyCache.clear(), teamMemory, aboutMe: () => cfg.profile?.aboutMe ?? "", saveAboutMe: (text) => { saveConfig({ profile: { ...cfg.profile, aboutMe: text } }); Object.assign(cfg, loadConfig()); broadcast({ kind: "config", ...configStatus() }); } } }), cloudConnections.routes, createTodayRoutes({ visibleFor: (auth) => visibleTo(viewerFor(auth)), ...(teamOwners.asks ? { asks: teamOwners.asks, messages: teamMessages.needsYou } : {}), sources: () => ({ bots: store.bots, groups: store.groups, routines, parked: coordinator.active(), engines: registry.instances().map((instance) => ({ instanceId: instance.instanceId, snapshot: registry.lastSnapshot(instance.instanceId) })) }) }), createInboxRoutes(teamMessages));
if (CLOUD_TEAM) teamHost.adoptServerProfile(sessions.list().flatMap((session) => session.email ? [session.email] : []));
ROUTES.push(createSidebarSectionRoutes({ store, teamComputers, maxBots: MAX_WORKSPACE_BOTS, assertTeamComputerChangeIdle, wireBot }), createPresenceRoutes({ isOwner: ownerOrAdmin, heard: (auth, language) => personLanguages.heard(auth.kind === "session" ? actorKey(auth) : THIS_COMPUTER, language), sawChat: (auth, threadId) => { if (ownerOrAdmin(auth) && store.botByThread(threadId)) sawThread(threadId); }, active: async (source, zone, language) => { const answer = await proactive.brief.active(source, zone, language); firstHourHooks.arrived(); return answer; }, ...(CLOUD_TEAM ? { member: teamMessages.arrived } : {}) }), createMeRoutes({ team: CLOUD_TEAM, session: (auth) => (auth.kind === "session" ? auth.session : null), profile: teamHost.memberProfile, save: teamHost.saveMemberProfile, seed: teamHost.seedMemberProfile, seeded: teamHost.seededFields, changed: () => broadcast({ kind: "config", ...configStatus() }) }), createTeamPhoneRoutes({ team: CLOUD_TEAM, sessions, publicBase: (req, auth) => publicUrl() ?? (auth.kind === "session" ? requestOrigin(req) : null) }),
createTeamConnectionRoutes({ host: teamConnections, cfg: () => cfg, composio, policy: managedPolicy, publicOrigin: CLOUD_HOME?.publicOrigin ?? null, record: (auth, row) => appendAdminAction(DATA_DIR, { ...row, actor: decisionActorFor(auth) }) }), createSignInCardRoutes({ settle: signInSettle.settle, saveLogin: (botId, threadId, messageId, body, auth) => CLOUD_TEAM && !auth.scopes.includes("admin") ? Promise.resolve({ status: 403 as const, body: { error: memberLoginRefusal(CLOUD_TEAM) } }) : saveLoginFromCard(botId, threadId, messageId, body), saveTarget: signInSaveTarget, threadVisible: (auth, threadId) => visibleTo(viewerFor(auth)).thread(threadId) }));
diff --git a/server/mcp-bot-rules.ts b/server/mcp-bot-rules.ts
index 9d705122b9..dc10165e8f 100644
--- a/server/mcp-bot-rules.ts
+++ b/server/mcp-bot-rules.ts
@@ -175,6 +175,7 @@ export function botListing(
signIn: extra.authState,
forThisBot: extra.forThisBot,
...(extra.managedBy ? { managedBy: extra.managedBy } : {}),
+ ...(server.runsOn ? { runsOn: server.runsOn.label } : {}),
};
if (isRemoteMcpServer(server)) {
return { ...common, transport: server.type ?? "http", url: botAddress(server.url), headerKeys: Object.keys(server.headers ?? {}) };
diff --git a/server/routes/cloud-send.ts b/server/routes/cloud-send.ts
index 24096b2719..3af5141357 100644
--- a/server/routes/cloud-send.ts
+++ b/server/routes/cloud-send.ts
@@ -39,6 +39,8 @@ export interface CloudSendRouteDeps extends Pick<CloudSendSources, "appVersion"
/** This server's connections (cloud-connections.ts), by id. */
connections?(): Promise<ReadonlyArray<{ id: string }>>;
connectionFingerprints?(nonce: string): Record<string, string>;
+ /** The move ended: the person hears which connections stayed on the computer it came from. */
+ connectionsMoved?(language?: string): void;
/** What only a move carries: automations, skill extras and bot fields, memory, and bot files. */
move?: MoveKindsDeps & Omit<MoveMemoryDeps, "bot" | "owner">;
/** This server's automations, which a Cloud home stops for a computer whose bots go home to it. */
@@ -83,7 +85,7 @@ export function createCloudSendRoutes(deps: CloudSendRouteDeps): RouteHandler {
if (move && await moveKindsRoute(move, ctx)) return;
if (move && await moveMemoryRoute({ ...move, bot: (id) => move.store.bot(id) ?? undefined }, ctx)) return;
if (move && await moveFilesRoute({ dataDir: move.dataDir, bots: () => (bot ? move.store.bots.filter((entry) => entry.id === bot) : move.store.bots), owner: move.owner }, ctx)) return;
- if (move && home && await arrivedRoute({ dataDir: move.dataDir, store: move.store, webhooks: move.webhooks, owner: move.owner, lineLanguage: deps.lineLanguage ?? (() => deps.config().language) }, ctx)) return;
+ if (move && home && await arrivedRoute({ dataDir: move.dataDir, store: move.store, webhooks: move.webhooks, owner: move.owner, lineLanguage: deps.lineLanguage ?? (() => deps.config().language), ...(deps.connectionsMoved ? { stayed: deps.connectionsMoved } : {}) }, ctx)) return;
if (move && deps.cloudHome && deps.automations && await automationsOffRoute({ automations: deps.automations, owner: move.owner }, ctx)) return;
if (move && !deps.cloudHome && await homeRoute({ dataDir: move.dataDir, store: move.store, webhooks: move.webhooks }, ctx)) return;
if (path === "/api/cloud-send/manifest") {
diff --git a/src/lib/cloud-send.test.ts b/src/lib/cloud-send.test.ts
index f4d9b1b1b4..7c8fdff40b 100644
--- a/src/lib/cloud-send.test.ts
+++ b/src/lib/cloud-send.test.ts
@@ -6,6 +6,18 @@ beforeEach(() => { setLocale("en"); });
afterEach(() => { setLocale("en"); });
describe("the one-time move's line", () => {
+ it("never says everything is here when a connector stayed on this computer, and says why", () => {
+ const done = { phase: "done" as const, phone: false, held: [], counts: { bots: 13, skills: 0, logins: 0, onePassword: false, chats: 0, routines: 0 } };
+ expect(moveLine(done, "cloud")?.text).toContain("Everything from this computer is here");
+ const line = moveLine({ ...done, stayed: [{ name: "fetch", needs: "uvx" }, { name: "easy" }] }, "cloud");
+ expect(line).toMatchObject({ kind: "done", text: "Everything else from this computer is here. These stayed on it:" });
+ expect(line?.extra).toEqual([
+ "fetch: it needs uvx, which isn't here, so bots here can't use it.",
+ "easy: it only works on that computer, so bots here can't use it.",
+ ]);
+ expect(moveLine({ ...done, place: "Garage server", stayed: [{ name: "easy" }] }, "cloud")?.extra).toEqual(["easy: it only works on that computer, so bots here can't use it."]);
+ });
+
it("says where the move is on whichever page is open, and who it waits for", () => {
expect(moveLine({ phase: "copy" }, "local")).toMatchObject({ kind: "sending", text: "Moving your bots to My Cloud…" });
expect(moveLine({ phase: "copy", chats: { done: 34, total: 120 } }, "local")?.text).toBe("Moving your bots to My Cloud… 34 of 120 chats");
diff --git a/src/lib/cloud-send.ts b/src/lib/cloud-send.ts
index d51b90e774..a4a1fddfd0 100644
--- a/src/lib/cloud-send.ts
+++ b/src/lib/cloud-send.ts
@@ -1,6 +1,6 @@
// What either page says about the one-time move to My Cloud (electron/one-home.mjs), and what arrived, in words.
import type { CloudSendCounts } from "../../electron/cloud-send.mjs";
-import type { OneHomeCounts, OneHomeNotCarried, OneHomeView } from "../../electron/one-home.mjs";
+import type { OneHomeCounts, OneHomeNotCarried, OneHomeStayed, OneHomeView } from "../../electron/one-home.mjs";
import type { TeamMoveView } from "../../electron/team-move.mjs";
import type { LocaleKey } from "@/locales";
import { activeLocale, t } from "@/lib/i18n";
@@ -54,6 +54,10 @@ export function moveQuietUntil(move: OneHomeView | null | undefined): number {
/** What a move could not carry, one line each: its name, then why. */
const notCarried = (items: OneHomeNotCarried[] | undefined) => (items ?? []).map((item) => `${item.label}: ${item.error}`);
+/** What stayed on this computer because it only works here, one line each. */
+const stayedHere = (items: OneHomeStayed[] | undefined) => (items ?? []).map((item) => (item.needs
+ ? t("cloudSend.move.stayedNeeds", { name: item.name, program: item.needs })
+ : t("cloudSend.move.stayedHere", { name: item.name })));
/** The one-time move's line on either page: on its way (with progress, or who it waits for), almost done, failing for a
* day (with Try again), what arrived (on My Cloud's page, once), coming home, where the bots came home instead, or this
@@ -64,8 +68,8 @@ export function moveLine(move: OneHomeView, page: "local" | "cloud"): { kind: "s
if (move.phase === "done") {
if (page !== "cloud") return null;
const list = move.counts ? arrivedList(move.counts) : [];
- const text = move.left?.length ? t("cloudSend.move.doneLeft") : list.length ? t("cloudSend.move.done", { list: listOf(list) }) : t("cloudSend.move.doneAll");
- return { kind: "done", text, extra: [...notCarried(move.left), ...move.held.map((key) => t("cloudSend.result.held", { key }))], ...(move.phone ? { phone: true as const } : {}) };
+ const text = move.left?.length || move.stayed?.length ? t("cloudSend.move.doneLeft") : list.length ? t("cloudSend.move.done", { list: listOf(list) }) : t("cloudSend.move.doneAll");
+ return { kind: "done", text, extra: [...notCarried(move.left), ...stayedHere(move.stayed), ...move.held.map((key) => t("cloudSend.result.held", { key }))], ...(move.phone ? { phone: true as const } : {}) };
}
if (move.phase === "keeping") return { kind: "sending", text: t(move.updating ? "cloudSend.move.keepingUpdating" : "cloudSend.move.keeping"), extra: [] };
if (move.phase === "home-again" || move.phase === "back") {
@@ -104,7 +108,7 @@ export function moveLine(move: OneHomeView, page: "local" | "cloud"): { kind: "s
* of it here. */
function ownMoveLine(move: OneHomeView, place: string, page: "local" | "cloud"): ReturnType<typeof moveLine> {
// What that server refused for good is said there, where the window opens once the move is done.
- if (move.phase === "done" && page === "cloud" && move.left?.length) return { kind: "done", text: t("cloudSend.move.doneLeft"), extra: notCarried(move.left), place };
+ if (move.phase === "done" && page === "cloud" && (move.left?.length || move.stayed?.length)) return { kind: "done", text: t("cloudSend.move.doneLeft"), extra: [...notCarried(move.left), ...stayedHere(move.stayed)], place };
if (page !== "local" || !["copy", "wait", "finishing"].includes(move.phase)) return null;
const line = (kind: "sending" | "failed", text: string, more: { retry?: true; reason?: string; extra?: string[] } = {}) => ({ kind, text, extra: [], place, ...more });
const failing = "failing" in move ? move.failing : undefined;
diff --git a/src/locales/en.json b/src/locales/en.json
index 7686f3f943..6a997d5b80 100644
--- a/src/locales/en.json
+++ b/src/locales/en.json
@@ -136,6 +136,9 @@
"notice.dismiss": "Dismiss for good",
"notice.notNow": "Not now",
"notice.openFailed": "Could not open your browser. Please try again.",
+ "server.moves.connectorStayedMail": "{name} stayed on {computer} when your bots moved to My Cloud, so bots here can't read or send mail through it. It keeps its accounts on {computer}, and it can't reach a mail server from here.",
+ "server.moves.connectorStayedProgram": "{name} stayed on {computer} when your bots moved to My Cloud, so bots here can't use it. It needs {program}, which My Cloud doesn't have.",
+ "server.moves.connectorStayedHere": "{name} stayed on {computer} when your bots moved to My Cloud, so bots here can't use it. It uses files or an address only {computer} has.",
"server.moves.webhookMoved": "Now that I live on {place}, my webhook \"{name}\" has a new address. Open Automations, choose Copy address on \"{name}\", and paste it into the app that sends to it.",
"server.teammates.sameRequest": "Another teammate asked the same a moment ago, so this gets that answer instead of a second one.",
"server.reports.sent": "Sent to the MausBot team (report {report}). Milind and Omkar get it by email.",
@@ -1210,6 +1213,8 @@
"cloudSend.move.done": "Everything from this computer is here: {list}.",
"cloudSend.move.doneAll": "Everything from this computer is here.",
"cloudSend.move.doneLeft": "Everything else from this computer is here. These stayed on it:",
+ "cloudSend.move.stayedNeeds": "{name}: it needs {program}, which isn't here, so bots here can't use it.",
+ "cloudSend.move.stayedHere": "{name}: it only works on that computer, so bots here can't use it.",
"cloudSend.move.phone": "Pair your phone with My Cloud",
"cloudSend.move.homeAgain": "My Cloud has ended, so your bots are back on this computer. What you did on My Cloud is on its way back too.",
"cloudSend.move.back": "My Cloud has ended, so your bots are back on this computer, with what you did on My Cloud. Logins and keys you added on My Cloud didn't come back: add them here again if you need them.",