Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
Team Clouds sleep like any home; a bot-to-bot hand-off holds it awake
milind-soni150515b92190
diff --git a/docs/cloud-pro.md b/docs/cloud-pro.mdindex b5ede22ebd..39e9e722d0 100644--- a/docs/cloud-pro.md+++ b/docs/cloud-pro.md@@ -1734,7 +1734,10 @@ judge a pending timer by a wall-clock time stored when it was set.- no turn running (bots, rooms, delegated work), no routine run queued to startnow or running (one waiting on a person doesn't count: their answer wakes- the home), no Live call, no cloud computer on or starting (its idle timer+ the home), no work one bot handed another still moving on by itself (an+ assignment queued, running or due to resume its requester, or a report to+ send; one parked on a person's answer doesn't count), no Live call, no cloud+ computer on or starting (its idle timerlives in this process), no maintenance (backup or restore, Move to Cloud, anengine or browser install, a provider sign-in) and no request in progress;- nobody used the home for 10 minutes (the Admin may ask for another window).@@ -1755,8 +1758,10 @@ its own nonces. `200`:"nextDueAt": 1792358600000, "sleeping": false, "wokeBy": { "by": "events", "background": true } }```-`busy` holds fixed codes only: `turn`, `run`, `live-call`, `computer`,-`maintenance`, `recent-activity`, `recent-work`, `just-woke`, `due-soon`.+`busy` holds fixed codes only: `turn`, `run`, `handoff`, `live-call`,+`computer`, `maintenance`, `recent-activity`, `recent-work`, `just-woke`,+`due-soon`. A Team Cloud answers like any other home: its plan decides whether+the Admin ever asks.`nextDueAt` is the earliest enabled routine's next run or queued run's retry,or, while a bot waits for something (`wait_until`), 30 minutes on, so itschecks go on that often: the Admin starts a sleeping home a minute before itdiff --git a/docs/team-cloud.md b/docs/team-cloud.mdindex a17596c303..261bef88b5 100644--- a/docs/team-cloud.md+++ b/docs/team-cloud.md@@ -83,8 +83,12 @@ keeps people apart on it. The bot box ([bot-box.md](bot-box.md)) is what makes t*Paired devices* lists the phones those codes opened as *device · member* (`GET /api/team/phones`): a member sees theirown, the Super admin and Admins every member's. **Remove** (`DELETE /api/team/phones/<id>`, the same rule) signs thatphone out at once and closes its open streams; the app windows the Admin signs in are not listed there.-- **Never asleep, kept across restarts.** A Team Cloud refuses the Admin's sleep request (`busy: ["team"]`) and keeps- every member's session across a restart; a My Cloud revokes every session that is not its owner's at each boot.+- **Asleep only when nobody needs it, kept across restarts.** On a plan that sleeps, a Team Cloud answers the Admin's+ sleep request as any home does ([Sleeping homes](cloud-pro.md#sleeping-homes-the-power-read-and-the-sleep-handshake)):+ not while any member used it in the last minutes, a turn or routine runs, or work one bot handed another is still+ moving (`handoff`). A member's app, phone or a webhook wakes it, and the Admin wakes it before a routine is due. Inbox+ lines and open cards live on its volume, so a person's answer after a sleep finds them. It keeps every member's+ session across a restart; a My Cloud revokes every session that is not its owner's at each boot.### Off a teamdiff --git a/server/cloud-power.test.ts b/server/cloud-power.test.tsindex e6be297268..3fb0c0e435 100644--- a/server/cloud-power.test.ts+++ b/server/cloud-power.test.ts@@ -25,10 +25,10 @@ function home(probes: Partial<CloudPowerProbes> = {}) {let clock = START;const dataDir = mkdtempSync(join(tmpdir(), "omb-cloud-power-"));dirs.push(dataDir);- const state = { turn: false, run: false, liveCall: false, computer: false, maintenance: false, nextDueAt: null as number | null };+ const state = { turn: false, run: false, handoff: false, liveCall: false, computer: false, maintenance: false, nextDueAt: null as number | null };const sent: Record<string, unknown>[] = [];const power = createCloudPower({ dataDir, now: () => clock, broadcast: (payload) => sent.push(payload), probes: {- turn: () => state.turn, run: () => state.run, liveCall: () => state.liveCall, computer: () => state.computer,+ turn: () => state.turn, run: () => state.run, handoff: () => state.handoff, liveCall: () => state.liveCall, computer: () => state.computer,maintenance: () => state.maintenance, nextDueAt: () => state.nextDueAt, ...probes,} });powers.push(power);@@ -48,8 +48,8 @@ describe("the home's idle verdict", () => {it("names every kind of work that keeps it awake", () => {const h = home();h.pass(CLOUD_IDLE_AWAKE_MS);- Object.assign(h.state, { turn: true, run: true, liveCall: true, computer: true, maintenance: true });- expect(h.power.report().busy).toEqual(["turn", "run", "live-call", "computer", "maintenance"]);+ Object.assign(h.state, { turn: true, run: true, handoff: true, liveCall: true, computer: true, maintenance: true });+ expect(h.power.report().busy).toEqual(["turn", "run", "handoff", "live-call", "computer", "maintenance"]);});it("stays awake two minutes after work ends, ten after someone used it", () => {@@ -276,19 +276,19 @@ describe("the Admin's signed power routes", () => {});});-describe("a Team Cloud", () => {- it("never sleeps: the Admin's sleep request is refused as busy with the team, however idle it is", () => {- let clock = START;- const dataDir = mkdtempSync(join(tmpdir(), "omb-cloud-power-team-"));- dirs.push(dataDir);- const power = createCloudPower({ dataDir, team: true, now: () => clock, broadcast: () => {}, probes: {- turn: () => false, run: () => false, liveCall: () => false, computer: () => false, maintenance: () => false, nextDueAt: () => null,- } });- powers.push(power);- for (let left = CLOUD_IDLE_AWAKE_MS; left > 0; left -= 5_000) { clock += 5_000; power.tick(); }- expect(power.report()).toMatchObject({ idle: true, busy: [] });- expect(power.prepareSleep()).toEqual({ ok: false, busy: ["team"] });- expect(power.sleeping()).toBe(false);- expect(existsSync(join(dataDir, "cloud-sleep.json"))).toBe(false);+describe("a hand-off between bots", () => {+ it("keeps the home awake until it ends and its follow-ups get going, then the home sleeps like any other", () => {+ const h = home();+ h.pass(CLOUD_IDLE_AWAKE_MS);+ h.state.handoff = true;+ h.pass(5_000);+ expect(h.power.report()).toMatchObject({ idle: false, busy: ["handoff"] });+ expect(h.power.prepareSleep()).toEqual({ ok: false, busy: ["handoff"] });+ expect(h.power.sleeping()).toBe(false);+ h.state.handoff = false;+ expect(h.power.prepareSleep()).toEqual({ ok: false, busy: ["recent-work"] });+ h.pass(CLOUD_IDLE_WORK_MS);+ expect(h.power.prepareSleep()).toEqual({ ok: true, nextDueAt: null });+ expect(existsSync(join(h.dataDir, "cloud-sleep.json"))).toBe(true);});});diff --git a/server/cloud-power.ts b/server/cloud-power.tsindex ca36af388b..e495cfd2fb 100644--- a/server/cloud-power.ts+++ b/server/cloud-power.ts@@ -11,7 +11,7 @@ import { join } from "node:path";import { writeFileAtomic } from "./atomic.ts";/** Why a home is not idle, as fixed codes (the Admin keeps the latest one for its operator page). */-export type CloudPowerBusy = "turn" | "run" | "live-call" | "computer" | "maintenance" | "recent-activity" | "recent-work" | "just-woke" | "due-soon" | "team";+export type CloudPowerBusy = "turn" | "run" | "handoff" | "live-call" | "computer" | "maintenance" | "recent-activity" | "recent-work" | "just-woke" | "due-soon";export interface CloudPowerReport {v: 1; at: number; bootedAt: number; wokeAt: number;@@ -32,6 +32,9 @@ export interface CloudPowerProbes {turn(): boolean;/** A routine run is queued to start now, starting or running. One waiting for a person's answer is not: the answer wakes the home. */run(): boolean;+ /** Work one bot handed another moves on without anyone: an assignment queued, running or due to resume its requester, or a+ * report to send. One parked on a person's answer is not: the answer wakes the home. */+ handoff(): boolean;liveCall(): boolean;/** A cloud computer is on, starting or within its own idle window: its idle timer lives in this process. */computer(): boolean;@@ -102,8 +105,6 @@ export function wokeFromSleep(dataDir: string): boolean {export function createCloudPower(options: {dataDir: string; probes: CloudPowerProbes;- /** A Team Cloud: the Admin never sleeps a team plan, and a sleep request is refused as busy with `team`. */- team?: boolean;/** Tells connected clients the home is going to sleep (`{ kind: "power", state: "sleeping" }`). */broadcast(payload: Record<string, unknown>): void;now?: () => number;@@ -134,6 +135,7 @@ export function createCloudPower(options: {const { probes } = options;if (probes.turn()) busy.push("turn");if (probes.run()) busy.push("run");+ if (probes.handoff()) busy.push("handoff");if (probes.liveCall()) busy.push("live-call");if (probes.computer()) busy.push("computer");if (probes.maintenance() || inFlight > 0) busy.push("maintenance");@@ -207,7 +209,7 @@ export function createCloudPower(options: {/** The Admin is about to suspend or stop this machine: yes only when idle now. From here until a resume, someone's* use or CLOUD_SLEEP_PENDING_MS, held polls answer "asleep" and new ones are refused (`sleeping`). */prepareSleep(activityMs = CLOUD_IDLE_ACTIVITY_MS): { ok: true; nextDueAt: number | null } | { ok: false; busy: CloudPowerBusy[] } {- const busy = options.team ? ["team" as const, ...busyNow(activityMs)] : busyNow(activityMs);+ const busy = busyNow(activityMs);if (busy.length) return { ok: false, busy };sleepingSince = now();try { writeFileAtomic(join(options.dataDir, MARKER), JSON.stringify({ at: sleepingSince })); }diff --git a/server/cloud-team-sleep.e2e.test.ts b/server/cloud-team-sleep.e2e.test.tsnew file mode 100644index 0000000000..fd5bf8fedf--- /dev/null+++ b/server/cloud-team-sleep.e2e.test.ts@@ -0,0 +1,160 @@+// A real Team Cloud home (OMB_CLOUD_ROLE=team) whose idle windows are a quarter second (the power clock): it agrees to+// the Admin's sleep request once nobody uses it, waits while a member does, and waits for work one bot handed another+// until it is done. The engine is the synthetic Claude CLI with each bot's tool calls scripted; nothing leaves loopback.+import { randomBytes } from "node:crypto";+import { spawn, type ChildProcess } from "node:child_process";+import { mkdtempSync, rmSync, writeFileSync } from "node:fs";+import { tmpdir } from "node:os";+import { join } from "node:path";+import { fileURLToPath, pathToFileURL } from "node:url";+import { afterAll, beforeAll, expect, it } from "vitest";+import { cloudPairingSignature, cloudRequestSignature } from "./cloud-home.ts";+import { removeTempDir, waitForExit } from "./testing/cleanup.ts";+import { hostTimeout } from "./testing/host-timeout.ts";+import { freePortBlock } from "./testing/ports.ts";++const SERVER_DIR = fileURLToPath(new URL("./", import.meta.url));+const HOST = "omb-t-3f2e1d0c9b8a.fly.dev";+const MACHINE = "8e2f4a6b-1c3d-4e5f-8a7b-9c0d1e2f3a4b";+const TEAM = { id: "team-sleep-1", name: "Harbor" };+const OWNER = { email: "[email protected]", role: "owner" as const }, MEMBER = { email: "[email protected]", role: "member" as const };+const EDGE = { host: HOST, "x-forwarded-for": "203.0.113.9", "x-forwarded-proto": "https", origin: `https://${HOST}` };+const secret = randomBytes(32).toString("base64url");+type Bot = { id: string; threadId: string };+let home = "", base = "", log = "", owner = "", member = "";+let child: ChildProcess | undefined;+let lead: Bot, helper: Bot;++const sleep = (ms: number) => new Promise((done) => setTimeout(done, ms));++async function as(token: string, method: string, path: string, body?: unknown) {+ const response = await fetch(`${base}${path}`, { method, body: body === undefined ? undefined : JSON.stringify(body),+ headers: { ...EDGE, authorization: `Bearer ${token}`, ...(body === undefined ? {} : { "content-type": "application/json" }) } });+ return { status: response.status, body: await response.json().catch(() => null) as any };+}++/** The Admin's signed calls: its power read and its sleep request. */+async function admin(method: "GET" | "POST", path: string, body = "") {+ const timestamp = String(Math.floor(Date.now() / 1000)), nonce = randomBytes(16).toString("base64url");+ const response = await fetch(`${base}${path}`, { method, ...(method === "POST" ? { body } : {}), headers: {+ ...EDGE, ...(method === "POST" ? { "content-type": "application/json" } : {}),+ "x-omb-cloud-timestamp": timestamp, "x-omb-cloud-nonce": nonce, "x-omb-cloud-signature": `v1=${cloudRequestSignature(secret, timestamp, nonce, method, path, body)}`,+ } });+ return { status: response.status, body: await response.json().catch(() => null) as any };+}+const askToSleep = (idleMinutes?: number) => admin("POST", "/api/cloud/power/sleep", JSON.stringify({ v: 1, ...(idleMinutes === undefined ? {} : { idleMinutes }) }));++/** The Admin's signed pairing with a member claim, redeemed into that member's bearer. */+async function pair(person: { email: string; role: "owner" | "member" }) {+ const body = JSON.stringify({ label: "OpenMausBot app (Team Cloud)", ttlSeconds: 300, team: TEAM, member: person });+ const timestamp = String(Math.floor(Date.now() / 1000)), nonce = randomBytes(16).toString("base64url");+ const minted = await fetch(`${base}/api/cloud/pairing`, { method: "POST", body, headers: { ...EDGE, "content-type": "application/json",+ "x-omb-cloud-timestamp": timestamp, "x-omb-cloud-nonce": nonce, "x-omb-cloud-signature": `v1=${cloudPairingSignature(secret, timestamp, nonce, body)}` } });+ expect(minted.status, log.slice(-2000)).toBe(200);+ const { code } = await minted.json() as { code: string };+ const paired = await fetch(`${base}/api/auth/pair`, { method: "POST", headers: { ...EDGE, "content-type": "application/json" }, body: JSON.stringify({ code }) });+ return ((await paired.json()) as { token: string }).token;+}++/** Each bot's engine reads its own scripted tool calls (its working folder names the bot); a held call ends with `release`. */+const script = (bot: Bot, calls: unknown[] | null) => {+ const file = join(home, `tools-${bot.id}.json`);+ if (calls) writeFileSync(file, JSON.stringify(calls)); else rmSync(file, { force: true });+};++/** Asks until the home agrees (the power clock's windows are a quarter second), or gives up after `ms`. */+async function sleepsWithin(ms: number) {+ let answer = await askToSleep();+ for (const deadline = Date.now() + ms; answer.status !== 200 && Date.now() < deadline;) {+ await sleep(250);+ answer = await askToSleep();+ }+ return answer;+}++beforeAll(async () => {+ home = mkdtempSync(join(tmpdir(), "omb-cloud-team-sleep-"));+ const cli = join(home, "fixture-claude.mjs");+ writeFileSync(cli, `#!/usr/bin/env node+import { readdirSync } from "node:fs";+if (process.argv[2] === "auth") { console.log(JSON.stringify({ loggedIn: true, email: "[email protected]" })); process.exit(0); }+process.env.FAKE_CLAUDE_VERSION = "2.1.284";+process.env.FAKE_CLAUDE_RELEASE = ${JSON.stringify(join(home, "release"))};+const own = readdirSync(${JSON.stringify(home)}).map((name) => /^tools-(.+)\\.json$/.exec(name)?.[1]).find((id) => id && process.cwd().includes(id));+if (own) process.env.FAKE_CLAUDE_TOOL_CALLS_FILE = ${JSON.stringify(home)} + "/tools-" + own + ".json";+await import(${JSON.stringify(pathToFileURL(join(SERVER_DIR, "testing", "fake-claude-cli.ts")).href)});+`, { mode: 0o755 });+ writeFileSync(join(home, "config.json"), JSON.stringify({ instances: { claude: { driver: "claudeAgent", displayName: "Fixture", config: { cli } } } }));+ const port = await freePortBlock([0, 1]);+ base = `http://127.0.0.1:${port}`;+ const offline = `data:text/javascript,${encodeURIComponent('const real = globalThis.fetch; globalThis.fetch = async (url, init) => String(url).startsWith("http://127.0.0.1:") ? real(url, init) : new Response("offline fixture", { status: 503 });')}`;+ child = spawn(process.execPath, ["--import", offline, "--import", new URL("./testing/power-clock-hooks.mjs", import.meta.url).href, join(SERVER_DIR, "index.ts")], {+ cwd: join(SERVER_DIR, ".."),+ env: {+ PATH: process.env.PATH, ...(process.env.SystemRoot ? { SystemRoot: process.env.SystemRoot } : {}), HOME: home, USERPROFILE: home, OMB_DATA_DIR: home,+ OMB_PORT: String(port), OMB_WEBHOOK_PORT: String(port + 1), OMB_CLOUD_ROLE: "team", OMB_CLOUD_TEAM_ID: TEAM.id, OMB_CLOUD_TEAM_NAME: TEAM.name,+ OMB_CLOUD_MACHINE_ID: MACHINE, OMB_CLOUD_ADMIN_URL: "https://cloud.example.test", OMB_CLOUD_BOOTSTRAP_SECRET: secret, OMB_PUBLIC_URL: `https://${HOST}`,+ OMB_TEST_POWER_CLOCK: "1",+ },+ stdio: ["ignore", "pipe", "pipe"],+ });+ child.stdout?.on("data", (chunk) => { log += chunk; });+ child.stderr?.on("data", (chunk) => { log += chunk; });+ const deadline = Date.now() + 30_000;+ for (;;) {+ if (child.exitCode !== null) throw new Error(`the server exited:\n${log}`);+ try { if ((await fetch(`${base}/api/health`)).ok) break; } catch {}+ if (Date.now() > deadline) throw new Error(`the server did not start:\n${log}`);+ await sleep(100);+ }+ owner = await pair(OWNER);+ member = await pair(MEMBER);+ const make = async (name: string) => {+ const made = await as(owner, "POST", "/api/bots", { name, modelSelection: { instanceId: "claude", model: "claude-sonnet-5" } });+ expect(made.status, JSON.stringify(made.body)).toBe(201);+ return made.body.bot as Bot;+ };+ lead = await make("Lead");+ helper = await make("Helper");+}, hostTimeout(90_000));++afterAll(async () => {+ if (child) await waitForExit(child, { signal: "SIGTERM" });+ if (home) await removeTempDir(home);+});++it("with nobody using it, reports idle and agrees to sleep: no hold for being a team's", async () => {+ const answer = await sleepsWithin(20_000);+ expect(answer, log.slice(-2000)).toMatchObject({ status: 200, body: { ok: true } });+ expect((await admin("GET", "/api/cloud/power")).body).toMatchObject({ sleeping: true });+ // A member opening it ends the sleep the Admin had not carried out yet.+ expect((await as(member, "GET", "/api/auth/session")).status).toBe(200);+ expect((await admin("GET", "/api/cloud/power")).body.sleeping).toBe(false);+}, hostTimeout(60_000));++it("waits while a member uses it", async () => {+ expect((await as(member, "GET", "/api/bots")).status).toBe(200);+ const read = await admin("GET", "/api/cloud/power?idleMinutes=10");+ expect(read.body).toMatchObject({ idle: false });+ expect(read.body.busy).toContain("recent-activity");+ const refused = await askToSleep(10);+ expect(refused.status).toBe(409);+ expect(refused.body.busy).toContain("recent-activity");+ expect(refused.body.busy).not.toContain("team");+}, hostTimeout(30_000));++it("waits for a hand-off between two bots until it is done, then sleeps", async () => {+ script(lead, [{ name: "coordinate_bots", server: "agents", input: { bot_ids: [helper.id], message: "Count the rooms on floor two." } }]);+ script(helper, [{ name: "Bash", input: { command: "echo counting" }, hold: true }]);+ const sent = await as(owner, "POST", `/api/bots/${lead.id}/messages`, { text: "Ask Helper to count the rooms.", threadId: lead.threadId });+ expect(sent.status, JSON.stringify(sent.body)).toBe(202);+ await expect.poll(async () => (await admin("GET", "/api/cloud/power")).body.busy, { timeout: 45_000, interval: 250 }).toContain("handoff");+ const refused = await askToSleep();+ expect(refused.status).toBe(409);+ expect(refused.body.busy).toContain("handoff");+ script(lead, null);+ writeFileSync(join(home, "release"), "");+ await expect.poll(async () => (await admin("GET", "/api/cloud/power")).body.busy, { timeout: 60_000, interval: 250 }).not.toContain("handoff");+ const answer = await sleepsWithin(30_000);+ expect(answer, log.slice(-2000)).toMatchObject({ status: 200, body: { ok: true } });+}, hostTimeout(150_000));diff --git a/server/cloud-team.e2e.test.ts b/server/cloud-team.e2e.test.tsindex 3415b16128..3124cebe62 100644--- a/server/cloud-team.e2e.test.ts+++ b/server/cloud-team.e2e.test.ts@@ -94,14 +94,15 @@ it("pairs three people with the Admin's signed claims, each with their role, andexpect((await fx.onCloud("GET", "/api/auth/session")).body.team).toBeUndefined();}, hostTimeout(60_000));-it("keeps every member's session across a restart, never sleeps, and exports for the Owner only", async () => {+it("keeps every member's session across a restart, waits to sleep only while it is used, and exports for the Owner only", async () => {await team.relaunch();expect((await team.as(ada, "GET", "/api/auth/session")).status).toBe(200);expect((await team.as(cleo, "GET", "/api/auth/session")).status).toBe(200);expect((await team.as(owner, "GET", "/api/auth/session")).status).toBe(200);const sleep = await team.signed("POST", "/api/cloud/power/sleep", {});expect(sleep.status, JSON.stringify(sleep.body)).toBe(409);- expect(sleep.body.busy).toContain("team");+ expect(sleep.body.busy).toEqual(expect.arrayContaining(["recent-activity", "just-woke"]));+ expect(sleep.body.busy).not.toContain("team");expect((await team.signed("GET", "/api/cloud/power")).status).toBe(200);expect((await team.signed("GET", "/api/cloud/health")).status).toBe(200);// A member reaches nothing an admin does: the team's setup is the admins'.diff --git a/server/index.ts b/server/index.tsindex 2ca4a5bad2..5fd0fb621b 100644--- a/server/index.ts+++ b/server/index.ts@@ -15515,8 +15515,8 @@ restoreChannelMessages();if (movedAutoPins) console.log(`Works on: moved ${movedAutoPins} auto-pinned thread(s) to their bot's current Works on`);}-if (CLOUD_HOME) registerCloudPower(cloudPower = createCloudPower({ dataDir: DATA_DIR, team: CLOUD_TEAM !== null, broadcast: (payload) => broadcast(payload), log: (line) => console.warn(line), probes: {- turn: () => store.bots.some((bot) => botHasActiveTurn(bot.id)) || store.groups.some(groupIsWorking), run: () => Boolean(routines?.hasActiveRuns()),+if (CLOUD_HOME) registerCloudPower(cloudPower = createCloudPower({ dataDir: DATA_DIR, broadcast: (payload) => broadcast(payload), log: (line) => console.warn(line), probes: {+ turn: () => store.bots.some((bot) => botHasActiveTurn(bot.id)) || store.groups.some(groupIsWorking), run: () => Boolean(routines?.hasActiveRuns()), handoff: () => coordinator.pace() === "busy",liveCall: () => liveCalls.current() !== null, computer: () => cloudComputerPower.awake() || boatLifecycleBusyBots.size > 0, nextDueAt: () => { const due = [routines?.nextDueAt() ?? null, proactive.brief.nextWakeAt(), botWaits.nextWakeAt()].filter((at): at is number => at !== null); return due.length ? Math.min(...due) : null; },maintenance: () => workspaceMaintenance.active || providerFleetReloading || providerAuthSessions.active || browserEngineInstall !== null } }));diff --git a/server/waits.test.ts b/server/waits.test.tsindex 80865dbc44..3920f63cde 100644--- a/server/waits.test.ts+++ b/server/waits.test.ts@@ -280,7 +280,7 @@ describe("WaitManager", () => {await h.create({ kind: "url_contains", url: "https://x.test/", text: "shipped" });const idle = () => false;const power = createCloudPower({ dataDir: dirname(h.file), now: h.now, broadcast: () => {}, probes: {- turn: idle, run: idle, liveCall: idle, computer: idle, maintenance: idle, nextDueAt: () => h.manager.nextWakeAt(),+ turn: idle, run: idle, handoff: idle, liveCall: idle, computer: idle, maintenance: idle, nextDueAt: () => h.manager.nextWakeAt(),} });try {for (let left = CLOUD_IDLE_AWAKE_MS; left > 0; left -= 5_000) { h.advance(5_000); power.tick(); }