Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
Bots check back later, and hand-offs show who's working on what (1/2: check back later) (#6621)
Milind Sonif10d1832f967
diff --git a/docs/routine-schedules.md b/docs/routine-schedules.mdindex 715a85449c..71648eb657 100644--- a/docs/routine-schedules.md+++ b/docs/routine-schedules.md@@ -19,6 +19,41 @@ In **Automations → Schedule**, choose **Monthly**, **Yearly**, or **Custom crocan be changed. Saved cron routines retain their own zone even on anothercomputer. Editing just a title or instructions preserves the exact schedule.+## Check back later++For "check CI in 5 minutes", "check the payroll export reached the bank at 4 pm"+or "chase the client Friday if they haven't replied", a bot uses `check_back`+instead of a routine. It takes `when` ("in 2 hours", "Friday 9am",+"tomorrow 16:00" in the person's zone, or an exact time with its offset),+`note` (what to check) and an optional `if`. A day and a time are read in the+person's zone: the computer's on a desktop, the one the person's app gave on a+Cloud. A Team Cloud has one zone for everyone (the one its owner's app gave),+so a member elsewhere is best served by a span or a time with its offset; the+bot's answer names the zone and the exact time it set. At that time the same bot takes an+ordinary turn in the same conversation with the note, checks, and carries on.+It counts as a normal turn for usage. Nobody is asked to approve anything:+the conversation shows one quiet line ("Will check back Fri 9:00 · Cancel"),+which becomes "Checked back Fri 9:00" once it runs. Cancel is optional.++- **Who may set one:** a turn the person's own request started in their+ one-to-one chat with the bot, or a check-back's own turn (so it can look again+ later). A room, work another bot handed on, a routine, an outside event and a+ Cloud guest get a one-line refusal, and the bot finishes in its turn.+- **Limits:** at least a minute and at most 90 days ahead; 10 waiting per+ conversation and 50 per bot. Over a limit the bot is told why in one line.+- **Reliable:** each check-back is kept in `check-backs.json`. The desktop runs+ them only while OpenMausBot is running; a check-back that came due while the+ computer slept or the app was closed runs once, late, when it is back, and+ its turn says it is late. A Cloud wakes for the next one. One that was being+ started when the server stopped is closed with a line, never started twice.+ A paused bot is waited out; any other refused start is tried again each+ minute for an hour, then its line says it couldn't check back.+- **Gone with what it belongs to:** a check-back whose conversation or bot is+ deleted is dropped. On a Team Cloud it belongs to the conversation's audience:+ one set in a member's private chat runs for that member's request (the asker+ owns the run) and stays in that chat; when they leave the team their private+ chats, and so their check-backs, go.+## Off, on, and doneThe switch on **Automations** pauses a schedule or a webhook and turns it backdiff --git a/docs/verification/README.md b/docs/verification/README.mdindex 43c2044bb9..3c69deab90 100644--- a/docs/verification/README.md+++ b/docs/verification/README.md@@ -68,6 +68,7 @@ Use only mapped, tested commands:- [Native dictation retention and send-to-stop](dictation.md)- [Proactive routines and the brief](proactive-routines.md)- [Waits: tell me when, with no AI while waiting](waits.md)+- [Check-backs: a bot comes back later by itself](check-backs.md)- [A new Cloud's first hour](first-hour.md)- [Chat widgets](widgets.md)- [Pages and apps in a room](room-pages.md)diff --git a/docs/verification/check-backs.md b/docs/verification/check-backs.mdnew file mode 100644index 0000000000..fbdb27b340--- /dev/null+++ b/docs/verification/check-backs.md@@ -0,0 +1,27 @@+# Check-backs: a bot comes back later by itself++A bot calls `check_back` with a time and a note; at that time it takes a turn in the same+conversation with the note. See [Routine schedules](../routine-schedules.md#check-back-later).++## Automated checks++```sh+pnpm exec vitest run server/host/check-back-time.test.ts server/host/check-backs.test.ts server/routes/check-backs.test.ts src/components/CheckBackLine.dom.test.ts+OMB_TEST_PORTS=20900-20999 pnpm exec vitest run server/check-backs.e2e.test.ts server/cloud-team-check-backs.e2e.test.ts+```++Unix sockets cap their path near 104 bytes: run the e2e tests with a short `TMPDIR`.++- `check-back-time`: spans, exact times, days and times in a zone, a skipped and a repeated+ wall-clock hour, refusals.+- `check-backs`: fires once at its time with nobody asked and the asker's origin; limits;+ restart and catch-up once, late; a start cut by a stop is never run again; cancel; a gone+ conversation, bot or person drops it; a busy chat waits; a refused start is retried.+- `check-backs.e2e`: on a fixture with the fake engine, a turn sets two check-backs, Cancel+ stops one, and a minute later the same bot is woken in the same conversation with the note+ and no card; that turn sets the next one.+- `cloud-team-check-backs.e2e`: on a Team Cloud, Ben's private chat sets one; it runs there for+ Ben's request (`origin.person` is Ben's key) and Cleo, the owner, never reads it.++**What it does not prove:** what a real model does with the note, and phones (they show the+line's English words).diff --git a/docs/verification/evidence/followups/check-back-line-dark.png b/docs/verification/evidence/followups/check-back-line-dark.pngnew file mode 100644index 0000000000..c5b25a191bBinary files /dev/null and b/docs/verification/evidence/followups/check-back-line-dark.png differdiff --git a/docs/verification/evidence/followups/check-back-line-light.png b/docs/verification/evidence/followups/check-back-line-light.pngnew file mode 100644index 0000000000..17250368a0Binary files /dev/null and b/docs/verification/evidence/followups/check-back-line-light.png differdiff --git a/packages/phone-protocol/src/check-back.ts b/packages/phone-protocol/src/check-back.tsnew file mode 100644index 0000000000..c57c1765c1--- /dev/null+++ b/packages/phone-protocol/src/check-back.ts@@ -0,0 +1,29 @@+/** What a check-back (a bot's `check_back`) is doing: waiting for its time, started its turn, or ended without one. */+export type CheckBackStatus = "pending" | "started" | "cancelled" | "dropped" | "failed";++/** The quiet line a check-back keeps in its conversation (`WireMessage.checkBack`), patched in place as it moves on. */+export interface CheckBackLine {+ id: string;+ /** When the bot comes back, epoch ms. */+ dueAt: number;+ status: CheckBackStatus;+ /** What the bot will check, in its words. */+ note: string;+ /** When its turn started, epoch ms; later than `dueAt` when the computer was asleep or the app closed. */+ startedAt?: number;+ /** Why it ended without a turn, one line. */+ why?: string;+}++/** `WireMessage.checkBack`: set on the line a check-back keeps in its conversation. */+export interface CheckBackLineField {+ checkBack?: CheckBackLine;+}++/** Pending check-backs a conversation and a bot may hold, and how near and far one may be set. */+export const CHECK_BACK_LIMITS = {+ perConversation: 10,+ perBot: 50,+ minMs: 60_000,+ maxMs: 90 * 24 * 60 * 60_000,+} as const;diff --git a/packages/phone-protocol/src/wire.ts b/packages/phone-protocol/src/wire.tsindex 295d15c5fa..6a5b69a3d1 100644--- a/packages/phone-protocol/src/wire.ts+++ b/packages/phone-protocol/src/wire.ts@@ -14,7 +14,7 @@ import type { CredentialTargetId, CUSTOM_SECRET_TARGET, SecretDelivery } from ".import type { TeamSetupRequest } from "./team-setup.ts"; import type { DefaultBotFields, HelperIntroField } from "./default-bot.ts";import type { SetupCardFields } from "./setup-card.ts"; import type { BugReportField } from "./devs-report-status.ts"; import type { AccessRequestCardField, BotAccessFields } from "./bot-access.ts";import type { RoutineRequestCardData } from "./routine-request.ts"; import type { SavedStepsMark } from "./saved-steps.ts";-import type { WebhookRequestCardData } from "./webhook-request.ts"; import type { WaitCardField, WaitLineField } from "./wait-request.ts"; import type { ComputerAskField } from "./computer-ask.ts";+import type { WebhookRequestCardData } from "./webhook-request.ts"; import type { WaitCardField, WaitLineField } from "./wait-request.ts"; import type { CheckBackLineField } from "./check-back.ts"; import type { ComputerAskField } from "./computer-ask.ts";import type { AppEventAttempt, AppTrigger, AppTriggerRequestCardData, AppTriggerService } from "./app-triggers.ts";import type { ProfileRequestCardData } from "./profile-request.ts";import type { ServerTextLine, ServerTextParams } from "./server-text.ts";@@ -436,7 +436,7 @@ export type CardAnswerer = (export const EXCERPT_SUMMARY_HEADER = "Historical excerpts in chronological order; newer corrections override older requests. These excerpts may omit earlier details.";/** One transcript line, serialized as stored. */-export interface WireMessage extends ServerTextLine, HelperIntroField, SetupCardFields, WaitLineField, BugReportField {+export interface WireMessage extends ServerTextLine, HelperIntroField, SetupCardFields, WaitLineField, CheckBackLineField, BugReportField {roomRequest?: { id: string; phase: "request" | "result" };id: string;role: "bot" | "user";diff --git a/scripts/ci-scope.mjs b/scripts/ci-scope.mjsindex 2dce8522e2..49b051f1f0 100644--- a/scripts/ci-scope.mjs+++ b/scripts/ci-scope.mjs@@ -90,6 +90,7 @@ export const VITEST_SUBSETS = {"server/cloud-team-bitwarden.e2e.test.ts","server/cloud-team-box-audience.e2e.test.ts","server/cloud-team-browser.e2e.test.ts",+ "server/cloud-team-check-backs.e2e.test.ts","server/cloud-team-connections.e2e.test.ts","server/cloud-team-conversation-share.e2e.test.ts","server/cloud-team-engine-homes.e2e.test.ts",diff --git a/scripts/ci-scope.test.ts b/scripts/ci-scope.test.tsindex c384e6cbdb..535847e6b4 100644--- a/scripts/ci-scope.test.ts+++ b/scripts/ci-scope.test.ts@@ -230,6 +230,7 @@ describe("CI outputs", () => {"server/cloud-team-bitwarden.e2e.test.ts","server/cloud-team-box-audience.e2e.test.ts","server/cloud-team-browser.e2e.test.ts",+ "server/cloud-team-check-backs.e2e.test.ts","server/cloud-team-connections.e2e.test.ts","server/cloud-team-conversation-share.e2e.test.ts","server/cloud-team-engine-homes.e2e.test.ts",diff --git a/server/activity.ts b/server/activity.tsindex e70d9b0942..0bc48f2afc 100644--- a/server/activity.ts+++ b/server/activity.ts@@ -79,6 +79,7 @@ const TEAM_ACTION_KEYS: Record<string, string> = {delete_trigger: "activity.tool.team.deleteTrigger",list_waits: "activity.tool.team.listWaits",wait_until: "activity.tool.team.waitUntil",+ check_back: "activity.tool.team.checkBack",add_mcp_server: "activity.tool.team.addMcpServer",app_settings: "activity.tool.team.appSettings",ask_bot: "activity.tool.team.askBot",diff --git a/server/check-backs.e2e.test.ts b/server/check-backs.e2e.test.tsnew file mode 100644index 0000000000..38766d0e95--- /dev/null+++ b/server/check-backs.e2e.test.ts@@ -0,0 +1,107 @@+// A bot checks back later by itself: the fake engine's turn sets a check-back through the real internal route, nobody+// presses anything, and at its time the same bot takes a turn in the same conversation with the note. The line in the+// chat moves from pending to started; Cancel on another one stops it. It proves timing, place and provenance, not a+// model's judgement.+import { mkdtempSync, readFileSync, unlinkSync, writeFileSync } from "node:fs";+import { tmpdir } from "node:os";+import { join } from "node:path";+import { expect, it } from "vitest";++import { launchVerificationServer, runControlOmb } from "../scripts/control-omb.ts";+import { removeTempDir } from "./testing/cleanup.ts";++it("wakes the same bot in the same conversation at its time with no human action, and Cancel stops another", async () => {+ const folder = mkdtempSync(join(tmpdir(), "omb-check-backs-"));+ const gate = join(folder, "finish");+ const fixture = await launchVerificationServer({ FAKE_CLAUDE_MODE: "slow", FAKE_CLAUDE_SLOW_FINISH_GATE: gate });+ const evidence: unknown[] = [];+ const api = async (method: string, path: string, body?: unknown, expected = 200, token?: string) => {+ const response = await fetch(fixture.info.url + path, {+ method, headers: { "content-type": "application/json", origin: fixture.info.url, ...(token ? { authorization: `Bearer ${token}` } : {}) },+ ...(body === undefined ? {} : { body: JSON.stringify(body) }),+ });+ const result = await response.json() as any;+ evidence.push({ method, path, body, status: response.status, result });+ expect(response.status, JSON.stringify(result)).toBe(expected);+ return result;+ };+ const dump = () => JSON.parse(readFileSync(fixture.fixtureDumpPath, "utf8"));+ const turnPrompt = (): string => {+ try {+ const content = dump().prompt?.message?.content;+ return Array.isArray(content) ? content.map((block: { text?: string }) => block.text ?? "").join("\n") : String(content ?? "");+ } catch { return ""; }+ };+ const turnToken = async () => {+ let token = "";+ await expect.poll(() => {+ try { token = dump().mcpConfig.mcpServers.agents.env.OMB_COMMS_TOKEN; } catch { return false; }+ return Boolean(token);+ }, { timeout: 15_000 }).toBe(true);+ return token;+ };+ try {+ const bot = (await api("POST", "/api/bots", { name: "Scout" }, 201)).bot;+ const busy = async () => (await api("GET", "/api/bots?messages=0")).bots.find((candidate: any) => candidate.id === bot.id).busy;+ const transcript = async (): Promise<any[]> => (await api("GET", `/api/threads/${bot.threadId}/messages?limit=100`)).messages;+ const lines = async () => (await transcript()).filter((m) => m.checkBack).map((m) => m.checkBack);++ await runControlOmb(["send", "--bot", bot.id, "--task", bot.threadId, "--text", "Merge it, then check CI in a minute", "--url", fixture.info.url]);+ const asked = await turnToken();+ const made = await api("POST", "/api/internal/check-backs", { when: "in 1 minute", note: "see if CI passed" }, 201, asked);+ expect(made.text).toMatch(/check-back id [\w-]+/);+ await api("POST", "/api/internal/check-backs", { when: "in 2 hours", note: "never" }, 201, asked);+ expect(await lines()).toMatchObject([{ status: "pending", note: "see if CI passed" }, { status: "pending", note: "never" }]);+ const second = (await lines())[1];+ await api("POST", `/api/check-backs/${second.id}/cancel`, undefined, 200);+ expect((await lines())[1]).toMatchObject({ status: "cancelled" });+ expect(await api("POST", "/api/internal/check-backs", { when: "in 20 seconds", note: "too soon" }, 409, asked)).toMatchObject({ error: expect.stringContaining("less than a minute") });++ writeFileSync(gate, "finish");+ await expect.poll(busy, { timeout: 15_000 }).toBe(false);+ unlinkSync(gate);++ await expect.poll(turnPrompt, { timeout: 90_000, interval: 500 }).toContain("What to check: see if CI passed");+ expect(turnPrompt()).toContain("[Check back:");+ const woken = await turnToken();+ expect(await lines()).toMatchObject([{ status: "started" }, { status: "cancelled" }]);+ const rows = await transcript();+ expect(rows.filter((m) => m.card && !m.card.answered && !m.card.dismissed)).toEqual([]);+ expect(rows.filter((m) => m.role === "user" && String(m.text ?? "").includes("[Check back:"))).toEqual([]);++ const again = await api("POST", "/api/internal/check-backs", { when: "in 5 minutes", note: "look at CI once more" }, 201, woken);+ expect(again.text).toContain("You will be woken here");+ writeFileSync(gate, "finish");+ await expect.poll(busy, { timeout: 15_000 }).toBe(false);+ expect(JSON.parse(readFileSync(join(fixture.info.dataDir, "check-backs.json"), "utf8")).checkBacks.map((c: any) => [c.threadId, c.note]))+ .toEqual([[bot.threadId, "look at CI once more"]]);+ } finally {+ writeFileSync(`${fixture.info.logPath}.check-backs.json`, JSON.stringify(evidence, null, 2));+ await fixture.close();+ await removeTempDir(folder);+ }+}, 180_000);++it("sets a check-back through the real tool call on a bot at Ask, with no card and no question", async () => {+ const fixture = await launchVerificationServer({+ FAKE_CLAUDE_TOOL_CALLS: JSON.stringify([{ server: "agents", name: "check_back", input: { when: "in 2 hours", note: "see if the client replied" } }]),+ });+ const api = async (method: string, path: string, body?: unknown) => {+ const response = await fetch(fixture.info.url + path, { method, headers: { "content-type": "application/json", origin: fixture.info.url }, ...(body === undefined ? {} : { body: JSON.stringify(body) }) });+ return { status: response.status, body: await response.json() as any };+ };+ try {+ const made = await api("POST", "/api/bots", { name: "Scout" });+ expect(made.status).toBe(201);+ const bot = made.body.bot;+ expect((await api("PATCH", `/api/bots/${bot.id}`, { approvalMode: "ask" })).status).toBe(200);+ await runControlOmb(["send", "--bot", bot.id, "--task", bot.threadId, "--text", "Chase the client in two hours if they haven't replied", "--url", fixture.info.url]);+ await runControlOmb(["wait", "--bot", bot.id, "--timeout", "60", "--url", fixture.info.url]);+ const rows = (await api("GET", `/api/threads/${bot.threadId}/messages?limit=100`)).body.messages as any[];+ expect(rows.filter((m) => m.checkBack).map((m) => m.checkBack)).toMatchObject([{ status: "pending", note: "see if the client replied" }]);+ expect(rows.filter((m) => m.kind === "options" || m.card)).toEqual([]);+ expect(rows.filter((m) => m.role === "user" && String(m.text ?? "").includes("[Check back:"))).toEqual([]);+ } finally {+ await fixture.close();+ }+}, 120_000);diff --git a/server/cloud-team-check-backs.e2e.test.ts b/server/cloud-team-check-backs.e2e.test.tsnew file mode 100644index 0000000000..b8e51ecdf8--- /dev/null+++ b/server/cloud-team-check-backs.e2e.test.ts@@ -0,0 +1,104 @@+// A check-back on a Team Cloud: Ben asks Scout in his private chat, Scout sets a check-back, and at its time Scout's+// turn runs in that same private chat for Ben's request, with nobody pressing anything. Cleo, the owner, can't read the+// chat or its line.+import { randomBytes } from "node:crypto";+import { readFileSync, rmSync, writeFileSync } from "node:fs";+import { join } from "node:path";+import { afterAll, beforeAll, expect, it } from "vitest";+import { launchCloudSendFixture, type CloudSendFixture, type CloudTeamFixture } from "../scripts/testing/cloud-send-fixture.ts";+import { personKey } from "./person-key.ts";+import { hostTimeout } from "./testing/host-timeout.ts";++const CLEO = { email: "[email protected]", role: "owner" as const };+const BEN = { email: "[email protected]", role: "member" as const };+const BEN_KEY = personKey({ id: "", email: BEN.email });+const ENGINE = `const { existsSync } = process.getBuiltinModule("node:fs");+const dir = process.env.FAKE_CLAUDE_FIXTURE_DIR;+process.env.FAKE_CLAUDE_DUMP = dir + "/dump.json";+process.env.FAKE_CLAUDE_REPLY_FILE = dir + "/reply.txt";+if (existsSync(dir + "/hang-mode")) { process.env.FAKE_CLAUDE_MODE = "hang"; process.env.FAKE_CLAUDE_RELEASE = dir + "/release"; }`;+const TOKEN = `ops_fake-team-${randomBytes(8).toString("hex")}`;++type Row = { id: string; role: string; kind: string; text?: string; checkBack?: { id: string; status: string; note: string } };++let fx: CloudSendFixture, team: CloudTeamFixture;+let cleo = "", ben = "";++const file = (name: string) => join(team.home, name);+const dump = () => { try { return JSON.parse(readFileSync(file("dump.json"), "utf8")); } catch { return null; } };+const prompt = (): string => JSON.stringify(dump()?.prompt ?? "");++async function until(done: () => Promise<boolean> | boolean, timeoutMs = 60_000): Promise<void> {+ const end = Date.now() + timeoutMs;+ while (!(await done())) {+ if (Date.now() > end) throw new Error(`timed out waiting\n${fx.logs().slice(-4_000)}`);+ await new Promise((resolve) => setTimeout(resolve, 250));+ }+}++beforeAll(async () => {+ fx = await launchCloudSendFixture({ onePasswordToken: TOKEN, team: { id: "team-acme-cb", name: "Acme", engine: ENGINE } });+ team = fx.team!;+ writeFileSync(file("reply.txt"), "Noted.");+ cleo = (await team.pair(CLEO)).token!;+ ben = (await team.pair(BEN)).token!;+}, hostTimeout(180_000));++afterAll(async () => {+ await fx?.close();+});++it("runs Ben's private check-back in his chat, for his request, with no human action, and keeps it from Cleo", async () => {+ const made = await team.as(cleo, "POST", "/api/bots", { visibility: "everyone", name: "Scout" });+ expect(made.status, JSON.stringify(made.body)).toBe(201);+ const scout = made.body.bot as { id: string };+ const opened = await team.as(ben, "POST", `/api/bots/${scout.id}/tasks`, { title: "Payroll" });+ expect(opened.status, JSON.stringify(opened.body)).toBe(201);+ const benThread = opened.body.task.threadId as string;++ writeFileSync(file("hang-mode"), "");+ rmSync(file("release"), { force: true });+ rmSync(file("dump.json"), { force: true });+ const sent = await team.as(ben, "POST", `/api/bots/${scout.id}/messages`, { text: "Send the payroll export, then check at 4 it reached the bank", threadId: benThread });+ expect(sent.status, JSON.stringify(sent.body)).toBe(202);+ let token = "";+ await until(() => { token = dump()?.mcpConfig?.mcpServers?.agents?.env?.OMB_COMMS_TOKEN ?? ""; return Boolean(token) && prompt().includes("payroll export"); }, 30_000);+ const set = await fetch(`${team.base}/api/internal/check-backs`, { method: "POST", headers: { authorization: `Bearer ${token}`, "content-type": "application/json" },+ body: JSON.stringify({ when: "in 1 minute", note: "see the payroll export reached the bank" }) });+ expect(set.status, await set.clone().text()).toBe(201);++ const stored = JSON.parse(readFileSync(join(team.home, ".openmausbot", "check-backs.json"), "utf8")).checkBacks;+ expect(stored).toMatchObject([{ botId: scout.id, threadId: benThread, origin: { kind: "user", person: BEN_KEY } }]);++ rmSync(file("hang-mode"), { force: true });+ writeFileSync(file("release"), "");+ const lines = async (token: string) => {+ const answer = await team.as(token, "GET", `/api/threads/${benThread}/messages?limit=200`);+ return { status: answer.status, rows: ((answer.body.messages ?? []) as Row[]).filter((row) => row.checkBack) };+ };+ expect((await lines(ben)).rows.map((row) => row.checkBack!.status)).toEqual(["pending"]);+ const cleoSees = await lines(cleo);+ expect(cleoSees.status === 200 ? cleoSees.rows : []).toEqual([]);++ await until(async () => !((await team.as(ben, "GET", "/api/bots?messages=0")).body.bots as Array<{ id: string; busy?: boolean }>).find((bot) => bot.id === scout.id)?.busy, 30_000);+ rmSync(file("release"), { force: true });+ writeFileSync(file("hang-mode"), "");++ await until(() => prompt().includes("What to check: see the payroll export reached the bank"), 100_000);+ await until(async () => (await lines(ben)).rows.some((row) => row.checkBack!.status === "started"), 30_000);+ const woken = dump()?.mcpConfig?.mcpServers?.agents?.env?.OMB_COMMS_TOKEN as string;+ const next = await fetch(`${team.base}/api/internal/check-backs`, { method: "POST", headers: { authorization: `Bearer ${woken}`, "content-type": "application/json" },+ body: JSON.stringify({ when: "in 3 hours", note: "look once more" }) });+ expect(next.status, `the woken turn runs as Ben's request: ${await next.clone().text()}`).toBe(201);+ expect(JSON.parse(readFileSync(join(team.home, ".openmausbot", "check-backs.json"), "utf8")).checkBacks)+ .toMatchObject([{ threadId: benThread, note: "look once more", origin: { kind: "user", person: BEN_KEY } }]);+ const rows = (await team.as(ben, "GET", `/api/threads/${benThread}/messages?limit=200`)).body.messages as Row[];+ expect(rows.filter((row) => row.role === "user" && String(row.text ?? "").includes("[Check back:"))).toEqual([]);+ rmSync(file("hang-mode"), { force: true });+ writeFileSync(file("release"), "");+ const later = await lines(cleo);+ expect(later.status === 200 ? later.rows : []).toEqual([]);+ const cleoTasks = ((await team.as(cleo, "GET", "/api/bots")).body.bots as Array<{ id: string; tasks?: Array<{ threadId: string }> }>)+ .find((bot) => bot.id === scout.id)?.tasks ?? [];+ expect(cleoTasks.some((task) => task.threadId === benThread)).toBe(false);+}, hostTimeout(240_000));diff --git a/server/drivers/agents-call.ts b/server/drivers/agents-call.tsindex 46df20c9d4..3d21fce1b5 100644--- a/server/drivers/agents-call.ts+++ b/server/drivers/agents-call.ts@@ -21,7 +21,7 @@ import { callResearchTool, RESEARCH_TOOL_NAMES } from "./agents-research-tools.timport { callHelperTool, HELPER_TOOL_NAMES } from "./agents-helper-tools.ts";import { callUsageLimitsTool, USAGE_LIMITS_TOOL } from "./agents-usage-tool.ts";import { callThreadPostTool, THREAD_POST_TOOL } from "./agents-thread-post-tool.ts"; import { callListThreadsTool, LIST_THREADS_TOOL } from "./agents-list-threads-tool.ts"; import { callRenameThreadTool, RENAME_THREAD_TOOL } from "./agents-thread-title-tool.ts";-import { callWaitTool, WAIT_TOOL_NAMES } from "./agents-wait-tools.ts";+import { callWaitTool, WAIT_TOOL_NAMES } from "./agents-wait-tools.ts"; import { callCheckBackTool, CHECK_BACK_TOOL_NAMES } from "./agents-check-back-tool.ts";import { callBurstTool } from "./agents-burst-tool.ts";import { callComputerAskTool, COMPUTER_ASK_TOOL_NAMES } from "./agents-computer-ask-tool.ts";import { callImageTool, IMAGE_TOOL_NAMES } from "./agents-image-tools.ts";@@ -255,7 +255,7 @@ export async function callTool(called: string, input: Json, context: ToolCallConif (PERSON_TOOL_NAMES.has(name)) return callPersonTool(name, args, context);if (DEVS_TOOL_NAMES.has(name)) return callDevsTool(name, args, context);if (TRIGGER_TOOL_NAMES.has(name)) return callTriggerTool(name, args, context);- if (WAIT_TOOL_NAMES.has(name)) return callWaitTool(name, args, context);+ if (WAIT_TOOL_NAMES.has(name)) return callWaitTool(name, args, context); if (CHECK_BACK_TOOL_NAMES.has(name)) return callCheckBackTool(args, context);if (name === USAGE_LIMITS_TOOL) return callUsageLimitsTool(context);if (COMPUTER_ASK_TOOL_NAMES.has(name)) return callComputerAskTool(args, context);// Second lock: with sharing off the catalog already omits these tools.diff --git a/server/drivers/agents-catalog-goldens/bridged.profiles.json b/server/drivers/agents-catalog-goldens/bridged.profiles.jsonindex ae49ea2c35..a4c452519e 100644--- a/server/drivers/agents-catalog-goldens/bridged.profiles.json+++ b/server/drivers/agents-catalog-goldens/bridged.profiles.json@@ -1,7 +1,7 @@{"default": {- "bytes": 18030,- "sha256": "4f782cd4f1cb93e94495a5809c53e17e483092c794eb45ce234668f35a517e90",+ "bytes": 18042,+ "sha256": "77e381efdb38f4f5baf0d7713b97b3d5fdbf59771ef282e137b14c11d84337e9","tools": ["tool_result_read","list_room_targets",@@ -24,8 +24,8 @@]},"voice": {- "bytes": 18811,- "sha256": "eb72ce16a32799a4df7d8bec2ef0bec4e2c1d5dcebedc4399d657a060cd9c710",+ "bytes": 18823,+ "sha256": "6b3b080f386cdbe41c1610f8e3df99a5eedb7bfbbc96a5fd568d2ac6dd75bfc3","tools": ["tool_result_read","list_room_targets",@@ -49,8 +49,8 @@]},"shared": {- "bytes": 18070,- "sha256": "a0347157f33b999b6e0e7fab1edc77555fdd9024b17bc01df466a7835e4338ef",+ "bytes": 18082,+ "sha256": "9f0e8423c761a226315886aa3d322814ab7ebf34b45a6518de27bc809529f3fd","tools": ["tool_result_read","list_room_targets",@@ -73,8 +73,8 @@]},"shared+voice": {- "bytes": 18851,- "sha256": "861f8348be71c59943288e546414f87389e676c2b2aae26aac6d895b684d6983",+ "bytes": 18863,+ "sha256": "4a04a23df21bc6ac943e83f23ea790cf494d8e91547d01bfd7e65a41d5c21897","tools": ["tool_result_read","list_room_targets",@@ -98,8 +98,8 @@]},"skills": {- "bytes": 18057,- "sha256": "6534be554aada3500a8f04012db70c9a08d4d0c6a8c13348f4791bcc186debb5",+ "bytes": 18069,+ "sha256": "58fe1016e6600ffc8945aa5f8484e8fb20c085f8f333e6633e775746159a9a8c","tools": ["tool_result_read","list_room_targets",@@ -122,8 +122,8 @@]},"skills+voice": {- "bytes": 18838,- "sha256": "e1cfcb0633c86c2194be02880f1bf016545fd0931e5a685582497c3bc39f80c1",+ "bytes": 18850,+ "sha256": "c93615e5f8b24d1359d8ec16373fd0c4b236516c0cdae3c093b0dd7748549216","tools": ["tool_result_read","list_room_targets",@@ -147,8 +147,8 @@]},"skills+shared": {- "bytes": 18097,- "sha256": "81939330eb923c276cf9abaee1281020fea7f01d78cca06f5735c69e4da544e9",+ "bytes": 18109,+ "sha256": "4730af33348dbca434989e4e61d8559fb6e517cdee592bf7423b7155c09c86e7","tools": ["tool_result_read","list_room_targets",@@ -171,8 +171,8 @@]},"skills+shared+voice": {- "bytes": 18878,- "sha256": "d41548078fcc21c5c29ba549b19e482aad4c0cdafa12a36a1dbfa79184490e74",+ "bytes": 18890,+ "sha256": "5e0e33bea0b9e1a962d2f9baae672be8696847697ff46f28feb6800f5fdf26a5","tools": ["tool_result_read","list_room_targets",@@ -196,8 +196,8 @@]},"non-chief": {- "bytes": 17913,- "sha256": "bd16346abe6270a6690a2e86a19c2f945dc1536268c8c9e43c073fad7539018a",+ "bytes": 17925,+ "sha256": "7f9f776f07f7050b4a93f6178abbac20816dc94a17335e49cbe5b9e587140211","tools": ["tool_result_read","list_room_targets",@@ -220,8 +220,8 @@]},"voice+non-chief": {- "bytes": 18694,- "sha256": "14ab6c577d0d1fb15cb56107bf5643585fa451a1419834c0594e2eeb6b310697",+ "bytes": 18706,+ "sha256": "b75e27bd99e8628ee42c290e33741366209351a4bdd9a0bb5de4e5dfff1e2e30","tools": ["tool_result_read","list_room_targets",@@ -245,8 +245,8 @@]},"shared+non-chief": {- "bytes": 17953,- "sha256": "b41adb9700eabf6e0b4dc435f0d94a6b1c02588bcf901c48f9e8c2eee2099b54",+ "bytes": 17965,+ "sha256": "52cdb6533b6a75ffb8cb7ffd24b4214232f59bfaec3e19768a3d724ea534f815","tools": ["tool_result_read","list_room_targets",@@ -269,8 +269,8 @@]},"shared+voice+non-chief": {- "bytes": 18734,- "sha256": "4881945f5a36e97b0ed3cc7b19e81697dd71a78d2d135a9782ba8605e257f00d",+ "bytes": 18746,+ "sha256": "33b2cad8dc7c81b66fec3e043dcff16d16512e43912dc95cfea37acd5e727b39","tools": ["tool_result_read","list_room_targets",@@ -294,8 +294,8 @@]},"skills+non-chief": {- "bytes": 17940,- "sha256": "03d18f1d80b3115b1d044f694eed677c8183b63189c9b3f291bd0e365cb23e37",+ "bytes": 17952,+ "sha256": "8f936477369bdc53234def6a3734287d0ceda4a502e106781693adf5012031e2","tools": ["tool_result_read","list_room_targets",@@ -318,8 +318,8 @@]},"skills+voice+non-chief": {- "bytes": 18721,- "sha256": "ea0a23fb1949f3791a5ea17aaf0be33cac214bb797151565b5ad5afd09d36bc2",+ "bytes": 18733,+ "sha256": "7a13fd4becb2b77128ff1f3167342f2c67f4c57fa3953fc21371360c37ad4e2c","tools": ["tool_result_read","list_room_targets",@@ -343,8 +343,8 @@]},"skills+shared+non-chief": {- "bytes": 17980,- "sha256": "ce981102ab12b60566271f057f9a8686f972abeae874a936a43cae8839532b10",+ "bytes": 17992,+ "sha256": "a87836c170782e3785c0ac2a302af4226d9145608628929a522e45ff0bb643d8","tools": ["tool_result_read","list_room_targets",@@ -367,8 +367,8 @@]},"skills+shared+voice+non-chief": {- "bytes": 18761,- "sha256": "53add750951d5994d7a1cbca8a430d8ea38aa41d95de7ff2ecb0aa412156bb1e",+ "bytes": 18773,+ "sha256": "5a358456b45a2d3880bf192d435d39245cd45f12a3a110745a18ab4aafd378a2","tools": ["tool_result_read","list_room_targets",@@ -392,8 +392,8 @@]},"skills+shared+voice+cloud-home": {- "bytes": 18894,- "sha256": "f1f0e20232c7d4923913cbcb47305c00bd9e53c77abcad04f13749bf3d264abd",+ "bytes": 18906,+ "sha256": "19fa09a0f90d988eeaa94e4621611b2e7729824aac235835f1fcd63f868031a5","tools": ["tool_result_read","list_room_targets",@@ -417,8 +417,8 @@]},"skills+shared+voice+non-chief+cloud-home": {- "bytes": 18777,- "sha256": "e701e153ebf5b0949501bd71c1a9e8aaf33168f23c0222f8a8b10e97a8879ee2",+ "bytes": 18789,+ "sha256": "76a9cda3121e556222b2c189004728ebaaaf407fae5d1a22c1ce28b985483a64","tools": ["tool_result_read","list_room_targets",@@ -442,8 +442,8 @@]},"skills+shared+voice+x": {- "bytes": 18939,- "sha256": "c252c1db6ce472fbfcf934e8fce38f2f708008d2eaf5d00f7b8750ee2c649b68",+ "bytes": 18951,+ "sha256": "13745dea473a78c3ed15502554dbe864347b46593fbe75453697da0d441d0502","tools": ["tool_result_read","list_room_targets",@@ -467,8 +467,8 @@]},"skills+shared+voice+x+team": {- "bytes": 18939,- "sha256": "c252c1db6ce472fbfcf934e8fce38f2f708008d2eaf5d00f7b8750ee2c649b68",+ "bytes": 18951,+ "sha256": "13745dea473a78c3ed15502554dbe864347b46593fbe75453697da0d441d0502","tools": ["tool_result_read","list_room_targets",@@ -492,8 +492,8 @@]},"skills+shared+voice+x+team+images": {- "bytes": 18967,- "sha256": "fbd98541d95e898915f54e5bb003609690f669005f5aaa8f46526f70eb5b11b2",+ "bytes": 18979,+ "sha256": "dd48e03197d0c7b2c303053098ed737a01f53837d0c60d101b07fd23142d224b","tools": ["tool_result_read","list_room_targets",@@ -517,8 +517,8 @@]},"default+legacy-switches": {- "bytes": 18030,- "sha256": "4f782cd4f1cb93e94495a5809c53e17e483092c794eb45ce234668f35a517e90",+ "bytes": 18042,+ "sha256": "77e381efdb38f4f5baf0d7713b97b3d5fdbf59771ef282e137b14c11d84337e9","tools": ["tool_result_read","list_room_targets",@@ -541,8 +541,8 @@]},"default+mausbot": {- "bytes": 18082,- "sha256": "97b8fa6fc920cad0f5b733f01161b8851eea5d267e5589cb265a1b79317da6fa",+ "bytes": 18094,+ "sha256": "9bc2fbba9e038c8418fa2da8942304db5234b9f75432e2691d45fef42d96d3ed","tools": ["tool_result_read","list_room_targets",@@ -565,8 +565,8 @@]},"skills+shared+voice+mausbot": {- "bytes": 18930,- "sha256": "5dfaa7c8c79b94eacc21660e42d19649b7800d3d1ae5ece8b5d583f9270e609f",+ "bytes": 18942,+ "sha256": "91a5c99105c63d8b9c9296a8b2b274e51c8c9f099fe8ca4ded78e08b8f660c78","tools": ["tool_result_read","list_room_targets",@@ -590,8 +590,8 @@]},"default+no-computer-pick": {- "bytes": 16818,- "sha256": "c1097578166385dfdd2b6b940ba4422d901c76c905c3a3108838a31ffc77d2e6",+ "bytes": 16830,+ "sha256": "1ef5bed20d164393ab479bdad845341228530d399cdee57b3ec218c0880e62c0","tools": ["tool_result_read","list_room_targets",@@ -659,8 +659,8 @@]},"default+images": {- "bytes": 18058,- "sha256": "2a680e1fa73085b07251de2e0732c3d212ff7ccb0fbf8bfe1074385bfa340945",+ "bytes": 18070,+ "sha256": "b9ff9c4af83c6f0f1dad2f4c08f9820ab9de19b06708937c604b3488b6190431","tools": ["tool_result_read","list_room_targets",@@ -683,8 +683,8 @@]},"skills+shared+voice+x+team+images+hosting": {- "bytes": 20169,- "sha256": "020cdeafbdf7e63cb3f52a80b50eb17db1962f30b54367a7f53b8956d9f7d9be",+ "bytes": 20181,+ "sha256": "5caa8816b73fa9ba571d5626425b43dba8e67a854d388a12a7e36ab0e35da1cf","tools": ["tool_result_read","list_room_targets",@@ -709,8 +709,8 @@]},"default+hosting": {- "bytes": 19232,- "sha256": "506d8948fb4976db8d1d253265a4f5d30c2fa0863a20c3f5c59b7794f5529665",+ "bytes": 19244,+ "sha256": "2371919f9588a0cc6f9aa638958c5bd5e412ab1f580d1e3bc5c4757c612db64c","tools": ["tool_result_read","list_room_targets",@@ -734,8 +734,8 @@]},"default+tools-off": {- "bytes": 16373,- "sha256": "7f3232b7a410a104c92695af541f0b6938644ffe85a82e304deca448a46a6331",+ "bytes": 16385,+ "sha256": "796a8cf642248fc4ad6ae216efe5835f52e375058e787528c115d83d43a8fa3e","tools": ["tool_result_read","list_room_targets",diff --git a/server/drivers/agents-catalog-goldens/bridged.tools-list.json b/server/drivers/agents-catalog-goldens/bridged.tools-list.jsonindex 273bdfecb6..4b362007f5 100644--- a/server/drivers/agents-catalog-goldens/bridged.tools-list.json+++ b/server/drivers/agents-catalog-goldens/bridged.tools-list.json@@ -537,7 +537,7 @@},{"name": "find_tool",- "description": "Find an OpenMausBot tool that is not in your tool list. Say what you want to do in a few words, or give the tool's name. Each match comes back with its description and exact input schema; run one with use_tool. Tools reached this way: list_shared_computers, shared_computer, assignment_status, usage_limits, list_threads, close_thread, rename_thread, start_thread, burst, list_models, vm_exec, show_widget, show_html, unpublish_page, create_bot, list_team_setup, list_team_library, propose_team_setup, propose_bot_deletion, manage_room, x_search, research_search, research_endpoint, research_call, decide, extract, edit_image, generate_image, report_bug, check_app_hosting, retry_thread, memory_log, session_search, trigger_info, trigger, delete_trigger, wait_until, list_waits, cancel_wait, propose_profile, propose_model, propose_team_memory, skills_list, skill_manage, mcp_server, app_settings.",+ "description": "Find an OpenMausBot tool that is not in your tool list. Say what you want to do in a few words, or give the tool's name. Each match comes back with its description and exact input schema; run one with use_tool. Tools reached this way: list_shared_computers, shared_computer, assignment_status, usage_limits, list_threads, close_thread, rename_thread, start_thread, burst, list_models, vm_exec, show_widget, show_html, unpublish_page, create_bot, list_team_setup, list_team_library, propose_team_setup, propose_bot_deletion, manage_room, x_search, research_search, research_endpoint, research_call, decide, extract, edit_image, generate_image, report_bug, check_app_hosting, retry_thread, memory_log, session_search, trigger_info, trigger, delete_trigger, wait_until, list_waits, cancel_wait, check_back, propose_profile, propose_model, propose_team_memory, skills_list, skill_manage, mcp_server, app_settings.","inputSchema": {"type": "object","additionalProperties": false,diff --git a/server/drivers/agents-catalog-goldens/full.tools-list.json b/server/drivers/agents-catalog-goldens/full.tools-list.jsonindex 9ddd971320..873f13c9f4 100644--- a/server/drivers/agents-catalog-goldens/full.tools-list.json+++ b/server/drivers/agents-catalog-goldens/full.tools-list.json@@ -1625,7 +1625,7 @@},{"name": "trigger",- "description": "Set up or change an automation (a routine): when something happens, a bot does the instructions. Create it in this turn, without asking to confirm, whenever the person describes recurring or event-based work (\"every morning send me…\", \"whenever I get an email from…\", \"when another app calls…\"); something to do once, now, is not one. when=schedule runs on a time rule or cron (trigger_info first for the current time); app_event when a connected app's event happens (trigger_info action=events first; better than a schedule that keeps checking); webhook when another app calls its private address, which you may paste only into that app's setup; limit_reset when an AI's usage limit resets. update, pause, resume and run_now take a trigger_id from trigger_info. Pause a temporary monitor once its goal is met, then read it back; delete_trigger only at the person's request. To the person these are automations: write name and instructions as they would say them.",+ "description": "Set up or change an automation (a routine): when something happens, a bot does the instructions. Create it in this turn, without asking to confirm, whenever the person describes recurring or event-based work; something to do once, now, is not one, and a later look at this chat is check_back. when=schedule runs on a time rule or cron (trigger_info first for the current time); app_event when a connected app's event happens (trigger_info action=events first; better than a schedule that keeps checking); webhook when another app calls its private address, which you may paste only into that app's setup; limit_reset when an AI's usage limit resets. update, pause, resume and run_now take a trigger_id from trigger_info. Pause a temporary monitor once its goal is met, then read it back; delete_trigger only at the person's request. To the person these are automations: write name and instructions as they would say them.","inputSchema": {"type": "object","additionalProperties": false,@@ -1879,7 +1879,7 @@},{"name": "wait_until",- "description": "Tell the person in this chat when something happens. No AI runs while you wait, only plain code checks. Ends after hours (default 24, 1-168).",+ "description": "Tell the person in this chat when something happens. No AI runs while you wait. Ends after hours (default 24, 1-168).","inputSchema": {"type": "object","additionalProperties": false,@@ -1963,6 +1963,31 @@]}},+ {+ "name": "check_back",+ "description": "Come back to this chat later on your own; no one is asked. No args lists; cancel: id or \"all\".",+ "inputSchema": {+ "type": "object",+ "additionalProperties": false,+ "properties": {+ "when": {+ "type": "string",+ "description": "\"in 2 hours\", \"Fri 9am\" (person's zone) or ISO."+ },+ "note": {+ "type": "string",+ "description": "What to check then."+ },+ "if": {+ "type": "string",+ "description": "Act only if this holds then."+ },+ "cancel": {+ "type": "string"+ }+ }+ }+ },{"name": "propose_profile","description": "Change your own name, title, description, standing instructions (SOUL.md), working folder (cwd), notifications or speakReplies, as the person asked. Keep SOUL.md short: who you are and the rules you never break; put step-by-step procedure in a skill. A Chief of Staff may pass for_bot_id (from list_bots) for a requested change to another bot in its section. It applies at once, with an Undo where possible: read the result before saying it did. It never raises another bot's execution permissions.",diff --git a/server/drivers/agents-catalog-goldens/profiles.json b/server/drivers/agents-catalog-goldens/profiles.jsonindex d10942b792..0b44988f08 100644--- a/server/drivers/agents-catalog-goldens/profiles.json+++ b/server/drivers/agents-catalog-goldens/profiles.json@@ -1,7 +1,7 @@{"default": {- "bytes": 58446,- "sha256": "2787cebd18cb81295dd633de8c254687a7d9912baf1f80634b3ad0bf2845fd5a",+ "bytes": 58828,+ "sha256": "0bc510317f6c20f8a6f99d3c523657344603486fa41285717358c37316e186af","tools": ["tool_result_read","list_room_targets",@@ -49,6 +49,7 @@"wait_until","list_waits","cancel_wait",+ "check_back","propose_profile","propose_model","propose_team_memory",@@ -57,8 +58,8 @@]},"voice": {- "bytes": 59227,- "sha256": "b3ea969c417db37a4e1c51df0ebbbc0f7e70cddec3d1ba622a4bbb588ffaaf02",+ "bytes": 59609,+ "sha256": "84c74fc165fa7788490f88532d8fac7766879c6f215328a26fdfad5aaddb1cec","tools": ["tool_result_read","list_room_targets",@@ -107,6 +108,7 @@"wait_until","list_waits","cancel_wait",+ "check_back","propose_profile","propose_model","propose_team_memory",@@ -115,8 +117,8 @@]},"shared": {- "bytes": 60711,- "sha256": "2bb5b61577336bea47166249537b4adfb6d0c1ca07d40bdc51aa7b81023907cd",+ "bytes": 61093,+ "sha256": "8efe0d27e4adf6249d19c047a929bcf1c389d10403fd6399da9e1e9f1428edde","tools": ["tool_result_read","list_shared_computers",@@ -166,6 +168,7 @@"wait_until","list_waits","cancel_wait",+ "check_back","propose_profile","propose_model","propose_team_memory",@@ -174,8 +177,8 @@]},"shared+voice": {- "bytes": 61492,- "sha256": "44f18712a4cb6d0b4b0b9a67b07a68d9ef82d0d8ac862e296d1f735fa3afa8b0",+ "bytes": 61874,+ "sha256": "ef67c1e35a2219d9e1b132a12d425e390327b3d12b3deee713565d5107a40dfe","tools": ["tool_result_read","list_shared_computers",@@ -226,6 +229,7 @@"wait_until","list_waits","cancel_wait",+ "check_back","propose_profile","propose_model","propose_team_memory",@@ -234,8 +238,8 @@]},"skills": {- "bytes": 60767,- "sha256": "8ce17e34610fa6033b37a00e4847e37e226d5b9dff6e8faa201d0753b677de30",+ "bytes": 61149,+ "sha256": "2b9c046537f8c3bf02d291061963d3e093a8f76906980f472f548694695e1b43","tools": ["tool_result_read","list_room_targets",@@ -283,6 +287,7 @@"wait_until","list_waits","cancel_wait",+ "check_back","propose_profile","propose_model","propose_team_memory",@@ -293,8 +298,8 @@]},"skills+voice": {- "bytes": 61548,- "sha256": "e4dbd3ff11708e9f5df8693ba915a859fa6c6ccf35a64fbbb49d13cadc99e8ed",+ "bytes": 61930,+ "sha256": "6790c26bf2db33fe4a05a28e3c8be24361fc0177da1860fdc6f085a015185dd5","tools": ["tool_result_read","list_room_targets",@@ -343,6 +348,7 @@"wait_until","list_waits","cancel_wait",+ "check_back","propose_profile","propose_model","propose_team_memory",@@ -353,8 +359,8 @@]},"skills+shared": {- "bytes": 63032,- "sha256": "5ed16c2b52d32e7dd8e96bc8e1748871f93574756c503d92ad43b624744bf140",+ "bytes": 63414,+ "sha256": "7e4b83b4bd72690866e9ac5fdb04a797618e0c2084d3037d303c2a858651d8d4","tools": ["tool_result_read","list_shared_computers",@@ -404,6 +410,7 @@"wait_until","list_waits","cancel_wait",+ "check_back","propose_profile","propose_model","propose_team_memory",@@ -414,8 +421,8 @@]},"skills+shared+voice": {- "bytes": 63813,- "sha256": "327c4037035dc94989ed9d79b0fd4c177662a4e418e845ac429ca8d385ce19a9",+ "bytes": 64195,+ "sha256": "3baddbc0c2fb5eae43372a7ec7975dde4bad9777672e170645df5fa174d6bbcb","tools": ["tool_result_read","list_shared_computers",@@ -466,6 +473,7 @@"wait_until","list_waits","cancel_wait",+ "check_back","propose_profile","propose_model","propose_team_memory",@@ -476,8 +484,8 @@]},"non-chief": {- "bytes": 49898,- "sha256": "b50e27f1c2e882eb4e064f788c4034fc75b2172d63e869c607a088430ad1351b",+ "bytes": 50280,+ "sha256": "2f36a30278c390b6e75b5ef9b13d8969b41d37dbcd03046857c515d8a8949885","tools": ["tool_result_read","list_room_targets",@@ -518,6 +526,7 @@"wait_until","list_waits","cancel_wait",+ "check_back","propose_profile","propose_model","propose_team_memory",@@ -526,8 +535,8 @@]},"voice+non-chief": {- "bytes": 50679,- "sha256": "c72c640d9b4dc34384cf1a22e70e66df75b480f737e33caafe74ee097e54bb91",+ "bytes": 51061,+ "sha256": "9c2327276275e3c59daeb928ba6ef8cc7d0113050bfb6db068383f9b51345778","tools": ["tool_result_read","list_room_targets",@@ -569,6 +578,7 @@"wait_until","list_waits","cancel_wait",+ "check_back","propose_profile","propose_model","propose_team_memory",@@ -577,8 +587,8 @@]},"shared+non-chief": {- "bytes": 52163,- "sha256": "5245eddb78e52d23c2916a549c0fddb328a0a08460549cb67961cd0865525d29",+ "bytes": 52545,+ "sha256": "7b88c750cfc76292aefafbaad6c338aa57581a7634b4594c20174df59eacdb27","tools": ["tool_result_read","list_shared_computers",@@ -621,6 +631,7 @@"wait_until","list_waits","cancel_wait",+ "check_back","propose_profile","propose_model","propose_team_memory",@@ -629,8 +640,8 @@]},"shared+voice+non-chief": {- "bytes": 52944,- "sha256": "caf3a03024a4d6d8b2c7aa8f27c22d2b2d4f484d6cfa8a23190efd77f56c78c4",+ "bytes": 53326,+ "sha256": "344fae24fb4ca181f9535d8491d63f4b3730733852e556f29a5e0e5afdf33070","tools": ["tool_result_read","list_shared_computers",@@ -674,6 +685,7 @@"wait_until","list_waits","cancel_wait",+ "check_back","propose_profile","propose_model","propose_team_memory",@@ -682,8 +694,8 @@]},"skills+non-chief": {- "bytes": 52219,- "sha256": "35b172d3a3e96d79e506635e1bfaef6d1e0086088f09046e689f6b5b100c3046",+ "bytes": 52601,+ "sha256": "f58b8554a43b1221632d881269372885edf7fc9d560d6ddabf7e51d9d42b945c","tools": ["tool_result_read","list_room_targets",@@ -724,6 +736,7 @@"wait_until","list_waits","cancel_wait",+ "check_back","propose_profile","propose_model","propose_team_memory",@@ -734,8 +747,8 @@]},"skills+voice+non-chief": {- "bytes": 53000,- "sha256": "c141396f4df71741a364868e627718c4337bfe944b0cdb320051d638f32f2567",+ "bytes": 53382,+ "sha256": "45cc5db670f9c0ad6c487df9a881db5d58802813b0d7237f853b2599cd79dcc0","tools": ["tool_result_read","list_room_targets",@@ -777,6 +790,7 @@"wait_until","list_waits","cancel_wait",+ "check_back","propose_profile","propose_model","propose_team_memory",@@ -787,8 +801,8 @@]},"skills+shared+non-chief": {- "bytes": 54484,- "sha256": "b30274611c147f598681b5f3c3ecd94d5ac40fe31327340df80039e6540fa6ab",+ "bytes": 54866,+ "sha256": "3d70000599f350cbbbd41fbe67d26c5e3fa0ecff3ba5ed707ab389c621e79f28","tools": ["tool_result_read","list_shared_computers",@@ -831,6 +845,7 @@"wait_until","list_waits","cancel_wait",+ "check_back","propose_profile","propose_model","propose_team_memory",@@ -841,8 +856,8 @@]},"skills+shared+voice+non-chief": {- "bytes": 55265,- "sha256": "ab017f8af3e9867f4321691508254ca85f1ba976c16cfad116a0a801fef8df2a",+ "bytes": 55647,+ "sha256": "618f91f99861d9b84922da174fa7cb4fac6b8b6269c48e2bed7802d4d259c1d1","tools": ["tool_result_read","list_shared_computers",@@ -886,6 +901,7 @@"wait_until","list_waits","cancel_wait",+ "check_back","propose_profile","propose_model","propose_team_memory",@@ -896,8 +912,8 @@]},"skills+shared+voice+cloud-home": {- "bytes": 63579,- "sha256": "360a4aa23106dfb223f1fe19ddb3dc4abec9b22d749f6db49461d38265e75358",+ "bytes": 63961,+ "sha256": "12b61b8135e45ed1d8d5cc1b3d486ed8b1dc2754f7207d13ef797ada1b94adaa","tools": ["tool_result_read","list_shared_computers",@@ -947,6 +963,7 @@"wait_until","list_waits","cancel_wait",+ "check_back","ask_for_computer","propose_profile","propose_model",@@ -958,8 +975,8 @@]},"skills+shared+voice+non-chief+cloud-home": {- "bytes": 55031,- "sha256": "5a266dc7f48bd237b3c24d234164c7769beba6680037ebeef85ba7131df14ee2",+ "bytes": 55413,+ "sha256": "2b1058789d6de069e611534026b85b4fe6e01cf6d4c3d927e584010b9c7422ad","tools": ["tool_result_read","list_shared_computers",@@ -1002,6 +1019,7 @@"wait_until","list_waits","cancel_wait",+ "check_back","ask_for_computer","propose_profile","propose_model",@@ -1013,8 +1031,8 @@]},"skills+shared+voice+x": {- "bytes": 67652,- "sha256": "b3fad9c9f669908926256647bc9549017615d601db1db7f33f199ec58db815a9",+ "bytes": 68034,+ "sha256": "07704e3ea47b374017b1673993709c4c3295af93c1093fb978f79ee9c93cc119","tools": ["tool_result_read","list_shared_computers",@@ -1069,6 +1087,7 @@"wait_until","list_waits","cancel_wait",+ "check_back","propose_profile","propose_model","propose_team_memory",@@ -1079,8 +1098,8 @@]},"skills+shared+voice+x+team": {- "bytes": 67652,- "sha256": "b3fad9c9f669908926256647bc9549017615d601db1db7f33f199ec58db815a9",+ "bytes": 68034,+ "sha256": "07704e3ea47b374017b1673993709c4c3295af93c1093fb978f79ee9c93cc119","tools": ["tool_result_read","list_shared_computers",@@ -1135,6 +1154,7 @@"wait_until","list_waits","cancel_wait",+ "check_back","propose_profile","propose_model","propose_team_memory",@@ -1145,8 +1165,8 @@]},"skills+shared+voice+x+team+images": {- "bytes": 69599,- "sha256": "b438d389774ffc7122684e09095fb51126f70e2405dcdc4c90a5708e68e3d081",+ "bytes": 69981,+ "sha256": "cdce42a3892f3425c82f94695e9f06760c57071751fbc5ba77dcc09bf6deac20","tools": ["tool_result_read","list_shared_computers",@@ -1203,6 +1223,7 @@"wait_until","list_waits","cancel_wait",+ "check_back","propose_profile","propose_model","propose_team_memory",@@ -1213,8 +1234,8 @@]},"default+legacy-switches": {- "bytes": 58446,- "sha256": "2787cebd18cb81295dd633de8c254687a7d9912baf1f80634b3ad0bf2845fd5a",+ "bytes": 58828,+ "sha256": "0bc510317f6c20f8a6f99d3c523657344603486fa41285717358c37316e186af","tools": ["tool_result_read","list_room_targets",@@ -1262,6 +1283,7 @@"wait_until","list_waits","cancel_wait",+ "check_back","propose_profile","propose_model","propose_team_memory",@@ -1270,8 +1292,8 @@]},"default+mausbot": {- "bytes": 59097,- "sha256": "ca98f7bacf2b163b0d336cee6933989bd9b016565f94eada630c4ac0bda19c2c",+ "bytes": 59479,+ "sha256": "648fe0697b962ab200977b51d8438abaeede5ed122a3330ae88cff2ededb054f","tools": ["tool_result_read","list_room_targets",@@ -1319,6 +1341,7 @@"wait_until","list_waits","cancel_wait",+ "check_back","propose_profile","propose_model","propose_team_memory",@@ -1329,8 +1352,8 @@]},"skills+shared+voice+mausbot": {- "bytes": 64464,- "sha256": "53ea77f065727abf095363090cfcec000bbab3bfa5cb2503aefff1b18140e17d",+ "bytes": 64846,+ "sha256": "3e38f4adecea9c5fe026ab7dbd15da8c4f1d8ed45c68a97c4fe923de7c389e75","tools": ["tool_result_read","list_shared_computers",@@ -1381,6 +1404,7 @@"wait_until","list_waits","cancel_wait",+ "check_back","propose_profile","propose_model","propose_team_memory",@@ -1393,8 +1417,8 @@]},"default+no-computer-pick": {- "bytes": 57234,- "sha256": "b938c0bd001768793a1ae6d6c3c03d2ab8cdddc85d7eae2c047f1c016e1da3fc",+ "bytes": 57616,+ "sha256": "0d4c7eb2d214eb47ca111a1d2f0cc8cf990a730f65e4be9829821be5b97b06dd","tools": ["tool_result_read","list_room_targets",@@ -1441,6 +1465,7 @@"wait_until","list_waits","cancel_wait",+ "check_back","propose_profile","propose_model","propose_team_memory",@@ -1449,8 +1474,8 @@]},"default+room": {- "bytes": 54230,- "sha256": "f322beae3f37b5b350972644770fb451e8ab75a4047b949e7d67a947f270191d",+ "bytes": 54176,+ "sha256": "5712832949edbc37c2d3f0141d292b6ae2910e0e91f73a900a32e5da17dab9b2","tools": ["tool_result_read","list_room_targets",@@ -1500,8 +1525,8 @@]},"non-chief+room": {- "bytes": 45682,- "sha256": "ca0642564d2d04729db70605162313330cbadce22d085c5d14aa09f4affbba8b",+ "bytes": 45628,+ "sha256": "05c64d2fe12e3fa0cd6cc913cda686ee507123b956313f5c5893337e301f16c2","tools": ["tool_result_read","list_room_targets",@@ -1544,8 +1569,8 @@]},"default+images": {- "bytes": 60393,- "sha256": "17dea4851607f69666df754aa561c498e3ba88cc44f585c84d43c160c5b2bbac",+ "bytes": 60775,+ "sha256": "0843c41a1e3a7d891dbb8d0c767c614581f9123570d1bfd19286813d4c94c604","tools": ["tool_result_read","list_room_targets",@@ -1595,6 +1620,7 @@"wait_until","list_waits","cancel_wait",+ "check_back","propose_profile","propose_model","propose_team_memory",@@ -1603,8 +1629,8 @@]},"skills+shared+voice+x+team+images+hosting": {- "bytes": 71462,- "sha256": "59cd33becc55931ea7d0c7b66a4663b867d21d234b6f315a183020da8c2e4013",+ "bytes": 71844,+ "sha256": "cdab3567ed19c7d4bd0a97614ddfe0421521913d19e63f9065ced6e4f73328cf","tools": ["tool_result_read","list_shared_computers",@@ -1663,6 +1689,7 @@"wait_until","list_waits","cancel_wait",+ "check_back","propose_profile","propose_model","propose_team_memory",@@ -1673,8 +1700,8 @@]},"default+hosting": {- "bytes": 60309,- "sha256": "5253bff55e778309d67917716297acf084b8e43d1d5a505ad0eacf8ecc2166fa",+ "bytes": 60691,+ "sha256": "ddfd0a210f66b3872a37eceff61fa185deeb866a5cca123bd54a50e9dfa4e3cb","tools": ["tool_result_read","list_room_targets",@@ -1724,6 +1751,7 @@"wait_until","list_waits","cancel_wait",+ "check_back","propose_profile","propose_model","propose_team_memory",@@ -1732,8 +1760,8 @@]},"default+tools-off": {- "bytes": 54128,- "sha256": "b6b99d3b147d5927a611fb47a35123a9390c26ca7f4b8b6c6a49c9ea200dd652",+ "bytes": 54510,+ "sha256": "4bc1783522425f2423926b2f68a7bdcd2959a2a592af06c454e7cf19db7aaf7d","tools": ["tool_result_read","list_room_targets",@@ -1777,6 +1805,7 @@"wait_until","list_waits","cancel_wait",+ "check_back","propose_profile","propose_model","propose_team_memory",diff --git a/server/drivers/agents-catalog-wire.test.ts b/server/drivers/agents-catalog-wire.test.tsindex 079a5f7154..c737fbea73 100644--- a/server/drivers/agents-catalog-wire.test.ts+++ b/server/drivers/agents-catalog-wire.test.ts@@ -117,7 +117,7 @@ const BUDGET_BASELINE: Record<string, number> = {"default+images": 60010,"skills+shared+voice+x+team+images+hosting": 71107,"default+hosting": 59808,- "default+tools-off": 53081,+ "default+tools-off": 54421,};const RPC_PREFIX = '{"jsonrpc":"2.0","id":1,"result":';@@ -354,7 +354,7 @@ describe("agents proxy tools/list golden", () => {const names = (name: string) => toolsOf(wires[name]!).map((tool) => tool.name);expect(names("default+no-computer-pick")).toEqual(names("default").filter((tool) => tool !== "select_computer"));for (const name of ["default", "non-chief"]) {- expect(names(`${name}+room`), name).toEqual(names(name).filter((tool) => !["select_computer", "wait_until", "list_waits", "cancel_wait", "burst", "rename_thread"].includes(tool)));+ expect(names(`${name}+room`), name).toEqual(names(name).filter((tool) => !["select_computer", "wait_until", "list_waits", "cancel_wait", "check_back", "burst", "rename_thread"].includes(tool)));}for (const [name, profile] of Object.entries(PROFILES)) {expect(names(name).includes("select_computer"), name).toBe(profile.env.OMB_COMPUTER_SELECTION === "1");diff --git a/server/drivers/agents-catalog.ts b/server/drivers/agents-catalog.tsindex 01da2c966f..1286cc1e2c 100644--- a/server/drivers/agents-catalog.ts+++ b/server/drivers/agents-catalog.ts@@ -11,7 +11,7 @@ import { USAGE_LIMITS_TOOL_DEFINITION } from "./agents-usage-tool.ts";import { APP_SETTINGS_TOOL_DEFINITION } from "./agents-app-settings-tool.ts";import { THREAD_POST_TOOL_DEFINITION } from "./agents-thread-post-tool.ts";import { RENAME_THREAD_TOOL_DEFINITION } from "./agents-thread-title-tool.ts";-import { WAIT_TOOL_DEFINITIONS, WAIT_TOOL_NAMES } from "./agents-wait-tools.ts";+import { WAIT_TOOL_DEFINITIONS, WAIT_TOOL_NAMES } from "./agents-wait-tools.ts"; import { CHECK_BACK_TOOL_DEFINITIONS, CHECK_BACK_TOOL_NAMES } from "./agents-check-back-tool.ts";import { COMPUTER_ASK_TOOL_DEFINITIONS, COMPUTER_ASK_TOOL_NAMES } from "./agents-computer-ask-tool.ts";import { IMAGE_TOOL_DEFINITIONS, IMAGE_TOOL_NAMES } from "./agents-image-tools.ts";import { HOSTING_TOOL_DEFINITIONS, HOSTING_TOOL_NAMES } from "./agents-hosting-tools.ts";@@ -610,7 +610,7 @@ const TOOL_DEFINITIONS = [{name: "trigger",description:- "Set up or change an automation (a routine): when something happens, a bot does the instructions. Create it in this turn, without asking to confirm, whenever the person describes recurring or event-based work (\"every morning send me…\", \"whenever I get an email from…\", \"when another app calls…\"); something to do once, now, is not one. when=schedule runs on a time rule or cron (trigger_info first for the current time); app_event when a connected app's event happens (trigger_info action=events first; better than a schedule that keeps checking); webhook when another app calls its private address, which you may paste only into that app's setup; limit_reset when an AI's usage limit resets. update, pause, resume and run_now take a trigger_id from trigger_info. Pause a temporary monitor once its goal is met, then read it back; delete_trigger only at the person's request. To the person these are automations: write name and instructions as they would say them.",+ "Set up or change an automation (a routine): when something happens, a bot does the instructions. Create it in this turn, without asking to confirm, whenever the person describes recurring or event-based work; something to do once, now, is not one, and a later look at this chat is check_back. when=schedule runs on a time rule or cron (trigger_info first for the current time); app_event when a connected app's event happens (trigger_info action=events first; better than a schedule that keeps checking); webhook when another app calls its private address, which you may paste only into that app's setup; limit_reset when an AI's usage limit resets. update, pause, resume and run_now take a trigger_id from trigger_info. Pause a temporary monitor once its goal is met, then read it back; delete_trigger only at the person's request. To the person these are automations: write name and instructions as they would say them.",inputSchema: {type: "object",additionalProperties: false,@@ -644,6 +644,7 @@ const TOOL_DEFINITIONS = [},},...WAIT_TOOL_DEFINITIONS,+ ...CHECK_BACK_TOOL_DEFINITIONS,...COMPUTER_ASK_TOOL_DEFINITIONS,{name: "propose_profile",@@ -812,7 +813,7 @@ const WATCHER_TOOL_NAMES = new Set(["create_options_card"]);const LOCAL_VM_TOOL_NAMES = new Set(["vm_exec"]);/** Refused in a room's thread (routes/waits.ts), and list_waits, since a room holds no wait. */-const ROOM_REFUSED_TOOL_NAMES = new Set([...WAIT_TOOL_NAMES, "burst", "rename_thread"]);+const ROOM_REFUSED_TOOL_NAMES = new Set([...WAIT_TOOL_NAMES, ...CHECK_BACK_TOOL_NAMES, "burst", "rename_thread"]);const CLOUD_HOME_SURFACE = {type: "string", enum: ["auto", "cloud", "browser"],description: "auto = suitable configured computer, cloud = the bot's cloud computer, browser = built-in browser. Omit to list. This server runs in the cloud: the user's own computer and a Local VM are not places here.",diff --git a/server/drivers/agents-check-back-tool.ts b/server/drivers/agents-check-back-tool.tsnew file mode 100644index 0000000000..24077f0b8f--- /dev/null+++ b/server/drivers/agents-check-back-tool.ts@@ -0,0 +1,26 @@+import type { ToolCallContext, ToolCallResult } from "./agents-call.ts";+import type { Json } from "./agents-client.ts";++export const CHECK_BACK_TOOL_NAMES: ReadonlySet<string> = new Set(["check_back"]);++export async function callCheckBackTool(args: Json, context: ToolCallContext): Promise<ToolCallResult> {+ const { ok, body } = await context.client.apiResponse("/api/internal/check-backs", { method: "POST", body: JSON.stringify(args) });+ return ok ? { text: String(body.text ?? "") } : { text: String(body.error ?? "The check-back did not go through. Try again shortly."), isError: true };+}++export const CHECK_BACK_TOOL_DEFINITIONS = [+ {+ name: "check_back",+ description: 'Come back to this chat later on your own; no one is asked. No args lists; cancel: id or "all".',+ inputSchema: {+ type: "object",+ additionalProperties: false,+ properties: {+ when: { type: "string", description: '"in 2 hours", "Fri 9am" (person\'s zone) or ISO.' },+ note: { type: "string", description: "What to check then." },+ if: { type: "string", description: "Act only if this holds then." },+ cancel: { type: "string" },+ },+ },+ },+];diff --git a/server/drivers/agents-claude-defer.test.ts b/server/drivers/agents-claude-defer.test.tsindex 97b2f5aa2b..c5deb06a6f 100644--- a/server/drivers/agents-claude-defer.test.ts+++ b/server/drivers/agents-claude-defer.test.ts@@ -23,8 +23,8 @@ const DEFER = { [DEFER_TOOLS_ENV]: "1" };/** Bytes Claude Code sends up front for the agents server when the budget was last set; each may move at most 2%. */const UP_FRONT_BASELINE: Record<string, { whole: number; deferred: number }> = {- default: { whole: 3855, deferred: 1209 },- specialist: { whole: 1495, deferred: 1037 },+ default: { whole: 3855, deferred: 1252 },+ specialist: { whole: 1495, deferred: 1080 },fullest: { whole: 3855, deferred: 1589 },};diff --git a/server/drivers/agents-proxy.test.ts b/server/drivers/agents-proxy.test.tsindex ceed377862..e3196b6196 100644--- a/server/drivers/agents-proxy.test.ts+++ b/server/drivers/agents-proxy.test.ts@@ -683,6 +683,7 @@ describe("agents-proxy MCP surface", () => {"wait_until","list_waits","cancel_wait",+ "check_back","propose_profile","propose_model","propose_team_memory",diff --git a/server/drivers/agents-tool-groups.ts b/server/drivers/agents-tool-groups.tsindex 3c277da5ca..b8b2d6a48e 100644--- a/server/drivers/agents-tool-groups.ts+++ b/server/drivers/agents-tool-groups.ts@@ -32,7 +32,7 @@ export const CORE_TOOLS: ReadonlySet<string> = new Set(["post_to_room", "post_to_thread", "create_bot", "list_team_setup", "list_team_library", "propose_team_setup","propose_bot_deletion", "manage_room", "request_credential", "request_sign_in", "fill_login", "send_voice_note", "decide","extract", "message_person", "report_bug", "retry_thread", "session_search", "trigger_info", "trigger", "delete_trigger",- "wait_until", "list_waits", "cancel_wait", "propose_profile", "propose_model", "propose_team_memory", "skills_list",+ "wait_until", "list_waits", "cancel_wait", "check_back", "propose_profile", "propose_model", "propose_team_memory", "skills_list","skill_manage", "mcp_server", "app_settings", "list_unread_notifications", "mark_notifications_read",]);diff --git a/server/drivers/agents-wait-tools.ts b/server/drivers/agents-wait-tools.tsindex 52e3964a29..f1212de46c 100644--- a/server/drivers/agents-wait-tools.ts+++ b/server/drivers/agents-wait-tools.ts@@ -19,7 +19,7 @@ export const WAIT_TOOL_DEFINITIONS = [// Short on purpose: it rides every turn. Its result says when the condition already holds, when this computer cannot// check files or programs, and when My Cloud's sleep can delay the message.description:- `Tell the person in this chat when something happens. No AI runs while you wait, only plain code checks. Ends after hours (default ${WAIT_HOURS.default}, 1-${WAIT_HOURS.max}).`,+ `Tell the person in this chat when something happens. No AI runs while you wait. Ends after hours (default ${WAIT_HOURS.default}, 1-${WAIT_HOURS.max}).`,inputSchema: {type: "object",additionalProperties: false,diff --git a/server/host/check-back-host.ts b/server/host/check-back-host.tsnew file mode 100644index 0000000000..3e9c2d8010--- /dev/null+++ b/server/host/check-back-host.ts@@ -0,0 +1,36 @@+// The quiet line a check-back keeps in its conversation: one activity row, rewritten in place as it moves on. Clients draw+// it from `checkBack`; the row's English words are for clients that don't know the field.+import type { CheckBackLine } from "../../shared/check-back.ts";+import { serverLine, type ServerLineKey } from "../server-lines.ts";+import type { Message, Store } from "../store.ts";+import { wallClockLabel } from "./check-back-time.ts";+import type { CheckBackRecord } from "./check-backs.ts";++const WORDS: Record<CheckBackLine["status"], ServerLineKey> = {+ pending: "server.checkBack.pending",+ started: "server.checkBack.started",+ cancelled: "server.checkBack.cancelled",+ dropped: "server.checkBack.cancelled",+ failed: "server.checkBack.failed",+};++export function checkBackRow(record: Pick<CheckBackRecord, "dueAt" | "zone">, line: CheckBackLine, language: string | undefined): Omit<Message, "id" | "at"> {+ const when = wallClockLabel(line.startedAt ?? record.dueAt, record.zone);+ return {+ role: "bot", kind: "activity",+ tool: { name: serverLine(language, WORDS[line.status], { when }), ok: line.status !== "failed" },+ checkBack: line,+ };+}++/** Writes the line, or rewrites it when it is still there; a line someone deleted is written again at the end. */+export function writeCheckBackLine(store: Pick<Store, "appendMessage" | "patchMessage" | "messagesFor">, record: CheckBackRecord, line: CheckBackLine,+ messageId: string | undefined, language: string | undefined): string | undefined {+ const row = checkBackRow(record, line, language);+ if (messageId && store.messagesFor(record.threadId).some((message) => message.id === messageId)) {+ store.patchMessage(record.threadId, messageId, { tool: row.tool, checkBack: line });+ return messageId;+ }+ if (line.status !== "pending") return messageId;+ return store.appendMessage(record.threadId, row).id;+}diff --git a/server/host/check-back-time.test.ts b/server/host/check-back-time.test.tsnew file mode 100644index 0000000000..0838d3eafa--- /dev/null+++ b/server/host/check-back-time.test.ts@@ -0,0 +1,81 @@+import { describe, expect, it } from "vitest";++import { parseWhen, wallClockLabel, zonedInstant } from "./check-back-time.ts";++// Thursday 19 November 2026, 14:00 UTC (15:00 in Berlin, 09:00 in New York, 19:30 in Kolkata).+const NOW = Date.UTC(2026, 10, 19, 14, 0);+const at = (when: string, zone = "UTC", now = NOW) => {+ const result = parseWhen(when, now, zone);+ if (!result.ok) throw new Error(result.error);+ return new Date(result.at).toISOString();+};++describe("parseWhen", () => {+ it("reads spans from now", () => {+ expect(at("in 5 minutes")).toBe("2026-11-19T14:05:00.000Z");+ expect(at("in 2 hours")).toBe("2026-11-19T16:00:00.000Z");+ expect(at("in an hour")).toBe("2026-11-19T15:00:00.000Z");+ expect(at("in half an hour")).toBe("2026-11-19T14:30:00.000Z");+ expect(at("in 1h30m")).toBe("2026-11-19T15:30:00.000Z");+ expect(at("in 2 hours and 15 minutes")).toBe("2026-11-19T16:15:00.000Z");+ expect(at("3 days from now")).toBe("2026-11-22T14:00:00.000Z");+ expect(at("in 1 week")).toBe("2026-11-26T14:00:00.000Z");+ });++ it("takes an exact time with its own offset, whatever the zone", () => {+ expect(at("2026-11-21T09:00:00+01:00", "Asia/Kolkata")).toBe("2026-11-21T08:00:00.000Z");+ expect(at("2026-11-21T09:00Z", "America/New_York")).toBe("2026-11-21T09:00:00.000Z");+ expect(at("2026-11-21T09:00:00+0530")).toBe("2026-11-21T03:30:00.000Z");+ });++ it("reads a time without an offset in the person's zone", () => {+ expect(at("2026-11-21T09:00", "Europe/Berlin")).toBe("2026-11-21T08:00:00.000Z");+ expect(at("2026-11-21 09:00", "Asia/Kolkata")).toBe("2026-11-21T03:30:00.000Z");+ });++ it("reads days and times in the person's zone", () => {+ expect(at("Friday 9am", "America/New_York")).toBe("2026-11-20T14:00:00.000Z");+ expect(at("9am friday", "America/New_York")).toBe("2026-11-20T14:00:00.000Z");+ expect(at("tomorrow at 4 pm", "Europe/Berlin")).toBe("2026-11-20T15:00:00.000Z");+ expect(at("tomorrow 16:00", "Asia/Kolkata")).toBe("2026-11-20T10:30:00.000Z");+ expect(at("monday", "Europe/Berlin")).toBe("2026-11-23T08:00:00.000Z");+ expect(at("next thursday", "UTC")).toBe("2026-11-26T09:00:00.000Z");+ expect(at("tonight", "Europe/Berlin")).toBe("2026-11-19T19:00:00.000Z");+ expect(at("2026-12-01", "UTC")).toBe("2026-12-01T09:00:00.000Z");+ });++ it("moves a time already passed today to tomorrow, and today's weekday to next week once its time passed", () => {+ expect(at("4pm", "Europe/Berlin")).toBe("2026-11-19T15:00:00.000Z");+ expect(at("2pm", "Europe/Berlin")).toBe("2026-11-20T13:00:00.000Z");+ expect(at("thursday 10:00", "America/New_York")).toBe("2026-11-19T15:00:00.000Z");+ expect(at("thursday 8:00", "America/New_York")).toBe("2026-11-26T13:00:00.000Z");+ });++ it("moves a skipped wall-clock time forward through the gap and takes the first of a repeated one", () => {+ expect(new Date(zonedInstant({ year: 2026, month: 3, day: 8, hour: 2, minute: 30 }, "America/New_York")).toISOString()).toBe("2026-03-08T07:30:00.000Z");+ expect(new Date(zonedInstant({ year: 2026, month: 11, day: 1, hour: 1, minute: 30 }, "America/New_York")).toISOString()).toBe("2026-11-01T05:30:00.000Z");+ expect(new Date(zonedInstant({ year: 2026, month: 3, day: 29, hour: 2, minute: 30 }, "Europe/Berlin")).toISOString()).toBe("2026-03-29T01:30:00.000Z");+ expect(new Date(zonedInstant({ year: 2026, month: 10, day: 25, hour: 2, minute: 30 }, "Europe/Berlin")).toISOString()).toBe("2026-10-25T00:30:00.000Z");+ const beforeSpring = Date.UTC(2026, 2, 7, 15, 0);+ expect(at("tomorrow 9am", "America/New_York", beforeSpring)).toBe("2026-03-08T13:00:00.000Z");+ });++ it("lands on the whole minute whatever second it is now", () => {+ expect(at("Friday 9am", "Asia/Kolkata", NOW + 55_086)).toBe("2026-11-20T03:30:00.000Z");+ expect(at("4pm", "Europe/Berlin", NOW + 12_345)).toBe("2026-11-19T15:00:00.000Z");+ });++ it("refuses what it can't read, with the forms it can", () => {+ for (const when of ["", "soon", "in a while", "whenever", "25:00", "friday 13pm", "2026-13-40T99:00"]) {+ const result = parseWhen(when, NOW, "UTC");+ expect(result.ok, when).toBe(false);+ if (!result.ok) expect(result.error).toContain("in 2 hours");+ }+ });+});++describe("wallClockLabel", () => {+ it("names the day and the time in the zone", () => {+ expect(wallClockLabel(Date.UTC(2026, 10, 20, 14, 0), "America/New_York")).toBe("Fri 20 Nov 09:00");+ });+});diff --git a/server/host/check-back-time.ts b/server/host/check-back-time.tsnew file mode 100644index 0000000000..24e51f8b69--- /dev/null+++ b/server/host/check-back-time.ts@@ -0,0 +1,183 @@+// When a check-back is due, from a bot's `when`: an exact time with its offset, a span from now ("in 2 hours"), or a day+// and a time in the person's zone ("Friday 9am", "tomorrow 16:00"). Wall-clock times follow the routine rules: a time a+// clock change skips moves forward through the gap, and a time a clock change repeats is its first occurrence.++const MINUTE = 60_000, HOUR = 60 * MINUTE, DAY = 24 * HOUR;+const WEEKDAYS = ["sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday"] as const;+const WEEKDAY_SHORT: Record<string, number> = { sun: 0, mon: 1, tue: 2, tues: 2, wed: 3, thu: 4, thur: 4, thurs: 4, fri: 5, sat: 6 };+const UNITS: Record<string, number> = {+ s: 1_000, sec: 1_000, secs: 1_000, second: 1_000, seconds: 1_000,+ m: MINUTE, min: MINUTE, mins: MINUTE, minute: MINUTE, minutes: MINUTE,+ h: HOUR, hr: HOUR, hrs: HOUR, hour: HOUR, hours: HOUR,+ d: DAY, day: DAY, days: DAY,+ w: 7 * DAY, wk: 7 * DAY, wks: 7 * DAY, week: 7 * DAY, weeks: 7 * DAY,+};+const NAMED_TIMES: Record<string, [number, number]> = { noon: [12, 0], midday: [12, 0], midnight: [0, 0], morning: [9, 0], afternoon: [14, 0], evening: [18, 0], tonight: [20, 0] };+/** A day named without a time: the start of a working day. */+const DEFAULT_TIME: [number, number] = [9, 0];++export const WHEN_HELP = 'when: "in 2 hours", "tomorrow 9am", "Friday 16:00", or an exact time such as 2026-11-21T09:00:00+01:00.';++export type WhenResult = { ok: true; at: number } | { ok: false; error: string };++interface Wall { year: number; month: number; day: number; hour: number; minute: number; weekday: number }++const formatters = new Map<string, Intl.DateTimeFormat>();+function formatter(zone: string): Intl.DateTimeFormat {+ let found = formatters.get(zone);+ if (!found) {+ found = new Intl.DateTimeFormat("en-US", { timeZone: zone, hourCycle: "h23", year: "numeric", month: "2-digit", day: "2-digit", hour: "2-digit", minute: "2-digit", second: "2-digit", weekday: "short" });+ formatters.set(zone, found);+ }+ return found;+}++export function validZone(zone: string): boolean {+ try { formatter(zone); return true; } catch { return false; }+}++function wallOf(ms: number, zone: string): Wall & { second: number } {+ const parts = Object.fromEntries(formatter(zone).formatToParts(new Date(ms)).map((part) => [part.type, part.value]));+ return {+ year: Number(parts.year), month: Number(parts.month), day: Number(parts.day), hour: Number(parts.hour) % 24, minute: Number(parts.minute),+ second: Number(parts.second), weekday: WEEKDAY_SHORT[String(parts.weekday).toLowerCase()] ?? 0,+ };+}++const asUtc = (wall: Pick<Wall, "year" | "month" | "day" | "hour" | "minute"> & { second?: number }) =>+ Date.UTC(wall.year, wall.month - 1, wall.day, wall.hour, wall.minute, wall.second ?? 0);++function offsetAt(ms: number, zone: string): number {+ return asUtc(wallOf(ms, zone)) - Math.floor(ms / 1000) * 1000;+}++/** The instant a wall-clock time in `zone` names: the first of two in a repeated hour, moved forward through a skipped one. */+export function zonedInstant(wall: Pick<Wall, "year" | "month" | "day" | "hour" | "minute">, zone: string): number {+ const target = asUtc({ year: wall.year, month: wall.month, day: wall.day, hour: wall.hour, minute: wall.minute });+ const before = offsetAt(target - DAY, zone), after = offsetAt(target + DAY, zone);+ const fits = [target - before, target - after].filter((at) => asUtc(wallOf(at, zone)) === target);+ return fits.length ? Math.min(...fits) : target - before;+}++function addDays(wall: Wall, days: number): Wall {+ const date = new Date(Date.UTC(wall.year, wall.month - 1, wall.day + days));+ return { ...wall, year: date.getUTCFullYear(), month: date.getUTCMonth() + 1, day: date.getUTCDate(), weekday: date.getUTCDay() };+}++function parseDuration(text: string): number | null {+ const words = text.replace(/\bfrom now\b/, "").replace(/\band\b|,/g, " ").trim();+ if (!words) return null;+ let total = 0, rest = words;+ const half = /^half an? hour\b\s*/;+ while (rest) {+ if (half.test(rest)) { total += 30 * MINUTE; rest = rest.replace(half, ""); continue; }+ const match = /^(\d+(?:\.\d+)?|an?)\s*([a-z]+)\s*/.exec(rest);+ const unit = match ? UNITS[match[2]!] : undefined;+ if (!match || unit === undefined) return null;+ total += (match[1] === "a" || match[1] === "an" ? 1 : Number(match[1])) * unit;+ rest = rest.slice(match[0].length);+ }+ return total > 0 ? Math.round(total) : null;+}++function parseClock(text: string): [number, number] | null {+ const named = NAMED_TIMES[text];+ if (named) return named;+ const match = /^(\d{1,2})(?::(\d{2}))?\s*(am|pm|a\.m\.|p\.m\.)?$/.exec(text);+ if (!match) return null;+ let hour = Number(match[1]);+ const minute = match[2] ? Number(match[2]) : 0;+ const half = match[3]?.replace(/\./g, "");+ if (!half && !match[2] && text.length > 2) return null;+ if (minute > 59) return null;+ if (half) {+ if (hour < 1 || hour > 12) return null;+ hour = (hour % 12) + (half === "pm" ? 12 : 0);+ } else if (hour > 23) return null;+ return [hour, minute];+}++type DayWord = { kind: "today" } | { kind: "tomorrow" } | { kind: "weekday"; weekday: number; next: boolean } | { kind: "date"; year: number; month: number; day: number };++function parseDay(text: string): DayWord | null {+ if (text === "today" || text === "tonight" || text === "this evening" || text === "this afternoon" || text === "this morning") return { kind: "today" };+ if (text === "tomorrow") return { kind: "tomorrow" };+ const date = /^(\d{4})-(\d{2})-(\d{2})$/.exec(text);+ if (date) return { kind: "date", year: Number(date[1]), month: Number(date[2]), day: Number(date[3]) };+ const weekday = /^(?:(next|this|on)\s+)?([a-z]+)$/.exec(text);+ if (!weekday) return null;+ const name = weekday[2]!;+ const full = WEEKDAYS.findIndex((day) => day === name);+ const index = full >= 0 ? full : WEEKDAY_SHORT[name];+ return index === undefined ? null : { kind: "weekday", weekday: index, next: weekday[1] === "next" };+}++const DAY_PART: Record<string, string> = { tonight: "tonight", "this evening": "evening", "this afternoon": "afternoon", "this morning": "morning" };++function dayAndTime(text: string, now: number, zone: string): number | null {+ const at = text.replace(/\s+at\s+/, " ").replace(/^at\s+/, "").trim();+ const tokens = at.split(/\s+/);+ for (let split = 0; split <= tokens.length; split++) {+ for (const [dayText, clockText] of [[tokens.slice(0, split).join(" "), tokens.slice(split).join(" ")], [tokens.slice(split).join(" "), tokens.slice(0, split).join(" ")]] as const) {+ const day = dayText ? parseDay(dayText) : null;+ if (dayText && !day) continue;+ const clock = clockText ? parseClock(clockText) : DAY_PART[dayText] ? NAMED_TIMES[DAY_PART[dayText]!]! : null;+ if (clockText && !clock) continue;+ if (!day && !clock) continue;+ return resolveDay(day, clock, now, zone);+ }+ }+ return null;+}++function realDate(year: number, month: number, day: number): boolean {+ const date = new Date(Date.UTC(year, month - 1, day));+ return date.getUTCFullYear() === year && date.getUTCMonth() === month - 1 && date.getUTCDate() === day;+}++function resolveDay(day: DayWord | null, clock: [number, number] | null, now: number, zone: string): number | null {+ const today = wallOf(now, zone);+ const [hour, minute] = clock ?? DEFAULT_TIME;+ const on = (wall: Pick<Wall, "year" | "month" | "day">) => zonedInstant({ ...wall, hour, minute }, zone);+ if (!day) {+ const first = on(today);+ return first > now ? first : on(addDays(today, 1));+ }+ if (day.kind === "today") return on(today);+ if (day.kind === "tomorrow") return on(addDays(today, 1));+ if (day.kind === "date") return realDate(day.year, day.month, day.day) ? on(day) : null;+ let ahead = (day.weekday - today.weekday + 7) % 7;+ if (day.next && ahead === 0) ahead = 7;+ const candidate = on(addDays(today, ahead));+ return candidate > now ? candidate : on(addDays(today, ahead + 7));+}++const EXACT = /^(\d{4})-(\d{2})-(\d{2})[t ](\d{2}):(\d{2})(?::(\d{2})(?:\.\d+)?)?(z|[+-]\d{2}:?\d{2})?$/;++/** The time `when` names, in `zone` where it names a wall-clock time; an error the bot can act on otherwise. */+export function parseWhen(when: string, now: number, zone: string): WhenResult {+ const text = when.trim().toLowerCase().replace(/\s+/g, " ").replace(/[.!]$/, "");+ if (!text) return { ok: false, error: WHEN_HELP };+ const exact = EXACT.exec(text);+ if (exact) {+ const [, y, mo, d, h, mi, s, offset] = exact;+ if (!realDate(Number(y), Number(mo), Number(d)) || Number(h) > 23 || Number(mi) > 59 || Number(s ?? 0) > 59) return { ok: false, error: WHEN_HELP };+ const at = offset+ ? Date.parse(`${y}-${mo}-${d}T${h}:${mi}:${s ?? "00"}${offset === "z" ? "Z" : offset.length === 5 ? `${offset.slice(0, 3)}:${offset.slice(3)}` : offset}`)+ : zonedInstant({ year: Number(y), month: Number(mo), day: Number(d), hour: Number(h), minute: Number(mi) }, zone);+ return Number.isFinite(at) ? { ok: true, at } : { ok: false, error: WHEN_HELP };+ }+ const relative = /^(?:in |after )(.+)$/.exec(text)?.[1] ?? (/\bfrom now$/.test(text) ? text : null);+ if (relative) {+ const span = parseDuration(relative);+ return span === null ? { ok: false, error: WHEN_HELP } : { ok: true, at: now + span };+ }+ const at = dayAndTime(text, now, zone);+ return at === null ? { ok: false, error: WHEN_HELP } : { ok: true, at };+}++/** "Fri 21 Nov 09:00" in `zone`, for the bot's answer and the line's English words. */+export function wallClockLabel(at: number, zone: string): string {+ return new Intl.DateTimeFormat("en-GB", { timeZone: zone, weekday: "short", day: "numeric", month: "short", hour: "2-digit", minute: "2-digit", hourCycle: "h23" })+ .format(new Date(at)).replace(",", "");+}diff --git a/server/host/check-backs.test.ts b/server/host/check-backs.test.tsnew file mode 100644index 0000000000..7d59f4210c--- /dev/null+++ b/server/host/check-backs.test.ts@@ -0,0 +1,222 @@+import { mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs";+import { tmpdir } from "node:os";+import { join } from "node:path";+import { afterEach, describe, expect, it } from "vitest";++import { CHECK_BACK_LIMITS, type CheckBackLine } from "../../shared/check-back.ts";+import { BUSY_RETRY_MS, CHECK_BACK_FILE, START_RETRY_MS, START_TRIES, checkBackPrompt, createCheckBacks, type CheckBackDeps, type NewCheckBack } from "./check-backs.ts";++const T0 = Date.UTC(2026, 10, 19, 14, 0);+const MIN = 60_000;+const dirs: string[] = [];+afterEach(() => { for (const dir of dirs.splice(0)) rmSync(dir, { recursive: true, force: true }); });++function harness(over: Partial<CheckBackDeps> = {}, dir = mkdtempSync(join(tmpdir(), "omb-check-backs-"))) {+ if (!dirs.includes(dir)) dirs.push(dir);+ const h = {+ dir,+ clock: T0,+ alive: new Set(["scout:t1", "scout:t2", "ada:t9"]),+ busy: new Set<string>(),+ lines: new Map<string, CheckBackLine>(),+ started: [] as Array<{ id: string; threadId: string; prompt: string; origin: unknown }>,+ refuseStart: null as string | null,+ };+ let lineId = 0;+ const manager = createCheckBacks({+ dataDir: dir,+ now: () => h.clock,+ alive: (botId, threadId) => h.alive.has(`${botId}:${threadId}`),+ busy: (botId, threadId) => h.busy.has(`${botId}:${threadId}`),+ line: (_record, line, messageId) => { const id = messageId ?? `m${++lineId}`; h.lines.set(id, line); return id; },+ start: async (record, prompt) => {+ if (h.refuseStart) throw new Error(h.refuseStart);+ h.started.push({ id: record.id, threadId: record.threadId, prompt, origin: record.origin });+ },+ log: () => {},+ ...over,+ });+ return { h, manager };+}++const asked = (over: Partial<NewCheckBack> = {}): NewCheckBack => ({+ botId: "scout", threadId: "t1", note: "see if CI passed", dueAt: T0 + 5 * MIN, zone: "Europe/Berlin",+ origin: { kind: "user", request: "fix the build and tell me when CI is green", person: "p_aaaaaaaaaaaaaaaaaaaaaa" }, ...over,+});++describe("check-backs", () => {+ it("fires once at its time in the same conversation, with nobody asked, and keeps the asker's origin", async () => {+ const { h, manager } = harness();+ const made = manager.create(asked());+ expect(made.ok).toBe(true);+ const [lineId] = [...h.lines.keys()];+ expect(h.lines.get(lineId!)).toMatchObject({ status: "pending", dueAt: T0 + 5 * MIN, note: "see if CI passed" });+ await manager.tick();+ expect(h.started).toEqual([]);+ h.clock = T0 + 5 * MIN;+ await manager.tick();+ await manager.tick();+ expect(h.started).toHaveLength(1);+ expect(h.started[0]).toMatchObject({ threadId: "t1", origin: { kind: "user", person: "p_aaaaaaaaaaaaaaaaaaaaaa" } });+ expect(h.started[0]!.prompt).toContain("What to check: see if CI passed");+ expect(h.started[0]!.prompt).not.toContain("runs now, once, late");+ expect(h.lines.get(lineId!)).toMatchObject({ status: "started", startedAt: T0 + 5 * MIN });+ expect(manager.list("scout", "t1")).toEqual([]);+ });++ it("never lends a computer on a later turn", () => {+ const { manager } = harness();+ const made = manager.create(asked({ origin: { kind: "user", request: "x", lends: true } }));+ expect(made.ok && made.record.origin).toEqual({ kind: "user", request: "x" });+ });++ it("carries the condition into the turn", async () => {+ const { h, manager } = harness();+ manager.create(asked({ note: "chase the client", condition: "they have not replied" }));+ h.clock += 5 * MIN;+ await manager.tick();+ expect(h.started[0]!.prompt).toContain("Only if this holds: they have not replied.");+ });++ it("refuses times under a minute or past 90 days, and over the limits", () => {+ const { manager } = harness();+ expect(manager.create(asked({ dueAt: T0 + 30_000 }))).toMatchObject({ ok: false, error: expect.stringContaining("less than a minute") });+ expect(manager.create(asked({ dueAt: T0 + CHECK_BACK_LIMITS.maxMs + MIN }))).toMatchObject({ ok: false, error: expect.stringContaining("90 days") });+ expect(manager.create(asked({ dueAt: T0 + CHECK_BACK_LIMITS.maxMs })).ok).toBe(true);+ for (let i = 1; i < CHECK_BACK_LIMITS.perConversation; i++) expect(manager.create(asked()).ok).toBe(true);+ expect(manager.create(asked())).toMatchObject({ ok: false, error: expect.stringContaining("already has 10") });+ expect(manager.create(asked({ threadId: "t2" })).ok).toBe(true);+ });++ it("holds a bot to its limit across conversations", () => {+ const { h, manager } = harness();+ for (let i = 0; i < CHECK_BACK_LIMITS.perBot; i++) {+ h.alive.add(`scout:c${i}`);+ expect(manager.create(asked({ threadId: `c${i}` })).ok).toBe(true);+ }+ h.alive.add("scout:c-more");+ expect(manager.create(asked({ threadId: "c-more" }))).toMatchObject({ ok: false, error: expect.stringContaining("50") });+ expect(manager.create(asked({ botId: "ada", threadId: "t9" })).ok).toBe(true);+ });++ it("survives a restart and catches up once, late, after the computer slept", async () => {+ const first = harness();+ first.manager.create(asked());+ first.manager.create(asked({ dueAt: T0 + 60 * MIN, note: "second" }));+ expect(JSON.parse(readFileSync(join(first.h.dir, CHECK_BACK_FILE), "utf8")).checkBacks).toHaveLength(2);+ const again = harness({}, first.h.dir);+ again.h.clock = T0 + 3 * 24 * 60 * MIN;+ await again.manager.tick();+ expect(again.h.started.map((one) => one.prompt.includes("runs now, once, late"))).toEqual([true, true]);+ expect(again.h.started).toHaveLength(2);+ expect(JSON.parse(readFileSync(join(first.h.dir, CHECK_BACK_FILE), "utf8")).checkBacks).toEqual([]);+ });++ it("does not start again one that was mid-start when the server stopped", async () => {+ const first = harness();+ first.manager.create(asked());+ const file = join(first.h.dir, CHECK_BACK_FILE);+ const saved = JSON.parse(readFileSync(file, "utf8"));+ saved.checkBacks[0].startingAt = T0 + 5 * MIN;+ writeFileSync(file, JSON.stringify(saved));+ const again = harness({}, first.h.dir);+ again.h.clock = T0 + 10 * MIN;+ again.manager.start();+ again.manager.stop();+ await again.manager.tick();+ expect(again.h.started).toEqual([]);+ expect([...again.h.lines.values()][0]).toMatchObject({ status: "failed" });+ });++ it("cancels: the line says so and nothing runs", async () => {+ const { h, manager } = harness();+ const made = manager.create(asked());+ if (!made.ok) throw new Error(made.error);+ expect(manager.cancel(made.record.id)).not.toBeNull();+ expect([...h.lines.values()][0]).toMatchObject({ status: "cancelled" });+ h.clock += 10 * MIN;+ await manager.tick();+ expect(h.started).toEqual([]);+ expect(manager.cancel(made.record.id)).toBeNull();+ });++ it("drops one whose conversation or bot is gone, or whose person left", async () => {+ const { h, manager } = harness();+ manager.create(asked());+ manager.create(asked({ botId: "ada", threadId: "t9" }));+ h.alive.delete("scout:t1");+ h.alive.delete("ada:t9");+ h.clock += 10 * MIN;+ await manager.tick();+ expect(h.started).toEqual([]);+ expect(JSON.parse(readFileSync(join(h.dir, CHECK_BACK_FILE), "utf8")).checkBacks).toEqual([]);+ expect(manager.nextDueAt()).toBeNull();+ });++ it("waits for a busy conversation, then starts", async () => {+ const { h, manager } = harness();+ manager.create(asked());+ h.busy.add("scout:t1");+ h.clock += 5 * MIN;+ await manager.tick();+ expect(h.started).toEqual([]);+ h.busy.clear();+ await manager.tick();+ expect(h.started).toEqual([]);+ h.clock += BUSY_RETRY_MS;+ await manager.tick();+ expect(h.started).toHaveLength(1);+ });++ it("tries a refused start again, and gives up with a line after many", async () => {+ const { h, manager } = harness();+ manager.create(asked());+ h.refuseStart = "This bot is paused.";+ h.clock += 5 * MIN;+ await manager.tick();+ expect([...h.lines.values()][0]).toMatchObject({ status: "pending" });+ h.refuseStart = null;+ h.clock += START_RETRY_MS;+ await manager.tick();+ expect(h.started).toHaveLength(1);++ expect(manager.create(asked({ dueAt: h.clock + 5 * MIN })).ok).toBe(true);+ h.refuseStart = "This bot is paused.";+ h.clock += 5 * MIN;+ for (let i = 0; i < START_TRIES; i++) {+ h.clock += START_RETRY_MS;+ await manager.tick();+ }+ expect([...h.lines.values()].at(-1)).toMatchObject({ status: "failed", why: "This bot is paused." });+ expect(manager.nextDueAt()).toBeNull();+ });++ it("waits out a paused bot without using up its tries", async () => {+ const { h, manager } = harness({ paused: (error) => (error as { code?: string }).code === "bot_paused" });+ manager.create(asked());+ h.clock += 5 * MIN;+ const paused = Object.assign(new Error("Scout is paused."), { code: "bot_paused" });+ const start = async () => { throw paused; };+ const held = harness({ paused: (error) => (error as { code?: string }).code === "bot_paused", start }, h.dir);+ held.h.clock = h.clock;+ for (let i = 0; i < START_TRIES + 5; i++) {+ held.h.clock += START_RETRY_MS;+ await held.manager.tick();+ }+ expect(held.manager.nextDueAt()).not.toBeNull();+ expect([...held.h.lines.values()].some((line) => line.status === "failed")).toBe(false);+ });++ it("names the soonest one to wake a sleeping Cloud", () => {+ const { manager } = harness();+ expect(manager.nextDueAt()).toBeNull();+ manager.create(asked({ dueAt: T0 + 90 * MIN }));+ manager.create(asked({ dueAt: T0 + 7 * MIN }));+ expect(manager.nextDueAt()).toBe(T0 + 7 * MIN);+ });++ it("writes the prompt in plain words with the zone", () => {+ const prompt = checkBackPrompt({ ...asked(), id: "c1", createdAt: T0, zone: "Europe/Berlin" }, T0 + 5 * MIN);+ expect(prompt).toContain("(Thu 19 Nov 15:05, Europe/Berlin)");+ });+});diff --git a/server/host/check-backs.ts b/server/host/check-backs.tsnew file mode 100644index 0000000000..52a41f9d36--- /dev/null+++ b/server/host/check-backs.ts@@ -0,0 +1,254 @@+// Check-backs: a bot comes back to the same conversation at a time it chose, with a note of what to check. Each one is a+// record in `check-backs.json` and a quiet line in its conversation. When its time comes the bot takes an ordinary turn+// there, started for whoever's request set it (the same origin, so on a Team Cloud the asker owns the run and a private+// chat stays private). Nobody is asked anything at any point: the line's Cancel is the person's only control.+//+// A check-back starts at most once. The start is saved before the turn is asked for; a record found mid-start after a+// restart is closed, never started again. Time missed while the computer slept or the app was closed runs it once, late.+import { randomUUID } from "node:crypto";+import { mkdirSync, readFileSync } from "node:fs";+import { dirname, join } from "node:path";+import { z } from "zod";++import { CHECK_BACK_LIMITS, type CheckBackLine, type CheckBackStatus } from "../../shared/check-back.ts";+import { writeFileAtomic } from "../atomic.ts";+import { startDueTimer, type DueTimer } from "../due-timer.ts";+import { workOriginSchema, type WorkOrigin } from "../peer-provenance.ts";+import { wallClockLabel } from "./check-back-time.ts";++export const CHECK_BACK_FILE = "check-backs.json";+export const NOTE_MAX = 1_000;+export const CONDITION_MAX = 500;+/** How long a check-back whose bot or chat is busy waits before it looks again. */+export const BUSY_RETRY_MS = 15_000;+/** A start the server refused (a paused bot, maintenance, a move) is tried again this often, this many times. */+export const START_RETRY_MS = 60_000;+export const START_TRIES = 60;+/** Later than this past its time, a check-back says in its turn that it runs late. */+export const LATE_MS = 2 * 60_000;++const id = z.string().min(1).max(200);+const recordSchema = z.object({+ id, botId: id, threadId: id,+ note: z.string().min(1).max(NOTE_MAX), condition: z.string().max(CONDITION_MAX).optional(),+ dueAt: z.number(), createdAt: z.number(), zone: z.string().max(100),+ origin: workOriginSchema,+ lineMessageId: id.optional(),+ /** Set and saved right before the turn is asked for. */+ startingAt: z.number().optional(),+ tries: z.number().int().optional(),+});+const fileSchema = z.object({ version: z.literal(1), checkBacks: z.array(z.unknown()) });+export type CheckBackRecord = z.infer<typeof recordSchema>;++export interface NewCheckBack {+ botId: string; threadId: string; note: string; condition?: string; dueAt: number; zone: string; origin: WorkOrigin;+}+export type CreateResult = { ok: true; record: CheckBackRecord } | { ok: false; error: string };++export interface CheckBackDeps {+ file?: string;+ dataDir: string;+ now?: () => number;+ /** False once the bot or the conversation is gone, or the person who owns a private chat left. */+ alive(botId: string, threadId: string): boolean;+ busy(botId: string, threadId: string): boolean;+ /** Writes or rewrites the record's line; returns the line's message id. */+ line(record: CheckBackRecord, line: CheckBackLine, messageId: string | undefined): string | undefined;+ /** Asks for the turn; rejects when the server refused to start it. */+ start(record: CheckBackRecord, prompt: string): Promise<void>;+ /** The refusal is the bot being paused or held: it waits for the bot, however long, without using up its tries. */+ paused?(error: unknown): boolean;+ log?(text: string): void;+}++export function checkBackPrompt(record: CheckBackRecord, startAt: number): string {+ const late = startAt - record.dueAt > LATE_MS+ ? ` It was due at ${new Date(record.dueAt).toISOString()}; this computer was asleep or MausBot was not running, so it runs now, once, late.`+ : "";+ const condition = record.condition ? ` Only if this holds: ${record.condition}. If it does not, end with one short line saying nothing was needed.` : "";+ return `[Check back: at ${new Date(record.createdAt).toISOString()} you set this to come back now (${wallClockLabel(record.dueAt, record.zone)}, ${record.zone}). What to check: ${record.note}${condition}${late} Check it now and carry on the work here; tell the person what you found in a sentence or two. Use check_back again only if it still needs a later look.]`;+}++const lineOf = (record: CheckBackRecord, status: CheckBackStatus, extra: Partial<CheckBackLine> = {}): CheckBackLine => ({+ id: record.id, dueAt: record.dueAt, status, note: record.note, ...extra,+});++export function createCheckBacks(deps: CheckBackDeps) {+ const file = deps.file ?? join(deps.dataDir, CHECK_BACK_FILE);+ const now = deps.now ?? Date.now;+ const log = deps.log ?? ((text: string) => console.error(text));+ let records: CheckBackRecord[] = load();+ const waitUntil = new Map<string, number>();+ let timer: DueTimer | null = null;+ let running = false;+ let recovered = false;++ function load(): CheckBackRecord[] {+ try {+ const parsed = fileSchema.safeParse(JSON.parse(readFileSync(file, "utf8")));+ return parsed.success ? parsed.data.checkBacks.flatMap((candidate) => {+ const record = recordSchema.safeParse(candidate);+ return record.success ? [record.data] : [];+ }) : [];+ } catch {+ return [];+ }+ }++ function save(): void {+ mkdirSync(dirname(file), { recursive: true });+ writeFileAtomic(file, JSON.stringify({ version: 1, checkBacks: records }, null, 2), { mode: 0o600 });+ }++ function commit(mutate: () => void): void {+ const before = records.map((record) => ({ ...record }));+ try {+ mutate();+ save();+ } catch (error) {+ records = before;+ throw error;+ }+ timer?.poke();+ }++ function drawLine(record: CheckBackRecord, line: CheckBackLine): void {+ try {+ const messageId = deps.line(record, line, record.lineMessageId);+ if (messageId && !record.lineMessageId) record.lineMessageId = messageId;+ } catch (error) {+ log(`check-back ${record.id}: could not draw its line: ${String(error)}`);+ }+ }++ function close(record: CheckBackRecord, line: CheckBackLine): void {+ commit(() => { records = records.filter((other) => other.id !== record.id); });+ waitUntil.delete(record.id);+ drawLine(record, line);+ }++ /** Pending ones whose bot and chat are still here; the others are dropped, so nothing of a gone chat stays on disk. */+ function live(): CheckBackRecord[] {+ const here = records.filter((record) => deps.alive(record.botId, record.threadId));+ if (here.length !== records.length) {+ try { commit(() => { records = records.filter((record) => here.includes(record)); }); } catch (error) { log(`check-back: could not drop gone ones: ${String(error)}`); }+ }+ return here;+ }++ function refusal(input: NewCheckBack, at: number): string | null {+ const ahead = input.dueAt - at;+ if (ahead < CHECK_BACK_LIMITS.minMs - 1_000) return "That is less than a minute away: do it now in this turn instead.";+ if (ahead > CHECK_BACK_LIMITS.maxMs) return "That is more than 90 days away. Pick a time within 90 days, or make a routine with trigger.";+ const mine = live().filter((record) => record.botId === input.botId);+ if (mine.filter((record) => record.threadId === input.threadId).length >= CHECK_BACK_LIMITS.perConversation) {+ return `This conversation already has ${CHECK_BACK_LIMITS.perConversation} check-backs waiting, the most it may. Cancel one first.`;+ }+ if (mine.length >= CHECK_BACK_LIMITS.perBot) return `You already have ${CHECK_BACK_LIMITS.perBot} check-backs waiting across your conversations, the most a bot may.`;+ return null;+ }++ async function startOne(record: CheckBackRecord, at: number): Promise<void> {+ commit(() => { record.startingAt = at; });+ try {+ await deps.start(record, checkBackPrompt(record, at));+ } catch (error) {+ const tries = (record.tries ?? 0) + (deps.paused?.(error) ? 0 : 1);+ const why = error instanceof Error ? error.message : String(error);+ if (tries >= START_TRIES || !deps.alive(record.botId, record.threadId)) {+ close(record, lineOf(record, "failed", { why: why.split("\n", 1)[0]!.slice(0, 200) }));+ return;+ }+ commit(() => { delete record.startingAt; record.tries = tries; });+ waitUntil.set(record.id, now() + START_RETRY_MS);+ return;+ }+ close(record, lineOf(record, "started", { startedAt: at }));+ }++ async function tick(): Promise<void> {+ if (running) return;+ running = true;+ try {+ live();+ const at = now();+ for (const record of records.slice()) {+ if (record.startingAt !== undefined || at < record.dueAt || at < (waitUntil.get(record.id) ?? 0)) continue;+ if (deps.busy(record.botId, record.threadId)) { waitUntil.set(record.id, at + BUSY_RETRY_MS); continue; }+ await startOne(record, at);+ }+ } finally {+ running = false;+ }+ }++ return {+ create(input: NewCheckBack): CreateResult {+ const at = now();+ const refused = refusal(input, at);+ if (refused) return { ok: false, error: refused };+ const { lends: _lends, ...origin } = input.origin as WorkOrigin & { lends?: true };+ const record: CheckBackRecord = {+ id: randomUUID(), botId: input.botId, threadId: input.threadId, note: input.note.slice(0, NOTE_MAX),+ ...(input.condition ? { condition: input.condition.slice(0, CONDITION_MAX) } : {}),+ dueAt: input.dueAt, createdAt: at, zone: input.zone, origin: origin as WorkOrigin,+ };+ commit(() => { records.push(record); });+ drawLine(record, lineOf(record, "pending"));+ if (record.lineMessageId) {+ try { save(); } catch (error) { log(`check-back ${record.id}: could not store its line: ${String(error)}`); }+ }+ return { ok: true, record: { ...record } };+ },+ /** Pending ones in this conversation, soonest first. */+ list(botId: string, threadId: string): CheckBackRecord[] {+ return live().filter((record) => record.botId === botId && record.threadId === threadId && record.startingAt === undefined)+ .sort((a, b) => a.dueAt - b.dueAt).map((record) => ({ ...record }));+ },+ get(checkBackId: string): CheckBackRecord | null {+ const found = records.find((record) => record.id === checkBackId);+ return found ? { ...found } : null;+ },+ cancel(checkBackId: string): CheckBackRecord | null {+ const found = records.find((record) => record.id === checkBackId && record.startingAt === undefined);+ if (!found) return null;+ close(found, lineOf(found, "cancelled"));+ return { ...found };+ },+ /** When a sleeping Cloud should wake: the soonest check-back's time. */+ nextDueAt(): number | null {+ const pending = live().filter((record) => record.startingAt === undefined);+ return pending.length ? Math.min(...pending.map((record) => Math.max(record.dueAt, waitUntil.get(record.id) ?? 0))) : null;+ },+ start(): void {+ if (!recovered) {+ recovered = true;+ const cut = records.filter((record) => record.startingAt !== undefined);+ for (const record of cut) close(record, lineOf(record, "failed", { why: "MausBot stopped while it was starting this; it was not started again." }));+ }+ if (timer) return;+ timer = startDueTimer({+ run: () => tick(),+ next: () => records.reduce<number | null>((soonest, record) => record.startingAt !== undefined ? soonest+ : Math.min(soonest ?? Infinity, Math.max(record.dueAt, waitUntil.get(record.id) ?? 0)), null),+ now,+ retryMs: BUSY_RETRY_MS,+ onError: (error) => log(`check-back tick failed: ${String(error)}`),+ });+ },+ stop(): void {+ timer?.stop();+ timer = null;+ },+ tick,+ get isTicking(): boolean { return running; },+ };+}++export type CheckBacks = ReturnType<typeof createCheckBacks>;++/** What the bot reads back: each pending check-back with its id, its time and its note. */+export function checkBackList(records: readonly CheckBackRecord[]): string {+ return records.map((record) => `- ${record.id} · ${wallClockLabel(record.dueAt, record.zone)} (${new Date(record.dueAt).toISOString()}) · ${record.note}${record.condition ? ` · only if: ${record.condition}` : ""}`).join("\n");+}diff --git a/server/host/person-first.test.ts b/server/host/person-first.test.tsindex 511055bfa8..22848274ba 100644--- a/server/host/person-first.test.ts+++ b/server/host/person-first.test.ts@@ -60,7 +60,7 @@ describe("the person's message goes first", () => {await h.advance(0);expect(h.stops).toEqual(["Stopped a step that had run for 9 min, to answer you first"]);expect(h.requeued).toEqual([stoppedNote("Bash: gh run view 42; sleep 30", 9 * MIN)]);- expect(h.requeued[0]).toContain("do not wait inside a command again: check it once, then use wait_until or a one-time trigger");+ expect(h.requeued[0]).toContain("do not wait inside a command again: check it once, then use check_back or wait_until");});it("gives a young tool call the rest of its minute, and leaves the turn alone when it returns and the bot answers", async () => {diff --git a/server/host/person-first.ts b/server/host/person-first.tsindex 2c8eb1af6e..d10c6290f8 100644--- a/server/host/person-first.ts+++ b/server/host/person-first.ts@@ -59,7 +59,7 @@ export function stoppedLine(ms: number, language?: string): string {/** What the model is told after the person's words, in the turn that answers them. */export function stoppedNote(label: string, ms: number): string {- return `[OpenMausBot: your step ${JSON.stringify(label)} had run for ${ranFor(ms)} with this message unread, so it was stopped for you to answer first. Answer this now. If that step still matters, do not wait inside a command again: check it once, then use wait_until or a one-time trigger to check back.]`;+ return `[OpenMausBot: your step ${JSON.stringify(label)} had run for ${ranFor(ms)} with this message unread, so it was stopped for you to answer first. Answer this now. If that step still matters, do not wait inside a command again: check it once, then use check_back or wait_until.]`;}function toolLabel(event: Extract<RuntimeEvent, { type: "item.started" }>): string {diff --git a/server/index.ts b/server/index.tsindex e2e2e8308e..c3efeeab54 100644--- a/server/index.ts+++ b/server/index.ts@@ -605,7 +605,7 @@ import { createTrustAnswers } from "./host/trust-answers.ts";import { createInternalThreadRoutes } from "./routes/internal-threads.ts";import { createBrowserEvidenceRoutes } from "./routes/browser-evidence.ts";import { createSignInCardRoutes } from "./routes/sign-in-cards.ts";-import { createInternalChiefTeamRoutes } from "./routes/internal-chief-team.ts"; import { createInternalModelRoutes } from "./routes/internal-models.ts"; import { createOwnThreads } from "./host/own-threads.ts"; import { burstDefaultModel, burstProposalRefusal, createBurstHost } from "./host/burst-host.ts"; import { expandBurstTurnText } from "./burst/command.ts"; import { createBurstProposalRoutes, createBurstRoutes } from "./routes/burst.ts";+import { createInternalChiefTeamRoutes } from "./routes/internal-chief-team.ts"; import { createInternalModelRoutes } from "./routes/internal-models.ts"; import { createOwnThreads } from "./host/own-threads.ts"; import { burstDefaultModel, burstProposalRefusal, createBurstHost } from "./host/burst-host.ts"; import { expandBurstTurnText } from "./burst/command.ts"; import { createBurstProposalRoutes, createBurstRoutes } from "./routes/burst.ts"; import { createCheckBacks } from "./host/check-backs.ts"; import { writeCheckBackLine } from "./host/check-back-host.ts"; import { checkBackRefusal, createCheckBackRoutes, createCheckBackToolRoutes } from "./routes/check-backs.ts";import { createRoomHoldRoutes } from "./routes/room-holds.ts";import { checkedGroupResponder, createGroupRoutes } from "./routes/groups.ts";import { createChannelRoutes } from "./routes/channels.ts";@@ -8896,7 +8896,7 @@ calendarCalls = new CalendarCallManager({botExists: (botId) => Boolean(store.bot(botId)),onDue: deliverCalendarCall,});-const botWaits = new WaitManager(createWaitHost({ store, directChat: directChatOf, threadBusy, wrote: markTaskContextExternallyUpdated, notify, enqueue: (input) => routines!.enqueueWebhook(input), cloudHome: Boolean(CLOUD_HOME) })); store.onChange((change) => { if (change.type === "bot" && store.bot(change.botId)?.busy) botWaits.noteBotBusy(change.botId); });+const checkBacks = createCheckBacks({ dataDir: DATA_DIR, alive: (botId, threadId) => directChatOf(botId, threadId), busy: (botId, threadId) => threadBusy(botId, threadId), line: (record, line, messageId) => writeCheckBackLine(store, record, line, messageId, threadLanguage(record.threadId)), start: async (record, prompt) => { await startTurn(record.botId, prompt, { threadId: record.threadId, cardContinuation: true, origin: record.origin }); }, paused: (error) => [BOT_HELD_CODE, BOT_PAUSED_CODE].includes(String((error as { code?: unknown } | null)?.code)) }); const botWaits = new WaitManager(createWaitHost({ store, directChat: directChatOf, threadBusy, wrote: markTaskContextExternallyUpdated, notify, enqueue: (input) => routines!.enqueueWebhook(input), cloudHome: Boolean(CLOUD_HOME) })); store.onChange((change) => { if (change.type === "bot" && store.bot(change.botId)?.busy) botWaits.noteBotBusy(change.botId); });const recoveryOwners = routines.routineRequestReceiptOwners();if (recoveryOwners.length > 0) {const recoveryThreads = [...new Set(recoveryOwners.map((owner) => owner.threadId))];@@ -11458,7 +11458,7 @@ function claimPhoneSecretBotDeletion(botId: string): (() => void) | null {}const secretCards = createSecretCards({ store, cfg, botLogins, vaultStore: logins, vaultReader: vaultReaders.turn, phoneSecrets, phoneSecretSubmissions, connectorThread, answerCardNode, followCard: (threadId, from, to) => coordinator.followCard(threadId, from, to), threadLanguage, email: { connect: (request, reading) => emailService.connect(request, reading), refusal: () => emailService.status().reason, connected: (address) => { const one = emailService.store.get(address); return Boolean(one && !one.problem); }, sendingProblem: (address) => emailService.sendingProblem(address), account: (address) => emailService.status().accounts.find((one) => one.address.toLowerCase() === address.toLowerCase()), checkOutgoing: (address, fields) => emailService.checkOutgoing(address, fields), profileAddress: () => cfg.profile?.email?.trim() || undefined }, dataDir: DATA_DIR, providerKeysRefused: Boolean(hostedModels), layerFolder: (botId, threadId) => workspaceDir(teamHost.layer(botId, threadId)), turnVm: (threadId) => localVmThreadTargets.get(threadId)?.key });-ROUTES.push(createBurstRoutes({ owner: (id) => burst.owner(id), sees: (auth, threadId) => visibleTo(viewerFor(auth)).thread(threadId), refusal: (auth, threadId, id) => cardAnswerRefusal(auth, threadId, id, "allow"), view: (id) => burst.view(id), run: (id) => burst.run(id), cancel: (id) => burst.cancel(id), retry: (id) => burst.retryFailed(id), edit: (id, plan) => burst.edit(id, plan) })); ROUTES.push(createSecretCardRoutes({ cards: secretCards, phoneSecretSubmissions, threadVisible: (auth, threadId) => visibleTo(viewerFor(auth)).thread(threadId), answerContext: (auth, botId, threadId) => ({ personalCloud: Boolean(CLOUD_PERSONAL), shared: sharedMembership(), owner: (CLOUD_TEAM ? teamOwners.routing.askedPerson(botId, threadId) : null) ?? threadStarters.get(threadId) ?? null, person: auth.kind === "session" ? personKey(auth.session) : null }) }));+ROUTES.push(createCheckBackRoutes({ checkBacks, sees: (auth, threadId) => visibleTo(viewerFor(auth)).thread(threadId), refusal: (auth, threadId, messageId) => cardAnswerRefusal(auth, threadId, messageId, "deny") })); ROUTES.push(createBurstRoutes({ owner: (id) => burst.owner(id), sees: (auth, threadId) => visibleTo(viewerFor(auth)).thread(threadId), refusal: (auth, threadId, id) => cardAnswerRefusal(auth, threadId, id, "allow"), view: (id) => burst.view(id), run: (id) => burst.run(id), cancel: (id) => burst.cancel(id), retry: (id) => burst.retryFailed(id), edit: (id, plan) => burst.edit(id, plan) })); ROUTES.push(createSecretCardRoutes({ cards: secretCards, phoneSecretSubmissions, threadVisible: (auth, threadId) => visibleTo(viewerFor(auth)).thread(threadId), answerContext: (auth, botId, threadId) => ({ personalCloud: Boolean(CLOUD_PERSONAL), shared: sharedMembership(), owner: (CLOUD_TEAM ? teamOwners.routing.askedPerson(botId, threadId) : null) ?? threadStarters.get(threadId) ?? null, person: auth.kind === "session" ? personKey(auth.session) : null }) }));// By design OpenMausBot never receives a website password: the person signs in where the bot works, and the bot uses that session.@@ -11998,15 +11998,15 @@ const workspaceBackupAccess = {return work();}, {idle: () => !providerFleetReloading && !providerAuthSessions.active && !browserEngineInstall &&- !routines?.isTicking && !calendarCalls?.isTicking && !botWaits.isTicking &&+ !routines?.isTicking && !calendarCalls?.isTicking && !botWaits.isTicking && !checkBacks.isTicking &&!localVmImageBusy && !localVmProvisionBusy && !localVmModeChangeBusy &&!localVmLifecycleBusy.size && !boatLifecycleBusyBots.size && !computerPreviews.size && !orphanBoatLifecycleBusyIds.size &&!computerProviderConfigTransitions.size &&teamComputers.list().every(computer => !teamComputerInUse(computer)) &&store.bots.every((bot) => !botHasActiveTurn(bot.id) && !routines?.activeRunForBot(bot.id) && !sharedVm.snapshot(bot.id).held) &&store.groups.every((group) => !groupIsWorking(group)),- pause: () => { routines?.stop(); calendarCalls?.stop(); botWaits.stop(); watchdog.stop(); memoryUpkeep.pause(); },- resume: () => { if (!moveFreeze.frozen()) { routines?.start(); calendarCalls?.start(); botWaits.start(); } watchdog.start(); memoryUpkeep.resume(); },+ pause: () => { routines?.stop(); calendarCalls?.stop(); botWaits.stop(); checkBacks.stop(); watchdog.stop(); memoryUpkeep.pause(); },+ resume: () => { if (!moveFreeze.frozen()) { routines?.start(); calendarCalls?.start(); botWaits.start(); checkBacks.start(); } watchdog.start(); memoryUpkeep.resume(); },flush: async () => {await Promise.all([chatApps.settleLive(), flushAllProfileHistory(), flushAllMemoryJournals(), flushUsageLedger(DATA_DIR), flushDecisionLog(DATA_DIR), flushAdminActivity(DATA_DIR)]);// Writers gated and work idle: release the WAL connection for a consistent snapshot; Store reopens it lazily.@@ -13376,7 +13376,7 @@ const handleRequest = async (req: IncomingMessage, res: ServerResponse) => {});return json(res, 201, proposed);}- if (await dispatchRoutes([createBurstProposalRoutes({ requireActive: requireActiveInternalCapability, readBody: readInternalBody, refusal: () => burstProposalRefusal({ owner: connectorThread(internalSender.id, internalCapability.threadId), outside: outsideWorkStaysHere(internalCapability.threadId), self: selfThreadRefusal({ handoff: Boolean(internalCapability.roomHandoffId), requestLine: store.activePath(internalCapability.threadId).findLast((line) => line.role === "user" && line.kind === "text") }) }), model: () => burst.model(internalSender, internalCapability.threadId), propose: (plan) => burst.propose({ ...plan, botId: internalSender.id, threadId: internalCapability.threadId }) }), createInternalChiefTeamRoutes({ bot: () => store.bot(internalCapability.botId), requireActive: requireActiveInternalCapability,+ if (await dispatchRoutes([createCheckBackToolRoutes({ checkBacks, requireActive: requireActiveInternalCapability, readBody: readInternalBody, botId: () => internalSender.id, threadId: () => internalCapability.threadId, zone: () => proactive.brief.timeZone() ?? routineTimeZone(), origin: () => { const origin = turnOrigin(internalCapability); return origin.kind === "user" ? withPerson(origin, origin.person ?? threadPersonKey(internalCapability.threadId)) : origin; }, refusal: () => { const source = connectorThread(internalSender.id, internalCapability.threadId); return checkBackRefusal({ owned: source !== null, room: Boolean(source?.group), depth: internalCapability.depth, handedOff: Boolean(internalCapability.roomHandoffId), routineRun: Boolean(activeRoutineRunForThread(internalCapability.threadId)), outsideDriven: outsideDrivenThread(internalCapability.threadId) || outsideWorkStaysHere(internalCapability.threadId), personStarted: turnOrigin(internalCapability).kind === "user", guest: cloudGuestDriven(internalCapability.threadId) }); } }), createBurstProposalRoutes({ requireActive: requireActiveInternalCapability, readBody: readInternalBody, refusal: () => burstProposalRefusal({ owner: connectorThread(internalSender.id, internalCapability.threadId), outside: outsideWorkStaysHere(internalCapability.threadId), self: selfThreadRefusal({ handoff: Boolean(internalCapability.roomHandoffId), requestLine: store.activePath(internalCapability.threadId).findLast((line) => line.role === "user" && line.kind === "text") }) }), model: () => burst.model(internalSender, internalCapability.threadId), propose: (plan) => burst.propose({ ...plan, botId: internalSender.id, threadId: internalCapability.threadId }) }), createInternalChiefTeamRoutes({ bot: () => store.bot(internalCapability.botId), requireActive: requireActiveInternalCapability,teams: teamSetupTeams, bots: () => store.bots, instances: () => registry.describe() }), createInternalModelRoutes({ requireActive: requireActiveInternalCapability, menu: (search) => ownThreads.menu(internalCapability.botId, internalCapability.threadId, search) })], { req, res, url, path, method, auth, json, readBody })) return;if (method === "POST" && path === "/api/internal/team-setup-requests") {const parsed = z.object({ fromBotId: z.string().optional(), fromThreadId: z.string().optional(), plan: z.unknown() }).strict().safeParse(await readInternalBody());@@ -15244,7 +15244,7 @@ restoreChannelMessages();if (CLOUD_HOME) registerCloudPower(cloudPower = createCloudPower({ dataDir: DATA_DIR, broadcast: (payload) => broadcast(payload), log: (line) => console.warn(line), bootedFromSleep: startedFromSleep, onBootWakeRequest: (at) => cloudHealth?.speed.wakeRequest(at), onWoke: createWokeNotifier({ adminOrigin: CLOUD_HOME.adminOrigin, machineId: CLOUD_HOME.machineId, secret: CLOUD_HOME.bootstrapSecret, 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; },+ liveCall: () => liveCalls.current() !== null, computer: () => cloudComputerPower.awake() || boatLifecycleBusyBots.size > 0, nextDueAt: () => { const due = [routines?.nextDueAt() ?? null, proactive.brief.nextWakeAt(), botWaits.nextWakeAt(), checkBacks.nextDueAt()].filter((at): at is number => at !== null); return due.length ? Math.min(...due) : null; },maintenance: () => workspaceMaintenance.active || providerFleetReloading || providerAuthSessions.active || browserEngineInstall !== null } }));botLink.start(); let pausedSent = starterAwake.paused().join(); store.onChange((change) => { if (change.type === "bot.deleted") botHolds.forget("bot", change.botId); if (change.type !== "bot" && change.type !== "bot.deleted") return; const paused = starterAwake.paused().join(); if (paused !== pausedSent) { pausedSent = paused; broadcast({ kind: "config", ...configStatus() }); } });@@ -15263,7 +15263,7 @@ server.listen(PORT, listenHost(server), async () => {if (companyShutdown) return;}// Only once every registry is initialized and the endpoint listens: earlier dispatch can hit uninitialized bindings.- moveFreeze.hold(() => { routines!.start(); botWaits.start(); proactive.start(); }, () => { routines!.stop(); botWaits.stop(); proactive.stop(); });+ moveFreeze.hold(() => { routines!.start(); botWaits.start(); checkBacks.start(); proactive.start(); }, () => { routines!.stop(); botWaits.stop(); checkBacks.stop(); proactive.stop(); });limitClock.start(); burst.recover();moveFreeze.hold(() => memoryUpkeep.start(), () => memoryUpkeep.stop());});@@ -15329,7 +15329,7 @@ const gracefulShutdown = createGracefulShutdown({vps.closeAllVpsDesktopTunnels();watchdog.stop();routines?.close(); void appTriggers.stop();- calendarCalls?.stop(); botWaits.stop();+ calendarCalls?.stop(); botWaits.stop(); checkBacks.stop();memoryUpkeep.stop();cacheKeepWarm.dispose(); warmSummaries.dispose();skillReview.stop();diff --git a/server/routes/check-backs.test.ts b/server/routes/check-backs.test.tsnew file mode 100644index 0000000000..fabc40b31c--- /dev/null+++ b/server/routes/check-backs.test.ts@@ -0,0 +1,117 @@+import { mkdtempSync, rmSync } from "node:fs";+import { tmpdir } from "node:os";+import { join } from "node:path";+import { afterEach, describe, expect, it } from "vitest";++import { createCheckBacks } from "../host/check-backs.ts";+import type { RequestAuth } from "../request-auth.ts";+import { CHECK_BACK_MESSAGES, checkBackRefusal, createCheckBackRoutes, createCheckBackToolRoutes, type CheckBackTurnFacts } from "./check-backs.ts";+import { PASS, type RouteContext } from "./table.ts";++const T0 = Date.UTC(2026, 10, 19, 14, 0);+const auth = { kind: "loopback", scopes: ["admin", "client"] } as RequestAuth;+const dirs: string[] = [];+afterEach(() => { for (const dir of dirs.splice(0)) rmSync(dir, { recursive: true, force: true }); });++function ctx(path: string, method: string, body?: unknown) {+ const sent: { status?: number; body?: Record<string, unknown> } = {};+ const context = { req: {} as RouteContext["req"], res: {} as RouteContext["res"], url: new URL(`http://x${path}`), path, method, auth,+ json: ((_res: unknown, status: number, value: Record<string, unknown>) => { sent.status = status; sent.body = value; }) as unknown as RouteContext["json"],+ readBody: (async () => body) as unknown as RouteContext["readBody"] } as RouteContext;+ return { context, sent };+}++function setup(refusal: string | null = null) {+ const dir = mkdtempSync(join(tmpdir(), "omb-check-back-routes-"));+ dirs.push(dir);+ const checkBacks = createCheckBacks({ dataDir: dir, now: () => T0, alive: () => true, busy: () => false, line: (record) => `line-${record.id}`, start: async () => {}, log: () => {} });+ let body: unknown;+ const tool = createCheckBackToolRoutes({+ checkBacks, requireActive: () => {}, botId: () => "scout", threadId: () => "t1", refusal: () => refusal, zone: () => "America/New_York",+ origin: () => ({ kind: "user", request: "watch CI" }), readBody: async () => body, now: () => T0,+ });+ const call = async (args: unknown) => {+ body = args;+ const { context, sent } = ctx("/api/internal/check-backs", "POST", args);+ await tool(context);+ return sent;+ };+ return { checkBacks, call };+}++const person: CheckBackTurnFacts = { owned: true, room: false, depth: 0, handedOff: false, routineRun: false, outsideDriven: false, personStarted: true, guest: false };++describe("checkBackRefusal", () => {+ it("lets the person's own turn in a one-to-one chat set one", () => {+ expect(checkBackRefusal(person)).toBeNull();+ });++ it("refuses rooms, guests, handed-on work, routines and outside events with a line for the bot", () => {+ expect(checkBackRefusal({ ...person, owned: false })).toBe(CHECK_BACK_MESSAGES.notYours);+ expect(checkBackRefusal({ ...person, room: true })).toBe(CHECK_BACK_MESSAGES.room);+ expect(checkBackRefusal({ ...person, guest: true })).toBe(CHECK_BACK_MESSAGES.guest);+ for (const facts of [{ depth: 1 }, { handedOff: true }, { routineRun: true }, { outsideDriven: true }, { personStarted: false }]) {+ expect(checkBackRefusal({ ...person, ...facts })).toBe(CHECK_BACK_MESSAGES.notPerson);+ }+ });+});++describe("check_back tool route", () => {+ it("passes other paths", async () => {+ const { checkBacks } = setup();+ const tool = createCheckBackToolRoutes({ checkBacks, requireActive: () => {}, botId: () => "b", threadId: () => "t", refusal: () => null, zone: () => "UTC", origin: () => ({ kind: "outside" }), readBody: async () => ({}) });+ expect(await tool(ctx("/api/internal/waits", "POST").context)).toBe(PASS);+ });++ it("sets one in the person's zone, applies at once with nobody asked, lists and cancels it", async () => {+ const { checkBacks, call } = setup();+ const made = await call({ when: "Friday 9am", note: "chase the client", if: "they haven't replied" });+ expect(made.status).toBe(201);+ expect(String(made.body?.text)).toContain("Fri 20 Nov 09:00 (America/New_York; 2026-11-20T14:00:00.000Z)");+ const [record] = checkBacks.list("scout", "t1");+ expect(record).toMatchObject({ note: "chase the client", condition: "they haven't replied", dueAt: Date.UTC(2026, 10, 20, 14, 0), origin: { kind: "user", request: "watch CI" } });+ const listed = await call({});+ expect(String(listed.body?.text)).toContain(record!.id);+ const cancelled = await call({ cancel: record!.id });+ expect(cancelled.status).toBe(200);+ expect(checkBacks.list("scout", "t1")).toEqual([]);+ expect((await call({ cancel: "nope" })).status).toBe(404);+ });++ it("cancels them all", async () => {+ const { checkBacks, call } = setup();+ await call({ when: "in 10 minutes", note: "one" });+ await call({ when: "in 20 minutes", note: "two" });+ expect((await call({ cancel: "all" })).body?.text).toContain("Cancelled 2 check-backs");+ expect(checkBacks.list("scout", "t1")).toEqual([]);+ });++ it("refuses with a short line to the bot, never an ask", async () => {+ const { call } = setup();+ expect(await call({ when: "in 30 seconds", note: "x" })).toMatchObject({ status: 409, body: { error: expect.stringContaining("less than a minute") } });+ expect(await call({ when: "in 100 days", note: "x" })).toMatchObject({ status: 409, body: { error: expect.stringContaining("90 days") } });+ expect(await call({ when: "someday", note: "x" })).toMatchObject({ status: 400, body: { error: expect.stringContaining("when:") } });+ expect(await call({ when: "in 1 hour" })).toMatchObject({ status: 400 });+ expect(await call({ when: "in 1 hour", note: "x", extra: 1 })).toMatchObject({ status: 400 });+ const refused = setup(CHECK_BACK_MESSAGES.room);+ expect(await refused.call({ when: "in 1 hour", note: "x" })).toMatchObject({ status: 403, body: { error: CHECK_BACK_MESSAGES.room } });+ });+});++describe("the line's Cancel", () => {+ it("cancels for someone who may act in that chat, and 404s for anyone who can't see it", async () => {+ const { checkBacks, call } = setup();+ await call({ when: "in 1 hour", note: "x" });+ const [record] = checkBacks.list("scout", "t1");+ const hidden = createCheckBackRoutes({ checkBacks, sees: () => false, refusal: () => null });+ const blocked = createCheckBackRoutes({ checkBacks, sees: () => true, refusal: () => "Only the person who started this conversation or sent this request, or a workspace admin, can answer this card." });+ const allowed = createCheckBackRoutes({ checkBacks, sees: () => true, refusal: () => null });+ const path = `/api/check-backs/${record!.id}/cancel`;+ const a = ctx(path, "POST"); await hidden(a.context); expect(a.sent.status).toBe(404);+ const b = ctx(path, "POST"); await blocked(b.context); expect(b.sent.status).toBe(403);+ expect(checkBacks.list("scout", "t1")).toHaveLength(1);+ const c = ctx(path, "POST"); await allowed(c.context); expect(c.sent.status).toBe(200);+ expect(checkBacks.list("scout", "t1")).toEqual([]);+ const d = ctx(path, "POST"); await allowed(d.context); expect(d.sent.status).toBe(404);+ });+});diff --git a/server/routes/check-backs.ts b/server/routes/check-backs.tsnew file mode 100644index 0000000000..6d1fc8fc7e--- /dev/null+++ b/server/routes/check-backs.ts@@ -0,0 +1,113 @@+import { z } from "zod";++import type { RequestAuth } from "../request-auth.ts";+import { parseWhen, validZone, wallClockLabel, WHEN_HELP } from "../host/check-back-time.ts";+import { checkBackList, CONDITION_MAX, NOTE_MAX, type CheckBacks } from "../host/check-backs.ts";+import type { WorkOrigin } from "../peer-provenance.ts";+import { refusalText } from "../user-errors.ts";+import { PASS, type RouteHandler } from "./table.ts";++export const CHECK_BACK_MESSAGES = {+ notYours: "This conversation is not yours.",+ room: "A check-back is set in a one-to-one chat, not in a room. Tell the person you can do it from your own chat with them.",+ notPerson: "A check-back needs the person's own request behind this turn; work handed on by a bot, a routine or an outside event can't set one. Finish in this turn.",+ guest: "Only the owner of this Cloud can have a bot check back later. Finish in this turn.",+} as const;++const bodySchema = z.object({+ when: z.string().max(200).optional(),+ note: z.string().max(NOTE_MAX * 2).optional(),+ if: z.string().max(CONDITION_MAX * 2).optional(),+ cancel: z.string().max(200).optional(),+}).strict();++export interface CheckBackTurnFacts {+ owned: boolean; room: boolean; depth: number; handedOff: boolean; routineRun: boolean; outsideDriven: boolean; personStarted: boolean; guest: boolean;+}++/** Who may set or cancel a check-back: a turn the person's own request started in their one-to-one chat, or a check-back's+ * own turn, which keeps that request's origin. */+export function checkBackRefusal(turn: CheckBackTurnFacts): string | null {+ if (!turn.owned) return CHECK_BACK_MESSAGES.notYours;+ if (turn.room) return CHECK_BACK_MESSAGES.room;+ if (turn.guest) return CHECK_BACK_MESSAGES.guest;+ if (turn.depth > 0 || turn.handedOff || turn.routineRun || turn.outsideDriven || !turn.personStarted) return CHECK_BACK_MESSAGES.notPerson;+ return null;+}++export interface CheckBackToolDeps {+ checkBacks: Pick<CheckBacks, "create" | "list" | "cancel">;+ requireActive(): void;+ botId(): string;+ threadId(): string;+ refusal(): string | null;+ /** The person's zone, for a day and a time without an offset. */+ zone(): string;+ /** The origin of the request this turn works for, from the harness's records. */+ origin(): WorkOrigin;+ readBody(): Promise<unknown>;+ now?: () => number;+}++/** The check_back tool: set one (when + note), cancel one (cancel: id or "all"), or list them (neither). */+export function createCheckBackToolRoutes(deps: CheckBackToolDeps): RouteHandler {+ const now = deps.now ?? Date.now;+ return async ({ res, path, method, json }) => {+ if (path !== "/api/internal/check-backs") return PASS;+ if (method !== "POST") return json(res, 405, { error: "method not allowed" });+ deps.requireActive();+ const parsed = bodySchema.safeParse(await deps.readBody());+ if (!parsed.success) return json(res, 400, { error: `check_back takes when and note (and optionally if), or cancel. ${WHEN_HELP}` });+ const body = parsed.data, botId = deps.botId(), threadId = deps.threadId();+ const pending = () => deps.checkBacks.list(botId, threadId);+ const listed = () => {+ const here = pending();+ return here.length ? `Check-backs waiting in this conversation:\n${checkBackList(here)}` : "No check-backs are waiting in this conversation.";+ };+ if (body.when === undefined && body.note === undefined && body.cancel === undefined) return json(res, 200, { text: listed() });+ const refused = deps.refusal();+ if (refused) return json(res, 403, { error: refused });+ if (body.cancel !== undefined) {+ const ids = body.cancel.trim() === "all" ? pending().map((record) => record.id) : [body.cancel.trim()];+ const mine = new Set(pending().map((record) => record.id));+ const stopped = ids.filter((one) => mine.has(one) && deps.checkBacks.cancel(one));+ if (!stopped.length) return json(res, 404, { error: `No check-back here has that id. ${listed()}` });+ return json(res, 200, { text: `Cancelled ${stopped.length === 1 ? "it" : `${stopped.length} check-backs`}. ${listed()}` });+ }+ const note = body.note?.replace(/\s+/g, " ").trim() ?? "";+ if (!note || !body.when?.trim()) return json(res, 400, { error: `check_back needs both when and note. ${WHEN_HELP}` });+ const zone = validZone(deps.zone()) ? deps.zone() : "UTC";+ const at = now();+ const when = parseWhen(body.when, at, zone);+ if (!when.ok) return json(res, 400, { error: when.error });+ const condition = body.if?.replace(/\s+/g, " ").trim();+ const created = deps.checkBacks.create({ botId, threadId, note, ...(condition ? { condition } : {}), dueAt: when.at, zone, origin: deps.origin() });+ if (!created.ok) return json(res, 409, { error: created.error });+ const label = wallClockLabel(when.at, zone);+ return json(res, 201, {+ text: `You will be woken here at ${label} (${zone}; ${new Date(when.at).toISOString()}), check-back id ${created.record.id}. A quiet line in this chat shows it, with Cancel. Tell the person in one short sentence and end your turn; do not wait or poll. ${zone === deps.zone() ? "" : "The person's zone could not be read, so UTC was used. "}`.trim(),+ });+ };+}++export interface CheckBackRoutesDeps {+ checkBacks: Pick<CheckBacks, "get" | "cancel">;+ sees(auth: RequestAuth, threadId: string): boolean;+ /** Why this person may not act on the line; the same rule as answering a card in that chat. */+ refusal(auth: RequestAuth, threadId: string, messageId: string): string | null;+}++/** The line's Cancel. Only a person's press reaches it: no bot tool calls this route. */+export function createCheckBackRoutes(deps: CheckBackRoutesDeps): RouteHandler {+ return async ({ res, path, method, auth, json }) => {+ const match = /^\/api\/check-backs\/([\w-]+)\/cancel$/.exec(path);+ if (!match) return PASS;+ if (method !== "POST") return json(res, 405, { error: "method not allowed" });+ const record = deps.checkBacks.get(match[1]!);+ if (!record || !deps.sees(auth, record.threadId)) return json(res, 404, { error: "That check-back already ran or was cancelled." });+ const refused = deps.refusal(auth, record.threadId, record.lineMessageId ?? record.id);+ if (refused) return json(res, 403, refusalText(refused));+ if (!deps.checkBacks.cancel(record.id)) return json(res, 409, { error: "That check-back already started." });+ return json(res, 200, { ok: true });+ };+}diff --git a/server/system-prompt.test.ts b/server/system-prompt.test.tsindex 820279fc78..f6709b9d51 100644--- a/server/system-prompt.test.ts+++ b/server/system-prompt.test.ts@@ -494,7 +494,7 @@ describe("longCommandsPrompt", () => {const text = longCommandsPrompt(kind);expect(text).toContain("pass `timeout` in milliseconds, up to 86400000, which is 1440 minutes, unless a lower limit is set here");expect(text).toContain("Never wait inside a command for CI, a deploy or any other job to finish (no sleep loops or polls): check once");- expect(text).toContain("tell the person what you made, with links. Only on a turn the person started in their own chat, set wait_until or a one-time trigger to check back and end your turn");+ expect(text).toContain("tell the person what you made, with links. Only on a turn the person started in their own chat, set check_back (a time) or wait_until (a condition) and end your turn");expect(text).toContain("When the person writes while you work, answer them first.");expect(text).not.toContain("vm_exec");}diff --git a/server/system-prompt.ts b/server/system-prompt.tsindex 8faa74b168..0aa49f2791 100644--- a/server/system-prompt.ts+++ b/server/system-prompt.ts@@ -285,7 +285,7 @@ export const BASH_MAX_TIMEOUT_MS = 24 * 60 * 60_000;/** The default cap; a person's own BASH_MAX_TIMEOUT_MS can be lower, so the guidance names this as the most it allows. */export const BASH_MAX_TIMEOUT_TEXT = `${BASH_MAX_TIMEOUT_MS}, which is ${BASH_MAX_TIMEOUT_MS / 60_000} minutes, unless a lower limit is set here`;const LONG_COMMANDS_TEXT =- ` Long-running shell commands: Bash stops a call after 2 minutes by default and its output is lost. For anything that may run over a minute (whisper, ffmpeg or ffprobe on long media, renders, big builds or transfers) pass \`timeout\` in milliseconds, up to ${BASH_MAX_TIMEOUT_TEXT}, and stay in the foreground until it exits; split work that cannot finish within that. A detached job may die when the call ends: trust only the command's own fresh exit code and output, never a launch exit 0 or an old output file. Never scan the whole disk (\`find /\`): use \`mdfind -name\` on macOS or one folder with a depth limit. Never rerun a timed-out command unchanged. Never wait inside a command for CI, a deploy or any other job to finish (no sleep loops or polls): check once; if still running, tell the person what you made, with links. Only on a turn the person started in their own chat, set wait_until or a one-time trigger to check back and end your turn; work a bot handed you for the person's own request may set one wait_until (not a trigger), cannot cancel it, and ends its turn (the wait's message lands in that work's chat); a routine or an outside event cannot set a wait, so finish in this turn. When the person writes while you work, answer them first.`;+ ` Long-running shell commands: Bash stops a call after 2 minutes by default and its output is lost. For anything that may run over a minute (whisper, ffmpeg or ffprobe on long media, renders, big builds or transfers) pass \`timeout\` in milliseconds, up to ${BASH_MAX_TIMEOUT_TEXT}, and stay in the foreground until it exits; split work that cannot finish within that. A detached job may die when the call ends: trust only the command's own fresh exit code and output, never a launch exit 0 or an old output file. Never scan the whole disk (\`find /\`): use \`mdfind -name\` on macOS or one folder with a depth limit. Never rerun a timed-out command unchanged. Never wait inside a command for CI, a deploy or any other job to finish (no sleep loops or polls): check once; if still running, tell the person what you made, with links. Only on a turn the person started in their own chat, set check_back (a time) or wait_until (a condition) and end your turn; work a bot handed you for the person's own request may set one wait_until (not a trigger), cannot cancel it, and ends its turn (the wait's message lands in that work's chat); a routine or an outside event cannot set a wait, so finish in this turn. When the person writes while you work, answer them first.`;const VM_LONG_COMMANDS_TEXT =" In your Local VM, vm_exec takes `timeout_seconds` instead (default 60, at most 300). The VM keeps running between calls, so a job longer than that may start detached inside it (`nohup <command> > /tmp/<job>.log 2>&1 &`); check its log with later vm_exec calls.";export function longCommandsPrompt(computer: ComputerPromptKind | null): string {@@ -301,7 +301,7 @@ const AUTOMATION_COMPLETION_PROMPT =" Before reporting a task finished, check its automations with trigger_info: pause a temporary monitor whose goal is met (trigger action=pause), then read it back to verify enabled=false and nextRunAt=null. Keep standing automations; delete only at the person's explicit request.";export const TRIGGER_PROMPT =- " When the person describes something that should happen on its own (on a schedule, on an event in one of their apps, or when another app calls a link), set it up with trigger action=create in this turn. Do not ask for confirmation or announce it first: it applies at once with a card showing Edit, Pause and Undo. Ask one short question only for something required that cannot be inferred (which of two Gmail accounts, say). App events: trigger_info action=events, then when=app_event, never a polling schedule; who or what it concerns goes in filter (Gmail filters at the source), judgement in the instructions. App not connected: ask them to connect it (a Connect card if you have connected-app tools), then create it. Instructions are complete steps for a future run that will not see this chat, in the person's plain words (\"draft a reply\"): never \"event data\", \"payload\", \"webhook\" or \"trigger\"; they read them, and each run is told where its event is. A one-off request for now is not a trigger. Then confirm plainly what you set up and assumed: when it runs, with the time zone as people say it (\"weekdays at 9:00 AM India time\", never a zone id such as Asia/Kolkata), where its results will appear, what each run covers, and when the first run is. Call them \"automations\", never triggers or webhooks. trigger_info reviews; trigger changes, pauses or tests; delete_trigger deletes. run_on omitted or maus uses the bot's current model and configured computer (its VPS too); box is its cloud computer, only if the person wants that. Calendar rules (last day of the month, second Monday) are a five-field cron with an explicit IANA timezone, never daily AI date checks or an approximate weekly schedule; interval is for every-N-minutes; clarify ambiguous or unsupported requests. \"When my limit resets\" is when=limit_reset (default: your own engine); told your usage limit is nearly used up and the task may not finish, create that continuation yourself, with instructions to pick up where you stopped, and tell the person in one sentence. To tell the person when something a plain check can see happens (a page changes, a file appears, a program starts or stops, another bot finishes), use wait_until instead of staying busy or making a short-interval routine, and give follow_up only when they asked for something to be done at that moment." + AUTOMATION_COMPLETION_PROMPT;+ " When the person describes something that should happen on its own (on a schedule, on an event in one of their apps, or when another app calls a link), set it up with trigger action=create in this turn. Do not ask for confirmation or announce it first: it applies at once with a card showing Edit, Pause and Undo. Ask one short question only for something required that cannot be inferred (which of two Gmail accounts, say). App events: trigger_info action=events, then when=app_event, never a polling schedule; who or what it concerns goes in filter (Gmail filters at the source), judgement in the instructions. App not connected: ask them to connect it (a Connect card if you have connected-app tools), then create it. Instructions are complete steps for a future run that will not see this chat, in the person's plain words (\"draft a reply\"): never \"event data\", \"payload\", \"webhook\" or \"trigger\"; they read them, and each run is told where its event is. A one-off request for now is not a trigger; to look again later in this chat use check_back. Then confirm plainly what you set up and assumed: when it runs, with the time zone as people say it (\"weekdays at 9:00 AM India time\", never a zone id such as Asia/Kolkata), where its results will appear, what each run covers, and when the first run is. Call them \"automations\", never triggers or webhooks. trigger_info reviews; trigger changes, pauses or tests; delete_trigger deletes. run_on omitted or maus uses the bot's current model and configured computer (its VPS too); box is its cloud computer, only if the person wants that. Calendar rules (last day of the month, second Monday) are a five-field cron with an explicit IANA timezone, never daily AI date checks or an approximate weekly schedule; interval is for every-N-minutes; clarify ambiguous or unsupported requests. \"When my limit resets\" is when=limit_reset (default: your own engine); told your usage limit is nearly used up and the task may not finish, create that continuation yourself, with instructions to pick up where you stopped, and tell the person in one sentence. To tell the person when something a plain check can see happens (a page changes, a file appears, a program starts or stops, another bot finishes), use wait_until instead of staying busy or making a short-interval routine, and give follow_up only when they asked for something to be done at that moment." + AUTOMATION_COMPLETION_PROMPT;export const AUTOMATION_REPLY_PROMPT =" Only your final reply leaves this run: it is posted in your chat with the person under this automation's name, and your steps stay here. Write it for them, in plain words. If nothing needs their attention this time, reply with just NOTHING NEW and nothing is posted. If you need something only they can give, such as a decision or a missing detail, end with a line that starts with NEEDS INPUT: and the question; they answer in that chat. Ask in words, not with show_widget: they do not see this conversation.";export const READ_ONLY_ROUTINE_EXECUTION_PROMPT = " Execute this automation now within its read-and-draft limits.";diff --git a/shared/check-back.ts b/shared/check-back.tsnew file mode 100644index 0000000000..10dea47a10--- /dev/null+++ b/shared/check-back.ts@@ -0,0 +1 @@+export * from "../packages/phone-protocol/src/check-back.ts";diff --git a/src/components/ChatView.tsx b/src/components/ChatView.tsxindex eb45252137..7fd368ddff 100644--- a/src/components/ChatView.tsx+++ b/src/components/ChatView.tsx@@ -63,7 +63,7 @@ import { ChatMarkdown } from "./ChatMarkdown";import { LiveToolsContext, useLiveToolIds } from "@/hooks/use-live-tool-ids";import { VoiceNoteBubble, type VoiceNoteAttachment } from "./VoiceNoteBubble";import { RawMarkdownView, RawToggleAction } from "./RawMarkdownToggle";-import { ThreadChip } from "./ThreadChip";+import { ThreadChip } from "./ThreadChip"; import { CheckBackLine } from "./CheckBackLine";import { HandoffChip } from "./HandoffReply"; import { TeammateChip } from "./TeammateChip"; import { useTeammates } from "@/state/team-people"; import type { MentionPeer } from "@/lib/mentions";import { NewConversationInstead } from "./NewConversationInstead";import { VerifyCard } from "./VerifyCard";@@ -599,7 +599,7 @@ const ActivityChip = memo(function ActivityChip({ message, place = "auto" }: { mconst { bots, dispatch, threadId } = useChatRows(), liveTools = use(LiveToolsContext);const tool = message.tool;if (!tool) return null;- if (message.threadRef) return <ThreadChip message={message} threadId={threadId} />; if (message.relay) return <TeammateChip message={message} />;+ if (message.threadRef) return <ThreadChip message={message} threadId={threadId} />; if (message.relay) return <TeammateChip message={message} />; if (message.checkBack) return <CheckBackLine line={message.checkBack} />;const comm = message.comm;if (comm) return <RoomHandoffChip message={message} comm={comm} bots={bots} dispatch={dispatch} threadId={threadId} />;return <ToolActivity tool={tool} live={liveTools.has(message.id)} place={toolPlace(tool.name, place)} source={{ threadId, messageId: message.id }} />;@@ -729,7 +729,7 @@ const MessagesList = memo(function MessagesList({/>);}- if (!showToolCalls && !m.comm && !m.threadRef && !m.relay && !m.dataResult) return null;+ if (!showToolCalls && !m.comm && !m.threadRef && !m.relay && !m.checkBack && !m.dataResult) return null;return <ActivityChip message={m} place={place} />;}case "digest":diff --git a/src/components/CheckBackLine.dom.test.ts b/src/components/CheckBackLine.dom.test.tsnew file mode 100644index 0000000000..c04b99bf6e--- /dev/null+++ b/src/components/CheckBackLine.dom.test.ts@@ -0,0 +1,69 @@+// @vitest-environment happy-dom+import { act, createElement } from "react";+import { createRoot } from "react-dom/client";+import { afterEach, beforeEach, expect, it, vi } from "vitest";+import { setLocale } from "@/lib/i18n";+import { isToolStep } from "@/lib/activity-runs";+import type { CheckBackLine as Line } from "../../shared/check-back";++const api = vi.fn(async (..._args: unknown[]) => ({ ok: true }));+vi.mock("@/state/store", () => ({ api: (...args: unknown[]) => api(...args) }));+const { CheckBackLine, checkBackWhen } = await import("./CheckBackLine");++(globalThis as { IS_REACT_ACT_ENVIRONMENT?: boolean }).IS_REACT_ACT_ENVIRONMENT = true;+beforeEach(() => { setLocale("en"); api.mockClear(); });+afterEach(() => { document.body.innerHTML = ""; });++const NOW = new Date(2026, 10, 19, 14, 0).getTime();+const line = (over: Partial<Line> = {}): Line => ({ id: "cb1", dueAt: new Date(2026, 10, 20, 9, 0).getTime(), status: "pending", note: "chase the client", ...over });++async function draw(value: Line) {+ const host = document.createElement("div");+ document.body.append(host);+ const root = createRoot(host);+ await act(async () => { root.render(createElement(CheckBackLine, { line: value })); });+ return host;+}++it("is one quiet line with the day and time and a Cancel, the note as its tooltip, and no card or question", async () => {+ vi.useFakeTimers({ now: NOW, toFake: ["Date"] });+ try {+ const host = await draw(line());+ const row = host.querySelector<HTMLElement>("[data-check-back]")!;+ expect(row.dataset.checkBack).toBe("pending");+ expect(row.textContent).toBe("Will check back Fri 9:00 AM·Cancel");+ expect(row.title).toBe("chase the client");+ expect(host.querySelectorAll("button")).toHaveLength(1);+ } finally {+ vi.useRealTimers();+ }+});++it("Cancel posts to the line's own route", async () => {+ const host = await draw(line());+ await act(async () => { host.querySelector<HTMLButtonElement>("[data-check-back-cancel]")!.click(); });+ expect(api).toHaveBeenCalledWith("/api/check-backs/cb1/cancel", { method: "POST" });+});++it("says what happened once it ran, was cancelled or could not start, with nothing to press", async () => {+ vi.useFakeTimers({ now: NOW, toFake: ["Date"] });+ try {+ expect((await draw(line({ status: "started", startedAt: new Date(2026, 10, 20, 9, 2).getTime() }))).textContent).toBe("Checked back Fri 9:02 AM");+ expect((await draw(line({ status: "cancelled" }))).textContent).toBe("Check-back cancelled");+ const failed = await draw(line({ status: "failed", why: "This bot is paused." }));+ expect(failed.textContent).toBe("Couldn't check back Fri 9:00 AM");+ expect(failed.querySelector<HTMLElement>("[data-check-back]")!.title).toContain("This bot is paused.");+ expect(document.querySelectorAll("[data-check-back-cancel]")).toHaveLength(0);+ } finally {+ vi.useRealTimers();+ }+});++it("reads today's time alone and a date beyond the week", () => {+ expect(checkBackWhen(new Date(2026, 10, 19, 16, 30).getTime(), NOW)).toBe("4:30 PM");+ expect(checkBackWhen(new Date(2026, 11, 3, 9, 0).getTime(), NOW)).toBe("Thu, Dec 3 9:00 AM");+});++it("is never folded into the turn's tool steps", () => {+ expect(isToolStep({ id: "m", role: "bot", kind: "activity", at: 0, tool: { name: "Will check back", ok: true }, checkBack: line() } as never)).toBe(false);+});diff --git a/src/components/CheckBackLine.tsx b/src/components/CheckBackLine.tsxnew file mode 100644index 0000000000..566f39fcee--- /dev/null+++ b/src/components/CheckBackLine.tsx@@ -0,0 +1,64 @@+// A check-back's quiet line: when the bot comes back, with Cancel while it waits. Nothing here asks anything.+import { Clock } from "lucide-react";+import { useState } from "react";+import type { CheckBackLine as Line } from "../../shared/check-back";+import { clockOptions, namesLocale } from "@/lib/clock-time";+import { intlLocale, t } from "@/lib/i18n";+import { cn } from "@/lib/cn";+import { api } from "@/state/store";++const WEEK = 6 * 24 * 60 * 60_000;++/** "Fri 9:00 AM" within the coming week, "Mon 1 Dec, 9:00 AM" after it; today's reads as the time alone. */+export function checkBackWhen(at: number, now = Date.now()): string {+ const date = new Date(at);+ if (Number.isNaN(date.getTime())) return "";+ const locale = intlLocale();+ const clock = new Intl.DateTimeFormat(locale, clockOptions(locale)).format(date);+ if (date.toDateString() === new Date(now).toDateString()) return clock;+ const day = new Intl.DateTimeFormat(namesLocale(), Math.abs(at - now) < WEEK ? { weekday: "short" } : { weekday: "short", day: "numeric", month: "short" }).format(date);+ return `${day} ${clock}`;+}++export function checkBackText(line: Line, now = Date.now()): string {+ switch (line.status) {+ case "pending": return t("chat.checkBack.pending", { when: checkBackWhen(line.dueAt, now) });+ case "started": return t("chat.checkBack.started", { when: checkBackWhen(line.startedAt ?? line.dueAt, now) });+ case "failed": return t("chat.checkBack.failed", { when: checkBackWhen(line.dueAt, now) });+ default: return t("chat.checkBack.cancelled");+ }+}++export function CheckBackLine({ line }: { line: Line }) {+ const [cancelling, setCancelling] = useState(false);+ const [failed, setFailed] = useState(false);+ const pending = line.status === "pending";+ async function cancel() {+ setCancelling(true);+ setFailed(false);+ try {+ await api(`/api/check-backs/${encodeURIComponent(line.id)}/cancel`, { method: "POST" });+ } catch {+ setFailed(true);+ } finally {+ setCancelling(false);+ }+ }+ return (+ <div data-check-back={line.status} title={line.why ? `${line.note}\n${line.why}` : line.note}+ className={cn("flex min-w-0 items-center gap-1.5 py-0.5 pl-0.5 text-[12px]", line.status === "failed" ? "text-danger" : "text-ink-tertiary")}>+ <Clock size={12} aria-hidden="true" className="shrink-0" />+ <span className="min-w-0 truncate">{checkBackText(line)}</span>+ {pending && (+ <>+ <span aria-hidden="true">·</span>+ <button type="button" data-check-back-cancel onClick={() => { void cancel(); }} disabled={cancelling}+ className="shrink-0 text-ink-secondary underline-offset-2 hover:underline disabled:opacity-60">+ {t("chat.checkBack.cancel")}+ </button>+ {failed && <span className="text-danger">{t("chat.checkBack.cancelFailed")}</span>}+ </>+ )}+ </div>+ );+}diff --git a/src/components/chat-bubble.ts b/src/components/chat-bubble.tsindex 131ea32fb1..3bb617ce01 100644--- a/src/components/chat-bubble.ts+++ b/src/components/chat-bubble.ts@@ -63,7 +63,7 @@ export function quietRow(message: Message, showToolCalls: boolean): boolean {if (message.reaction || message.helperFollowup) return true;if (message.kind === "digest") return !showToolCalls;if (message.kind !== "activity" || showToolCalls) return false;- if (message.dataResult || message.comm || message.threadRef || message.relay || isStatusActivity(message)) return false;+ if (message.dataResult || message.comm || message.threadRef || message.relay || message.checkBack || isStatusActivity(message)) return false;return !(message.tool && failedTurnCause(message.tool.name) !== null);}diff --git a/src/lib/activity-runs.ts b/src/lib/activity-runs.tsindex b4dbb81268..b24606b58b 100644--- a/src/lib/activity-runs.ts+++ b/src/lib/activity-runs.ts@@ -34,7 +34,7 @@ export function isStatusActivity(message: Message): boolean {export function isToolStep(message: Message): message is Message & { tool: NonNullable<Message["tool"]> } {const tool = message.tool;if (message.kind !== "activity" || !tool) return false;- if (message.comm || message.threadRef || message.relay || message.dataResult || isStatusActivity(message)) return false;+ if (message.comm || message.threadRef || message.relay || message.checkBack || message.dataResult || isStatusActivity(message)) return false;return failedTurnCause(tool.name) === null;}diff --git a/src/locales/de.json b/src/locales/de.jsonindex f906a798c5..a823d5a651 100644--- a/src/locales/de.json+++ b/src/locales/de.json@@ -273,6 +273,10 @@"server.rooms.compactedRequested": "Kontext von {bot} komprimiert ({percent} % voll): neue Sitzung mit den letzten Nachrichten des Raums","server.rooms.compactedThreshold": "Der Kontext von {bot} war zu {percent} % voll: komprimiert zu einer neuen Sitzung mit den letzten Nachrichten des Raums","server.teammates.sent": "An {bot} gesendet",+ "server.checkBack.pending": "Schaut {when} wieder nach",+ "server.checkBack.started": "Hat {when} wieder nachgeschaut",+ "server.checkBack.cancelled": "Nachschauen abgebrochen",+ "server.checkBack.failed": "Konnte {when} nicht wieder nachschauen","server.teammates.sentInRoom": "An {bot} gesendet · {room}","server.teammates.sentDirectly": "Direkt an {bot} gesendet: er ist nicht in {room}.","server.teammates.sentDirectlyHere": "Direkt an {bot} gesendet: er ist nicht in diesem Raum.",diff --git a/src/locales/en.json b/src/locales/en.jsonindex 5532c72ae2..ff349700bc 100644--- a/src/locales/en.json+++ b/src/locales/en.json@@ -428,6 +428,10 @@"server.rooms.compactedRequested": "compacted {bot}'s context ({percent}% full): fresh session with the room's recent messages","server.rooms.compactedThreshold": "{bot}'s context was {percent}% full: compacted to a fresh session with the room's recent messages","server.teammates.sent": "Sent to {bot}",+ "server.checkBack.pending": "Will check back {when}",+ "server.checkBack.started": "Checked back {when}",+ "server.checkBack.cancelled": "Check-back cancelled",+ "server.checkBack.failed": "Couldn't check back {when}","server.teammates.sentInRoom": "Sent to {bot} · {room}","server.teammates.sentDirectly": "Sent to {bot} directly: it isn't in {room}.","server.teammates.sentDirectlyHere": "Sent to {bot} directly: it isn't in this room.",@@ -2678,6 +2682,12 @@"chat.openFork": "Open fork: {title}","chat.openThreadOn": "Open #{title} on {name}","chat.sentDirectly": "Sent to {name} directly: it isn't in this room.",+ "chat.checkBack.pending": "Will check back {when}",+ "chat.checkBack.started": "Checked back {when}",+ "chat.checkBack.cancelled": "Check-back cancelled",+ "chat.checkBack.failed": "Couldn't check back {when}",+ "chat.checkBack.cancel": "Cancel",+ "chat.checkBack.cancelFailed": "Couldn't cancel. Try again.","chat.sentDirectlyNotInRoom": "Sent to {name} directly: it isn't in {room}.","chat.botScreen": "Bot's screen","chat.digestChip": "Did {tools} tool calls · {files} files changed",@@ -10015,6 +10025,7 @@"activity.tool.team.deleteTrigger": "Delete trigger","activity.tool.team.listWaits": "List waits","activity.tool.team.waitUntil": "Wait until",+ "activity.tool.team.checkBack": "Check back","serverError.request.bodyTimeout": "The request took too long. Check the connection and try again.","serverError.browser.restartingUnresponsive": "The browser stopped responding, so it is being restarted. The live view reconnects by itself.","serverError.computer.desktopOnly": "Only the OpenMausBot app on this computer can let a bot use it. Open the app here, or let the bot work in its own browser or on a cloud desktop instead.",diff --git a/src/locales/pt-br.json b/src/locales/pt-br.jsonindex ae112a0c18..71dd3340aa 100644--- a/src/locales/pt-br.json+++ b/src/locales/pt-br.json@@ -402,6 +402,10 @@"server.rooms.compactedRequested": "Compactamos o contexto de {bot} ({percent}% ocupado): nova sessão com as mensagens recentes do grupo","server.rooms.compactedThreshold": "Compactamos o contexto de {bot}, que estava {percent}% ocupado: nova sessão com as mensagens recentes do grupo","server.teammates.sent": "Enviado para {bot}",+ "server.checkBack.pending": "Vai verificar de novo: {when}",+ "server.checkBack.started": "Verificou de novo: {when}",+ "server.checkBack.cancelled": "Verificação cancelada",+ "server.checkBack.failed": "Não foi possível verificar de novo: {when}","server.teammates.sentInRoom": "Enviado para {bot} · {room}","server.teammates.sentDirectly": "Enviado diretamente para {bot}: ele não está em {room}.","server.teammates.sentDirectlyHere": "Enviado diretamente para {bot}: ele não está neste grupo.",@@ -2494,6 +2498,12 @@"chat.openFork": "Abrir bifurcação: {title}","chat.openThreadOn": "Abrir #{title} de {name}","chat.sentDirectly": "Mensagem enviada diretamente a {name}: esse bot não está neste grupo.",+ "chat.checkBack.pending": "Vai verificar de novo: {when}",+ "chat.checkBack.started": "Verificou de novo: {when}",+ "chat.checkBack.cancelled": "Verificação cancelada",+ "chat.checkBack.failed": "Não foi possível verificar de novo: {when}",+ "chat.checkBack.cancel": "Cancelar",+ "chat.checkBack.cancelFailed": "Não foi possível cancelar. Tente de novo.","chat.sentDirectlyNotInRoom": "Mensagem enviada diretamente a {name}: esse bot não está em {room}.","chat.botScreen": "Tela do bot","chat.digestChip": "Fez {tools} chamadas de ferramenta · {files} arquivos alterados",@@ -9926,6 +9936,7 @@"activity.tool.team.deleteTrigger": "Excluir automação","activity.tool.team.listWaits": "Listar esperas","activity.tool.team.waitUntil": "Esperar até",+ "activity.tool.team.checkBack": "Verificar depois","serverError.request.bodyTimeout": "O pedido demorou demais. Confira a conexão e tente novamente.","serverError.browser.restartingUnresponsive": "O navegador parou de responder e está sendo reiniciado. A visualização ao vivo se reconecta sozinha.","serverError.computer.desktopOnly": "Só o app OpenMausBot neste computador pode permitir que um bot o use. Abra o app aqui ou deixe o bot trabalhar no próprio navegador ou em um desktop na nuvem.",diff --git a/src/state/store.tsx b/src/state/store.tsxindex c63c5d6cea..b5c3288e8d 100644--- a/src/state/store.tsx+++ b/src/state/store.tsx@@ -113,7 +113,7 @@ export type SecretRequestCardData = Omit<import("../../shared/wire").SecretRequeexport type ComputerControlState = { held: boolean; helpReason: string | null; help?: import("../../shared/wire").ComputerHelpRef | null };-export interface Message extends Pick<import("../../shared/wire").WireMessage, "widget" | "app" | "fromApp" | "pointed" | "routedBy" | "quickModel" | "automation" | "publishedPage" | "template" | "sender" | "setupSuggestion" | "settingsCard" | "helperIntro" | "helperFollowup" | "setupOffer" | "savedSteps" | "setupChoices" | "setupChoicesPending" | "setupChoicesUpdating" | "setupRequest" | "relay" | "inbox" | "sentDirectly" | "doneWhen" | "bugReport" | "engineCompaction" | "stoppedBy"> {+export interface Message extends Pick<import("../../shared/wire").WireMessage, "widget" | "app" | "fromApp" | "pointed" | "routedBy" | "quickModel" | "automation" | "publishedPage" | "template" | "sender" | "setupSuggestion" | "settingsCard" | "helperIntro" | "helperFollowup" | "setupOffer" | "savedSteps" | "setupChoices" | "setupChoicesPending" | "setupChoicesUpdating" | "setupRequest" | "relay" | "inbox" | "sentDirectly" | "doneWhen" | "checkBack" | "bugReport" | "engineCompaction" | "stoppedBy"> {id: string;role: "bot" | "user";kind: "text" | "options" | "activity" | "screen" | "connector" | "secret" | "signin" | "routine.run" | "goal.run" | "burst" | "digest" | "compaction" | "call" | "widget" | "app";