Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
feat(waits): "tell me when…" with no AI running while a bot waits (#3763)
Omkar Satputef71928c15d20
diff --git a/docs/cloud-pro.md b/docs/cloud-pro.mdindex 893ccc6e16..8e50a33821 100644--- a/docs/cloud-pro.md+++ b/docs/cloud-pro.md@@ -1568,9 +1568,10 @@ its own nonces. `200`:`busy` holds fixed codes only: `turn`, `run`, `live-call`, `computer`,`maintenance`, `recent-activity`, `recent-work`, `just-woke`, `due-soon`.-`nextDueAt` is the earliest enabled routine's next run or queued run's retry:-the Admin starts a sleeping home a minute before it. `wokeAt` is the boot, or-the last resume (noticed as a jump of the clock).+`nextDueAt` is the earliest enabled routine's next run or queued run's retry,+or, while a bot waits for something (`wait_until`), 30 minutes on, so its+checks go on that often: the Admin starts a sleeping home a minute before it.+`wokeAt` is the boot, or the last resume (noticed as a jump of the clock).**`POST /api/cloud/power/sleep`**, signed over its JSON body`{"v":1,"idleMinutes":10}`. `409 {"ok":false,"busy":[…]}` while not idle;diff --git a/docs/runtime-contract.md b/docs/runtime-contract.mdindex f4e148ff93..1339ed9ec3 100644--- a/docs/runtime-contract.md+++ b/docs/runtime-contract.md@@ -122,7 +122,7 @@ Every turn that may hand work on, whatever started it, gets the same tools:- `raise_escalation(reason)` (only with `features.chiefEscalations` on): a bot parks itself on a gate only a person can lift and says so in one line; the Chief of Staff (or the person directly, `server/escalations.ts`) is told, the turn keeps running and the tool's answer says to end it and wait.- `list_bots`, `start_thread` (on yourself), `list_threads`, `close_thread`, `post_to_room`, `list_rooms`, the Chief tools and `retry_thread` are unchanged.-Outside the teamwork tools, a turn is not listed what its server would refuse it: `select_computer` only on a person's own request that may pick its computer (`OMB_COMPUTER_SELECTION`), and no `show_widget` or `show_html` in a room's turn (`OMB_ROOM`).+Outside the teamwork tools, a turn is not listed what its server would refuse it: `select_computer` only on a person's own request that may pick its computer (`OMB_COMPUTER_SELECTION`), and no `show_widget`, `show_html`, `wait_until` or `cancel_wait` in a room's turn (`OMB_ROOM`). Nor is it listed `list_waits` and `cancel_wait` while the bot has no wait in this chat that has not ended (`OMB_ACTIVE_WAITS`): both act only on the chat's own waits. They still answer a call then (a wait made this turn, a list read earlier), and the waits route scopes them to the chat.The old names (`delegate_bot`, `ask_bot`, `send_to_bot`, `check_delegation`, `wait_delegation`) stayed for one release as aliases with a deprecation line in their result and were removed in PR 5; `start_thread` opens a job on the bot itself.diff --git a/docs/superpowers/plans/2026-10-27-waits.md b/docs/superpowers/plans/2026-10-27-waits.mdnew file mode 100644index 0000000000..53e76f9130--- /dev/null+++ b/docs/superpowers/plans/2026-10-27-waits.md@@ -0,0 +1,1031 @@+# Waits Implementation Plan++> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.++**Goal:** A bot can say "tell me when…": three tools (`wait_until`, `list_waits`, `cancel_wait`) hand a condition to a server loop that checks it with plain code, and when it is met the asking chat gets one message, an unread badge, a notification and, if the bot was given `then`, a follow-up run in that chat.++**Architecture:** `server/wait-probes.ts` reads files, the process list and web pages (the page read resolves the host itself, refuses non-public answers and connects to the address it checked). `server/waits.ts` holds `WaitManager` on the `CalendarCallManager` pattern: `DATA_DIR/waits.json`, a 5 s tick, per-kind intervals, an `ending` that is saved before it is posted so a restart never posts twice. `server/wait-host.ts` is the store side (the line, the card, the notification, the follow-up run through `routines.enqueueWebhook`). `server/routes/waits.ts` is the internal route behind the tools; `server/index.ts` gains about 20 lines of wiring and no path guard.++**Tech Stack:** TypeScript on Node with type stripping (type-only imports must be `import type`), zod 4, vitest 4, React for one renderer line.++**Spec:** `docs/superpowers/specs/2026-10-27-waits-design.md`++**Worktree:** `/Users/omkar/Desktop/openmaus/OpenGrokBot-bot-waits`, branch `feat/bot-waits`. Run every command from there. Never push.++## Global Constraints++- No model call between set-up and firing. The tick, the probes and the posting run no AI.+- Everything is named "wait". Never "watch" (`watch.json` and the Watcher bot exist).+- Kinds, exactly: `url_contains`, `url_missing`, `file_exists`, `file_missing`, `file_changed`, `process_running`, `process_gone`, `bot_idle`.+- URL checks: http(s) only, at least 60 s apart, doubling on each failure up to 15 min, reset to 60 s on success; 15 s timeout; 2 MB read cap; no cookies; at most 3 redirects, each hop checked again. The host is resolved by the probe, every answer must be a public address, and the request connects to the checked address (pinned `lookup`, no second lookup).+- File, process and `bot_idle` checks every 5 s (the tick). Paths accept `~`.+- `hours`: integer 1–168, default 24. Limits: 10 active waits per bot, 50 in all.+- `DATA_DIR/waits.json`, mode `0o600`, `writeFileAtomic`, zod-validated on load, commit with rollback.+- Fired line: `<label>: done. <detail>`. Expiry line: `Stopped waiting for <label> after N hours.` (no notification, no follow-up). Follow-up prompt: `[Wait finished: <label>] <then>`.+- Bot and chat come from the internal capability, never from tool arguments. Waits are made and cancelled only in a turn a person started in their own one-to-one chat with the bot (or a Cloud guest's own turn); rooms, routine runs, peer asks, handed-off work and outside events are refused.+- File and process kinds are refused when the server is not the bot's own computer: Cloud home, hosted workspace, Cloud guest, or a turn working in a Local VM, VPS or Boat.+- No new `path === "/…"`, `path.match(`, `path.startsWith(` in `server/index.ts` (`scripts/testing/index-route-ratchet.test.ts`). The route lives in `server/routes/waits.ts`.+- Comments only for what code cannot say (`AGENTS.md`). Doc comments on new wire fields in `shared/`.+- No phone app changes in this repository. Phones get the `notify` frame and the feed as they are; drawing the wait card on phones is a separate `SupaMaus/mausbot-mobile` change.+- Decided here (the spec left them open): waits do not keep a sleeping Cloud home awake (`nextDueAt` unchanged); `waits.json` is left out of workspace backups and Cloud sends; on a Cloud home the follow-up does not join the person's chat but runs and reports like any outside event there (its own "<label> · Results" chat), because that is the Cloud home's rule for outside events; `bot_idle` treats "waiting on you" as working, since `ACTIVITY_BUSY` does.++## Review Focus++1. The condition is met while the person is mid-turn in that chat: the line must wait for the chat to be free, then appear once. Task 3 ("holds the line…") and Task 4 ("holds the line while a turn runs") pin it.+2. The server stops between deciding a wait fired and posting it: after restart, one line and one follow-up, not two. Task 3 ("holds the line…", reload from file) and Task 4 (post skips a line already there) pin it.+3. The chat, the bot, or the bot waited for is deleted while waiting: drop silently without recreating the chat; say so when the other bot is gone. Task 3 ("drops a wait silently…", "stops with a line…") pins it.+4. A host that resolves to a public and a private address, a redirect to loopback, `localhost`, `[::1]`: all refused. Task 2 pins it.+5. A relative path, a Windows `.exe` name, a Linux 15-character process name, a macOS full path in `ps`: Task 1 and Task 5 pin them.++---++### Task 1: File and process probes++**Files:**+- Create: `server/wait-probes.ts`+- Test: `server/wait-probes.test.ts`++**Interfaces:**+- Produces:+ - `interface FileStamp { size: number; mtimeMs: number }`+ - `interface ProcessEntry { pid: number; name: string }`+ - `expandHome(path: string, home: string): string`+ - `fileStamp(path: string): Promise<FileStamp | null>` (any stat error is `null`)+ - `fileChanged(before: FileStamp | null, now: FileStamp | null): boolean`+ - `parsePs(stdout: string): ProcessEntry[]`, `parseTasklist(stdout: string): ProcessEntry[]`+ - `listProcesses(platform?: NodeJS.Platform, run?: (file: string, args: string[]) => Promise<string>): Promise<ProcessEntry[]>`+ - `processRunning(entries: readonly ProcessEntry[], wanted: string): boolean`+ - `pageText(body: string): string`, `pageSays(text: string, wanted: string): boolean`++- [ ] **Step 1: Write the failing tests**++```ts+describe("file and process probes", () => {+ it("expands ~ to the home folder and leaves other paths alone", () => {+ expect(expandHome("~", "/h")).toBe("/h");+ expect(expandHome("~/a/b.txt", "/h")).toBe(join("/h", "a/b.txt"));+ expect(expandHome("/x/y", "/h")).toBe("/x/y");+ expect(expandHome("~bob/x", "/h")).toBe("~bob/x");+ });+ it("stamps a file with its size and modification time, and a missing one as null", async () => {+ // writeFileSync(join(dir, "r.txt"), "abc")+ expect(await fileStamp(join(dir, "r.txt"))).toEqual({ size: 3, mtimeMs: expect.any(Number) });+ expect(await fileStamp(join(dir, "none.txt"))).toBeNull();+ });+ it("sees a change in size or modification time and a file that appears, never a missing file", () => {+ expect(fileChanged({ size: 3, mtimeMs: 1 }, { size: 4, mtimeMs: 1 })).toBe(true);+ expect(fileChanged({ size: 3, mtimeMs: 1 }, { size: 3, mtimeMs: 2 })).toBe(true);+ expect(fileChanged({ size: 3, mtimeMs: 1 }, { size: 3, mtimeMs: 1 })).toBe(false);+ expect(fileChanged(null, { size: 0, mtimeMs: 1 })).toBe(true);+ expect(fileChanged({ size: 3, mtimeMs: 1 }, null)).toBe(false);+ });+ it("reads ps and tasklist output", () => {+ expect(parsePs(" 1 /sbin/launchd\n 812 /Applications/Google Chrome.app/Contents/MacOS/Google Chrome\n 9 node\n"))+ .toEqual([{ pid: 1, name: "launchd" }, { pid: 812, name: "Google Chrome" }, { pid: 9, name: "node" }]);+ expect(parseTasklist('"chrome.exe","1234","Console","1","123,456 K"\r\n"System","4","Services","0","1,000 K"\r\n'))+ .toEqual([{ pid: 1234, name: "chrome.exe" }, { pid: 4, name: "System" }]);+ });+ it("matches a program by name in any case, with or without .exe, by Linux's 15-character name, or by pid", () => {+ const entries = [{ pid: 812, name: "Google Chrome" }, { pid: 1234, name: "node.exe" }, { pid: 77, name: "gnome-shell-cal" }];+ for (const wanted of ["google chrome", "NODE", "node.exe", "gnome-shell-calendar-server", "812"]) expect(processRunning(entries, wanted), wanted).toBe(true);+ for (const wanted of ["google", "813", "gnome-shell"]) expect(processRunning(entries, wanted), wanted).toBe(false);+ });+ it("runs ps on macOS and Linux and tasklist on Windows, without a shell", async () => {+ const calls: unknown[] = [];+ const run = async (file: string, args: string[]) => { calls.push([file, args]); return ""; };+ await listProcesses("darwin", run); await listProcesses("linux", run); await listProcesses("win32", run);+ expect(calls).toEqual([["ps", ["-axo", "pid=,comm="]], ["ps", ["-axo", "pid=,comm="]], ["tasklist", ["/fo", "csv", "/nh"]]]);+ });+ it("lists this machine's processes, this one included", async () => {+ expect((await listProcesses()).some((entry) => entry.pid === process.pid)).toBe(true);+ });+ it("reads a page as words: tags, scripts and styles out, entities decoded, spaces collapsed", () => {+ const text = pageText("<html><head><style>p{}</style><script>var shipped=1</script></head><body><p>Status: <b>Shipped</b> & done</p></body></html>");+ expect(text).toBe("Status: Shipped & done");+ expect(pageSays(text, "status: SHIPPED")).toBe(true);+ expect(pageSays(text, "shipped=1")).toBe(false);+ });+});+```++- [ ] **Step 2: Run them and see them fail**++Run: `pnpm exec vitest run server/wait-probes.test.ts`+Expected: FAIL, `Cannot find module './wait-probes.ts'`.++- [ ] **Step 3: Implement `server/wait-probes.ts`**++- `parsePs`: pid is the first token, the name is the rest of the line trimmed, after its last `/`.+- `parseTasklist`: first two quoted CSV fields.+- `processRunning`: an all-digit `wanted` compares pids; otherwise lower-case both sides and match when the name equals `wanted`, or equals it with `.exe` added or removed, or when the name is exactly 15 characters and equals the first 15 of `wanted`.+- `listProcesses` default `run`: `promisify(execFile)(file, args, { timeout: 10_000, maxBuffer: 8 * 1024 * 1024, windowsHide: true })` stdout. Never a shell.+- `pageText`: drop `<script>…</script>`, `<style>…</style>` and `<!-- -->`, replace remaining tags with a space, decode `& < > " ' ` and numeric entities, collapse whitespace, trim. `pageSays` collapses whitespace in `wanted` and compares lower-cased.++- [ ] **Step 4: Run them and see them pass**++Run: `pnpm exec vitest run server/wait-probes.test.ts`+Expected: PASS.++- [ ] **Step 5: Commit**++```bash+git add server/wait-probes.ts server/wait-probes.test.ts+git commit -m "feat(waits): file and process probes"+```++---++### Task 2: The page probe, behind the egress check++**Files:**+- Modify: `server/wait-probes.ts`+- Test: `server/wait-probes.test.ts`++**Interfaces:**+- Consumes: `resolveTarget(host)` from `server/browser/egress/gate.ts:71`; `addressClass`, `ownAddresses` from `server/browser/egress/policy.ts:8`.+- Produces:+ - `type PageResult = { ok: true; text: string } | { ok: false; refused: boolean; error: string }`+ - `interface PageFetchOptions { allow?: (target: { host: string; address: string }) => boolean; lookup?: (host: string) => Promise<Array<{ address: string; family: number }>>; timeoutMs?: number; maxBytes?: number }`+ - `fetchPageText(url: string, options?: PageFetchOptions): Promise<PageResult>`+ - `PAGE_TIMEOUT_MS = 15_000`, `PAGE_MAX_BYTES = 2 * 1024 * 1024`, `PAGE_MAX_REDIRECTS = 3`++- [ ] **Step 1: Write the failing tests**++A local `http` server on `127.0.0.1` answers `/` with `<p>Build: Shipped</p>` (and records the `host` and `cookie` request headers), `/hop` 302 → `/`, `/away` 302 → `http://127.0.0.1:PORT/`, `/loop` 302 → `/loop`, `/big` 3 MB of `a` then `needle`, `/slow` never, `/404` 404. `test = { lookup: async (host) => host === "status.test" ? [{ address: "127.0.0.1", family: 4 }] : [], allow: ({ host }) => host === "status.test" }`.++```ts+describe("fetchPageText", () => {+ it("reads a page through the address it checked, under its own name, with no cookie", async () => {+ expect(await fetchPageText(`http://status.test:${port}/`, test)).toEqual({ ok: true, text: "Build: Shipped" });+ expect(seen.at(-1)).toEqual({ host: `status.test:${port}`, cookie: undefined });+ });+ it("follows a redirect only to an address it may reach, and at most three", async () => {+ expect(await fetchPageText(`http://status.test:${port}/hop`, test)).toEqual({ ok: true, text: "Build: Shipped" });+ expect(await fetchPageText(`http://status.test:${port}/away`, test)).toMatchObject({ ok: false, refused: true });+ expect(await fetchPageText(`http://status.test:${port}/loop`, test)).toEqual({ ok: false, refused: false, error: "The page redirected too many times." });+ });+ it("refuses loopback, private and mixed answers with the real egress check", async () => {+ const mixed = { lookup: async () => [{ address: "93.184.216.34", family: 4 }, { address: "10.0.0.5", family: 4 }] };+ expect(await fetchPageText("http://mixed.test/", mixed)).toMatchObject({ ok: false, refused: true });+ for (const url of [`http://127.0.0.1:${port}/`, `http://localhost:${port}/`, `http://[::1]:${port}/`]) {+ expect(await fetchPageText(url), url).toMatchObject({ ok: false, refused: true });+ }+ });+ it("takes only http and https, with no sign-in in the address", async () => {+ for (const url of ["file:///etc/passwd", "ftp://example.com/", "https://user:[email protected]/"]) {+ expect(await fetchPageText(url), url).toMatchObject({ ok: false, refused: true });+ }+ });+ it("reads at most 2 MB, and gives up after its timeout", async () => {+ const big = await fetchPageText(`http://status.test:${port}/big`, test);+ expect(big.ok && big.text.includes("needle")).toBe(false);+ expect(await fetchPageText(`http://status.test:${port}/slow`, { ...test, timeoutMs: 200 })).toEqual({ ok: false, refused: false, error: "The page took too long to answer." });+ });+ it("counts an answer that is not 2xx as a failed check", async () => {+ expect(await fetchPageText(`http://status.test:${port}/404`, test)).toEqual({ ok: false, refused: false, error: "The page answered 404." });+ });+});+```++- [ ] **Step 2: Run them and see them fail**++Run: `pnpm exec vitest run server/wait-probes.test.ts -t fetchPageText`+Expected: FAIL, `fetchPageText` is not exported.++- [ ] **Step 3: Implement `fetchPageText`**++Defaults: `lookup = resolveTarget`, `allow = ({ address }) => addressClass(address, ownAddresses()) === "public"`. One `AbortSignal.timeout(timeoutMs)` covers every hop. Each hop:+1. Parse; protocol not `http:`/`https:` or a username/password present → `{ ok: false, refused: true, error: "Only an http or https address with no sign-in details can be checked." }`.+2. `host = url.hostname` without `[ ]`; `addresses = await lookup(host)`; none → `{ ok: false, refused: false, error: "That address could not be found." }`.+3. Any address failing `allow` → `{ ok: false, refused: true, error: \`${host} points at this computer or a private network, which waits never check.\` }`.+4. `http(s).request(url, { agent: false, signal, lookup: <always answers addresses[0]>, headers: { "user-agent": "OpenMausBot-wait", accept: "text/html,text/plain;q=0.9,*/*;q=0.1" } })`, the pinned-lookup shape of `server/custom-domain.ts:99-102`.+5. 3xx with `location`: next hop from `new URL(location, url)`; a fourth redirect → the "redirected too many times" error. Other non-2xx → `The page answered <status>.`+6. 2xx: collect chunks until `maxBytes`, then destroy the response and use what was read; `pageText(utf8)`.+An abort → `The page took too long to answer.`; any other socket error → `{ ok: false, refused: false, error: "The page could not be reached." }`.++- [ ] **Step 4: Run them and see them pass**++Run: `pnpm exec vitest run server/wait-probes.test.ts`+Expected: PASS.++- [ ] **Step 5: Commit**++```bash+git add server/wait-probes.ts server/wait-probes.test.ts+git commit -m "feat(waits): page probe that only reaches public addresses"+```++---++### Task 3: `WaitManager`++**Files:**+- Create: `server/waits.ts`+- Test: `server/waits.test.ts`++**Interfaces:**+- Consumes: Task 1 and 2 exports; `writeFileAtomic` (`server/atomic.ts`); `DATA_DIR` (`server/config.ts`).+- Produces (all exported from `server/waits.ts`):++```ts+export const WAIT_KINDS = ["url_contains", "url_missing", "file_exists", "file_missing", "file_changed", "process_running", "process_gone", "bot_idle"] as const;+export type WaitKind = (typeof WAIT_KINDS)[number];+export const WAIT_LIMITS = { perBot: 10, total: 50 } as const;+export const WAIT_HOURS = { default: 24, max: 168 } as const;+export const WAIT_TICK_MS = 5_000, URL_CHECK_MS = 60_000, URL_BACKOFF_MAX_MS = 15 * 60_000;++export type NewWaitCondition =+ | { kind: "url_contains" | "url_missing"; url: string; text: string }+ | { kind: "file_exists" | "file_missing" | "file_changed"; path: string }+ | { kind: "process_running" | "process_gone"; process: string }+ | { kind: "bot_idle"; botId: string; botName: string };+export type WaitCondition =+ | { kind: "url_contains" | "url_missing"; url: string; text: string }+ | { kind: "file_exists" | "file_missing"; path: string }+ | { kind: "file_changed"; path: string; before: FileStamp | null }+ | { kind: "process_running" | "process_gone"; process: string }+ | { kind: "bot_idle"; botId: string; botName: string; sawBusy: boolean };+export interface WaitNotice { status: "fired" | "expired" | "stopped"; text: string }+export interface WaitRecord {+ id: string; botId: string; threadId: string; label: string; condition: WaitCondition; then?: string;+ createdAt: number; expiresAt: number; nextCheckAt: number; errors: number; cardMessageId?: string;+ /** Decided and saved first; posted once its chat is free. */+ ending?: WaitNotice;+}+export interface NewWait { botId: string; threadId: string; label: string; condition: NewWaitCondition; then?: string; hours?: number }+export type CreateWaitResult =+ | { state: "created"; wait: WaitRecord; note?: string }+ | { state: "already"; text: string }+ | { state: "refused"; status: 400 | 409; error: string };+export interface WaitProbes { page(url: string): Promise<PageResult>; stamp(path: string): Promise<FileStamp | null>; processes(): Promise<ProcessEntry[]> }+export interface WaitManagerOptions {+ file?: string; now?: () => number; probes?: Partial<WaitProbes>;+ sourceAlive(botId: string, threadId: string): boolean;+ /** Undefined once that bot no longer exists. */+ botBusy(botId: string): boolean | undefined;+ /** False while a turn runs in the chat: try again next tick. */+ post(wait: WaitRecord, notice: WaitNotice): boolean;+ followUp(wait: WaitRecord & { then: string }): void;+ showCard(wait: WaitRecord & { then: string }): string | undefined;+ settleCard(wait: WaitRecord, how: "fired" | "expired" | "cancelled"): void;+}+export function describeCondition(condition: NewWaitCondition | WaitCondition): string;+export function waitList(waits: readonly WaitRecord[]): string;+export class WaitManager {+ constructor(options: WaitManagerOptions);+ create(input: NewWait): Promise<CreateWaitResult>;+ /** Active waits only: none with an ending. */+ list(botId: string): WaitRecord[];+ cancel(id: string, botId: string): WaitRecord | null;+ /** Every bot that has a stored wait, once each. */+ owners(): string[];+ removeForBot(botId: string): number;+ noteBotBusy(botId: string): void;+ start(): void; stop(): void; tick(): Promise<void>; get isTicking(): boolean;+}+```++Copy (exact):+- `describeCondition`: `<url> says “<text>”`, `<url> no longer says “<text>”`, `<path> exists`, `<path> is gone`, `<path> changes`, `<process> is running`, `<process> has stopped`, `<botName> finishes its work`.+- Already true: `` `${describeCondition(c)} already. Nothing was set up: tell the person now.` ``+- Fired detail after `<label>: done. `: `<url> now says “<text>”.`, `<url> no longer says “<text>”.`, `<path> is there now.`, `<path> is gone.`, `<path> changed.`, `<process> is running.`, `<process> stopped.`, `<botName> finished.`+- Expired: `` `Stopped waiting for ${label} after ${n} hour${n === 1 ? "" : "s"}.` `` with `n = Math.round((expiresAt - createdAt) / 3_600_000)`.+- Stopped (the other bot is gone): `` `Stopped waiting for ${label}: ${botName} no longer exists.` ``+- `waitList` line: `` `- ${id} · ${label} · until ${describeCondition(c)} · made ${iso(createdAt)} · stops ${iso(expiresAt)}${then ? ` · then: ${then}` : ""}` `` (`iso` = `new Date(ms).toISOString()`).+- Per-bot limit: `` `You already keep ${WAIT_LIMITS.perBot} waits, the most one bot may:\n${waitList(mine)}\nCancel one with cancel_wait first.` ``; total: `This computer already keeps 50 waits, the most it holds. Ask the person which ones to stop.`+- Unreachable page at creation, `note`: `` `The page could not be read just now (${error}); checks go on every minute and slow down while it keeps failing.` ``++- [ ] **Step 1: Write the failing tests**++Harness `harness(options?: Partial<WaitManagerOptions>)` returns `h` with: `manager`, `file` (in a `mkdtemp`), `reload()` (a new manager on the same file and stubs), a clock `now()` starting at `T0` with `advance(ms)` / `advanceTo(ms)`; probe stubs `h.stamp` (default `null`), `h.page`, `h.processes` (default `[]`) with counters `stampCalls`, `pageCalls`, `processCalls`; `h.busy` (a `Map` behind `botBusy`), `h.alive` (default `true`, behind `sourceAlive`); `post`, `followUp`, `showCard` (returns `"card-1"`), `settleCard` as `vi.fn`; `post` returns `h.postOk` (default `true`) and `h.posts` holds the notices of the posts that returned `true`; `h.create(condition, { label?, then?, botId?, hours? })` with defaults `bot-1`, `t-1`, `"the report is ready"`; `h.waitOf(id)` reads the stored record.++```ts+describe("WaitManager", () => {+ it("creates a wait with a 24-hour default and its first check due, and keeps it across a restart", async () => {+ const created = await h.manager.create({ botId: "bot-1", threadId: "t-1", label: "the report is ready", condition: { kind: "file_exists", path: "/r.txt" } });+ expect(created).toMatchObject({ state: "created", wait: { expiresAt: T0 + 24 * 3_600_000, nextCheckAt: T0 + 5_000, errors: 0 } });+ expect(h.reload().list("bot-1")).toHaveLength(1);+ if (process.platform !== "win32") expect(statSync(h.file).mode & 0o777).toBe(0o600);+ });+ it("creates nothing when the condition is already true", async () => {+ h.stamp = { size: 1, mtimeMs: 1 };+ expect(await h.create({ kind: "file_exists", path: "/r.txt" })).toEqual({ state: "already", text: "/r.txt exists already. Nothing was set up: tell the person now." });+ h.processes = [{ pid: 9, name: "make" }];+ expect(await h.create({ kind: "process_running", process: "make" })).toMatchObject({ state: "already" });+ h.page = { ok: true, text: "Shipped" };+ expect(await h.create({ kind: "url_contains", url: "https://x.test/", text: "shipped" })).toMatchObject({ state: "already" });+ expect(h.manager.list("bot-1")).toEqual([]);+ });+ it("keeps ten waits per bot and fifty in all, and names the bot's waits when full", async () => {+ for (let i = 0; i < 10; i++) await h.create({ kind: "file_exists", path: `/f${i}` }, { label: `file ${i}` });+ const full = await h.create({ kind: "file_exists", path: "/f10" });+ expect(full).toMatchObject({ state: "refused", status: 409, error: expect.stringContaining("cancel_wait") });+ expect((full as { error: string }).error).toContain("file 9");+ for (let i = 0; i < 40; i++) await h.create({ kind: "file_exists", path: `/g${i}` }, { botId: `bot-${2 + (i % 8)}` });+ expect(await h.create({ kind: "file_exists", path: "/h" }, { botId: "bot-99" })).toMatchObject({ state: "refused", status: 409 });+ });+ it("refuses a page at a private address, and keeps checking a page that only failed to load", async () => {+ h.page = { ok: false, refused: true, error: "x.test points at this computer or a private network, which waits never check." };+ expect(await h.create({ kind: "url_contains", url: "http://x.test/", text: "ok" })).toEqual({ state: "refused", status: 400, error: h.page.error });+ h.page = { ok: false, refused: false, error: "The page took too long to answer." };+ expect(await h.create({ kind: "url_contains", url: "http://x.test/", text: "ok" })).toMatchObject({ state: "created", note: expect.stringContaining("took too long") });+ });+ it("shows the card only for a wait with a follow-up, and stores its message id", async () => {+ h.showCard.mockReturnValue("m-1");+ const withThen = await h.create({ kind: "file_exists", path: "/r" }, { then: "Summarise it." });+ expect(withThen).toMatchObject({ wait: { cardMessageId: "m-1" } });+ await h.create({ kind: "file_exists", path: "/s" });+ expect(h.showCard).toHaveBeenCalledTimes(1);+ });+ it("fires once: one line, one follow-up, the card settled, and the wait gone", async () => {+ await h.create({ kind: "file_exists", path: "/r.txt" }, { label: "the report is ready", then: "Summarise it." });+ h.stamp = { size: 1, mtimeMs: 1 }; h.advance(5_000); await h.manager.tick(); await h.manager.tick();+ expect(h.posts).toEqual([{ status: "fired", text: "the report is ready: done. /r.txt is there now." }]);+ expect(h.followUp).toHaveBeenCalledTimes(1);+ expect(h.settleCard.mock.calls.map(([, how]) => how)).toEqual(["fired"]);+ expect(h.manager.list("bot-1")).toEqual([]);+ });+ it("holds the line while a turn runs in the chat, then posts it once, even across a restart", async () => {+ await h.create({ kind: "file_exists", path: "/r.txt" }, { then: "Go." });+ h.stamp = { size: 1, mtimeMs: 1 }; h.postOk = false; h.advance(5_000); await h.manager.tick();+ const reloaded = h.reload(); h.postOk = true; await reloaded.tick();+ expect(h.post).toHaveBeenCalledTimes(2);+ expect(h.followUp).toHaveBeenCalledTimes(1);+ await reloaded.tick(); expect(h.post).toHaveBeenCalledTimes(2);+ });+ it("expires after its hours with one last check, quietly and without a follow-up", async () => {+ await h.create({ kind: "file_exists", path: "/r" }, { label: "the build", then: "Deploy." });+ h.advance(24 * 3_600_000); await h.manager.tick();+ expect(h.posts).toEqual([{ status: "expired", text: "Stopped waiting for the build after 24 hours." }]);+ expect(h.followUp).not.toHaveBeenCalled();+ expect(h.settleCard.mock.calls.map(([, how]) => how)).toEqual(["expired"]);+ });+ it("fires instead of expiring when the last check finds it", async () => {+ await h.create({ kind: "file_exists", path: "/r" }, { label: "the build" });+ h.stamp = { size: 1, mtimeMs: 1 }; h.advance(30 * 3_600_000); await h.manager.tick();+ expect(h.posts[0]).toMatchObject({ status: "fired" });+ });+ it("checks a page every minute and backs off to 15 minutes while it fails", async () => {+ h.page = { ok: true, text: "building" };+ const { wait } = await h.create({ kind: "url_contains", url: "https://x.test/", text: "shipped" }) as { wait: WaitRecord };+ expect(wait.nextCheckAt - T0).toBe(60_000);+ h.page = { ok: false, refused: false, error: "down" };+ const gaps: number[] = [];+ for (let i = 0; i < 6; i++) { h.advanceTo(h.waitOf(wait.id).nextCheckAt); await h.manager.tick(); gaps.push(h.waitOf(wait.id).nextCheckAt - h.now()); }+ expect(gaps).toEqual([120_000, 240_000, 480_000, 900_000, 900_000, 900_000]);+ h.page = { ok: true, text: "building" }; h.advanceTo(h.waitOf(wait.id).nextCheckAt); await h.manager.tick();+ expect(h.waitOf(wait.id).nextCheckAt - h.now()).toBe(60_000);+ h.advance(5_000); await h.manager.tick(); expect(h.pageCalls).toBe(8);+ });+ it("waits for another bot to start and then finish, even a turn shorter than a tick", async () => {+ h.busy.set("coder", false);+ await h.create({ kind: "bot_idle", botId: "coder", botName: "Coder" }, { label: "Coder's review" });+ h.advance(5_000); await h.manager.tick(); expect(h.posts).toEqual([]);+ h.manager.noteBotBusy("coder");+ h.advance(5_000); await h.manager.tick();+ expect(h.posts).toEqual([{ status: "fired", text: "Coder's review: done. Coder finished." }]);+ });+ it("stops with a line when the bot it waits for is deleted", async () => {+ h.busy.set("coder", false);+ await h.create({ kind: "bot_idle", botId: "coder", botName: "Coder" }, { label: "Coder's review" });+ h.busy.delete("coder"); h.advance(5_000); await h.manager.tick();+ expect(h.posts).toEqual([{ status: "stopped", text: "Stopped waiting for Coder's review: Coder no longer exists." }]);+ });+ it("drops a wait silently when its chat or bot is gone, without posting or touching the card", async () => {+ await h.create({ kind: "file_exists", path: "/r" }, { then: "Go." });+ h.alive = false; h.stamp = { size: 1, mtimeMs: 1 }; h.advance(5_000); await h.manager.tick();+ expect([h.post.mock.calls.length, h.settleCard.mock.calls.length, h.manager.list("bot-1").length]).toEqual([0, 0, 0]);+ });+ it("reads a file's change against the stamp taken when the wait was made", async () => {+ h.stamp = { size: 1, mtimeMs: 1 };+ await h.create({ kind: "file_changed", path: "/log" });+ h.advance(5_000); await h.manager.tick(); expect(h.posts).toEqual([]);+ h.stamp = { size: 2, mtimeMs: 2 }; h.advance(5_000); await h.manager.tick();+ expect(h.posts[0]).toMatchObject({ status: "fired" });+ });+ it("reads the process list once per tick for every process wait", async () => {+ h.processes = [{ pid: 1, name: "a" }, { pid: 2, name: "b" }, { pid: 3, name: "c" }];+ for (const name of ["a", "b", "c"]) await h.create({ kind: "process_gone", process: name }, { label: name });+ h.processCalls = 0; h.advance(5_000); await h.manager.tick();+ expect(h.processCalls).toBe(1);+ expect(h.posts).toEqual([]);+ });+ it("lets a bot cancel only its own waits, and settles the card", async () => {+ const { wait } = await h.create({ kind: "file_exists", path: "/r" }, { then: "Go." }) as { wait: WaitRecord };+ expect(h.manager.cancel(wait.id, "bot-2")).toBeNull();+ expect(h.manager.cancel(wait.id, "bot-1")?.id).toBe(wait.id);+ expect(h.settleCard.mock.calls.map(([, how]) => how)).toEqual(["cancelled"]);+ });+ it("removes a deleted bot's waits and nobody else's", async () => {+ await h.create({ kind: "file_exists", path: "/a" }); await h.create({ kind: "file_exists", path: "/b" });+ await h.create({ kind: "file_exists", path: "/c" }, { botId: "bot-2" });+ expect(h.manager.owners()).toEqual(["bot-1", "bot-2"]);+ expect(h.manager.removeForBot("bot-1")).toBe(2);+ expect([h.manager.list("bot-1").length, h.manager.list("bot-2").length, h.posts.length]).toEqual([0, 1, 0]);+ });+ it("checks every five seconds once started, and not at all once stopped", async () => {+ vi.useFakeTimers();+ const h = harness({ now: () => Date.now() });+ await h.create({ kind: "file_exists", path: "/r" });+ h.manager.start(); await vi.advanceTimersByTimeAsync(5_000); const seen = h.stampCalls;+ h.manager.stop(); await vi.advanceTimersByTimeAsync(20_000);+ expect(h.stampCalls).toBe(seen); expect(h.manager.isTicking).toBe(false);+ });+});+```++- [ ] **Step 2: Run them and see them fail**++Run: `pnpm exec vitest run server/waits.test.ts`+Expected: FAIL, `Cannot find module './waits.ts'`.++- [ ] **Step 3: Implement `server/waits.ts`**++Persistence exactly as `server/calendar-calls.ts:183-386`: `file ?? join(DATA_DIR, "waits.json")`, `{ version: 1, waits }` validated by a zod schema per record (invalid records dropped), `commit()` with rollback for `create`/`cancel`/`removeForBot`/`noteBotBusy`, `save()` with `writeFileAtomic(…, { mode: 0o600 })`, `start()` runs `tick()` then a `WAIT_TICK_MS` interval with `unref()`.++`create`: limits first (per bot counts waits of `botId` without `ending`; total counts all), then one probe through the same check as the tick: met → `already`; a `refused` page → `refused 400`; a failed page → created with `note`. `file_changed` stores `before` from `stamp(path)`; `bot_idle` stores `sawBusy: false`. `nextCheckAt = now + interval(kind, 0)`; `expiresAt = now + (hours ?? 24) * 3_600_000`. After the commit, a wait with `then` gets `cardMessageId = showCard(wait)` in a second commit.++`noteBotBusy(botId)` sets `sawBusy` on active `bot_idle` waits for that bot that do not have it yet, and saves only if one changed.++`tick()` (guarded by `ticking`; the process list is read at most once, lazily, per tick):+1. For each wait: `!sourceAlive(botId, threadId)` → remove it; no post, no `settleCard`.+2. A wait with `ending` skips to step 5.+3. Due when `now >= nextCheckAt` or `now >= expiresAt` (an expired wait gets one last check). Probe every due wait concurrently. `bot_idle`: `botBusy` undefined → gone; true → `sawBusy = true`, not met; false → met when `sawBusy`.+4. Met → `ending` = fired notice; gone → stopped notice; otherwise past `expiresAt` → expired notice; otherwise a failed page → `errors += 1`, else `errors = 0`; `nextCheckAt = now + interval(kind, errors)` where `interval` is `min(URL_CHECK_MS * 2 ** errors, URL_BACKOFF_MAX_MS)` for `url_*` and `WAIT_TICK_MS` for the rest. Save before step 5 when any `ending` was set.+5. With an `ending`: `post(wait, ending)`; false → keep it for the next tick. True → `followUp` when fired with `then` (an exception is logged, the wait still ends), `settleCard(wait, status === "fired" ? "fired" : "expired")` when it has a card, remove it, save.++- [ ] **Step 4: Run them and see them pass**++Run: `pnpm exec vitest run server/waits.test.ts`+Expected: PASS.++- [ ] **Step 5: Commit**++```bash+git add server/waits.ts server/waits.test.ts+git commit -m "feat(waits): WaitManager with a 5 s tick, limits and expiry"+```++---++### Task 4: Wire shapes, the notification, the follow-up run and the store side++**Files:**+- Modify: `shared/notification.ts:3-28` (add `| "wait"` with a doc comment)+- Modify: `server/notify.ts:26-64` (title)+- Modify: `src/components/NotificationsPanel.tsx:13-26` (`KIND_LOOK.wait`)+- Modify: `shared/wire.ts:516` (message field), `shared/wire.ts:640-698` (card field and `WaitCardData`)+- Modify: `shared/routine-run.ts:33`, `shared/routines.ts:173`, `server/routines.ts:113-115` and `:768-792`+- Create: `server/wait-host.ts`+- Test: `server/notify.test.ts`, `server/routines.test.ts`, `server/wait-host.test.ts`++**Interfaces:**+- Consumes: `WaitManagerOptions`, `WaitRecord`, `WaitNotice` (Task 3).+- Produces:+ - `NotifyKind` gains `"wait"`; `buildNotification("wait", …)` title `` `${who}'s wait is over` ``.+ - `WireMessage.wait?: { id: string; status: "fired" | "expired" | "stopped" }` — doc: "The line a wait (wait_until) posted when it ended."+ - `OptionCardData.waitRequest?: WaitCardData`; `export interface WaitCardData { waitId: string; label: string; then: string; settled?: "fired" | "expired" | "cancelled" }` — doc: "A wait with a follow-up a bot set up from chat; Cancel stops it until it settles."+ - `AutomationLine.trigger` and `RoutineRun.eventSource` (shared and server) gain `"wait"`.+ - `RoutineManager.enqueueWebhook` input gains `eventSource?: "app" | "wait"` and `resultsThreadId?: string` (used instead of `eventResultsThread` when given).+ - `server/wait-host.ts`:++```ts+export interface WaitHostDeps {+ store: Pick<Store, "appendMessage" | "patchMessage" | "patchTask" | "messagesFor" | "bot">;+ /** A one-to-one chat this bot owns; a room is not one. */+ directChat(botId: string, threadId: string): boolean;+ threadBusy(botId: string, threadId: string): boolean;+ wrote(bot: BotRecord, threadId: string): void;+ notify(notification: Notification | null): void;+ enqueue(input: Parameters<RoutineManager["enqueueWebhook"]>[0]): { id: string };+ cloudHome: boolean;+ now?: () => number;+}+export function createWaitHost(deps: WaitHostDeps): Pick<WaitManagerOptions, "sourceAlive" | "botBusy" | "post" | "followUp" | "showCard" | "settleCard">;+/** The chat a wait's follow-up run works in: the one it was asked in, never on a Cloud home or in a room. */+export function waitRunChat(run: Pick<RoutineRun, "botId" | "resultsThreadId">, directChat: (botId: string, threadId: string) => boolean, cloudHome: boolean): string | null;+```++- [ ] **Step 1: Write the failing tests**++`server/notify.test.ts`:++```ts+it("titles a finished wait and keeps its line as the body", () => {+ expect(buildNotification("wait", { id: "b", name: "Pepper" }, "t", "the build: done. ci passed.")).toEqual({+ kind: "wait", botId: "b", botName: "Pepper", threadId: "t", title: "Pepper's wait is over", body: "the build: done. ci passed.",+ });+});+```++`server/routines.test.ts`, beside "sends an outside event's run to report where the bot's chat is" (`:3907`):++```ts+it("runs a wait's follow-up in the chat it was asked in, reporting nowhere else", async () => {+ const h = harness();+ h.options.eventResultsThread = () => "main";+ h.options.joinConversation = (run) => run.eventSource === "wait" ? run.resultsThreadId ?? null : null;+ const queued = h.manager.enqueueWebhook({ webhookId: "wait:w1", webhookName: "the build", prompt: "[Wait finished: the build] Deploy.", botId: "maus-1",+ runOn: "maus", deliveryId: "w1", receivedAt: Date.now(), eventSource: "wait", resultsThreadId: "chat-1" });+ await h.manager.tick();+ expect(h.manager.listRuns().find((run) => run.id === queued.id)).toMatchObject({ eventSource: "wait", resultsThreadId: "chat-1", threadId: "chat-1", status: "running" });+ expect(h.taskTitles).toHaveLength(0);+});+```++`server/wait-host.test.ts` (a small in-memory store fake with `appendMessage` returning `{ id: "m-<n>", …message }`):++```ts+describe("the store side of waits", () => {+ it("posts a wait's line once, marks the chat unread and notifies only when it fired", () => {+ expect(host.post(wait, { status: "fired", text: "the build: done. ci passed." })).toBe(true);+ expect(host.post(wait, { status: "fired", text: "the build: done. ci passed." })).toBe(true);+ expect(store.lines).toEqual([{ role: "bot", kind: "text", text: "the build: done. ci passed.", wait: { id: "w1", status: "fired" } }]);+ expect(store.patchTask).toHaveBeenCalledWith("bot-1", "t-1", { unread: true });+ expect(wrote).toHaveBeenCalledTimes(1);+ host.post({ ...wait, id: "w2" }, { status: "expired", text: "Stopped waiting for the build after 24 hours." });+ expect(notify.mock.calls.map(([n]) => n?.kind)).toEqual(["wait"]);+ });+ it("holds the line while a turn runs in the chat", () => {+ busy = true;+ expect(host.post(wait, { status: "fired", text: "x" })).toBe(false);+ expect(store.lines).toEqual([]);+ });+ it("shows a card with the follow-up, and settles it", () => {+ const id = host.showCard({ ...wait, then: "Deploy it." });+ expect(store.message(id!)).toMatchObject({ role: "bot", kind: "options", card: {+ title: "Waiting: the build", subtitle: "When the build, Pepper will: Deploy it.", options: [], answered: "allow", dismissed: true,+ autoApplied: true, requestId: "w1", tool: "wait_until", waitRequest: { waitId: "w1", label: "the build", then: "Deploy it." } } });+ host.settleCard({ ...wait, cardMessageId: id }, "cancelled");+ expect(store.message(id!).card).toMatchObject({ undone: true, waitRequest: { settled: "cancelled" } });+ });+ it("queues the follow-up as an outside event that joins the chat, except on a Cloud home", () => {+ host.followUp({ ...wait, then: "Deploy it." });+ expect(enqueue).toHaveBeenLastCalledWith({ webhookId: "wait:w1", webhookName: "the build", prompt: "[Wait finished: the build] Deploy it.",+ botId: "bot-1", runOn: "maus", deliveryId: "w1", receivedAt: NOW, eventSource: "wait", resultsThreadId: "t-1" });+ cloudHost.followUp({ ...wait, then: "Deploy it." });+ expect(enqueue.mock.lastCall![0]).not.toHaveProperty("resultsThreadId");+ expect(waitRunChat({ botId: "bot-1", resultsThreadId: "t-1" }, () => true, false)).toBe("t-1");+ expect(waitRunChat({ botId: "bot-1", resultsThreadId: "t-1" }, () => true, true)).toBeNull();+ expect(waitRunChat({ botId: "bot-1", resultsThreadId: "room" }, () => false, false)).toBeNull();+ });+ it("knows a deleted bot from an idle one", () => {+ expect([host.botBusy("bot-1"), host.botBusy("gone")]).toEqual([false, undefined]);+ });+});+```++- [ ] **Step 2: Run them and see them fail**++Run: `pnpm exec vitest run server/notify.test.ts server/routines.test.ts server/wait-host.test.ts`+Expected: FAIL: the title falls through to "finished", `resultsThreadId` is the event's `main`, `wait-host.ts` is missing.++- [ ] **Step 3: Implement**++- Types as listed in Interfaces; `KIND_LOOK.wait = { Icon: CheckCircle2, className: "text-success", status: "notifications.status.done" }` (no new locale key).+- `enqueueWebhook`: `resultsThreadId: input.resultsThreadId ?? this.options.eventResultsThread?.(input)`.+- `createWaitHost`: `sourceAlive` = bot exists and `directChat`; `botBusy` = `store.bot(id)?.busy === true`, `undefined` for a missing bot. `post`: missing bot → `true` (drop); `threadBusy` → `false`; a line in `messagesFor(threadId)` with the same `wait.id` and `status` → `true`; else append, `patchTask(…, { unread: true })`, `wrote(bot, threadId)`, and for `fired` `notify(buildNotification("wait", bot, threadId, text, { avatarUrl: bot.avatarUrl }))`. `settleCard`: patch the card message only when it still carries `waitRequest`; `cancelled` also sets `undone: true`.++- [ ] **Step 4: Run them and see them pass, then typecheck**++Run: `pnpm exec vitest run server/notify.test.ts server/routines.test.ts server/wait-host.test.ts src/components/NotificationsPanel.test.ts && pnpm typecheck`+Expected: PASS, typecheck clean.++- [ ] **Step 5: Commit**++```bash+git add shared/notification.ts server/notify.ts server/notify.test.ts src/components/NotificationsPanel.tsx shared/wire.ts shared/routine-run.ts shared/routines.ts server/routines.ts server/routines.test.ts server/wait-host.ts server/wait-host.test.ts+git commit -m "feat(waits): wire shapes, wait notification and follow-up run plumbing"+```++---++### Task 5: The internal route++**Files:**+- Create: `server/routes/waits.ts`+- Test: `server/routes/waits.test.ts`+- Modify: `server/read-and-draft.test.ts:83` (pin the default-deny for waits; `server/read-and-draft.ts` itself does not change)++**Interfaces:**+- Consumes: `WaitManager` (`create`, `list`, `cancel`), `WAIT_KINDS`, `WAIT_HOURS`, `waitList` (Task 3); `expandHome` (Task 1); `PASS` (`server/routes/table.ts`); `type json` (`server/harness/http.ts`); `type Surface` (`shared/wire.ts:57`).+- Produces:++```ts+export const WAIT_MESSAGES = {+ notYours: "This conversation is not yours.",+ room: "Waits are made in a one-to-one chat with the person, not in a room.",+ notPerson: "Only the person can set up or stop a wait, in their own chat with you; work handed to you by a bot, a routine or an outside event cannot.",+ serverHost: "File and program waits look at the computer OpenMausBot runs on, and here that is a server, not the computer you work on. Use url_contains, url_missing or bot_idle.",+ guest: "File and program waits are only for the owner of this computer. Use url_contains, url_missing or bot_idle.",+ otherComputer: "You work on another computer this turn (a Local VM or a cloud computer), and file and program waits look at the one OpenMausBot runs on. Use url_contains, url_missing or bot_idle.",+ noPeer: "No bot you can reach goes by that name. Use a name or id from list_bots.",+ self: "You cannot wait for yourself to finish.",+ noWait: "None of your waits has that id. Use list_waits.",+ none: "You are not waiting for anything.",+} as const;+export interface WaitRequest { label: string; kind: WaitKind; url?: string; text?: string; path?: string; process?: string; bot?: string; then?: string; hours: number }+export function parseWaitRequest(body: unknown, home: string): { ok: true; request: WaitRequest } | { ok: false; error: string };+export function waitSourceRefusal(turn: { owned: boolean; room: boolean; depth: number; handedOff: boolean; routineRun: boolean; outsideDriven: boolean; personStarted: boolean; guest: boolean }): string | null;+export function hostWaitRefusal(turn: { cloudHome: boolean; hosted: boolean; guest: boolean; place: Surface | null }): string | null;+export function findWaitPeer(peers: readonly { id: string; name: string; hidden?: boolean }[], selfId: string, nameOrId: string): { id: string; name: string } | "self" | null;+export interface WaitRouteContext {+ method: string; path: string; res: ServerResponse; json: typeof sendJson;+ botId: string; threadId: string; readBody: () => Promise<unknown>;+ sourceRefusal: () => string | null;+ hostRefusal: () => string | null;+ peer: (nameOrId: string) => { id: string; name: string } | "self" | null;+}+export function createWaitRoutes(deps: { waits: Pick<WaitManager, "create" | "list" | "cancel">; home?: () => string }): (ctx: WaitRouteContext) => Promise<typeof PASS | void>;+```++Routes: `GET /api/internal/waits` → 200 `{ text }` (`waitList(list(botId))` or `none`); `POST /api/internal/waits` → create; `POST /api/internal/waits/cancel` `{ id }` → 200 `{ text: "Stopped waiting for <label>." }` or 404 `{ error: noWait }`. Anything else → `PASS`.++Create order: `sourceRefusal` → 403; `parseWaitRequest` → 400; `file_*`/`process_*` with `hostRefusal` → 403; `bot_idle`: `peer(bot)` → `self` 400 / null 400; `waits.create({ botId, threadId, … })`: created → 201 `{ text }`, already → 200 `{ text }`, refused → its status `{ error }`. Created text:+`` `Waiting for ${label} (wait id ${id}): plain checks, no AI, until ${iso(expiresAt)}. When it happens a message lands in this chat${then ? ", and you will then do what you wrote in then" : ""}. Tell the person in one sentence; do not keep checking yourself.` `` plus `\n\n${note}` when there is one.++Parse rules and errors (exact):+- `label` trimmed 1–120 → else `label: the person's words for what you wait for, up to 120 characters.`+- `kind` → else `` `kind is one of: ${WAIT_KINDS.join(", ")}.` ``+- Fields per kind: `url`+`text` for `url_*`, `path` for `file_*`, `process` for `process_*`, `bot` for `bot_idle`. Missing → `` `${kind} needs ${fields joined with " and "}.` `` A field of another kind (null counts as absent) → `` `${field} applies only to ${kinds joined with " and "}.` ``+- `url` ≤ 2048, `http:`/`https:` → else `url must be an http or https address.`; username or password → `Put no sign-in details in the address.`+- `text` 1–500; `process` 1–256; `bot` 1–128; `then` trimmed 1–2000 when present.+- `path` ≤ 1024, `expandHome(path, home)` must be absolute (`path.isAbsolute`) → else `path must be a full path or start with ~.`+- `hours` integer 1–168, default 24 → else `hours is a whole number from 1 to 168.`++Refusal rules: `!owned` → `notYours`; `room` → `room`; `depth > 0 || handedOff || routineRun || outsideDriven || !(personStarted || guest)` → `notPerson`; else null. Host: `cloudHome || hosted` → `serverHost`; `guest` → `guest`; `place === "vm" || place === "cloud"` → `otherComputer`; else null. Peer: skip `hidden`; match `id` exactly or `name` case-insensitively; the match being `selfId` → `"self"`.++- [ ] **Step 1: Write the failing tests**++Harness: `waits = { create: vi.fn(async (input) => ({ state: "created", wait: { id: "w1", label: input.label, expiresAt: 0 } })), list: vi.fn(() => []), cancel: vi.fn() }`; `call(method, path, body?, overrides?)` runs the route with `botId: "bot-1"`, `threadId: "thread-1"`, `home` `HOME`, `sourceRefusal`/`hostRefusal` returning null and `peer` returning null unless overridden, and returns `{ outcome, status, payload }` from the `json` spy. `FILE_WAIT = { label: "the report is ready", kind: "file_exists", path: "/r.txt" }`.++```ts+describe("the waits route", () => {+ it("passes requests that are not its own", async () => {+ expect((await call("GET", "/api/internal/triggers")).outcome).toBe(PASS);+ });+ it("makes a wait for the capability's bot and chat, never ids from the body", async () => {+ const { status, payload } = await call("POST", "/api/internal/waits", { label: "the report is ready", kind: "file_exists", path: "~/r.txt" });+ expect(waits.create).toHaveBeenCalledWith({ botId: "bot-1", threadId: "thread-1", label: "the report is ready", condition: { kind: "file_exists", path: join(HOME, "r.txt") }, hours: 24 });+ expect([status, payload.text]).toEqual([201, expect.stringContaining("(wait id w1)")]);+ });+ it("refuses a turn the person did not start in their own chat, for making and for stopping", async () => {+ for (const [path, body] of [["/api/internal/waits", FILE_WAIT], ["/api/internal/waits/cancel", { id: "w1" }]] as const) {+ expect(await call("POST", path, body, { sourceRefusal: () => WAIT_MESSAGES.notPerson })).toMatchObject({ status: 403, payload: { error: WAIT_MESSAGES.notPerson } });+ }+ expect(waits.create).not.toHaveBeenCalled(); expect(waits.cancel).not.toHaveBeenCalled();+ });+ it("refuses file and program waits away from the bot's own computer, and allows pages and bots there", async () => {+ const away = { hostRefusal: () => WAIT_MESSAGES.otherComputer };+ expect(await call("POST", "/api/internal/waits", FILE_WAIT, away)).toMatchObject({ status: 403 });+ expect(await call("POST", "/api/internal/waits", { label: "l", kind: "process_gone", process: "make" }, away)).toMatchObject({ status: 403 });+ expect(await call("POST", "/api/internal/waits", { label: "l", kind: "url_contains", url: "https://x.test/", text: "ok" }, away)).toMatchObject({ status: 201 });+ });+ it.each([+ [{ label: "", kind: "file_exists", path: "/r" }, "label: the person's words for what you wait for, up to 120 characters."],+ [{ label: "l", kind: "file_seen", path: "/r" }, `kind is one of: ${WAIT_KINDS.join(", ")}.`],+ [{ label: "l", kind: "url_contains", url: "https://x.test/" }, "url_contains needs url and text."],+ [{ label: "l", kind: "file_exists", path: "/r", text: "x" }, "text applies only to url_contains and url_missing."],+ [{ label: "l", kind: "url_missing", url: "ftp://x.test/", text: "x" }, "url must be an http or https address."],+ [{ label: "l", kind: "url_missing", url: "https://u:[email protected]/", text: "x" }, "Put no sign-in details in the address."],+ [{ label: "l", kind: "file_exists", path: "build/out.txt" }, "path must be a full path or start with ~."],+ [{ label: "l", kind: "file_exists", path: "/r", hours: 169 }, "hours is a whole number from 1 to 168."],+ [{ label: "l", kind: "file_exists", path: "/r", hours: 0 }, "hours is a whole number from 1 to 168."],+ ])("refuses %j", async (body, error) => {+ expect(await call("POST", "/api/internal/waits", body)).toMatchObject({ status: 400, payload: { error } });+ });+ it("finds the other bot by name or id among the bots it may reach, never itself", async () => {+ const peers = [{ id: "b2", name: "Coder" }, { id: "b3", name: "Hidden", hidden: true }, { id: "bot-1", name: "Pepper" }];+ expect(findWaitPeer(peers, "bot-1", "coder")).toEqual({ id: "b2", name: "Coder" });+ expect(findWaitPeer(peers, "bot-1", "b2")).toEqual({ id: "b2", name: "Coder" });+ expect([findWaitPeer(peers, "bot-1", "Hidden"), findWaitPeer(peers, "bot-1", "pepper")]).toEqual([null, "self"]);+ expect(await call("POST", "/api/internal/waits", { label: "l", kind: "bot_idle", bot: "nobody" }, { peer: () => null })).toMatchObject({ status: 400, payload: { error: WAIT_MESSAGES.noPeer } });+ });+ it("lets a bot cancel only its own waits and lists only its own", async () => {+ waits.cancel.mockReturnValueOnce(null);+ expect(await call("POST", "/api/internal/waits/cancel", { id: "w9" })).toMatchObject({ status: 404, payload: { error: WAIT_MESSAGES.noWait } });+ waits.cancel.mockReturnValueOnce({ id: "w1", label: "the build" } as WaitRecord);+ expect(await call("POST", "/api/internal/waits/cancel", { id: "w1" })).toMatchObject({ status: 200, payload: { text: "Stopped waiting for the build." } });+ expect(waits.cancel.mock.calls).toEqual([["w9", "bot-1"], ["w1", "bot-1"]]);+ await call("GET", "/api/internal/waits"); expect(waits.list).toHaveBeenCalledWith("bot-1");+ });+ it("lets only a person's own one-to-one turn make a wait", () => {+ const person = { owned: true, room: false, depth: 0, handedOff: false, routineRun: false, outsideDriven: false, personStarted: true, guest: false };+ expect(waitSourceRefusal(person)).toBeNull();+ expect(waitSourceRefusal({ ...person, personStarted: false, guest: true })).toBeNull();+ expect(waitSourceRefusal({ ...person, owned: false })).toBe(WAIT_MESSAGES.notYours);+ expect(waitSourceRefusal({ ...person, room: true })).toBe(WAIT_MESSAGES.room);+ for (const other of [{ depth: 1 }, { handedOff: true }, { routineRun: true }, { outsideDriven: true }, { personStarted: false }]) {+ expect(waitSourceRefusal({ ...person, ...other }), JSON.stringify(other)).toBe(WAIT_MESSAGES.notPerson);+ }+ });+ it("offers files and programs only on the bot's own computer", () => {+ const own = { cloudHome: false, hosted: false, guest: false, place: null };+ for (const place of [null, "local", "browser"] as const) expect(hostWaitRefusal({ ...own, place })).toBeNull();+ for (const place of ["vm", "cloud"] as const) expect(hostWaitRefusal({ ...own, place })).toBe(WAIT_MESSAGES.otherComputer);+ expect([hostWaitRefusal({ ...own, cloudHome: true }), hostWaitRefusal({ ...own, hosted: true }), hostWaitRefusal({ ...own, guest: true })])+ .toEqual([WAIT_MESSAGES.serverHost, WAIT_MESSAGES.serverHost, WAIT_MESSAGES.guest]);+ });+});+```++`server/read-and-draft.test.ts:83`, add `["POST", "/api/internal/waits"], ["GET", "/api/internal/waits"], ["POST", "/api/internal/waits/cancel"]` to the refused list.++- [ ] **Step 2: Run them and see them fail**++Run: `pnpm exec vitest run server/routes/waits.test.ts server/read-and-draft.test.ts`+Expected: `waits.test.ts` FAILS (module missing); `read-and-draft.test.ts` PASSES already (default deny), which is the point of pinning it.++- [ ] **Step 3: Implement `server/routes/waits.ts`** on the `server/routes/helper-tools.ts` shape, with the rules above. `home` defaults to `os.homedir`.++- [ ] **Step 4: Run them and see them pass**++Run: `pnpm exec vitest run server/routes/waits.test.ts server/read-and-draft.test.ts`+Expected: PASS.++- [ ] **Step 5: Commit**++```bash+git add server/routes/waits.ts server/routes/waits.test.ts server/read-and-draft.test.ts+git commit -m "feat(waits): internal route with source, host and ownership checks"+```++---++### Task 6: The three tools and the prompt sentence++**Files:**+- Create: `server/drivers/agents-wait-tools.ts`, `server/drivers/agents-wait-tools.test.ts`+- Modify: `server/drivers/agents-catalog.ts` (import; `...WAIT_TOOL_DEFINITIONS,` right after the `manage_trigger` entry, `:728`)+- Modify: `server/drivers/agents-call.ts:187` (dispatch after the trigger tools)+- Modify: `server/agent-tool-policy.ts:3-16` and `server/agent-tool-policy.test.ts` (`"list_waits"` after `"list_trigger_events"`; `"wait_until"`, `"cancel_wait"` in the never-read-only list)+- Modify: `server/drivers/agents-proxy.test.ts:661` (`"wait_until", "list_waits", "cancel_wait"` after `"manage_trigger"`)+- Modify: `server/drivers/agents-catalog-wire.test.ts` (new test; `BUDGET_BASELINE`, `:70-93`)+- Regenerate: `server/drivers/agents-catalog-goldens/{full.tools-list,profiles,bridged.tools-list,bridged.profiles}.json`+- Modify: `server/system-prompt.ts:211` (`TRIGGER_PROMPT`), `server/system-prompt.test.ts:296`++**Interfaces:**+- Consumes: the route paths and `{ text } | { error }` answers of Task 5.+- Produces: `WAIT_TOOL_NAMES: ReadonlySet<string>`, `callWaitTool(name: string, args: Json, context: ToolCallContext): Promise<ToolCallResult>`, `WAIT_TOOL_DEFINITIONS` (in this order: `wait_until`, `list_waits`, `cancel_wait`).++Definitions (flat, no composition):+- `wait_until`, description: `Tell the person when something happens, with no AI running while you wait: plain code checks a web page for some words (every minute), a file or folder (there, gone or changed), a program (running or stopped), or another bot finishing its work. When it happens a message lands in this chat with a notification; with then, you also carry out then here. Use it instead of staying busy or a short-interval routine. If it is already true nothing is set up and the result says so: tell the person at once. Files and programs are those of the computer OpenMausBot runs on, only when you work on it. A wait stops after hours (default 24, at most 168).` Properties: `label` (string, maxLength 120, `The person's words for it, e.g. "the build finishes".`), `kind` (enum `WAIT_KINDS`, `url_* = a page says or no longer says text; file_* = path exists, is gone or changes; process_* = a program runs or stops; bot_idle = another bot finishes its work.`), `url` (`url_*: the http(s) page.`), `text` (`url_*: the words to look for, any case.`), `path` (`file_*: a full path; ~ is the home folder.`), `process` (`process_*: the program's name, any case, or its process id.`), `bot` (`bot_idle: the other bot's name or id from list_bots.`), `then` (string, maxLength 2000, `Only when the person asked for something to happen then: that request, written for a run that will not see this conversation.`), `hours` (integer, minimum 1, maximum 168). `required: ["label", "kind"]`.+- `list_waits`: `Your waits that have not ended (wait_until): id, label, what it checks, when it was made and when it stops.` No properties.+- `cancel_wait`: `Stop one of your waits; its id comes from list_waits or wait_until's answer.` `id` string minLength 1, required.++Prompt sentence appended to `TRIGGER_PROMPT`: ` To tell the person when something a plain check can see happens (a page says something, a file appears or changes, a program starts or stops, another bot finishes), use wait_until instead of staying busy or making a short-interval routine, and give then only when they asked for something to be done at that moment.`++- [ ] **Step 1: Write the failing tests**++`server/drivers/agents-wait-tools.test.ts` (a fake `client.apiResponse` that records calls):++```ts+it("sends wait_until's arguments unchanged to the waits route and returns its words", async () => {+ reply = { ok: true, status: 201, body: { text: "Waiting for the build (wait id w1)…" } };+ expect(await callWaitTool("wait_until", { label: "the build", kind: "file_exists", path: "/r" }, context)).toEqual({ text: "Waiting for the build (wait id w1)…" });+ expect(calls).toEqual([["/api/internal/waits", { method: "POST", body: JSON.stringify({ label: "the build", kind: "file_exists", path: "/r" }) }]]);+});+it("marks a refusal as an error in the route's words", async () => {+ reply = { ok: false, status: 403, body: { error: "Only the person can set up or stop a wait…" } };+ expect(await callWaitTool("wait_until", {}, context)).toEqual({ text: "Only the person can set up or stop a wait…", isError: true });+});+it("lists with a GET and cancels by id", async () => {+ await callWaitTool("list_waits", {}, context); await callWaitTool("cancel_wait", { id: "w1" }, context);+ expect(calls).toEqual([["/api/internal/waits", undefined], ["/api/internal/waits/cancel", { method: "POST", body: '{"id":"w1"}' }]]);+});+```++`server/drivers/agents-catalog-wire.test.ts`, in the `describe`:++```ts+it("offers the wait tools right after the trigger tools on every profile", () => {+ for (const [name, wire] of Object.entries(wires)) {+ const names = toolsOf(wire).map((tool) => tool.name);+ const at = names.indexOf("manage_trigger");+ expect(names.slice(at + 1, at + 4), name).toEqual(["wait_until", "list_waits", "cancel_wait"]);+ }+});+```++`server/system-prompt.test.ts:296`: `expect(TRIGGER_PROMPT).toContain("use wait_until instead of staying busy or making a short-interval routine");`++Policy and proxy lists as in Files.++- [ ] **Step 2: Run them and see them fail**++Run: `pnpm exec vitest run server/drivers/agents-wait-tools.test.ts server/drivers/agents-catalog-wire.test.ts server/drivers/agents-proxy.test.ts server/agent-tool-policy.test.ts server/system-prompt.test.ts`+Expected: FAIL in each file on the new names.++- [ ] **Step 3: Implement** the driver on the `agents-helper-tools.ts` shape (route map, `apiResponse`, `body.text` / `body.error`), the definitions, the dispatch line, the policy entry and the sentence.++- [ ] **Step 4: Regenerate the goldens and move the budgets**++Run: `UPDATE_AGENTS_CATALOG_GOLDENS=1 pnpm exec vitest run server/drivers/agents-catalog-wire.test.ts server/drivers/agents-bridge-wire.test.ts`+Review the golden diff: only the three tools and the three names in `find_tool`'s description. Three tools do not fit the ±2% budget (the `default` profile is already at 62,220 bytes against 61,361), so set every `BUDGET_BASELINE` entry in `agents-catalog-wire.test.ts` to the new bytes this prints:++```sh+node -e 'for (const [k, v] of Object.entries(require("./server/drivers/agents-catalog-goldens/profiles.json"))) console.log(` "${k}": ${v.bytes},`)'+```++The bridged lists grow only by three names (about 40 bytes, under 2%), so `agents-bridge-wire.test.ts` keeps its baselines; if one fails, set it the same way from `bridged.profiles.json`.++- [ ] **Step 5: Run the driver suites and see them pass**++Run: `pnpm exec vitest run server/drivers server/agent-tool-policy.test.ts server/system-prompt.test.ts`+Expected: PASS.++- [ ] **Step 6: Commit**++```bash+git add server/drivers server/agent-tool-policy.ts server/agent-tool-policy.test.ts server/system-prompt.ts server/system-prompt.test.ts+git commit -m "feat(waits): wait_until, list_waits and cancel_wait in the agents catalog"+```++---++### Task 7: Wire waits into the server++**Files:**+- Modify: `server/index.ts` (imports; `:9028` `joinConversation`; after `:9153` construction; `:9676` undo branch; `:9733` tie to bots; `:11390` two helpers; `:12491`, `:12498`, `:12499` maintenance; `:12850` route instance; `:13425` mount; `:16055` start; `:16117` stop)+- Modify: `server/bot-automations.ts`, `server/bot-automations.test.ts`+- Modify: `server/workspace-backup.ts:29-45`, `server/workspace-backup.test.ts`+- Create: `server/waits.e2e.test.ts`++**Interfaces:**+- Consumes: `WaitManager` (Task 3), `createWaitHost`, `waitRunChat` (Task 4), `createWaitRoutes`, `waitSourceRefusal`, `hostWaitRefusal`, `findWaitPeer`, `WaitRouteContext` (Task 5).+- Produces: `bot-automations.ts` `Automations.waits?: Pick<WaitManager, "removeForBot" | "owners">`: its `owners()` count at start like the other automations' bots, and `removeFor` also calls `waits.removeForBot` (inside the same try/catch loop).++`server/index.ts`, line by line:+1. Two module-level helpers beside `connectorThread` (`:11390`):+ - `function directChatOf(botId: string, threadId: string): boolean` — `connectorThread` exists and has no `group`.+ - `function waitTurnChecks(capability: InternalCapability, sender: BotRecord): Pick<WaitRouteContext, "sourceRefusal" | "hostRefusal" | "peer">` — `sourceRefusal` feeds `waitSourceRefusal` with `owned`/`room` from `connectorThread(sender.id, threadId)`, `depth: capability.depth`, `handedOff: Boolean(capability.roomHandoffId)`, `routineRun: Boolean(activeRoutineRunForThread(threadId))`, `outsideDriven: outsideDrivenThread(threadId)`, `personStarted: turnOrigin(capability).kind === "user"`, `guest: cloudGuestDriven(threadId)`; `hostRefusal` feeds `hostWaitRefusal` with `cloudHome: Boolean(CLOUD_HOME)`, `hosted: HOSTED_WORKSPACE`, `guest`, and `place` = `turnPlaces.get(threadId)` when its `botId` is the sender's, else null; `peer` = `findWaitPeer(reachablePeers(store.bots, sender), sender.id, name)`.+2. After `calendarCalls = new CalendarCallManager(…)`: `const botWaits = new WaitManager(createWaitHost({ store, directChat: directChatOf, threadBusy, wrote: markTaskContextExternallyUpdated, notify, enqueue: (input) => routines!.enqueueWebhook(input), cloudHome: Boolean(CLOUD_HOME) }));` and `store.onChange((change) => { if (change.type === "bot" && store.bot(change.botId)?.busy) botWaits.noteBotBusy(change.botId); });`+3. `joinConversation` first line: `if (run.eventSource === "wait") return waitRunChat(run, directChatOf, Boolean(CLOUD_HOME));`+4. `undoAppliedChange`, before `card.profileRequest`: `else if (card.waitRequest) result = card.undone ? { claimed: true, state: "already_undone" } : botWaits.cancel(card.waitRequest.waitId, botId) ? { claimed: true, state: "undone" } : { claimed: true, state: "invalid", error: "This wait has already ended.", status: 409 };`+5. `tieAutomationsToBots(store, { …, waits: botWaits })`.+6. Maintenance: `!botWaits.isTicking` in `idle`; `botWaits.stop()` in `pause`; `botWaits.start()` inside the `!moveFreeze.frozen()` branch of `resume`.+7. Beside `helperToolRoutes` (`:12850`): `const waitRoutes = createWaitRoutes({ waits: botWaits });`. In the `:13425` chain, after the `helperToolRoutes(…) !== PASS` term: `|| await waitRoutes({ method, path, res, json, botId: internalSender.id, threadId: internalCapability.threadId, readBody: readInternalBody, ...waitTurnChecks(internalCapability, internalSender) }) !== PASS`.+8. `:16055`: start and stop `botWaits` in the same `moveFreeze.hold` as `routines`. `:16117`: `botWaits.stop();`.++`server/workspace-backup.ts`: add `"waits.json"` to `EXCLUDED` with the line comment `// Waits watch this machine's files and programs and end within a week.`++- [ ] **Step 1: Write the failing tests**++`server/bot-automations.test.ts`: extend `fixture` with `waits: { removeForBot: vi.fn(), owners: () => owners.waits ?? [] }` and add++```ts+it("removes a deleted bot's waits, at start and when it is deleted", () => {+ const { automations, emit } = fixture(["scout"], { waits: ["gone", "scout"] });+ emit({ type: "bot.deleted", botId: "scout" });+ expect(automations.waits.removeForBot.mock.calls).toEqual([["gone"], ["scout"]]);+});+```++`server/workspace-backup.test.ts`: `it("leaves waits out of backups and Cloud sends", () => expect(omittedFromWorkspaceBackup("waits.json")).toBe(true));`++`server/waits.e2e.test.ts`, on the `server/chat-widgets.e2e.test.ts` pattern (`launchVerificationServer({ FAKE_CLAUDE_MODE: "slow", FAKE_CLAUDE_SLOW_FINISH_GATE: gate })`, the turn's `OMB_COMMS_TOKEN` from the fake dump, the internal route called with it as Bearer):++```ts+it("waits for a file with no AI, posts once in the asked chat, notifies, and continues there; Cancel on its card stops another", async () => {+ // Scout; control send "Tell me when the report is ready"; token from the dump while the slow turn is open.+ const made = await api("POST", "/api/internal/waits", { label: "the report is ready", kind: "file_exists", path: report, then: "Say the report is ready." }, 201, token);+ expect(made.text).toMatch(/\(wait id [\w-]+\)/);+ writeFileSync(present, "x");+ expect((await api("POST", "/api/internal/waits", { label: "present", kind: "file_exists", path: present }, 200, token)).text).toContain("already. Nothing was set up");+ await api("POST", "/api/internal/waits", { label: "the other file", kind: "file_exists", path: other, then: "Never." }, 201, token);+ const cards = (await transcript()).filter((m) => m.card?.waitRequest);+ expect(cards.map((m) => m.card.title)).toEqual(["Waiting: the report is ready", "Waiting: the other file"]);+ await api("POST", `/api/threads/${bot.threadId}/undo`, { requestId: cards[1].card.requestId }, 200);+ expect((await transcript()).find((m) => m.id === cards[1].id).card).toMatchObject({ undone: true, waitRequest: { settled: "cancelled" } });+ writeFileSync(gate, "finish"); await settledTurn();+ writeFileSync(report, "done"); writeFileSync(other, "x");+ await expect.poll(async () => (await transcript()).filter((m) => m.wait?.status === "fired").map((m) => m.text), { timeout: 30_000 })+ .toEqual([`the report is ready: done. ${report} is there now.`]);+ await expect.poll(async () => (await transcript()).some((m) => m.role === "user" && m.text?.includes("[Wait finished: the report is ready] Say the report is ready.")), { timeout: 40_000 }).toBe(true);+ expect((await api("GET", "/api/notifications")).notifications.filter((n) => n.kind === "wait")).toMatchObject([{ title: "Scout's wait is over" }]);+ await new Promise((resolve) => setTimeout(resolve, 7_000));+ expect((await transcript()).filter((m) => m.wait).length).toBe(1);+}, 120_000);+```++`report`, `present` and `other` are paths in a `mkdtemp` folder; `present` is written before its call.++- [ ] **Step 2: Run them and see them fail**++Run: `pnpm exec vitest run server/bot-automations.test.ts server/workspace-backup.test.ts server/waits.e2e.test.ts`+Expected: FAIL: `waits` is not removed, `waits.json` is backed up, the internal route answers 404.++- [ ] **Step 3: Implement** the changes listed above.++- [ ] **Step 4: Run them and the guards, and see them pass**++Run: `pnpm exec vitest run server/bot-automations.test.ts server/workspace-backup.test.ts server/waits.e2e.test.ts scripts/testing/index-route-ratchet.test.ts && pnpm typecheck && pnpm lint`+Expected: PASS; the ratchet unchanged; typecheck and lint clean.++- [ ] **Step 5: Commit**++```bash+git add server/index.ts server/bot-automations.ts server/bot-automations.test.ts server/workspace-backup.ts server/workspace-backup.test.ts server/waits.e2e.test.ts+git commit -m "feat(waits): run waits in the server, tie them to bots, keep them out of backups"+```++---++### Task 8: The card's line with Cancel++**Files:**+- Modify: `src/components/ApprovalCard.tsx:128-187` (`appliedChange`) and `:190-260` (`AppliedChangeLine` button label)+- Modify: `src/locales/en.json` (`"approval.applied.wait": "{name} is waiting for {title}"`, beside `approval.applied.teamMemory`; English only, other packs fall back)+- Test: `src/components/ApprovalCard.test.ts`++**Interfaces:**+- Consumes: `OptionCardData.waitRequest` (Task 4); the undo route (Task 7 step 4).+- Produces: `appliedChange` returns `{ line: string; canUndo: boolean; undoLabel?: LocaleKey }`; a wait card gives `{ line: t("approval.applied.wait", { name, title: label }), canUndo: !settled, undoLabel: "common.cancel" }`; `AppliedChangeLine` shows `t(summary.undoLabel ?? "approval.applied.undo")`.++- [ ] **Step 1: Write the failing test**++```ts+it("shows a wait with a follow-up as one line with Cancel, and no Cancel once it ended", () => {+ const message = (settled?: "fired") => ({ id: "m1", at: 1, role: "bot", kind: "options", card: { title: "Waiting: the build finishes", subtitle: "When the build finishes, Pepper will: Deploy it.",+ options: [], answered: "allow", dismissed: true, autoApplied: true, requestId: "w1", tool: "wait_until",+ waitRequest: { waitId: "w1", label: "the build finishes", then: "Deploy it.", ...(settled ? { settled } : {}) } } }) as Message;+ const open = renderToStaticMarkup(createElement(ApprovalCard, { bot: { name: "Pepper" }, message: message(), threadId: "t1" }));+ expect(open).toContain("Pepper is waiting for the build finishes");+ expect(open).toContain(">Cancel<");+ expect(renderToStaticMarkup(createElement(ApprovalCard, { bot: { name: "Pepper" }, message: message("fired"), threadId: "t1" }))).not.toContain(">Cancel<");+});+```++- [ ] **Step 2: Run it and see it fail**++Run: `pnpm exec vitest run src/components/ApprovalCard.test.ts`+Expected: FAIL: the card renders as an approval box, not one line.++- [ ] **Step 3: Implement** the branch and the label.++- [ ] **Step 4: Run it and the locale check, and see them pass**++Run: `pnpm exec vitest run src/components/ApprovalCard.test.ts && pnpm i18n:check && pnpm typecheck`+Expected: PASS.++- [ ] **Step 5: Commit**++```bash+git add src/components/ApprovalCard.tsx src/components/ApprovalCard.test.ts src/locales/en.json+git commit -m "feat(waits): a wait's card reads as one line with Cancel"+```++---++### Task 9: Verification recipe, run against a fixture++**Files:**+- Create: `docs/verification/waits.md`+- Modify: `docs/verification/README.md` (one line in "Drive", after "Proactive routines and the brief": `- [Waits: tell me when, with no AI while waiting](waits.md)`)+- Modify: `scripts/mcp-server.ts:714` (`projectMessage` also returns `...(message.wait ? { wait: message.wait } : {})`, so `messages` shows it)++**Interfaces:**+- Consumes: everything above; the fake engine's `FAKE_CLAUDE_TOOL_CALLS_FILE` with `"server": "agents"` (`server/testing/fake-claude-cli.ts:31-32`, `:1000`).++- [ ] **Step 1: Write `docs/verification/waits.md`**++Sections: what a wait is (two sentences, link to the spec); **Automated checks** (`pnpm exec vitest run server/wait-probes.test.ts server/waits.test.ts server/wait-host.test.ts server/routes/waits.test.ts server/drivers/agents-wait-tools.test.ts server/waits.e2e.test.ts src/components/ApprovalCard.test.ts`); **In a fixture**, these commands:++```sh+W=$(mktemp -d)+printf '[{"server":"agents","name":"wait_until","input":{"label":"the report is ready","kind":"file_exists","path":"%s/report.txt","then":"Say the report is ready."}}]' "$W" > "$W/calls.json"+FAKE_CLAUDE_TOOL_CALLS_FILE="$W/calls.json" node --experimental-strip-types scripts/control-omb.ts launch+```++Second terminal (same `W`):++```sh+pnpm control:omb new-bot --name Pepper --url http://127.0.0.1:PORT+pnpm control:omb send --bot BOT_ID --text "Tell me when report.txt is there, then say so" --url http://127.0.0.1:PORT+pnpm control:omb wait --bot BOT_ID --timeout 30 --url http://127.0.0.1:PORT+pnpm control:omb messages --bot BOT_ID --limit 10 --url http://127.0.0.1:PORT+echo '[]' > "$W/calls.json"; touch "$W/report.txt"; sleep 25+pnpm control:omb wait --bot BOT_ID --timeout 60 --url http://127.0.0.1:PORT+pnpm control:omb messages --bot BOT_ID --limit 10 --url http://127.0.0.1:PORT+curl -s http://127.0.0.1:PORT/api/notifications+sleep 10; pnpm control:omb messages --bot BOT_ID --limit 10 --url http://127.0.0.1:PORT+```++Expected, written into the doc: after the first `messages`, a `wait_until` tool row that succeeded and a card titled `Waiting: the report is ready`; after the touch, exactly one bot line `the report is ready: done. <W>/report.txt is there now.` carrying `"wait": { "status": "fired" }`, then a user line `[Wait finished: the report is ready] Say the report is ready.` and the fake engine's reply; one notification with `"kind": "wait"` and `"title": "Pepper's wait is over"`; the last `messages` still shows one fired line. **What it does not prove**: the desktop card's Cancel button (Task 8's test and the e2e undo call cover it), phones, a real page on the internet. **Cleanup**: Ctrl-C the launcher; `rm -r "$W"`. **Last exercised**: filled in Step 2.++- [ ] **Step 2: Run the recipe and record it**++Run every command in the doc against a fresh fixture. Under **Last exercised**, write the date, the fixture's printed log path, and the JSON of the fired line, the follow-up user line and the `wait` notification.+Expected: every expectation in the doc holds.++- [ ] **Step 3: Full check**++Run: `pnpm typecheck && pnpm lint && pnpm exec vitest run server/wait-probes.test.ts server/waits.test.ts server/wait-host.test.ts server/routes/waits.test.ts server/drivers server/agent-tool-policy.test.ts server/system-prompt.test.ts server/notify.test.ts server/routines.test.ts server/bot-automations.test.ts server/workspace-backup.test.ts server/read-and-draft.test.ts src/components/ApprovalCard.test.ts src/components/NotificationsPanel.test.ts scripts/testing/index-route-ratchet.test.ts server/waits.e2e.test.ts`+Expected: all PASS.++- [ ] **Step 4: Commit**++```bash+git add docs/verification/waits.md docs/verification/README.md scripts/mcp-server.ts+git commit -m "docs(verification): waits recipe, exercised against a fixture"+```diff --git a/docs/superpowers/specs/2026-10-27-waits-design.md b/docs/superpowers/specs/2026-10-27-waits-design.mdnew file mode 100644index 0000000000..42221cf84d--- /dev/null+++ b/docs/superpowers/specs/2026-10-27-waits-design.md@@ -0,0 +1,148 @@+# Waits: "tell me when…" that costs nothing while it waits++Date: 2026-10-27 · Branch: `feat/bot-waits` · Idea source: Atticus "Watch for me" (SaarthurR/atticus-mac, MIT). We take the idea, not the code.++## Why++"Tell me when the build finishes", "watch this page until it says shipped",+"let me know when Coder is done". Today a bot can only do this by staying in a+turn (burning tokens) or by a routine that wakes the AI every 5 minutes or more.+The AI should be needed twice: once to set the wait up, once (optionally) to+act when it fires. In between, plain code checks.++## Goals++- Three bot tools: `wait_until`, `list_waits`, `cancel_wait`.+- A server loop checks each wait's condition with no AI.+- When it fires: a message in the chat where it was asked, an unread badge, a+ notification. If the bot was given a follow-up, the bot continues in that+ same chat with it.+- Waits expire (default 24 h, at most 7 days) and say so when they do.++## Non-goals (v1)++- Arbitrary shell commands as conditions (they would run unattended every few+ seconds).+- Reading windows on the person's screen (needs a computer claim outside a+ turn, which the control gate refuses by design).+- A waits list in the UI. People ask the bot ("what are you waiting for?").+- Phone push (the harness side does not exist yet); phones get the normal+ notification frame and feed.++## Anti-goals++- Any model call between set-up and firing.+- Hammering a website: URL checks are at least 60 s apart, with backoff.+- Reaching private network addresses through URL checks.+- A wait that outlives its bot.++## Naming++"Watch" is taken (`watch.json` is the proactive brief; "Keep an eye on my day"+and the Watcher bot exist). Everything here is "wait".++## Conditions (`kind`)++| kind | fields | check | every |+|---|---|---|---|+| `url_contains` / `url_missing` | `url`, `text` | GET, tags stripped, case-insensitive substring | 60 s, backoff to 15 min on errors |+| `file_exists` / `file_missing` | `path` | stat | 5 s |+| `file_changed` | `path` | size or mtime differs from creation | 5 s |+| `process_running` / `process_gone` | `process` (name, case-insensitive exact; or pid) | process list | 5 s |+| `bot_idle` | `bot` (name or id of another bot) | that bot has no running turn | 5 s |++URL checks: http(s) only. `addressClass` classifies an IP, not a name, so the+check resolves the host itself, refuses private and loopback answers, and+connects to the address it checked (no second lookup). 15 s timeout, 2 MB cap,+no cookies, no redirects to a refused address. Paths accept `~`.++File and process checks look at the machine the server runs on. They are+offered only when that is the bot's own computer: refused for bots working in a+Local VM, VPS or Cloud Boat, in Cloud homes and for Cloud guests. URL and+`bot_idle` work everywhere (my call).++`bot_idle` fires the next time that bot goes from working to idle in any chat+after the wait was made. If it is idle when asked, the wait waits for it to+start and then finish (my call; avoids "already done" before a hand-off+starts).+If a condition is already true when asked, `wait_until` creates nothing and+says so, so the bot answers right away.++## Tools (agents catalog)++`wait_until {label, kind, url?, text?, path?, process?, bot?, then?, hours?}`+(flat schema). `label` is the person's words for it ("the build finishes").+`then` is an optional request the bot runs when it fires. `hours` defaults to+24, max 168. Limits: 10 active waits per bot, 50 total; over the limit the tool+says which waits exist.++`list_waits {}` (read-only): this bot's active waits with label, condition,+created and expiry.++`cancel_wait {id}`: only the bot's own waits.++Listing (after #3773 and #3786, which made the agents tool list smaller): every+turn outside a room lists `wait_until`, with a short description (the kinds,+no AI while waiting, `follow_up`, 1 to 168 hours) and compact schema; its+result explains the rest. `list_waits` and `cancel_wait` act only on the+chat's own waits, so they are listed only while the bot has a wait in this+chat that has not ended (`OMB_ACTIVE_WAITS`, from+`WaitManager.count(botId, threadId)`): the next turn in that chat sees them,+and a wait in another chat lists nothing here. Without one they still answer+a call, directly or through `use_tool`. A room's turn is never listed+`wait_until` or `cancel_wait`, which rooms refuse; since no wait is made in a+room, it is not listed `list_waits` either.++The handler takes bot and chat from the internal capability token (never from+arguments) and stores those, never the token. Waits can be made only from a+direct chat turn the person started, with the same guest and outside-driven+checks `create_trigger` runs; rooms, routine runs and peer asks are refused (my+call).++A wait with `then` is a one-off automation the bot wrote, so it is treated like+one (my call): creating it posts the same kind of visible card a new routine+gets, with Cancel; and the follow-up runs as an automation (outside+provenance, like a routine run) that joins the source chat, the way+`limit_reset` runs continue where the person asked. A prompt-injected `then`+never runs with the person's own authority. Tools sit beside the trigger+tools with the same availability as `create_trigger`. One sentence in the+system prompt's trigger paragraph tells bots to use `wait_until` instead of+staying busy or making a short-interval routine.++## Firing (`server/waits.ts`)++`WaitManager` on the `CalendarCallManager` pattern: `DATA_DIR/waits.json`, mode+0600, zod schema, atomic writes with rollback, a 5 s tick, per-kind intervals,+paused with the other automations during workspace maintenance, removed with+its bot through `bot-automations.ts`. Probes are pure functions in+`server/wait-probes.ts`.++When a wait fires:++1. `appendMessage(sourceThread, {role:"bot", kind:"text", text:"<label>: done.+ <detail>", wait:{id, status:"fired"}})`, `patchTask(unread)`, and+ `notify(buildNotification("wait", …))` (new `NotifyKind`).+2. If `then` is set: queue it as an automation run with event source `wait`+ (`routines.enqueueWebhook`, widened), joining the source chat, with+ `"[Wait finished: <label>] <then>"` as the prompt. Retries, deferral when the+ chat is busy and failure notices come with it.++On expiry: a quiet message "Stopped waiting for <label> after N hours." and no+follow-up.++## Testing++- Probes: each kind against temp files, a spawned process, a local HTTP server+ (with the egress check injected so tests can reach it), a fake bot registry.+- Manager: create/limit/expire/cancel; fire posts once and only once; restart+ keeps waits; bot deletion removes them; URL backoff; maintenance pause.+- Tools: catalog goldens and budgets regenerated; token-scoped ownership+ (another bot cannot cancel); "already true" returns without creating.+- Fixture: the fake engine calls `wait_until file_exists`; touch the file; the+ chat gets the message and the follow-up turn starts.++## Left to the builder++Message and notification copy, the exact process-list command per platform,+route module layout, whether `bot_idle` reads running turns from the event bus+or the turn registry.diff --git a/docs/verification/README.md b/docs/verification/README.mdindex 2bee042d5b..4272548a5d 100644--- a/docs/verification/README.md+++ b/docs/verification/README.md@@ -64,6 +64,7 @@ Use only mapped, tested commands:- [Taking control of a bot's computer](take-control.md)- [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)- [A new Cloud's first hour](first-hour.md)- [Chat widgets](widgets.md)- [Reactions](reactions.md)diff --git a/docs/verification/waits.md b/docs/verification/waits.mdnew file mode 100644index 0000000000..d5640acf6e--- /dev/null+++ b/docs/verification/waits.md@@ -0,0 +1,106 @@+# Waits: tell me when, with no AI while waiting++A wait is a condition a bot sets up once ("tell me when report.txt is there"); plain server+code checks it on a timer, and no model runs until it fires. See the+[design](../superpowers/specs/2026-10-27-waits-design.md).++## Automated checks++```sh+pnpm exec vitest run server/wait-probes.test.ts server/waits.test.ts server/wait-host.test.ts server/routes/waits.test.ts server/drivers/agents-wait-tools.test.ts server/bot-moves.test.ts server/move-freeze.test.ts server/waits.e2e.test.ts src/components/ApprovalCard.test.ts+```++## In a fixture++The fake engine calls `wait_until` on every turn it runs, the follow-up turn too. That+turn was started by the wait, not by the person, so its `wait_until` is refused: a wait+never renews itself.++```sh+W=$(mktemp -d)+printf '[{"server":"agents","name":"wait_until","input":{"label":"the report","kind":"file_exists","path":"%s/report.txt","follow_up":"Say the report is ready."}}]' "$W" > "$W/calls.json"+FAKE_CLAUDE_TOOL_CALLS_FILE="$W/calls.json" node --experimental-strip-types scripts/control-omb.ts launch+```++Second terminal (same `W`; `DATA` is the `dataDir` the launcher printed):++```sh+pnpm control:omb new-bot --name Pepper --url http://127.0.0.1:PORT+pnpm control:omb send --bot BOT_ID --text "Tell me when report.txt is there, then say so" --url http://127.0.0.1:PORT+pnpm control:omb wait --bot BOT_ID --timeout 30 --url http://127.0.0.1:PORT+pnpm control:omb messages --bot BOT_ID --limit 12 --url http://127.0.0.1:PORT+touch "$W/report.txt"; sleep 25+pnpm control:omb wait --bot BOT_ID --timeout 60 --url http://127.0.0.1:PORT+pnpm control:omb messages --bot BOT_ID --limit 12 --url http://127.0.0.1:PORT+curl -s http://127.0.0.1:PORT/api/notifications+cat "$DATA/waits.json"+sleep 10; pnpm control:omb messages --bot BOT_ID --limit 12 --url http://127.0.0.1:PORT+```++Expected:++- After the first `messages`: a `wait_until` tool row with `"ok": true`, and one+ `options` card titled `Waiting: the report` with the subtitle+ `Then Pepper will: Say the report is ready.`+- After the `touch`: exactly one bot line `the report: done. <W>/report.txt is there now.`+ carrying `"wait": { "id": "...", "status": "fired" }`, then a user line+ `[Wait finished: the report] Say the report is ready.`, then that turn's `wait_until`+ row with `"ok": false` (refused: "Only the person can set up or stop a wait, in their+ own chat with you; …"), and the fake engine's reply.+- Still one `options` card: the refused call made no second wait.+- `waits.json` holds `"waits": []`.+- One notification with `"kind": "wait"` and `"title": "Pepper's wait is over"`.+- The last `messages` still shows one fired line.++**What it does not prove:** the desktop card's Cancel button and its ended lines (the+card test and the e2e undo call cover them), phones, a Cloud home, a real page on the+internet, and what a real model does with the follow-up (the fake engine replies+`hello from fake claude` regardless of the prompt).++**Cleanup:** Ctrl-C the launcher; `rm -r "$W"`.++## Last exercised++2026-10-28, Node 24, branch `feat/bot-waits` at `4fc4ef0bb`, fixture log+`/var/folders/7b/15jj691d4tj_7vq99cqvwgbr0000gn/T/openmausbot-verification-evidence/server-1793162265419-23568.log`.+Every expectation above held. The lines below are abridged: only these fields of each+message are kept, and `<W>` stands for the temp dir.++`wait_until` answer in the person's turn:++```text+Waiting for the report (wait id 8fef1e72-d37f-41f2-bb8d-a8b015ebe237): plain checks, no AI, until 2026-10-29T04:38:07.391Z. When it happens a message lands in this chat, and you will then do what you wrote in follow_up. Tell the person in one sentence; do not keep checking yourself.+```++The card, read from `/api/threads/THREAD_ID/messages` after it fired:++```json+{"title": "Waiting: the report", "subtitle": "Then Pepper will: Say the report is ready.", "answered": "allow", "dismissed": true, "waitRequest": {"waitId": "8fef1e72-d37f-41f2-bb8d-a8b015ebe237", "label": "the report", "followUp": "Say the report is ready.", "settled": "fired"}}+```++From the fired line on:++```json+{"role": "bot", "kind": "text", "text": "the report: done. <W>/report.txt is there now.", "wait": {"id": "8fef1e72-d37f-41f2-bb8d-a8b015ebe237", "status": "fired"}}+{"role": "user", "kind": "text", "text": "[Wait finished: the report] Say the report is ready."}+{"role": "bot", "kind": "activity", "tool": {"name": "wait_until", "ok": false, "spoken": "running wait_until"}}+{"role": "bot", "kind": "text", "text": "hello from fake claude"}+```++The refused call's result, from the chat's event log:++```text+Only the person can set up or stop a wait, in their own chat with you; work handed to you by a bot, a routine or an outside event cannot.+```++`waits.json` after:++```json+{"version": 1, "waits": []}+```++Wait notification (the two turns also left their own `"kind": "done"` notifications):++```json+{"kind": "wait", "botName": "Pepper", "title": "Pepper's wait is over", "body": "the report: done. <W>/report.txt is there now.", "read": false}+```diff --git a/scripts/mcp-message-projection.ts b/scripts/mcp-message-projection.tsindex ec40e5250d..10f334f49c 100644--- a/scripts/mcp-message-projection.ts+++ b/scripts/mcp-message-projection.ts@@ -70,7 +70,7 @@ export function projectMessage(message: Record<string, any>) {...(card ? { card } : {}),...(connector ? { connector } : {}),...(secret ? { secret } : {}),- ...(signIn ? { signIn } : {}), ...(message.widget ? { widget: message.widget } : {}), ...(message.app ? { app: message.app } : {}), ...(message.fromApp ? { fromApp: message.fromApp } : {}),+ ...(signIn ? { signIn } : {}), ...(message.widget ? { widget: message.widget } : {}), ...(message.app ? { app: message.app } : {}), ...(message.fromApp ? { fromApp: message.fromApp } : {}), ...(message.wait ? { wait: message.wait } : {}),...(message.kind === "screen" ? { hasImage: Boolean(message.hasImage || message.png) } : {}),};}diff --git a/server/agent-tool-policy.test.ts b/server/agent-tool-policy.test.tsindex 9756d4da74..a0f431093f 100644--- a/server/agent-tool-policy.test.ts+++ b/server/agent-tool-policy.test.ts@@ -13,6 +13,7 @@ describe("built-in agent tool read policy", () => {"session_search","tool_result_read","trigger_info",+ "list_waits","skills_list","list_unread_notifications",]);@@ -32,7 +33,7 @@ describe("built-in agent tool read policy", () => {// These post into the chat: never read-only."attach_file", "show_widget", "update_widget", "show_html", "update_html","create_bot", "request_credential", "request_sign_in", "memory_update", "trigger", "delete_trigger", "create_trigger",- "manage_trigger", "memory_log", "manage_room", "create_room", "propose_profile", "skill_manage",+ "manage_trigger", "memory_log", "manage_room", "create_room", "wait_until", "cancel_wait", "propose_profile", "skill_manage",// Read through their action tools, never as read-only names of their own."list_triggers", "list_trigger_events", "session_read","propose_team_setup", "propose_bot_deletion",diff --git a/server/agent-tool-policy.ts b/server/agent-tool-policy.tsindex f32fad7fa8..d7487571e5 100644--- a/server/agent-tool-policy.ts+++ b/server/agent-tool-policy.ts@@ -10,6 +10,7 @@ export const READ_ONLY_AGENT_TOOL_NAMES: ReadonlySet<string> = new Set(["session_search","tool_result_read","trigger_info",+ "list_waits","skills_list","list_unread_notifications",]);diff --git a/server/agents-bridge-names.ts b/server/agents-bridge-names.tsindex b671a2d993..f6972815c1 100644--- a/server/agents-bridge-names.ts+++ b/server/agents-bridge-names.ts@@ -8,7 +8,7 @@ import { availableTools } from "./drivers/agents-catalog.ts";/** Every catalog tool's name, whoever may call it, and every alias a call may still use. */export const CATALOG_TOOL_NAMES: ReadonlySet<string> = new Set([...availableTools({skillAuthoring: true, sharedComputers: true, voiceNotes: true, xResearch: true, escalations: true, team: true,- computerSelection: true, cloudHome: false, chief: true, mausbot: true, botId: WATCHER_OPTIONS_CARD_BOT_ID,+ computerSelection: true, activeWaits: true, cloudHome: false, chief: true, mausbot: true, botId: WATCHER_OPTIONS_CARD_BOT_ID,}).map((tool) => tool.name), ...Object.keys(AGENTS_TOOL_ALIASES)]);/** A call's name with a bridged call read as the tool it ran. With `serverNamed`, only a title that namesdiff --git a/server/bot-automations.test.ts b/server/bot-automations.test.tsindex 778c8f39a8..4563ced7f3 100644--- a/server/bot-automations.test.ts+++ b/server/bot-automations.test.ts@@ -2,7 +2,7 @@ import { describe, expect, it, vi } from "vitest";import { tieAutomationsToBots } from "./bot-automations.ts";-function fixture(bots: string[], owners: { routines?: string[]; runs?: string[]; webhooks?: string[]; apps?: string[] }) {+function fixture(bots: string[], owners: { routines?: string[]; runs?: string[]; webhooks?: string[]; apps?: string[]; waits?: string[] }) {let listener: ((change: { type: string; botId?: string }) => void) | undefined;const store = {bots: bots.map((id) => ({ id })),@@ -15,6 +15,7 @@ function fixture(bots: string[], owners: { routines?: string[]; runs?: string[];},webhooks: { removeForBot: vi.fn(), list: () => (owners.webhooks ?? []).map((botId) => ({ botId })) },apps: { remove: vi.fn(async (_id: string) => true), list: () => (owners.apps ?? []).map((botId, index) => ({ id: `app-${index}`, botId })) },+ waits: { removeForBot: vi.fn(), owners: () => owners.waits ?? [] },};tieAutomationsToBots(store, automations as never);return { automations, emit: (change: { type: string; botId?: string }) => listener!(change) };@@ -56,4 +57,10 @@ describe("a bot's automations live and die with it", () => {await vi.waitFor(() => expect(error).toHaveBeenCalledTimes(1));error.mockRestore();});++ it("removes a deleted bot's waits, at start and when it is deleted", () => {+ const { automations, emit } = fixture(["scout"], { waits: ["gone", "scout"] });+ emit({ type: "bot.deleted", botId: "scout" });+ expect(automations.waits.removeForBot.mock.calls).toEqual([["gone"], ["scout"]]);+ });});diff --git a/server/bot-automations.ts b/server/bot-automations.tsindex 539f5456c8..b299358877 100644--- a/server/bot-automations.ts+++ b/server/bot-automations.ts@@ -1,6 +1,7 @@-// A bot's schedules, webhooks and app events live and die with it, however the bot is deleted.+// A bot's schedules, webhooks, app events and waits live and die with it, however the bot is deleted.import type { AppTriggerManager } from "./app-triggers.ts";import type { RoutineManager } from "./routines.ts";+import type { WaitManager } from "./waits.ts";import type { WebhookManager } from "./webhooks.ts";interface Automations {@@ -8,6 +9,7 @@ interface Automations {webhooks: Pick<WebhookManager, "removeForBot" | "list">;/** App events: removing one also releases its watch on the connected-apps service. */apps?: Pick<AppTriggerManager, "list" | "remove">;+ waits?: Pick<WaitManager, "removeForBot" | "owners">;}interface Bots {@@ -17,7 +19,7 @@ interface Bots {}function removeFor(botId: string, automations: Automations): void {- for (const remove of [() => automations.routines.removeForBot(botId), () => automations.webhooks.removeForBot(botId)]) {+ for (const remove of [() => automations.routines.removeForBot(botId), () => automations.webhooks.removeForBot(botId), () => automations.waits?.removeForBot(botId)]) {// A save that fails here leaves an orphan that never runs; the next start removes it.try { remove(); } catch (error) { console.error(`automations: could not remove deleted bot ${botId}'s automations yet`, error); }}@@ -31,7 +33,7 @@ function removeFor(botId: string, automations: Automations): void {export function tieAutomationsToBots(store: Bots, automations: Automations): void {if (store.bots.length) {const owners = [...automations.routines.listRoutines(), ...automations.routines.listRuns(), ...automations.webhooks.list(), ...automations.apps?.list() ?? []];- for (const botId of new Set(owners.map((owner) => owner.botId))) if (!store.bot(botId)) removeFor(botId, automations);+ for (const botId of new Set([...owners.map((owner) => owner.botId), ...automations.waits?.owners() ?? []])) if (!store.bot(botId)) removeFor(botId, automations);}store.onChange((change) => {if (change.type === "bot.deleted" && change.botId) removeFor(change.botId, automations);diff --git a/server/bot-moves.test.ts b/server/bot-moves.test.tsindex f2d97c578d..7f53d330f1 100644--- a/server/bot-moves.test.ts+++ b/server/bot-moves.test.ts@@ -1,11 +1,27 @@-import { describe, expect, it } from "vitest";+import { mkdtempSync, rmSync } from "node:fs";+import { tmpdir } from "node:os";+import { join } from "node:path";+import { afterEach, describe, expect, it } from "vitest";import { assertBotHere, botMoveRefusal, createBotMoves } from "./bot-moves.ts";import type { BotRecord } from "./store.ts";+import { WaitManager } from "./waits.ts";++const dirs: string[] = [];+afterEach(() => { for (const dir of dirs.splice(0)) rmSync(dir, { recursive: true, force: true }); });const ACME = { id: "team-acme", name: "Acme" };-function setup({ busy = false } = {}) {+function waitsFor(settled: string[][]) {+ const dir = mkdtempSync(join(tmpdir(), "omb-bot-moves-"));+ dirs.push(dir);+ return new WaitManager({+ file: join(dir, "waits.json"), probes: { stamp: async () => null }, sourceAlive: () => true, botBusy: () => false,+ post: () => true, followUp: () => undefined, showCard: (wait) => `card-${wait.label}`, settleCard: (wait, how) => { settled.push([wait.label, how]); },+ });+}++function setup({ busy = false, waits = null as WaitManager | null } = {}) {const bots = new Map<string, Record<string, unknown>>([["scout", { id: "scout", name: "Scout" }], ["pip", { id: "pip", name: "Pip" }]]);const routines = [{ id: "brief", botId: "scout", enabled: true }, { id: "weekly", botId: "scout", enabled: false }, { id: "pips", botId: "pip", enabled: true },@@ -22,6 +38,7 @@ function setup({ busy = false } = {}) {removeForBot: (botId: string) => { removed.push(botId); for (let i = routines.length - 1; i >= 0; i--) if (routines[i]!.botId === botId) routines.splice(i, 1); } }),webhooks: () => ({ list: () => hooks as never, update: (id: string, patch: unknown) => Object.assign(hooks.find((hook) => hook.id === id)!, patch as object) as never }),appEvents: () => ({ list: () => events as never, update: async (id: string, patch: unknown) => Object.assign(events.find((event) => event.id === id)!, patch as object) as never }),+ waits: () => waits,busy: () => busy,now: () => 1_000,});@@ -67,4 +84,19 @@ describe("My Cloud holding a bot while it moves into a team", () => {expect(removed, "once").toEqual(["scout"]);expect(moves.moved("pip", ACME)).toEqual({ refused: "This bot is not moving to that team." });});++ it("cancels the moving bot's waits, card and all, so none fires for a bot that lives in the team; other bots keep theirs", async () => {+ const settled: string[][] = [];+ const waits = waitsFor(settled);+ const made = (botId: string, label: string) => waits.create({ botId, threadId: `t-${botId}`, label, condition: { kind: "file_exists", path: `/${label}` }, followUp: "Tell them." });+ await made("scout", "the report"); await made("pip", "the build");+ const { moves } = setup({ waits });+ await moves.hold("scout", ACME);+ expect(waits.all().map((wait) => wait.botId)).toEqual(["pip"]);+ expect(settled).toEqual([["the report", "cancelled"]]);+ await made("scout", "the invoice");+ moves.moved("scout", ACME);+ expect(waits.all().map((wait) => wait.botId)).toEqual(["pip"]);+ expect(settled).toEqual([["the report", "cancelled"], ["the invoice", "cancelled"]]);+ });});diff --git a/server/bot-moves.ts b/server/bot-moves.tsindex 649e96d1c4..4397d29831 100644--- a/server/bot-moves.ts+++ b/server/bot-moves.ts@@ -6,6 +6,7 @@ import type { BotMovedTo } from "../shared/wire.ts";import type { AppTriggerManager } from "./app-triggers.ts";import type { RoutineManager } from "./routines.ts";import type { BotRecord } from "./store.ts";+import type { WaitManager } from "./waits.ts";import type { WebhookManager } from "./webhooks.ts";export interface BotMovesDeps {@@ -13,6 +14,7 @@ export interface BotMovesDeps {routines(): Pick<RoutineManager, "listRoutines" | "update" | "removeForBot"> | null;webhooks(): Pick<WebhookManager, "list" | "update"> | null;appEvents(): Pick<AppTriggerManager, "list" | "update"> | null;+ waits(): Pick<WaitManager, "all" | "cancel"> | null;/** A turn or a routine run of this bot is going. */busy(botId: string): boolean;now?: () => number;@@ -49,10 +51,14 @@ export function createBotMoves(deps: BotMovesDeps) {else if (kind === "app-event") await deps.appEvents()?.update(id, { enabled: on });}const movedOf = (bot: BotRecord | null | undefined): Held | undefined => (bot as (BotRecord & { movedTo?: Held }) | null | undefined)?.movedTo;+ const cancelWaits = (botId: string) => {+ const waits = deps.waits();+ for (const wait of waits?.all() ?? []) if (wait.botId === botId) waits!.cancel(wait.id, botId);+ };return {- /** The bot stops here for the move: no turns, its automations off. Busy while it answers; a bot already moved stays- * moved. Holding it again keeps what the first hold switched off. */+ /** The bot stops here for the move: no turns, its automations off and its waits cancelled. Busy while it answers; a+ * bot already moved stays moved. Holding it again keeps what the first hold switched off. */async hold(botId: string, team: Team): Promise<{ movedTo: Held } | { busy: string } | { refused: string }> {const bot = deps.store.bot(botId);if (!bot) return { refused: "This bot is no longer here." };@@ -71,6 +77,7 @@ export function createBotMoves(deps: BotMovesDeps) {deps.store.patchBot(botId, { movedTo: { ...next, held: [...off] } } as Partial<BotRecord>);await switchTo(automation.key, false);}+ cancelWaits(botId);return { movedTo: movedOf(deps.store.bot(botId))! };},/** The move stopped before the bot arrived: it is here again as it was, its automations back on. */@@ -83,13 +90,14 @@ export function createBotMoves(deps: BotMovesDeps) {deps.store.patchBot(botId, { movedTo: undefined } as Partial<BotRecord>);return { released: true };},- /** The bot lives in the team now: archived here as the line that opens it there, its routines gone from here. */+ /** The bot lives in the team now: archived here as the line that opens it there, its routines and waits gone from here. */moved(botId: string, team: Team): { movedTo: Held } | { refused: string } {const bot = deps.store.bot(botId);const held = movedOf(bot);if (!bot || !held || held.team.id !== team.id) return { refused: "This bot is not moving to that team." };if (held.state !== "moved") {deps.routines()?.removeForBot(botId);+ cancelWaits(botId);deps.store.patchBot(botId, { movedTo: { ...held, state: "moved", at: now() }, hidden: true } as Partial<BotRecord>);}return { movedTo: movedOf(deps.store.bot(botId))! };diff --git a/server/cloud-power.ts b/server/cloud-power.tsindex 1b6b8ca61a..f0eeac95bc 100644--- a/server/cloud-power.ts+++ b/server/cloud-power.ts@@ -17,8 +17,8 @@ export interface CloudPowerReport {v: 1; at: number; bootedAt: number; wokeAt: number;idle: boolean; busy: CloudPowerBusy[];lastActivityAt: number | null; lastWorkAt: number | null;- /** The earliest scheduled run (an enabled routine's next run or a queued run's retry), null when none: the Admin- * starts a sleeping home a minute before it. */+ /** The earliest scheduled run (an enabled routine's next run or a queued run's retry, or 30 minutes on while a bot+ * waits for something), null when none: the Admin starts a sleeping home a minute before it. */nextDueAt: number | null;/** The home said yes to a sleep request and has not been used or woken since. */sleeping: boolean;diff --git a/server/cloud-send-arrived.test.ts b/server/cloud-send-arrived.test.tsindex a01a553720..1067aea03c 100644--- a/server/cloud-send-arrived.test.ts+++ b/server/cloud-send-arrived.test.ts@@ -96,6 +96,7 @@ describe("POST /api/cloud-send/automations-off", () => {calls: () => ({ list: () => of("call").map(({ id: call, value }) => ({ id: call, nextRunAt: value ? 1 : null })), switchOff: (call: string) => { on.set(`call:${call}`, false); return true; } }),webhooks: () => ({ list: () => of("webhook").map(({ id: hook, value }) => ({ id: hook, enabled: value })), update: turnOff("webhook") }),appEvents: () => ({ list: () => of("app-event").map(({ id: trigger, value }) => ({ id: trigger, enabled: value })), update: turnOff("app-event") }),+ waits: () => null,} as unknown as MoveAutomations;return { on, deps };}diff --git a/server/drivers/agents-call.ts b/server/drivers/agents-call.tsindex 00c86757ae..631e7dafca 100644--- a/server/drivers/agents-call.ts+++ b/server/drivers/agents-call.ts@@ -14,6 +14,7 @@ import { boundedAgentResult } from "./agents-result.ts";import { outOfBounds } from "./agents-schema.ts";import { callResearchTool, RESEARCH_TOOL_NAMES } from "./agents-research-tools.ts";import { callHelperTool, HELPER_TOOL_NAMES } from "./agents-helper-tools.ts";+import { callWaitTool, WAIT_TOOL_NAMES } from "./agents-wait-tools.ts";import { callMausBotTool, MAUSBOT_TOOL_NAMES } from "./agents-mausbot-tools.ts";import { callPageTool, PAGE_TOOL_NAMES } from "./agents-pages-tools.ts";import { callPersonTool, PERSON_TOOL_NAMES } from "./agents-person-tools.ts";@@ -209,6 +210,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);// Second lock: with sharing off the catalog already omits these tools.if (SHARED_COMPUTER_TOOL_NAMES.has(name) && !context.sharedComputers) {return { text: "Computer sharing is turned off in this workspace. There are no shared computers to use.", isError: true };diff --git a/server/drivers/agents-catalog-goldens/bridged.profiles.json b/server/drivers/agents-catalog-goldens/bridged.profiles.jsonindex 95816c5418..18fb8d7fa4 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": 16182,- "sha256": "9b5afc9fc8ae91e75f9d20ab838cbdca0cb77ad5f3b19648a59c7206208270e1",+ "bytes": 16194,+ "sha256": "a5686d95df45b86914b49e4783ae5b26f8986af4bf73276ee21cf7b67713645d","tools": ["tool_result_read","list_room_targets",@@ -21,8 +21,8 @@]},"voice": {- "bytes": 16963,- "sha256": "d15547d8df84844808fc492504ee797829de367d4ca5436f7d03c30556afd518",+ "bytes": 16975,+ "sha256": "0c70a42d2cfbb6e9fe9a4023a457d21cf00da10426423462a814c392011ae7df","tools": ["tool_result_read","list_room_targets",@@ -43,8 +43,8 @@]},"shared": {- "bytes": 16222,- "sha256": "3526dc3b2bc3910d3da42aa3b8f5dedcaad65d580f3be64ec14423c613926850",+ "bytes": 16234,+ "sha256": "18aa56063d9e27afe7fa8116839b61259518ffa12f6875db10ebcd1a083230ab","tools": ["tool_result_read","list_room_targets",@@ -64,8 +64,8 @@]},"shared+voice": {- "bytes": 17003,- "sha256": "ffe1ac827297f41a877f82765b77f636e537ee24aef6d00329db471d5c2f6496",+ "bytes": 17015,+ "sha256": "a6041694ea70ba49d03d4ff453992de5d9dd14c6a4ed0e1b9d9830ff29f840c4","tools": ["tool_result_read","list_room_targets",@@ -86,8 +86,8 @@]},"skills": {- "bytes": 16209,- "sha256": "26420432bb62eee2b1642a7a7f060854229ac5e0dcbeb2e70312f4c7499984ba",+ "bytes": 16221,+ "sha256": "a3701d06e1eb0aa0096ffb806d7780f03d015771d7d51b3323dedb184df4a534","tools": ["tool_result_read","list_room_targets",@@ -107,8 +107,8 @@]},"skills+voice": {- "bytes": 16990,- "sha256": "3fb27ecce75dfb493bfe0061d194d186608bfaea291c867eeba53b9e7f225673",+ "bytes": 17002,+ "sha256": "31981dba5bbc7b4b6a381efab249b3df072c7019ff0264ed70d0ac69588dbdcf","tools": ["tool_result_read","list_room_targets",@@ -129,8 +129,8 @@]},"skills+shared": {- "bytes": 16249,- "sha256": "f339942881eb42d74d39671b353b040f7c4a5e43ea93b666d432a86bda4456c0",+ "bytes": 16261,+ "sha256": "a73c9c906eb3c58c52f8b4b2b41fba68754634ff1abc13309d49d8eb3a765b01","tools": ["tool_result_read","list_room_targets",@@ -150,8 +150,8 @@]},"skills+shared+voice": {- "bytes": 17030,- "sha256": "aaa5ea3aba96c136998bcd19a71bfd90544c4eb74191e12c28a7fff23d86bd3e",+ "bytes": 17042,+ "sha256": "66c3d261f0b65b77629ba03fbfabf6987205809909e66211bd3be2ed776b9b3c","tools": ["tool_result_read","list_room_targets",@@ -172,8 +172,8 @@]},"non-chief": {- "bytes": 16065,- "sha256": "9dd6da99b2a1e789f921ee837547cdd890fafb9bbc962e5e2a8ac6bd61117e74",+ "bytes": 16077,+ "sha256": "0c53c56a8581f978d47300f4a3dffcd27e41c5105bcc2a9471ca9fa317765c00","tools": ["tool_result_read","list_room_targets",@@ -193,8 +193,8 @@]},"voice+non-chief": {- "bytes": 16846,- "sha256": "83c3f5d3d86def6ace667d5b39698f6dd543fe8e4c955353ca069a958044b749",+ "bytes": 16858,+ "sha256": "ec0f09bee675f4e68ebd2bb6ee0c96a9942116122102eed882d33754145b550e","tools": ["tool_result_read","list_room_targets",@@ -215,8 +215,8 @@]},"shared+non-chief": {- "bytes": 16105,- "sha256": "c9baa50c66e08d10f7941788173d17de4ac713ec06e8d1c10178c597ab04a83a",+ "bytes": 16117,+ "sha256": "5c26dc9f463fb47747ce79ce2d1e51464e737b3fa9189985eda15941383baabd","tools": ["tool_result_read","list_room_targets",@@ -236,8 +236,8 @@]},"shared+voice+non-chief": {- "bytes": 16886,- "sha256": "ea64c03c02f1149ca7879e2b89d496500f00e1a9a06de89b5dd74455a9203c1c",+ "bytes": 16898,+ "sha256": "23b268356e721f49bd8edfa69a1d5f25105eb4f5f6b45d3b334e250102dc02f1","tools": ["tool_result_read","list_room_targets",@@ -258,8 +258,8 @@]},"skills+non-chief": {- "bytes": 16092,- "sha256": "07f88cd25c15e30975eaf25ebbe8f0c7c92a8c6688273e84d14bb0611f8d5f19",+ "bytes": 16104,+ "sha256": "648ddae4b113569ece691ecc4f08eb9b7f5ad0a5e70cb542c421e8b0b50edf0e","tools": ["tool_result_read","list_room_targets",@@ -279,8 +279,8 @@]},"skills+voice+non-chief": {- "bytes": 16873,- "sha256": "830e6a32b4647c24e7949ad766736954bd805eb307f9abe26d3e9d77e7e75f80",+ "bytes": 16885,+ "sha256": "b2d8519f3beb2c21a2b0087721915787e4408cf20a9d986e2adcfa107b0cbe43","tools": ["tool_result_read","list_room_targets",@@ -301,8 +301,8 @@]},"skills+shared+non-chief": {- "bytes": 16132,- "sha256": "44074f4eb37a85ba00b683b28a63549d820fe67e8e7ea0eed22f03b97c3d799d",+ "bytes": 16144,+ "sha256": "f760025d87b8595e6a2218ee8e24314a5c4ef8c0e9adf925d12e3d8bca1c5cea","tools": ["tool_result_read","list_room_targets",@@ -322,8 +322,8 @@]},"skills+shared+voice+non-chief": {- "bytes": 16913,- "sha256": "657d9f4cc25cd13804d4f4f0c14de086d8139adb10831f73ea473a244d1c1adb",+ "bytes": 16925,+ "sha256": "7a1239d6ddadd1c5564784018de306c2f2beafdb5d5c79811a304ccd2d7b2e5f","tools": ["tool_result_read","list_room_targets",@@ -344,8 +344,8 @@]},"skills+shared+voice+cloud-home": {- "bytes": 17028,- "sha256": "52d6e08d0b0916e9f2d5ea9a58fdb231067d1774ec7072310600799fe55a2ac0",+ "bytes": 17040,+ "sha256": "d118cdb958f6358cf1204dbdbb576a9561ce1a8e6b500eb64ba086ea8490e8e7","tools": ["tool_result_read","list_room_targets",@@ -366,8 +366,8 @@]},"skills+shared+voice+non-chief+cloud-home": {- "bytes": 16911,- "sha256": "a00049ca86cb608be9b7c36cd96af9b6e89c5e0a216cb39013aa1ebdd23fe970",+ "bytes": 16923,+ "sha256": "f3b089f063234f60518beaec477ccce4d0a30bff4855a30f673879641117ea03","tools": ["tool_result_read","list_room_targets",@@ -388,8 +388,8 @@]},"skills+shared+voice+escalations": {- "bytes": 17048,- "sha256": "02022a7b41ede2a5b8b17d3e4969fe7b26e239703bd132f9edfe3b651a9cbe25",+ "bytes": 17060,+ "sha256": "88499d977512c6472be1719cfd2d9e0c6f8786b1f125c58810dbd6c2465c946f","tools": ["tool_result_read","list_room_targets",@@ -410,8 +410,8 @@]},"skills+shared+voice+escalations+x": {- "bytes": 17109,- "sha256": "a6c9ec97fcd010ab966508f6445e7734008648798a72b51b2c3b35188396e919",+ "bytes": 17121,+ "sha256": "eaff0c51f59ef56649178f7005cca5a5013b2cda156a92a701fb656e96878e97","tools": ["tool_result_read","list_room_targets",@@ -432,8 +432,8 @@]},"skills+shared+voice+escalations+x+team": {- "bytes": 17125,- "sha256": "4c6f3f5707e682f8966e7f5a12f5fd8dd5a3c30a47291e2b2c4c1bf191f47796",+ "bytes": 17137,+ "sha256": "736ff88df3c197844ed36d47c267e34fde791d1ec5328e2800d39a14e29457dd","tools": ["tool_result_read","list_room_targets",@@ -454,8 +454,8 @@]},"default+legacy-switches": {- "bytes": 16182,- "sha256": "9b5afc9fc8ae91e75f9d20ab838cbdca0cb77ad5f3b19648a59c7206208270e1",+ "bytes": 16194,+ "sha256": "a5686d95df45b86914b49e4783ae5b26f8986af4bf73276ee21cf7b67713645d","tools": ["tool_result_read","list_room_targets",@@ -475,8 +475,8 @@]},"default+mausbot": {- "bytes": 16234,- "sha256": "15d15e19d8354bcd56bc4c986aa0dd56b0b7814ed2faf3ded6bc42428fd9ebc9",+ "bytes": 16246,+ "sha256": "196b9a8cdc89f27cef7aca09b212643dde6b5e4845e722b8c7e2c3896600ab7d","tools": ["tool_result_read","list_room_targets",@@ -496,8 +496,8 @@]},"skills+shared+voice+mausbot": {- "bytes": 17082,- "sha256": "6729583c68d601a739c20ebc0ca896546dab15d75754208b91aaf87d2127ceb1",+ "bytes": 17094,+ "sha256": "b418afc6c98f43f49c6109c6b129a35b47fea7981d4a11d78af9982dfe2ec5b0","tools": ["tool_result_read","list_room_targets",@@ -518,8 +518,8 @@]},"default+handoff": {- "bytes": 14970,- "sha256": "e8b1ef16bc202a97bb76b66fd3c693db30dce6c70482fa2a365d31bec959d17c",+ "bytes": 14982,+ "sha256": "aed068b7fe762d93ee726468d6bfeead92be485d93dc9c08dc3c0571d7004137","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 10154491fb..37bc91834b 100644--- a/server/drivers/agents-catalog-goldens/bridged.tools-list.json+++ b/server/drivers/agents-catalog-goldens/bridged.tools-list.json@@ -373,7 +373,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, raise_escalation, list_threads, close_thread, start_thread, 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, message_person, report_bug, retry_thread, memory_log, session_search, trigger_info, trigger, delete_trigger, propose_profile, propose_model, propose_team_memory, skills_list, skill_manage, add_mcp_server.",+ "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, raise_escalation, list_threads, close_thread, start_thread, 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, message_person, report_bug, retry_thread, memory_log, session_search, trigger_info, trigger, delete_trigger, wait_until, propose_profile, propose_model, propose_team_memory, skills_list, skill_manage, add_mcp_server.","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 6a8d9e0604..8fb2174a28 100644--- a/server/drivers/agents-catalog-goldens/full.tools-list.json+++ b/server/drivers/agents-catalog-goldens/full.tools-list.json@@ -1509,6 +1509,61 @@]}},+ {+ "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).",+ "inputSchema": {+ "type": "object",+ "additionalProperties": false,+ "properties": {+ "label": {+ "type": "string",+ "maxLength": 120,+ "description": "A noun phrase in the person's words, e.g. \"the build\"."+ },+ "kind": {+ "type": "string",+ "enum": [+ "url_contains",+ "url_missing",+ "file_exists",+ "file_missing",+ "file_changed",+ "process_running",+ "process_gone",+ "bot_idle"+ ],+ "description": "url_*: the page at url has or lacks text. file_*: path exists, is gone or changes. process_*: process (name or pid) runs or stops. bot_idle: bot (name or id) finishes its work."+ },+ "url": {+ "type": "string"+ },+ "text": {+ "type": "string"+ },+ "path": {+ "type": "string"+ },+ "process": {+ "type": "string"+ },+ "bot": {+ "type": "string"+ },+ "follow_up": {+ "type": "string",+ "description": "Only if the person asked for something to be done then: that request, for a run that won't see this chat. You carry it out here."+ },+ "hours": {+ "type": "integer"+ }+ },+ "required": [+ "label",+ "kind"+ ]+ }+ },{"name": "propose_profile","description": "Submit user-requested changes to your own name, title, description, standing instructions (SOUL.md), working folder (cwd), or your alert and voice toggles (notifications, speakReplies). Keep SOUL.md short — who you are and the rules you never break; put step-by-step procedure into a skill instead. A Chief of Staff may pass for_bot_id (from list_bots) for a requested change to another bot in its section. Read the result: it applies immediately at every access level, and the person sees it with an Undo where possible. If applied, continue the work without another confirmation. Only a pending result (a Cloud conversation its owner did not drive) means ending the turn to wait for the owner. Never claim success without an applied result; report failures honestly. This does not elevate another bot's execution permissions.",diff --git a/server/drivers/agents-catalog-goldens/profiles.json b/server/drivers/agents-catalog-goldens/profiles.jsonindex 2409bcfce7..33f2aa5bcd 100644--- a/server/drivers/agents-catalog-goldens/profiles.json+++ b/server/drivers/agents-catalog-goldens/profiles.json@@ -1,7 +1,7 @@{"default": {- "bytes": 54959,- "sha256": "055422a9aaf5ec5e4186cc42b2d530b7a1ae542db924c8e254827c6d7ce7980a",+ "bytes": 56030,+ "sha256": "277330b3463508a9839dedd0dd99533fee12dd87441d0c344f0dd4d839b7e005","tools": ["tool_result_read","list_room_targets",@@ -39,6 +39,7 @@"trigger_info","trigger","delete_trigger",+ "wait_until","propose_profile","propose_model","propose_team_memory",@@ -46,8 +47,8 @@]},"voice": {- "bytes": 55740,- "sha256": "507daf75784f03268963e22c49b4a9321e6634ade4d0fa7a8682d3e9b371c165",+ "bytes": 56811,+ "sha256": "d09ec1ba3563c2870f1ab963c12d8e39b304ac62f3409dac85380c73ce9d3f19","tools": ["tool_result_read","list_room_targets",@@ -86,6 +87,7 @@"trigger_info","trigger","delete_trigger",+ "wait_until","propose_profile","propose_model","propose_team_memory",@@ -93,8 +95,8 @@]},"shared": {- "bytes": 57059,- "sha256": "340e648d28159f149df68d2af0c8c26be2ba41bc84501b3bf7f8e84e4c5c8c09",+ "bytes": 58130,+ "sha256": "13711eda72a72fd8088bf8175a318dffe4fdbf6b097c2e132b7a7e7f16f5b858","tools": ["tool_result_read","list_shared_computers",@@ -134,6 +136,7 @@"trigger_info","trigger","delete_trigger",+ "wait_until","propose_profile","propose_model","propose_team_memory",@@ -141,8 +144,8 @@]},"shared+voice": {- "bytes": 57840,- "sha256": "9b9a77ab731549e72c3f10575c9673f7975c17b8852012c232a92ce40420a29c",+ "bytes": 58911,+ "sha256": "dd12ef0aa9fee6d8000afcd19eaab3442547e0317c6b0e66f10a0633df7d6801","tools": ["tool_result_read","list_shared_computers",@@ -183,6 +186,7 @@"trigger_info","trigger","delete_trigger",+ "wait_until","propose_profile","propose_model","propose_team_memory",@@ -190,8 +194,8 @@]},"skills": {- "bytes": 57778,- "sha256": "011d5c2a43c040517c5793d3e0afc1ed83af6999598fe9b58fc534ea7c46946b",+ "bytes": 58849,+ "sha256": "615ce770723a8d54f2239c307399edc88e1f120da635c0434dd5807c6a081a36","tools": ["tool_result_read","list_room_targets",@@ -229,6 +233,7 @@"trigger_info","trigger","delete_trigger",+ "wait_until","propose_profile","propose_model","propose_team_memory",@@ -238,8 +243,8 @@]},"skills+voice": {- "bytes": 58559,- "sha256": "757b6157211d61fdc5c5a6e3711efa15078036fc71573d3981a01684dd884524",+ "bytes": 59630,+ "sha256": "f57b83c6f2e67c8cfcb91ee96fe7e8573995e5a36d595cbbd0289c55a8806fbf","tools": ["tool_result_read","list_room_targets",@@ -278,6 +283,7 @@"trigger_info","trigger","delete_trigger",+ "wait_until","propose_profile","propose_model","propose_team_memory",@@ -287,8 +293,8 @@]},"skills+shared": {- "bytes": 59878,- "sha256": "713a1fdf33ade7c6a8fbfd8482510b15ec70728d09e243fff97c9ea434f3e84e",+ "bytes": 60949,+ "sha256": "528b685195e1a5c4e5756f37b0d4fc9efa30584fa0a192d4f78a0a117b51c6a4","tools": ["tool_result_read","list_shared_computers",@@ -328,6 +334,7 @@"trigger_info","trigger","delete_trigger",+ "wait_until","propose_profile","propose_model","propose_team_memory",@@ -337,8 +344,8 @@]},"skills+shared+voice": {- "bytes": 60659,- "sha256": "ab8a04727a3631e0f938f6c28baf61ebbc50ee1f276ac3efcff4a4667d0f637e",+ "bytes": 61730,+ "sha256": "53f8f3d36d5baae695a581c106fe1d7e083de7c6da05f058754b999474f5c476","tools": ["tool_result_read","list_shared_computers",@@ -379,6 +386,7 @@"trigger_info","trigger","delete_trigger",+ "wait_until","propose_profile","propose_model","propose_team_memory",@@ -388,8 +396,8 @@]},"non-chief": {- "bytes": 45902,- "sha256": "c81fde7f83c9cc2616423edce06eb67891e402cda312d5c8af03e35aedbe8580",+ "bytes": 46973,+ "sha256": "73b31997bda74dce6110eca0cc661711f471ec0303aaddd794f0942182f56c5d","tools": ["tool_result_read","list_room_targets",@@ -420,6 +428,7 @@"trigger_info","trigger","delete_trigger",+ "wait_until","propose_profile","propose_model","propose_team_memory",@@ -427,8 +436,8 @@]},"voice+non-chief": {- "bytes": 46683,- "sha256": "3be621aef5aef0d1c6b173c361e30065454f78a98d058f846f53d40b23857c58",+ "bytes": 47754,+ "sha256": "b057caa85cd409fc246a90da38ac28d65b4115b11065c9b27dd53276e2c6f161","tools": ["tool_result_read","list_room_targets",@@ -460,6 +469,7 @@"trigger_info","trigger","delete_trigger",+ "wait_until","propose_profile","propose_model","propose_team_memory",@@ -467,8 +477,8 @@]},"shared+non-chief": {- "bytes": 48002,- "sha256": "a160b5ab569a346d80ae6cd3e4ee62fbf42f0c172b135d2801410cff5f32f028",+ "bytes": 49073,+ "sha256": "3447a9645994d6b098f9d674dccee5a7c6c920c703afc7ac8a9fd221a8c3d791","tools": ["tool_result_read","list_shared_computers",@@ -501,6 +511,7 @@"trigger_info","trigger","delete_trigger",+ "wait_until","propose_profile","propose_model","propose_team_memory",@@ -508,8 +519,8 @@]},"shared+voice+non-chief": {- "bytes": 48783,- "sha256": "241f04f836848f263bb2004141fd117ad6864d8b2bf457eefbb8d300071debb6",+ "bytes": 49854,+ "sha256": "f32c3b3b80e6440f8827b451022566a12e431f57b810d4f48f551fbb672e3e58","tools": ["tool_result_read","list_shared_computers",@@ -543,6 +554,7 @@"trigger_info","trigger","delete_trigger",+ "wait_until","propose_profile","propose_model","propose_team_memory",@@ -550,8 +562,8 @@]},"skills+non-chief": {- "bytes": 48721,- "sha256": "62dff75e2edd7198cb9f7e3153faa06a91751860dce39ca0cda2b9502de724ff",+ "bytes": 49792,+ "sha256": "f0c3446e8bae858de81a94f54a0cc7a10f008ab1f8e02255818daad25b5447fd","tools": ["tool_result_read","list_room_targets",@@ -582,6 +594,7 @@"trigger_info","trigger","delete_trigger",+ "wait_until","propose_profile","propose_model","propose_team_memory",@@ -591,8 +604,8 @@]},"skills+voice+non-chief": {- "bytes": 49502,- "sha256": "c9808496e1c9a368ec30b29b769a5173eeb958db5287e301d948fd9257c19dbf",+ "bytes": 50573,+ "sha256": "634141dec1f2bf3babe3be74285d53fadd38d9267012a201ef35709bcaed46ea","tools": ["tool_result_read","list_room_targets",@@ -624,6 +637,7 @@"trigger_info","trigger","delete_trigger",+ "wait_until","propose_profile","propose_model","propose_team_memory",@@ -633,8 +647,8 @@]},"skills+shared+non-chief": {- "bytes": 50821,- "sha256": "f65fcc8f4d1ae46fd6bc51945e4537400de17b2cfa12bcdc81a5b0b8c1b0ba24",+ "bytes": 51892,+ "sha256": "bc114b25482e4f2dba7d78a674c6a3db8d89e35288b2fd48657eb968652d1e86","tools": ["tool_result_read","list_shared_computers",@@ -667,6 +681,7 @@"trigger_info","trigger","delete_trigger",+ "wait_until","propose_profile","propose_model","propose_team_memory",@@ -676,8 +691,8 @@]},"skills+shared+voice+non-chief": {- "bytes": 51602,- "sha256": "49b1ab5e4f0cf33cbc6693c3af01c722550cc25b5d0c98814ec260b4d8df3c32",+ "bytes": 52673,+ "sha256": "7971f0d71c3015ede83f7afed5783b451c367f552fa22b94b477b227708a99c6","tools": ["tool_result_read","list_shared_computers",@@ -711,6 +726,7 @@"trigger_info","trigger","delete_trigger",+ "wait_until","propose_profile","propose_model","propose_team_memory",@@ -720,8 +736,8 @@]},"skills+shared+voice+cloud-home": {- "bytes": 59740,- "sha256": "c3974afd740694f3c9885c87f5a7ab5699094eee33f6cb576ff6b9d701b8dbac",+ "bytes": 60811,+ "sha256": "3cf72cdd6b27ea665cf9f3b4e61ad176800d9676eda9887d9ffb5512a2b1bda7","tools": ["tool_result_read","list_shared_computers",@@ -761,6 +777,7 @@"trigger_info","trigger","delete_trigger",+ "wait_until","propose_profile","propose_model","propose_team_memory",@@ -770,8 +787,8 @@]},"skills+shared+voice+non-chief+cloud-home": {- "bytes": 50683,- "sha256": "d1a468b6b78ae421c6a4a70626e9f0e52eff48eef31f3d4ec423ab90be588154",+ "bytes": 51754,+ "sha256": "ccc7d02a98e2fe73f779ad942d24086087422dc8cd4cbfcbb069df71ec4bfca0","tools": ["tool_result_read","list_shared_computers",@@ -804,6 +821,7 @@"trigger_info","trigger","delete_trigger",+ "wait_until","propose_profile","propose_model","propose_team_memory",@@ -813,8 +831,8 @@]},"skills+shared+voice+escalations": {- "bytes": 61489,- "sha256": "1621a44231e9746de5be6853e478f7641b917dca1a03ed5e122adb9a38cd0766",+ "bytes": 62560,+ "sha256": "ca57b486a33ad1b0000b4376d53a0064fdc457d39db0db232bafe9c7429b37f8","tools": ["tool_result_read","list_shared_computers",@@ -856,6 +874,7 @@"trigger_info","trigger","delete_trigger",+ "wait_until","propose_profile","propose_model","propose_team_memory",@@ -865,8 +884,8 @@]},"skills+shared+voice+escalations+x": {- "bytes": 65328,- "sha256": "7cfaac75f29302b3f28d4b773de58f41834351df23c0eb19f560cc133ffc2e0f",+ "bytes": 66399,+ "sha256": "2e74581168c148752b6868a1a6a867d6bc6565eb19cfbf0e0ab4750247a9e830","tools": ["tool_result_read","list_shared_computers",@@ -912,6 +931,7 @@"trigger_info","trigger","delete_trigger",+ "wait_until","propose_profile","propose_model","propose_team_memory",@@ -921,8 +941,8 @@]},"skills+shared+voice+escalations+x+team": {- "bytes": 65960,- "sha256": "79316b6456b7b7f21822f5b9bc815b0e893c49c2184ebcc68a3de45f85286b65",+ "bytes": 67031,+ "sha256": "11a74db0c69f231adf07e342c12f71baf70f53a7735c1a510a887f125927def1","tools": ["tool_result_read","list_shared_computers",@@ -969,6 +989,7 @@"trigger_info","trigger","delete_trigger",+ "wait_until","propose_profile","propose_model","propose_team_memory",@@ -978,8 +999,8 @@]},"default+legacy-switches": {- "bytes": 54959,- "sha256": "055422a9aaf5ec5e4186cc42b2d530b7a1ae542db924c8e254827c6d7ce7980a",+ "bytes": 56030,+ "sha256": "277330b3463508a9839dedd0dd99533fee12dd87441d0c344f0dd4d839b7e005","tools": ["tool_result_read","list_room_targets",@@ -1017,6 +1038,7 @@"trigger_info","trigger","delete_trigger",+ "wait_until","propose_profile","propose_model","propose_team_memory",@@ -1024,8 +1046,8 @@]},"default+mausbot": {- "bytes": 55610,- "sha256": "a387f46716678cc043ef0f629dc9c7c824897181ad276651cf088201dad761a2",+ "bytes": 56681,+ "sha256": "1612054aaa6e02ee99e882b4e73a0261d6f6e6a97525a95af1a5c0969147e324","tools": ["tool_result_read","list_room_targets",@@ -1063,6 +1085,7 @@"trigger_info","trigger","delete_trigger",+ "wait_until","propose_profile","propose_model","propose_team_memory",@@ -1072,8 +1095,8 @@]},"skills+shared+voice+mausbot": {- "bytes": 61310,- "sha256": "c2615cf8b4a26ec7b8df9b2eba7907955013216db9a86798f6bae46335e26a4c",+ "bytes": 62381,+ "sha256": "f649b8271cda9d3ca42e9a4ec77204cc17b76015b2df338a9df4e1c9d0a7b354","tools": ["tool_result_read","list_shared_computers",@@ -1114,6 +1137,7 @@"trigger_info","trigger","delete_trigger",+ "wait_until","propose_profile","propose_model","propose_team_memory",@@ -1125,8 +1149,8 @@]},"default+handoff": {- "bytes": 53747,- "sha256": "ac3d1d2f86d5ca9dd0d70353089b0ce5b4d48cb771311ca1dce7d0a7e675be47",+ "bytes": 54818,+ "sha256": "b0110b0824bf7ebbd2332e690e4a20406068dfcb9869e865e313a0520b22f925","tools": ["tool_result_read","list_room_targets",@@ -1163,6 +1187,7 @@"trigger_info","trigger","delete_trigger",+ "wait_until","propose_profile","propose_model","propose_team_memory",diff --git a/server/drivers/agents-catalog-profile.ts b/server/drivers/agents-catalog-profile.tsindex 2a587a822b..d61dfeff83 100644--- a/server/drivers/agents-catalog-profile.ts+++ b/server/drivers/agents-catalog-profile.ts@@ -22,8 +22,11 @@ export interface CatalogProfile {/** A person's own request that may pick its computer: select_computer is mounted. Every other turn (a hand-off, a* routine, a room, a continuation) is refused a selection, so it is not shown the tool. */computerSelection?: boolean;- /** A room's turn: the widget and page tools, which rooms refuse, are not mounted. */+ /** A room's turn: the widget and page tools and wait_until and cancel_wait, which rooms refuse, are not mounted. */room?: boolean;+ /** The bot has a wait in this chat that has not ended: list_waits and cancel_wait, which act only on this chat's+ * waits, are mounted. Without one they still answer a call (agents-catalog.ts callableTools), but are not listed. */+ activeWaits?: boolean;}/** Everything is off unless the harness says "1". */@@ -42,5 +45,6 @@ export function catalogProfileFromEnv(env: NodeJS.ProcessEnv): CatalogProfile {mausbot: env.OMB_MAUSBOT === "1",computerSelection: env.OMB_COMPUTER_SELECTION === "1",room: env.OMB_ROOM === "1",+ activeWaits: env.OMB_ACTIVE_WAITS === "1",};}diff --git a/server/drivers/agents-catalog-wire.test.ts b/server/drivers/agents-catalog-wire.test.tsindex f6d6e1a550..55d1f24e97 100644--- a/server/drivers/agents-catalog-wire.test.ts+++ b/server/drivers/agents-catalog-wire.test.ts@@ -87,16 +87,16 @@ const BUDGET_BASELINE: Record<string, number> = {"skills+voice": 58559,"skills+shared": 59878,"skills+shared+voice": 60659,- "non-chief": 45902,- "voice+non-chief": 46683,- "shared+non-chief": 48002,- "shared+voice+non-chief": 48783,- "skills+non-chief": 48721,- "skills+voice+non-chief": 49502,- "skills+shared+non-chief": 50821,- "skills+shared+voice+non-chief": 51602,+ "non-chief": 46055,+ "voice+non-chief": 46821,+ "shared+non-chief": 48113,+ "shared+voice+non-chief": 48879,+ "skills+non-chief": 48818,+ "skills+voice+non-chief": 49583,+ "skills+shared+non-chief": 50876,+ "skills+shared+voice+non-chief": 51641,"skills+shared+voice+cloud-home": 59740,- "skills+shared+voice+non-chief+cloud-home": 50683,+ "skills+shared+voice+non-chief+cloud-home": 50741,"default+legacy-switches": 54959,"default+mausbot": 55610,"skills+shared+voice+mausbot": 61310,@@ -187,6 +187,24 @@ describe("agents proxy tools/list golden", () => {expect(wire).toBe(JSON.stringify(golden));});+ it("offers wait_until right after the trigger tools, outside a room, and list_waits and cancel_wait only to a bot with a wait", () => {+ for (const [name, wire] of Object.entries(wires)) {+ const names = toolsOf(wire).map((tool) => tool.name);+ const at = names.indexOf("delete_trigger");+ expect(at, name).toBeGreaterThan(-1);+ const waits = PROFILES[name]!.env.OMB_ROOM === "1" ? [] : ["wait_until"];+ expect(names.slice(at + 1, at + 1 + waits.length), name).toEqual(waits);+ expect(names.filter((tool) => /wait/.test(tool) && tool !== "assignment_status"), name).toEqual(waits);+ }+ const waiting = (name: string) => availableTools(catalogProfileFromEnv({ OMB_BOT_ID: "bot-golden", ...PROFILES[name]!.env, OMB_ACTIVE_WAITS: "1" }));+ for (const name of Object.keys(PROFILES)) {+ const names = waiting(name).map((tool) => tool.name);+ const room = PROFILES[name]!.env.OMB_ROOM === "1";+ expect(names.filter((tool) => /wait/.test(tool) && tool !== "assignment_status"), name).toEqual(room ? ["list_waits"] : ["wait_until", "list_waits", "cancel_wait"]);+ expect(names.filter((tool) => tool !== "list_waits" && tool !== "cancel_wait"), name).toEqual(toolsOf(wires[name]!).map((tool) => tool.name));+ }+ });+it("every profile matches its pinned tool names, byte count and sha256", () => {expect(manifestOf(wires)).toEqual(readJson(manifestPath));});@@ -292,11 +310,12 @@ describe("agents proxy tools/list golden", () => {const names = (name: string) => toolsOf(wires[name]!).map((tool) => tool.name);expect(names("default+handoff")).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", "show_widget", "show_html"].includes(tool)));+ expect(names(`${name}+room`), name).toEqual(names(name).filter((tool) => !["select_computer", "show_widget", "show_html", "wait_until", "cancel_wait"].includes(tool)));}for (const [name, profile] of Object.entries(PROFILES)) {expect(names(name).includes("select_computer"), name).toBe(profile.env.OMB_COMPUTER_SELECTION === "1");expect(names(name).includes("show_widget"), name).toBe(profile.env.OMB_ROOM !== "1");+ expect(names(name).includes("wait_until"), name).toBe(profile.env.OMB_ROOM !== "1");}});diff --git a/server/drivers/agents-catalog.ts b/server/drivers/agents-catalog.tsindex 0326d7df45..86a9acdd9d 100644--- a/server/drivers/agents-catalog.ts+++ b/server/drivers/agents-catalog.ts@@ -5,6 +5,7 @@ import { agentToolAnnotations } from "../agent-tool-policy.ts";import { CHAT_CARD_TOOL_DEFINITIONS } from "./agents-chat-card-tools.ts";import { DEVS_TOOL_DEFINITIONS } from "./agents-devs-tools.ts";import { HELPER_TOOL_DEFINITIONS } from "./agents-helper-tools.ts";+import { ROOM_REFUSED_WAIT_TOOL_NAMES, WAIT_TOOL_DEFINITIONS, WAITING_ONLY_TOOL_NAMES } from "./agents-wait-tools.ts";import { MAUSBOT_TOOL_DEFINITIONS } from "./agents-mausbot-tools.ts";import { PERSON_TOOL_DEFINITIONS, PERSON_TOOL_NAMES } from "./agents-person-tools.ts";import { RESEARCH_TOOL_DEFINITIONS, RESEARCH_TOOL_NAMES } from "./agents-research-tools.ts";@@ -642,6 +643,7 @@ const TOOL_DEFINITIONS = [required: ["trigger_id"],},},+ ...WAIT_TOOL_DEFINITIONS,{name: "propose_profile",description:@@ -864,8 +866,8 @@ const CHIEF_TARGET_TOOL_NAMES = new Set(["propose_profile", "propose_model"]);const WATCHER_TOOL_NAMES = new Set(["create_options_card"]);const LOCAL_VM_TOOL_NAMES = new Set(["vm_exec"]);-/** Refused in a room's thread (chat-widgets.ts, chat-apps.ts). */-const CHAT_CARD_TOOL_NAMES = new Set(["show_widget", "show_html"]);+/** Refused in a room's thread (chat-widgets.ts, chat-apps.ts, routes/waits.ts). */+const ROOM_REFUSED_TOOL_NAMES = new Set(["show_widget", "show_html", ...ROOM_REFUSED_WAIT_TOOL_NAMES]);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.",@@ -881,6 +883,12 @@ export function availableTools(profile: CatalogProfile) {return placed.map((tool) => ({ ...tool, inputSchema: advertisedSchema(tool.inputSchema, tool.description) }));}+/** What a turn may call: what it is listed, and list_waits and cancel_wait, left off the list only while the bot has no+ * wait in this chat. A wait made this turn, or a list read before it ended, still reaches them; the route scopes each call. */+export function callableTools(profile: CatalogProfile) {+ return availableTools({ ...profile, activeWaits: true });+}+const FULL_INPUT_SCHEMAS = new Map<string, unknown>([...TOOL_DEFINITIONS, ...MAUSBOT_TOOL_DEFINITIONS].map((tool) => [tool.name, tool.inputSchema]));/** A tool's input schema as the catalog writes it, before tools/list leaves anything out: what every call is held to. */@@ -895,7 +903,8 @@ function catalogTools(profile: CatalogProfile) {(profile.escalations === true || tool.name !== "raise_escalation") &&(profile.team === true || !PERSON_TOOL_NAMES.has(tool.name)) &&(profile.computerSelection === true || tool.name !== "select_computer") &&- (profile.room !== true || !CHAT_CARD_TOOL_NAMES.has(tool.name)));+ (profile.room !== true || !ROOM_REFUSED_TOOL_NAMES.has(tool.name)) &&+ (profile.activeWaits === true || !WAITING_ONLY_TOOL_NAMES.has(tool.name)));const AUTHORING_TOOLS = profile.skillAuthoring? BOT_SCOPED_TOOLS: BOT_SCOPED_TOOLS.filter((tool) => !SKILL_TOOL_NAMES.has(tool.name));diff --git a/server/drivers/agents-mcp-env.ts b/server/drivers/agents-mcp-env.tsindex e439bfcb0e..a23759241d 100644--- a/server/drivers/agents-mcp-env.ts+++ b/server/drivers/agents-mcp-env.ts@@ -4,4 +4,4 @@ import { TOOL_LIMIT_ENV } from "../tool-count-limit.ts";/** The settings the harness gives the agents MCP server, and the only ones a request may carry over HTTP. */export const AGENTS_MCP_ENV = ["OMB_BOT_ID", "OMB_THREAD_ID", "OMB_TURN_DEPTH", "OMB_EXTERNAL_RUNTIME", "OMB_CHIEF_OF_STAFF","OMB_SKILL_AUTHORING_ENABLED", "OMB_MEMORY_ENABLED", "OMB_SHARED_COMPUTERS_ENABLED", "OMB_CLOUD_HOME", "OMB_VOICE_NOTES",- "OMB_X_RESEARCH", "OMB_ESCALATIONS", "OMB_TEAM_PEOPLE", "OMB_MAUSBOT", "OMB_COMPUTER_SELECTION", "OMB_ROOM", TOOL_BRIDGE_ENV, TOOL_LIMIT_ENV] as const;+ "OMB_X_RESEARCH", "OMB_ESCALATIONS", "OMB_TEAM_PEOPLE", "OMB_MAUSBOT", "OMB_COMPUTER_SELECTION", "OMB_ROOM", "OMB_ACTIVE_WAITS", TOOL_BRIDGE_ENV, TOOL_LIMIT_ENV] as const;diff --git a/server/drivers/agents-mcp.ts b/server/drivers/agents-mcp.tsindex fabf19c7d8..bf65af5f9f 100644--- a/server/drivers/agents-mcp.ts+++ b/server/drivers/agents-mcp.ts@@ -3,21 +3,23 @@// both answer through it.import { resolveAgentsCall } from "../../shared/agents-tool-names.ts";import { TOOL_BRIDGE_ENV, createToolBridge } from "./agents-bridge.ts";-import { availableTools, catalogProfileFromEnv } from "./agents-catalog.ts";+import { availableTools, callableTools, catalogProfileFromEnv } from "./agents-catalog.ts";import { callTool, capResult, toolCallContextFromEnv } from "./agents-call.ts";import { sendToolReceipt } from "./agents-timing.ts";import type { Json } from "./agents-client.ts";import { capToolListResult, toolLimitFromEnv } from "../tool-count-limit.ts";-/** What the agents server lists for `env`, before any tool limit. */+/** What the agents server lists for `env`, before any tool limit, and what a call may reach: the listed tools, and the+ * wait tools left off the list only for want of a wait (callableTools), which a bridge's find_tool does not search. */export function agentsToolList(env: NodeJS.ProcessEnv) {- const available = availableTools(catalogProfileFromEnv(env));+ const profile = catalogProfileFromEnv(env);+ const available = availableTools(profile);const bridge = env[TOOL_BRIDGE_ENV] === "1" ? createToolBridge(available) : undefined;- return { available, bridge, listed: bridge ? bridge.listed : available };+ return { callable: callableTools(profile), bridge, listed: bridge ? bridge.listed : available };}export function agentsMcp(env: NodeJS.ProcessEnv): (msg: Json) => Promise<Json | undefined> {- const { available, bridge, listed } = agentsToolList(env);+ const { callable, bridge, listed } = agentsToolList(env);const limit = toolLimitFromEnv(env);const context = toolCallContextFromEnv(env);const ok = (id: unknown, result: unknown): Json => ({ jsonrpc: "2.0", id, result } as Json);@@ -50,7 +52,7 @@ export function agentsMcp(env: NodeJS.ProcessEnv): (msg: Json) => Promise<Json |const { name, arguments: args } = bridged ?? called;// An alias runs only where the tool it names is listed: never a way to a tool this turn was not given.const runs = resolveAgentsCall(name, args).name;- if (!available.some((t) => t.name === runs)) {+ if (!callable.some((t) => t.name === runs)) {// A name written into use_tool fails the call, not the protocol: the chat runtime ends a turn on a protocol error.const unknown = `Unknown tool: ${name}`;return bridged ? textResult(id, unknown, true) : rpcErr(id, -32602, unknown);diff --git a/server/drivers/agents-proxy.test.ts b/server/drivers/agents-proxy.test.tsindex 376937a8c2..39ab2743a8 100644--- a/server/drivers/agents-proxy.test.ts+++ b/server/drivers/agents-proxy.test.ts@@ -659,6 +659,7 @@ describe("agents-proxy MCP surface", () => {"trigger_info","trigger","delete_trigger",+ "wait_until","propose_profile","propose_model","propose_team_memory",diff --git a/server/drivers/agents-wait-tools.test.ts b/server/drivers/agents-wait-tools.test.tsnew file mode 100644index 0000000000..71341241c7--- /dev/null+++ b/server/drivers/agents-wait-tools.test.ts@@ -0,0 +1,155 @@+import { createServer, type Server } from "node:http";+import type { AddressInfo } from "node:net";++import { afterAll, beforeAll, describe, expect, it } from "vitest";++import type { ToolCallContext } from "./agents-call.ts";+import { availableTools, callableTools, catalogProfileFromEnv } from "./agents-catalog.ts";+import type { Json } from "./agents-client.ts";+import { agentsMcp } from "./agents-mcp.ts";+import { callWaitTool, WAIT_TOOL_DEFINITIONS, WAIT_TOOL_NAMES } from "./agents-wait-tools.ts";+import { WAIT_KINDS } from "../../shared/waits.ts";++type Reply = { ok: boolean; status: number; body: Record<string, unknown> };++function setup(reply: Reply = { ok: true, status: 200, body: { text: "ok" } }) {+ const calls: Array<[string, RequestInit | undefined]> = [];+ const client = { apiResponse: async (path: string, init?: RequestInit) => { calls.push([path, init]); return reply; } };+ return { calls, context: { botId: "scout", threadId: "t1", client } as unknown as ToolCallContext };+}++describe("wait tools", () => {+ it("sends wait_until's arguments unchanged to the waits route and returns its words", async () => {+ const { calls, context } = setup({ ok: true, status: 201, body: { text: "Waiting for the build (wait id w1)…" } });+ expect(await callWaitTool("wait_until", { label: "the build", kind: "file_exists", path: "/r" }, context)).toEqual({ text: "Waiting for the build (wait id w1)…" });+ expect(calls).toEqual([["/api/internal/waits", { method: "POST", body: JSON.stringify({ label: "the build", kind: "file_exists", path: "/r" }) }]]);+ });++ it("marks a refusal as an error in the route's words", async () => {+ const { context } = setup({ ok: false, status: 403, body: { error: "Only the person can set up or stop a wait…" } });+ expect(await callWaitTool("wait_until", {}, context)).toEqual({ text: "Only the person can set up or stop a wait…", isError: true });+ });++ it("lists with a GET and cancels by id", async () => {+ const { calls, context } = setup();+ await callWaitTool("list_waits", {}, context);+ await callWaitTool("cancel_wait", { id: "w1" }, context);+ expect(calls).toEqual([["/api/internal/waits", undefined], ["/api/internal/waits/cancel", { method: "POST", body: '{"id":"w1"}' }]]);+ });++ it("defines the three tools in order, with follow_up and never then", () => {+ expect(WAIT_TOOL_DEFINITIONS.map((tool) => tool.name)).toEqual(["wait_until", "list_waits", "cancel_wait"]);+ expect([...WAIT_TOOL_NAMES]).toEqual(["wait_until", "list_waits", "cancel_wait"]);+ const waitUntil = WAIT_TOOL_DEFINITIONS.find((tool) => tool.name === "wait_until")!;+ const properties = (waitUntil.inputSchema as unknown as { properties: Record<string, { enum?: string[] }> }).properties;+ expect(Object.keys(properties)).toEqual(["label", "kind", "url", "text", "path", "process", "bot", "follow_up", "hours"]);+ expect(properties.kind!.enum).toEqual([...WAIT_KINDS]);+ expect(JSON.stringify(WAIT_TOOL_DEFINITIONS)).not.toMatch(/"then"|with then|give then/);+ });++ it("tells the model in few words: no AI while waiting, every kind, follow_up, 1 to 168 hours and a noun-phrase label", () => {+ const [waitUntil, list] = WAIT_TOOL_DEFINITIONS;+ const properties = (waitUntil!.inputSchema as unknown as { properties: Record<string, { description?: string }> }).properties;+ expect(waitUntil!.description).toContain("No AI runs while you wait");+ expect(waitUntil!.description).toContain("(default 24, 1-168)");+ for (const prefix of ["url_*", "file_*", "process_*", "bot_idle"]) expect(properties.kind!.description).toContain(prefix);+ expect(properties.follow_up!.description).toMatch(/^Only if the person asked for something to be done then.*You carry it out here\.$/);+ expect(properties.label!.description).toBe('A noun phrase in the person\'s words, e.g. "the build".');+ expect(list!.description).toMatch(/^Your waits in this chat that have not ended/);+ // The advertised bytes ride every turn that lists it: the catalog wire test budgets them, this keeps them small.+ const [advertised] = availableTools(catalogProfileFromEnv({ OMB_BOT_ID: "scout" })).filter((tool) => tool.name === "wait_until");+ expect(JSON.stringify(advertised).length).toBeLessThan(1_100);+ });+});++const waitNames = (env: Record<string, string>) =>+ availableTools(catalogProfileFromEnv({ OMB_BOT_ID: "scout", OMB_CHIEF_OF_STAFF: "1", ...env })).map((tool) => tool.name).filter((name) => WAIT_TOOL_NAMES.has(name));++describe("which wait tools a turn is listed", () => {+ it("lists wait_until alone while the bot has no wait, and list_waits and cancel_wait too once it has one", () => {+ expect(waitNames({})).toEqual(["wait_until"]);+ expect(waitNames({ OMB_ACTIVE_WAITS: "1" })).toEqual(["wait_until", "list_waits", "cancel_wait"]);+ const all = availableTools(catalogProfileFromEnv({ OMB_BOT_ID: "scout", OMB_ACTIVE_WAITS: "1" })).map((tool) => tool.name);+ expect(availableTools(catalogProfileFromEnv({ OMB_BOT_ID: "scout" })).map((tool) => tool.name))+ .toEqual(all.filter((name) => name !== "list_waits" && name !== "cancel_wait"));+ });++ it("marks list_waits read-only when it is listed, and nothing else of the three", () => {+ const tools = availableTools(catalogProfileFromEnv({ OMB_BOT_ID: "scout", OMB_ACTIVE_WAITS: "1" })).filter((tool) => WAIT_TOOL_NAMES.has(tool.name));+ expect(tools.map((tool) => [tool.name, Boolean((tool as { annotations?: { readOnlyHint?: boolean } }).annotations?.readOnlyHint)]))+ .toEqual([["wait_until", false], ["list_waits", true], ["cancel_wait", false]]);+ });++ // OMB_ACTIVE_WAITS counts the chat's own waits (WaitManager.count), and no wait is made in a room, so a room's turn+ // is never listed list_waits in practice; the catalog would list it alone.+ it("lists a room's turn list_waits alone, and only with OMB_ACTIVE_WAITS", () => {+ expect(waitNames({ OMB_ROOM: "1" })).toEqual([]);+ expect(waitNames({ OMB_ROOM: "1", OMB_ACTIVE_WAITS: "1" })).toEqual(["list_waits"]);+ });++ it("lets a turn call list_waits and cancel_wait without a wait, but never what a room refuses", () => {+ const callable = (env: Record<string, string>) => callableTools(catalogProfileFromEnv({ OMB_BOT_ID: "scout", ...env }))+ .map((tool) => tool.name).filter((name) => WAIT_TOOL_NAMES.has(name));+ expect(callable({})).toEqual(["wait_until", "list_waits", "cancel_wait"]);+ expect(callable({ OMB_ROOM: "1" })).toEqual(["list_waits"]);+ });+});++describe("a wait tool the turn is not listed", () => {+ let server: Server;+ let url = "";+ const reached: string[] = [];++ beforeAll(async () => {+ server = createServer((req, res) => {+ if (req.url?.startsWith("/api/internal/waits")) reached.push(`${req.method} ${req.url}`);+ const [status, body] = req.url === "/api/internal/waits/cancel"+ ? [404, { error: "None of your waits in this chat has that id. Use list_waits." }]+ : [200, { text: "You are not waiting for anything in this chat." }];+ req.resume();+ req.on("end", () => { res.writeHead(status, { "content-type": "application/json" }); res.end(JSON.stringify(body)); });+ });+ await new Promise<void>((resolve) => server.listen(0, "127.0.0.1", resolve));+ url = `http://127.0.0.1:${(server.address() as AddressInfo).port}`;+ });+ afterAll(() => new Promise<void>((resolve) => server.close(() => resolve())));++ const send = (env: Record<string, string>, method: string, params?: Json) =>+ agentsMcp({ OMB_BOT_ID: "scout", OMB_THREAD_ID: "t1", OMB_COMMS_TOKEN: "token", OMB_HARNESS_URL: url, ...env })(+ { jsonrpc: "2.0", id: 1, method, ...(params ? { params } : {}) } as Json,+ ) as Promise<{ result?: { tools?: Array<{ name: string }>; content?: Array<{ text: string }>; isError?: boolean }; error?: { message: string } }>;+ const answer = async (env: Record<string, string>, name: string, args: Json = {}) => {+ const reply = await send(env, "tools/call", { name, arguments: args });+ return reply.error ? { error: reply.error.message } : { text: reply.result!.content![0]!.text, isError: reply.result!.isError };+ };++ it("still answers in the route's words when called directly, from a list read before or a wait made this turn", async () => {+ const listed = (await send({}, "tools/list")).result!.tools!.map((tool) => tool.name);+ expect(listed).toContain("wait_until");+ expect(listed).not.toContain("list_waits");+ expect(listed).not.toContain("cancel_wait");+ reached.length = 0;+ expect(await answer({}, "list_waits")).toEqual({ text: "You are not waiting for anything in this chat.", isError: false });+ expect(await answer({}, "cancel_wait", { id: "w1" })).toEqual({ text: "None of your waits in this chat has that id. Use list_waits.", isError: true });+ expect(reached).toEqual(["GET /api/internal/waits", "POST /api/internal/waits/cancel"]);+ });++ it("runs through use_tool on a bridged turn, which find_tool offers only once the bot has a wait", async () => {+ const bridged = { OMB_AGENTS_TOOL_BRIDGE: "1" };+ const found = async (env: Record<string, string>) =>+ (JSON.parse((await answer({ ...bridged, ...env }, "find_tool", { query: "cancel_wait" })).text!) as { matches: Array<{ name: string }> })+ .matches.map((match) => match.name);+ expect(await found({})).not.toContain("cancel_wait");+ expect(await found({ OMB_ACTIVE_WAITS: "1" })).toContain("cancel_wait");+ expect(await answer(bridged, "use_tool", { name: "cancel_wait", arguments: { id: "w1" } }))+ .toEqual({ text: "None of your waits in this chat has that id. Use list_waits.", isError: true });+ expect(await answer(bridged, "use_tool", { name: "list_waits" })).toEqual({ text: "You are not waiting for anything in this chat.", isError: false });+ });++ it("refuses cancel_wait in a room as a tool the room is not given, and still answers list_waits there", async () => {+ reached.length = 0;+ expect(await answer({ OMB_ROOM: "1" }, "cancel_wait", { id: "w1" })).toEqual({ error: "Unknown tool: cancel_wait" });+ expect(await answer({ OMB_ROOM: "1" }, "list_waits")).toEqual({ text: "You are not waiting for anything in this chat.", isError: false });+ expect(reached).toEqual(["GET /api/internal/waits"]);+ });+});diff --git a/server/drivers/agents-wait-tools.ts b/server/drivers/agents-wait-tools.tsnew file mode 100644index 0000000000..7729a9fb8b--- /dev/null+++ b/server/drivers/agents-wait-tools.ts@@ -0,0 +1,67 @@+import { WAIT_HOURS, WAIT_KINDS } from "../../shared/waits.ts";+import type { ToolCallContext, ToolCallResult } from "./agents-call.ts";+import type { Json } from "./agents-client.ts";++const WAITS = "/api/internal/waits";+export const WAIT_TOOL_NAMES: ReadonlySet<string> = new Set(["wait_until", "list_waits", "cancel_wait"]);+/** Refused in a room's thread (routes/waits.ts): a room's turn is not listed them. list_waits answers there. */+export const ROOM_REFUSED_WAIT_TOOL_NAMES: ReadonlySet<string> = new Set(["wait_until", "cancel_wait"]);+/** Listed only while the bot has a wait in this chat that has not ended (`CatalogProfile.activeWaits`); callable either way. */+export const WAITING_ONLY_TOOL_NAMES: ReadonlySet<string> = new Set(["list_waits", "cancel_wait"]);++export async function callWaitTool(name: string, args: Json, context: ToolCallContext): Promise<ToolCallResult> {+ const { ok, body } =+ name === "list_waits"+ ? await context.client.apiResponse(WAITS)+ : await context.client.apiResponse(name === "cancel_wait" ? `${WAITS}/cancel` : WAITS, { method: "POST", body: JSON.stringify(args) });+ return ok ? { text: String(body.text ?? "") } : { text: String(body.error ?? "The wait did not go through. Try again shortly."), isError: true };+}++export const WAIT_TOOL_DEFINITIONS = [+ {+ name: "wait_until",+ // 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}).`,+ inputSchema: {+ type: "object",+ additionalProperties: false,+ properties: {+ label: { type: "string", maxLength: 120, description: 'A noun phrase in the person\'s words, e.g. "the build".' },+ kind: {+ type: "string",+ enum: [...WAIT_KINDS],+ description: "url_*: the page at url has or lacks text. file_*: path exists, is gone or changes. process_*: process (name or pid) runs or stops. bot_idle: bot (name or id) finishes its work.",+ },+ url: { type: "string" },+ text: { type: "string" },+ path: { type: "string" },+ process: { type: "string" },+ bot: { type: "string" },+ follow_up: {+ type: "string",+ maxLength: 2000,+ description: "Only if the person asked for something to be done then: that request, for a run that won't see this chat. You carry it out here.",+ },+ hours: { type: "integer", minimum: 1, maximum: WAIT_HOURS.max },+ },+ required: ["label", "kind"],+ },+ },+ {+ name: "list_waits",+ description: "Your waits in this chat that have not ended (wait_until): id, label, what it checks, when it was made and when it stops.",+ inputSchema: { type: "object", additionalProperties: false, properties: {} },+ },+ {+ name: "cancel_wait",+ description: "Stop one of your waits; its id comes from list_waits or wait_until's answer.",+ inputSchema: {+ type: "object",+ additionalProperties: false,+ properties: { id: { type: "string", minLength: 1 } },+ required: ["id"],+ },+ },+];diff --git a/server/harness-capabilities.ts b/server/harness-capabilities.tsindex 5e8784e585..59b377b815 100644--- a/server/harness-capabilities.ts+++ b/server/harness-capabilities.ts@@ -12,6 +12,7 @@ const ENVELOPE: CatalogProfile = {sharedComputers: true,voiceNotes: true,computerSelection: true,+ activeWaits: true,cloudHome: false,chief: true,botId: "",diff --git a/server/index.ts b/server/index.tsindex e5feaecff6..15f2de218a 100644--- a/server/index.ts+++ b/server/index.ts@@ -475,7 +475,7 @@ import { listenWebhookIngress, type WebhookIngress } from "./webhook-ingress.ts"import { addressFor } from "./webhook-address.ts";import { assertModelVariantSupported, memberTurnSelection } from "./member-turn.ts";import { WebhookManager } from "./webhooks.ts";-import { tieAutomationsToBots } from "./bot-automations.ts";+import { tieAutomationsToBots } from "./bot-automations.ts"; import { WaitManager } from "./waits.ts"; import { cancelWaitFromCard, createWaitHost, waitRunChat } from "./wait-host.ts"; import { createWaitRoutes, findWaitPeer, hostWaitRefusal, waitSourceRefusal, type WaitRouteContext } from "./routes/waits.ts";import type { WebhookTrigger } from "../shared/webhooks.ts";import { AGENTS_NODE_FLAG, SPAWNED_PROXIES } from "./proxy-paths.ts";import { AGENTS_PROXY_ENV, agentsProxyLaunch, agentsToolBridgeEnv, applyAgentsBridge, bridgedToolTitle, turnEngine } from "./agents-bridge-switch.ts";@@ -1874,7 +1874,7 @@ function agentsIntegration(OMB_MEMORY_ENABLED: store.bot(botId)?.memoryEnabled === false ? "0" : "1",// Only advertises the tools; the routes behind them refuse regardless.OMB_SHARED_COMPUTERS_ENABLED: lendingEnabled() ? "1" : "0",- OMB_CLOUD_HOME: CLOUD_HOME ? "1" : "0", OMB_TEAM_PEOPLE: CLOUD_TEAM ? "1" : "0", OMB_ROOM: store.groupByThread(threadId) ? "1" : "0",+ OMB_CLOUD_HOME: CLOUD_HOME ? "1" : "0", OMB_TEAM_PEOPLE: CLOUD_TEAM ? "1" : "0", OMB_ROOM: store.groupByThread(threadId) ? "1" : "0", OMB_ACTIVE_WAITS: botWaits.count(botId, threadId) ? "1" : "0",OMB_VOICE_NOTES: (() => {const speaking = botForThread(botId, threadId) ?? store.bot(botId);return tts.voiceReady(cfg, speaking?.voice) && speaking?.voiceNotes !== false ? "1" : "0";@@ -8938,6 +8938,7 @@ routines = new RoutineManager({return task;},joinConversation: (run) => {+ if (run.eventSource === "wait") return waitRunChat(run, directChatOf, Boolean(CLOUD_HOME));const continues = routines?.listRoutines().some((routine) => routine.id === run.routineId && routine.schedule.type === "limit_reset");if (!continues || run.target !== "bot") return null;const source = routineSourceOwner(run);@@ -9063,6 +9064,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 recoveryOwners = routines.routineRequestReceiptOwners();if (recoveryOwners.length > 0) {const recoveryThreads = [...new Set(recoveryOwners.map((owner) => owner.threadId))];@@ -9587,15 +9589,10 @@ async function undoAppliedChange(res: ServerResponse, threadId: string, requestIresult = undone;} else if (card.webhookRequest || card.appTriggerRequest) {result = card.webhookRequest ? webhookRequests.undo({ botId, threadId, requestId }) : await appTriggers.undo({ botId, threadId, requestId });- } else if (card.profileRequest) {- const undone = profileRequests.undo({ botId, threadId, requestId });- if (undone.claimed && undone.state === "undone") {- const target = store.bot(undone.targetBotId);- if (target) broadcast({ kind: "bot", bot: wireBot(target) });- }- result = undone;- } else if (card.modelRequest) {- const undone = modelRequests.undo({ botId, threadId, requestId });+ } else if (card.waitRequest) {+ result = card.undone ? { claimed: true, state: "already_undone" } : cancelWaitFromCard(botWaits, store, { botId, threadId, messageId: message.id, waitId: card.waitRequest.waitId }) ? { claimed: true, state: "undone" } : { claimed: true, state: "invalid", error: "This wait has already ended.", status: 409 };+ } else if (card.profileRequest || card.modelRequest) {+ const undone = (card.profileRequest ? profileRequests : modelRequests).undo({ botId, threadId, requestId });if (undone.claimed && undone.state === "undone") {const target = store.bot(undone.targetBotId);if (target) broadcast({ kind: "bot", bot: wireBot(target) });@@ -9642,8 +9639,8 @@ const webhookRequests = new WebhookRequestService({ store, webhooks, botName: (bconst appTriggers = createAppTriggerHost({ store, webhooks, webhookBase: () => webhookIngressStatus().baseUrl, routines: () => routines!, botState: unattendedDispatchState, timeZone: routineTimeZone, emit: broadcast, connectionMode: () => composio.connectionMode(cfg),access: composio.brokerAccess, connectedApps: () => composio.connectedServices(cfg), visibleBot: (auth, botId) => visibleTo(viewerFor(auth)).bot(botId),audit: (row) => appendDecision(DATA_DIR, { ...row, decision: "auto-approved", source: "routine" }) });-tieAutomationsToBots(store, { routines: routines!, webhooks, apps: appTriggers.manager });-ROUTES.push(appTriggers.routes); ROUTES.unshift(createMoveFreezeRoutes({ freeze: moveFreeze, automationsOff: () => switchAutomationsOff({ routines: () => routines, calls: () => calendarCalls, webhooks: () => webhooks, appEvents: () => appTriggers.manager }), restart: () => { restartRequested = true; gracefulShutdown(); }, busy: createMoveWaits({ bots: () => store.bots, rooms: () => store.groups, answering: (id) => watchdog.answering(id), turn: botHasActiveTurn, runs: () => routines?.listRuns() ?? [], roomWorking: (id) => { const group = store.group(id); return Boolean(group && groupIsWorking(group)); }, handoffs: () => coordinator.active(), exists: (node) => !(!node.parentId && node.groupId ? roomRootProblem(node) : roomHandoffProblem(node)), signingIn: () => providerAuthSessions.active }) }));+tieAutomationsToBots(store, { routines: routines!, webhooks, apps: appTriggers.manager, waits: botWaits });+ROUTES.push(appTriggers.routes); ROUTES.unshift(createMoveFreezeRoutes({ freeze: moveFreeze, automationsOff: () => switchAutomationsOff({ routines: () => routines, calls: () => calendarCalls, webhooks: () => webhooks, appEvents: () => appTriggers.manager, waits: () => botWaits }), restart: () => { restartRequested = true; gracefulShutdown(); }, busy: createMoveWaits({ bots: () => store.bots, rooms: () => store.groups, answering: (id) => watchdog.answering(id), turn: botHasActiveTurn, runs: () => routines?.listRuns() ?? [], roomWorking: (id) => { const group = store.group(id); return Boolean(group && groupIsWorking(group)); }, handoffs: () => coordinator.active(), exists: (node) => !(!node.parentId && node.groupId ? roomRootProblem(node) : roomHandoffProblem(node)), signingIn: () => providerAuthSessions.active }) }));ROUTES.push(createLimitResetRoutes({ clock: limitClock, routines: routines!, requests: routineRequests, engineName, threadEngine: (botId, threadId) => turnSelection(botId, threadId)?.instanceId,threadTitle: (botId, threadId) => store.bot(botId) && !store.bot(botId)!.hidden ? store.taskByThread(botId, threadId)?.title ?? null : null,created: (id, auth) => cloudRoutineAuthors?.wrote(id, auth.kind === "session" ? actorKey(auth) : CLOUD_NOBODY_KEY) }));@@ -11308,6 +11305,9 @@ function connectorThread(botId: string, threadId: string) {if (group?.memberIds.includes(botId)) return { bot, group };return null;}+function directChatOf(botId: string, threadId: string): boolean { const source = connectorThread(botId, threadId); return source !== null && !source.group; }+function waitTurnChecks(capability: InternalCapability, sender: BotRecord): Pick<WaitRouteContext, "sourceRefusal" | "hostRefusal" | "guest" | "peer"> { const { threadId } = capability, place = () => { const turn = turnPlaces.get(threadId); return turn?.botId === sender.id ? turn.place : null; };+ return { sourceRefusal: () => { const source = connectorThread(sender.id, threadId); return waitSourceRefusal({ owned: source !== null, room: Boolean(source?.group), depth: capability.depth, handedOff: Boolean(capability.roomHandoffId), routineRun: Boolean(activeRoutineRunForThread(threadId)), outsideDriven: outsideDrivenThread(threadId), personStarted: turnOrigin(capability).kind === "user", guest: cloudGuestDriven(threadId) }); }, hostRefusal: () => hostWaitRefusal({ cloudHome: Boolean(CLOUD_HOME), hosted: HOSTED_WORKSPACE, guest: cloudGuestDriven(threadId), place: place() }), guest: () => cloudGuestDriven(threadId), peer: (name) => findWaitPeer(reachablePeers(store.bots, sender), sender.id, name) }; }/** Read fresh every time; a line stamped via the HTTP API does not count, so a bot cannot re-arm the ceiling it just spent. */function lastHumanRoomMessageAt(group: GroupRecord): number | undefined {@@ -12253,15 +12253,15 @@ const workspaceBackupAccess = {return work();}, {idle: () => !providerFleetReloading && !providerAuthSessions.active && !browserEngineInstall &&- !routines?.isTicking && !calendarCalls?.isTicking &&+ !routines?.isTicking && !calendarCalls?.isTicking && !botWaits.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) && !botComputerControlSnapshot(bot.id).held) &&store.groups.every((group) => !groupIsWorking(group)),- pause: () => { routines?.stop(); calendarCalls?.stop(); watchdog.stop(); memoryUpkeep.pause(); },- resume: () => { if (!moveFreeze.frozen()) { routines?.start(); calendarCalls?.start(); } watchdog.start(); memoryUpkeep.resume(); },+ 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(); },flush: async () => {await Promise.all([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.@@ -12383,7 +12383,7 @@ ROUTES.push(createBotMemoryRoutes({broadcast({ kind: "config", ...configStatus() });},}));-const teamMoveIn = CLOUD_TEAM ? createTeamMoveIn({ team: CLOUD_TEAM, dataDir: DATA_DIR, sessions, store, routines: () => routines, library: () => readSkillLibraryIndex(), starters: threadStarters }) : null; const cloudSendOwner = (auth: RequestAuth) => teamMoveIn ? teamMoveIn.owner(auth) : CLOUD_HOME && auth.kind === "session" && auth.scopes.includes("admin") ? { person: actorKey(auth), name: cfg.profile?.name?.trim() || "User" } : null; const botMoves = CLOUD_PERSONAL ? createBotMoves({ store, routines: () => routines, webhooks: () => webhooks, appEvents: () => appTriggers.manager, busy: (id) => botHasActiveTurn(id) || Boolean(routines?.activeRunForBot(id)) }) : null; ROUTES.push(createBotMoveRoutes({ moves: botMoves, enabled: CLOUD_PERSONAL })); if (teamMoveIn) { ROUTES.unshift(teamMoveIn.guard); ROUTES.push(teamMoveIn.routes); teamOwners.backfill(teamMoveIn.list()); } ROUTES.push(createDeciderRoutes({ decider, extractor, config: () => cfg }), createTtsRoutes({ config: () => cfg }), createHelperSuggestionRoutes({ notNow: proactive.suggestionNotNow }), createSetupRequestRoutes({ store, language: () => appLanguage() ?? Intl.DateTimeFormat().resolvedOptions().locale, sendRefusal: cloudGuestSendRefusal, presser: (auth) => setupPresser(sharedMembership(), auth, messageSender(auth)), canSetUp: (botId, threadId) => registry.get(store.projectBotForTask(botId, threadId)?.modelSelection.instanceId ?? "")?.adapter.capabilities.agentsMcp === true, send: (auth, botId, threadId, text) => acceptDirectSend({ botId, threadId, text, sender: messageSender(auth), trigger: usageTriggerFor(auth), personPresent: auth.kind === "session" || DESKTOP_MANAGED }) }), createNotificationRoutes(undefined, threadShown, CLOUD_TEAM ? (auth, entry) => teamOwners.routing.notificationReaches(teamOwners.viewer(auth), entry) : undefined), createUpdateCheckRoutes({ check: serverUpdateChecker({ desktopManaged: DESKTOP_MANAGED, managed: Boolean(CLOUD_HOME || HOSTED_WORKSPACE) }) }), createTimeZoneRoutes({ adopts: Boolean(CLOUD_HOME), dataDir: DATA_DIR, changed: () => routines?.rescheduleLocalTimes() }), createCloudSendRoutes({ appVersion: serverVersion(), ...(CLOUD_TEAM ? { refusal: personalMoveRefusal(CLOUD_TEAM), scope: (auth) => teamMoveIn?.scope(auth) ?? null } : {}), bots: () => store.bots, messagesTail: (threadId, limit) => store.messagesTail(threadId, limit), skills: (bot) => listSkills(bot.id), logins, config: () => cfg, chats: { store, dataDir: DATA_DIR, owner: cloudSendOwner, ...(CLOUD_OWNER_KEY ? { ownerKey: CLOUD_OWNER_KEY } : {}), stamped: (threadId) => ownerOnlyCache.delete(threadId), instanceExists: (id) => Boolean(registry.get(id)), approvalSupported: (selection, mode) => supportsApprovalMode(selection, mode) }, cloudHome: Boolean(CLOUD_HOME), automations: { routines: () => routines, calls: () => calendarCalls, webhooks: () => webhooks, appEvents: () => appTriggers.manager }, connections: () => cloudConnections.connections(), connectionFingerprints: (nonce) => cloudConnections.fingerprints(nonce), move: { dataDir: DATA_DIR, store, routines: () => routines, calls: () => calendarCalls, webhooks: () => webhooks, appEvents: () => appTriggers.manager, claudeCodeSkills: () => (claudeUserSkillsEnabled(cfg) ? claudeCodeSkillInputs() : []), instanceExists: (id) => Boolean(registry.get(id)), owner: cloudSendOwner, ownRoutine: (routine, person) => { cloudRoutineAuthors?.record(routine.id, routine); cloudRoutineAuthors?.wrote(routine.id, person); }, arrived: () => ownerOnlyCache.clear(), teamMemory, aboutMe: () => cfg.profile?.aboutMe ?? "", saveAboutMe: (text) => { saveConfig({ profile: { ...cfg.profile, aboutMe: text } }); Object.assign(cfg, loadConfig()); broadcast({ kind: "config", ...configStatus() }); } } }), cloudConnections.routes, createTodayRoutes({ visibleFor: (auth) => visibleTo(viewerFor(auth)), ...(teamOwners.asks ? { asks: teamOwners.asks, messages: teamMessages.needsYou } : {}), sources: () => ({ bots: store.bots, groups: store.groups, routines, parked: coordinator.active(), engines: registry.instances().map((instance) => ({ instanceId: instance.instanceId, snapshot: registry.lastSnapshot(instance.instanceId) })) }) }), createInboxRoutes(teamMessages));+const teamMoveIn = CLOUD_TEAM ? createTeamMoveIn({ team: CLOUD_TEAM, dataDir: DATA_DIR, sessions, store, routines: () => routines, library: () => readSkillLibraryIndex(), starters: threadStarters }) : null; const cloudSendOwner = (auth: RequestAuth) => teamMoveIn ? teamMoveIn.owner(auth) : CLOUD_HOME && auth.kind === "session" && auth.scopes.includes("admin") ? { person: actorKey(auth), name: cfg.profile?.name?.trim() || "User" } : null; const botMoves = CLOUD_PERSONAL ? createBotMoves({ store, routines: () => routines, webhooks: () => webhooks, appEvents: () => appTriggers.manager, waits: () => botWaits, busy: (id) => botHasActiveTurn(id) || Boolean(routines?.activeRunForBot(id)) }) : null; ROUTES.push(createBotMoveRoutes({ moves: botMoves, enabled: CLOUD_PERSONAL })); if (teamMoveIn) { ROUTES.unshift(teamMoveIn.guard); ROUTES.push(teamMoveIn.routes); teamOwners.backfill(teamMoveIn.list()); } ROUTES.push(createDeciderRoutes({ decider, extractor, config: () => cfg }), createTtsRoutes({ config: () => cfg }), createHelperSuggestionRoutes({ notNow: proactive.suggestionNotNow }), createSetupRequestRoutes({ store, language: () => appLanguage() ?? Intl.DateTimeFormat().resolvedOptions().locale, sendRefusal: cloudGuestSendRefusal, presser: (auth) => setupPresser(sharedMembership(), auth, messageSender(auth)), canSetUp: (botId, threadId) => registry.get(store.projectBotForTask(botId, threadId)?.modelSelection.instanceId ?? "")?.adapter.capabilities.agentsMcp === true, send: (auth, botId, threadId, text) => acceptDirectSend({ botId, threadId, text, sender: messageSender(auth), trigger: usageTriggerFor(auth), personPresent: auth.kind === "session" || DESKTOP_MANAGED }) }), createNotificationRoutes(undefined, threadShown, CLOUD_TEAM ? (auth, entry) => teamOwners.routing.notificationReaches(teamOwners.viewer(auth), entry) : undefined), createUpdateCheckRoutes({ check: serverUpdateChecker({ desktopManaged: DESKTOP_MANAGED, managed: Boolean(CLOUD_HOME || HOSTED_WORKSPACE) }) }), createTimeZoneRoutes({ adopts: Boolean(CLOUD_HOME), dataDir: DATA_DIR, changed: () => routines?.rescheduleLocalTimes() }), createCloudSendRoutes({ appVersion: serverVersion(), ...(CLOUD_TEAM ? { refusal: personalMoveRefusal(CLOUD_TEAM), scope: (auth) => teamMoveIn?.scope(auth) ?? null } : {}), bots: () => store.bots, messagesTail: (threadId, limit) => store.messagesTail(threadId, limit), skills: (bot) => listSkills(bot.id), logins, config: () => cfg, chats: { store, dataDir: DATA_DIR, owner: cloudSendOwner, ...(CLOUD_OWNER_KEY ? { ownerKey: CLOUD_OWNER_KEY } : {}), stamped: (threadId) => ownerOnlyCache.delete(threadId), instanceExists: (id) => Boolean(registry.get(id)), approvalSupported: (selection, mode) => supportsApprovalMode(selection, mode) }, cloudHome: Boolean(CLOUD_HOME), automations: { routines: () => routines, calls: () => calendarCalls, webhooks: () => webhooks, appEvents: () => appTriggers.manager, waits: () => botWaits }, connections: () => cloudConnections.connections(), connectionFingerprints: (nonce) => cloudConnections.fingerprints(nonce), move: { dataDir: DATA_DIR, store, routines: () => routines, calls: () => calendarCalls, webhooks: () => webhooks, appEvents: () => appTriggers.manager, claudeCodeSkills: () => (claudeUserSkillsEnabled(cfg) ? claudeCodeSkillInputs() : []), instanceExists: (id) => Boolean(registry.get(id)), owner: cloudSendOwner, ownRoutine: (routine, person) => { cloudRoutineAuthors?.record(routine.id, routine); cloudRoutineAuthors?.wrote(routine.id, person); }, arrived: () => ownerOnlyCache.clear(), teamMemory, aboutMe: () => cfg.profile?.aboutMe ?? "", saveAboutMe: (text) => { saveConfig({ profile: { ...cfg.profile, aboutMe: text } }); Object.assign(cfg, loadConfig()); broadcast({ kind: "config", ...configStatus() }); } } }), cloudConnections.routes, createTodayRoutes({ visibleFor: (auth) => visibleTo(viewerFor(auth)), ...(teamOwners.asks ? { asks: teamOwners.asks, messages: teamMessages.needsYou } : {}), sources: () => ({ bots: store.bots, groups: store.groups, routines, parked: coordinator.active(), engines: registry.instances().map((instance) => ({ instanceId: instance.instanceId, snapshot: registry.lastSnapshot(instance.instanceId) })) }) }), createInboxRoutes(teamMessages));if (CLOUD_TEAM) teamHost.adoptServerProfile(sessions.list().flatMap((session) => session.email ? [session.email] : []));ROUTES.push(createSidebarSectionRoutes({ store, teamComputers, maxBots: MAX_WORKSPACE_BOTS, assertTeamComputerChangeIdle, wireBot }), createPresenceRoutes({ isOwner: ownerOrAdmin, active: async (source, zone, language) => { const answer = await proactive.brief.active(source, zone, language); firstHourHooks.arrived(); return answer; }, ...(CLOUD_TEAM ? { member: teamMessages.arrived } : {}) }), createMeRoutes({ team: CLOUD_TEAM, session: (auth) => (auth.kind === "session" ? auth.session : null), profile: teamHost.memberProfile, save: teamHost.saveMemberProfile, seed: teamHost.seedMemberProfile, seeded: teamHost.seededFields, changed: () => broadcast({ kind: "config", ...configStatus() }) }), createTeamPhoneRoutes({ team: CLOUD_TEAM, sessions, publicBase: (req, auth) => publicUrl() ?? (auth.kind === "session" ? requestOrigin(req) : null) }),createTeamConnectionRoutes({ host: teamConnections, cfg: () => cfg, composio, publicOrigin: CLOUD_HOME?.publicOrigin ?? null, record: (auth, row) => appendAdminAction(DATA_DIR, { ...row, actor: decisionActorFor(auth) }) }), createSignInCardRoutes({ settle: signInSettle.settle, saveLogin: (botId, threadId, messageId, body, auth) => CLOUD_TEAM && !auth.scopes.includes("admin") ? Promise.resolve({ status: 403 as const, body: { error: memberLoginRefusal(CLOUD_TEAM) } }) : saveLoginFromCard(botId, threadId, messageId, body), saveTarget: signInSaveTarget, threadVisible: (auth, threadId) => visibleTo(viewerFor(auth)).thread(threadId) }));@@ -12613,7 +12613,7 @@ ROUTES.push(createBrowserViewerRoutes({restartRefusal: (session) => browserRestartRefusal(browserRuntime.interrupted(session), store.bots.filter((candidate) => candidate.busy&& browserSessionsOf(candidate.id, candidate.browserProfile).includes(session)).map((candidate) => ({ waitingOnBrowser: computerControl.snapshot(candidate.id).help?.place === "browser" }))),}));-const internalToolRoutes = createInternalToolRoutes({ helpers: { decider, extractor }, notifications: { bot: (id) => store.bot(id), team: () => CLOUD_TEAM !== null, broadcast }, xResearch: { credential: () => researchCredential(cfg.treg?.key), botEnabled: (botId) => store.bot(botId)?.xResearch !== false, cloudHome: CLOUD_HOME !== null } }); ROUTES.push(createXConnectorRoutes({ credential: () => researchCredential(cfg.treg?.key), included: () => xCredential(), unavailable: () => xResearchStatus().unavailable === true }));+const internalToolRoutes = createInternalToolRoutes({ helpers: { decider, extractor }, notifications: { bot: (id) => store.bot(id), team: () => CLOUD_TEAM !== null, broadcast }, xResearch: { credential: () => researchCredential(cfg.treg?.key), botEnabled: (botId) => store.bot(botId)?.xResearch !== false, cloudHome: CLOUD_HOME !== null } }); const waitRoutes = createWaitRoutes({ waits: botWaits, cloudHome: Boolean(CLOUD_HOME), sleeps: Boolean(CLOUD_HOME) && CLOUD_TEAM === null }); ROUTES.push(createXConnectorRoutes({ credential: () => researchCredential(cfg.treg?.key), included: () => xCredential(), unavailable: () => xResearchStatus().unavailable === true }));// Live calls: the client holds the WebRTC audio; the key never leaves the harness, which creates the session.function liveBotFor(botId: string): LiveBot {@@ -13188,7 +13188,7 @@ const handleRequest = async (req: IncomingMessage, res: ServerResponse) => {throw Object.assign(new Error("the internal turn capability has expired"), { status: 401 });}};- const botFolders = async () => ({ roots: messageFileRootsForThread(internalSender.id, internalCapability.threadId).filter((root) => root !== ATTACHMENTS_DIR), vmWorkspace: (await attachmentVmForTurn(internalCapability))?.workspaceDir ?? null }); if (await internalToolRoutes({ method, path, res, json, botId: internalSender.id, readBody: readInternalBody, folders: botFolders }) !== PASS || await teamMessages.internal({ method, path, res, json, botId: internalSender.id, threadId: internalCapability.threadId, readBody: readInternalBody }) !== PASS || await devsReports.internal({ method, path, res, json, botId: internalSender.id, threadId: internalCapability.threadId, readBody: readInternalBody }) !== PASS) return; const pagesCall = new AbortController(); res.once("close", () => { if (!res.writableEnded) pagesCall.abort(); }); if (await publishedPages.internal({ method, path, res, json, botId: internalSender.id, threadId: internalCapability.threadId, readBody: readInternalBody, requireActive: requireActiveInternalCapability, signal: pagesCall.signal, folders: botFolders, post: (text, publishedPage, bundle) => { const source = connectorThread(internalSender.id, internalCapability.threadId); return !source ? null : (!source.group && bundle && publishedPages.show({ threadId: internalCapability.threadId, card: publishedPage, bundle })) || store.appendMessage(internalCapability.threadId, { role: "bot", kind: "text", text, publishedPage, ...(source.group ? { from: { botId: internalSender.id, name: internalSender.name, color: internalSender.color } } : {}) }).id; } }) !== PASS) return;+ const botFolders = async () => ({ roots: messageFileRootsForThread(internalSender.id, internalCapability.threadId).filter((root) => root !== ATTACHMENTS_DIR), vmWorkspace: (await attachmentVmForTurn(internalCapability))?.workspaceDir ?? null }); if (await internalToolRoutes({ method, path, res, json, botId: internalSender.id, readBody: readInternalBody, folders: botFolders }) !== PASS || await waitRoutes({ method, path, res, json, botId: internalSender.id, threadId: internalCapability.threadId, readBody: readInternalBody, ...waitTurnChecks(internalCapability, internalSender) }) !== PASS || await teamMessages.internal({ method, path, res, json, botId: internalSender.id, threadId: internalCapability.threadId, readBody: readInternalBody }) !== PASS || await devsReports.internal({ method, path, res, json, botId: internalSender.id, threadId: internalCapability.threadId, readBody: readInternalBody }) !== PASS) return; const pagesCall = new AbortController(); res.once("close", () => { if (!res.writableEnded) pagesCall.abort(); }); if (await publishedPages.internal({ method, path, res, json, botId: internalSender.id, threadId: internalCapability.threadId, readBody: readInternalBody, requireActive: requireActiveInternalCapability, signal: pagesCall.signal, folders: botFolders, post: (text, publishedPage, bundle) => { const source = connectorThread(internalSender.id, internalCapability.threadId); return !source ? null : (!source.group && bundle && publishedPages.show({ threadId: internalCapability.threadId, card: publishedPage, bundle })) || store.appendMessage(internalCapability.threadId, { role: "bot", kind: "text", text, publishedPage, ...(source.group ? { from: { botId: internalSender.id, name: internalSender.name, color: internalSender.color } } : {}) }).id; } }) !== PASS) return;const delegatedThisTurn = (taskId: string) => {(internalCapability.delegatedThisTurn ??= new Set()).add(taskId);};@@ -15682,7 +15682,7 @@ restoreChannelMessages();if (CLOUD_HOME) registerCloudPower(cloudPower = createCloudPower({ dataDir: DATA_DIR, team: CLOUD_TEAM !== null, broadcast: (payload) => broadcast(payload), log: (line) => console.warn(line), probes: {turn: () => store.bots.some((bot) => botHasActiveTurn(bot.id)) || store.groups.some(groupIsWorking), run: () => Boolean(routines?.hasActiveRuns()),- liveCall: () => liveCalls.current() !== null, computer: () => cloudComputerPower.awake() || boatLifecycleBusyBots.size > 0, nextDueAt: () => { const due = [routines?.nextDueAt() ?? null, proactive.brief.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()].filter((at): at is number => at !== null); return due.length ? Math.min(...due) : null; },maintenance: () => workspaceMaintenance.active || providerFleetReloading || providerAuthSessions.active || browserEngineInstall !== null } }));server.listen(PORT, "127.0.0.1", async () => {@@ -15700,7 +15700,7 @@ server.listen(PORT, "127.0.0.1", async () => {if (companyShutdown) return;}// Only once every registry is initialized and the endpoint listens: earlier dispatch can hit uninitialized bindings.- moveFreeze.hold(() => { routines!.start(); proactive.start(); }, () => { routines!.stop(); proactive.stop(); });+ moveFreeze.hold(() => { routines!.start(); botWaits.start(); proactive.start(); }, () => { routines!.stop(); botWaits.stop(); proactive.stop(); });limitClock.start();moveFreeze.hold(() => memoryUpkeep.start(), () => memoryUpkeep.stop());});@@ -15762,7 +15762,7 @@ const gracefulShutdown = createGracefulShutdown({vps.closeAllVpsDesktopTunnels();watchdog.stop();routines?.close(); void appTriggers.stop();- calendarCalls?.stop();+ calendarCalls?.stop(); botWaits.stop();memoryUpkeep.stop();cacheKeepWarm.dispose();skillReview.stop();diff --git a/server/mausbot-notifications.test.ts b/server/mausbot-notifications.test.tsindex 57543a9932..3c77c07370 100644--- a/server/mausbot-notifications.test.ts+++ b/server/mausbot-notifications.test.ts@@ -10,7 +10,7 @@ import type { BotRecord } from "./store.ts";const NOW = 1_000_000_000;const MAUS = { id: "maus", name: "MausBot", defaultBot: {} } as BotRecord;-const ALL_KINDS = ["approval", "question", "done", "routine-failed", "routine-deferred", "turn-failed", "incident", "sign-in", "delegation-settled", "mention", "spend", "brief"] satisfies NotifyKind[];+const ALL_KINDS = ["approval", "question", "done", "routine-failed", "routine-deferred", "turn-failed", "incident", "sign-in", "delegation-settled", "mention", "spend", "brief", "wait"] satisfies NotifyKind[];const entry = (id: string, kind: string, extra: Partial<NotificationLogEntry> = {}): NotificationLogEntry =>({ id, kind, botId: "pip", botName: "Pip", threadId: `t-${id}`, title: `Title ${id}`, body: `Body ${id}`, at: NOW - 5 * 60_000, read: false, ...extra }) as NotificationLogEntry;diff --git a/server/mausbot-notifications.ts b/server/mausbot-notifications.tsindex eea1b0dde6..fc3b50b5a4 100644--- a/server/mausbot-notifications.ts+++ b/server/mausbot-notifications.ts@@ -30,6 +30,7 @@ const LEAN: Record<NotifyKind, Lean> = {mention: "needs-you",spend: "needs-you",brief: "needs-you",+ wait: "fyi",notice: "fyi",};diff --git a/server/move-freeze-thaw.test.ts b/server/move-freeze-thaw.test.tsindex 44a1e4c9fa..70cc9118cd 100644--- a/server/move-freeze-thaw.test.ts+++ b/server/move-freeze-thaw.test.ts@@ -40,7 +40,7 @@ function frozenCopy({ exportOnly = false } = {}) {freeze.hold(() => calls.start(), () => calls.stop());// Frozen past both times: the morning routine and the call are due the moment the schedulers start.clock += 75 * 60_000;- const automations = { routines: () => routines, calls: () => calls, webhooks: () => webhooks, appEvents: () => appEvents } as unknown as MoveAutomations;+ const automations = { routines: () => routines, calls: () => calls, webhooks: () => webhooks, appEvents: () => appEvents, waits: () => null } as unknown as MoveAutomations;const route = createMoveFreezeRoutes({ freeze, busy: () => null, restart() {}, automationsOff: () => switchAutomationsOff(automations) });const lift = async (body: unknown) => {let answered: { status: number; body: any } | undefined;diff --git a/server/move-freeze.test.ts b/server/move-freeze.test.tsindex 40150b62ca..96862fad27 100644--- a/server/move-freeze.test.ts+++ b/server/move-freeze.test.ts@@ -3,10 +3,11 @@ import { tmpdir } from "node:os";import { join } from "node:path";import { afterEach, describe, expect, it } from "vitest";-import { createMoveFreeze, ENDED_REFUSAL, HOME_SCREEN, MOVED_REFUSAL, RAIL_PAGE } from "./move-freeze.ts";+import { createMoveFreeze, ENDED_REFUSAL, HOME_SCREEN, MOVED_REFUSAL, RAIL_PAGE, switchAutomationsOff, type MoveAutomations } from "./move-freeze.ts";import type { MoveWait } from "./move-waits.ts";import { createMoveFreezeRoutes } from "./routes/move-freeze.ts";import { PASS } from "./routes/table.ts";+import { WaitManager, type WaitNotice } from "./waits.ts";const dirs: string[] = [];const dataDir = () => { const dir = mkdtempSync(join(tmpdir(), "omb-move-freeze-")); dirs.push(dir); return dir; };@@ -85,6 +86,45 @@ describe("this computer's copy, frozen at the move", () => {});});+describe("switching this computer's automations off for a move", () => {+ it("cancels every wait, one already over but not yet posted too, so none posts, notifies or follows up once the freeze lifts", async () => {+ const present = new Set<string>();+ let chatBusy = true, clock = Date.UTC(2026, 9, 27, 9, 0);+ const posts: WaitNotice[] = [], followUps: string[] = [], cards: string[][] = [];+ const waits = new WaitManager({+ file: join(dataDir(), "waits.json"), now: () => clock, probes: { stamp: async (path) => (present.has(path) ? { size: 1, mtimeMs: 1 } : null) },+ sourceAlive: () => true, botBusy: () => false,+ post: (_wait, notice) => { if (chatBusy) return false; posts.push(notice); return true; },+ followUp: (wait) => { followUps.push(wait.label); },+ showCard: (wait) => `card-${wait.id}`,+ settleCard: (wait, how) => { cards.push([wait.label, how]); },+ });+ const made = async (botId: string, label: string, path: string) => {+ const result = await waits.create({ botId, threadId: `t-${botId}`, label, condition: { kind: "file_exists", path }, followUp: "Tell them." });+ if (result.state !== "created") throw new Error(result.state);+ return result.wait.id;+ };+ const report = await made("b1", "the report", "/report"), build = await made("b2", "the build", "/build");+ present.add("/build");+ clock += 5_000;+ await waits.tick();+ expect(waits.all().map((wait) => [wait.label, wait.ending?.status])).toEqual([["the report", undefined], ["the build", "fired"]]);++ const automations: MoveAutomations = { routines: () => null, calls: () => null, webhooks: () => null, appEvents: () => null, waits: () => waits };+ expect(await switchAutomationsOff(automations, new Set(["routine:r1"])), "only what is named").toEqual([]);+ expect(waits.all()).toHaveLength(2);+ expect(await switchAutomationsOff(automations)).toEqual([`wait:${report}`, `wait:${build}`]);+ expect(cards).toEqual([["the report", "cancelled"], ["the build", "cancelled"]]);+ expect(waits.all()).toEqual([]);++ chatBusy = false;+ present.add("/report");+ clock += 5_000;+ await waits.tick();+ expect([posts, followUps]).toEqual([[], []]);+ });+});+describe("/api/move/freeze", () => {const ask = async (route: ReturnType<typeof createMoveFreezeRoutes>, method: string, path = "/api/move/freeze", body: unknown = {}, kind = "loopback") => {let answered: { status: number; body: any } | undefined;diff --git a/server/move-freeze.ts b/server/move-freeze.tsindex 6e111c0b7b..0e956c39f8 100644--- a/server/move-freeze.ts+++ b/server/move-freeze.ts@@ -10,6 +10,7 @@ import type { AppTriggerManager } from "./app-triggers.ts";import { writeFileAtomic } from "./atomic.ts";import type { CalendarCallManager } from "./calendar-calls.ts";import type { RoutineManager } from "./routines.ts";+import type { WaitManager } from "./waits.ts";import type { WebhookManager } from "./webhooks.ts";export const MOVED_REFUSAL = "This bot lives on My Cloud now.";@@ -39,11 +40,13 @@ export interface MoveAutomations {calls(): Pick<CalendarCallManager, "list" | "switchOff"> | null;webhooks(): Pick<WebhookManager, "list" | "update"> | null;appEvents(): Pick<AppTriggerManager, "list" | "update"> | null;+ waits(): Pick<WaitManager, "all" | "cancel"> | null;}/** Switches off every automation that is on, or only those named by key ("routine:<id>", "call:<id>", "webhook:<id>",- * "app-event:<id>"); the person can switch each on again by hand. Done while frozen, so none of them runs once the freeze- * lifts. One that can't be switched off is logged, never a reason to stay frozen. The keys of those switched off. */+ * "app-event:<id>", "wait:<id>"); the person can switch each on again by hand, and a wait is cancelled. Done while frozen,+ * so none of them runs once the freeze lifts. One that can't be switched off is logged, never a reason to stay frozen.+ * The keys of those switched off. */export async function switchAutomationsOff(automations: MoveAutomations, only?: ReadonlySet<string>): Promise<string[]> {const done: string[] = [];const off = async (kind: string, id: string, work: () => unknown) => {@@ -51,11 +54,12 @@ export async function switchAutomationsOff(automations: MoveAutomations, only?:if (only && !only.has(key)) return;try { await work(); done.push(key); } catch (error) { console.warn(`move freeze: could not switch ${kind} ${id} off (${(error as Error).message})`); }};- const routines = automations.routines(), calls = automations.calls(), webhooks = automations.webhooks(), appEvents = automations.appEvents();+ const routines = automations.routines(), calls = automations.calls(), webhooks = automations.webhooks(), appEvents = automations.appEvents(), waits = automations.waits();for (const routine of routines?.listRoutines() ?? []) if (routine.enabled) await off("routine", routine.id, () => routines!.update(routine.id, { enabled: false }));for (const call of calls?.list() ?? []) if (call.nextRunAt !== null) await off("call", call.id, () => calls!.switchOff(call.id));for (const webhook of webhooks?.list() ?? []) if (webhook.enabled) await off("webhook", webhook.id, () => webhooks!.update(webhook.id, { enabled: false }));for (const trigger of appEvents?.list() ?? []) if (trigger.enabled) await off("app-event", trigger.id, () => appEvents!.update(trigger.id, { enabled: false }));+ for (const wait of waits?.all() ?? []) await off("wait", wait.id, () => { if (!waits!.cancel(wait.id, wait.botId)) throw new Error("it already ended"); });return done;}diff --git a/server/notify.test.ts b/server/notify.test.tsindex 738db4697b..0cca2fc231 100644--- a/server/notify.test.ts+++ b/server/notify.test.ts@@ -77,6 +77,11 @@ describe("buildNotification", () => {expect(buildNotification("done", bot, "thread-1", "pushed")?.avatarUrl).toBeUndefined();});+ it("titles a finished wait and keeps its line as the body", () => {+ expect(buildNotification("wait", { id: "b", name: "Pepper" }, "t", "the build: done. ci passed.")).toEqual({+ kind: "wait", botId: "b", botName: "Pepper", threadId: "t", title: "Pepper's wait is over", body: "the build: done. ci passed.",+ });+ });});describe("sign-in requests", () => {diff --git a/server/notify.ts b/server/notify.tsindex 09c6175d17..0485cd1d88 100644--- a/server/notify.ts+++ b/server/notify.ts@@ -58,7 +58,9 @@ export function buildNotification(? `${who} resumed with results`: kind === "mention"? `${who} mentioned you`- : `${who} finished`;+ : kind === "wait"+ ? `${who}'s wait is over`+ : `${who} finished`;if ((kind === "done" || kind === "mention") && !body) return null;diff --git a/server/read-and-draft.test.ts b/server/read-and-draft.test.tsindex 16399e6b4c..2023926f75 100644--- a/server/read-and-draft.test.ts+++ b/server/read-and-draft.test.ts@@ -80,7 +80,7 @@ describe("the fence around a read-and-draft run", () => {for (const route of [["GET", "/api/internal/session-search"], ["POST", "/api/internal/hook"], ["POST", "/api/internal/connectors/mcp"]]) {expect(gate.refusesRoute(bot, "run-thread", route[0]!, route[1]!)).toBe(false);}- for (const route of [["POST", "/api/internal/coordinate"], ["POST", "/api/internal/memory"], ["POST", "/api/internal/options-card"], ["POST", "/api/internal/trigger-requests"]]) {+ for (const route of [["POST", "/api/internal/coordinate"], ["POST", "/api/internal/memory"], ["POST", "/api/internal/options-card"], ["POST", "/api/internal/trigger-requests"], ["POST", "/api/internal/waits"], ["GET", "/api/internal/waits"], ["POST", "/api/internal/waits/cancel"]]) {expect(gate.refusesRoute(bot, "run-thread", route[0]!, route[1]!)).toBe(true);}expect(gate.refusesRoute(bot, "main-chat", "POST", "/api/internal/memory")).toBe(false);diff --git a/server/routes/waits.test.ts b/server/routes/waits.test.tsnew file mode 100644index 0000000000..01b36e6bc3--- /dev/null+++ b/server/routes/waits.test.ts@@ -0,0 +1,186 @@+import { join } from "node:path";+import { describe, expect, it, vi } from "vitest";++import { WAIT_KINDS } from "../../shared/waits.ts";+import type { NewWait, WaitRecord } from "../waits.ts";+import { createWaitRoutes, findWaitPeer, hostWaitRefusal, isNetworkPath, parseWaitRequest, waitSourceRefusal, WAIT_MESSAGES } from "./waits.ts";+import { PASS } from "./table.ts";++const HOME = "/home/maus";+const FILE_WAIT = { label: "the report", kind: "file_exists", path: "/r.txt" };++const waits = {+ create: vi.fn(async (input: NewWait) => ({ state: "created", wait: { id: "w1", label: input.label, expiresAt: 0 } }) as never),+ list: vi.fn((_botId: string): WaitRecord[] => []),+ cancel: vi.fn((_id: string, _botId: string): WaitRecord | null => null),+};++const readBody = vi.fn(async (): Promise<unknown> => undefined);++async function call(method: string, path: string, body?: unknown, overrides: Partial<Parameters<ReturnType<typeof createWaitRoutes>>[0]> = {}, cloudHome = false, sleeps = cloudHome) {+ const route = createWaitRoutes({ waits, home: () => HOME, cloudHome, sleeps });+ const json = vi.fn();+ const outcome = await route({+ method, path, res: {} as never, json, botId: "bot-1", threadId: "thread-1", readBody: async () => { readBody(); return body; },+ sourceRefusal: () => null, hostRefusal: () => null, guest: () => false, peer: () => null, ...overrides,+ });+ const [, status, payload] = json.mock.calls[0] ?? [];+ return { outcome, status: status as number | undefined, payload: payload as { text?: string; error?: string } };+}++describe("the waits route", () => {+ it("passes requests that are not its own", async () => {+ expect((await call("GET", "/api/internal/triggers")).outcome).toBe(PASS);+ expect((await call("DELETE", "/api/internal/waits")).outcome).toBe(PASS);+ });+ it("makes a wait for the capability's bot and chat, never ids from the body", async () => {+ waits.create.mockClear();+ const { status, payload } = await call("POST", "/api/internal/waits", { label: "the report", kind: "file_exists", path: "~/r.txt", botId: "evil", threadId: "evil" });+ expect(waits.create).toHaveBeenCalledWith({ botId: "bot-1", threadId: "thread-1", label: "the report", condition: { kind: "file_exists", path: join(HOME, "r.txt") }, hours: 24 });+ expect([status, payload.text]).toEqual([201, expect.stringContaining("(wait id w1)")]);+ });+ it("carries follow_up as followUp and says so in the answer", async () => {+ waits.create.mockClear();+ const { payload } = await call("POST", "/api/internal/waits", { ...FILE_WAIT, follow_up: " tell me the size ", hours: 2 });+ expect(waits.create).toHaveBeenCalledWith(expect.objectContaining({ followUp: "tell me the size", hours: 2 }));+ expect(payload.text).toContain("you will then do what you wrote in follow_up");+ expect(payload.text).toContain("plain checks, no AI, until 1970-01-01T00:00:00.000Z");+ });+ it("says on a Cloud home that a sleeping My Cloud wakes to check every 30 minutes, and that the follow-up reports in its own results chat", async () => {+ const here = (await call("POST", "/api/internal/waits", { ...FILE_WAIT, follow_up: "Deploy it." })).payload.text!;+ expect(here).toContain("lands in this chat, and you will then do what you wrote in follow_up. Tell the person");+ expect(here).not.toContain("My Cloud");+ const cloud = (await call("POST", "/api/internal/waits", { ...FILE_WAIT, follow_up: "Deploy it." }, {}, true)).payload.text!;+ expect(cloud).toContain("lands in this chat, and you will then do what you wrote in follow_up in a run that reports in its own results chat, not this one.");+ expect(cloud).toContain(" While My Cloud sleeps it wakes to check every 30 minutes, so the message can come up to 30 minutes late: tell the person that too. Tell the person in one sentence;");+ expect((await call("POST", "/api/internal/waits", FILE_WAIT, {}, true)).payload.text).toContain("lands in this chat. While My Cloud sleeps it wakes to check every 30 minutes");+ });+ it("never says a Team Cloud sleeps: its plan never does", async () => {+ const team = (await call("POST", "/api/internal/waits", { ...FILE_WAIT, follow_up: "Deploy it." }, {}, true, false)).payload.text!;+ expect(team).toContain("in a run that reports in its own results chat, not this one.");+ expect(team).not.toContain("sleeps");+ });+ it("answers 200 for a condition already true and the manager's status for a refusal, and appends a note", async () => {+ waits.create.mockResolvedValueOnce({ state: "already", text: "It exists already." } as never);+ expect(await call("POST", "/api/internal/waits", FILE_WAIT)).toMatchObject({ status: 200, payload: { text: "It exists already." } });+ waits.create.mockResolvedValueOnce({ state: "refused", status: 409, error: "Too many." } as never);+ expect(await call("POST", "/api/internal/waits", FILE_WAIT)).toMatchObject({ status: 409, payload: { error: "Too many." } });+ waits.create.mockResolvedValueOnce({ state: "created", wait: { id: "w2", label: "l", expiresAt: 0 }, note: "Slow page." } as never);+ expect((await call("POST", "/api/internal/waits", FILE_WAIT)).payload.text).toMatch(/\n\nSlow page\.$/);+ });+ it("refuses a turn the person did not start in their own chat, for making and for stopping", async () => {+ waits.create.mockClear(); waits.cancel.mockClear(); readBody.mockClear();+ for (const [path, body] of [["/api/internal/waits", FILE_WAIT], ["/api/internal/waits/cancel", { id: "w1" }]] as const) {+ expect(await call("POST", path, body, { sourceRefusal: () => WAIT_MESSAGES.notPerson })).toMatchObject({ status: 403, payload: { error: WAIT_MESSAGES.notPerson } });+ }+ expect(waits.create).not.toHaveBeenCalled();+ expect(waits.cancel).not.toHaveBeenCalled();+ expect(readBody).not.toHaveBeenCalled();+ });+ it("refuses a Cloud guest's follow-up, since it would run as the owner's, and still makes a guest's wait that only tells", async () => {+ waits.create.mockClear();+ const guest = { guest: () => true };+ const page = { label: "the price drops", kind: "url_contains", url: "https://x.test/", text: "sale" };+ expect(await call("POST", "/api/internal/waits", { ...page, follow_up: "Buy it." }, guest)).toMatchObject({ status: 403, payload: { error: WAIT_MESSAGES.guestFollowUp } });+ expect(waits.create).not.toHaveBeenCalled();+ expect(await call("POST", "/api/internal/waits", page, guest)).toMatchObject({ status: 201 });+ expect(waits.create).toHaveBeenCalledWith(expect.not.objectContaining({ followUp: expect.anything() }));+ expect(await call("POST", "/api/internal/waits", { ...page, follow_up: "Buy it." })).toMatchObject({ status: 201 });+ });+ it("refuses file and program waits away from the bot's own computer, and allows pages and bots there", async () => {+ const away = { hostRefusal: () => WAIT_MESSAGES.otherComputer, peer: () => ({ id: "b2", name: "Coder" }) };+ expect(await call("POST", "/api/internal/waits", FILE_WAIT, away)).toMatchObject({ status: 403, payload: { error: WAIT_MESSAGES.otherComputer } });+ expect(await call("POST", "/api/internal/waits", { label: "l", kind: "process_gone", process: "make" }, away)).toMatchObject({ status: 403 });+ expect(await call("POST", "/api/internal/waits", { label: "l", kind: "url_contains", url: "https://x.test/", text: "ok" }, away)).toMatchObject({ status: 201 });+ expect(await call("POST", "/api/internal/waits", { label: "l", kind: "bot_idle", bot: "coder" }, away)).toMatchObject({ status: 201 });+ });+ it.each([+ [{ label: "", kind: "file_exists", path: "/r" }, "label: the person's words for what you wait for, up to 120 characters."],+ [{ label: "l", kind: "file_seen", path: "/r" }, `kind is one of: ${WAIT_KINDS.join(", ")}.`],+ [{ label: "l", kind: "url_contains", url: "https://x.test/" }, "url_contains needs url and text."],+ [{ label: "l", kind: "file_exists", path: "/r", text: "x" }, "text applies only to url_contains and url_missing."],+ [{ label: "l", kind: "url_missing", url: "ftp://x.test/", text: "x" }, "url must be an http or https address."],+ [{ label: "l", kind: "url_missing", url: "https://u:[email protected]/", text: "x" }, "Put no sign-in details in the address."],+ [{ label: "l", kind: "url_contains", url: "https://x.test/", text: "" }, "text must be 1 to 500 characters."],+ [{ label: "l", kind: "url_missing", url: "https://x.test/", text: " " }, "text must be 1 to 500 characters."],+ [{ label: "l", kind: "file_exists", path: "build/out.txt" }, "path must be a full path or start with ~."],+ [{ label: "l", kind: "file_exists", path: "/r", hours: 169 }, "hours is a whole number from 1 to 168."],+ [{ label: "l", kind: "file_exists", path: "/r", hours: 0 }, "hours is a whole number from 1 to 168."],+ [{ label: "l", kind: "file_exists", path: "/r", follow_up: " " }, "follow_up must be 1 to 2000 characters."],+ [{ label: "l", kind: "bot_idle", bot: "x", path: "/r" }, "path applies only to file_exists, file_missing and file_changed."],+ ])("refuses %j", async (body, error) => {+ waits.create.mockClear();+ expect(await call("POST", "/api/internal/waits", body)).toMatchObject({ status: 400, payload: { error } });+ expect(waits.create).not.toHaveBeenCalled();+ });+ it("refuses a network path with either slash, mixed or percent-encoded, before anything checks it", async () => {+ waits.create.mockClear();+ const error = "path must be on this computer: a network path (\\\\server\\share or //server/share) is never checked.";+ for (const path of ["\\\\host\\share\\x", "//host/share/x", "\\/host/share", "/\\host\\share", "\\\\?\\UNC\\host\\share\\x", " \\\\host\\share", "%5C%5Chost%5Cshare", "%2f%2fhost/share", "/%2Fhost/share", "%255C%255Chost"]) {+ expect(await call("POST", "/api/internal/waits", { ...FILE_WAIT, path }), path).toMatchObject({ status: 400, payload: { error } });+ }+ expect(waits.create).not.toHaveBeenCalled();+ for (const path of ["/srv/share/x", "~/a//b", "C:\\Users\\maus\\r.txt", "/a/%2F/b"]) expect(isNetworkPath(path), path).toBe(false);+ });+ it("treats null as absent and a body that is not an object as an error", async () => {+ expect(parseWaitRequest({ ...FILE_WAIT, text: null, hours: null }, HOME)).toMatchObject({ ok: true, request: { hours: 24 } });+ expect(parseWaitRequest("nope", HOME)).toEqual({ ok: false, error: "Send a JSON object." });+ });+ it("finds the other bot by name or id among the bots it may reach, never itself", async () => {+ const peers = [{ id: "b2", name: "Coder" }, { id: "b3", name: "Hidden", hidden: true }, { id: "bot-1", name: "Pepper" }];+ expect(findWaitPeer(peers, "bot-1", "coder")).toEqual({ id: "b2", name: "Coder" });+ expect(findWaitPeer(peers, "bot-1", "b2")).toEqual({ id: "b2", name: "Coder" });+ expect([findWaitPeer(peers, "bot-1", "Hidden"), findWaitPeer(peers, "bot-1", "pepper")]).toEqual([null, "self"]);+ expect(await call("POST", "/api/internal/waits", { label: "l", kind: "bot_idle", bot: "nobody" }, { peer: () => null })).toMatchObject({ status: 400, payload: { error: WAIT_MESSAGES.noPeer } });+ expect(await call("POST", "/api/internal/waits", { label: "l", kind: "bot_idle", bot: "me" }, { peer: () => "self" })).toMatchObject({ status: 400, payload: { error: WAIT_MESSAGES.self } });+ });+ it("waits for the found bot by id and name", async () => {+ waits.create.mockClear();+ await call("POST", "/api/internal/waits", { label: "l", kind: "bot_idle", bot: "coder" }, { peer: () => ({ id: "b2", name: "Coder" }) });+ expect(waits.create).toHaveBeenCalledWith(expect.objectContaining({ condition: { kind: "bot_idle", botId: "b2", botName: "Coder" } }));+ });+ it("lets a bot cancel only waits made in this chat and lists only those", async () => {+ waits.cancel.mockClear(); waits.list.mockClear();+ const mine = { id: "w1", label: "the build", threadId: "thread-1", condition: { kind: "process_gone", process: "make" }, createdAt: 0, expiresAt: 0 } as WaitRecord;+ const elsewhere = { ...mine, id: "w9", label: "other chat", threadId: "thread-A" } as WaitRecord;+ waits.list.mockReturnValue([mine, elsewhere]);+ expect(await call("POST", "/api/internal/waits/cancel", { id: "w9" })).toMatchObject({ status: 404, payload: { error: "None of your waits in this chat has that id. Use list_waits." } });+ expect(waits.cancel).not.toHaveBeenCalled();+ waits.cancel.mockReturnValueOnce(mine);+ expect(await call("POST", "/api/internal/waits/cancel", { id: "w1" })).toMatchObject({ status: 200, payload: { text: "Stopped waiting for the build." } });+ expect(waits.cancel.mock.calls).toEqual([["w1", "bot-1"]]);+ const listed = (await call("GET", "/api/internal/waits")).payload.text;+ expect(listed).toContain("w1 · the build");+ expect(listed).not.toContain("w9");+ expect(waits.list).toHaveBeenCalledWith("bot-1");+ expect(await call("GET", "/api/internal/waits", undefined, { threadId: "thread-B" })).toMatchObject({ status: 200, payload: { text: "You are not waiting for anything in this chat." } });+ expect(await call("POST", "/api/internal/waits/cancel", { id: "w1" }, { threadId: "thread-B" })).toMatchObject({ status: 404 });+ waits.list.mockReturnValue([]);+ });+ it("keeps a turn that is not the person's conversation from listing", async () => {+ expect(await call("GET", "/api/internal/waits", undefined, { sourceRefusal: () => WAIT_MESSAGES.notYours })).toMatchObject({ status: 403, payload: { error: WAIT_MESSAGES.notYours } });+ });+ it("keeps the address as the URL parser normalises it and the label to one line", async () => {+ waits.create.mockClear();+ await call("POST", "/api/internal/waits", { label: "l", kind: "url_contains", url: "https://X.test", text: "ok" });+ expect(waits.create).toHaveBeenCalledWith(expect.objectContaining({ condition: { kind: "url_contains", url: "https://x.test/", text: "ok" } }));+ expect(await call("POST", "/api/internal/waits", { ...FILE_WAIT, label: "a\nb" })).toMatchObject({ status: 400, payload: { error: "label must be a single line of plain text." } });+ });+ it("lets only a person's own one-to-one turn make a wait", () => {+ const person = { owned: true, room: false, depth: 0, handedOff: false, routineRun: false, outsideDriven: false, personStarted: true, guest: false };+ expect(waitSourceRefusal(person)).toBeNull();+ expect(waitSourceRefusal({ ...person, personStarted: false, guest: true })).toBeNull();+ expect(waitSourceRefusal({ ...person, owned: false })).toBe(WAIT_MESSAGES.notYours);+ expect(waitSourceRefusal({ ...person, room: true })).toBe(WAIT_MESSAGES.room);+ for (const other of [{ depth: 1 }, { handedOff: true }, { routineRun: true }, { outsideDriven: true }, { personStarted: false }]) {+ expect(waitSourceRefusal({ ...person, ...other }), JSON.stringify(other)).toBe(WAIT_MESSAGES.notPerson);+ }+ });+ it("offers files and programs only on the bot's own computer", () => {+ const own = { cloudHome: false, hosted: false, guest: false, place: null };+ for (const place of [null, "local", "browser"] as const) expect(hostWaitRefusal({ ...own, place })).toBeNull();+ for (const place of ["vm", "cloud"] as const) expect(hostWaitRefusal({ ...own, place })).toBe(WAIT_MESSAGES.otherComputer);+ expect([hostWaitRefusal({ ...own, cloudHome: true }), hostWaitRefusal({ ...own, hosted: true }), hostWaitRefusal({ ...own, guest: true })])+ .toEqual([WAIT_MESSAGES.serverHost, WAIT_MESSAGES.serverHost, WAIT_MESSAGES.guest]);+ });+});diff --git a/server/routes/waits.ts b/server/routes/waits.tsnew file mode 100644index 0000000000..61a082c4c9--- /dev/null+++ b/server/routes/waits.ts@@ -0,0 +1,230 @@+import type { ServerResponse } from "node:http";+import { homedir } from "node:os";+import { isAbsolute } from "node:path";++import { WAIT_HOURS, WAIT_KINDS, type WaitKind } from "../../shared/waits.ts";+import type { Surface } from "../../shared/wire.ts";+import type { json as sendJson } from "../harness/http.ts";+import { expandHome } from "../wait-probes.ts";+import { WAIT_WAKE_MS, waitList, type NewWaitCondition, type WaitManager } from "../waits.ts";+import { PASS } from "./table.ts";++const WAITS = "/api/internal/waits";+const CANCEL = "/api/internal/waits/cancel";++export const WAIT_MESSAGES = {+ notYours: "This conversation is not yours.",+ room: "Waits are made in a one-to-one chat with the person, not in a room.",+ notPerson: "Only the person can set up or stop a wait, in their own chat with you; work handed to you by a bot, a routine or an outside event cannot.",+ serverHost: "File and program waits look at the computer MausBot runs on, and here that is a server, not the computer you work on. Use url_contains, url_missing or bot_idle.",+ guest: "File and program waits are only for the owner of this computer. Use url_contains, url_missing or bot_idle.",+ guestFollowUp: "Guests can be told when something happens, but can't set a follow-up. Make the wait without follow_up.",+ otherComputer: "You work on another computer this turn (a private desktop or a cloud desktop), and file and program waits look at the one MausBot runs on. Use url_contains, url_missing or bot_idle.",+ noPeer: "No bot you can reach goes by that name. Use a name or id from list_bots.",+ self: "You cannot wait for yourself to finish. Tell the person yourself when you are done.",+ noWait: "None of your waits in this chat has that id. Use list_waits.",+ none: "You are not waiting for anything in this chat.",+} as const;++export interface WaitRequest {+ label: string; kind: WaitKind; url?: string; text?: string; path?: string; process?: string; bot?: string; followUp?: string; hours: number;+}++const FIELD_KINDS = {+ url: ["url_contains", "url_missing"],+ text: ["url_contains", "url_missing"],+ path: ["file_exists", "file_missing", "file_changed"],+ process: ["process_running", "process_gone"],+ bot: ["bot_idle"],+} as const satisfies Record<string, readonly WaitKind[]>;+type WaitField = keyof typeof FIELD_KINDS;+const FIELDS = Object.keys(FIELD_KINDS) as WaitField[];++/**+ * `\\host\share` or `//host/share`, with either slash, mixed or percent-encoded (`%5C`, `%2F`, `%255C`): a network path.+ * Windows would sign in to that host to check it, sending it the person's password hash.+ */+export function isNetworkPath(path: string): boolean {+ let plain = path.trim();+ for (let round = 0; round < 4 && /%(?:25|5c|2f)/i.test(plain); round++) {+ plain = plain.replace(/%(25|5c|2f)/gi, (_, hex: string) => String.fromCharCode(parseInt(hex, 16)));+ }+ return /^[\\/]{2}/.test(plain);+}++const isRecord = (value: unknown): value is Record<string, unknown> => Boolean(value) && typeof value === "object" && !Array.isArray(value);+const absent = (value: unknown) => value === undefined || value === null;+const joinWords = (words: readonly string[]) => (words.length < 2 ? words.join("") : `${words.slice(0, -1).join(", ")} and ${words.at(-1)}`);+const iso = (ms: number) => new Date(ms).toISOString();++export function parseWaitRequest(body: unknown, home: string): { ok: true; request: WaitRequest } | { ok: false; error: string } {+ const fail = (error: string) => ({ ok: false, error }) as const;+ if (!isRecord(body)) return fail("Send a JSON object.");+ const label = typeof body.label === "string" ? body.label.trim() : "";+ if (!label || label.length > 120) return fail("label: the person's words for what you wait for, up to 120 characters.");+ if (/\p{Cc}/u.test(label)) return fail("label must be a single line of plain text.");+ const kind = WAIT_KINDS.find((candidate) => candidate === body.kind);+ if (!kind) return fail(`kind is one of: ${WAIT_KINDS.join(", ")}.`);++ const needed = FIELDS.filter((field) => (FIELD_KINDS[field] as readonly WaitKind[]).includes(kind));+ if (needed.some((field) => absent(body[field]))) return fail(`${kind} needs ${needed.join(" and ")}.`);+ const stray = FIELDS.find((field) => !needed.includes(field) && !absent(body[field]));+ if (stray) return fail(`${stray} applies only to ${joinWords(FIELD_KINDS[stray])}.`);++ const request: WaitRequest = { label, kind, hours: WAIT_HOURS.default };+ const size = (field: WaitField | "follow_up", max: number, trim = false) => {+ const raw = body[field];+ const value = typeof raw === "string" ? (trim ? raw.trim() : raw) : "";+ return value.length >= 1 && value.length <= max && value.trim() ? value : null;+ };+ const lengthError = (field: string, max: number) => fail(`${field} must be 1 to ${max} characters.`);++ if (needed.includes("url")) {+ const raw = body.url;+ let parsed: URL | null = null;+ try { parsed = typeof raw === "string" && raw.length <= 2048 ? new URL(raw) : null; } catch { parsed = null; }+ if (!parsed || (parsed.protocol !== "http:" && parsed.protocol !== "https:")) return fail("url must be an http or https address.");+ if (parsed.username || parsed.password) return fail("Put no sign-in details in the address.");+ request.url = parsed.href;+ const text = size("text", 500);+ if (text === null) return lengthError("text", 500);+ request.text = text;+ }+ if (needed.includes("path")) {+ const raw = body.path;+ if (typeof raw === "string" && isNetworkPath(raw)) return fail("path must be on this computer: a network path (\\\\server\\share or //server/share) is never checked.");+ const path = typeof raw === "string" && raw.length >= 1 && raw.length <= 1024 ? expandHome(raw, home) : "";+ if (!path || !isAbsolute(path)) return fail("path must be a full path or start with ~.");+ request.path = path;+ }+ if (needed.includes("process")) {+ const process = size("process", 256);+ if (process === null) return lengthError("process", 256);+ request.process = process;+ }+ if (needed.includes("bot")) {+ const bot = size("bot", 128, true);+ if (bot === null) return lengthError("bot", 128);+ request.bot = bot;+ }+ if (!absent(body.follow_up)) {+ const followUp = size("follow_up", 2000, true);+ if (followUp === null) return lengthError("follow_up", 2000);+ request.followUp = followUp;+ }+ if (!absent(body.hours)) {+ const hours = body.hours;+ if (typeof hours !== "number" || !Number.isInteger(hours) || hours < 1 || hours > WAIT_HOURS.max) return fail(`hours is a whole number from 1 to ${WAIT_HOURS.max}.`);+ request.hours = hours;+ }+ return { ok: true, request };+}++export function waitSourceRefusal(turn: {+ owned: boolean; room: boolean; depth: number; handedOff: boolean; routineRun: boolean; outsideDriven: boolean; personStarted: boolean; guest: boolean;+}): string | null {+ if (!turn.owned) return WAIT_MESSAGES.notYours;+ if (turn.room) return WAIT_MESSAGES.room;+ if (turn.depth > 0 || turn.handedOff || turn.routineRun || turn.outsideDriven || !(turn.personStarted || turn.guest)) return WAIT_MESSAGES.notPerson;+ return null;+}++export function hostWaitRefusal(turn: { cloudHome: boolean; hosted: boolean; guest: boolean; place: Surface | null }): string | null {+ if (turn.cloudHome || turn.hosted) return WAIT_MESSAGES.serverHost;+ if (turn.guest) return WAIT_MESSAGES.guest;+ if (turn.place === "vm" || turn.place === "cloud") return WAIT_MESSAGES.otherComputer;+ return null;+}++export function findWaitPeer(+ peers: readonly { id: string; name: string; hidden?: boolean }[],+ selfId: string,+ nameOrId: string,+): { id: string; name: string } | "self" | null {+ const wanted = nameOrId.toLowerCase();+ const match = peers.find((peer) => !peer.hidden && (peer.id === nameOrId || peer.name.toLowerCase() === wanted));+ if (!match) return null;+ return match.id === selfId ? "self" : { id: match.id, name: match.name };+}++export interface WaitRouteContext {+ method: string;+ path: string;+ res: ServerResponse;+ json: typeof sendJson;+ botId: string;+ threadId: string;+ readBody: () => Promise<unknown>;+ sourceRefusal: () => string | null;+ hostRefusal: () => string | null;+ /** A Cloud guest's turn: its follow-up would run later as the owner's, so a guest's wait only tells. */+ guest: () => boolean;+ peer: (nameOrId: string) => { id: string; name: string } | "self" | null;+}++/** `sleeps`: the home is a personal My Cloud, whose plan sleeps when idle; a Team Cloud never sleeps. */+export function createWaitRoutes(deps: { waits: Pick<WaitManager, "create" | "list" | "cancel">; home?: () => string; cloudHome?: boolean; sleeps?: boolean }) {+ const home = deps.home ?? homedir;+ return async (ctx: WaitRouteContext): Promise<typeof PASS | void> => {+ const { res, json } = ctx;+ const here = () => deps.waits.list(ctx.botId).filter((wait) => wait.threadId === ctx.threadId);+ if (ctx.method === "GET" && ctx.path === WAITS) {+ if (ctx.sourceRefusal() === WAIT_MESSAGES.notYours) return void json(res, 403, { error: WAIT_MESSAGES.notYours });+ const mine = here();+ return void json(res, 200, { text: mine.length ? waitList(mine) : WAIT_MESSAGES.none });+ }+ if (ctx.method !== "POST" || (ctx.path !== WAITS && ctx.path !== CANCEL)) return PASS;++ const refusal = ctx.sourceRefusal();+ if (refusal) return void json(res, 403, { error: refusal });+ const body = await ctx.readBody();++ if (ctx.path === CANCEL) {+ const id = isRecord(body) ? body.id : undefined;+ if (typeof id !== "string" || !id) return void json(res, 400, { error: "id: the wait id from list_waits." });+ const stopped = here().some((wait) => wait.id === id) ? deps.waits.cancel(id, ctx.botId) : null;+ if (!stopped) return void json(res, 404, { error: WAIT_MESSAGES.noWait });+ return void json(res, 200, { text: `Stopped waiting for ${stopped.label}.` });+ }++ const parsed = parseWaitRequest(body, home());+ if (!parsed.ok) return void json(res, 400, { error: parsed.error });+ const { request } = parsed;+ if (request.followUp && ctx.guest()) return void json(res, 403, { error: WAIT_MESSAGES.guestFollowUp });+ if (request.kind.startsWith("file_") || request.kind.startsWith("process_")) {+ const away = ctx.hostRefusal();+ if (away) return void json(res, 403, { error: away });+ }++ let condition: NewWaitCondition;+ if (request.kind === "bot_idle") {+ const peer = ctx.peer(request.bot!);+ if (peer === "self") return void json(res, 400, { error: WAIT_MESSAGES.self });+ if (!peer) return void json(res, 400, { error: WAIT_MESSAGES.noPeer });+ condition = { kind: "bot_idle", botId: peer.id, botName: peer.name };+ } else if (request.kind === "url_contains" || request.kind === "url_missing") {+ condition = { kind: request.kind, url: request.url!, text: request.text! };+ } else if (request.kind === "process_running" || request.kind === "process_gone") {+ condition = { kind: request.kind, process: request.process! };+ } else {+ condition = { kind: request.kind, path: request.path! };+ }++ const result = await deps.waits.create({+ botId: ctx.botId,+ threadId: ctx.threadId,+ label: request.label,+ condition,+ ...(request.followUp ? { followUp: request.followUp } : {}),+ hours: request.hours,+ });+ if (result.state === "refused") return void json(res, result.status, { error: result.error });+ if (result.state === "already") return void json(res, 200, { text: result.text });+ const { wait, note } = result;+ const then = request.followUp ? `, and you will then do what you wrote in follow_up${deps.cloudHome ? " in a run that reports in its own results chat, not this one" : ""}` : "";+ const every = WAIT_WAKE_MS / 60_000;+ const sleeps = deps.sleeps ? ` While My Cloud sleeps it wakes to check every ${every} minutes, so the message can come up to ${every} minutes late: tell the person that too.` : "";+ const text = `Waiting for ${wait.label} (wait id ${wait.id}): plain checks, no AI, until ${iso(wait.expiresAt)}. When it happens a message lands in this chat${then}.${sleeps} Tell the person in one sentence; do not keep checking yourself.`;+ return void json(res, 201, { text: note ? `${text}\n\n${note}` : text });+ };+}diff --git a/server/routines.test.ts b/server/routines.test.tsindex 7e7fe103cf..41aef9d9c8 100644--- a/server/routines.test.ts+++ b/server/routines.test.ts@@ -3930,6 +3930,17 @@ describe("runs that report into a chat", () => {expect(h.taskTitles).toHaveLength(1);});+ it("runs a wait's follow-up in the chat it was asked in, reporting nowhere else", async () => {+ const h = harness();+ h.options.eventResultsThread = () => "main";+ h.options.joinConversation = (run) => run.eventSource === "wait" ? run.resultsThreadId ?? null : null;+ const queued = h.manager.enqueueWebhook({ webhookId: "wait:w1", webhookName: "the build", prompt: "[Wait finished: the build] Deploy.", botId: "maus-1",+ runOn: "maus", deliveryId: "w1", receivedAt: Date.now(), eventSource: "wait", resultsThreadId: "chat-1" });+ await h.manager.tick();+ expect(h.manager.listRuns().find((run) => run.id === queued.id)).toMatchObject({ eventSource: "wait", resultsThreadId: "chat-1", threadId: "chat-1", status: "running" });+ expect(h.taskTitles).toHaveLength(0);+ });+it("finds a conversation's live run before an older finished one", async () => {const h = harness();h.options.joinConversation = () => "chat";diff --git a/server/routines.ts b/server/routines.tsindex 046c272893..1f6590a72c 100644--- a/server/routines.ts+++ b/server/routines.ts@@ -112,8 +112,8 @@ export interface RoutineRun {/** Time spent waiting on the person's answers, which the run limit does not count. */waitedMs?: number;triggerSource?: RoutineRunTrigger;- /** "app": a connected-app event started it (its triggerSource stays "webhook", an outside event). */- eventSource?: "app";+ /** "app": a connected-app event started it; "wait": a wait's follow-up did (its triggerSource stays "webhook", an outside event). */+ eventSource?: "app" | "wait";webhookId?: string;deliveryId?: string;sourceThreadId?: string;@@ -766,14 +766,10 @@ export class RoutineManager {}enqueueWebhook(input: {- webhookId: string;- webhookName: string;- prompt: string;- botId: string;- runOn: RoutineRunOn;- deliveryId: string;- receivedAt: number;- eventSource?: "app";+ webhookId: string; webhookName: string; prompt: string; botId: string; runOn: RoutineRunOn; deliveryId: string; receivedAt: number;+ eventSource?: "app" | "wait";+ /** Where the run reports, instead of the event's own results chat. */+ resultsThreadId?: string;}): { id: string } {this.assertWritable();const existing = this.webhookRunReceipt(input.webhookId, input.deliveryId);@@ -785,7 +781,7 @@ export class RoutineManager {id: randomUUID(), routineId: input.webhookId, routineName: input.webhookName, prompt: input.prompt, target: "bot",botId: input.botId, runOn: input.runOn, scheduledFor: input.receivedAt, status: "queued", manual: false,triggerSource: "webhook", webhookId: input.webhookId, deliveryId: input.deliveryId, attachments: [], createdAt: this.now(),- resultsThreadId: this.options.eventResultsThread?.(input), ...(input.eventSource ? { eventSource: input.eventSource } : {}),+ resultsThreadId: input.resultsThreadId ?? this.options.eventResultsThread?.(input), ...(input.eventSource ? { eventSource: input.eventSource } : {}),};this.commitEvent(run, input.deliveryId, () => { this.runs.push(run); });return cloneRun(run);diff --git a/server/system-prompt.test.ts b/server/system-prompt.test.tsindex e0290694d3..6e0fb97d51 100644--- a/server/system-prompt.test.ts+++ b/server/system-prompt.test.ts@@ -301,6 +301,8 @@ describe("shared sentences", () => {expect(TRIGGER_PROMPT).toContain("set it up with trigger action=create in this turn");expect(TRIGGER_PROMPT).toContain("Do not ask for confirmation");expect(TRIGGER_PROMPT).toContain("Edit, Pause and Undo");+ expect(TRIGGER_PROMPT).toContain("use wait_until instead of staying busy or making a short-interval routine");+ expect(TRIGGER_PROMPT).toContain("give follow_up only when they asked for something to be done at that moment");expect(TRIGGER_PROMPT).not.toMatch(/pending|explicitly asks/);expect(CREDENTIAL_PROMPT).toContain("secure credential request");expect(CREDENTIAL_PROMPT).not.toContain("applied immediately");diff --git a/server/system-prompt.ts b/server/system-prompt.tsindex f0fae9a00d..9adee97e97 100644--- a/server/system-prompt.ts+++ b/server/system-prompt.ts@@ -224,7 +224,7 @@ export const WIDGET_PROMPT =const APPLIED_RESULT_PROMPT =" Follow the tool result: a change you ask for (your skills, profile or model, or as a Chief a teammate's) applies immediately at every access level and the person sees it with an Undo; then continue the requested work without asking for another confirmation. Only a pending result (a Cloud conversation its owner did not drive) waits for the owner: then end the turn. Never claim success before an applied result, and report failures honestly. Full Access does not grant another bot broader permissions.";export const TRIGGER_PROMPT =- " When the person describes something that should happen on its own — on a schedule (\"every morning send me…\", \"each Friday…\"), whenever something happens in one of their apps (\"whenever I get an email from Acme…\", \"when someone posts in #sales…\") or when another app calls a link — set it up with trigger action=create in this turn. Do not ask for confirmation and do not announce it first: it applies at once and the person sees a card with Edit, Pause and Undo. Ask one short question only when something required is missing and cannot be inferred, such as which of two Gmail accounts. For anything that happens in an app, call trigger_info action=events and use when=app_event rather than a schedule that keeps checking; put who or what it is about in filter (Gmail filters at the source), and judgement (\"if it is not about an order, stop\") in the instructions. If the app is not connected yet, ask the person to connect it the usual way (a Connect card when you have connected-app tools), then create the trigger once it is. Write the instructions as complete steps for a future run that will not see this conversation, in the plain words the person would use (\"draft a reply\", \"add the lead to the sheet\"): never \"event data\", \"payload\", \"webhook\" or \"trigger\", since the person reads them as the automation's sentence and each run is already told where its event is. A request to do something once, now, is not a trigger. Then confirm in plain words what you set up and what you 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. To the person these are \"automations\", never triggers or webhooks. Use trigger_info to review triggers, the trigger tool to change, pause or test them, and delete_trigger to delete one. Keep run_on omitted or maus to use the bot's current model and configured computer, including its VPS; box runs on the bot's cloud computer, only when the person wants that. Convert calendar requests such as the first or last day of each month or the second Monday to a five-field cron expression with an explicit IANA timezone; use interval for elapsed every-N-minutes work. Never replace a calendar rule with daily AI date checking or an approximate weekly schedule; clarify ambiguous or unsupported requests. For \"run this when my limit resets\" use when=limit_reset (it defaults to your own engine). When you are told your usage limit is nearly used up and the task may not finish, set up its continuation yourself with trigger action=create when=limit_reset, instructions to pick up where you stopped, and tell the person in one sentence.";+ " When the person describes something that should happen on its own — on a schedule (\"every morning send me…\", \"each Friday…\"), whenever something happens in one of their apps (\"whenever I get an email from Acme…\", \"when someone posts in #sales…\") or when another app calls a link — set it up with trigger action=create in this turn. Do not ask for confirmation and do not announce it first: it applies at once and the person sees a card with Edit, Pause and Undo. Ask one short question only when something required is missing and cannot be inferred, such as which of two Gmail accounts. For anything that happens in an app, call trigger_info action=events and use when=app_event rather than a schedule that keeps checking; put who or what it is about in filter (Gmail filters at the source), and judgement (\"if it is not about an order, stop\") in the instructions. If the app is not connected yet, ask the person to connect it the usual way (a Connect card when you have connected-app tools), then create the trigger once it is. Write the instructions as complete steps for a future run that will not see this conversation, in the plain words the person would use (\"draft a reply\", \"add the lead to the sheet\"): never \"event data\", \"payload\", \"webhook\" or \"trigger\", since the person reads them as the automation's sentence and each run is already told where its event is. A request to do something once, now, is not a trigger. Then confirm in plain words what you set up and what you 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. To the person these are \"automations\", never triggers or webhooks. Use trigger_info to review triggers, the trigger tool to change, pause or test them, and delete_trigger to delete one. Keep run_on omitted or maus to use the bot's current model and configured computer, including its VPS; box runs on the bot's cloud computer, only when the person wants that. Convert calendar requests such as the first or last day of each month or the second Monday to a five-field cron expression with an explicit IANA timezone; use interval for elapsed every-N-minutes work. Never replace a calendar rule with daily AI date checking or an approximate weekly schedule; clarify ambiguous or unsupported requests. For \"run this when my limit resets\" use when=limit_reset (it defaults to your own engine). When you are told your usage limit is nearly used up and the task may not finish, set up its continuation yourself with trigger action=create when=limit_reset, 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 says something, a file appears or changes, 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.";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 ROUTINE_EXECUTION_PROMPT =diff --git a/server/wait-host.test.ts b/server/wait-host.test.tsnew file mode 100644index 0000000000..73617203ec--- /dev/null+++ b/server/wait-host.test.ts@@ -0,0 +1,113 @@+import { beforeEach, describe, expect, it, vi } from "vitest";++import type { Notification } from "../shared/notification.ts";+import type { Message } from "./store.ts";+import { cancelWaitFromCard, createWaitHost, waitRunChat, type WaitHostDeps } from "./wait-host.ts";+import type { WaitRecord } from "./waits.ts";++const NOW = 1_700_000_000_000;+const wait: WaitRecord = {+ id: "w1", botId: "bot-1", threadId: "t-1", label: "the build", condition: { kind: "file_exists", path: "/tmp/x" },+ createdAt: NOW, expiresAt: NOW + 1000, nextCheckAt: NOW, errors: 0,+};++function fakeStore() {+ const messages: Message[] = [];+ let next = 0;+ const bots = new Map([["bot-1", { id: "bot-1", name: "Pepper", busy: false, avatarUrl: "/a.png" }]]);+ return {+ messages,+ get lines() { return messages.map(({ id: _id, at: _at, ...rest }) => rest); },+ message: (id: string) => messages.find((m) => m.id === id)!,+ appendMessage: vi.fn((_thread: string, message: Omit<Message, "id" | "at">) => {+ const full = { id: `m-${++next}`, at: 1, ...message } as Message;+ messages.push(full);+ return full;+ }),+ patchMessage: vi.fn((_thread: string, id: string, patch: Partial<Message>) => {+ const index = messages.findIndex((m) => m.id === id);+ messages[index] = { ...messages[index]!, ...patch };+ return messages[index]!;+ }),+ patchTask: vi.fn(),+ messagesFor: vi.fn(() => messages),+ bot: vi.fn((id: string) => bots.get(id) ?? null),+ };+}++describe("the store side of waits", () => {+ let store: ReturnType<typeof fakeStore>;+ let busy: boolean;+ let wrote: ReturnType<typeof vi.fn<WaitHostDeps["wrote"]>>;+ let notify: ReturnType<typeof vi.fn<(n: Notification | null) => void>>;+ let enqueue: ReturnType<typeof vi.fn<WaitHostDeps["enqueue"]>>;+ let host: ReturnType<typeof createWaitHost>;+ let cloudHost: ReturnType<typeof createWaitHost>;++ beforeEach(() => {+ store = fakeStore();+ busy = false;+ wrote = vi.fn<WaitHostDeps["wrote"]>();+ notify = vi.fn();+ enqueue = vi.fn<WaitHostDeps["enqueue"]>(() => ({ id: "run-1" }));+ const deps = (cloudHome: boolean): WaitHostDeps => ({+ store: store as unknown as WaitHostDeps["store"], directChat: () => true, threadBusy: () => busy, wrote, notify, enqueue, cloudHome, now: () => NOW,+ });+ host = createWaitHost(deps(false));+ cloudHost = createWaitHost(deps(true));+ });++ it("posts a wait's line once, marks the chat unread and notifies only when it fired", () => {+ expect(host.post(wait, { status: "fired", text: "the build: done. ci passed." })).toBe(true);+ expect(host.post(wait, { status: "fired", text: "the build: done. ci passed." })).toBe(true);+ expect(store.lines).toEqual([{ role: "bot", kind: "text", text: "the build: done. ci passed.", wait: { id: "w1", status: "fired" } }]);+ expect(store.patchTask).toHaveBeenCalledWith("bot-1", "t-1", { unread: true });+ expect(wrote).toHaveBeenCalledTimes(1);+ host.post({ ...wait, id: "w2" }, { status: "expired", text: "Stopped waiting for the build after 24 hours." });+ expect(notify.mock.calls.map(([n]) => n?.kind)).toEqual(["wait"]);+ });++ it("holds the line while a turn runs in the chat", () => {+ busy = true;+ expect(host.post(wait, { status: "fired", text: "x" })).toBe(false);+ expect(store.lines).toEqual([]);+ });++ it("shows a card with the follow-up, and settles it", () => {+ const id = host.showCard({ ...wait, followUp: "Deploy it." });+ expect(store.message(id!)).toMatchObject({ role: "bot", kind: "options", card: {+ title: "Waiting: the build", subtitle: "Then Pepper will: Deploy it.", options: [], answered: "allow", dismissed: true,+ autoApplied: true, requestId: "w1", tool: "wait_until", waitRequest: { waitId: "w1", label: "the build", followUp: "Deploy it." } } });+ host.settleCard({ ...wait, cardMessageId: id }, "cancelled");+ expect(store.message(id!).card).toMatchObject({ undone: true, waitRequest: { settled: "cancelled" } });+ host.settleCard({ ...wait, cardMessageId: id }, "fired");+ expect(store.message(id!).card?.waitRequest?.settled, "a card settles once").toBe("cancelled");+ });++ it("settles a card whose wait already ended when its Cancel finds nothing to stop, and only stops a wait that is there", () => {+ const id = host.showCard({ ...wait, followUp: "Deploy it." })!;+ const card = { botId: "bot-1", threadId: "t-1", messageId: id, waitId: "w1" };+ const cancel = vi.fn((): WaitRecord | null => wait);+ expect(cancelWaitFromCard({ cancel }, store, card)).toBe(true);+ expect([cancel.mock.calls, store.message(id).card?.waitRequest?.settled]).toEqual([[["w1", "bot-1"]], undefined]);+ cancel.mockReturnValue(null);+ expect(cancelWaitFromCard({ cancel }, store, card)).toBe(false);+ expect(store.message(id).card).toMatchObject({ waitRequest: { settled: "expired" } });+ expect(store.message(id).card).not.toHaveProperty("undone");+ });++ it("queues the follow-up as an outside event that joins the chat, except on a Cloud home", () => {+ host.followUp({ ...wait, followUp: "Deploy it." });+ expect(enqueue).toHaveBeenLastCalledWith({ webhookId: "wait:w1", webhookName: "the build", prompt: "[Wait finished: the build] Deploy it.",+ botId: "bot-1", runOn: "maus", deliveryId: "w1", receivedAt: NOW, eventSource: "wait", resultsThreadId: "t-1" });+ cloudHost.followUp({ ...wait, followUp: "Deploy it." });+ expect(enqueue.mock.lastCall![0]).not.toHaveProperty("resultsThreadId");+ expect(waitRunChat({ botId: "bot-1", resultsThreadId: "t-1" }, () => true, false)).toBe("t-1");+ expect(waitRunChat({ botId: "bot-1", resultsThreadId: "t-1" }, () => true, true)).toBeNull();+ expect(waitRunChat({ botId: "bot-1", resultsThreadId: "room" }, () => false, false)).toBeNull();+ });++ it("knows a deleted bot from an idle one", () => {+ expect([host.botBusy("bot-1"), host.botBusy("gone")]).toEqual([false, undefined]);+ });+});diff --git a/server/wait-host.ts b/server/wait-host.tsnew file mode 100644index 0000000000..6045be5d97--- /dev/null+++ b/server/wait-host.ts@@ -0,0 +1,108 @@+import type { Notification } from "../shared/notification.ts";+import { buildNotification } from "./notify.ts";+import type { RoutineManager, RoutineRun } from "./routines.ts";+import type { BotRecord, Store } from "./store.ts";+import type { WaitManager, WaitManagerOptions } from "./waits.ts";++export interface WaitHostDeps {+ store: Pick<Store, "appendMessage" | "patchMessage" | "patchTask" | "messagesFor" | "bot">;+ /** A one-to-one chat this bot owns; a room is not one. */+ directChat(botId: string, threadId: string): boolean;+ threadBusy(botId: string, threadId: string): boolean;+ wrote(bot: BotRecord, threadId: string): void;+ notify(notification: Notification | null): void;+ enqueue(input: Parameters<RoutineManager["enqueueWebhook"]>[0]): { id: string };+ cloudHome: boolean;+ now?: () => number;+}++/** The chat a wait's follow-up run works in: the one it was asked in, never on a Cloud home or in a room. */+export function waitRunChat(+ run: Pick<RoutineRun, "botId" | "resultsThreadId">,+ directChat: (botId: string, threadId: string) => boolean,+ cloudHome: boolean,+): string | null {+ if (cloudHome || !run.resultsThreadId) return null;+ return directChat(run.botId, run.resultsThreadId) ? run.resultsThreadId : null;+}++type CardStore = Pick<Store, "messagesFor" | "patchMessage">;++function settleWaitCard(store: CardStore, threadId: string, messageId: string, how: "fired" | "expired" | "cancelled"): void {+ const card = store.messagesFor(threadId).find((m) => m.id === messageId)?.card;+ if (!card?.waitRequest || card.waitRequest.settled) return;+ store.patchMessage(threadId, messageId, {+ card: { ...card, ...(how === "cancelled" ? { undone: true } : {}), waitRequest: { ...card.waitRequest, settled: how } },+ });+}++/** The card's Cancel: true once it stopped the wait. A wait that already ended settles its card instead, so Cancel goes. */+export function cancelWaitFromCard(+ waits: Pick<WaitManager, "cancel">,+ store: CardStore,+ card: { botId: string; threadId: string; messageId: string; waitId: string },+): boolean {+ if (waits.cancel(card.waitId, card.botId)) return true;+ settleWaitCard(store, card.threadId, card.messageId, "expired");+ return false;+}++export function createWaitHost(deps: WaitHostDeps): Pick<WaitManagerOptions, "sourceAlive" | "botBusy" | "post" | "followUp" | "showCard" | "settleCard"> {+ const { store } = deps;+ const now = deps.now ?? Date.now;+ return {+ sourceAlive: (botId, threadId) => store.bot(botId) !== null && deps.directChat(botId, threadId),+ botBusy: (botId) => {+ const bot = store.bot(botId);+ return bot ? bot.busy === true : undefined;+ },+ post(wait, notice) {+ const bot = store.bot(wait.botId);+ if (!bot) return true;+ if (deps.threadBusy(wait.botId, wait.threadId)) return false;+ const posted = store.messagesFor(wait.threadId).some((m) => m.wait?.id === wait.id && m.wait.status === notice.status);+ if (posted) return true;+ store.appendMessage(wait.threadId, { role: "bot", kind: "text", text: notice.text, wait: { id: wait.id, status: notice.status } });+ store.patchTask(wait.botId, wait.threadId, { unread: true });+ deps.wrote(bot, wait.threadId);+ if (notice.status === "fired") deps.notify(buildNotification("wait", bot, wait.threadId, notice.text, { avatarUrl: bot.avatarUrl }));+ return true;+ },+ followUp(wait) {+ deps.enqueue({+ webhookId: `wait:${wait.id}`,+ webhookName: wait.label,+ prompt: `[Wait finished: ${wait.label}] ${wait.followUp}`,+ botId: wait.botId,+ runOn: "maus",+ deliveryId: wait.id,+ receivedAt: now(),+ eventSource: "wait",+ ...(deps.cloudHome ? {} : { resultsThreadId: wait.threadId }),+ });+ },+ showCard(wait) {+ const bot = store.bot(wait.botId);+ if (!bot) return undefined;+ const message = store.appendMessage(wait.threadId, {+ role: "bot",+ kind: "options",+ card: {+ title: `Waiting: ${wait.label}`,+ subtitle: `Then ${bot.name} will: ${wait.followUp}`,+ options: [],+ answered: "allow",+ dismissed: true,+ autoApplied: true,+ requestId: wait.id,+ tool: "wait_until",+ waitRequest: { waitId: wait.id, label: wait.label, followUp: wait.followUp },+ },+ });+ return message.id;+ },+ settleCard(wait, how) {+ if (wait.cardMessageId) settleWaitCard(store, wait.threadId, wait.cardMessageId, how);+ },+ };+}diff --git a/server/wait-probes.test.ts b/server/wait-probes.test.tsnew file mode 100644index 0000000000..5367c2426a--- /dev/null+++ b/server/wait-probes.test.ts@@ -0,0 +1,166 @@+import { createServer, type Server } from "node:http";+import type { AddressInfo } from "node:net";+import { mkdtempSync, rmSync, writeFileSync } from "node:fs";+import { tmpdir } from "node:os";+import { join } from "node:path";+import { afterAll, beforeAll, describe, expect, it } from "vitest";+import {+ expandHome,+ fetchPageText,+ fileChanged,+ fileStamp,+ listProcesses,+ PAGE_MAX_BYTES,+ pageSays,+ pageText,+ parsePs,+ parseTasklist,+ processRunning,+} from "./wait-probes.ts";++let dir = "";+beforeAll(() => {+ dir = mkdtempSync(join(tmpdir(), "wait-probes-"));+});+afterAll(() => {+ rmSync(dir, { recursive: true, force: true });+});++describe("file and process probes", () => {+ it("expands ~ to the home folder and leaves other paths alone", () => {+ expect(expandHome("~", "/h")).toBe("/h");+ expect(expandHome("~/a/b.txt", "/h")).toBe(join("/h", "a/b.txt"));+ expect(expandHome("/x/y", "/h")).toBe("/x/y");+ expect(expandHome("~bob/x", "/h")).toBe("~bob/x");+ });+ it("stamps a file with its size and modification time, and a missing one as null", async () => {+ writeFileSync(join(dir, "r.txt"), "abc");+ expect(await fileStamp(join(dir, "r.txt"))).toEqual({ size: 3, mtimeMs: expect.any(Number) });+ expect(await fileStamp(join(dir, "none.txt"))).toBeNull();+ });+ it("sees a change in size or modification time and a file that appears, never a missing file", () => {+ expect(fileChanged({ size: 3, mtimeMs: 1 }, { size: 4, mtimeMs: 1 })).toBe(true);+ expect(fileChanged({ size: 3, mtimeMs: 1 }, { size: 3, mtimeMs: 2 })).toBe(true);+ expect(fileChanged({ size: 3, mtimeMs: 1 }, { size: 3, mtimeMs: 1 })).toBe(false);+ expect(fileChanged(null, { size: 0, mtimeMs: 1 })).toBe(true);+ expect(fileChanged({ size: 3, mtimeMs: 1 }, null)).toBe(false);+ });+ it("reads ps and tasklist output", () => {+ expect(parsePs(" 1 /sbin/launchd\n 812 /Applications/Google Chrome.app/Contents/MacOS/Google Chrome\n 9 node\n"))+ .toEqual([{ pid: 1, name: "launchd" }, { pid: 812, name: "Google Chrome" }, { pid: 9, name: "node" }]);+ expect(parseTasklist('"chrome.exe","1234","Console","1","123,456 K"\r\n"System","4","Services","0","1,000 K"\r\n'))+ .toEqual([{ pid: 1234, name: "chrome.exe" }, { pid: 4, name: "System" }]);+ });+ it("matches a program by name in any case, with or without .exe, by Linux's 15-character name, or by pid", () => {+ const entries = [{ pid: 812, name: "Google Chrome" }, { pid: 1234, name: "node.exe" }, { pid: 77, name: "gnome-shell-cal" }];+ for (const wanted of ["google chrome", "NODE", "node.exe", "gnome-shell-calendar-server", "812"]) expect(processRunning(entries, wanted), wanted).toBe(true);+ for (const wanted of ["google", "813", "gnome-shell"]) expect(processRunning(entries, wanted), wanted).toBe(false);+ });+ it("runs ps on macOS and Linux and tasklist on Windows, without a shell", async () => {+ const calls: unknown[] = [];+ const run = async (file: string, args: string[]) => { calls.push([file, args]); return ""; };+ await listProcesses("darwin", run); await listProcesses("linux", run); await listProcesses("win32", run);+ expect(calls).toEqual([["ps", ["-axo", "pid=,comm="]], ["ps", ["-axo", "pid=,comm="]], ["tasklist", ["/fo", "csv", "/nh"]]]);+ });+ it("lists this machine's processes, this one included", async () => {+ expect((await listProcesses()).some((entry) => entry.pid === process.pid)).toBe(true);+ });+ it("reads a page as words: tags, scripts and styles out, entities decoded, spaces collapsed", () => {+ const text = pageText("<html><head><style>p{}</style><script>var shipped=1</script></head><body><p>Status: <b>Shipped</b> & done</p></body></html>");+ expect(text).toBe("Status: Shipped & done");+ expect(pageSays(text, "status: SHIPPED")).toBe(true);+ expect(pageSays(text, "shipped=1")).toBe(false);+ });+ it("keeps a < with no > after it as text, and hides a script or comment left open as a browser does", () => {+ expect(pageText("a < b")).toBe("a < b");+ expect(pageText("<p>In stock</p><script>if (a < b) x = '<b>Sold out</b>'</script><SCRIPT>y</SCRIPT ><p>today</p>")).toBe("In stock today");+ expect(pageText("<!-- <p>Sold out</p> -->In stock<!-->!<script>never closed <p>Sold out</p>")).toBe("In stock !");+ expect(pageText("In stock<!-- never closed <p>Sold out</p>")).toBe("In stock");+ });+ it("reads a hostile 2 MB page in well under a second", () => {+ // 64 KB first, so a reader that backtracks fails here in a second or two instead of running for minutes at 2 MB.+ for (const [size, budgetMs] of [[64 * 1024, 250], [PAGE_MAX_BYTES, 1000]] as const) {+ for (const unit of ["<", "<a ", "<!--", "<script>", "<style ", "<<>", "<"]) {+ const page = unit.repeat(Math.ceil(size / unit.length)).slice(0, size);+ const started = performance.now();+ pageText(page);+ expect(performance.now() - started, `${size} bytes of ${unit}`).toBeLessThan(budgetMs);+ }+ }+ });+});++describe("fetchPageText", () => {+ let server: Server;+ let port = 0;+ const seen: Array<{ host?: string; cookie?: string }> = [];+ const test = {+ lookup: async (host: string) => (host === "status.test" ? [{ address: "127.0.0.1", family: 4 }] : []),+ allow: ({ host }: { host: string }) => host === "status.test",+ };+ beforeAll(async () => {+ server = createServer((req, res) => {+ const path = req.url ?? "/";+ if (path === "/") {+ seen.push({ host: req.headers.host, cookie: req.headers.cookie });+ res.setHeader("content-type", "text/html");+ res.end("<p>Build: Shipped</p>");+ } else if (path === "/hop") {+ res.writeHead(302, { location: "/" }).end();+ } else if (path === "/away") {+ res.writeHead(302, { location: `http://127.0.0.1:${port}/` }).end();+ } else if (path === "/loop") {+ res.writeHead(302, { location: "/loop" }).end();+ } else if (path === "/big") {+ res.write("a".repeat(3 * 1024 * 1024));+ res.end("needle");+ } else if (path === "/404") {+ res.writeHead(404).end();+ }+ });+ await new Promise<void>((done) => server.listen(0, "127.0.0.1", done));+ port = (server.address() as AddressInfo).port;+ });+ afterAll(() => {+ server.closeAllConnections();+ server.close();+ });++ it("reads a page through the address it checked, under its own name, with no cookie", async () => {+ expect(await fetchPageText(`http://status.test:${port}/`, test)).toEqual({ ok: true, text: "Build: Shipped" });+ expect(seen.at(-1)).toEqual({ host: `status.test:${port}`, cookie: undefined });+ });+ it("follows a redirect only to an address it may reach, and at most three", async () => {+ expect(await fetchPageText(`http://status.test:${port}/hop`, test)).toEqual({ ok: true, text: "Build: Shipped" });+ expect(await fetchPageText(`http://status.test:${port}/away`, test)).toMatchObject({ ok: false, refused: true });+ expect(await fetchPageText(`http://status.test:${port}/loop`, test)).toEqual({ ok: false, refused: false, error: "The page redirected too many times." });+ });+ it("refuses loopback, private and mixed answers with the real egress check", async () => {+ const mixed = { lookup: async () => [{ address: "93.184.216.34", family: 4 }, { address: "10.0.0.5", family: 4 }] };+ expect(await fetchPageText("http://mixed.test/", mixed)).toMatchObject({ ok: false, refused: true });+ for (const url of [`http://127.0.0.1:${port}/`, `http://localhost:${port}/`, `http://[::1]:${port}/`, `http://2130706433:${port}/`, `http://[::ffff:127.0.0.1]:${port}/`, "http://169.254.169.254/"]) {+ expect(await fetchPageText(url), url).toMatchObject({ ok: false, refused: true });+ }+ });+ it("takes only http and https, with no sign-in in the address", async () => {+ for (const url of ["file:///etc/passwd", "ftp://example.com/", "https://user:[email protected]/"]) {+ expect(await fetchPageText(url), url).toMatchObject({ ok: false, refused: true });+ }+ });+ it("reads at most 2 MB, and gives up after its timeout", async () => {+ const big = await fetchPageText(`http://status.test:${port}/big`, test);+ expect(big).toMatchObject({ ok: true });+ expect(big.ok && big.text.length).toBe(PAGE_MAX_BYTES);+ expect(big.ok && big.text.includes("needle")).toBe(false);+ expect(await fetchPageText(`http://status.test:${port}/slow`, { ...test, timeoutMs: 200 })).toEqual({ ok: false, refused: false, error: "The page took too long to answer." });+ });+ it("gives up on a lookup that never answers within its timeout", async () => {+ const started = Date.now();+ const result = await fetchPageText("http://stuck.test/", { lookup: () => new Promise(() => {}), timeoutMs: 200 });+ expect(result).toEqual({ ok: false, refused: false, error: "The page took too long to answer." });+ expect(Date.now() - started).toBeLessThan(1000);+ });+ it("counts an answer that is not 2xx as a failed check", async () => {+ expect(await fetchPageText(`http://status.test:${port}/404`, test)).toEqual({ ok: false, refused: false, error: "The page answered 404." });+ });+});diff --git a/server/wait-probes.ts b/server/wait-probes.tsnew file mode 100644index 0000000000..d2b3c1af42--- /dev/null+++ b/server/wait-probes.ts@@ -0,0 +1,268 @@+import { execFile } from "node:child_process";+import { stat } from "node:fs/promises";+import { request as httpRequest, type IncomingMessage } from "node:http";+import { request as httpsRequest } from "node:https";+import { isIP, type LookupFunction } from "node:net";+import { join } from "node:path";+import { promisify } from "node:util";++import { resolveTarget } from "./browser/egress/gate.ts";+import { addressClass, ownAddresses } from "./browser/egress/policy.ts";++export interface FileStamp {+ size: number;+ mtimeMs: number;+}++export interface ProcessEntry {+ pid: number;+ name: string;+}++const execFileAsync = promisify(execFile);++export function expandHome(path: string, home: string): string {+ if (path === "~") return home;+ if (path.startsWith("~/") || path.startsWith("~\\")) return join(home, path.slice(2));+ return path;+}++export async function fileStamp(path: string): Promise<FileStamp | null> {+ try {+ const info = await stat(path);+ return { size: info.size, mtimeMs: info.mtimeMs };+ } catch {+ return null;+ }+}++export function fileChanged(before: FileStamp | null, now: FileStamp | null): boolean {+ if (!now) return false;+ if (!before) return true;+ return before.size !== now.size || before.mtimeMs !== now.mtimeMs;+}++export function parsePs(stdout: string): ProcessEntry[] {+ const entries: ProcessEntry[] = [];+ for (const line of stdout.split(/\r?\n/)) {+ const match = /^\s*(\d+)\s+(.+?)\s*$/.exec(line);+ if (!match) continue;+ const name = match[2].slice(match[2].lastIndexOf("/") + 1);+ if (name) entries.push({ pid: Number(match[1]), name });+ }+ return entries;+}++export function parseTasklist(stdout: string): ProcessEntry[] {+ const entries: ProcessEntry[] = [];+ for (const line of stdout.split(/\r?\n/)) {+ const match = /^"([^"]*)","(\d+)"/.exec(line);+ if (match) entries.push({ pid: Number(match[2]), name: match[1] });+ }+ return entries;+}++async function runFile(file: string, args: string[]): Promise<string> {+ const { stdout } = await execFileAsync(file, args, {+ timeout: 10_000,+ maxBuffer: 8 * 1024 * 1024,+ windowsHide: true,+ });+ return stdout;+}++export async function listProcesses(+ platform: NodeJS.Platform = process.platform,+ run: (file: string, args: string[]) => Promise<string> = runFile,+): Promise<ProcessEntry[]> {+ if (platform === "win32") return parseTasklist(await run("tasklist", ["/fo", "csv", "/nh"]));+ return parsePs(await run("ps", ["-axo", "pid=,comm="]));+}++export function processRunning(entries: readonly ProcessEntry[], wanted: string): boolean {+ const target = wanted.trim();+ if (/^\d+$/.test(target)) return entries.some((entry) => entry.pid === Number(target));+ const lower = target.toLowerCase();+ const withExe = lower.endsWith(".exe") ? lower : `${lower}.exe`;+ const withoutExe = lower.endsWith(".exe") ? lower.slice(0, -4) : lower;+ return entries.some((entry) => {+ const name = entry.name.toLowerCase();+ if (name === lower || name === withExe || name === withoutExe) return true;+ return name.length === 15 && name === lower.slice(0, 15);+ });+}++const NAMED_ENTITIES: Record<string, string> = {+ amp: "&",+ lt: "<",+ gt: ">",+ quot: '"',+ "#39": "'",+ nbsp: " ",+};++function decodeEntities(text: string): string {+ return text.replace(/&(#x[0-9a-f]+|#\d+|[a-z]+|#39);/gi, (whole, body: string) => {+ const named = NAMED_ENTITIES[body.toLowerCase()];+ if (named !== undefined) return named;+ if (body[0] !== "#") return whole;+ const code = body[1].toLowerCase() === "x" ? parseInt(body.slice(2), 16) : parseInt(body.slice(1), 10);+ if (!Number.isInteger(code) || code < 0 || code > 0x10ffff) return whole;+ return String.fromCodePoint(code);+ });+}++/** `<script` or `<style` as a whole tag name: an element whose text a page never shows. */+const HIDDEN_OPEN = /<(script|style)(?!\w)/iy;+const HIDDEN_CLOSE: Record<string, RegExp> = { script: /<\/script[\s/>]/gi, style: /<\/style[\s/>]/gi };++/**+ * Where the markup starting with the `<` at `open` ends (just past it), or -1 when that `<` is text: no `>` follows+ * anywhere, so no later `<` starts a tag either. A comment, script or style left open runs to the end, as in a browser.+ */+function markupEnd(body: string, open: number): number {+ if (body.startsWith("<!--", open)) {+ const close = body.indexOf("-->", open + 2);+ return close === -1 ? body.length : close + 3;+ }+ const close = body.indexOf(">", open + 1);+ if (close === -1) return -1;+ HIDDEN_OPEN.lastIndex = open;+ const hidden = HIDDEN_OPEN.exec(body)?.[1]?.toLowerCase();+ if (!hidden) return close + 1;+ const end = HIDDEN_CLOSE[hidden]!;+ end.lastIndex = close + 1;+ const found = end.exec(body);+ const after = found ? body.indexOf(">", found.index) : -1;+ return after === -1 ? body.length : after + 1;+}++/**+ * A page's words: tags, comments, scripts and styles out, entities decoded, spaces collapsed. One linear pass, so a+ * hostile 2 MB page costs milliseconds (the patterns this replaced backtracked, and took minutes on a page of `<`).+ */+export function pageText(body: string): string {+ const words: string[] = [];+ for (let at = 0; at < body.length;) {+ const open = body.indexOf("<", at);+ const end = open === -1 ? -1 : markupEnd(body, open);+ if (end === -1) {+ words.push(body.slice(at));+ break;+ }+ words.push(body.slice(at, open), " ");+ at = end;+ }+ return decodeEntities(words.join("")).replace(/\s+/g, " ").trim();+}++export function pageSays(text: string, wanted: string): boolean {+ const needle = wanted.replace(/\s+/g, " ").trim().toLowerCase();+ return text.toLowerCase().includes(needle);+}++export const PAGE_TIMEOUT_MS = 15_000;+export const PAGE_MAX_BYTES = 2 * 1024 * 1024;+export const PAGE_MAX_REDIRECTS = 3;++export type PageResult = { ok: true; text: string } | { ok: false; refused: boolean; error: string };++export interface PageFetchOptions {+ allow?: (target: { host: string; address: string }) => boolean;+ lookup?: (host: string) => Promise<Array<{ address: string; family: number }>>;+ timeoutMs?: number;+ maxBytes?: number;+}++type Answer = { status: number; location?: string; body: Buffer };++const fail = (error: string, refused = false): PageResult => ({ ok: false, refused, error });++function requestOnce(url: URL, address: { address: string; family: number }, signal: AbortSignal, maxBytes: number): Promise<Answer> {+ return new Promise((resolve, reject) => {+ const pinned: LookupFunction = (_host, lookupOptions, callback) => {+ if (lookupOptions.all) callback(null, [address]);+ else callback(null, address.address, address.family);+ };+ const send = url.protocol === "https:" ? httpsRequest : httpRequest;+ const req = send(+ url,+ {+ agent: false,+ signal,+ lookup: pinned,+ headers: { "user-agent": "OpenMausBot-wait", accept: "text/html,text/plain;q=0.9,*/*;q=0.1" },+ },+ (response: IncomingMessage) => {+ const status = response.statusCode ?? 0;+ const location = response.headers.location;+ if (status < 200 || status >= 300) {+ response.destroy();+ resolve({ status, location, body: Buffer.alloc(0) });+ return;+ }+ const chunks: Buffer[] = [];+ let size = 0;+ response.on("data", (chunk: Buffer) => {+ chunks.push(chunk);+ size += chunk.length;+ if (size >= maxBytes) {+ response.destroy();+ resolve({ status, body: Buffer.concat(chunks).subarray(0, maxBytes) });+ }+ });+ response.on("end", () => resolve({ status, body: Buffer.concat(chunks) }));+ response.on("error", reject);+ },+ );+ req.on("error", reject);+ req.end();+ });+}++function withinSignal<T>(promise: Promise<T>, signal: AbortSignal): Promise<T> {+ return new Promise((resolve, reject) => {+ if (signal.aborted) return reject(signal.reason);+ const abort = () => reject(signal.reason);+ signal.addEventListener("abort", abort, { once: true });+ promise.then(resolve, reject).finally(() => signal.removeEventListener("abort", abort));+ });+}++export async function fetchPageText(rawUrl: string, options: PageFetchOptions = {}): Promise<PageResult> {+ const lookup = options.lookup ?? resolveTarget;+ const allow = options.allow ?? (({ address }) => addressClass(address, ownAddresses()) === "public");+ const maxBytes = options.maxBytes ?? PAGE_MAX_BYTES;+ const signal = AbortSignal.timeout(options.timeoutMs ?? PAGE_TIMEOUT_MS);+ let url: URL;+ try {+ url = new URL(rawUrl);+ } catch {+ return fail("That is not a web address.", true);+ }+ try {+ for (let hop = 0; ; hop++) {+ if ((url.protocol !== "http:" && url.protocol !== "https:") || url.username || url.password) {+ return fail("Only an http or https address with no sign-in details can be checked.", true);+ }+ const host = url.hostname.replace(/^\[|\]$/g, "");+ const literal = isIP(host);+ const addresses = literal ? [{ address: host, family: literal }] : await withinSignal(lookup(host), signal);+ if (addresses.length === 0) return fail("That address could not be found.");+ if (!addresses.every(({ address }) => allow({ host, address }))) {+ return fail(`${host} points at this computer or a private network, which waits never check. Use a page on the public web.`, true);+ }+ signal.throwIfAborted();+ const answer = await requestOnce(url, addresses[0], signal, maxBytes);+ if (answer.status >= 300 && answer.status < 400 && answer.location) {+ if (hop >= PAGE_MAX_REDIRECTS) return fail("The page redirected too many times.");+ url = new URL(answer.location, url);+ continue;+ }+ if (answer.status < 200 || answer.status >= 300) return fail(`The page answered ${answer.status}.`);+ return { ok: true, text: pageText(answer.body.toString("utf8")) };+ }+ } catch {+ return signal.aborted ? fail("The page took too long to answer.") : fail("The page could not be reached.");+ }+}diff --git a/server/waits.e2e.test.ts b/server/waits.e2e.test.tsnew file mode 100644index 0000000000..4a8ee94474--- /dev/null+++ b/server/waits.e2e.test.ts@@ -0,0 +1,102 @@+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 { WAIT_MESSAGES } from "./routes/waits.ts";+import { removeTempDir } from "./testing/cleanup.ts";++async function scout(name: string) {+ const folder = mkdtempSync(join(tmpdir(), `omb-waits-${name}-`));+ 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;+ };+ const close = async () => {+ writeFileSync(`${fixture.info.logPath}.waits-${name}.json`, JSON.stringify(evidence, null, 2));+ await fixture.close();+ await removeTempDir(folder);+ };+ const bot = await api("POST", "/api/bots", { name: "Scout" }, 201).then((made) => made.bot, async (error: unknown) => { await close(); throw error; });+ const busy = async () => (await api("GET", "/api/bots?messages=0")).bots.find((candidate: any) => candidate.id === bot.id).busy;+ const settledTurn = () => expect.poll(busy, { timeout: 15_000 }).toBe(false);+ const transcript = async (): Promise<any[]> => (await api("GET", `/api/threads/${bot.threadId}/messages?limit=100`)).messages;+ const send = (text: string) => runControlOmb(["send", "--bot", bot.id, "--task", bot.threadId, "--text", text, "--url", fixture.info.url]);+ return { folder, gate, api, bot, busy, settledTurn, transcript, send, turnPrompt, turnToken, close };+}++it("waits for a file with no AI, posts once in the asked chat, notifies, and continues there; Cancel on its card stops another", async () => {+ const { folder, gate, api, bot, settledTurn, transcript, send, turnToken, close } = await scout("fires");+ const report = join(folder, "report.txt"), present = join(folder, "present.txt"), other = join(folder, "other.txt");+ try {+ await send("Tell me when the report is ready");+ const token = await turnToken();+ const made = await api("POST", "/api/internal/waits", { label: "the report", kind: "file_exists", path: report, follow_up: "Say the report is ready." }, 201, token);+ expect(made.text).toMatch(/\(wait id [\w-]+\)/);+ writeFileSync(present, "x");+ expect((await api("POST", "/api/internal/waits", { label: "present", kind: "file_exists", path: present }, 200, token)).text).toContain("already. Nothing was set up");+ await api("POST", "/api/internal/waits", { label: "the other file", kind: "file_exists", path: other, follow_up: "Never." }, 201, token);+ const cards = (await transcript()).filter((m) => m.card?.waitRequest);+ expect(cards.map((m) => m.card.title)).toEqual(["Waiting: the report", "Waiting: the other file"]);+ await api("POST", `/api/threads/${bot.threadId}/undo`, { requestId: cards[1].card.requestId }, 200);+ expect((await transcript()).find((m) => m.id === cards[1].id).card).toMatchObject({ undone: true, waitRequest: { settled: "cancelled" } });+ writeFileSync(gate, "finish"); await settledTurn();+ writeFileSync(report, "done"); writeFileSync(other, "x");+ await expect.poll(async () => (await transcript()).filter((m) => m.wait?.status === "fired").map((m) => m.text), { timeout: 30_000 })+ .toEqual([`the report: done. ${report} is there now.`]);+ await expect.poll(async () => (await transcript()).some((m) => m.role === "user" && m.text?.includes("[Wait finished: the report] Say the report is ready.")), { timeout: 40_000 }).toBe(true);+ expect((await api("GET", "/api/notifications")).notifications.filter((n: any) => n.kind === "wait")).toMatchObject([{ title: "Scout's wait is over" }]);+ await new Promise((resolve) => setTimeout(resolve, 7_000));+ expect((await transcript()).filter((m) => m.wait).length).toBe(1);+ } finally {+ await close();+ }+}, 120_000);++it("refuses a new wait in the run a wait's follow-up started, so a wait never renews itself", async () => {+ const { folder, gate, api, busy, settledTurn, transcript, send, turnPrompt, turnToken, close } = await scout("renew");+ const build = join(folder, "build.txt");+ try {+ await send("Tell me when the build is done");+ const asked = await turnToken();+ await api("POST", "/api/internal/waits", { label: "the build", kind: "file_exists", path: build, follow_up: "Wait for the build again." }, 201, asked);+ writeFileSync(gate, "finish"); await settledTurn(); unlinkSync(gate);+ writeFileSync(build, "x");+ await expect.poll(turnPrompt, { timeout: 40_000 }).toContain("[Wait finished: the build] Wait for the build again.");+ expect(await busy()).toBe(true);+ const followUp = await turnToken();+ expect(await api("GET", "/api/internal/waits", undefined, 200, followUp)).toEqual({ text: WAIT_MESSAGES.none });+ const again = { label: "the build", kind: "file_changed", path: build, follow_up: "Wait for the build again." };+ expect(await api("POST", "/api/internal/waits", again, 403, followUp)).toEqual({ error: WAIT_MESSAGES.notPerson });+ expect(await api("POST", "/api/internal/waits/cancel", { id: "any" }, 403, followUp)).toEqual({ error: WAIT_MESSAGES.notPerson });+ writeFileSync(gate, "finish"); await settledTurn();+ expect((await transcript()).filter((m) => m.card?.waitRequest).map((m) => m.card.waitRequest)).toMatchObject([{ label: "the build", settled: "fired" }]);+ } finally {+ await close();+ }+}, 120_000);diff --git a/server/waits.test.ts b/server/waits.test.tsnew file mode 100644index 0000000000..2415725284--- /dev/null+++ b/server/waits.test.ts@@ -0,0 +1,508 @@+import { mkdtempSync, readFileSync, rmSync, statSync } from "node:fs";+import { tmpdir } from "node:os";+import { dirname, join } from "node:path";+import { afterEach, describe, expect, it, vi } from "vitest";++import type { FileStamp, PageResult, ProcessEntry } from "./wait-probes.ts";+import { CLOUD_IDLE_AWAKE_MS, createCloudPower } from "./cloud-power.ts";+import { availableTools, catalogProfileFromEnv } from "./drivers/agents-catalog.ts";+import { describeCondition, WAIT_WAKE_MS, WaitManager, waitList, type NewWaitCondition, type WaitManagerOptions, type WaitNotice, type WaitRecord } from "./waits.ts";++const T0 = 1_800_000_000_000;+const dirs: string[] = [];++afterEach(() => {+ vi.useRealTimers();+ for (const dir of dirs.splice(0)) rmSync(dir, { recursive: true, force: true });+});++function harness(options: Partial<WaitManagerOptions> = {}) {+ const dir = mkdtempSync(join(tmpdir(), "omb-waits-"));+ dirs.push(dir);+ const file = join(dir, "waits.json");+ let clock = T0;+ const h = {+ file,+ stamp: null as FileStamp | null,+ page: { ok: true, text: "" } as PageResult,+ processes: [] as ProcessEntry[],+ stampCalls: 0,+ pageCalls: 0,+ processCalls: 0,+ pageInFlight: 0,+ pageMaxInFlight: 0,+ pageDelayMs: 0,+ pageGate: null as Promise<void> | null,+ busy: new Map<string, boolean>(),+ alive: true,+ postOk: true,+ posts: [] as WaitNotice[],+ now: () => clock,+ advance(ms: number) { clock += ms; },+ advanceTo(ms: number) { clock = ms; },+ post: vi.fn(),+ followUp: vi.fn(),+ showCard: vi.fn(() => "card-1" as string | undefined),+ settleCard: vi.fn(),+ manager: undefined as unknown as WaitManager,+ reload: () => build(),+ create(condition: NewWaitCondition, extra: { label?: string; followUp?: string; botId?: string; threadId?: string; hours?: number } = {}) {+ return h.manager.create({ botId: extra.botId ?? "bot-1", threadId: extra.threadId ?? "t-1", label: extra.label ?? "the report", condition, followUp: extra.followUp, hours: extra.hours });+ },+ waitOf(id: string): WaitRecord {+ const found = JSON.parse(readFileSync(file, "utf8")).waits.find((w: WaitRecord) => w.id === id);+ return found;+ },+ };+ h.post.mockImplementation((_wait: WaitRecord, notice: WaitNotice) => {+ if (h.postOk) h.posts.push(notice);+ return h.postOk;+ });+ function build(): WaitManager {+ h.manager = new WaitManager({+ file,+ now: options.now ?? h.now,+ probes: {+ async stamp() { h.stampCalls++; return h.stamp; },+ async page() {+ h.pageCalls++;+ h.pageInFlight++;+ h.pageMaxInFlight = Math.max(h.pageMaxInFlight, h.pageInFlight);+ try {+ if (h.pageDelayMs) await new Promise((resolve) => setTimeout(resolve, h.pageDelayMs));+ if (h.pageGate) await h.pageGate;+ return h.page;+ } finally { h.pageInFlight--; }+ },+ async processes() { h.processCalls++; return h.processes; },+ },+ sourceAlive: () => h.alive,+ botBusy: (id) => h.busy.get(id),+ post: h.post,+ followUp: h.followUp,+ showCard: h.showCard,+ settleCard: h.settleCard,+ ...options,+ });+ return h.manager;+ }+ build();+ return h;+}++describe("WaitManager", () => {+ it("creates a wait with a 24-hour default and its first check due, and keeps it across a restart", async () => {+ const h = harness();+ const created = await h.manager.create({ botId: "bot-1", threadId: "t-1", label: "the report", condition: { kind: "file_exists", path: "/r.txt" } });+ expect(created).toMatchObject({ state: "created", wait: { expiresAt: T0 + 24 * 3_600_000, nextCheckAt: T0 + 5_000, errors: 0 } });+ expect(h.reload().list("bot-1")).toHaveLength(1);+ if (process.platform !== "win32") expect(statSync(h.file).mode & 0o777).toBe(0o600);+ });++ it("creates nothing when the condition is already true", async () => {+ const h = harness();+ h.stamp = { size: 1, mtimeMs: 1 };+ expect(await h.create({ kind: "file_exists", path: "/r.txt" })).toEqual({ state: "already", text: "/r.txt exists already. Nothing was set up: tell the person now." });+ h.processes = [{ pid: 9, name: "make" }];+ expect(await h.create({ kind: "process_running", process: "make" })).toMatchObject({ state: "already" });+ h.page = { ok: true, text: "Shipped" };+ expect(await h.create({ kind: "url_contains", url: "https://x.test/", text: "shipped" })).toMatchObject({ state: "already" });+ expect(h.manager.list("bot-1")).toEqual([]);+ expect(h.reload().list("bot-1")).toEqual([]);+ });++ it("keeps ten waits per bot and fifty in all, and names the bot's waits when full", async () => {+ const h = harness();+ for (let i = 0; i < 10; i++) await h.create({ kind: "file_exists", path: `/f${i}` }, { label: `file ${i}` });+ const full = await h.create({ kind: "file_exists", path: "/f10" });+ expect(full).toMatchObject({ state: "refused", status: 409, error: expect.stringContaining("cancel_wait") });+ expect((full as { error: string }).error).toContain("file 9");+ for (let i = 0; i < 40; i++) await h.create({ kind: "file_exists", path: `/g${i}` }, { botId: `bot-${2 + (i % 8)}` });+ expect(h.manager.owners()).toHaveLength(9);+ const total = await h.create({ kind: "file_exists", path: "/h" }, { botId: "bot-99" });+ expect(total).toEqual({ state: "refused", status: 409, error: "This computer already keeps 50 waits, the most it holds. Ask the person which ones to stop." });+ });++ it("names only this chat's waits when the bot is full, and counts the others", async () => {+ const h = harness();+ for (let i = 0; i < 6; i++) await h.create({ kind: "file_exists", path: `/here${i}` }, { label: `here ${i}` });+ for (let i = 0; i < 4; i++) await h.create({ kind: "file_exists", path: `/away${i}` }, { label: `away ${i}`, threadId: "t-2" });+ const full = await h.create({ kind: "file_exists", path: "/more" }) as { error: string };+ expect(full.error).toMatch(/^You already keep 10 waits, the most one bot may\. In this chat:\n- /);+ expect(full.error).toContain("here 5");+ expect(full.error).not.toContain("away");+ expect(full.error).toMatch(/\n4 more in other chats\.\nCancel one with cancel_wait first\.$/);+ const elsewhere = await h.create({ kind: "file_exists", path: "/more" }, { threadId: "t-3" });+ expect(elsewhere).toEqual({ state: "refused", status: 409, error: "You already keep 10 waits, the most one bot may, all in other chats. Ask the person to stop one in the chat it was made in." });+ });++ it("refuses a program wait where this computer can't list its programs, and keeps one whose later listing fails", async () => {+ const h = harness();+ const processes = vi.fn(async (): Promise<ProcessEntry[]> => { throw new Error("spawn ps ENOENT"); });+ h.manager = new WaitManager({ file: h.file, now: h.now, probes: { processes }, sourceAlive: () => true, botBusy: () => false, post: h.post, followUp: h.followUp, showCard: h.showCard, settleCard: h.settleCard });+ expect(await h.create({ kind: "process_gone", process: "make" })).toEqual({ state: "refused", status: 400, error: "This computer can't list its programs, so a program wait can't work here. Wait for a file or a page instead." });+ expect(h.manager.owners()).toEqual([]);+ processes.mockResolvedValueOnce([{ pid: 1, name: "make" }]);+ expect(await h.create({ kind: "process_gone", process: "make" })).toMatchObject({ state: "created" });+ h.advance(5_000); await h.manager.tick();+ expect([h.posts, h.manager.list("bot-1").length]).toEqual([[], 1]);+ });++ it("refuses a page at a private address, and keeps checking a page that only failed to load", async () => {+ const h = harness();+ const error = "x.test points at this computer or a private network, which waits never check.";+ h.page = { ok: false, refused: true, error };+ expect(await h.create({ kind: "url_contains", url: "http://x.test/", text: "ok" })).toEqual({ state: "refused", status: 400, error });+ expect(h.manager.list("bot-1")).toEqual([]);+ h.page = { ok: false, refused: false, error: "The page took too long to answer." };+ expect(await h.create({ kind: "url_contains", url: "http://x.test/", text: "ok" })).toMatchObject({ state: "created", note: expect.stringContaining("took too long") });+ expect(h.manager.list("bot-1")).toHaveLength(1);+ });++ it("shows the card only for a wait with a follow-up, and stores its message id", async () => {+ const h = harness();+ h.showCard.mockReturnValue("m-1");+ const withFollowUp = await h.create({ kind: "file_exists", path: "/r" }, { followUp: "Summarise it." });+ expect(withFollowUp).toMatchObject({ wait: { cardMessageId: "m-1" } });+ const stored = h.reload().list("bot-1");+ expect(stored[0]?.cardMessageId).toBe("m-1");+ await h.create({ kind: "file_exists", path: "/s" });+ expect(h.showCard).toHaveBeenCalledTimes(1);+ });++ it("fires once: one line, one follow-up, the card settled, and the wait gone", async () => {+ const h = harness();+ await h.create({ kind: "file_exists", path: "/r.txt" }, { label: "the report", followUp: "Summarise it." });+ h.stamp = { size: 1, mtimeMs: 1 }; h.advance(5_000); await h.manager.tick(); await h.manager.tick();+ expect(h.posts).toEqual([{ status: "fired", text: "the report: done. /r.txt is there now." }]);+ expect(h.followUp).toHaveBeenCalledTimes(1);+ expect(h.settleCard.mock.calls.map(([, how]) => how)).toEqual(["fired"]);+ expect(h.manager.list("bot-1")).toEqual([]);+ expect(h.reload().owners()).toEqual([]);+ });++ it("holds the line while a turn runs in the chat, then posts it once, even across a restart", async () => {+ const h = harness();+ await h.create({ kind: "file_exists", path: "/r.txt" }, { followUp: "Go." });+ expect(h.manager.count("bot-1", "t-1")).toBe(1);+ h.stamp = { size: 1, mtimeMs: 1 }; h.postOk = false; h.advance(5_000); await h.manager.tick();+ expect(h.manager.list("bot-1")).toEqual([]);+ expect(h.manager.count("bot-1", "t-1")).toBe(0);+ expect(h.manager.owners()).toEqual(["bot-1"]);+ const storedAtFollowUp: number[] = [];+ h.followUp.mockImplementation(() => { storedAtFollowUp.push(JSON.parse(readFileSync(h.file, "utf8")).waits.length); });+ const reloaded = h.reload(); h.postOk = true; await reloaded.tick();+ expect(storedAtFollowUp).toEqual([0]);+ expect(h.post).toHaveBeenCalledTimes(2);+ expect(h.posts).toHaveLength(1);+ expect(h.followUp).toHaveBeenCalledTimes(1);+ await reloaded.tick(); expect(h.post).toHaveBeenCalledTimes(2);+ expect(h.followUp).toHaveBeenCalledTimes(1);+ });++ it("expires after its hours with one last check, quietly and without a follow-up", async () => {+ const h = harness();+ await h.create({ kind: "file_exists", path: "/r" }, { label: "the build", followUp: "Deploy." });+ h.stampCalls = 0;+ h.advance(24 * 3_600_000); await h.manager.tick();+ expect(h.stampCalls).toBe(1);+ expect(h.posts).toEqual([{ status: "expired", text: "Stopped waiting for the build after 24 hours." }]);+ expect(h.followUp).not.toHaveBeenCalled();+ expect(h.settleCard.mock.calls.map(([, how]) => how)).toEqual(["expired"]);+ expect(h.manager.owners()).toEqual([]);+ });++ it("says one hour in the singular", async () => {+ const h = harness();+ await h.create({ kind: "file_exists", path: "/r" }, { label: "the build", hours: 1 });+ h.advance(3_600_000); await h.manager.tick();+ expect(h.posts).toEqual([{ status: "expired", text: "Stopped waiting for the build after 1 hour." }]);+ });++ it("fires instead of expiring when the last check finds it", async () => {+ const h = harness();+ await h.create({ kind: "file_exists", path: "/r" }, { label: "the build" });+ h.stamp = { size: 1, mtimeMs: 1 }; h.advance(30 * 3_600_000); await h.manager.tick();+ expect(h.posts).toEqual([{ status: "fired", text: "the build: done. /r is there now." }]);+ });++ it("lets the last check at expiry keep the page minimum interval", async () => {+ const h = harness();+ h.page = { ok: true, text: "building" };+ await h.create({ kind: "url_contains", url: "https://x.test/", text: "shipped" }, { label: "the page", hours: 1 });+ h.advanceTo(T0 + 3_600_000 - 30_000); await h.manager.tick();+ h.page = { ok: true, text: "shipped" };+ const calls = h.pageCalls;+ h.advanceTo(T0 + 3_600_000); await h.manager.tick();+ expect(h.pageCalls).toBe(calls);+ expect(h.posts).toEqual([{ status: "expired", text: "Stopped waiting for the page after 1 hour." }]);+ });++ it("checks a page every minute and backs off to 15 minutes while it fails", async () => {+ const h = harness();+ h.page = { ok: true, text: "building" };+ const { wait } = await h.create({ kind: "url_contains", url: "https://x.test/", text: "shipped" }) as { wait: WaitRecord };+ expect(wait.nextCheckAt - T0).toBe(60_000);+ h.page = { ok: false, refused: false, error: "down" };+ const gaps: number[] = [];+ for (let i = 0; i < 6; i++) { h.advanceTo(h.waitOf(wait.id).nextCheckAt); await h.manager.tick(); gaps.push(h.waitOf(wait.id).nextCheckAt - h.now()); }+ expect(gaps).toEqual([120_000, 240_000, 480_000, 900_000, 900_000, 900_000]);+ h.page = { ok: true, text: "building" }; h.advanceTo(h.waitOf(wait.id).nextCheckAt); await h.manager.tick();+ expect(h.waitOf(wait.id).nextCheckAt - h.now()).toBe(60_000);+ h.advance(5_000); await h.manager.tick(); expect(h.pageCalls).toBe(8);+ });++ it("fires url_missing only once a check saw the text, so a page its scripts draw is never gone at once", async () => {+ const h = harness();+ h.page = { ok: true, text: "Loading" };+ const created = await h.create({ kind: "url_missing", url: "https://shop.test/", text: "Sold out" }, { label: "the shoes" });+ expect(created).toMatchObject({ state: "created", wait: { condition: { sawText: false } }, note: expect.stringContaining("The page does not say “Sold out” now") });+ h.advance(60_000); await h.manager.tick();+ expect(h.posts).toEqual([]);+ h.page = { ok: true, text: "Shoes: Sold out" }; h.advance(60_000); await h.manager.tick();+ expect([h.posts, h.reload().list("bot-1")[0]?.condition]).toEqual([[], expect.objectContaining({ sawText: true })]);+ h.page = { ok: true, text: "Shoes: In stock" }; h.advance(60_000); await h.manager.tick();+ expect(h.posts).toEqual([{ status: "fired", text: "the shoes: done. https://shop.test/ no longer says “Sold out”." }]);+ });++ it("counts text the page shows when a url_missing wait is made as seen, with no note", async () => {+ const h = harness();+ h.page = { ok: true, text: "Shoes: Sold out" };+ const created = await h.create({ kind: "url_missing", url: "https://shop.test/", text: "sold out" }, { label: "the shoes" });+ expect(created).toMatchObject({ state: "created", wait: { condition: { sawText: true } } });+ expect(created).not.toHaveProperty("note");+ h.page = { ok: true, text: "Shoes: In stock" }; h.advance(60_000); await h.manager.tick();+ expect(h.posts).toEqual([{ status: "fired", text: "the shoes: done. https://shop.test/ no longer says “sold out”." }]);+ });++ it("lets a sleeping Cloud sleep while a wait is open and wake for it 30 minutes on, not at a page's next minute", async () => {+ const h = harness();+ expect(h.manager.nextWakeAt()).toBeNull();+ h.page = { ok: true, text: "building" };+ await h.create({ kind: "url_contains", url: "https://x.test/", text: "shipped" });+ const idle = () => false;+ const power = createCloudPower({ dataDir: dirname(h.file), now: h.now, broadcast: () => {}, probes: {+ turn: idle, run: idle, liveCall: idle, computer: idle, maintenance: idle, nextDueAt: () => h.manager.nextWakeAt(),+ } });+ try {+ for (let left = CLOUD_IDLE_AWAKE_MS; left > 0; left -= 5_000) { h.advance(5_000); power.tick(); }+ expect(power.prepareSleep()).toEqual({ ok: true, nextDueAt: h.now() + WAIT_WAKE_MS });+ } finally { power.close(); }+ h.page = { ok: true, text: "shipped" }; h.advance(60_000); await h.manager.tick();+ expect([h.posts.length, h.manager.nextWakeAt()]).toEqual([1, null]);+ });++ it("never fetches two pages at once, even for concurrent creates", async () => {+ const h = harness();+ h.page = { ok: true, text: "building" };+ h.pageDelayMs = 10;+ await Promise.all(["https://a.test/", "https://b.test/", "https://c.test/"].map((url) => h.create({ kind: "url_contains", url, text: "shipped" }, { label: url })));+ expect(h.pageCalls).toBe(3);+ expect(h.pageMaxInFlight).toBe(1);+ h.pageCalls = 0; h.pageMaxInFlight = 0;+ h.advance(60_000); await h.manager.tick();+ expect(h.pageCalls).toBe(3);+ expect(h.pageMaxInFlight).toBe(1);+ });++ it("leaves a due page for the next tick while another page fetch is in flight", async () => {+ const h = harness();+ h.page = { ok: true, text: "building" };+ await h.create({ kind: "url_contains", url: "https://a.test/", text: "shipped" });+ h.advance(60_000); h.pageCalls = 0; h.pageMaxInFlight = 0; h.pageDelayMs = 10;+ const creating = h.create({ kind: "url_contains", url: "https://b.test/", text: "shipped" });+ await vi.waitFor(() => expect(h.pageInFlight).toBe(1), { interval: 1 });+ await h.manager.tick();+ expect(h.pageCalls).toBe(1);+ await creating;+ expect(h.pageMaxInFlight).toBe(1);+ h.pageDelayMs = 0; await h.manager.tick();+ expect(h.pageCalls).toBe(2);+ });++ it("reads a slow page outside the ticking window, and posts nothing it found once stopped until started again", async () => {+ const h = harness();+ h.page = { ok: true, text: "building" };+ await h.create({ kind: "url_contains", url: "https://x.test/", text: "shipped" }, { label: "the page" });+ let open!: () => void;+ h.pageGate = new Promise((resolve) => { open = resolve; });+ h.page = { ok: true, text: "shipped" }; h.advance(60_000);+ const ticking = h.manager.tick();+ await vi.waitFor(() => expect(h.pageInFlight).toBe(1), { interval: 1 });+ expect(h.manager.isTicking).toBe(false);+ h.manager.stop(); open(); await ticking;+ expect([h.posts, h.manager.list("bot-1").length]).toEqual([[], 1]);+ h.pageGate = null; h.manager.start();+ await vi.waitFor(() => expect(h.posts).toEqual([{ status: "fired", text: "the page: done. https://x.test/ now says “shipped”." }]), { interval: 1 });+ h.manager.stop();+ });++ it("waits for another bot to start and then finish, even a turn shorter than a tick", async () => {+ const h = harness();+ h.busy.set("coder", false);+ await h.create({ kind: "bot_idle", botId: "coder", botName: "Coder" }, { label: "Coder's review" });+ h.advance(5_000); await h.manager.tick(); expect(h.posts).toEqual([]);+ h.manager.noteBotBusy("coder");+ h.advance(5_000); await h.manager.tick();+ expect(h.posts).toEqual([{ status: "fired", text: "Coder's review: done. Coder finished." }]);+ });++ it("stops with a line when the bot it waits for is deleted", async () => {+ const h = harness();+ h.busy.set("coder", false);+ await h.create({ kind: "bot_idle", botId: "coder", botName: "Coder" }, { label: "Coder's review" });+ h.busy.delete("coder"); h.advance(5_000); await h.manager.tick();+ expect(h.posts).toEqual([{ status: "stopped", text: "Stopped waiting for Coder's review: Coder no longer exists." }]);+ expect(h.manager.owners()).toEqual([]);+ });++ it("drops a wait silently when its chat or bot is gone, without posting or touching the card", async () => {+ const h = harness();+ await h.create({ kind: "file_exists", path: "/r" }, { followUp: "Go." });+ h.alive = false; h.stamp = { size: 1, mtimeMs: 1 }; h.advance(5_000); await h.manager.tick();+ expect([h.post.mock.calls.length, h.settleCard.mock.calls.length, h.manager.list("bot-1").length]).toEqual([0, 0, 0]);+ expect(h.reload().owners()).toEqual([]);+ });++ it("reads a file's change against the stamp taken when the wait was made", async () => {+ const h = harness();+ h.stamp = { size: 1, mtimeMs: 1 };+ await h.create({ kind: "file_changed", path: "/log" });+ h.advance(5_000); await h.manager.tick(); expect(h.posts).toEqual([]);+ h.stamp = { size: 2, mtimeMs: 2 }; h.advance(5_000); await h.manager.tick();+ expect(h.posts).toEqual([{ status: "fired", text: "the report: done. /log changed." }]);+ });++ it("reads the process list once per tick for every process wait", async () => {+ const h = harness();+ h.processes = [{ pid: 1, name: "a" }, { pid: 2, name: "b" }, { pid: 3, name: "c" }];+ for (const name of ["a", "b", "c"]) await h.create({ kind: "process_gone", process: name }, { label: name });+ h.processCalls = 0; h.advance(5_000); await h.manager.tick();+ expect(h.processCalls).toBe(1);+ expect(h.posts).toEqual([]);+ h.processes = [];+ h.advance(5_000); await h.manager.tick();+ expect(h.processCalls).toBe(2);+ expect(h.posts.map((p) => p.text)).toEqual(["a: done. a stopped.", "b: done. b stopped.", "c: done. c stopped."]);+ });++ it("lets a bot cancel only its own waits, and settles the card", async () => {+ const h = harness();+ const { wait } = await h.create({ kind: "file_exists", path: "/r" }, { followUp: "Go." }) as { wait: WaitRecord };+ expect(h.manager.cancel(wait.id, "bot-2")).toBeNull();+ expect(h.manager.list("bot-1")).toHaveLength(1);+ expect([h.manager.count("bot-1", "t-1"), h.manager.count("bot-2", "t-1")]).toEqual([1, 0]);+ expect(h.manager.cancel(wait.id, "bot-1")?.id).toBe(wait.id);+ expect(h.manager.count("bot-1", "t-1")).toBe(0);+ expect(h.settleCard.mock.calls.map(([, how]) => how)).toEqual(["cancelled"]);+ expect(h.manager.list("bot-1")).toEqual([]);+ expect(h.reload().owners()).toEqual([]);+ });++ it("counts only this chat's waits, so list_waits and cancel_wait are listed in that chat and not in the bot's others", async () => {+ const h = harness();+ await h.create({ kind: "file_exists", path: "/r" }, { threadId: "t-1" });+ // As server/index.ts sets OMB_ACTIVE_WAITS for a turn of bot-1 in a chat.+ const listed = (threadId: string) => availableTools(catalogProfileFromEnv({ OMB_BOT_ID: "bot-1", OMB_ACTIVE_WAITS: h.manager.count("bot-1", threadId) ? "1" : "0" }))+ .map((tool) => tool.name).filter((name) => ["wait_until", "list_waits", "cancel_wait"].includes(name));+ expect([h.manager.count("bot-1", "t-1"), h.manager.count("bot-1", "t-2")]).toEqual([1, 0]);+ expect(listed("t-2")).toEqual(["wait_until"]);+ expect(listed("t-1")).toEqual(["wait_until", "list_waits", "cancel_wait"]);+ });++ it("removes a deleted bot's waits and nobody else's", async () => {+ const h = harness();+ await h.create({ kind: "file_exists", path: "/a" }); await h.create({ kind: "file_exists", path: "/b" });+ await h.create({ kind: "file_exists", path: "/c" }, { botId: "bot-2" });+ expect(h.manager.owners()).toEqual(["bot-1", "bot-2"]);+ expect(h.manager.removeForBot("bot-1")).toBe(2);+ expect([h.manager.list("bot-1").length, h.manager.list("bot-2").length, h.posts.length]).toEqual([0, 1, 0]);+ });++ it("describes conditions and lists waits in the exact copy", () => {+ expect(describeCondition({ kind: "url_missing", url: "https://x.test/", text: "beta" })).toBe("https://x.test/ no longer says “beta”");+ expect(describeCondition({ kind: "process_gone", process: "make" })).toBe("make has stopped");+ expect(describeCondition({ kind: "bot_idle", botId: "c", botName: "Coder", sawBusy: false })).toBe("Coder finishes its work");+ const wait: WaitRecord = { id: "w1", botId: "b", threadId: "t", label: "L", condition: { kind: "file_exists", path: "/p" }, followUp: "Go", createdAt: 0, expiresAt: 3_600_000, nextCheckAt: 0, errors: 0 };+ expect(waitList([wait])).toBe("- w1 · L · until /p exists · made 1970-01-01T00:00:00.000Z · stops 1970-01-01T01:00:00.000Z · follow_up: Go");+ });++ it("checks every five seconds once started, and not at all once stopped", async () => {+ vi.useFakeTimers();+ const h = harness({ now: () => Date.now() });+ await h.create({ kind: "file_exists", path: "/r" });+ h.manager.start(); await vi.advanceTimersByTimeAsync(0);+ const seen = h.stampCalls;+ await vi.advanceTimersByTimeAsync(5_000);+ expect(h.stampCalls).toBe(seen + 1);+ h.manager.stop(); await vi.advanceTimersByTimeAsync(30_000);+ expect(h.stampCalls).toBe(seen + 1);+ expect(h.manager.isTicking).toBe(false);+ });++ it("keeps exactly ten waits for a bot when creates run at the same time", async () => {+ const h = harness();+ h.page = { ok: true, text: "building" };+ h.pageDelayMs = 2;+ const results = await Promise.all(Array.from({ length: 15 }, (_, i) => h.create({ kind: "url_contains", url: `https://x${i}.test/`, text: "shipped" }, { label: `p${i}` })));+ expect(results.filter((r) => r.state === "created")).toHaveLength(10);+ expect(results.filter((r) => r.state === "refused")).toHaveLength(5);+ expect(h.manager.list("bot-1")).toHaveLength(10);+ expect(h.reload().list("bot-1")).toHaveLength(10);+ });++ it("starts a bot_idle wait that was made while the bot is busy as already seen busy", async () => {+ const h = harness();+ h.busy.set("coder", true);+ const created = await h.create({ kind: "bot_idle", botId: "coder", botName: "Coder" }, { label: "Coder's review" });+ expect(created).toMatchObject({ state: "created", wait: { condition: { sawBusy: true } } });+ h.advance(5_000); await h.manager.tick(); expect(h.posts).toEqual([]);+ h.busy.set("coder", false); h.advance(5_000); await h.manager.tick();+ expect(h.posts).toEqual([{ status: "fired", text: "Coder's review: done. Coder finished." }]);+ });++ it("rolls a failed save back completely, and keeps a wait whose card id could not be saved", async () => {+ const h = harness();+ const save = vi.spyOn(h.manager as unknown as { save(): void }, "save");+ save.mockImplementationOnce(() => { throw new Error("disk full"); });+ await expect(h.create({ kind: "file_exists", path: "/r" })).rejects.toThrow("disk full");+ expect(h.manager.owners()).toEqual([]);++ const { wait } = await h.create({ kind: "file_exists", path: "/s" }) as { wait: WaitRecord };+ save.mockImplementationOnce(() => { throw new Error("disk full"); });+ expect(() => h.manager.cancel(wait.id, "bot-1")).toThrow("disk full");+ expect(h.manager.list("bot-1")).toHaveLength(1);++ h.showCard.mockReturnValue("m-9");+ save.mockImplementationOnce(() => undefined);+ save.mockImplementationOnce(() => { throw new Error("disk full"); });+ const withCard = await h.create({ kind: "file_exists", path: "/t" }, { followUp: "Go." });+ expect(withCard).toMatchObject({ state: "created" });+ expect((withCard as { wait: WaitRecord }).wait.cardMessageId).toBeUndefined();+ expect(h.manager.list("bot-1")).toHaveLength(2);+ });++ it("restores a bot_idle record's changed flag when its save fails", async () => {+ const h = harness();+ h.busy.set("coder", false);+ await h.create({ kind: "bot_idle", botId: "coder", botName: "Coder" });+ const save = vi.spyOn(h.manager as unknown as { save(): void }, "save");+ save.mockImplementationOnce(() => { throw new Error("disk full"); });+ expect(() => h.manager.noteBotBusy("coder")).toThrow("disk full");+ expect(h.manager.list("bot-1")[0]?.condition).toMatchObject({ sawBusy: false });+ });++ it("logs a tick that throws instead of leaving it unhandled", async () => {+ vi.useFakeTimers();+ const error = vi.spyOn(console, "error").mockImplementation(() => undefined);+ const h = harness({ now: () => Date.now() });+ await h.create({ kind: "file_exists", path: "/r" });+ h.stamp = { size: 1, mtimeMs: 1 };+ vi.spyOn(h.manager as unknown as { save(): void }, "save").mockImplementation(() => { throw new Error("disk full"); });+ h.manager.start();+ await vi.advanceTimersByTimeAsync(5_000);+ expect(error).toHaveBeenCalledWith("wait tick failed", expect.objectContaining({ message: "disk full" }));+ h.manager.stop();+ error.mockRestore();+ });+});diff --git a/server/waits.ts b/server/waits.tsnew file mode 100644index 0000000000..189f7e2e12--- /dev/null+++ b/server/waits.ts@@ -0,0 +1,449 @@+import { randomUUID } from "node:crypto";+import { mkdirSync, readFileSync } from "node:fs";+import { homedir } from "node:os";+import { dirname, join } from "node:path";+import { z } from "zod";++import { WAIT_HOURS, type WaitKind } from "../shared/waits.ts";+import { writeFileAtomic } from "./atomic.ts";+import { DATA_DIR } from "./config.ts";+import {+ expandHome,+ fetchPageText,+ fileChanged,+ fileStamp,+ listProcesses,+ pageSays,+ processRunning,+ type FileStamp,+ type PageResult,+ type ProcessEntry,+} from "./wait-probes.ts";++export const WAIT_LIMITS = { perBot: 10, total: 50 } as const;+export const WAIT_TICK_MS = 5_000, URL_CHECK_MS = 60_000, URL_BACKOFF_MAX_MS = 15 * 60_000;+/** A sleeping Cloud wakes this often while a wait is open, to check it; checks pause in between. */+export const WAIT_WAKE_MS = 30 * 60_000;+export const NO_PROCESS_LIST = "This computer can't list its programs, so a program wait can't work here. Wait for a file or a page instead.";++export type NewWaitCondition =+ | { kind: "url_contains" | "url_missing"; url: string; text: string }+ | { kind: "file_exists" | "file_missing" | "file_changed"; path: string }+ | { kind: "process_running" | "process_gone"; process: string }+ | { kind: "bot_idle"; botId: string; botName: string };+export type WaitCondition =+ | { kind: "url_contains"; url: string; text: string }+ /** `sawText`: a check found the text, so its going counts (a page its scripts draw reads bare from the start). */+ | { kind: "url_missing"; url: string; text: string; sawText: boolean }+ | { kind: "file_exists" | "file_missing"; path: string }+ | { kind: "file_changed"; path: string; before: FileStamp | null }+ | { kind: "process_running" | "process_gone"; process: string }+ | { kind: "bot_idle"; botId: string; botName: string; sawBusy: boolean };+export interface WaitNotice { status: "fired" | "expired" | "stopped"; text: string }+export interface WaitRecord {+ id: string; botId: string; threadId: string; label: string; condition: WaitCondition; followUp?: string;+ createdAt: number; expiresAt: number; nextCheckAt: number; errors: number; cardMessageId?: string;+ /** Decided and saved first; posted once its chat is free. */+ ending?: WaitNotice;+}+export interface NewWait { botId: string; threadId: string; label: string; condition: NewWaitCondition; followUp?: string; hours?: number }+export type CreateWaitResult =+ | { state: "created"; wait: WaitRecord; note?: string }+ | { state: "already"; text: string }+ | { state: "refused"; status: 400 | 409; error: string };+export interface WaitProbes { page(url: string): Promise<PageResult>; stamp(path: string): Promise<FileStamp | null>; processes(): Promise<ProcessEntry[]> }+export interface WaitManagerOptions {+ file?: string; now?: () => number; probes?: Partial<WaitProbes>;+ sourceAlive(botId: string, threadId: string): boolean;+ /** Undefined once that bot no longer exists. */+ botBusy(botId: string): boolean | undefined;+ /** False while a turn runs in the chat: try again next tick. */+ post(wait: WaitRecord, notice: WaitNotice): boolean;+ followUp(wait: WaitRecord & { followUp: string }): void;+ showCard(wait: WaitRecord & { followUp: string }): string | undefined;+ settleCard(wait: WaitRecord, how: "fired" | "expired" | "cancelled"): void;+}++const stampSchema = z.object({ size: z.number(), mtimeMs: z.number() });+const conditionSchema = z.union([+ z.object({ kind: z.literal("url_contains"), url: z.string(), text: z.string() }),+ z.object({ kind: z.literal("url_missing"), url: z.string(), text: z.string(), sawText: z.boolean() }),+ z.object({ kind: z.enum(["file_exists", "file_missing"]), path: z.string() }),+ z.object({ kind: z.literal("file_changed"), path: z.string(), before: stampSchema.nullable() }),+ z.object({ kind: z.enum(["process_running", "process_gone"]), process: z.string() }),+ z.object({ kind: z.literal("bot_idle"), botId: z.string(), botName: z.string(), sawBusy: z.boolean() }),+]);+const recordSchema = z.object({+ id: z.string(),+ botId: z.string(),+ threadId: z.string(),+ label: z.string(),+ condition: conditionSchema,+ followUp: z.string().optional(),+ createdAt: z.number(),+ expiresAt: z.number(),+ nextCheckAt: z.number(),+ errors: z.number(),+ cardMessageId: z.string().optional(),+ ending: z.object({ status: z.enum(["fired", "expired", "stopped"]), text: z.string() }).optional(),+});+const fileSchema = z.object({ version: z.literal(1), waits: z.array(z.unknown()) });++export function describeCondition(condition: NewWaitCondition | WaitCondition): string {+ switch (condition.kind) {+ case "url_contains": return `${condition.url} says “${condition.text}”`;+ case "url_missing": return `${condition.url} no longer says “${condition.text}”`;+ case "file_exists": return `${condition.path} exists`;+ case "file_missing": return `${condition.path} is gone`;+ case "file_changed": return `${condition.path} changes`;+ case "process_running": return `${condition.process} is running`;+ case "process_gone": return `${condition.process} has stopped`;+ case "bot_idle": return `${condition.botName} finishes its work`;+ }+}++function firedDetail(condition: WaitCondition): string {+ switch (condition.kind) {+ case "url_contains": return `${condition.url} now says “${condition.text}”.`;+ case "url_missing": return `${condition.url} no longer says “${condition.text}”.`;+ case "file_exists": return `${condition.path} is there now.`;+ case "file_missing": return `${condition.path} is gone.`;+ case "file_changed": return `${condition.path} changed.`;+ case "process_running": return `${condition.process} is running.`;+ case "process_gone": return `${condition.process} stopped.`;+ case "bot_idle": return `${condition.botName} finished.`;+ }+}++const iso = (ms: number) => new Date(ms).toISOString();++export function waitList(waits: readonly WaitRecord[]): string {+ return waits+ .map((w) => `- ${w.id} · ${w.label} · until ${describeCondition(w.condition)} · made ${iso(w.createdAt)} · stops ${iso(w.expiresAt)}${w.followUp ? ` · follow_up: ${w.followUp}` : ""}`)+ .join("\n");+}++const isPage = (condition: NewWaitCondition | WaitCondition) => condition.kind === "url_contains" || condition.kind === "url_missing";++function interval(kind: WaitKind, errors: number): number {+ if (kind !== "url_contains" && kind !== "url_missing") return WAIT_TICK_MS;+ return Math.min(URL_CHECK_MS * 2 ** errors, URL_BACKOFF_MAX_MS);+}++function cloneWait(wait: WaitRecord): WaitRecord {+ return structuredClone(wait);+}++type Verdict = { met: boolean; gone?: boolean; unlisted?: boolean; page?: { ok: true } | { ok: false; refused: boolean; error: string } };++export class WaitManager {+ private readonly file: string;+ private readonly now: () => number;+ private readonly probes: WaitProbes;+ private readonly options: WaitManagerOptions;+ private waits: WaitRecord[] = [];+ private timer: ReturnType<typeof setInterval> | null = null;+ private running = false;+ private stopped = false;+ private ticking = false;+ private pageTail: Promise<unknown> = Promise.resolve();+ private pagesQueued = 0;++ constructor(options: WaitManagerOptions) {+ this.options = options;+ this.file = options.file ?? join(DATA_DIR, "waits.json");+ this.now = options.now ?? Date.now;+ this.probes = {+ page: (url) => fetchPageText(url),+ stamp: (path) => fileStamp(expandHome(path, homedir())),+ processes: () => listProcesses(),+ ...options.probes,+ };+ try {+ const parsed = fileSchema.safeParse(JSON.parse(readFileSync(this.file, "utf8")));+ this.waits = parsed.success+ ? parsed.data.waits.flatMap((candidate) => {+ const record = recordSchema.safeParse(candidate);+ return record.success ? [record.data as WaitRecord] : [];+ })+ : [];+ } catch {+ this.waits = [];+ }+ }++ async create(input: NewWait): Promise<CreateWaitResult> {+ const full = this.limitRefusal(input);+ if (full) return full;+ const condition = await this.startingCondition(input.condition);+ const verdict = await this.probe(condition, undefined);+ if (verdict.gone) return { state: "refused", status: 400, error: `${(condition as { botName: string }).botName} no longer exists. Use a name or id from list_bots.` };+ if (verdict.unlisted) return { state: "refused", status: 400, error: NO_PROCESS_LIST };+ if (verdict.page && !verdict.page.ok && verdict.page.refused) return { state: "refused", status: 400, error: verdict.page.error };+ if (verdict.met) return { state: "already", text: `${describeCondition(condition)} already. Nothing was set up: tell the person now.` };+ const crowded = this.limitRefusal(input);+ if (crowded) return crowded;+ const now = this.now();+ const wait: WaitRecord = {+ id: randomUUID(),+ botId: input.botId,+ threadId: input.threadId,+ label: input.label,+ condition,+ ...(input.followUp ? { followUp: input.followUp } : {}),+ createdAt: now,+ expiresAt: now + (input.hours ?? WAIT_HOURS.default) * 3_600_000,+ nextCheckAt: now + interval(condition.kind, 0),+ errors: 0,+ };+ this.commit(() => this.waits.push(wait));+ if (wait.followUp) {+ const cardMessageId = this.options.showCard(wait as WaitRecord & { followUp: string });+ if (cardMessageId) {+ try { this.commit(() => { wait.cardMessageId = cardMessageId; }); } catch (error) { console.error(`wait ${wait.id}: could not store the card id`, error); }+ }+ }+ const note = verdict.page && !verdict.page.ok+ ? `The page could not be read just now (${verdict.page.error}); checks go on every minute and slow down while it keeps failing.`+ : condition.kind === "url_missing" && !condition.sawText+ ? `The page does not say “${condition.text}” now, as a plain check reads it (without running its scripts), so this fires only once it says it and then stops. It may be gone already, or shown only by the page's scripts: tell the person.`+ : undefined;+ return { state: "created", wait: cloneWait(wait), ...(note ? { note } : {}) };+ }++ private limitRefusal({ botId, threadId }: Pick<NewWait, "botId" | "threadId">): CreateWaitResult | null {+ const mine = this.waits.filter((w) => w.botId === botId && !w.ending);+ if (mine.length >= WAIT_LIMITS.perBot) {+ const here = mine.filter((w) => w.threadId === threadId), others = mine.length - here.length;+ const full = `You already keep ${WAIT_LIMITS.perBot} waits, the most one bot may`;+ const error = here.length+ ? `${full}. In this chat:\n${waitList(here)}${others ? `\n${others} more in other chats.` : ""}\nCancel one with cancel_wait first.`+ : `${full}, all in other chats. Ask the person to stop one in the chat it was made in.`;+ return { state: "refused", status: 409, error };+ }+ if (this.waits.length >= WAIT_LIMITS.total) {+ return { state: "refused", status: 409, error: `This computer already keeps ${WAIT_LIMITS.total} waits, the most it holds. Ask the person which ones to stop.` };+ }+ return null;+ }++ private async startingCondition(condition: NewWaitCondition): Promise<WaitCondition> {+ switch (condition.kind) {+ case "file_changed": return { ...condition, before: await this.probes.stamp(condition.path) };+ case "file_exists":+ case "file_missing": return { kind: condition.kind, path: condition.path };+ case "bot_idle": return { ...condition, sawBusy: false };+ case "url_contains": return { kind: "url_contains", url: condition.url, text: condition.text };+ case "url_missing": return { kind: "url_missing", url: condition.url, text: condition.text, sawText: false };+ default: return { ...condition };+ }+ }++ list(botId: string): WaitRecord[] {+ return this.waits.filter((w) => w.botId === botId && !w.ending).map(cloneWait);+ }++ /** How many of the bot's waits in this chat have not ended, without copying them: what list_waits would name there. */+ count(botId: string, threadId: string): number {+ return this.waits.reduce((count, w) => count + (w.botId === botId && w.threadId === threadId && !w.ending ? 1 : 0), 0);+ }++ /** Every wait, those ended but not yet posted too. */+ all(): WaitRecord[] {+ return this.waits.map(cloneWait);+ }++ cancel(id: string, botId: string): WaitRecord | null {+ const wait = this.waits.find((w) => w.id === id && w.botId === botId);+ if (!wait) return null;+ this.commit(() => { this.waits = this.waits.filter((w) => w !== wait); });+ if (wait.cardMessageId) this.safely(() => this.options.settleCard(wait, "cancelled"));+ return cloneWait(wait);+ }++ owners(): string[] {+ return [...new Set(this.waits.map((w) => w.botId))];+ }++ /** When a sleeping Cloud should wake to check: WAIT_WAKE_MS on while a wait is open, never a page's next minute (the+ * home would never sleep), null with none open. */+ nextWakeAt(): number | null {+ return this.waits.some((w) => !w.ending) ? this.now() + WAIT_WAKE_MS : null;+ }++ removeForBot(botId: string): number {+ const removed = this.waits.filter((w) => w.botId === botId).length;+ if (!removed) return 0;+ this.commit(() => { this.waits = this.waits.filter((w) => w.botId !== botId); });+ return removed;+ }++ noteBotBusy(botId: string): void {+ const pending = this.waits.filter((w) => !w.ending && w.condition.kind === "bot_idle" && w.condition.botId === botId && !w.condition.sawBusy);+ if (!pending.length) return;+ this.commit(() => {+ for (const w of pending) if (w.condition.kind === "bot_idle") w.condition.sawBusy = true;+ });+ }++ /** True while a tick decides and posts; its checks, a slow page among them, run before that. */+ get isTicking(): boolean { return this.ticking; }++ start(): void {+ this.stopped = false;+ if (this.timer) return;+ this.runTick();+ this.timer = setInterval(() => this.runTick(), WAIT_TICK_MS);+ this.timer.unref?.();+ }++ private runTick(): void {+ this.tick().catch((error) => console.error("wait tick failed", error));+ }++ stop(): void {+ this.stopped = true;+ if (this.timer) clearInterval(this.timer);+ this.timer = null;+ }++ async tick(): Promise<void> {+ if (this.running) return;+ this.running = true;+ try {+ const alive = this.waits.filter((w) => this.options.sourceAlive(w.botId, w.threadId));+ if (alive.length !== this.waits.length) {+ this.waits = alive;+ this.save();+ }+ const now = this.now();+ const due = this.waits.filter((w) => !w.ending && now >= w.nextCheckAt);+ const verdicts = new Map<WaitRecord, Verdict>();+ let processes: Promise<ProcessEntry[]> | undefined;+ const readProcesses = () => (processes ??= this.probes.processes());+ const pages = this.pagesQueued > 0 ? [] : due.filter((w) => isPage(w.condition));+ const chain = async () => {+ for (const w of pages) verdicts.set(w, await this.probe(w.condition, readProcesses));+ };+ await Promise.all([+ chain(),+ ...due.filter((w) => !isPage(w.condition)).map(async (w) => { verdicts.set(w, await this.probe(w.condition, readProcesses)); }),+ ]);+ if (!this.stopped) this.settle(now, verdicts);+ } finally {+ this.running = false;+ }+ }++ private settle(now: number, verdicts: ReadonlyMap<WaitRecord, Verdict>): void {+ this.ticking = true;+ try {+ let decided = false;+ for (const wait of this.waits.slice()) {+ if (wait.ending) continue;+ const verdict = verdicts.get(wait);+ const expired = now >= wait.expiresAt;+ if (!verdict) {+ if (expired && now < wait.nextCheckAt) {+ wait.ending = this.expiredNotice(wait);+ decided = true;+ }+ continue;+ }+ if (verdict.met) wait.ending = { status: "fired", text: `${wait.label}: done. ${firedDetail(wait.condition)}` };+ else if (verdict.gone && wait.condition.kind === "bot_idle") wait.ending = { status: "stopped", text: `Stopped waiting for ${wait.label}: ${wait.condition.botName} no longer exists.` };+ else if (expired) wait.ending = this.expiredNotice(wait);+ else {+ wait.errors = verdict.page && !verdict.page.ok ? wait.errors + 1 : 0;+ wait.nextCheckAt = now + interval(wait.condition.kind, wait.errors);+ decided = true;+ continue;+ }+ decided = true;+ }+ if (decided) this.save();++ for (const wait of this.waits.slice()) {+ if (!wait.ending) continue;+ let posted = false;+ try { posted = this.options.post(wait, wait.ending); } catch (error) { console.error(`wait ${wait.id}: could not post`, error); }+ if (!posted) continue;+ const status = wait.ending.status;+ this.commit(() => { this.waits = this.waits.filter((w) => w !== wait); });+ if (status === "fired" && wait.followUp) this.safely(() => this.options.followUp(wait as WaitRecord & { followUp: string }));+ if (wait.cardMessageId) this.safely(() => this.options.settleCard(wait, status === "fired" ? "fired" : "expired"));+ }+ } finally {+ this.ticking = false;+ }+ }++ private expiredNotice(wait: WaitRecord): WaitNotice {+ const n = Math.round((wait.expiresAt - wait.createdAt) / 3_600_000);+ return { status: "expired", text: `Stopped waiting for ${wait.label} after ${n} hour${n === 1 ? "" : "s"}.` };+ }++ private runPage(url: string): Promise<PageResult> {+ this.pagesQueued++;+ const run = this.pageTail.then(() => this.probes.page(url));+ this.pageTail = run.then(() => undefined, () => undefined).then(() => { this.pagesQueued--; });+ return run;+ }++ private async probe(condition: WaitCondition, processes: (() => Promise<ProcessEntry[]>) | undefined): Promise<Verdict> {+ switch (condition.kind) {+ case "url_contains":+ case "url_missing": {+ const page = await this.runPage(condition.url);+ if (!page.ok) return { met: false, page };+ const says = pageSays(page.text, condition.text);+ if (condition.kind === "url_contains") return { met: says, page: { ok: true } };+ if (says) condition.sawText = true;+ return { met: condition.sawText && !says, page: { ok: true } };+ }+ case "file_exists": return { met: (await this.probes.stamp(condition.path)) !== null };+ case "file_missing": return { met: (await this.probes.stamp(condition.path)) === null };+ case "file_changed": return { met: fileChanged(condition.before, await this.probes.stamp(condition.path)) };+ case "process_running":+ case "process_gone": {+ try {+ const running = processRunning(await (processes ?? (() => this.probes.processes()))(), condition.process);+ return { met: condition.kind === "process_running" ? running : !running };+ } catch {+ return { met: false, unlisted: true };+ }+ }+ case "bot_idle": {+ const busy = this.options.botBusy(condition.botId);+ if (busy === undefined) return { met: false, gone: true };+ if (busy) { condition.sawBusy = true; return { met: false }; }+ return { met: condition.sawBusy };+ }+ }+ }++ private safely(run: () => void): void {+ try { run(); } catch (error) { console.error("wait: callback failed", error); }+ }++ private commit(mutate: () => void): void {+ const before = this.waits.map(cloneWait);+ const identity = this.waits.slice();+ try {+ mutate();+ this.save();+ } catch (error) {+ identity.forEach((w, i) => {+ for (const key of Object.keys(w)) delete (w as unknown as Record<string, unknown>)[key];+ Object.assign(w, before[i]);+ });+ this.waits = identity;+ throw error;+ }+ }++ private save(): void {+ mkdirSync(dirname(this.file), { recursive: true });+ writeFileAtomic(this.file, JSON.stringify({ version: 1, waits: this.waits }, null, 2), { mode: 0o600 });+ }+}diff --git a/server/workspace-backup.test.ts b/server/workspace-backup.test.tsindex 56b828635a..3a3ba1865c 100644--- a/server/workspace-backup.test.ts+++ b/server/workspace-backup.test.ts@@ -14,7 +14,7 @@ import { afterEach, describe, expect, it } from "vitest";import {applyPendingWorkspaceRestore, commitPendingWorkspaceRestore, createWorkspaceBackup,readLastWorkspaceRestore, readPendingWorkspaceRestoreMetadata, readStagedWorkspaceBackup,- removeWorkspaceBackupJob, stageWorkspaceBackup,+ omittedFromWorkspaceBackup, removeWorkspaceBackupJob, stageWorkspaceBackup,} from "./workspace-backup.ts";const PASSWORD = "correct horse battery staple";@@ -115,6 +115,30 @@ function caseSensitiveTempFolder(): boolean {afterEach(() => { for (const root of scratch.splice(0)) rmSync(root, { recursive: true, force: true }); });describe("encrypted full workspace backups", () => {+ it("leaves waits out of backups and Cloud sends", () => expect(omittedFromWorkspaceBackup("waits.json")).toBe(true));++ it("carries no waits, and a restore ends the waits already here, keeping them in the safety copy", async () => {+ const source = directory();+ writeFileSync(join(source, "waits.json"), JSON.stringify({ version: 1, waits: [{ id: "from-the-backup" }] }));+ writeFileSync(join(source, "notes.md"), "kept");+ const exported = await createWorkspaceBackup(source, { password: PASSWORD });+ expect(exported.summary.exclusions).toContain("Waits bots set up: they end within a week, so ask the bot again after restoring.");+ expect(exported.summary.warnings.some((warning) => warning.startsWith("Restoring pauses routines, webhooks and calendar calls, ends every wait,"))).toBe(true);+ const target = directory();+ const here = JSON.stringify({ version: 1, waits: [{ id: "made-before-the-restore" }] });+ writeFileSync(join(target, "waits.json"), here);+ const staged = await stageWorkspaceBackup(target, exported.path, { password: PASSWORD });+ const manifest = readJson(join(target, ".backups", staged.id, "staged", "manifest.json"));+ expect(manifest.entries.map((entry: { path: string }) => entry.path)).toContain("notes.md");+ expect(manifest.entries.map((entry: { path: string }) => entry.path)).not.toContain("waits.json");+ commitPendingWorkspaceRestore(target, staged.id);+ const result = applyPendingWorkspaceRestore(target);+ expect(result).toMatchObject({ restored: true });+ expect(readFileSync(join(target, "notes.md"), "utf8")).toBe("kept");+ expect(existsSync(join(target, "waits.json"))).toBe(false);+ expect(readFileSync(join(result.safetyCopyPath!, "data", "waits.json"), "utf8")).toBe(here);+ });+it("leaves Sync with My Cloud's own records out of a backup", async () => {const source = directory();mkdirSync(join(source, "sync", "trash"), { recursive: true });diff --git a/server/workspace-backup.ts b/server/workspace-backup.tsindex 3b8350f5fa..c3e4ca81bb 100644--- a/server/workspace-backup.ts+++ b/server/workspace-backup.ts@@ -26,6 +26,7 @@ const MAGIC = Buffer.from("OMB-WORKSPACE-1\n");const HEADER_BYTES = MAGIC.length + 16 + 12;const TAG_BYTES = 16;const ID = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/;+const WAITS_FILE = "waits.json";const EXCLUDED = new Set([".backups", "tools", "browser", "agent-browser-profiles", "cache", ".cache", "tmp", ".tmp", "dist-native", "tunnel-runtime", "evidence",".openmausbot-server-child", "environment-id", "sessions.json", "tunnel-account.json",@@ -42,6 +43,7 @@ const EXCLUDED = new Set([// A Team Cloud's engine homes (engine-homes/layout.ts): CLI login homes, each audience's own transcripts and the held// folder, which no admin reads."engine-homes",+ WAITS_FILE,]);const EXCLUSION_NOTES = ["Device pairing, server identity, live leases and runtime files (existing destination identities are preserved).",@@ -50,8 +52,9 @@ const EXCLUSION_NOTES = ["Installed dependency folders (node_modules) and symbolic links inside conversation work folders; reinstall or recreate them in the project.","External project folders, CLI login homes, browser session homes, OS keychains, companion devices and other servers.","VM/container disk layers and remote cloud data; durable files inside this workspace are included.",+ "Waits bots set up: they end within a week, so ask the bot again after restoring.",];-const RESTORE_WARNING = "Restoring pauses routines, webhooks and calendar calls, and does not resume pending delegations, queued chat messages or queued runs. Definitions and historical receipts are retained; review before enabling them again.";+const RESTORE_WARNING = "Restoring pauses routines, webhooks and calendar calls, ends every wait, and does not resume pending delegations, queued chat messages or queued runs. Definitions and historical receipts are retained; review before enabling them again.";type Entry = { path: string; type: "file" | "directory"; size: number; mode: number; sha256?: string };interface Manifest extends WorkspaceBackupPrivateMetadata {@@ -91,9 +94,9 @@ function forbiddenArchivePath(path: string): boolean {(path !== folded && ["config.json", "webhooks.json"].includes(folded));}function preserved(name: string): boolean {- // An existing WAL/SHM belongs to the old database: it must never accompany a different restored main database.+ // An existing WAL/SHM belongs to the old database, and existing waits to the old chats: neither may accompany restored ones.const folded = name.toLowerCase();- return excluded(folded) && !LIVE_DATABASE_SIDECARS.has(folded);+ return excluded(folded) && !LIVE_DATABASE_SIDECARS.has(folded) && folded !== WAITS_FILE;}const SNAPSHOT_DATABASES: Record<string, string> = { "messages.db": "messages-snapshot.db", "runtime.db": "runtime-snapshot.db" };const LIVE_DATABASE_SIDECARS = new Set(Object.keys(SNAPSHOT_DATABASES).flatMap((name) => [`${name}-wal`, `${name}-shm`]));diff --git a/shared/notification.ts b/shared/notification.tsindex 095b66516a..d8d6917b6c 100644--- a/shared/notification.ts+++ b/shared/notification.ts@@ -26,6 +26,8 @@ export type NotifyKind =/** The main agent's brief has something new that needs the person, or a* meeting prep or reminder it posted with no AI turn. Personal installs only. */| "brief"+ /** A wait a bot set up (wait_until) fired: what it was waiting for happened. */+ | "wait"/** Something OpenMausBot changed on its own that the person hears about* once: a tool turned off for the bots it doesn't start for. */| "notice";diff --git a/shared/routine-run.ts b/shared/routine-run.tsindex 20ae75b56a..61367a6780 100644--- a/shared/routine-run.ts+++ b/shared/routine-run.ts@@ -29,8 +29,8 @@ export interface AutomationLine {routineId: string;runId: string;name: string;- /** What started the run; "app" is a connected-app event. */- trigger: "schedule" | "manual" | "startup" | "webhook" | "app";+ /** What started the run; "app" is a connected-app event, "wait" a wait's follow-up. */+ trigger: "schedule" | "manual" | "startup" | "webhook" | "app" | "wait";executionThreadId: string;scheduledFor: number;/** The run needs the person: it asked them something or cannot go on without them. */diff --git a/shared/routines.ts b/shared/routines.tsindex 69340fedcd..f2e9dbca29 100644--- a/shared/routines.ts+++ b/shared/routines.ts@@ -170,8 +170,8 @@ export interface RoutineRun {status: RoutineRunStatus;manual: boolean;triggerSource?: RoutineRunTrigger;- /** "app": a connected-app event started it; triggerSource is then "webhook" (an outside event). */- eventSource?: "app";+ /** "app": a connected-app event started it; "wait": a wait's follow-up did. triggerSource is then "webhook" (an outside event). */+ eventSource?: "app" | "wait";webhookId?: string;deliveryId?: string;/** Room task created for a team-goal run. */diff --git a/shared/wait-request.ts b/shared/wait-request.tsnew file mode 100644index 0000000000..a8ee36bf5b--- /dev/null+++ b/shared/wait-request.ts@@ -0,0 +1,23 @@+/** The line a wait (wait_until) posted when it ended (`WireMessage.wait`). */+export interface WaitLine {+ id: string;+ status: "fired" | "expired" | "stopped";+}++/** `WireMessage.wait`: set on the line a wait posted when it ended. */+export interface WaitLineField {+ wait?: WaitLine;+}++/** A wait with a follow-up a bot set up from chat (wait_until, `OptionCardData.waitRequest`); its Cancel stops it until it settles. */+export interface WaitCardData {+ waitId: string;+ label: string;+ followUp: string;+ settled?: "fired" | "expired" | "cancelled";+}++/** `OptionCardData.waitRequest`: set on the card a wait with a follow-up showed. */+export interface WaitCardField {+ waitRequest?: WaitCardData;+}diff --git a/shared/waits.ts b/shared/waits.tsnew file mode 100644index 0000000000..058254e0eb--- /dev/null+++ b/shared/waits.ts@@ -0,0 +1,5 @@+/** What a wait (wait_until) can wait for. */+export const WAIT_KINDS = ["url_contains", "url_missing", "file_exists", "file_missing", "file_changed", "process_running", "process_gone", "bot_idle"] as const;+export type WaitKind = (typeof WAIT_KINDS)[number];+/** How long a wait lasts unless it fires first, in hours. */+export const WAIT_HOURS = { default: 24, max: 168 } as const;diff --git a/shared/wire.ts b/shared/wire.tsindex 6931907e4a..40b111e365 100644--- a/shared/wire.ts+++ b/shared/wire.ts@@ -13,7 +13,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 { RoutineRequestCardData } from "./routine-request.ts";-import type { WebhookRequestCardData } from "./webhook-request.ts";+import type { WebhookRequestCardData } from "./webhook-request.ts"; import type { WaitCardField, WaitLineField } from "./wait-request.ts";import type { AppEventAttempt, AppTrigger, AppTriggerRequestCardData, AppTriggerService } from "./app-triggers.ts";import type { ProfileRequestCardData } from "./profile-request.ts";import type { PlaceRow } from "./place-view.ts";@@ -443,7 +443,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 HelperIntroField, SetupCardFields {+export interface WireMessage extends HelperIntroField, SetupCardFields, WaitLineField {roomRequest?: { id: string; phase: "request" | "result" };id: string;role: "bot" | "user";@@ -645,7 +645,7 @@ export function nextOpenThread<T extends OpenThreadCandidate>(tasks: readonly T[return [listed, open, own].map((candidates) => orderedThreadList(candidates)[0]).find((task) => task !== undefined);}-export interface OptionCardData {+export interface OptionCardData extends WaitCardField {/** calls: one per outbound call the card covers, in subtitle order. */outboundRequest?: { tool: string; app: string | null; calls?: Array<{ app: string | null; label: string }> };/** `revision`: the entry as it applied without a person, so Undo can tell it changed since. */diff --git a/src/components/ApprovalCard.test.ts b/src/components/ApprovalCard.test.tsindex 3f75e638be..8b69df3ade 100644--- a/src/components/ApprovalCard.test.ts+++ b/src/components/ApprovalCard.test.ts@@ -789,4 +789,26 @@ describe("one approval, one card", () => {expect(panel).toContain("Send to Slack?");expect(panel).toContain("{"text":"hi"}");});++ it("shows a wait with a follow-up as one line with Cancel, and says how it ended with no Cancel and no Undone after", () => {+ const message = (settled?: "fired" | "expired" | "cancelled"): Message => ({+ id: "m1", at: 1, role: "bot", kind: "options",+ card: {+ title: "Waiting: the build", subtitle: "Then Pepper will: Deploy it.",+ options: [], answered: "allow", dismissed: true, autoApplied: true, requestId: "w1", tool: "wait_until",+ ...(settled === "cancelled" ? { undone: true } : {}),+ waitRequest: { waitId: "w1", label: "the build", followUp: "Deploy it.", ...(settled ? { settled } : {}) },+ },+ });+ const render = (settled?: "fired" | "expired" | "cancelled") =>+ renderToStaticMarkup(createElement(ApprovalCard, { bot: { name: "Pepper" }, message: message(settled), threadId: "t1" })).replace(/'/g, "'");+ const open = render();+ expect(open).toContain("Pepper is waiting for the build");+ expect(open).toContain(">Cancel<");+ for (const [settled, line] of [["fired", "Pepper finished waiting for the build"], ["expired", "Pepper stopped waiting for the build"], ["cancelled", "Pepper's wait for the build was cancelled"]] as const) {+ const ended = render(settled);+ expect(ended, settled).toContain(line);+ expect(ended, settled).not.toMatch(/>Cancel<|is waiting for|Undone/);+ }+ });});diff --git a/src/components/ApprovalCard.tsx b/src/components/ApprovalCard.tsxindex 8e3f049e9e..bc68476e92 100644--- a/src/components/ApprovalCard.tsx+++ b/src/components/ApprovalCard.tsx@@ -44,6 +44,12 @@ const AUTOMATION_APPLIED_LINE = {run_now: "approval.applied.automation.runNow",delete: "approval.applied.automation.delete",} as const;+const WAIT_APPLIED_LINE = {+ waiting: "approval.applied.wait",+ fired: "approval.applied.waitFired",+ expired: "approval.applied.waitExpired",+ cancelled: "approval.applied.waitCancelled",+} as const;const SKILL_APPLIED_LINE = {create: "approval.applied.skill.create",@@ -127,7 +133,7 @@ function plainWhen(schedule: RoutineRequestSchedule): string {return scheduleLabel(schedule);}-export function appliedChange(card: OptionCardData, name: string): { line: string; canUndo: boolean } | undefined {+export function appliedChange(card: OptionCardData, name: string): { line: string; canUndo: boolean; cancels?: boolean } | undefined {const routine = card.routineRequest;if (routine) {const operation = routine.operation;@@ -146,6 +152,8 @@ export function appliedChange(card: OptionCardData, name: string): { line: strin: false;return { line: t(AUTOMATION_APPLIED_LINE[operation.action], { name, title }), canUndo };}+ const wait = card.waitRequest;+ if (wait) return { line: t(WAIT_APPLIED_LINE[wait.settled ?? "waiting"], { name, title: wait.label }), canUndo: !wait.settled, cancels: true };const webhook = card.webhookRequest;if (webhook) {const target = webhook.operation.forBot ? ` · ${t("approval.applied.forBot", { target: `@${webhook.operation.forBot.name}` })}` : "";@@ -198,7 +206,7 @@ function AppliedChangeLine({card: OptionCardData;name: string;threadId?: string;- summary: { line: string; canUndo: boolean };+ summary: { line: string; canUndo: boolean; cancels?: boolean };}) {const [open, setOpen] = useState(false);const [undoing, setUndoing] = useState(false);@@ -208,6 +216,7 @@ function AppliedChangeLine({const [sharedNow, setSharedNow] = useState<{ requestId: string; shared: SkillShareRecord }>();const config = useContext(StoreContext)?.state.config ?? null;const undone = card.undone === true;+ const cancels = summary.cancels === true;const skill = card.skillRequest;const shared = skill?.shared ?? (sharedNow && sharedNow.requestId === card.requestId ? sharedNow.shared : undefined);const canShare = Boolean(skill && !shared && !undone && threadId && card.requestId)@@ -232,9 +241,12 @@ function AppliedChangeLine({setError(undefined);api(`/api/threads/${threadId}/undo`, { method: "POST", body: JSON.stringify({ requestId: card.requestId }) }).catch((failure: unknown) => {+ // A wait that had already ended answers 409, and its card then says how it ended.+ if (cancels && failure instanceof ApiError && failure.status === 409) return;setError(failure instanceof ApiError && failure.body?.code === "changed-since"? t("approval.applied.changedSince")- : t("approval.applied.undoFailed", { error: failure instanceof Error ? failure.message : String(failure) }));+ : cancels ? t("approval.applied.cancelFailed", { name })+ : t("approval.applied.undoFailed", { error: failure instanceof Error ? failure.message : String(failure) }));}).finally(() => setUndoing(false));};@@ -247,7 +259,7 @@ function AppliedChangeLine({{shared && !undone && (<span> · {sharedNames.length ? t("approval.applied.sharedSkill", { names: sharedNames.join(", ") }) : t("approval.applied.sharedSkillNobody")}</span>)}- {undone && <span> · {t("approval.applied.undone")}</span>}+ {undone && !cancels && <span> · {t("approval.applied.undone")}</span>}</span>{!undone && summary.canUndo && threadId && (<button@@ -256,7 +268,7 @@ function AppliedChangeLine({disabled={undoing}className={cn(TEXT_ACTION, "text-accent disabled:opacity-60")}>- {undoing ? t("approval.applied.undoing") : t("approval.applied.undo")}+ {cancels ? t(undoing ? "approval.applied.cancelling" : "common.cancel") : t(undoing ? "approval.applied.undoing" : "approval.applied.undo")}</button>)}{canShare && (diff --git a/src/components/NotificationsPanel.tsx b/src/components/NotificationsPanel.tsxindex dfad9b0517..66c296902d 100644--- a/src/components/NotificationsPanel.tsx+++ b/src/components/NotificationsPanel.tsx@@ -23,6 +23,7 @@ const KIND_LOOK: Record<NotifyKind, { Icon: LucideIcon; className: string; statu"routine-deferred": { Icon: RotateCcw, className: "text-accent", status: "notifications.status.deferred" },spend: { Icon: Wallet, className: "text-accent", status: "notifications.status.spend" },brief: { Icon: Newspaper, className: "text-accent", status: "notifications.status.brief" },+ wait: { Icon: CheckCircle2, className: "text-success", status: "notifications.status.done" },notice: { Icon: Info, className: "text-accent", status: "notifications.status.notice" },};diff --git a/src/components/TriggerCard.test.ts b/src/components/TriggerCard.test.tsindex 0e5910c1e8..2f90fe997a 100644--- a/src/components/TriggerCard.test.ts+++ b/src/components/TriggerCard.test.ts@@ -5,7 +5,7 @@ import { createRoot, type Root } from "react-dom/client";import { renderToStaticMarkup } from "react-dom/server";import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";-import type { Message } from "@/state/store";+import { ApiError, type Message } from "@/state/store";const fixture = vi.hoisted(() => ({state: {} as Record<string, unknown>,@@ -167,3 +167,22 @@ describe("the chat card a bot-made automation leaves", () => {expect(render(webhookCard)).toContain("This automation no longer exists");});});++describe("the chat card a wait with a follow-up leaves", () => {+ const waiting = card({ tool: "wait_until", requestId: "wait-1", waitRequest: { waitId: "wait-1", label: "the build", followUp: "Deploy it." } });+ const cancelShown = () => [...document.querySelectorAll("button")].some((button) => button.textContent?.trim() === "Cancel");++ it("cancels through the undo route, and says what to do next when that fails", async () => {+ fixture.api.mockRejectedValueOnce(new ApiError("disk full", 500));+ click(waiting, "Cancel");+ expect(fixture.api).toHaveBeenCalledWith("/api/threads/thread-1/undo", { method: "POST", body: JSON.stringify({ requestId: "wait-1" }) });+ await vi.waitFor(() => expect(document.querySelector("[role=alert]")?.textContent).toBe("Couldn't cancel the wait. Try again, or ask Scout to stop it."));+ });++ it("shows no error when the wait had already ended: its card says how it ended", async () => {+ fixture.api.mockRejectedValueOnce(new ApiError("This wait has already ended.", 409));+ click(waiting, "Cancel");+ await vi.waitFor(() => expect(cancelShown()).toBe(true));+ expect(document.querySelector("[role=alert]")).toBeNull();+ });+});diff --git a/src/components/touch-actions.test.ts b/src/components/touch-actions.test.tsindex 726c45137e..704949a966 100644--- a/src/components/touch-actions.test.ts+++ b/src/components/touch-actions.test.ts@@ -20,7 +20,7 @@ const notActions: Array<{ file: string; snippet: string; why: string }> = [{ file: "components/AttachmentPreview.tsx", snippet: "group-hover/image:opacity-100", why: "zoom hint; the whole image is the tap target" },{ file: "components/remote-desktop-panel.tsx", snippet: "bg-black/65 py-2", why: "caption; the whole preview is the tap target" },{ file: "components/routines/CalendarSidebar.tsx", snippet: "text-[9px]", why: "'Drag' hint badge, not a control" },- { file: "components/RoutineCalendarPage.tsx", snippet: "cursor-ns-resize", why: "mouse drag-resize handle for call events" },+ { file: "components/routines/CalendarEventCard.tsx", snippet: "cursor-ns-resize", why: "mouse drag-resize handle for call events" },{ file: "components/ComputerPanel.tsx", snippet: "opacity-80", why: "already visible at 80% without hover" },{ file: "components/bot-panel/PanelHero.tsx", snippet: "whitespace-nowrap rounded-md border border-hairline bg-menu", why: "\"Edit avatar\" tooltip; the avatar button itself is the tap target" },{ file: "components/ChatView.tsx", snippet: "-ml-2.5 w-0 shrink-0 text-ink-secondary", why: "decorative chevron in the Simple bot pill; the whole pill is the tap target" },diff --git a/src/locales/en.json b/src/locales/en.jsonindex 2105a409dd..7718318083 100644--- a/src/locales/en.json+++ b/src/locales/en.json@@ -608,6 +608,10 @@"approval.applied.teamAdded": "added {names}","approval.applied.teamUpdated": "updated {names}","approval.applied.botDeleted": "{name} deleted {target}",+ "approval.applied.wait": "{name} is waiting for {title}",+ "approval.applied.waitFired": "{name} finished waiting for {title}",+ "approval.applied.waitExpired": "{name} stopped waiting for {title}",+ "approval.applied.waitCancelled": "{name}'s wait for {title} was cancelled","approval.applied.teamMemory": "{name} saved to department memory: {title}","approval.applied.field.name": "name","approval.applied.field.title": "title",@@ -624,6 +628,8 @@"approval.applied.hideDetails": "Hide details","approval.applied.changedSince": "Changed since, so it can't be undone here.","approval.applied.undoFailed": "Couldn't undo: {error}",+ "approval.applied.cancelling": "Cancelling…",+ "approval.applied.cancelFailed": "Couldn't cancel the wait. Try again, or ask {name} to stop it.","approval.applied.shareSkill": "Share with department","approval.applied.sharingSkill": "Sharing…","approval.applied.sharedSkill": "shared with {names}",diff --git a/src/locales/ko.json b/src/locales/ko.jsonindex a13953e2ed..83ea23aa95 100644--- a/src/locales/ko.json+++ b/src/locales/ko.json@@ -134,7 +134,7 @@"notice.dismiss": "다시 보지 않기","notice.notNow": "나중에","notice.openFailed": "브라우저를 열지 못했어요. 다시 시도하세요.",- "star.title": "OpenMausBot이 마음에 드세요?",+ "star.title": "{app}이 마음에 드세요?","star.body": "GitHub에 별을 눌러 주시면 더 많은 사람이 찾을 수 있어요.","star.button": "GitHub에서 별 주기","productHunt.title": "Product Hunt에 올라왔어요",@@ -345,8 +345,8 @@"rail.orgFailed": "아무것도 추가되지 않았어요. 잠시 후 다시 시도하세요.","rail.own": "내 서버 추가","rail.ownSub": "온라인에서 빌린 서버, 집의 Mac mini, Tailscale 네트워크의 컴퓨터 등.",- "rail.ownLede": "그곳에 OpenMausBot을 설치하면 이 앱에서 클라우드처럼 열 수 있어요. 봇은 그 서버에 머물러요.",- "rail.step1": "서버에 OpenMausBot 설치",+ "rail.ownLede": "그곳에 {app}을 설치하면 이 앱에서 클라우드처럼 열 수 있어요. 봇은 그 서버에 머물러요.",+ "rail.step1": "서버에 {app} 설치","rail.step1Sub": "서버의 터미널에서 실행하세요(Node 24 이상 필요):","rail.step2": "페어링 창 열기","rail.step2Sub": "서버에서 이 명령을 실행하세요. 이 앱용 페어링 링크가 출력돼요:",@@ -771,7 +771,7 @@"cloudAccount.manageInBrowser": "브라우저에서 관리","cloudAccount.onCloud": "MausBot Cloud가 이 컴퓨터의 앱에 대해 확인한 요금제예요.","cloudAccount.onCloudHome": "MausBot Cloud가 확인한 요금제예요.",- "cloudAccount.onCloudNone": "요금제는 이 컴퓨터의 OpenMausBot 앱에서 관리해요.",+ "cloudAccount.onCloudNone": "요금제는 이 컴퓨터의 {app} 앱에서 관리해요.","cloudAccount.teamPeopleTitle": "사람과 요금제","cloudAccount.teamPeopleBody": "요금제 페이지에서 {team}에 사람을 초대하고, 역할을 바꾸고, 요금제를 관리하세요. 여기서 쓰는 이메일로 로그인하세요.","cloudAccount.teamPeopleOpen": "요금제 페이지 열기",@@ -1106,7 +1106,7 @@"cloudWelcome.step.files": "파일과 앱","cloudWelcome.step.filesHint": "선택","cloudWelcome.bring.title": "{name}을(를) 무엇으로 시작할까요?",- "cloudWelcome.bring.sub": "컴퓨터에 있는 봇은 OpenMausBot 앱에서 알아서 이리로 와요.",+ "cloudWelcome.bring.sub": "컴퓨터에 있는 봇은 {app} 앱에서 알아서 이리로 와요.","cloudWelcome.bring.subTeam": "내 봇은 내 컴퓨터에 그대로 있어요. {name}은(는) 팀 모두가 쓸 수 있는 자체 봇으로 시작해요.","cloudWelcome.bring.fresh": "새로 시작","cloudWelcome.bring.freshHint": "라이브러리에서 준비된 팀을 고르거나, 봇 하나로 시작해 직접 팀을 꾸리세요.",@@ -1114,7 +1114,7 @@"cloudWelcome.bring.freshChief": "비서로 시작하세요. 필요한 일이 생기면 전문가를 불러와요.","cloudWelcome.bring.desktopTitle": "내 컴퓨터의 모든 것","cloudWelcome.bring.desktopOnly": "컴퓨터의 봇을 가져오려면 데스크톱 앱을 여세요.",- "cloudWelcome.bring.update": "봇이 알아서 이리로 오게 하려면 OpenMausBot을 업데이트하세요.",+ "cloudWelcome.bring.update": "봇이 알아서 이리로 오게 하려면 {app}을 업데이트하세요.","cloudWelcome.bring.hereTitle": "봇이 이미 여기 있어요","cloudWelcome.bring.hereBody": "{name}에는 이미 자체 봇이나 채팅이 있어요.","cloudWelcome.bring.sending": "이 컴퓨터의 봇, 채팅, 로그인을 가져오는 중…",@@ -1133,7 +1133,7 @@"cloudWelcome.files.sub": "자리를 비운 동안 봇이 일하는 데 필요한 것을 주세요.","cloudWelcome.files.folders": "폴더 공유","cloudWelcome.files.foldersDesktop": "{name}의 봇은 컴퓨터가 꺼져 있어도 내가 공유한 폴더를 읽을 수 있어요. 데스크톱 앱의 파일에서 공유하세요.",- "cloudWelcome.files.foldersLent": "{name}의 봇은 이 컴퓨터가 깨어 있고 OpenMausBot이 열려 있는 동안 이 컴퓨터의 파일을 알아서 써요. 따로 설정할 것은 없어요.",+ "cloudWelcome.files.foldersLent": "{name}의 봇은 이 컴퓨터가 깨어 있고 {app}이 열려 있는 동안 이 컴퓨터의 파일을 알아서 써요. 따로 설정할 것은 없어요.","cloudWelcome.files.apps": "앱 연결","cloudWelcome.files.appsHint": "Gmail, Slack, HighLevel 등. 연결은 클라우드마다 따로이니 여기서 연결하세요.","cloudWelcome.files.appsAction": "앱 연결",@@ -1157,7 +1157,7 @@"organization.working": "브라우저 여는 중…","organization.advanced": "고급","organization.advancedHelp": "조직에서 받은 주소가 있을 때만 사용자 지정 주소를 쓰세요.",- "organization.browserConsent": "브라우저에서 로그인을 마치세요. 끝나면 OpenMausBot이 자동으로 연결돼요.",+ "organization.browserConsent": "브라우저에서 로그인을 마치세요. 끝나면 {app}이 자동으로 연결돼요.","organization.customSignIn": "사용자 지정 관리자에 로그인","organization.securityDetails": "보안 세부 정보","organization.securityDetailsHelp": "이 코드를 브라우저에 표시된 코드와 비교할 수 있어요.",@@ -1357,7 +1357,7 @@"settings.diagnostics.logsAt": "로그는 {folder}에 있어요.","settings.diagnostics.openFailed": "로그 폴더를 열지 못했어요. 위치는 {folder}예요.","settings.diagnostics.logsHelp": "로그는 이 컴퓨터에 남아요. 진단 정보 내보내기는 키, 비밀번호, 로그인 정보를 지운 최근 부분을 저장해 지원팀에 보낼 수 있게 해요.",- "settings.diagnostics.elsewhere": "로그는 OpenMausBot이 실행되는 곳에 남아요. 이 컴퓨터의 로그를 열거나 내보내려면 그 컴퓨터의 데스크톱 앱에서 설정을 쓰세요. 클라우드의 로그는 MausBot Cloud 지원팀이 볼 수 있어요.",+ "settings.diagnostics.elsewhere": "로그는 {app}이 실행되는 곳에 남아요. 이 컴퓨터의 로그를 열거나 내보내려면 그 컴퓨터의 데스크톱 앱에서 설정을 쓰세요. 클라우드의 로그는 MausBot Cloud 지원팀이 볼 수 있어요.","settings.analytics.title": "사용 분석","settings.analytics.subtitle": "익명 제품 이벤트와, 하루 한 번 설정 현황(어떤 제공자에 키가 있는지(키 자체는 절대 아님), 봇, 대화방, 루틴, 컴퓨터의 개수)을 보내요. 대화, 프롬프트, 파일 내용, 이름, 주소는 절대 보내지 않아요. 이메일은 설정할 때 직접 공유했거나, MausBot Cloud에 로그인한 상태에서 Cloud Pro 팝업의 업그레이드, 관리, 요금제 비교를 누른 경우에만(클라우드 계정의 이메일) 함께 보내져요.","settings.analytics.link": "보내는 내용 모두 보기",@@ -1383,7 +1383,7 @@"simpleModePrompt.switchHint": "켜 보면 바로 차이를 볼 수 있어요.","simpleModePrompt.where": "설정 → 일반에서 언제든 바꿀 수 있어요.","settings.openAtLogin.title": "로그인할 때 열기",- "settings.openAtLogin.subtitle": "이 컴퓨터에 로그인하면 OpenMausBot을 열어요. 직접 열지 않아도 봇과 루틴이 준비돼요.",+ "settings.openAtLogin.subtitle": "이 컴퓨터에 로그인하면 {app}을 열어요. 직접 열지 않아도 봇과 루틴이 준비돼요.","settings.openAtLogin.failed": "변경하지 못했어요. 다시 시도하거나 시스템 설정의 로그인 항목을 확인하세요.","settings.updatesConsent.title": "이메일로 제품 소식 받기","settings.updatesConsent.subtitle": "새 기능과 팁을 한 달에 두 번 정도 보내 드려요. 언제든 구독을 해지할 수 있어요.",@@ -1578,7 +1578,7 @@"orgLibrary.fromSelf": "내 조직","orgLibrary.recommended": "{name} 추천","orgLibrary.withdrawn": "{name}이(가) 철회함",- "orgLibrary.newerRelease": "버전 {version} 출시. 다음 OpenMausBot 업데이트에서 자동으로 반영돼요.",+ "orgLibrary.newerRelease": "버전 {version} 출시. 다음 {app} 업데이트에서 자동으로 반영돼요.","orgLibrary.bots": "봇: {count}개","orgLibrary.skills": "스킬: {count}개","orgLibrary.presets": "프리셋 봇: {count}개",@@ -1591,7 +1591,7 @@"orgLibrary.addAria": "{name} 추가","orgLibrary.details": "세부 정보","orgLibrary.detailsAria": "{name} 세부 정보",- "orgLibrary.updateApp": "추가하려면 OpenMausBot을 업데이트하세요",+ "orgLibrary.updateApp": "추가하려면 {app}을 업데이트하세요","orgLibrary.notReady": "다운로드 중…","orgLibrary.noRelease": "아직 릴리스 없음","orgLibrary.addedSkills": "{name}이(가) 추가됐어요. 스킬은 각 봇의 스킬에서 고를 수 있어요.",@@ -1872,7 +1872,7 @@"sidebar.update.availableServer": "버전 {version} 출시 — 릴리스 노트","sidebar.update.how": "업데이트 방법: {command}","sidebar.update.howRestart": "업데이트 방법: {command} 실행 후 앱 다시 시작",- "sidebar.update.howDesktop": "업데이트는 이 봇들이 실행되는 컴퓨터의 OpenMausBot 앱에서 받아요",+ "sidebar.update.howDesktop": "업데이트는 이 봇들이 실행되는 컴퓨터의 {app} 앱에서 받아요","sidebar.update.managed": "자동으로 최신 상태를 유지해요","sidebar.update.availableOther": "{name}을(를) {version}(으)로 업데이트할 수 있어요","sidebar.update.upToDateOther": "{name}은(는) 최신 버전이에요",@@ -1951,7 +1951,7 @@"chat.error.details": "세부 정보","chat.error.requestTooLarge": "이 메시지는 {model}에 비해 너무 커요. 새 채팅을 시작하거나 더 많이 받는 모델을 고르세요.","chat.error.dismiss": "닫기",- "error.plain.unreachable": "OpenMausBot에 연결할 수 없어요. 실행 중인지 확인한 뒤 다시 시도하세요.",+ "error.plain.unreachable": "{app}에 연결할 수 없어요. 실행 중인지 확인한 뒤 다시 시도하세요.","error.plain.rateLimited": "지금 요청이 너무 많아요. 잠시 기다린 뒤 다시 시도하세요.","error.plain.busy": "지금 서비스가 바빠요. 잠시 후 다시 시도하세요.","error.plain.connection": "연결이 끊겼어요. 다시 시도하세요.",@@ -2101,7 +2101,7 @@"chat.verify.saved": "스킬로 저장됨","chat.workingFolder": "작업 폴더: {folder}","task.folder.new": "작업 폴더에서 새 스레드…",- "task.folder.detail": "이 스레드의 폴더는 고정돼요. OpenMausBot이 실행 중인 컴퓨터의 경로를 입력하세요.",+ "task.folder.detail": "이 스레드의 폴더는 고정돼요. {app}이 실행 중인 컴퓨터의 경로를 입력하세요.","task.folder.path": "작업 폴더","task.folder.placeholder": "폴더 절대 경로","task.folder.creating": "만드는 중…",@@ -2354,7 +2354,7 @@"settings.keepWarm.title": "프롬프트 캐시 유지","settings.keepWarm.subtitle": "구독으로 로그인한 Claude 봇용이에요. Karan Bansal의 Cache Tax(MIT)를 바탕으로 설계했어요.","settings.keepWarm.enable": "쉬고 있는 스레드의 프롬프트 캐시 유지",- "settings.keepWarm.help": "맥락이 5만 토큰 이상인 스레드에서 턴이 끝나면, OpenMausBot이 쉬는 동안 50분마다 도구 없는 분기 요청을 하나씩 보내요. 그러면 다음 메시지가 스레드 전체를 다시 쓰지 않고 캐시를 다시 읽어요. 채팅에는 아무것도 나타나지 않아요. 유지 시간이 끝나거나, 핑을 보냈을 때 캐시가 이미 사라졌거나, 지출 한도 또는 사용 한도에 닿으면 멈춰요.",+ "settings.keepWarm.help": "맥락이 5만 토큰 이상인 스레드에서 턴이 끝나면, {app}이 쉬는 동안 50분마다 도구 없는 분기 요청을 하나씩 보내요. 그러면 다음 메시지가 스레드 전체를 다시 쓰지 않고 캐시를 다시 읽어요. 채팅에는 아무것도 나타나지 않아요. 유지 시간이 끝나거나, 핑을 보냈을 때 캐시가 이미 사라졌거나, 지출 한도 또는 사용 한도에 닿으면 멈춰요.","settings.keepWarm.cost": "핑마다 스레드 맥락을 캐시 읽기 요금으로 읽고, 사용량과 지출 한도, 요금제 사용 한도에 포함돼요. API 키 엔진은 캐시가 5분만 유지되므로 핑을 보내지 않아요.","settings.keepWarm.window": "유지 시간","settings.keepWarm.hours": "{hours}시간",@@ -2414,7 +2414,7 @@"attach.folderFilesAria": "{name}의 파일","attach.folderTruncated": "처음 몇 개 파일만 표시돼요","attach.outsideWorkspace": "이 파일은 이 채팅의 작업 폴더 밖에 있어서 여기서 저장할 수 없어요",- "attach.outsideWorkspacePath": "OpenMausBot이 실행 중인 컴퓨터의 이 경로에서 파일을 찾으세요",+ "attach.outsideWorkspacePath": "{app}이 실행 중인 컴퓨터의 이 경로에서 파일을 찾으세요","attach.revealMissing": "그 파일이 더 이상 없어요","attach.revealFailed": "폴더에서 그 파일을 보여 주지 못했어요","task.renameHint": "클릭해서 전환 · 더블클릭이나 오른쪽 클릭으로 이름 바꾸기",@@ -2847,8 +2847,8 @@"onboarding.bot.name": "봇 이름","onboarding.bot.color": "색상","chief.addBotStarter": "나를 도와줄 봇이 하나 더 있으면 좋겠어. 어떤 일을 해야 할지 물어봐 줘.",- "onboarding.hosted.intro": "팀이 함께 쓰는 OpenMausBot이에요. 참여한 사람 모두가 같은 봇, 채팅, 파일을 봐요. AI 모델은 조직에서 제공하니 설치할 것이 없어요.",- "onboarding.shared.title": "팀이 함께 쓰는 OpenMausBot",+ "onboarding.hosted.intro": "팀이 함께 쓰는 {app}이에요. 참여한 사람 모두가 같은 봇, 채팅, 파일을 봐요. AI 모델은 조직에서 제공하니 설치할 것이 없어요.",+ "onboarding.shared.title": "팀이 함께 쓰는 {app}","onboarding.shared.body": "여기 있는 봇, 채팅, 파일은 팀과 공유돼요. 관리자가 AI 모델과 설정을 준비하니 바로 채팅을 시작할 수 있어요.","settings.welcome.title": "환영 둘러보기","settings.welcome.subtitle": "첫 실행 안내예요: 모델 제공자, 권한, 휴대폰, 첫 번째 봇.",@@ -2857,7 +2857,6 @@"engineSetup.copyCommand": "명령 복사","engineSetup.setupTitle": "{name} 설정","engineSetup.terminalSignInCheck": "설치됐어요. 터미널에서 계정 로그인을 마친 뒤 다시 확인을 누르세요.",- "engineSetup.sameMachine": "OpenMausBot이 실행 중인 컴퓨터에서 같은 사용자로 설치하고 로그인하세요. 원격 연결이라면 이 기기가 아니라 OpenMausBot이 실행되는 머신이에요. 그다음 다시 확인을 누르세요. 앱을 다시 시작할 필요는 없어요.","engineSetup.pathHint": "이미 설치했는데도 감지되지 않나요? 설정 → 모델 제공자 및 계정에서 CLI 경로 및 업데이트를 펼치고 CLI 지정으로 실행 파일을 고르세요.","engineSetup.checkFailed": "제공자 상태를 새로고침하지 못했어요. 이전 상태가 그대로 표시돼요. {reason}","engineSetup.checked": "제공자 상태를 새로고침했어요.",@@ -2875,7 +2874,7 @@"engineSetup.commandCopied": "명령 복사됨","engineSetup.openUpdate": "터미널에서 업데이트 열기","engineSetup.installing": "다운로드하고 확인하는 중…",- "engineSetup.downloadNote": "Google에서 {mb}MB를 다운로드해요. OpenMausBot이 쓰기 전에 확인해요.",+ "engineSetup.downloadNote": "Google에서 {mb}MB를 다운로드해요. {app}이 쓰기 전에 확인해요.","engineSetup.startingGoogle": "Google 로그인 시작하는 중…","engineSetup.openGoogleAgain": "Google 로그인 다시 열기","engineSetup.signInGoogle": "Google로 로그인",@@ -2891,7 +2890,7 @@"engineSetup.managedSignIn": "Antigravity 설정마다 자체 Google 계정이 있어요. 브라우저에서 안전한 로그인을 마쳐요.","engineSetup.terminalSignIn": "터미널에서 계정 로그인을 마치세요. 그다음 이 메뉴를 다시 열면 다시 확인할게요.","engineSetup.injectDesc": "에이전트를 한 번만 설치하면 로컬 모델로 실행할 수 있어요. 클라우드 로그인은 필요 없어요.",- "engineSetup.managedDesc": "OpenMausBot은 확인을 거친 자체 Antigravity 런타임을 설치해요. Antigravity 앱이나 agy CLI와는 별개예요. 여기서 설치하고 Google로 로그인하면 이 모델 목록이 내 계정 기준으로 새로고침돼요.",+ "engineSetup.managedDesc": "{app}은 확인을 거친 자체 Antigravity 런타임을 설치해요. Antigravity 앱이나 agy CLI와는 별개예요. 여기서 설치하고 Google로 로그인하면 이 모델 목록이 내 계정 기준으로 새로고침돼요.","engineSetup.installDesc": "명령줄 앱을 한 번만 설치하세요. 준비되면 바로 여기에 모델이 나타나요.","engineSetup.installDescSignIn": "명령줄 앱을 한 번만 설치하세요. 준비되면 바로 여기에 모델이 나타나고, 이어서 로그인이 필요할 수 있어요.","engineSetup.notReady": "{name}이(가) 준비되지 않았어요",@@ -2902,24 +2901,24 @@"engineSetup.apiKey.rejected": "제공자가 저장된 키를 거부했어요.","engineSetup.apiKey.title": "{name}에 API 키가 필요해요","engineSetup.apiKey.description": "설정 → API 키에 키를 붙여 넣으세요. 알아서 저장하고 확인한 뒤 모델이 여기에 나타나요.",- "engineSetup.apiKey.remote": "OpenMausBot이 실행 중인 컴퓨터의 설정 → API 키에서 키를 추가하세요.",+ "engineSetup.apiKey.remote": "{app}이 실행 중인 컴퓨터의 설정 → API 키에서 키를 추가하세요.","engineSetup.apiKey.open": "API 키 열기","engineSetup.apiKey.configuredTitle": "{name}은(는) 내 API 키를 써요","engineSetup.apiKey.configuredDescription": "오타를 고치거나 새 키를 쓰려면 설정 → API 키에서 바꾸거나 지우세요.",- "engineSetup.apiKey.configuredRemote": "키를 바꾸려면 OpenMausBot이 실행 중인 컴퓨터에서 설정 → API 키를 여세요.",+ "engineSetup.apiKey.configuredRemote": "키를 바꾸려면 {app}이 실행 중인 컴퓨터에서 설정 → API 키를 여세요.","engineSetup.apiKey.change": "키 변경","engineSetup.serverInstall": "여기에 {name} 설치","engineSetup.serverUpdate": "여기서 {name} 업데이트","engineSetup.serverInstalling": "설치하는 중이에요. 1분 정도 걸릴 수 있어요.","engineSetup.serverInstalled": "설치됐어요. 모델 제공자를 확인하는 중이에요.",- "engineSetup.usingAppCopy": "이 컴퓨터에 있는 다른 {name} 사본이 시작되지 않아서, 이제 {name}은(는) OpenMausBot이 설치한 사본을 써요.",+ "engineSetup.usingAppCopy": "이 컴퓨터에 있는 다른 {name} 사본이 시작되지 않아서, 이제 {name}은(는) {app}이 설치한 사본을 써요.","engineSetup.usingAppCopyDismiss": "닫기","engineSetup.appCopy.title": "{name} 설치됨","engineSetup.appCopy.description": "{name}은(는) 무료 모델로 작동하니 다시 확인을 눌러 불러오세요. 대신 내 계정을 쓰려면 설정 → API 키에서 {name} API 키를 추가하세요.",- "engineSetup.appCopy.remote": "{name}은(는) 무료 모델로 작동하니 다시 확인을 눌러 불러오세요. 대신 내 계정을 쓰려면 OpenMausBot이 실행 중인 컴퓨터의 설정 → API 키에서 {name} API 키를 추가하세요.",- "engineSetup.standaloneDownloadNote": "약 {mb}MB를 다운로드해요. OpenMausBot이 설치하기 전에 확인해요.",- "engineSetup.serverInstallDesc": "OpenMausBot이 실행되는 머신에 자체 사용자와 자체 폴더로 명령줄 앱을 설치해요. 터미널은 필요 없고, 이어서 로그인이 필요할 수 있어요.",- "engineSetup.serverUpdateDesc": "OpenMausBot이 실행되는 머신의 명령줄 앱을 업데이트해요. 터미널은 필요 없어요.",+ "engineSetup.appCopy.remote": "{name}은(는) 무료 모델로 작동하니 다시 확인을 눌러 불러오세요. 대신 내 계정을 쓰려면 {app}이 실행 중인 컴퓨터의 설정 → API 키에서 {name} API 키를 추가하세요.",+ "engineSetup.standaloneDownloadNote": "약 {mb}MB를 다운로드해요. {app}이 설치하기 전에 확인해요.",+ "engineSetup.serverInstallDesc": "{app}이 실행되는 머신에 자체 사용자와 자체 폴더로 명령줄 앱을 설치해요. 터미널은 필요 없고, 이어서 로그인이 필요할 수 있어요.",+ "engineSetup.serverUpdateDesc": "{app}이 실행되는 머신의 명령줄 앱을 업데이트해요. 터미널은 필요 없어요.","engineSetup.preferTerminal": "터미널이 더 편한가요?","engineSetup.details": "세부 정보","engineSetup.needsNode": "Node.js와 {npm}이(가) 필요해요.",@@ -2950,7 +2949,7 @@"settings.experimental.browserWindows": "이 Windows 머신에서는 아직 쓸 수 없어요: `openmausbot browser install`로 브라우저를 설치하세요.","settings.experimental.browserAria": "내장 브라우저 켜기","settings.experimental.newBrowser": "새 브라우저",- "settings.experimental.newBrowserDetail": "기본값은 꺼짐이에요. 봇의 브라우저가 agent-browser 대신 OpenMausBot 자체 Chrome 드라이버로 실행돼요. 페이지가 내 화면 해상도로 선명하게 표시되고, 봇이 업로드, 다운로드, 대화상자, 팝업을 처리할 수 있어요. 내 Chrome을 쓰는 프로필에는 영향이 없어요. 전환하면 열린 브라우저가 닫히고, 한쪽에 저장된 로그인은 다른 쪽으로 넘어가지 않아요.",+ "settings.experimental.newBrowserDetail": "기본값은 꺼짐이에요. 봇의 브라우저가 agent-browser 대신 {app} 자체 Chrome 드라이버로 실행돼요. 페이지가 내 화면 해상도로 선명하게 표시되고, 봇이 업로드, 다운로드, 대화상자, 팝업을 처리할 수 있어요. 내 Chrome을 쓰는 프로필에는 영향이 없어요. 전환하면 열린 브라우저가 닫히고, 한쪽에 저장된 로그인은 다른 쪽으로 넘어가지 않아요.","settings.experimental.newBrowserAria": "새 브라우저 사용","browser.notInstalled": "아직 여기에 브라우저가 설치되지 않았어요. 앱 설정 → 기기와 봇의 접근 설정에서 브라우저 스위치를 켠 뒤 봇의 화면 → 브라우저를 열어 설치하세요. 또는 앱이 실행되는 곳에서 `openmausbot browser install`을 실행하세요.","browser.panel.profileTitle": "브라우저 프로필: {name}",@@ -3004,7 +3003,7 @@"browser.passkey.otherWayGoogle": "그래도 여기서 로그인하려면 이 페이지에서 다른 방법 시도를 고른 뒤 비밀번호와 인증 앱 코드, 문자 메시지 코드, 백업 코드 중 하나를 쓰세요.","browser.passkey.otherWayMicrosoft": "그래도 여기서 로그인하려면 이 페이지에서 다른 로그인 방법을 고른 뒤 비밀번호와 인증 앱 코드, 문자 메시지 코드, 백업 코드 중 하나를 쓰세요.","browser.passkey.lentPc": "PC {computer}이(가) 클라우드와 공유되어 있어요: 패스키가 작동하는 그 PC의 브라우저로 로그인해 달라고 {name}에게 요청하세요. 승인은 그 PC에서 해요.",- "browser.passkey.lendPc": "또는 PC에서 OpenMausBot을 여세요: PC가 앱과 화면을 알아서 클라우드와 공유하므로, {name}이(가) 패스키가 작동하는 그 PC의 브라우저를 쓸 수 있어요.",+ "browser.passkey.lendPc": "또는 PC에서 {app}을 여세요: PC가 앱과 화면을 알아서 클라우드와 공유하므로, {name}이(가) 패스키가 작동하는 그 PC의 브라우저를 쓸 수 있어요.","browser.passkey.learnMore": "자세히 알아보기","browser.passkey.dismiss": "닫기","browser.control.yours": "지금 브라우저를 쓰고 있어요",@@ -3017,7 +3016,7 @@"browser.typeSecret": "비밀번호나 코드 입력…","browser.typeSecret.title": "선택한 입력란에 비밀번호나 코드 입력","browser.typeSecret.field": "페이지에 넣을 비밀번호나 코드",- "browser.typeSecret.note": "페이지로만 전달돼요. OpenMausBot은 저장하거나, 기록하거나, 보여 주지 않아요.",+ "browser.typeSecret.note": "페이지로만 전달돼요. {app}은 저장하거나, 기록하거나, 보여 주지 않아요.","signIn.title": "로그인 필요","signIn.cardLabel": "{name}이(가) {site}에 로그인해 달라고 요청해요","signIn.banner": "{site}에 로그인해 달라고 요청해요",@@ -3028,10 +3027,10 @@"signIn.where.vm": "{name}이(가) 일하는 비공개 데스크톱에서 로그인하세요. 열기를 누르면 제어권 가져오기와 함께 표시돼요.","signIn.where.cloud": "{name}이(가) 일하는 클라우드 데스크톱에서 로그인하세요. 열기를 누르면 제어권 가져오기와 함께 표시돼요.","signIn.where.local": "이 컴퓨터에서 {name}이(가) 쓰는 브라우저로 로그인하세요.",- "signIn.where.host": "OpenMausBot이 실행되는 컴퓨터에서 {name}이(가) 쓰는 브라우저로 로그인하세요.",+ "signIn.where.host": "{app}이 실행되는 컴퓨터에서 {name}이(가) 쓰는 브라우저로 로그인하세요.","signIn.local.explain": "이 컴퓨터에서 {name}이(가) 쓰는 브라우저 창으로 가서 로그인하세요. 브라우저 탭이 아니에요: 브라우저 탭은 자체 로그인을 따로 보관하고, {name}은(는) 여기서 그것을 쓰지 않아요. 그다음 완료를 누르세요.",- "signIn.local.explainHost": "OpenMausBot이 실행되는 컴퓨터에서 {name}이(가) 쓰는 브라우저 창으로 로그인하세요. 브라우저 탭은 자체 로그인을 따로 보관하고, {name}은(는) 여기서 그것을 쓰지 않아요. 그다음 완료를 누르세요.",- "signIn.private": "비밀번호는 내가 직접 페이지에 입력해요. OpenMausBot은 절대 보지 못해요.",+ "signIn.local.explainHost": "{app}이 실행되는 컴퓨터에서 {name}이(가) 쓰는 브라우저 창으로 로그인하세요. 브라우저 탭은 자체 로그인을 따로 보관하고, {name}은(는) 여기서 그것을 쓰지 않아요. 그다음 완료를 누르세요.",+ "signIn.private": "비밀번호는 내가 직접 페이지에 입력해요. {app}은 절대 보지 못해요.","signIn.superseded": "새 요청으로 대체됨","signIn.answeredInChat": "채팅에서 답했어요","signIn.retry": "다시 시도",@@ -3086,9 +3085,9 @@"settings.profiles.myChrome": "내 Chrome","settings.profiles.myChromeHint": "이 프로필의 봇은 내 실제 Chrome 안에서 내 계정으로 로그인된 상태로, 내 쿠키와 열린 탭을 그대로 쓰며 작업해요. Google 로그인처럼 내장 브라우저를 거부하는 사이트에 쓰세요. 연결하려면 Chrome에서 chrome://inspect/#remote-debugging을 열고 원격 디버깅을 켜세요. Chrome이 연결을 허용할지 물어봐요. 사이트 로그인과 로그아웃은 Chrome에서 직접 하세요.","settings.profiles.myChromeUnavailable": "내 Chrome은 봇이 내 컴퓨터에서 실행되는 데스크톱 앱용이에요. 클라우드처럼 다른 곳에는 쓸 수 있는 내 Chrome이 없으니 모든 프로필이 내장 브라우저를 써요.",- "settings.profiles.myChromeLent": "내 클라우드에서는 내 {device}인 {name}의 Chrome이에요. 그 {device}가 깨어 있고 OpenMausBot이 열려 있을 때, 내가 직접 시작한 대화에서 작동해요.",+ "settings.profiles.myChromeLent": "내 클라우드에서는 내 {device}인 {name}의 Chrome이에요. 그 {device}가 깨어 있고 {app}이 열려 있을 때, 내가 직접 시작한 대화에서 작동해요.","settings.profiles.myChromeLentOffline": "{name}은(는) 지금 오프라인이에요.",- "settings.profiles.myChromeLend": "내 클라우드에서 내 Chrome을 쓰려면 Mac이나 PC에서 OpenMausBot을 여세요: 깨어 있는 동안 알아서 Chrome을 빌려줘요. 그 전까지 내 Chrome 프로필의 봇은 웹을 탐색할 수 없어요. 프로필을 내장으로 바꿔도 돼요.",+ "settings.profiles.myChromeLend": "내 클라우드에서 내 Chrome을 쓰려면 Mac이나 PC에서 {app}을 여세요: 깨어 있는 동안 알아서 Chrome을 빌려줘요. 그 전까지 내 Chrome 프로필의 봇은 웹을 탐색할 수 없어요. 프로필을 내장으로 바꿔도 돼요.","settings.sites.title": "로그인된 사이트","logins.site": "로그인 페이지 주소","logins.sitePlaceholder": "accounts.example.com",@@ -3100,11 +3099,11 @@"logins.totp": "2단계 인증 설정 키(선택)","logins.totpKeep": "새 2단계 인증 설정 키(비워 두면 저장된 키 유지)","logins.totpHint": "인증 앱을 설정할 때 사이트가 보여 주는 키나 otpauth:// 주소예요. 이 키가 있으면 일회용 코드도 자동으로 입력돼요.",- "logins.private": "OpenMausBot이 실행되는 컴퓨터에 암호화되어 저장되고 다시는 표시되지 않아요. 봇은 절대 보지 못하고, OpenMausBot이 대신 로그인 페이지에 입력해요.",+ "logins.private": "{app}이 실행되는 컴퓨터에 암호화되어 저장되고 다시는 표시되지 않아요. 봇은 절대 보지 못하고, {app}이 대신 로그인 페이지에 입력해요.","logins.cancel": "취소","logins.saveError": "로그인 정보를 저장하지 못했어요.","settings.logins.title": "로그인",- "settings.logins.subtitle": "봇이 로그인할 때 쓸 수 있는 웹사이트 로그인 정보예요. 봇은 비밀번호를 절대 보지 못해요. OpenMausBot이 대신 로그인 페이지에 입력하며, 그 로그인 정보의 사이트에서만 입력해요.",+ "settings.logins.subtitle": "봇이 로그인할 때 쓸 수 있는 웹사이트 로그인 정보예요. 봇은 비밀번호를 절대 보지 못해요. {app}이 대신 로그인 페이지에 입력하며, 그 로그인 정보의 사이트에서만 입력해요.","settings.logins.adminOnly": "이 설치의 관리자만 저장된 로그인 정보를 보고 바꿀 수 있어요.","settings.logins.loading": "저장된 로그인 정보 불러오는 중…","settings.logins.loadError": "저장된 로그인 정보를 불러오지 못했어요.",@@ -3136,7 +3135,7 @@"settings.logins.removeTotp": "저장된 2단계 인증 키 제거","settings.logins.limits": "봇에게는 비밀번호가 텍스트가 아니라 페이지 입력으로만 전달되고, 봇이 다시 읽는 내용에서도 가려져요. 다만 페이지 스크린샷에는 사이트가 표시하는 내용이 보일 수 있으니, 봇을 믿고 맡길 수 있는 사이트의 로그인 정보만 저장하세요.","settings.logins.onePassword.title": "1Password",- "settings.logins.onePassword.guide": "봇이 1Password의 로그인 정보로 로그인하게 하세요. 1Password에서 “Shared with OpenMausBot”처럼 보관함 하나만 읽을 수 있는 서비스 계정을 만든 뒤, 그 토큰을 여기에 붙여 넣으세요.",+ "settings.logins.onePassword.guide": "봇이 1Password의 로그인 정보로 로그인하게 하세요. 1Password에서 “Shared with {app}”처럼 보관함 하나만 읽을 수 있는 서비스 계정을 만든 뒤, 그 토큰을 여기에 붙여 넣으세요.","settings.logins.onePassword.token": "서비스 계정 토큰","settings.logins.onePassword.connect": "1Password 연결","settings.logins.onePassword.connected": "{vaults}에 연결됨 · 웹사이트가 있는 로그인 {count}개",@@ -3146,8 +3145,8 @@"settings.logins.onePassword.vaultUse": "로그인 {count}개 · {who}","settings.logins.onePassword.changeVault": "{vault} 사용 대상 변경","settings.logins.onePassword.error": "1Password에 연결할 수 없어요.",- "settings.logins.onePassword.note": "토큰은 OpenMausBot이 실행되는 컴퓨터에 암호화되어 저장되고 다시는 표시되지 않아요. 1Password 로그인 정보는 위 목록에 표시되고 같은 방식으로 입력되며, 변경은 1Password에서 해요. 보관함은 봇을 따로 지정하지 않으면 모든 봇이 써요.",- "settings.logins.cloudOwn": "클라우드 자체의 로그인 정보예요. 컴퓨터의 OpenMausBot 앱이 봇을 이리로 옮기면 그 컴퓨터의 로그인 정보도 알아서 이리로 와요.",+ "settings.logins.onePassword.note": "토큰은 {app}이 실행되는 컴퓨터에 암호화되어 저장되고 다시는 표시되지 않아요. 1Password 로그인 정보는 위 목록에 표시되고 같은 방식으로 입력되며, 변경은 1Password에서 해요. 보관함은 봇을 따로 지정하지 않으면 모든 봇이 써요.",+ "settings.logins.cloudOwn": "클라우드 자체의 로그인 정보예요. 컴퓨터의 {app} 앱이 봇을 이리로 옮기면 그 컴퓨터의 로그인 정보도 알아서 이리로 와요.","settings.sites.loading": "확인 중…","settings.sites.none": "로그인된 사이트가 없어요.","settings.sites.shared": "{names}이(가) 이 브라우저를 함께 써요: 여기서 로그아웃하면 모두 로그아웃돼요.",@@ -3287,7 +3286,7 @@"decider.workersAi.error.rateLimited": "지금 Cloudflare가 요청을 제한하고 있어요. 1분 뒤 다시 시도하세요.","decider.workersAi.error.overloaded": "지금 Cloudflare가 바빠요. 잠시 후 다시 시도하세요.","decider.workersAi.error.http": "Cloudflare가 예상치 못한 오류를 보냈어요(HTTP {status}).",- "decider.workersAi.error.malformed": "Cloudflare가 OpenMausBot이 읽을 수 없는 응답을 보냈어요.",+ "decider.workersAi.error.malformed": "Cloudflare가 {app}이 읽을 수 없는 응답을 보냈어요.","decider.test.extractionOk": "추출도 작동해요.","decider.test.extractionFailed": "추출이 응답하지 않았어요.","decider.master": "빠른 판단과 추출 사용",@@ -3307,7 +3306,7 @@"decider.error.rateLimited": "지금 Jev가 요청을 제한하고 있어요. 1분 뒤 다시 시도하세요.","decider.error.overloaded": "지금 Jev에 요청이 몰려 있어요. 잠시 후 다시 시도하세요.","decider.error.http": "Jev가 예상치 못한 오류를 보냈어요(HTTP {status}).",- "decider.error.malformed": "Jev가 OpenMausBot이 읽을 수 없는 응답을 보냈어요.",+ "decider.error.malformed": "Jev가 {app}이 읽을 수 없는 응답을 보냈어요.","decider.error.noKey": "먼저 키를 붙여 넣거나 저장하세요.","decider.error.misconfigured": "판단 모델 주소가 허용되지 않아요. https를 써야 해요.","decider.error.other": "테스트가 끝나지 않았어요. 다시 시도하세요.",@@ -3345,11 +3344,11 @@"decider.openrouter.error.rateLimited": "지금 OpenRouter가 요청을 제한하고 있어요. 잠시 후 다시 시도하세요.","decider.openrouter.error.overloaded": "지금 모델에 요청이 몰려 있어요. 잠시 후 다시 시도하세요.","decider.openrouter.error.http": "OpenRouter가 예상치 못한 오류를 보냈어요(HTTP {status}).",- "decider.openrouter.error.malformed": "모델이 OpenMausBot이 읽을 수 없는 응답을 보냈어요. 다른 모델을 써 보세요.",+ "decider.openrouter.error.malformed": "모델이 {app}이 읽을 수 없는 응답을 보냈어요. 다른 모델을 써 보세요.","decider.openrouter.error.credits": "OpenRouter 계정의 크레딧이 떨어졌어요. openrouter.ai/credits에서 충전하세요.","decider.test.slow": "대화방 판단에 허용되는 1.5초보다 느려서, 대화방이 리더에게 넘어가게 돼요. 더 빠른 모델을 써 보세요.","keys.vps.label": "직접 호스팅하는 VPS",- "keys.vps.descBefore": "Linux VPS의 SSH 설정 별칭이에요. OpenMausBot은 평소 쓰는 SSH 설정과 에이전트를 쓰며, 키나 비밀번호를 저장하지 않아요. 필요한 SSH 별칭 형식은 ",+ "keys.vps.descBefore": "Linux VPS의 SSH 설정 별칭이에요. {app}은 평소 쓰는 SSH 설정과 에이전트를 쓰며, 키나 비밀번호를 저장하지 않아요. 필요한 SSH 별칭 형식은 ","keys.vps.descLink": "설정 안내","keys.vps.descAfter": "를 참고하세요.","keys.vps.aria": "직접 호스팅하는 VPS의 SSH 설정 별칭",@@ -3792,7 +3791,7 @@"engines.resetting": "초기화 중…","engines.setCli": "CLI 지정…","engines.claudeUpdated": "Claude 업데이트됨 — {version}",- "engines.account.signInHint": "OpenMausBot이 실행 중인 컴퓨터의 터미널에서 이 명령을 그대로 실행하고 Claude CLI 로그인을 마친 뒤 계정 확인을 누르세요. OpenMausBot을 원격으로 보고 있다면 이 기기가 아니라 그 컴퓨터에서 실행하세요.",+ "engines.account.signInHint": "{app}이 실행 중인 컴퓨터의 터미널에서 이 명령을 그대로 실행하고 Claude CLI 로그인을 마친 뒤 계정 확인을 누르세요. {app}을 원격으로 보고 있다면 이 기기가 아니라 그 컴퓨터에서 실행하세요.","engines.account.powershell": "이 명령은 PowerShell에서 실행하세요.","accounts.claude": "Claude","accounts.chatgpt": "ChatGPT",@@ -3810,9 +3809,9 @@"accounts.signOutTitle": "{name}에서 로그아웃할까요?","accounts.signOutBody": "이 계정을 쓰는 봇은 다음 작업 전에 다시 로그인해야 해요. 실행 중인 작업은 취소되지 않아요.","accounts.removeTitle": "{name}을(를) 제거할까요?",- "accounts.removeBodyClaude": "OpenMausBot에서 이 계정을 제거해요. Claude 자체 로그인 파일은 이 컴퓨터에 남아요.",- "accounts.removeBodyChatgpt": "이 계정을 로그아웃하고 OpenMausBot에서 제거해요.",- "accounts.removeBodyAntigravity": "이 계정과 로그인 정보를 OpenMausBot에서 제거해요. 다른 Antigravity 계정은 연결된 채로 남아요.",+ "accounts.removeBodyClaude": "{app}에서 이 계정을 제거해요. Claude 자체 로그인 파일은 이 컴퓨터에 남아요.",+ "accounts.removeBodyChatgpt": "이 계정을 로그아웃하고 {app}에서 제거해요.",+ "accounts.removeBodyAntigravity": "이 계정과 로그인 정보를 {app}에서 제거해요. 다른 Antigravity 계정은 연결된 채로 남아요.","accounts.addClaude": "다른 Claude 계정 추가","accounts.addChatgpt": "다른 ChatGPT 계정 추가","accounts.nameLabel": "계정 이름",@@ -3829,7 +3828,7 @@"engines.none": "아직 감지된 모델 제공자 앱이 없어요.","engines.footer": "CLI 지정은 모델 제공자가 특정 실행 파일(버전 지정 빌드, 래퍼 스크립트, 절대 경로)을 쓰게 해요. 변경 사항은 선택한 제공자가 쉬고 있을 때만 저장돼요. 다른 제공자는 계속 실행돼요.","engines.freeSpace.title": "남은 파일",- "engines.freeSpace.intro": "Windows에서 Antigravity가 멈출 때 큰 임시 파일을 남길 수 있어요. OpenMausBot은 자기 파일을 정리하고, 이 기능은 Windows 임시 폴더에 남은 파일도 찾아요. 확인하기 전에는 아무것도 삭제하지 않아요.",+ "engines.freeSpace.intro": "Windows에서 Antigravity가 멈출 때 큰 임시 파일을 남길 수 있어요. {app}은 자기 파일을 정리하고, 이 기능은 Windows 임시 폴더에 남은 파일도 찾아요. 확인하기 전에는 아무것도 삭제하지 않아요.","engines.freeSpace.action": "공간 확보","engines.freeSpace.scanning": "남은 파일 찾는 중…","engines.freeSpace.none": "남은 파일이 없어요.",@@ -3922,7 +3921,7 @@"remote.localOnly": "안전한 원격 접근이나 Tailscale이 없으면 이 컴퓨터는 호환되는 로컬 네트워크에서만 접속할 수 있어요.","remote.client.active": "원격 연결","remote.client.idle": "다른 컴퓨터에 연결",- "remote.client.subtitle": "이 데스크톱 앱을 다른 컴퓨터에서 실행 중인 OpenMausBot의 안전한 클라이언트로 써요.",+ "remote.client.subtitle": "이 데스크톱 앱을 다른 컴퓨터에서 실행 중인 {app}의 안전한 클라이언트로 써요.","phone.intro.title": "다른 기기에서 {app} 쓰기","phone.intro.detail": "휴대폰이나 다른 컴퓨터에서 채팅을 확인하고, 승인에 답하고, 새 작업을 보내세요.","phone.value.chats": "내 대화",@@ -3991,7 +3990,7 @@"phone.error.reference": "{message} 참조: {reference}.","remote.client.desktopOnly": "원격 데스크톱 페어링에는 설치된 앱이 필요해요.","remote.client.connected": "{name}에 연결됨",- "remote.client.fallbackName": "원격 OpenMausBot",+ "remote.client.fallbackName": "원격 {app}","remote.client.mode": "이 앱은 클라이언트 모드예요. 봇과 대화는 다른 컴퓨터에서 실행되고, 페어링된 기기 토큰은 이 컴퓨터의 암호화된 자격 증명 저장소에 남아요.","remote.client.disconnect": "연결 해제하고 이 컴퓨터 사용","remote.client.hostHint": "호스트 컴퓨터에서 설정 → 원격 접근을 열고 HTTPS, Tailscale, Wi-Fi 중 하나로 페어링 창을 여세요. 그다음 그 주소와 6자리 코드를 여기에 입력하세요.",@@ -4008,15 +4007,15 @@"remote.client.server.invalidLink": "https://bots.example.com/pair#code=XXXX-XXXX-XXXX처럼 전체 HTTPS 서버 페어링 링크를 붙여 넣으세요. 코드는 URL 쿼리가 아니라 # 뒤에 와야 해요.","remote.client.server.switchNote": "주소를 확인한 뒤 서버 페이지에서 페어링을 마치세요. 나중에 서버 메뉴에서 이 컴퓨터로 돌아올 수 있어요.","remote.client.companion.option": "데스크톱 컴패니언",- "remote.client.companion.hint": "다른 데스크톱 앱에서 설정 → 원격 접근을 열고 6자리 컴패니언 코드를 만드세요. 관리형 OpenMausBot HTTPS 주소나 .ts.net으로 끝나는 전체 Tailscale 이름을 쓰세요. 직접 호스팅하는 서버나 사용자 지정 도메인이라면 이 컴퓨터에 설치된 앱에서 직접 호스팅하는 서버를 고르세요.",+ "remote.client.companion.hint": "다른 데스크톱 앱에서 설정 → 원격 접근을 열고 6자리 컴패니언 코드를 만드세요. 관리형 {app} HTTPS 주소나 .ts.net으로 끝나는 전체 Tailscale 이름을 쓰세요. 직접 호스팅하는 서버나 사용자 지정 도메인이라면 이 컴퓨터에 설치된 앱에서 직접 호스팅하는 서버를 고르세요.","remote.client.companion.address": "컴패니언 주소","remote.client.companion.code": "6자리 컴패니언 코드","vm.state.notManaged": "관리되지 않음","vm.workspace.localVm": "로컬 VM",- "vm.workspace.desktopRequired": "두 데스크톱 보기는 OpenMausBot 데스크톱 앱이 필요해요.",+ "vm.workspace.desktopRequired": "두 데스크톱 보기는 {app} 데스크톱 앱이 필요해요.","vm.workspace.layoutUnavailable": "아직 뷰어 영역이 배치되지 않았어요. 창 크기를 바꾼 뒤 다시 시도하세요.",- "vm.workspace.connectFailed": "OpenMausBot이 이 로컬 VM 뷰어를 연결하지 못했어요.",- "vm.workspace.positionFailed": "OpenMausBot이 이 로컬 VM 뷰어의 위치를 잡지 못했어요.",+ "vm.workspace.connectFailed": "{app}이 이 로컬 VM 뷰어를 연결하지 못했어요.",+ "vm.workspace.positionFailed": "{app}이 이 로컬 VM 뷰어의 위치를 잡지 못했어요.","vm.workspace.chooseBot": "로컬 VM 봇 선택","vm.workspace.youHaveControl": "내가 제어 중","vm.workspace.controlElsewhere": "다른 곳에서 제어 중",@@ -4060,11 +4059,9 @@"vm.confirm.orphanVps": "남겨진 VPS 컴퓨터 ID {id}","vm.confirm.ownedVps": "{name}의 VPS 컴퓨터","vm.vps.title": "직접 호스팅하는 VPS 컴퓨터",- "vm.vps.subtitle": "내 VPS에서 OpenMaus가 관리하는 영구 Docker 데스크톱이에요. 제거하면 파일과 브라우저 로그인이 영구 삭제돼요.","vm.vps.sshHost": "SSH 호스트: {alias}. 오래되거나 남겨진 컴퓨터도 여기에 계속 표시돼요.","vm.vps.configuredFallback": "설정된 VPS","vm.vps.needsAlias": "직접 호스팅하는 컴퓨터를 쓰려면 설정 → API 키에서 VPS SSH 별칭을 추가하세요.",- "vm.vps.refreshHint": "새로고침해서 VPS에서 OpenMaus가 관리하는 컴퓨터를 확인하세요.","vm.vps.refreshAria": "VPS 컴퓨터 새로고침","vm.vps.checking": "VPS 컴퓨터 확인 중.","vm.vps.unavailable": "VPS 컴퓨터 목록을 쓸 수 없어요: {reason}",@@ -4106,7 +4103,7 @@"vm.perBot.checkingList": "기존 데스크톱 확인 중…","vm.perBot.none": "만들어진 봇별 데스크톱이 없어요.","vm.perBot.destination": "현재 작업 위치: {destination}",- "vm.perBot.unmanaged": "이 컨테이너는 OpenMausBot이 관리하지 않아요. Docker나 Podman에서 직접 확인하고 제거하세요.",+ "vm.perBot.unmanaged": "이 컨테이너는 {app}이 관리하지 않아요. Docker나 Podman에서 직접 확인하고 제거하세요.","vm.perBot.stopFirst": "데스크톱을 삭제하기 전에 이 봇의 턴을 멈추세요.","vm.perBot.deleteBlocked": "로컬 VM을 삭제하기 전에 이 봇의 턴을 멈추세요","vm.perBot.deleteTitle": "{name}의 로컬 VM 삭제",@@ -4137,10 +4134,10 @@"vm.saving": "저장 중…","vm.policyError": "로컬 VM 격리 정책을 저장하지 못했어요","vm.deleteError": "이 로컬 VM을 삭제하지 못했어요",- "vm.unmanagedError": "이 컨테이너는 OpenMausBot이 관리하지 않아서 여기서 제거할 수 없어요.",+ "vm.unmanagedError": "이 컨테이너는 {app}이 관리하지 않아서 여기서 제거할 수 없어요.","vm.vpsRemoveError": "이 VPS 컴퓨터를 제거하지 못했어요","vm.setup.title": "설정",- "vm.setup.subtitle": "컨테이너 런타임이 열려 있으면 OpenMausBot이 Cua와 VM을 대신 준비해요.",+ "vm.setup.subtitle": "컨테이너 런타임이 열려 있으면 {app}이 Cua와 VM을 대신 준비해요.","vm.setup.step1": "컨테이너 런타임 설치","vm.setup.step1Detail": "Podman과 Colima는 무료예요. Docker Desktop은 규모가 큰 회사나 공공기관에서 쓰려면 유료 라이선스가 필요할 수 있어요.","vm.setup.podmanGuide": "Podman 설치 안내 열기",@@ -4153,7 +4150,7 @@"vm.setup.step4PerBot": "각 봇의 화면 패널에서 비공개 데스크톱 만들기","vm.setup.step4Recreate": "오래되었거나 안전하지 않은 VM 교체","vm.setup.step4": "로컬 VM 만들고 시작하기",- "vm.setup.applePort": "Apple container는 호스트 포트를 직접 지정해야 해서, OpenMausBot은 포트를 추측하거나 노출하지 않아요. 봇별로 안전한 동적 루프백 포트를 쓰려면 Docker나 Podman을 설치하거나 시작하세요.",+ "vm.setup.applePort": "Apple container는 호스트 포트를 직접 지정해야 해서, {app}은 포트를 추측하거나 노출하지 않아요. 봇별로 안전한 동적 루프백 포트를 쓰려면 Docker나 Podman을 설치하거나 시작하세요.","vm.setup.recreate": "삭제하고 다시 만들기","vm.setup.prepareFirst": "이 VM을 교체하기 전에 위에서 고정된 Cua 데스크톱을 준비하세요.","vm.setup.start": "비공개 데스크톱 시작",@@ -4165,7 +4162,7 @@"vm.setup.waiting": "데스크톱을 기다리는 중…","vm.setup.create": "로컬 VM 만들기","vm.setup.showCommand": "명령 보기",- "vm.inspectFailed": "OpenMausBot이 컨테이너 런타임을 확인하지 못했어요. 다시 확인하거나 앱 로그를 살펴보세요.",+ "vm.inspectFailed": "{app}이 컨테이너 런타임을 확인하지 못했어요. 다시 확인하거나 앱 로그를 살펴보세요.","vm.safety.title": "안전과 저장 공간","vm.safety.perBot": "Cua Driver는 각 VM의 데스크톱만 조작해요. 봇마다 비공개 호스트 폴더가 {path}에 연결되며, 그 파일과 브라우저 프로필은 VM을 교체해도 남아요. 뷰어는 루프백에만 연결되고, 봇별로 정확히 지정된 대상 덕분에 한 봇이 다른 봇의 컨테이너에 붙을 수 없어요. 각 VM에는 기존의 4GB, CPU 2개, 프로세스 512개, 권한 축소 제한이 그대로 적용돼요. VM은 여전히 인터넷에 접속할 수 있어요.","vm.safety.shared": "Cua Driver는 VM의 데스크톱만 조작해요. 비공개 호스트 폴더 딱 하나가 {path}에 연결되며, 그곳의 파일과 브라우저 로그인은 VM을 교체해도 남고 VM의 나머지는 모두 버려도 되는 공간이에요. 비밀번호로 보호된 뷰어는 이 머신에서만 쓸 수 있어요. Docker와 Podman 실행은 메모리 4GB, CPU 2개, 프로세스 512개로 제한되며, 데스크톱 관리자가 권한 없는 사용자로 전환하는 데 필요한 두 가지를 빼고 모든 Linux 권한이 제거돼요. VM은 여전히 인터넷에 접속할 수 있고, 봇들은 한 번에 하나씩 이 VM을 써요.",@@ -4191,7 +4188,6 @@"vm.err.runtimeUnavailable": "컨테이너 런타임을 쓸 수 없음","vm.err.cloudUnavailable": "클라우드 데스크톱 목록을 가져오지 못함","vm.err.vpsUnavailable": "VPS 컴퓨터 목록을 쓸 수 없음",- "vm.vps.noneFound": "OpenMaus가 관리하는 VPS 컴퓨터가 없어요.","vm.cloud.noneFound": "클라우드 데스크톱이 없어요.","vm.vps.checkingList": "VPS 컴퓨터 확인 중…","vm.vps.remove": "제거",@@ -4207,7 +4203,7 @@"vm.announce.cloudSleeping": "{subject} 잠자는 중.","vm.cloud.deletedRefreshError": "{subject}은(는) 삭제됐지만 목록을 새로고침하지 못했어요: {detail}","vm.cloud.sleepRefreshError": "{subject}을(를) 재웠지만 목록을 새로고침하지 못했어요: {detail}",- "vm.setup.perBotHint": "봇에 비공개 데스크톱을 고르고 봇의 화면을 연 뒤 그곳에서 데스크톱을 만드세요. OpenMausBot이 비공개 폴더와 사용 가능한 루프백 뷰어 포트를 자동으로 배정해요.",+ "vm.setup.perBotHint": "봇에 비공개 데스크톱을 고르고 봇의 화면을 연 뒤 그곳에서 데스크톱을 만드세요. {app}이 비공개 폴더와 사용 가능한 루프백 뷰어 포트를 자동으로 배정해요.","vm.safety.baseImage": "기본 이미지: {image}","room.openBot": "{name} 열기","room.pinHint": "이 메시지를 그룹 스레드 맨 위에 고정",@@ -4320,12 +4316,12 @@"computer.problem.localWaylandBlocked": "이런 종류의 데스크톱 세션에서는 아직 봇이 이 컴퓨터를 쓸 수 없어요. 로그아웃한 뒤 로그인 화면에서 “Ubuntu on Xorg”를 고르고 다시 로그인하세요.","computer.problem.localWaylandDesktop": "이런 종류의 데스크톱 세션에서는 GNOME에서만 봇이 이 컴퓨터를 쓸 수 있어요. 여기서 쓰려면 로그아웃한 뒤 로그인 화면에서 Xorg 세션을 고르세요.","computer.problem.localTurnOn": "먼저 화면 패널에서 로컬 제어를 켜세요.",- "computer.problem.localNotReady": "아직 봇이 이 컴퓨터를 쓸 수 없어요. OpenMausBot을 다시 시작한 뒤 다시 시도하세요.",- "computer.problem.localNeedsApp": "이 컴퓨터의 OpenMausBot 앱만 봇이 이 컴퓨터를 쓰게 할 수 있어요. 쓰려면 여기서 앱을 여세요.",- "computer.problem.localWindows": "지금은 봇이 이 PC를 쓸 수 없어요. OpenMausBot을 다시 시작하고, 그래도 안 되면 설정 → 진단을 여세요.",- "computer.problem.localMac": "아직 봇이 이 Mac을 쓸 수 없어요. 시스템 설정 → 개인정보 보호 및 보안의 화면 기록과 손쉬운 사용에서 OpenMausBot이 허용되어 있는지 확인한 뒤 다시 시작하세요.",+ "computer.problem.localNotReady": "아직 봇이 이 컴퓨터를 쓸 수 없어요. {app}을 다시 시작한 뒤 다시 시도하세요.",+ "computer.problem.localNeedsApp": "이 컴퓨터의 {app} 앱만 봇이 이 컴퓨터를 쓰게 할 수 있어요. 쓰려면 여기서 앱을 여세요.",+ "computer.problem.localWindows": "지금은 봇이 이 PC를 쓸 수 없어요. {app}을 다시 시작하고, 그래도 안 되면 설정 → 진단을 여세요.",+ "computer.problem.localMac": "아직 봇이 이 Mac을 쓸 수 없어요. 시스템 설정 → 개인정보 보호 및 보안의 화면 기록과 손쉬운 사용에서 {app}이 허용되어 있는지 확인한 뒤 다시 시작하세요.","computer.problem.oldImage": "비공개 데스크톱이 오래됐어요. 교체하세요",- "computer.problem.unmanaged": "기존 컨테이너는 OpenMausBot이 만든 것이 아니에요. 다시 만드세요",+ "computer.problem.unmanaged": "기존 컨테이너는 {app}이 만든 것이 아니에요. 다시 만드세요","computer.problem.publicViewer": "비공개 데스크톱의 뷰어가 네트워크에 열려 있어요. 교체하세요","computer.problem.missingLimits": "비공개 데스크톱에 안전 제한이 없어요. 교체하세요","computer.problem.missingDurableFolder": "비공개 데스크톱에 자체 폴더가 없어요. 교체하세요",@@ -4342,24 +4338,24 @@"computer.err.frameTimeout": "화면 업데이트가 너무 오래 걸렸어요. 다시 시도하세요.","computer.err.screenUnavailable": "화면을 잠시 쓸 수 없어요.","computer.err.noDesktopLink": "실시간 데스크톱 링크를 가져오지 못했어요",- "computer.err.openDesktop": "OpenMausBot이 실시간 데스크톱을 열지 못했어요",- "computer.err.openDesktopLink": "OpenMausBot이 실시간 데스크톱 링크를 열지 못했어요",+ "computer.err.openDesktop": "{app}이 실시간 데스크톱을 열지 못했어요",+ "computer.err.openDesktopLink": "{app}이 실시간 데스크톱 링크를 열지 못했어요","computer.err.popupBlocked": "브라우저가 실시간 데스크톱 탭을 차단했어요","computer.confirm.deleteVm": "{name}의 로컬 VM을 삭제할까요? 영구 폴더와 웹사이트 로그인은 유지돼요. 데스크톱 안에 설치한 앱과 영구 폴더 밖의 파일은 삭제돼요.","computer.confirm.replaceVm": "{name}의 비공개 데스크톱을 교체할까요? 영구 폴더와 웹사이트 로그인은 유지돼요. 데스크톱 안에 설치한 앱과 영구 폴더 밖의 파일은 삭제돼요.",- "computer.confirm.replaceVps": "{name}의 VPS 컴퓨터를 이번 OpenMausBot 업데이트에 필요한 버전으로 교체할까요? 버려도 되는 컨테이너 안에만 저장된 파일은 삭제돼요.",+ "computer.confirm.replaceVps": "{name}의 VPS 컴퓨터를 이번 {app} 업데이트에 필요한 버전으로 교체할까요? 버려도 되는 컨테이너 안에만 저장된 파일은 삭제돼요.","computer.phase.checking": "확인 중…","computer.phase.starting": "봇의 데스크톱을 시작하는 중…","computer.phase.vpsUnconfigured": "내 머신이 아직 이 봇용으로 설정되지 않았어요",- "computer.phase.vpsIncompatible": "내 머신의 데스크톱이 이전 OpenMausBot 버전이에요",+ "computer.phase.vpsIncompatible": "내 머신의 데스크톱이 이전 {app} 버전이에요","computer.phase.vpsStopped": "내 머신의 데스크톱이 멈춰 있어요","computer.phase.localUnavailable": "로컬 컴퓨터 제어가 준비되지 않았어요.",- "computer.mac.permission.requiredOne": "OpenMausBot이 이 컴퓨터를 쓰려면 {permission} 권한이 필요해요. 시스템 설정 → 개인정보 보호 및 보안에서 허용한 뒤 OpenMausBot을 다시 실행하세요.",- "computer.mac.permission.requiredBoth": "OpenMausBot이 이 컴퓨터를 쓰려면 화면 기록과 손쉬운 사용 권한이 필요해요. 시스템 설정 → 개인정보 보호 및 보안에서 허용한 뒤 OpenMausBot을 다시 실행하세요.",- "computer.mac.permission.generic": "로컬 컴퓨터 제어가 준비되지 않았어요. OpenMausBot이 이 Mac을 쓰려면 손쉬운 사용과 화면 기록 권한이 필요해요. 드라이버 세부 정보나 시스템 설정을 확인한 뒤 다시 시도를 누르세요.",+ "computer.mac.permission.requiredOne": "{app}이 이 컴퓨터를 쓰려면 {permission} 권한이 필요해요. 시스템 설정 → 개인정보 보호 및 보안에서 허용한 뒤 {app}을 다시 실행하세요.",+ "computer.mac.permission.requiredBoth": "{app}이 이 컴퓨터를 쓰려면 화면 기록과 손쉬운 사용 권한이 필요해요. 시스템 설정 → 개인정보 보호 및 보안에서 허용한 뒤 {app}을 다시 실행하세요.",+ "computer.mac.permission.generic": "로컬 컴퓨터 제어가 준비되지 않았어요. {app}이 이 Mac을 쓰려면 손쉬운 사용과 화면 기록 권한이 필요해요. 드라이버 세부 정보나 시스템 설정을 확인한 뒤 다시 시도를 누르세요.","computer.mac.permission.screenSettings": "화면 기록 설정 열기","computer.mac.permission.accessibilitySettings": "손쉬운 사용 설정 열기",- "computer.mac.permission.relaunch": "OpenMausBot 다시 실행",+ "computer.mac.permission.relaunch": "{app} 다시 실행","computer.mac.permission.driverDetail": "드라이버 세부 정보","computer.phase.vmUnavailable": "이 봇은 비공개 데스크톱을 쓸 수 없어요","computer.phase.error": "봇의 화면에 연결할 수 없어요",@@ -4393,7 +4389,7 @@"routines.neverRun": "아직 실행 안 됨","routines.continuityLabel": "마지막 실행 기억하기","routines.continuityHelp": "실행할 때마다 이전 실행의 보고서로 시작해서, 봇이 지난번에 찾은 내용을 알아요. QA나 모니터링 같은 점검에 좋아요.",- "routines.runOnStartupLabel": "OpenMausBot이 시작될 때도 실행",+ "routines.runOnStartupLabel": "{app}이 시작될 때도 실행","routines.runOnStartupHelp": "예약된 시간에 자주 꺼져 있는 컴퓨터를 위해 앱을 열 때마다 한 번씩 실행해요. 일정은 평소대로 계속 돌아가요.","routines.overlapLabel": "이전 실행이 아직 작업 중이면","routines.overlapSkip": "이번 회차 건너뛰기",@@ -4431,7 +4427,7 @@"routines.status.missed": "놓침","routines.status.problems": "문제","routines.retried.stalled": "AI가 멈춘 뒤 다시 시도 · {status}",- "routines.retried.restarted": "OpenMausBot이 다시 시작된 뒤 다시 시도 · {status}",+ "routines.retried.restarted": "{app}이 다시 시작된 뒤 다시 시도 · {status}","routines.retried.rate_limited": "요청 한도에 걸린 뒤 다시 시도 · {status}","routines.retried.provider": "일시적인 오류 뒤 다시 시도 · {status}","routines.retried.usage_limit": "사용 한도가 초기화된 뒤 실행 · {status}",@@ -4538,7 +4534,7 @@"automations.address.title": "이 주소를 다른 앱에 붙여 넣으세요","automations.address.copy": "주소 복사","automations.address.copied": "복사됨",- "automations.address.keepOpen": "받을 수 있도록 OpenMausBot을 열어 두세요.",+ "automations.address.keepOpen": "받을 수 있도록 {app}을 열어 두세요.","automations.address.unavailable": "지금은 이 컴퓨터에서 받을 수 없어요.","automations.more": "더 보기","automations.address.showSecret": "비밀 값 / 설정 보기",@@ -4698,17 +4694,17 @@"routines.drawer.noRuns": "아직 실행이 없어요.","routines.drawer.allRuns": "모두 보기","routines.runsOn.local": "이 컴퓨터",- "routines.runsOn.localHint": "여기서 OpenMausBot이 열려 있는 동안 시작해요.",+ "routines.runsOn.localHint": "여기서 {app}이 열려 있는 동안 시작해요.","routines.runsOn.botCloud": "봇의 클라우드 데스크톱","routines.runsOn.botVm": "봇의 비공개 데스크톱","routines.runsOn.boat": "클라우드 데스크톱",- "routines.scheduleNote.local": "이 컴퓨터에서 OpenMausBot이 열려 있는 동안 실행돼요. 잠든 컴퓨터를 깨우지는 못하며, 12시간 이내에 놓친 실행은 앱이 다시 열리면 실행돼요.",+ "routines.scheduleNote.local": "이 컴퓨터에서 {app}이 열려 있는 동안 실행돼요. 잠든 컴퓨터를 깨우지는 못하며, 12시간 이내에 놓친 실행은 앱이 다시 열리면 실행돼요.","routines.scheduleNote.addCloud": "루틴을 24시간 실행하려면 클라우드를 추가하세요.","routines.scheduleNote.openCloud": "루틴을 24시간 실행하려면 클라우드에서 만드세요.","routines.scheduleNote.leave": "클라우드를 열까요? 이 루틴은 저장되지 않았으니 저장하지 않고 닫혀요.","routines.scheduleNote.cloud": "컴퓨터가 꺼져 있어도 클라우드에서 24시간 실행돼요.","routines.scheduleNote.server": "여기서 앱이 실행되는 동안 실행돼요.",- "routines.runsOn.boatHint": "OpenMausBot이 열려 있는 동안 봇의 클라우드 데스크톱에서 작업 전체를 실행해요.",+ "routines.runsOn.boatHint": "{app}이 열려 있는 동안 봇의 클라우드 데스크톱에서 작업 전체를 실행해요.","routines.runsOn.team": "이 컴퓨터, 그룹 전체와 함께","routines.runsOn.cloudHome": "클라우드","routines.runsOn.cloudHomeHint": "컴퓨터가 꺼져 있어도 일정대로 실행돼요.",@@ -4828,7 +4824,7 @@"computer.sleepTitle": "데스크톱 재우기","computer.worksOn": "작업 위치","computer.worksOnHint": "이 봇이 일할 곳을 고르세요.",- "computer.worksOnHintCloudHome": "이 봇이 일할 곳을 고르세요. 컴퓨터에서 OpenMausBot이 열려 있으면 언제든 그 컴퓨터도 쓸 수 있어요.",+ "computer.worksOnHintCloudHome": "이 봇이 일할 곳을 고르세요. 컴퓨터에서 {app}이 열려 있으면 언제든 그 컴퓨터도 쓸 수 있어요.","computer.destinationAria": "컴퓨터 위치","computer.dest.autoDesc": "자동으로 고르기","computer.dest.cloudDesc": "클라우드의 데스크톱",@@ -4956,7 +4952,7 @@"connectors.typeAria": "플러그인 유형","connectors.tab.apps": "연결된 앱","connectors.tab.mcp": "MCP 서버",- "connectors.stale": "지난번에 연결된 상태를 보여 주고 있어요 — 방금 이 Mac의 자격 증명 저장소를 열 수 없어서 다시 확인하지 못했어요. 앱은 여전히 연결되어 있으며, 보통 OpenMausBot을 다시 시작하면 해결돼요.",+ "connectors.stale": "지난번에 연결된 상태를 보여 주고 있어요 — 방금 이 Mac의 자격 증명 저장소를 열 수 없어서 다시 확인하지 못했어요. 앱은 여전히 연결되어 있으며, 보통 {app}을 다시 시작하면 해결돼요.","connectors.viewAria": "연결된 앱 보기","connectors.tab.marketplace": "마켓플레이스","connectors.tab.connected": "연결됨",@@ -5059,8 +5055,8 @@"mcp.err.nameAndUrl": "서버 이름과 전체 http:// 또는 https:// 주소를 추가하세요.","mcp.headersSaved": "저장된 헤더: {keys}","mcp.oauth.title": "로그인 앱 · 선택",- "mcp.oauth.hint": "Microsoft Entra ID 뒤에 있는 서버처럼 미리 등록된 앱만 로그인시키는 서버에만 필요해요. 클라이언트 ID를 비워 두면 OpenMausBot이 스스로 등록해요. 저장하면 등록할 리디렉션 URI가 보여요.",- "mcp.oauth.hintRedirect": "미리 등록된 앱만 로그인시키는 서버에만 필요해요. 앱의 리디렉션 URI로 {uri}을(를) 등록하세요. 클라이언트 ID를 비워 두면 OpenMausBot이 스스로 등록해요.",+ "mcp.oauth.hint": "Microsoft Entra ID 뒤에 있는 서버처럼 미리 등록된 앱만 로그인시키는 서버에만 필요해요. 클라이언트 ID를 비워 두면 {app}이 스스로 등록해요. 저장하면 등록할 리디렉션 URI가 보여요.",+ "mcp.oauth.hintRedirect": "미리 등록된 앱만 로그인시키는 서버에만 필요해요. 앱의 리디렉션 URI로 {uri}을(를) 등록하세요. 클라이언트 ID를 비워 두면 {app}이 스스로 등록해요.","mcp.oauth.clientId": "클라이언트 ID","mcp.oauth.clientSecret": "클라이언트 시크릿","mcp.oauth.secretOptional": "선택, 기밀 앱용",@@ -5115,7 +5111,7 @@"mcp.team.onlyMeOn": "나만 쓸 수 있어요. 팀원은 자기 팀 페이지에서 각자의 키를 추가할 수 있어요.","mcp.auth.loadingTools": "로그인했어요. 연결하는 중…","engineSetup.device.description": "ChatGPT 계정을 Codex에 연결하세요. 내 브라우저에서 로그인을 마치면 되고, 터미널이나 비밀번호 공유는 필요 없어요.",- "engineSetup.chatgpt.description": "OpenMausBot의 해당 AI 요청에 ChatGPT 요금제를 써요. MausBot Cloud나 API 결제와는 별개예요.",+ "engineSetup.chatgpt.description": "{app}의 해당 AI 요청에 ChatGPT 요금제를 써요. MausBot Cloud나 API 결제와는 별개예요.","engineSetup.chatgpt.start": "ChatGPT로 계속","engineSetup.antigravity.addAccount": "Google 계정 추가","engineSetup.antigravity.emailUnavailable": "Google로 로그인됨 · 계정 이메일을 알 수 없음",@@ -5131,7 +5127,7 @@"engineSetup.chatgpt.using": "ChatGPT 요금제 사용 중","engineSetup.chatgpt.manageUsage": "사용량 관리","engineSetup.chatgpt.welcome": "ChatGPT 요금제를 쓰고 있어요",- "engineSetup.chatgpt.welcomeBody": "OpenMausBot의 해당 AI 요청은 ChatGPT 요금제를 써요. 사용량과 접근 권한은 ChatGPT 설정에서 관리하세요. ChatGPT 요금제는 MausBot Cloud와 별개예요.",+ "engineSetup.chatgpt.welcomeBody": "{app}의 해당 AI 요청은 ChatGPT 요금제를 써요. 사용량과 접근 권한은 ChatGPT 설정에서 관리하세요. ChatGPT 요금제는 MausBot Cloud와 별개예요.","engineSetup.device.start": "ChatGPT 연결","engineSetup.device.starting": "로그인 코드를 받는 중…","engineSetup.device.enterCode": "OpenAI 로그인 페이지에서 이 일회용 코드를 입력하세요:",@@ -5165,7 +5161,7 @@"settings.domain.title": "내 도메인 연결","settings.domain.subtitle": "주소를 입력한 뒤 DNS 레코드를 도메인 업체에 복사하세요.","settings.domain.loading": "서버 주소 불러오는 중…",- "settings.domain.serverOnly": "사용자 지정 도메인은 직접 호스팅하는 OpenMausBot 서버용이에요. 이 데스크톱 앱의 휴대폰 연결은 아래에서 따로 관리해요.",+ "settings.domain.serverOnly": "사용자 지정 도메인은 직접 호스팅하는 {app} 서버용이에요. 이 데스크톱 앱의 휴대폰 연결은 아래에서 따로 관리해요.","settings.domain.current": "현재 공개 주소","settings.domain.guide": "고급 서버 설정","settings.domain.enterDomain": "DNS 값을 보려면 bots.yourcompany.com 같은 주소를 입력하세요.",@@ -5176,13 +5172,13 @@"settings.domain.copyField": "{field} 복사","settings.domain.recordHint": "TTL은 기본값으로 두세요. 업체가 도메인을 자동으로 붙인다면 이름에는 하위 도메인만 입력하세요(루트 도메인은 @).","settings.domain.missingIp": "서버 관리자에게 공개 IPv4 주소를 물어보세요.",- "settings.domain.ipAdminHint": "Docker, NAT, 여러 공개 주소를 쓴다면 OMB_PUBLIC_IPV4를 HTTPS 프록시가 있는 IPv4 주소로 설정하고 OpenMausBot을 다시 시작하세요. 사설 주소는 DNS 값으로 표시되지 않아요.",+ "settings.domain.ipAdminHint": "Docker, NAT, 여러 공개 주소를 쓴다면 OMB_PUBLIC_IPV4를 HTTPS 프록시가 있는 IPv4 주소로 설정하고 {app}을 다시 시작하세요. 사설 주소는 DNS 값으로 표시되지 않아요.","settings.domain.httpsNeeded": "관리자가 서버에서 HTTPS를 켜야 해요. 그다음 아래에서 연결을 확인하세요.","settings.domain.dns": "도메인 DNS 설정에서 고른 이름에 대해 이 서버의 공개 IPv4 주소를 가리키는 A 레코드를 만드세요. IPv6로도 같은 서버에 닿을 때만 AAAA 레코드를 추가하세요. DNS가 업데이트될 때까지 시간이 걸려요.",- "settings.domain.proxy": "서버 관리자가 OpenMausBot 앞에 HTTPS를 설정해야 해요. 같은 호스트나 네트워크 네임스페이스에서 Caddy를 실행한다면 이 예시를 쓰고 bots.example.com을 내 도메인으로 바꾸세요:",+ "settings.domain.proxy": "서버 관리자가 {app} 앞에 HTTPS를 설정해야 해요. 같은 호스트나 네트워크 네임스페이스에서 Caddy를 실행한다면 이 예시를 쓰고 bots.example.com을 내 도메인으로 바꾸세요:","settings.domain.proxyHint": "Caddy가 인증서를 받을 수 있게 80번과 443번 포트로 들어오는 연결을 허용하세요. 인증서 저장소는 영구적으로 유지하고, Host 헤더와 전달 헤더를 보존하며, 설정을 바꾼 뒤에는 Caddy를 다시 불러오세요. Docker라면 제공된 배포 예시를 쓰세요.",- "settings.domain.verifyHint": "HTTPS가 작동하면 아래에 도메인을 입력하세요. OpenMausBot이 저장하기 전에 인증서를 확인하고 정확히 이 설치에 연결되는지 확인해요.",- "settings.domain.loopbackWarning": "OpenMausBot의 앱과 웹훅 리스너는 루프백에 두세요. 앱의 내부 포트를 인터넷에 직접 공개하지 마세요.",+ "settings.domain.verifyHint": "HTTPS가 작동하면 아래에 도메인을 입력하세요. {app}이 저장하기 전에 인증서를 확인하고 정확히 이 설치에 연결되는지 확인해요.",+ "settings.domain.loopbackWarning": "{app}의 앱과 웹훅 리스너는 루프백에 두세요. 앱의 내부 포트를 인터넷에 직접 공개하지 마세요.","settings.domain.fullGuide": "직접 호스팅 안내 열기","settings.domain.label": "내 도메인","settings.domain.inputHint": "예: bots.yourcompany.com 또는 https://bots.yourcompany.com. 경로, 비밀번호, 페어링 코드는 넣지 마세요.",@@ -5191,18 +5187,18 @@"settings.domain.remove": "사용자 지정 주소 제거","settings.domain.removing": "제거하는 중…","settings.domain.fallback": "사용자 지정 주소를 제거하면 {url}(으)로 돌아가요. DNS나 프록시는 바뀌지 않아요.",- "settings.domain.noFallback": "대체할 공개 주소가 설정되어 있지 않아요. 이 주소를 제거하면 OpenMausBot이 새 페어링 링크에 이 주소를 쓰지 않으며, DNS와 프록시는 그대로예요.",+ "settings.domain.noFallback": "대체할 공개 주소가 설정되어 있지 않아요. 이 주소를 제거하면 {app}이 새 페어링 링크에 이 주소를 쓰지 않으며, DNS와 프록시는 그대로예요.","settings.domain.scope": "이후 만드는 서버 페어링 링크만 바뀌고, 기존 웹훅 URL이나 데스크톱 컴패니언 연결은 바뀌지 않아요. 봇과 대화도 그대로예요. 브라우저마다 새 도메인에서 따로 페어링해야 해요.","settings.domain.saved": "도메인이 확인되고 연결됐어요. 새 주소에서 브라우저를 페어링할 때까지 이 탭을 열어 두세요.","settings.domain.removed": "사용자 지정 주소를 제거했어요. 봇, 대화, DNS, 프록시는 그대로예요.","settings.domain.failed": "도메인을 업데이트하지 못했어요. DNS와 HTTPS를 확인한 뒤 다시 시도하세요.","remote.serverPairing.title": "휴대폰이나 다른 컴퓨터 페어링",- "remote.serverPairing.subtitle": "일회용 코드를 만든 뒤 OpenMausBot 앱으로 스캔하거나 브라우저에서 링크를 여세요. 코드는 한 번만 쓸 수 있고 5분 뒤 만료돼요.",+ "remote.serverPairing.subtitle": "일회용 코드를 만든 뒤 {app} 앱으로 스캔하거나 브라우저에서 링크를 여세요. 코드는 한 번만 쓸 수 있고 5분 뒤 만료돼요.","remote.serverPairing.scope.admin": "전체 접근","remote.serverPairing.scope.client": "채팅과 승인만","remote.serverPairing.create": "페어링 코드 만들기","teamPhone.title": "휴대폰에서 열기",- "teamPhone.subtitle": "OpenMausBot 휴대폰 앱으로 이 코드를 스캔하세요. 휴대폰에서 여기서 보는 채팅 그대로 내 계정으로 {team}이(가) 열려요.",+ "teamPhone.subtitle": "{app} 휴대폰 앱으로 이 코드를 스캔하세요. 휴대폰에서 여기서 보는 채팅 그대로 내 계정으로 {team}이(가) 열려요.","teamPhone.stays": "이 앱에서 {team}이(가) 열려 있는 동안 휴대폰도 로그인 상태로 유지돼요.","teamPhone.remove": "제거","remote.serverPairing.creating": "만드는 중…",@@ -5322,7 +5318,7 @@"settings.import.appsSubtitle": "이 컴퓨터의 Claude Code, Codex, Cursor, Claude Desktop, Gemini에서 스킬과 MCP 도구를 가져와요. 도구는 꺼진 상태로 들어오고, 로그인 정보와 기록은 절대 읽지 않아요.","settings.import.appsLooking": "이 컴퓨터에서 찾는 중…","settings.import.appsNothing": "AI 앱에서 새로 가져올 것이 없어요.",- "settings.import.appsLocalOnly": "OpenMausBot이 실행 중인 컴퓨터의 데스크톱 앱만 그 컴퓨터의 스킬과 도구를 가져올 수 있어요.",+ "settings.import.appsLocalOnly": "{app}이 실행 중인 컴퓨터의 데스크톱 앱만 그 컴퓨터의 스킬과 도구를 가져올 수 있어요.","settings.import.grokTitle": "Grok Bot에서","settings.import.grokSubtitle": "공유된 Grok Bot을 새 봇으로 가져와요: 지침, 스킬(꺼진 상태), 루틴(일시 중지 상태).","backup.scope": "이 설치의 비밀번호로 보호된 백업이에요: 봇, 대화, 지침, 로컬 파일, 비밀이 아닌 설정. 이 브라우저의 초안과 환경설정도 포함돼요.",@@ -5355,10 +5351,10 @@"backup.confirmReplace": "확인하려면 REPLACE를 입력하세요","backup.replace": "설치 교체","backup.restoring": "교체 준비 중…",- "backup.restart": "백업을 복원할 준비가 됐어요. 마무리하려면 OpenMausBot을 완전히 종료했다가 다시 여세요. 직접 호스팅하는 서버라면 서버 프로세스를 다시 시작한 뒤 이 브라우저를 새로고침하세요. 이 창만 닫으면 안 돼요.",- "backup.restartDesktop": "백업이 준비됐어요. 복원을 마치려면 OpenMausBot을 다시 시작하세요. 이 창을 닫는다고 서버가 다시 시작되지는 않아요.",+ "backup.restart": "백업을 복원할 준비가 됐어요. 마무리하려면 {app}을 완전히 종료했다가 다시 여세요. 직접 호스팅하는 서버라면 서버 프로세스를 다시 시작한 뒤 이 브라우저를 새로고침하세요. 이 창만 닫으면 안 돼요.",+ "backup.restartDesktop": "백업이 준비됐어요. 복원을 마치려면 {app}을 다시 시작하세요. 이 창을 닫는다고 서버가 다시 시작되지는 않아요.","backup.restartAction": "다시 시작하고 복원",- "backup.restartFailed": "OpenMausBot을 다시 시작하지 못했어요. 복원을 마치려면 앱을 완전히 종료했다가 다시 여세요.",+ "backup.restartFailed": "{app}을 다시 시작하지 못했어요. 복원을 마치려면 앱을 완전히 종료했다가 다시 여세요.","backup.recovering": "이 브라우저에 저장된 초안과 환경설정을 복원하는 중…","backup.skipDrafts": "초안을 복원하지 않고 계속","backup.skipDraftsHint": "이 브라우저의 현재 초안과 환경설정을 유지해요. 설치 복원을 되돌리지는 않아요.",@@ -5534,7 +5530,7 @@"canvasComputers.unassignTitle": "{name} 배정을 해제할까요?","canvasComputers.assignTitle": "{name}을(를) {team}에 배정할까요?","canvasComputers.unassignBody": "부서 기본값을 없애요. 머신, 파일, 로그인은 멈추거나 삭제되지 않아요. 다음 작업 전에 봇의 자동 경로를 검토하세요.",- "canvasComputers.assignBody": "이 부서에서 자동으로 설정된 봇은 이 데스크톱의 파일과 로그인된 계정을 함께 써요. 작업 위치를 따로 정한 봇은 그대로예요. 한 번에 한 봇만 데스크톱을 쓸 수 있어요. OpenMausBot 자체를 옮기거나 24시간 호스팅을 켜지는 않아요.",+ "canvasComputers.assignBody": "이 부서에서 자동으로 설정된 봇은 이 데스크톱의 파일과 로그인된 계정을 함께 써요. 작업 위치를 따로 정한 봇은 그대로예요. 한 번에 한 봇만 데스크톱을 쓸 수 있어요. {app} 자체를 옮기거나 24시간 호스팅을 켜지는 않아요.","canvasComputers.computer": "데스크톱","canvasComputers.assign": "데스크톱 배정","canvasComputers.unassign": "데스크톱 배정 해제",@@ -5655,7 +5651,7 @@"engines.icon.reset": "초기화","engines.icon.help": "제공자를 고르거나 128KB 이하의 정사각형 PNG, JPEG, WebP 이미지를 업로드하세요. 이 모델 제공자에만 적용돼요.","engines.icon.uploadAria": "{name}의 사용자 지정 제공자 아이콘 업로드",- "engines.icon.decodeError": "OpenMausBot이 그 이미지를 읽지 못했어요.",+ "engines.icon.decodeError": "{app}이 그 이미지를 읽지 못했어요.","engines.icon.formatError": "PNG, JPEG, WebP 이미지를 업로드하세요.","engines.icon.sizeError": "제공자 아이콘은 128KB 이하여야 해요.","engines.icon.invalidError": "128KB 이하, {dimension} × {dimension}픽셀 이하의 완전한 PNG, JPEG, WebP 이미지를 업로드하세요.",@@ -5755,7 +5751,7 @@"desktopViewer.showControls": "컨트롤 보기","desktopViewer.closePanel": "패널 닫기","desktopViewer.notice": "noVNC 라이선스와 소스",- "desktopViewer.invalid": "이 데스크톱 링크가 올바르지 않아요. OpenMausBot에서 다시 여세요.",+ "desktopViewer.invalid": "이 데스크톱 링크가 올바르지 않아요. {app}에서 다시 여세요.","desktopViewer.keyTab": "Tab","desktopViewer.keyEscape": "Esc","desktopViewer.keyCtrlAltDel": "Ctrl–Alt–Del",@@ -5766,7 +5762,7 @@"call.live.endedExpired": "통화가 끝났어요: OpenAI의 시간 제한에 닿았어요.","call.live.endedContent": "OpenAI가 콘텐츠 규칙에 따라 통화를 끝냈어요.","call.live.endedDeleted": "통화가 끝났어요: 채팅이 삭제됐어요.",- "call.live.endedShutdown": "통화가 끝났어요: OpenMausBot이 다시 시작됐어요.",+ "call.live.endedShutdown": "통화가 끝났어요: {app}이 다시 시작됐어요.","call.live.endedSignedOut": "통화가 끝났어요: 로그아웃됐어요.","call.live.busy.desktop": "데스크톱 앱에서 다른 실시간 통화가 진행 중이에요. 먼저 그쪽 통화를 끊으세요.","call.live.busy.web": "웹 브라우저에서 다른 실시간 통화가 진행 중이에요. 먼저 그쪽 통화를 끊으세요.",@@ -5776,7 +5772,7 @@"call.live.micBlockedBrowser": "마이크가 차단되어 있어요. 브라우저에서 이 사이트의 마이크를 허용한 뒤 다시 시도하세요.","call.live.micMissing": "마이크를 찾지 못했어요. 마이크를 연결한 뒤 다시 시도하세요.","call.live.micAppRefused": "앱이 이 페이지에서 마이크를 쓰지 못하게 했어요. 실시간 통화를 하려면 웹 브라우저에서 여세요.",- "call.live.unsupported": "실시간 통화에는 마이크가 필요한데, 이 창에서는 쓸 수 없어요. 통화하려면 안전한 https 주소로 OpenMausBot을 여세요.",+ "call.live.unsupported": "실시간 통화에는 마이크가 필요한데, 이 창에서는 쓸 수 없어요. 통화하려면 안전한 https 주소로 {app}을 여세요.","call.live.noOffer": "통화를 시작하지 못했어요: 연결 제안이 없어요.","call.live.clickToHear": "통화 소리를 들으려면 창 아무 곳이나 클릭하세요.","call.live.with": "{name}와(과) 실시간 통화",@@ -5817,7 +5813,7 @@"call.capability.unavailable": "이 기기에서는 통화를 쓸 수 없어요","call.capability.unavailableReason": "이 기기는 지금 통화에 필요한 기기 내 음성 인식을 제공하지 않아요.","call.capability.serviceUnavailable": "통화 서비스를 쓸 수 없어요",- "call.capability.serviceUnavailableReason": "이 앱 빌드에서는 음성 서비스를 쓸 수 없어요. OpenMausBot을 다시 시작하거나 업데이트하세요.",+ "call.capability.serviceUnavailableReason": "이 앱 빌드에서는 음성 서비스를 쓸 수 없어요. {app}을 다시 시작하거나 업데이트하세요.","call.hangUpOn": "{name}와(과)의 통화 끊기","call.live.callWith": "{name}와(과) 실시간 통화","call.live.startInstead": "대신 실시간 통화 시작",@@ -6868,7 +6864,7 @@"keys.search.none": "“{query}”와(과) 일치하는 키가 없어요.","keys.openPage": "API 키 열기","engineSetup.apiKey.inline": "여기에 붙여 넣으세요. 알아서 저장하고 확인한 뒤 모델이 여기에 나타나요.",- "secretCard.ref": "OpenMausBot이 자체 도구에서 한 번 쓰도록 보관해요. 봇은 절대 보지 못하고, 채팅에도 추가되지 않아요.",+ "secretCard.ref": "{app}이 자체 도구에서 한 번 쓰도록 보관해요. 봇은 절대 보지 못하고, 채팅에도 추가되지 않아요.","secretCard.file": "봇의 명령이 24시간 동안 읽을 수 있는 비공개 파일에 저장된 뒤 삭제돼요. 채팅에는 절대 추가되지 않아요.","secretCard.resumed": "봇이 재개됐어요"}diff --git a/src/locales/source-hashes.json b/src/locales/source-hashes.jsonindex b6f6db9984..d448ea52cb 100644--- a/src/locales/source-hashes.json+++ b/src/locales/source-hashes.json@@ -2585,8 +2585,8 @@"keys.purpose.postiz": "49f9b825d0b729c8ee5db12a0f177260cf2c1a9689a25e9a394d360f83fa595c","keys.postiz.placeholder": "56b1a7228075ecbabf95ce87f5df31020cb8a644ce910e545e7eec315cb818d3","approval.compact.maySend": "9aee9a892f7d74d514e3823aa095122d7ddc77caf5d73d1846f1eeb1430f6c0d",- "approval.status.expired": "6e5930304a7a7293559246feb54a74cedc480a6948bd468ce4ad07c941d87bcb",- "approval.status.timedOut": "9ebd74ec81556f23997af5d270166afaa3bf7ec4437a99af14f0b258fb2fddcd",+ "approval.status.expired": "3d83a9b033de67e452a6b367672b9fc0a26c318b904b62237a568e478ff1338c",+ "approval.status.timedOut": "833f9c81127bdf7f83ee550232973229c1ac16dedbd97d6c0e5040c09825657f","approval.applied.details": "45989de49fb7f66dfe17a8fc26f3a02c7abcd74f7e8e6cf9f39fa0e3775780df","approval.applied.hideDetails": "c9722a7a962a84359c87e56fe578f36a2bc75e66eee3ebce15963229fa12667d","question.card.named": "dd7f55499c6de8a849475543235d61883b004e6eb76e8cded7b4b83fdce3812c",@@ -8165,7 +8165,7 @@"keys.postiz.label": "322df8a3cbeb0f7f4e81ada5151c4f04cddada34f3b2ae76c70d8d43507965a6","keys.purpose.postiz": "49f9b825d0b729c8ee5db12a0f177260cf2c1a9689a25e9a394d360f83fa595c","keys.postiz.placeholder": "56b1a7228075ecbabf95ce87f5df31020cb8a644ce910e545e7eec315cb818d3",- "approval.status.timedOut": "9ebd74ec81556f23997af5d270166afaa3bf7ec4437a99af14f0b258fb2fddcd",+ "approval.status.timedOut": "833f9c81127bdf7f83ee550232973229c1ac16dedbd97d6c0e5040c09825657f","question.somethingElse": "b4768d66031a367906f5b7a0afdb6049db3ea469afeb55f468f3524b2977aa4a","ask.header.asks": "bb065f98972232b5d6b3ca3e367960f6c9800325d39285241f40bc60724c4838","ask.settled.chose": "4c402ce9ea7e79b8d6021991e837bcbe1b0e252c169d7f342fb7f7acbb429dc3",@@ -10743,7 +10743,7 @@"keys.postiz.label": "322df8a3cbeb0f7f4e81ada5151c4f04cddada34f3b2ae76c70d8d43507965a6","keys.purpose.postiz": "49f9b825d0b729c8ee5db12a0f177260cf2c1a9689a25e9a394d360f83fa595c","keys.postiz.placeholder": "56b1a7228075ecbabf95ce87f5df31020cb8a644ce910e545e7eec315cb818d3",- "approval.status.timedOut": "9ebd74ec81556f23997af5d270166afaa3bf7ec4437a99af14f0b258fb2fddcd",+ "approval.status.timedOut": "833f9c81127bdf7f83ee550232973229c1ac16dedbd97d6c0e5040c09825657f","question.somethingElse": "b4768d66031a367906f5b7a0afdb6049db3ea469afeb55f468f3524b2977aa4a","ask.header.asks": "bb065f98972232b5d6b3ca3e367960f6c9800325d39285241f40bc60724c4838","ask.settled.chose": "4c402ce9ea7e79b8d6021991e837bcbe1b0e252c169d7f342fb7f7acbb429dc3",@@ -13321,7 +13321,7 @@"keys.postiz.label": "322df8a3cbeb0f7f4e81ada5151c4f04cddada34f3b2ae76c70d8d43507965a6","keys.purpose.postiz": "49f9b825d0b729c8ee5db12a0f177260cf2c1a9689a25e9a394d360f83fa595c","keys.postiz.placeholder": "56b1a7228075ecbabf95ce87f5df31020cb8a644ce910e545e7eec315cb818d3",- "approval.status.timedOut": "9ebd74ec81556f23997af5d270166afaa3bf7ec4437a99af14f0b258fb2fddcd",+ "approval.status.timedOut": "833f9c81127bdf7f83ee550232973229c1ac16dedbd97d6c0e5040c09825657f","question.somethingElse": "b4768d66031a367906f5b7a0afdb6049db3ea469afeb55f468f3524b2977aa4a","ask.header.asks": "bb065f98972232b5d6b3ca3e367960f6c9800325d39285241f40bc60724c4838","ask.settled.chose": "4c402ce9ea7e79b8d6021991e837bcbe1b0e252c169d7f342fb7f7acbb429dc3",@@ -19825,7 +19825,7 @@"keys.purpose.postiz": "49f9b825d0b729c8ee5db12a0f177260cf2c1a9689a25e9a394d360f83fa595c","keys.postiz.placeholder": "56b1a7228075ecbabf95ce87f5df31020cb8a644ce910e545e7eec315cb818d3","apps.category.social": "f1b7505afa5c9e2bd6d68ae814b3582cf38632d56a67913e75e7d8cb10b5a8a3",- "approval.status.timedOut": "9ebd74ec81556f23997af5d270166afaa3bf7ec4437a99af14f0b258fb2fddcd",+ "approval.status.timedOut": "833f9c81127bdf7f83ee550232973229c1ac16dedbd97d6c0e5040c09825657f","question.somethingElse": "b4768d66031a367906f5b7a0afdb6049db3ea469afeb55f468f3524b2977aa4a","ask.header.asks": "bb065f98972232b5d6b3ca3e367960f6c9800325d39285241f40bc60724c4838","ask.settled.chose": "4c402ce9ea7e79b8d6021991e837bcbe1b0e252c169d7f342fb7f7acbb429dc3",@@ -26083,7 +26083,7 @@"keys.postiz.label": "322df8a3cbeb0f7f4e81ada5151c4f04cddada34f3b2ae76c70d8d43507965a6","keys.purpose.postiz": "49f9b825d0b729c8ee5db12a0f177260cf2c1a9689a25e9a394d360f83fa595c","keys.postiz.placeholder": "56b1a7228075ecbabf95ce87f5df31020cb8a644ce910e545e7eec315cb818d3",- "approval.status.timedOut": "9ebd74ec81556f23997af5d270166afaa3bf7ec4437a99af14f0b258fb2fddcd",+ "approval.status.timedOut": "833f9c81127bdf7f83ee550232973229c1ac16dedbd97d6c0e5040c09825657f","question.somethingElse": "b4768d66031a367906f5b7a0afdb6049db3ea469afeb55f468f3524b2977aa4a","ask.header.asks": "bb065f98972232b5d6b3ca3e367960f6c9800325d39285241f40bc60724c4838","ask.settled.chose": "4c402ce9ea7e79b8d6021991e837bcbe1b0e252c169d7f342fb7f7acbb429dc3",@@ -29520,11 +29520,11 @@"connectedWorkspaces.localSubtitle": "d305260fe318d84f9ad4bda857901450d1fb1c75470a1fb353489f33b227048f","connectedWorkspaces.switchTo": "f6d893e24f3c3d2f5209b0b66739979a81d30738415c7b6f33b0dfab7ee6fd59","connectedWorkspaces.switchConfirm": "3da46d3fd3884c06d1fb8e0462e82720ba5ae560eab4c82079e4be7d45cc2c8c",- "connectedWorkspaces.switchError": "c2b6ae24a835a4b16872a6cefacf466fd85839ff64dac61bdfa6cccde0f7af6d",+ "connectedWorkspaces.switchError": "6cb4eabbc4ec7e5c8f9ee96723d3770e3a7a19b779fd42b6fcf1c69a641db9f1","connectedWorkspaces.forgetName": "aa553b0835130001c7cafd2f2785cc46b858e78284db11b1a780e7d8580cfef4",- "connectedWorkspaces.forgetError": "363157dc3fe6a7d625cd13929d8fcd26da98c86ef1d044a4ed36aa065923172f",- "connectedWorkspaces.createError": "fcbd64308a78b24d8e20838391dda594a0a79ed2af9699602581fd5bb1f3e02d",- "approval.status.timedOut": "9ebd74ec81556f23997af5d270166afaa3bf7ec4437a99af14f0b258fb2fddcd",+ "connectedWorkspaces.forgetError": "6426192c4c32258117650b57029d6bb95102ab0eede1967d962a750817df5f85",+ "connectedWorkspaces.createError": "d6393fe1d84bccf5308d15cec7b87cba70c84c7cc098403c58067ad540709763",+ "approval.status.timedOut": "833f9c81127bdf7f83ee550232973229c1ac16dedbd97d6c0e5040c09825657f","question.somethingElse": "b4768d66031a367906f5b7a0afdb6049db3ea469afeb55f468f3524b2977aa4a","ask.header.asks": "bb065f98972232b5d6b3ca3e367960f6c9800325d39285241f40bc60724c4838","ask.settled.chose": "4c402ce9ea7e79b8d6021991e837bcbe1b0e252c169d7f342fb7f7acbb429dc3",@@ -33957,7 +33957,7 @@"keys.postiz.label": "322df8a3cbeb0f7f4e81ada5151c4f04cddada34f3b2ae76c70d8d43507965a6","keys.purpose.postiz": "49f9b825d0b729c8ee5db12a0f177260cf2c1a9689a25e9a394d360f83fa595c","keys.postiz.placeholder": "56b1a7228075ecbabf95ce87f5df31020cb8a644ce910e545e7eec315cb818d3",- "approval.status.timedOut": "9ebd74ec81556f23997af5d270166afaa3bf7ec4437a99af14f0b258fb2fddcd",+ "approval.status.timedOut": "833f9c81127bdf7f83ee550232973229c1ac16dedbd97d6c0e5040c09825657f","question.somethingElse": "b4768d66031a367906f5b7a0afdb6049db3ea469afeb55f468f3524b2977aa4a","ask.header.asks": "bb065f98972232b5d6b3ca3e367960f6c9800325d39285241f40bc60724c4838","ask.settled.chose": "4c402ce9ea7e79b8d6021991e837bcbe1b0e252c169d7f342fb7f7acbb429dc3",@@ -36980,7 +36980,7 @@"keys.postiz.label": "322df8a3cbeb0f7f4e81ada5151c4f04cddada34f3b2ae76c70d8d43507965a6","keys.purpose.postiz": "49f9b825d0b729c8ee5db12a0f177260cf2c1a9689a25e9a394d360f83fa595c","keys.postiz.placeholder": "56b1a7228075ecbabf95ce87f5df31020cb8a644ce910e545e7eec315cb818d3",- "approval.status.timedOut": "9ebd74ec81556f23997af5d270166afaa3bf7ec4437a99af14f0b258fb2fddcd",+ "approval.status.timedOut": "833f9c81127bdf7f83ee550232973229c1ac16dedbd97d6c0e5040c09825657f","question.somethingElse": "b4768d66031a367906f5b7a0afdb6049db3ea469afeb55f468f3524b2977aa4a","ask.header.asks": "bb065f98972232b5d6b3ca3e367960f6c9800325d39285241f40bc60724c4838","ask.settled.chose": "4c402ce9ea7e79b8d6021991e837bcbe1b0e252c169d7f342fb7f7acbb429dc3",@@ -42029,7 +42029,7 @@"keys.postiz.label": "322df8a3cbeb0f7f4e81ada5151c4f04cddada34f3b2ae76c70d8d43507965a6","keys.purpose.postiz": "49f9b825d0b729c8ee5db12a0f177260cf2c1a9689a25e9a394d360f83fa595c","keys.postiz.placeholder": "56b1a7228075ecbabf95ce87f5df31020cb8a644ce910e545e7eec315cb818d3",- "approval.status.timedOut": "9ebd74ec81556f23997af5d270166afaa3bf7ec4437a99af14f0b258fb2fddcd",+ "approval.status.timedOut": "833f9c81127bdf7f83ee550232973229c1ac16dedbd97d6c0e5040c09825657f","question.somethingElse": "b4768d66031a367906f5b7a0afdb6049db3ea469afeb55f468f3524b2977aa4a","ask.header.asks": "bb065f98972232b5d6b3ca3e367960f6c9800325d39285241f40bc60724c4838","ask.settled.chose": "4c402ce9ea7e79b8d6021991e837bcbe1b0e252c169d7f342fb7f7acbb429dc3",@@ -47078,7 +47078,7 @@"keys.postiz.label": "322df8a3cbeb0f7f4e81ada5151c4f04cddada34f3b2ae76c70d8d43507965a6","keys.purpose.postiz": "49f9b825d0b729c8ee5db12a0f177260cf2c1a9689a25e9a394d360f83fa595c","keys.postiz.placeholder": "56b1a7228075ecbabf95ce87f5df31020cb8a644ce910e545e7eec315cb818d3",- "approval.status.timedOut": "9ebd74ec81556f23997af5d270166afaa3bf7ec4437a99af14f0b258fb2fddcd",+ "approval.status.timedOut": "833f9c81127bdf7f83ee550232973229c1ac16dedbd97d6c0e5040c09825657f","question.somethingElse": "b4768d66031a367906f5b7a0afdb6049db3ea469afeb55f468f3524b2977aa4a","ask.header.asks": "bb065f98972232b5d6b3ca3e367960f6c9800325d39285241f40bc60724c4838","ask.settled.chose": "4c402ce9ea7e79b8d6021991e837bcbe1b0e252c169d7f342fb7f7acbb429dc3",@@ -53476,7 +53476,7 @@"keys.purpose.postiz": "49f9b825d0b729c8ee5db12a0f177260cf2c1a9689a25e9a394d360f83fa595c","keys.postiz.placeholder": "56b1a7228075ecbabf95ce87f5df31020cb8a644ce910e545e7eec315cb818d3","apps.category.social": "f1b7505afa5c9e2bd6d68ae814b3582cf38632d56a67913e75e7d8cb10b5a8a3",- "approval.status.timedOut": "9ebd74ec81556f23997af5d270166afaa3bf7ec4437a99af14f0b258fb2fddcd",+ "approval.status.timedOut": "833f9c81127bdf7f83ee550232973229c1ac16dedbd97d6c0e5040c09825657f","question.somethingElse": "b4768d66031a367906f5b7a0afdb6049db3ea469afeb55f468f3524b2977aa4a","ask.header.asks": "bb065f98972232b5d6b3ca3e367960f6c9800325d39285241f40bc60724c4838","ask.settled.chose": "4c402ce9ea7e79b8d6021991e837bcbe1b0e252c169d7f342fb7f7acbb429dc3",@@ -59957,7 +59957,7 @@"keys.purpose.postiz": "49f9b825d0b729c8ee5db12a0f177260cf2c1a9689a25e9a394d360f83fa595c","keys.postiz.placeholder": "56b1a7228075ecbabf95ce87f5df31020cb8a644ce910e545e7eec315cb818d3","apps.category.social": "f1b7505afa5c9e2bd6d68ae814b3582cf38632d56a67913e75e7d8cb10b5a8a3",- "approval.status.timedOut": "9ebd74ec81556f23997af5d270166afaa3bf7ec4437a99af14f0b258fb2fddcd",+ "approval.status.timedOut": "833f9c81127bdf7f83ee550232973229c1ac16dedbd97d6c0e5040c09825657f","question.somethingElse": "b4768d66031a367906f5b7a0afdb6049db3ea469afeb55f468f3524b2977aa4a","ask.header.asks": "bb065f98972232b5d6b3ca3e367960f6c9800325d39285241f40bc60724c4838","ask.settled.chose": "4c402ce9ea7e79b8d6021991e837bcbe1b0e252c169d7f342fb7f7acbb429dc3",@@ -66232,7 +66232,7 @@"keys.purpose.postiz": "49f9b825d0b729c8ee5db12a0f177260cf2c1a9689a25e9a394d360f83fa595c","keys.postiz.placeholder": "56b1a7228075ecbabf95ce87f5df31020cb8a644ce910e545e7eec315cb818d3","apps.category.social": "f1b7505afa5c9e2bd6d68ae814b3582cf38632d56a67913e75e7d8cb10b5a8a3",- "approval.status.timedOut": "9ebd74ec81556f23997af5d270166afaa3bf7ec4437a99af14f0b258fb2fddcd",+ "approval.status.timedOut": "833f9c81127bdf7f83ee550232973229c1ac16dedbd97d6c0e5040c09825657f","question.somethingElse": "b4768d66031a367906f5b7a0afdb6049db3ea469afeb55f468f3524b2977aa4a","ask.header.asks": "bb065f98972232b5d6b3ca3e367960f6c9800325d39285241f40bc60724c4838","ask.settled.chose": "4c402ce9ea7e79b8d6021991e837bcbe1b0e252c169d7f342fb7f7acbb429dc3",diff --git a/src/state/store.tsx b/src/state/store.tsxindex a986cbbc0e..7dd8964532 100644--- a/src/state/store.tsx+++ b/src/state/store.tsx@@ -73,7 +73,7 @@ import { reconcileSnapshotQueues, rememberConsumedQueueId, replaceBotQueues } frexport type { MausColor } from "@/lib/mascot";export type { RoutineRunCardData } from "../../shared/routine-run";-export interface OptionCardData extends Pick<WireOptionCard, "fixedOptions" | "webhookRequest" | "appTriggerRequest" | "yourComputer" | "stopped"> {+export interface OptionCardData extends Pick<WireOptionCard, "fixedOptions" | "webhookRequest" | "appTriggerRequest" | "yourComputer" | "waitRequest" | "stopped"> {title: string;subtitle: string;options: string[];