Public: anyone can read this; the crew can change it.

A held action asks in the person's words: "Archive marin/cakes.", not a tool name and its arguments #16224

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

talk/fix-ask-in-plain-words → main 0 commits

  • Merged. talk/fix-ask-in-plain-words was merged into main as f9d3a55.

Review

Sign in to review this change.
10 files changed +1172 −113
docs/features/talk.md +1 −1
@@ -24,7 +24,7 @@ On a phone the composer is sticky and lifts above the on-screen keyboard (the sc
2424
2525 A reply streams in over `GET /talk/stream?after=<turn id>` (server-sent events, one `turn` frame per stored turn, each carrying the server-rendered markup, and `live` frames for the block being written, see "Live" below). The stream ends with the turn (`done`), or after 40 seconds (`more`), well inside the edge's timeout; the page then reconnects from the last turn id it saw (`Last-Event-ID` works too). Without the script the composer is a plain form and a reload shows the answer.
2626
27 When the agent asks first (`needs_confirm`), the turn draws **Do it** (the existing yes) and **Not now** (a no: the confirm is spent, nothing runs, a turn says it was cancelled). A result shown once (an invite link) is drawn by Settings → Confirms instead, where Do it leads.
27 When the agent asks first (`needs_confirm`), the turn draws **Do it** (the existing yes) and **Not now** (a no: the confirm is spent, nothing runs, a turn says it was cancelled). The question is one sentence in the person's words, from one form per held tool in `src/crew/conversation_ask.ts` ("Archive marin/cakes.", "File an issue on owner/forge: "…"."): never a tool's name or the arguments in a row, which stay one tap away in Settings → Confirms; the ten-minute limit is the small print under the buttons. A result shown once (an invite link) is drawn by Settings → Confirms instead, where Do it leads.
2828
2929 ## Live
3030
src/actions/conversation_confirms.ts +2 −1
@@ -19,7 +19,8 @@ import { getIssue } from "../core/issues.ts";
1919 import { getRepo } from "../core/repos.ts";
2020 import { answerHeld, countWaiting, HELD_TTL_MS, waitingFor, type YesRefusal } from "../core/fence.ts";
2121 import type { User } from "../core/users.ts";
22 import { argumentsShown, confirmSentence, keptOf, undoOf } from "../crew/conversation_confirm.ts";
22 import { argumentsShown, keptOf, undoOf } from "../crew/conversation_confirm.ts";
23 import { confirmSentence } from "../crew/conversation_ask.ts";
2324 import type { Ctx } from "../http/context.ts";
2425 import { loadMcp } from "../http/mcp/load.ts";
2526 import { INVERSES, readReceipt, receiptOf, stillSo, targetOf, type Seen } from "../crew/receipt.ts";
src/crew/conversation_ask.ts added +324
@@ -0,0 +1,324 @@
1 /**
2 * What a held action asks, in the person's words (#7650, #10262): "Archive marin/cakes.", "File an
3 * issue on owner/forge: "Record forge metrics over time".", never a tool's name, never "call",
4 * never every argument in a row. One form per tool the forge's agent can be held on (the
5 * asked-first list, the fence's undoable list, every write Talk's agent is offered); a tool with
6 * none is said from its catalog description's first sentence and the thing it acts on.
7 * `test/conversation-ask.test.ts` walks the catalog, so a held tool without its form fails.
8 *
9 * The time limit is not in the sentence: the thread's small print says it, where it helps. The
10 * whole call, every argument as it runs, stays one tap away (`argumentsShown`).
11 *
12 * Plain data in, plain data out: values the agent wrote are put on one line, cut to 60, and never
13 * a secret (no form reads one).
14 */
15
16 type Args = Record<string, unknown>;
17
18 /** The words of a call: the start of a sentence, capitalised, without its full stop. */
19 type Form = (a: Args) => string;
20
21 /**
22 * Control, format and line-breaking characters, and backticks: a value the agent wrote cannot start
23 * a new line, reorder the sentence or turn into code.
24 */
25 const UNSAID = /[\p{Cc}\p{Cf}\u2028\u2029`]+/gu;
26
27 /** A string as said back: on one line, plain, cut to 60. */
28 const plain = (v: string): string => {
29 const one = v.replace(UNSAID, " ").replace(/\s+/g, " ").trim();
30 return one.length > 60 ? `${one.slice(0, 60)}…` : one;
31 };
32
33 /** An argument as words: a string plain, a number as written; anything else nothing. */
34 const val = (a: Args, k: string): string => {
35 const v = a[k];
36 return typeof v === "string" ? plain(v) : typeof v === "number" && Number.isFinite(v) ? String(v) : "";
37 };
38
39 /** The first line of a text, quoted: what an issue or comment will say. */
40 const quote = (a: Args, k: string): string => {
41 const v = a[k];
42 const line = typeof v === "string" ? plain(v.trim().split("\n")[0] ?? "") : "";
43 return line === "" ? "" : `"${line}"`;
44 };
45
46 /** ` text` when there is text, else nothing: a clause that is dropped when its value is. */
47 const clause = (before: string, value: string, after = ""): string => (value === "" ? "" : `${before}${value}${after}`);
48
49 /** The number a call names, as "#3", or nothing. */
50 const num = (a: Args): string => {
51 const n = a["number"];
52 return typeof n === "number" && Number.isInteger(n) && n > 0 ? `#${String(n)}` : "";
53 };
54
55 /**
56 * The issue or pull a call names, as "#3 in marin/cakes"; "an issue in …" when it names no number.
57 */
58 const item = (a: Args): string => `${num(a) || "an issue"}${clause(" in ", val(a, "repo"))}`;
59
60 /** "pull #3 in marin/cakes". */
61 const pull = (a: Args): string => `${clause("pull ", num(a)) || "a pull"}${clause(" in ", val(a, "repo"))}`;
62
63 /** The repository a call names, or what to say when it names none. */
64 const repo = (a: Args, none = "the app"): string => val(a, "repo") || none;
65
66 /** A list of strings as words: "a, b and c". */
67 const listed = (v: unknown): string => {
68 const xs = Array.isArray(v) ? v.filter((x): x is string => typeof x === "string").map(plain).filter((x) => x !== "") : [];
69 return xs.length <= 1 ? (xs[0] ?? "") : `${xs.slice(0, -1).join(", ")} and ${xs.at(-1)!}`;
70 };
71
72 const count = (v: unknown, one: string, many: string): string =>
73 Array.isArray(v) ? `${String(v.length)} ${v.length === 1 ? one : many}` : `the ${many}`;
74
75 const dollars = (v: unknown): string => (typeof v === "number" && Number.isFinite(v) ? `$${String(v)}` : "");
76
77 /** "omato's", "marin/cakes'". */
78 const own = (name: string): string => (name.endsWith("s") ? `${name}'` : `${name}'s`);
79
80 const capital = (s: string): string => s.charAt(0).toUpperCase() + s.slice(1);
81
82 /** One word for a verb the call names, from a table; `or` when it is not on it. */
83 const verb = (a: Args, k: string, words: Readonly<Record<string, string>>, or: string): string =>
84 words[String(a[k])] ?? or;
85
86 /** Every form, by tool. */
87 export const ASKED_AS: Readonly<Record<string, Form>> = {
88 // The everyday work, the fence's undoable list first.
89 tell: (a) => {
90 if (a["undo"] !== undefined) return `Take back your request #${val(a, "undo")}${clause(" in ", val(a, "repo"))}`;
91 const said = quote(a, "text");
92 if (val(a, "repo") === "") return `Keep a note for you${clause(": ", said)}`;
93 return `File an issue on ${val(a, "repo")}${clause(": ", said)}`;
94 },
95 say: (a) => {
96 const action = String(a["action"] ?? "");
97 if (action === "build_publish") return "Publish this conversation's build to production";
98 if (action === "build_restore") return `Put this conversation's build back to version ${val(a, "version") || "an earlier version"}`;
99 if (action === "build") return `Build from this conversation${clause(": ", quote(a, "text"))}`;
100 if (action === "new") return `Start a new conversation${clause(" called ", quote(a, "title"))}`;
101 if (action === "rename") return `Rename the conversation${clause(" to ", quote(a, "title"))}`;
102 if (action === "archive") return "Archive the conversation";
103 if (action === "restore") return "Bring the conversation back from the archive";
104 if (val(a, "repo") === "") return `Send the forge's agent a message${clause(": ", quote(a, "text"))}`;
105 return `Comment on ${item(a)}${clause(": ", quote(a, "text"))}`;
106 },
107 branches: (a) =>
108 a["action"] === "delete"
109 ? `Delete the branch ${val(a, "name")} from ${repo(a)}`
110 : `Create the branch ${val(a, "name")} in ${repo(a)}${clause(" from ", val(a, "from"))}`,
111 labels: (a) => {
112 const names = listed(a["labels"]);
113 if (a["action"] === "add") return `Add the label${Array.isArray(a["labels"]) && a["labels"].length > 1 ? "s" : ""} ${names} to ${item(a)}`;
114 if (a["action"] === "remove") return `Take the label${Array.isArray(a["labels"]) && a["labels"].length > 1 ? "s" : ""} ${names} off ${item(a)}`;
115 return names === "" ? `Clear the labels on ${item(a)}` : `Set the labels on ${item(a)} to ${names}`;
116 },
117 assign: (a) => (typeof a["assignee"] === "string" ? `Assign ${item(a)} to ${val(a, "assignee")}` : `Unassign ${item(a)}`),
118 close: (a) =>
119 a["state"] === "open" ? `Reopen ${item(a)}` : `Close ${item(a)}${clause(" as ", verb(a, "reason", { done: "done", dropped: "dropped", split: "split up" }, ""))}`,
120 merge: (a) => `Merge ${pull(a)}`,
121 edit: (a) =>
122 a["title"] !== undefined ? `Retitle ${item(a)}${clause(" to ", quote(a, "title"))}` : `Rewrite the description of ${item(a)}`,
123 review: (a) => (a["verdict"] === "changes" ? `Ask for changes on ${pull(a)}${clause(": ", quote(a, "reason"))}` : `Approve ${pull(a)}`),
124 keep_plan: (a) => `Update the plan on ${item(a)}`,
125 steer: (a) => `Tell crew run ${val(a, "run")}${clause(" in ", val(a, "repo"))}${clause(": ", quote(a, "text"))}`,
126 stop: (a) => (val(a, "run") === "" ? "Stop the forge's agent in the middle of its answer" : `Stop crew run ${val(a, "run")}${clause(" in ", val(a, "repo"))}`),
127 write_file: (a) => `Commit ${val(a, "path") || "a file"} to ${val(a, "branch") || "a branch"} in ${repo(a)}`,
128 open_pull: (a) => `Open a pull in ${repo(a)}${clause(": ", quote(a, "title"))}`,
129 new_app: (a) => `Make a new app${clause(" called ", val(a, "name"))}${clause(": ", quote(a, "sentence"))}`,
130 asks_act: (a) => `${capital(verb(a, "action", { dismiss: "dismiss", decline: "decline", mute: "mute", listen: "unmute", undo: "undo", ship: "ship", close: "close", replan: "replan" }, "decide"))} ${a["action"] === "listen" ? repo(a) : a["action"] === "undo" ? "the last decision on your asks" : count(a["items"], "ask", "asks")}`,
131 asks: () => "Change the filter on what waits on you",
132 knobs: (a) => `Set the crew's ${val(a, "knob") || "knob"} to ${val(a, "value") || "a new value"}${clause(" in ", val(a, "repo"))}`,
133 next_up: (a) => {
134 const to = val(a, "to");
135 const where = to === "top" ? "the top of" : to === "not-now" ? "not now on" : to === "undo" ? "back where it was on" : to.startsWith("after:") ? `after #${to.slice(6)} on` : "a new place on";
136 return `Move #${val(a, "issue")} to ${where} the next-up list of ${val(a, "app") || "the app"}`;
137 },
138 threads: (a) => `${a["resolved"] === false ? "Reopen" : "Resolve"} a review thread on ${pull(a)}`,
139 repo: (a) => `Change the chapters of ${repo(a)}`,
140 apps: (a) => `Bring ${repo(a, "an archived app")} back from the archive`,
141 app_deploy: (a) => {
142 const env = val(a, "env") || "production";
143 const name = val(a, "name");
144 const action = String(a["action"] ?? "redeploy");
145 if (action === "stop") return `Stop ${repo(a)} in ${env}`;
146 if (action === "run_schedule") return `Run ${own(repo(a))} schedule ${name} now`;
147 if (action === "pause_schedule") return `Pause ${own(repo(a))} schedule ${name}`;
148 if (action === "resume_schedule") return `Resume ${own(repo(a))} schedule ${name}`;
149 if (action === "cancel_job") return `Cancel ${own(repo(a))} job ${name}`;
150 if (action === "retry_job") return `Try ${own(repo(a))} job ${name} again`;
151 return `Publish ${repo(a)} to ${env} again`;
152 },
153 // Release and rollback.
154 rollback: (a) => `Roll the forge back to ${val(a, "sha") === "" ? "the last kept release" : `release ${val(a, "sha").slice(0, 12)}`}`,
155 release_hold: (a) => (a["lift"] !== undefined ? `Lift release hold ${val(a, "lift")}` : `Hold the forge's releases${clause(": ", quote(a, "reason"))}`),
156 release_now: (a) => `Cut a release of the forge now, outside the usual spacing${clause(": ", quote(a, "reason"))}`,
157 drop: (a) =>
158 a["action"] === "remove"
159 ? `Remove ${val(a, "name") || "a file"} from ${own(repo(a))} private files`
160 : `Put ${val(a, "name") || "a file"} in ${own(repo(a))} private files`,
161 // Archive and delete.
162 archive: (a) => {
163 const what = val(a, "repo") || count(a["repos"], "repository", "repositories");
164 return a["archived"] === false ? `Wake ${what} from the archive` : `Archive ${what}`;
165 },
166 board_delete: (a) => `Delete the board ${val(a, "slug")}`,
167 flow: (a) => `Apply ${val(a, "action") || "an operation"} to every row of the fleet query${clause(" ", quote(a, "q"))}`,
168 subscription_delete: (a) => `Remove the Claude subscription ${val(a, "id")} and its grants`,
169 // Money.
170 subscription_add: (a) => `Add the Claude login ${val(a, "name")} to the crew's pool`,
171 subscription_budget: (a) =>
172 a["usd"] === null ? `Clear subscription ${own(val(a, "id"))} lifetime budget` : `Set subscription ${own(val(a, "id"))} lifetime budget to ${dollars(a["usd"])}`,
173 subscription_headroom: (a) => `Leave ${val(a, "percent")}% of each window of subscription ${val(a, "id")} for people`,
174 subscription_wake: (a) => `Use the resting subscription ${val(a, "id")} again now`,
175 model_grant: (a) =>
176 a["usdPerMonth"] === 0 ? `Take back ${own(val(a, "username"))} monthly model grant` : `Give ${val(a, "username")} ${dollars(a["usdPerMonth"])} a month for models`,
177 model_ceiling: (a) => {
178 const caps = [clause("", dollars(a["dailyUsd"]), " a day"), clause("", dollars(a["perRunUsd"]), " a run")].filter((x) => x !== "").join(" and ");
179 return caps === "" ? `Clear ${own(val(a, "username"))} model spend caps` : `Cap ${own(val(a, "username"))} model spend at ${caps}`;
180 },
181 limits: (a) =>
182 a["value"] === "" ? `Put the forge's limit ${val(a, "key")} back to its default` : `Set the forge's limit ${val(a, "key")} to ${val(a, "value")}`,
183 held: (a) => `Close ${count(a["apply"], "issue", "issues")} the Later gate review proposed to close${clause(" in ", val(a, "app"))}`,
184 // Secrets and credentials.
185 secrets: (a) =>
186 a["action"] === "remove"
187 ? `Remove the sealed secret ${val(a, "name")}${clause(" of ", val(a, "ref"))}`
188 : `Set the sealed secret ${val(a, "name")}${clause(" for ", val(a, "ref"))}`,
189 app_env: (a) => {
190 const what = a["kind"] === "secret" ? "secret" : "variable";
191 const scope = clause(" (", val(a, "scope"), ")");
192 return a["action"] === "unset" ? `Remove the ${what} ${val(a, "name")} from ${repo(a)}${scope}` : `Set the ${what} ${val(a, "name")} for ${repo(a)}${scope}`;
193 },
194 features: (a) =>
195 a["absorb"] === true
196 ? `Make ${val(a, "slug")} part of the forge`
197 : a["absorb"] === false
198 ? `Take ${val(a, "slug")} out of the forge's features`
199 : `Change the settings of the forge feature ${val(a, "slug")}`,
200 proposal_tokens: (a) =>
201 a["verb"] === "revoke"
202 ? `Revoke the child forge credential ${val(a, "id")}`
203 : `Make a propose-only credential for the child forge ${val(a, "child")}`,
204 mint_invite: (a) => `Make a single-use invite link, good for ${val(a, "days") || "7"} days`,
205 claim_link: (a) =>
206 a["action"] === "revoke"
207 ? `End the claim link of ${val(a, "name")}`
208 : a["action"] === "undo"
209 ? `Bring back the old claim link of ${val(a, "name")}`
210 : `Make a new claim link for ${val(a, "name")}, ending the old one`,
211 ssh_keys: (a) => (a["action"] === "remove" ? `Remove SSH key ${val(a, "id")} from your account` : `Add the SSH key${clause(" ", quote(a, "title"))} to your account`),
212 // Reach and trust.
213 land_past_gate: (a) => `Land ${pull(a)} past its broken gate${clause(": ", quote(a, "reason"))}`,
214 share: (a) => `Share feed item ${val(a, "item")} with ${Array.isArray(a["to"]) ? "your followers" : "the app's crew and owners"}`,
215 invites: (a) => `Revoke invite link ${val(a, "id")}`,
216 egress_grants: (a) =>
217 a["op"] === "revoke" ? `Stop ${repo(a)} reaching ${val(a, "destination")}` : `Let ${repo(a)} reach ${val(a, "destination")}`,
218 sever: (a) => `Unlink ${repo(a)} from where it came from`,
219 parent_unlink: () => "Stop signing in through the parent forge",
220 quotas: (a) => `Set the ${val(a, "key")} quota to ${val(a, "value")}`,
221 spawn: (a) => `Start a child forge${clause(" called ", val(a, "name"))}`,
222 app_data_import: (a) => `Load a SQL dump into ${own(repo(a))} ${val(a, "env") || "production"} database${a["replace"] === true ? ", replacing what is there" : ""}`,
223 migrate_data: (a) =>
224 a["undo"] === true ? `Take back the data import into ${repo(a)}` : `Load ${val(a, "dump") || "the dump"} from ${own(repo(a))} private files into its database`,
225 converge: (a) => `Have ${own(repo(a))} crew merge its parent's updates`,
226 forges: (a) =>
227 a["revoke"] !== undefined
228 ? `Revoke the gift code ${val(a, "revoke")}`
229 : a["code"] !== undefined
230 ? "Make a gift code for a forge"
231 : `Put the forge ${val(a, "forge")} on the ${val(a, "plan")} plan`,
232 origins: (a) => (a["action"] === "hosts" ? `Replace the internal hosts origin ${val(a, "id")} may live on` : `Sync origin ${val(a, "id")} now`),
233 cloud_account: (a) => {
234 const which = `the ${val(a, "provider")} account ${val(a, "name")}`.replace("the account", "the account");
235 const verbs: Record<string, string> = {
236 attach: `Attach ${which}`,
237 verify: `Check ${which}`,
238 rotate: `Change the credential of ${which}`,
239 rename: `Rename ${which}${clause(" to ", val(a, "to"))}`,
240 remove: `Remove ${which}`,
241 allow_writes: a["allowed"] === false ? `Stop the forge writing with ${which}` : `Let the forge write with ${which}`,
242 audit: `Audit ${which}`,
243 };
244 return verbs[String(a["verb"])] ?? `Change ${which}`;
245 },
246 pinned_forge: (a) =>
247 `${verb(a, "verb", { deploy: "Deploy", update: "Update", rollback: "Roll back", check: "Check" }, "Change")} the pinned forge ${val(a, "name")}${clause(" on ", val(a, "target"))}`,
248 outsiders: (a) =>
249 a["on"] === false
250 ? `Stop people who cannot write to ${repo(a)} from directing its crew`
251 : `Let people who cannot write to ${repo(a)} direct its crew`,
252 seal: (a) => (a["sealed"] === false ? `Unseal ${item(a)}` : `Seal ${item(a)}, so only writers and the crew see it`),
253 migrate: (a) => `Bring in the repository at ${val(a, "url")}${clause(" as ", val(a, "name"))}`,
254 account_suspend: (a) => (a["suspended"] === false ? `Lift ${own(val(a, "username"))} suspension` : `Suspend ${val(a, "username")}`),
255 account_access: (a) =>
256 a["action"] === "end_sessions" || a["endSessions"] === true ? `Sign ${val(a, "username")} out everywhere` : `Reset ${own(val(a, "username"))} access with a one-time link`,
257 account_role: (a) => `Make ${val(a, "username")} a ${val(a, "role") || "member"}`,
258 // Every admin-scope tool.
259 agent: (a) => `${verb(a, "action", { create: "Create", update: "Change", remove: "Remove" }, "Change")} the crew agent ${val(a, "username")}`,
260 app_domains: (a) => {
261 const host = val(a, "host");
262 const act = String(a["action"] ?? "");
263 if (act.startsWith("dns_")) return `Change the DNS of ${host} for ${repo(a)}`;
264 return `${verb(a, "action", { add: "Add", check: "Check", keep: "Keep", remove: "Remove" }, "Change")} the domain ${host} ${act === "remove" ? "from" : "for"} ${repo(a)}`;
265 },
266 backups_destination: (a) => (a["action"] === "forget" ? "Forget where snapshots go" : `Send the forge's snapshots to ${val(a, "bucket") || "a new place"}`),
267 backups_test: () => "Test where the forge's snapshots go",
268 hooks: (a) => {
269 if (a["action"] === "add") return `Add a webhook to ${repo(a)} that posts to ${val(a, "url")}`;
270 if (a["action"] === "remove") return `Remove webhook ${val(a, "id")} from ${repo(a)}`;
271 if (a["action"] === "redeliver") return `Send delivery ${val(a, "delivery")} of ${own(repo(a))} webhook again`;
272 return `${verb(a, "action", { ping: "Ping", pause: "Pause", resume: "Resume" }, "Change")} webhook ${val(a, "id")} of ${repo(a)}`;
273 },
274 mirror_now: () => "Bring the off-box snapshot mirror level now",
275 mirror_set: (a) => (a["action"] === "forget" ? "Forget the off-box snapshot mirror" : `Mirror the forge's snapshots to ${val(a, "bucket") || "a new place"}`),
276 org_teams: (a) => {
277 const team = `${own(val(a, "org"))} team ${val(a, "team")}`;
278 if (a["action"] === "create") return `Create ${team}`;
279 if (a["action"] === "add_member") return `Add ${val(a, "user")} to ${team}`;
280 if (a["action"] === "remove_member") return `Take ${val(a, "user")} off ${team}`;
281 return `Remove ${team}`;
282 },
283 prompts: (a) =>
284 a["action"] === "run"
285 ? `Run prompt source ${val(a, "id")} of ${repo(a)}`
286 : a["action"] === "remove"
287 ? `Remove prompt source ${val(a, "id")} from ${repo(a)}`
288 : `Add a prompt source${clause(" (", val(a, "kind"), ")")} to ${repo(a)}`,
289 repo_settings: (a) => {
290 if (a["newOwner"] !== undefined) return `Move ${repo(a)} to ${val(a, "newOwner")}`;
291 if (a["name"] !== undefined) return `Rename ${repo(a)} to ${val(a, "name")}`;
292 if (a["visibility"] !== undefined) return `Make ${repo(a)} ${val(a, "visibility")}`;
293 if (a["description"] !== undefined) return `Change ${own(repo(a))} description${clause(" to ", quote(a, "description"))}`;
294 return `Change ${own(repo(a))} settings`;
295 },
296 sessions: (a) => (a["action"] === "end_idle" ? "Sign out the browsers you have not used lately" : `Sign browser ${val(a, "id")} out`),
297 telemetry_grant: (a) =>
298 a["on"] === false ? `Take back ${own(val(a, "agent"))} reading of the forge's telemetry` : `Let ${val(a, "agent")} read the forge's telemetry`,
299 };
300
301 /** The forge's own words, so longer than an argument may be. */
302 const DESCRIBED_MAX = 120;
303
304 /**
305 * A tool with no form: its description's first clause, without code marks, asides or field names,
306 * and what it acts on.
307 */
308 function described(tool: string, args: Args, description: string): string {
309 const unaside = description.replace(/\s*\([^)]*\)/g, "");
310 const first = (unaside.split(/(?<=[.;:!?])\s/)[0] ?? "").replace(/[.;:!?]$/, "");
311 const bare = first.replace(/`([^`]*)`/g, "$1").replaceAll("_", " ").replace(UNSAID, " ").replace(/\s+/g, " ").trim();
312 const words = (bare.length > DESCRIBED_MAX ? `${bare.slice(0, DESCRIBED_MAX)}…` : bare) || capital(tool.replaceAll("_", " "));
313 return `${words}${clause(", on ", val(args, "repo"), num(args))}`;
314 }
315
316 /**
317 * The one sentence the person reads before saying yes: what will happen, as they would say it.
318 * `description` is the tool's catalog line, said for a tool with no form of its own.
319 */
320 export function confirmSentence(tool: string, args: Args, description = ""): string {
321 const form = ASKED_AS[tool];
322 const said = (form === undefined ? described(tool, args, description) : form(args)).replace(/\s+/g, " ").trim();
323 return /[.!?]$/.test(said) ? said : `${said}.`;
324 }
src/crew/conversation_confirm.ts +50 −93
@@ -14,9 +14,11 @@ import { HELD_TTL_MS, type Work } from "../core/fence.ts";
1414
1515 type Args = Record<string, unknown>;
1616
17 /**
18 * What a tool on the asked-first list asks; what it does, in words, is its form in
19 * `crew/conversation_ask.ts`.
20 */
1721 export interface Asking {
18 /** What it does, as the start of a sentence: "roll the forge back to a kept release". */
19 readonly does: string;
2022 /** Which calls ask; absent, every call that writes. */
2123 readonly asks?: (args: Args) => boolean;
2224 /** How it is undone, when it can be: said on the result turn. */
@@ -43,49 +45,43 @@ const not =
4345 */
4446 export const ASKING: Readonly<Record<string, Asking>> = {
4547 // Release and rollback.
46 rollback: { does: "roll the forge back to a kept release", undo: () => "`rollback` to the release that was live rolls it forward again" },
48 rollback: { undo: () => "`rollback` to the release that was live rolls it forward again" },
4749 release_hold: {
48 does: "hold or lift the release keeper",
4950 undo: (a) => (a["reason"] !== undefined ? "`release_hold` with `lift` and the hold's id lifts it" : undefined),
5051 },
51 release_now: { does: "cut a release now, outside the spacing" },
52 release_now: {},
5253 // A file in an app's private drop: kept or removed (#645).
5354 drop: {
54 does: "put a file in an app's drop or remove one",
5555 asks: (a) => a["action"] === "put" || a["action"] === "remove",
5656 },
5757 // Archive and delete.
5858 archive: {
59 does: "archive or wake a repository",
6059 undo: (a) => `\`archive\` with \`archived: ${a["archived"] === false}\` turns it back`,
6160 },
62 board_delete: { does: "delete a board" },
61 board_delete: {},
6362 // One action over every row a fleet query selects (#450); only `apply: true` writes.
6463 flow: {
65 does: "apply a fleet operation to every row its query selects",
6664 undo: () => "`limb` with `action: undo` and the receipt's id reverts it for 24 hours",
6765 },
68 subscription_delete: { does: "remove a Claude subscription and its grants" },
66 subscription_delete: {},
6967 // Money: subscriptions, budgets, grants and limits.
70 subscription_add: { does: "add a Claude login to the crew's pool", undo: () => "`subscription_delete` with its id removes it" },
71 subscription_budget: { does: "set a subscription's lifetime budget", undo: () => "`subscription_budget` with the old `usd` sets it back" },
72 subscription_headroom: { does: "set the share of each window the crew leaves for people" },
73 subscription_wake: { does: "use a resting subscription again now" },
74 model_grant: { does: "give an account a monthly model grant", undo: () => "`model_grant` with `usdPerMonth: 0` takes it back" },
75 model_ceiling: { does: "cap an account's model spend", undo: () => "`model_ceiling` with both `null` clears it" },
76 limits: { does: "change one of the forge's limits", undo: () => "`limits` with `value: \"\"` restores the default" },
68 subscription_add: { undo: () => "`subscription_delete` with its id removes it" },
69 subscription_budget: { undo: () => "`subscription_budget` with the old `usd` sets it back" },
70 subscription_headroom: {},
71 subscription_wake: {},
72 model_grant: { undo: () => "`model_grant` with `usdPerMonth: 0` takes it back" },
73 model_ceiling: { undo: () => "`model_ceiling` with both `null` clears it" },
74 limits: { undo: () => "`limits` with `value: \"\"` restores the default" },
7775 // Closing the Later gate's unchosen ideas in one go; reading its proposal asks nothing.
7876 held: {
79 does: "close the issues the Later gate review proposed to close",
8077 asks: (a) => a["apply"] !== undefined,
8178 undo: () => "`lift` on each issue revives it",
8279 },
8380 // Secrets and credentials.
84 secrets: { does: "set or remove a sealed secret", asks: not("action", "list") },
85 app_env: { does: "set or unset an app's variable", asks: not("action", "list") },
81 secrets: { asks: not("action", "list") },
82 app_env: { asks: not("action", "list") },
8683 // Absorbing restarts the app and changes the forge's menu for its readers.
8784 features: {
88 does: "absorb or un-absorb an app as a forge feature, or change its settings",
8985 asks: (a) => a["absorb"] !== undefined || a["settings"] !== undefined,
9086 undo: (a) =>
9187 a["absorb"] === true
@@ -95,64 +91,58 @@ export const ASKING: Readonly<Record<string, Asking>> = {
9591 : "`features` with the old values sets them back",
9692 },
9793 proposal_tokens: {
98 does: "mint or revoke a child forge's propose-only credential",
9994 asks: not("verb", "list"),
10095 once: "The credential was shown once, to you, and is not kept here.",
10196 },
102 mint_invite: { does: "mint a single-use invite link", once: "The invite link was shown once, to you, and is not kept here." },
97 mint_invite: { once: "The invite link was shown once, to you, and is not kept here." },
10398 claim_link: {
104 does: "make a new claim link for a child forge, ending the old one",
10599 once: "The claim link was shown once, to you, and is not kept here.",
106100 },
107101 ssh_keys: {
108 does: "add or remove one of your SSH keys",
109102 asks: not("action", "list"),
110103 undo: (a) => (a["action"] === "add" ? "`ssh_keys` with `action: \"remove\"` and its id removes it" : undefined),
111104 },
112105 // Reach and trust: who may see, enter, deploy, stop or be linked to (#8230).
113 land_past_gate: { does: "land a pull past a broken gate" },
114 share: { does: "share a feed item with followers or the app's crew" },
115 invites: { does: "revoke an invite link", asks: (a) => a["action"] !== "list" },
116 egress_grants: { does: "grant or revoke an app's private destination", asks: not("op", "list") },
117 sever: { does: "unlink a spawned forge from its parent" },
118 parent_unlink: { does: "unlink parent-forge sign-in" },
119 quotas: { does: "change an account's quotas" },
120 spawn: { does: "spawn a child forge" },
121 app_data_import: { does: "load a SQL dump into an app's database" },
122 migrate_data: { does: "load a dump from an app's drop into its database, or take that import back", asks: (a) => a["apply"] === true || a["undo"] === true },
123 app_deploy: { does: "redeploy or stop an app's production or preview" },
124 stop: { does: "stop a crew run" },
125 converge: { does: "have a fork's crew merge the parent's updates" },
126 forges: { does: "grant a forge a plan by hand, or make or revoke a gift code", asks: (a) => (a["plan"] !== undefined || a["code"] !== undefined || a["revoke"] !== undefined) && a["dryRun"] === false },
127 origins: { does: "sync an origin or replace the internal hosts one may live on", asks: not("action", "list", "repos") },
128 cloud_account: { does: "change a cloud account" },
129 pinned_forge: { does: "deploy, update or roll back a pinned forge on the owner's cloud", asks: not("verb", "list") },
130 outsiders: { does: "let non-writers direct an app's crew, or stop them" },
131 seal: { does: "seal or unseal an issue or pull" },
132 migrate: { does: "bring a repository in from a public address" },
133 account_suspend: { does: "suspend an account or lift its suspension" },
106 land_past_gate: {},
107 share: {},
108 invites: { asks: (a) => a["action"] !== "list" },
109 egress_grants: { asks: not("op", "list") },
110 sever: {},
111 parent_unlink: {},
112 quotas: {},
113 spawn: {},
114 app_data_import: {},
115 migrate_data: { asks: (a) => a["apply"] === true || a["undo"] === true },
116 app_deploy: {},
117 stop: {},
118 converge: {},
119 forges: { asks: (a) => (a["plan"] !== undefined || a["code"] !== undefined || a["revoke"] !== undefined) && a["dryRun"] === false },
120 origins: { asks: not("action", "list", "repos") },
121 cloud_account: {},
122 pinned_forge: { asks: not("verb", "list") },
123 outsiders: {},
124 seal: {},
125 migrate: {},
126 account_suspend: {},
134127 account_access: {
135 does: "reset a person's access with a one-time link, or sign them out",
136128 once: "The link was shown once, to you, and is not kept here.",
137129 },
138 account_role: { does: "make a person a member or a guest" },
130 account_role: {},
139131 // Every admin-scope tool.
140 agent: { does: "create, change or remove a crew agent" },
141 app_domains: { does: "add, check or remove an app's domain" },
142 backups_destination: { does: "set or forget where snapshots go" },
143 backups_test: { does: "test the snapshot destination" },
144 hooks: { does: "add or remove a repository's webhook" },
145 mirror_now: { does: "bring the off-box snapshot mirror level now" },
146 mirror_set: { does: "set or forget the off-box snapshot mirror" },
147 org_teams: { does: "create, fill or remove an organization's team" },
148 prompts: { does: "add, run or remove an app's prompt source" },
132 agent: {},
133 app_domains: {},
134 backups_destination: {},
135 backups_test: {},
136 hooks: {},
137 mirror_now: {},
138 mirror_set: {},
139 org_teams: {},
140 prompts: {},
149141 repo_settings: {
150 does: "change a repository's description or visibility",
151142 undo: () => "`repo_settings` with the old values sets them back",
152143 },
153 sessions: { does: "list your sign-ins or sign a browser out" },
144 sessions: {},
154145 telemetry_grant: {
155 does: "grant or take back an agent's telemetry:read",
156146 undo: (a) => `\`telemetry_grant\` with \`on: ${a["on"] === false}\` turns it back`,
157147 },
158148 };
@@ -230,30 +220,6 @@ const SECRET_VALUE: ReadonlySet<string> = new Set(["secrets", "app_env", "cloud_
230220 const secretArg = (tool: string, k: string, top: boolean): boolean =>
231221 SECRET.test(k) || (top && k === "value" && SECRET_VALUE.has(tool));
232222
233 /**
234 * Control, format and line-breaking characters: an argument the agent wrote cannot start a new line
235 * or reorder the sentence.
236 */
237 const UNSAID = /[\p{Cc}\p{Cf}\u2028\u2029]+/gu;
238
239 /** A string as said back: on one line, plain, cut to 60. */
240 const plain = (v: string): string => {
241 const one = v.replace(UNSAID, " ").trim();
242 return one.length > 60 ? `${one.slice(0, 60)}…` : one;
243 };
244
245 /**
246 * One argument as said back: scalars as written (strings plain, cut to 60), a secret hidden,
247 * anything else counted.
248 */
249 function said(tool: string, k: string, v: unknown): string {
250 const name = plain(k);
251 if (secretArg(tool, k, true)) return `${name} (hidden)`;
252 if (typeof v === "string") return `${name} ${plain(v)}`;
253 if (typeof v === "number" || typeof v === "boolean" || v === null) return `${name} ${String(v)}`;
254 return Array.isArray(v) ? `${name} (${v.length})` : `${name} (…)`;
255 }
256
257223 /** Most keys an object may hold, and how long one key, in a call that asks first. */
258224 const KEYS_MAX = 30;
259225 const KEY_CHARS_MAX = 100;
@@ -300,15 +266,6 @@ export function argumentsShown(tool: string, args: Args): string {
300266 return escaped(JSON.stringify(hide(args, true), null, 2) ?? "{}");
301267 }
302268
303 /** The one sentence the person reads before saying yes. */
304 export function confirmSentence(tool: string, args: Args): string {
305 const does = ASKING[tool]?.does ?? `call \`${tool}\``;
306 const given = Object.entries(args)
307 .filter(([k]) => k !== "dryRun")
308 .map(([k, v]) => said(tool, k, v));
309 return `This will ${does} (\`${tool}\`${given.length === 0 ? "" : `: ${given.join(", ")}`}) as you, once you say yes within 10 minutes.`;
310 }
311
312269 /** Undos of writes that do not ask first but may be held by the fence and done on a yes. */
313270 const UNDONE: Readonly<Record<string, (args: Args) => string | undefined>> = {
314271 close: (a) => (a["state"] === "open" ? undefined : "`close` with `state: \"open\"` reopens it"),
src/http/mcp/shared.ts +7 −6
@@ -15,7 +15,8 @@ import { BOARD_NOT_SAVED } from "../../actions/board_words.ts";
1515 import { askedFor, fence, fenceTag, fenceUp, hold, named, readFenced } from "../../core/fence.ts";
1616 import { appendTurn, conversationOfVia, proposalBefore } from "../../core/conversations.ts";
1717 import { writesThisTurn } from "../../core/conversation_writes.ts";
18 import { asksFirst, confirmSentence, tooBigToApprove, undoableWork } from "../../crew/conversation_confirm.ts";
18 import { asksFirst, tooBigToApprove, undoableWork } from "../../crew/conversation_confirm.ts";
19 import { confirmSentence } from "../../crew/conversation_ask.ts";
1920
2021 export type Args = Record<string, unknown>;
2122 export type Answer =
@@ -138,12 +139,12 @@ export const NEEDS_CONFIRM =
138139 export const ASKED_WRITES_MAX = 8;
139140
140141 /** The confirm a held call draws in the person's thread, with its buttons; its sentence. */
141 function drawConfirm(ctx: Ctx, user: User, via: string, confirm: string, tool: string, args: Args): string {
142 const does = confirmSentence(tool, args);
142 function drawConfirm(ctx: Ctx, user: User, via: string, confirm: string, tool: ToolShape, args: Args): string {
143 const does = confirmSentence(tool.name, args, tool.description);
143144 const conversation = conversationOfVia(ctx.app.db, user.id, via);
144145 appendTurn(ctx.app.db, user.id, conversation.id, {
145146 role: "confirm",
146 text: JSON.stringify({ confirm, tool, does }),
147 text: JSON.stringify({ confirm, tool: tool.name, does }),
147148 });
148149 return does;
149150 }
@@ -176,7 +177,7 @@ export function heldWrite(ctx: Ctx, user: User, tool: ToolShape, args: Args): Re
176177 if (tooBigToApprove(args)) return tooBig(tool.name);
177178 // Past the cap nothing more is kept, and the agent is told the same.
178179 const confirm = hold(ctx.app.db, via, user.id, tool.name, args);
179 const does = confirm === null ? {} : { does: drawConfirm(ctx, user, via, confirm, tool.name, args) };
180 const does = confirm === null ? {} : { does: drawConfirm(ctx, user, via, confirm, tool, args) };
180181 return {
181182 content: [
182183 {
@@ -244,7 +245,7 @@ export function askedFirst(ctx: Ctx, user: User, tool: ToolShape, args: Args): R
244245 if (!short && (!tool.writes || plansOnly(tool, args) || !asksFirst(tool.name, args))) return undefined;
245246 if (tooBigToApprove(args)) return tooBig(tool.name);
246247 const confirm = hold(ctx.app.db, via, user.id, tool.name, args);
247 const does = confirm === null ? "" : drawConfirm(ctx, user, via, confirm, tool.name, args);
248 const does = confirm === null ? "" : drawConfirm(ctx, user, via, confirm, tool, args);
248249 return {
249250 content: [
250251 {
src/web/pages/talk.ts +4 −1
@@ -156,6 +156,9 @@ function receiptCard(id: string, turnId: string, receipt: Receipt, at: string, s
156156 */
157157 export const ASK_AGAIN = "That ran out before I answered. Ask me again.";
158158
159 /** The small print under a held action: the time limit, said where it helps. */
160 export const WAITS = "Nothing is done until you answer. This waits ten minutes.";
161
159162 /** A confirm past its time, said in the thread, with the one way on. */
160163 const ranOut = (conversationId: string): Html => html`<p class="muted small">Nothing was done: this ran out after ten minutes without an answer.</p>
161164 <form method="post" action="${HERE}/${conversationId}">
@@ -260,7 +263,7 @@ export function turnHtml(turn: Turn, waiting: ReadonlySet<string>, cost?: Spend,
260263 ${turn.replaced
261264 ? html`<p class="muted small">Replaced.</p>`
262265 : waiting.has(confirm)
263 ? confirmButtons(confirm, tool)
266 ? html`${confirmButtons(confirm, tool)}<p class="muted small">${WAITS}</p>`
264267 : expired.has(confirm)
265268 ? ranOut(turn.conversationId)
266269 : html`<p class="muted small">Answered.</p>`}
test/confirms-language.test.ts +3 −2
@@ -43,7 +43,8 @@ afterAll(async () => {
4343 });
4444
4545 test("an empty queue says so in one line, no card", async () => {
46 const m = main(await (await get("/settings/confirms", admin)).text());
46 // Someone nobody has asked anything: in any order, the waiting test's confirm is alice's.
47 const m = main(await (await get("/settings/confirms", plain)).text());
4748 expect(m).not.toContain('class="card');
4849 expect(m).toMatch(/<section class="settings-block" id="waiting">\s*<h2>Waiting for you<\/h2>/);
4950 expect(m).toContain("Nothing waiting");
@@ -61,7 +62,7 @@ test("a waiting ask is a row in a .list with its same-origin Yes form", async ()
6162 expect(m).not.toContain('class="card');
6263 expect(m).toMatch(/<section class="settings-block" id="waiting">\s*<h2>Waiting for you<\/h2>/);
6364 expect(m).toMatch(/<ul class="list[^"]*" id="confirms-list">/);
64 expect(m).toContain("archive or wake a repository");
65 expect(m).toContain(`Archive ${repo}.`);
6566 expect(m).toMatch(new RegExp(`<form class="row-actions" method="post" action="/settings/confirms/${asked.needs_confirm}">`));
6667 expect(m).not.toContain("Nothing waiting");
6768 // another person's page lists none of it
test/conversation-ask.test.ts added +765
@@ -0,0 +1,765 @@
1 /**
2 * A held action is asked in the person's words (#7650, #10262): one form per tool the forge's agent
3 * can be held on, never a tool's name, never "call", never the arguments in a row, and never the
4 * clock (the thread's small print says that). The catalog is walked, so a new held tool without
5 * its form fails here, and every other write still reads as words.
6 */
7
8 import { describe, expect, test } from "bun:test";
9 import { ASKED_AS, confirmSentence } from "../src/crew/conversation_ask.ts";
10 import { ASKING, UNDOABLE } from "../src/crew/conversation_confirm.ts";
11 import { TALK_TOOLS } from "../src/http/mcp/catalog.ts";
12 import { TOOLS } from "../src/http/mcp/tools.ts";
13
14 /** Every form, said: a tool, a call of it, and the sentence the person reads. */
15 const SAID: readonly (readonly [string, Record<string, unknown>, string])[] = [
16 [
17 "tell",
18 {
19 repo: "owner/forge",
20 text: "Record forge metrics over time so the forge can draw graphs\nThe health read gives only a snapshot",
21 },
22 'File an issue on owner/forge: "Record forge metrics over time so the forge can draw graphs".',
23 ],
24 [
25 "tell",
26 { text: "Record forge metrics over time" },
27 'Keep a note for you: "Record forge metrics over time".',
28 ],
29 [
30 "tell",
31 { repo: "marin/cakes", undo: 4 },
32 "Take back your request #4 in marin/cakes.",
33 ],
34 [
35 "say",
36 { repo: "marin/cakes", number: 3, text: "Looks good to me" },
37 'Comment on #3 in marin/cakes: "Looks good to me".',
38 ],
39 ["say", { text: "hello" }, 'Send the forge\'s agent a message: "hello".'],
40 [
41 "say",
42 { action: "build_publish", conversation: "c1" },
43 "Publish this conversation's build to production.",
44 ],
45 [
46 "say",
47 { action: "build_restore", conversation: "c1", version: 2 },
48 "Put this conversation's build back to version 2.",
49 ],
50 [
51 "say",
52 { action: "rename", title: "Cakes" },
53 'Rename the conversation to "Cakes".',
54 ],
55 [
56 "branches",
57 { repo: "marin/cakes", name: "frosting", action: "create", from: "main" },
58 "Create the branch frosting in marin/cakes from main.",
59 ],
60 [
61 "branches",
62 { repo: "marin/cakes", name: "frosting", action: "delete" },
63 "Delete the branch frosting from marin/cakes.",
64 ],
65 [
66 "labels",
67 { repo: "marin/cakes", number: 3, labels: ["bug", "ui"], action: "add" },
68 "Add the labels bug and ui to #3 in marin/cakes.",
69 ],
70 [
71 "labels",
72 { repo: "marin/cakes", number: 3, labels: ["bug"], action: "remove" },
73 "Take the label bug off #3 in marin/cakes.",
74 ],
75 [
76 "labels",
77 { repo: "marin/cakes", number: 3, labels: [] },
78 "Clear the labels on #3 in marin/cakes.",
79 ],
80 [
81 "assign",
82 { repo: "marin/cakes", number: 3, kind: "issue", assignee: "omato" },
83 "Assign #3 in marin/cakes to omato.",
84 ],
85 [
86 "assign",
87 { repo: "marin/cakes", number: 3, kind: "issue", assignee: null },
88 "Unassign #3 in marin/cakes.",
89 ],
90 [
91 "close",
92 { repo: "marin/cakes", number: 3, reason: "done" },
93 "Close #3 in marin/cakes as done.",
94 ],
95 [
96 "close",
97 { repo: "marin/cakes", number: 3, state: "open" },
98 "Reopen #3 in marin/cakes.",
99 ],
100 [
101 "merge",
102 { repo: "marin/cakes", number: 7 },
103 "Merge pull #7 in marin/cakes.",
104 ],
105 [
106 "edit",
107 { repo: "marin/cakes", number: 3, title: "Sprinkles on top" },
108 'Retitle #3 in marin/cakes to "Sprinkles on top".',
109 ],
110 [
111 "edit",
112 { repo: "marin/cakes", number: 3, body: "x" },
113 "Rewrite the description of #3 in marin/cakes.",
114 ],
115 [
116 "review",
117 { repo: "marin/cakes", number: 7, verdict: "approve" },
118 "Approve pull #7 in marin/cakes.",
119 ],
120 [
121 "review",
122 {
123 repo: "marin/cakes",
124 number: 7,
125 verdict: "changes",
126 reason: "The button is cut off",
127 },
128 'Ask for changes on pull #7 in marin/cakes: "The button is cut off".',
129 ],
130 [
131 "keep_plan",
132 { repo: "marin/cakes", number: 3, items: [] },
133 "Update the plan on #3 in marin/cakes.",
134 ],
135 [
136 "steer",
137 { repo: "marin/cakes", run: "r1", text: "use the blue" },
138 'Tell crew run r1 in marin/cakes: "use the blue".',
139 ],
140 [
141 "stop",
142 { repo: "marin/cakes", run: "r1" },
143 "Stop crew run r1 in marin/cakes.",
144 ],
145 ["stop", {}, "Stop the forge's agent in the middle of its answer."],
146 [
147 "write_file",
148 {
149 repo: "marin/cakes",
150 branch: "frosting",
151 path: "src/app.ts",
152 content: "x",
153 },
154 "Commit src/app.ts to frosting in marin/cakes.",
155 ],
156 [
157 "open_pull",
158 { repo: "marin/cakes", title: "Frosting", head: "frosting" },
159 'Open a pull in marin/cakes: "Frosting".',
160 ],
161 [
162 "new_app",
163 { name: "cakes", sentence: "A shop for cakes" },
164 'Make a new app called cakes: "A shop for cakes".',
165 ],
166 ["asks_act", { action: "dismiss", items: ["a", "b"] }, "Dismiss 2 asks."],
167 ["asks", { filter: "clear" }, "Change the filter on what waits on you."],
168 [
169 "knobs",
170 { knob: "budget", value: "20", repo: "marin/cakes" },
171 "Set the crew's budget to 20 in marin/cakes.",
172 ],
173 [
174 "next_up",
175 { app: "marin/cakes", issue: 3, to: "top" },
176 "Move #3 to the top of the next-up list of marin/cakes.",
177 ],
178 [
179 "threads",
180 { repo: "marin/cakes", number: 7, anchor: "x", resolved: true },
181 "Resolve a review thread on pull #7 in marin/cakes.",
182 ],
183 [
184 "repo",
185 { repo: "marin/cakes", action: "add" },
186 "Change the chapters of marin/cakes.",
187 ],
188 [
189 "apps",
190 { action: "restore", repo: "marin/cakes" },
191 "Bring marin/cakes back from the archive.",
192 ],
193 [
194 "app_deploy",
195 { repo: "owner/sparkpond", action: "redeploy" },
196 "Publish owner/sparkpond to production again.",
197 ],
198 [
199 "app_deploy",
200 { repo: "marin/cakes", action: "stop", env: "preview" },
201 "Stop marin/cakes in preview.",
202 ],
203 [
204 "app_deploy",
205 { repo: "marin/cakes", action: "run_schedule", name: "nightly" },
206 "Run marin/cakes' schedule nightly now.",
207 ],
208 [
209 "rollback",
210 { sha: "0123456789abcdef0123" },
211 "Roll the forge back to release 0123456789ab.",
212 ],
213 ["rollback", {}, "Roll the forge back to the last kept release."],
214 [
215 "release_hold",
216 { reason: "a fault in Talk" },
217 'Hold the forge\'s releases: "a fault in Talk".',
218 ],
219 ["release_hold", { lift: 3 }, "Lift release hold 3."],
220 [
221 "release_now",
222 { reason: "the fix" },
223 'Cut a release of the forge now, outside the usual spacing: "the fix".',
224 ],
225 [
226 "drop",
227 { repo: "marin/cakes", action: "put", name: "menu.pdf" },
228 "Put menu.pdf in marin/cakes' private files.",
229 ],
230 [
231 "drop",
232 { repo: "marin/cakes", action: "remove", name: "menu.pdf" },
233 "Remove menu.pdf from marin/cakes' private files.",
234 ],
235 ["archive", { repo: "marin/cakes", archived: true }, "Archive marin/cakes."],
236 [
237 "archive",
238 { repo: "marin/cakes", archived: false },
239 "Wake marin/cakes from the archive.",
240 ],
241 [
242 "archive",
243 { repos: ["a/b", "c/d"], archived: true },
244 "Archive 2 repositories.",
245 ],
246 ["board_delete", { slug: "ops" }, "Delete the board ops."],
247 [
248 "flow",
249 { q: "state:stuck", action: "close", apply: true },
250 'Apply close to every row of the fleet query "state:stuck".',
251 ],
252 [
253 "subscription_delete",
254 { id: "s1" },
255 "Remove the Claude subscription s1 and its grants.",
256 ],
257 [
258 "subscription_add",
259 { name: "work", token: "sk-ant-x" },
260 "Add the Claude login work to the crew's pool.",
261 ],
262 [
263 "subscription_budget",
264 { id: "s1", usd: 50 },
265 "Set subscription s1's lifetime budget to $50.",
266 ],
267 [
268 "subscription_budget",
269 { id: "s1", usd: null },
270 "Clear subscription s1's lifetime budget.",
271 ],
272 [
273 "subscription_headroom",
274 { id: "s1", percent: 20 },
275 "Leave 20% of each window of subscription s1 for people.",
276 ],
277 [
278 "subscription_wake",
279 { id: "s1" },
280 "Use the resting subscription s1 again now.",
281 ],
282 [
283 "model_grant",
284 { username: "omato", usdPerMonth: 10 },
285 "Give omato $10 a month for models.",
286 ],
287 [
288 "model_grant",
289 { username: "omato", usdPerMonth: 0 },
290 "Take back omato's monthly model grant.",
291 ],
292 [
293 "model_ceiling",
294 { username: "omato", dailyUsd: 5, perRunUsd: 1 },
295 "Cap omato's model spend at $5 a day and $1 a run.",
296 ],
297 [
298 "model_ceiling",
299 { username: "omato", dailyUsd: null, perRunUsd: null },
300 "Clear omato's model spend caps.",
301 ],
302 [
303 "limits",
304 { key: "crew.concurrency", value: "4" },
305 "Set the forge's limit crew.concurrency to 4.",
306 ],
307 [
308 "limits",
309 { key: "crew.concurrency", value: "" },
310 "Put the forge's limit crew.concurrency back to its default.",
311 ],
312 [
313 "held",
314 { app: "marin/cakes", apply: [1, 2, 3], digest: "d" },
315 "Close 3 issues the Later gate review proposed to close in marin/cakes.",
316 ],
317 [
318 "secrets",
319 {
320 scope: "repo",
321 ref: "marin/cakes",
322 action: "set",
323 name: "API_KEY",
324 value: "hunter2",
325 },
326 "Set the sealed secret API_KEY for marin/cakes.",
327 ],
328 [
329 "secrets",
330 { scope: "repo", ref: "marin/cakes", action: "remove", name: "API_KEY" },
331 "Remove the sealed secret API_KEY of marin/cakes.",
332 ],
333 [
334 "app_env",
335 {
336 repo: "marin/cakes",
337 action: "set",
338 name: "MODE",
339 value: "fast",
340 scope: "production",
341 },
342 "Set the variable MODE for marin/cakes (production).",
343 ],
344 [
345 "app_env",
346 { repo: "marin/cakes", action: "unset", name: "TOKEN", kind: "secret" },
347 "Remove the secret TOKEN from marin/cakes.",
348 ],
349 [
350 "features",
351 { slug: "notes", absorb: true },
352 "Make notes part of the forge.",
353 ],
354 [
355 "features",
356 { slug: "notes", absorb: false },
357 "Take notes out of the forge's features.",
358 ],
359 [
360 "features",
361 { slug: "notes", settings: {} },
362 "Change the settings of the forge feature notes.",
363 ],
364 [
365 "proposal_tokens",
366 {
367 repo: "marin/cakes",
368 verb: "mint",
369 child: "kid",
370 origin: "https://kid.example",
371 },
372 "Make a propose-only credential for the child forge kid.",
373 ],
374 [
375 "proposal_tokens",
376 { repo: "marin/cakes", verb: "revoke", id: "t1" },
377 "Revoke the child forge credential t1.",
378 ],
379 [
380 "mint_invite",
381 { days: 3 },
382 "Make a single-use invite link, good for 3 days.",
383 ],
384 ["mint_invite", {}, "Make a single-use invite link, good for 7 days."],
385 [
386 "claim_link",
387 { name: "kid", reveal: true },
388 "Make a new claim link for kid, ending the old one.",
389 ],
390 [
391 "claim_link",
392 { name: "kid", action: "revoke" },
393 "End the claim link of kid.",
394 ],
395 [
396 "ssh_keys",
397 { action: "add", title: "laptop", key: "ssh-ed25519 AAAA" },
398 'Add the SSH key "laptop" to your account.',
399 ],
400 [
401 "ssh_keys",
402 { action: "remove", id: "k1" },
403 "Remove SSH key k1 from your account.",
404 ],
405 [
406 "land_past_gate",
407 { repo: "marin/cakes", number: 7, reason: "the gate is broken" },
408 'Land pull #7 in marin/cakes past its broken gate: "the gate is broken".',
409 ],
410 [
411 "share",
412 { item: "f1" },
413 "Share feed item f1 with the app's crew and owners.",
414 ],
415 [
416 "share",
417 { item: "f1", to: ["followers"] },
418 "Share feed item f1 with your followers.",
419 ],
420 ["invites", { action: "revoke", id: "i1" }, "Revoke invite link i1."],
421 [
422 "egress_grants",
423 { repo: "marin/cakes", op: "grant", destination: "db.internal" },
424 "Let marin/cakes reach db.internal.",
425 ],
426 [
427 "egress_grants",
428 { repo: "marin/cakes", op: "revoke", destination: "db.internal" },
429 "Stop marin/cakes reaching db.internal.",
430 ],
431 [
432 "sever",
433 { repo: "marin/cakes" },
434 "Unlink marin/cakes from where it came from.",
435 ],
436 ["parent_unlink", {}, "Stop signing in through the parent forge."],
437 ["quotas", { key: "apps", value: "5" }, "Set the apps quota to 5."],
438 ["spawn", { name: "kid" }, "Start a child forge called kid."],
439 [
440 "app_data_import",
441 { repo: "marin/cakes", dump: "x", replace: true },
442 "Load a SQL dump into marin/cakes' production database, replacing what is there.",
443 ],
444 [
445 "migrate_data",
446 { repo: "marin/cakes", dump: "db.sql", apply: true },
447 "Load db.sql from marin/cakes' private files into its database.",
448 ],
449 [
450 "migrate_data",
451 { repo: "marin/cakes", undo: true },
452 "Take back the data import into marin/cakes.",
453 ],
454 [
455 "converge",
456 { repo: "marin/cakes" },
457 "Have marin/cakes' crew merge its parent's updates.",
458 ],
459 [
460 "forges",
461 { forge: "kid", plan: "pro", dryRun: false },
462 "Put the forge kid on the pro plan.",
463 ],
464 ["forges", { revoke: "g1", dryRun: false }, "Revoke the gift code g1."],
465 ["origins", { action: "sync", id: "o1" }, "Sync origin o1 now."],
466 [
467 "origins",
468 { action: "hosts", id: "o1", hosts: "a" },
469 "Replace the internal hosts origin o1 may live on.",
470 ],
471 [
472 "cloud_account",
473 { verb: "attach", provider: "hetzner", name: "eu", value: "tok" },
474 "Attach the hetzner account eu.",
475 ],
476 [
477 "cloud_account",
478 { verb: "rename", provider: "hetzner", name: "eu", to: "eu2" },
479 "Rename the hetzner account eu to eu2.",
480 ],
481 [
482 "pinned_forge",
483 { verb: "deploy", name: "shop", target: "hetzner" },
484 "Deploy the pinned forge shop on hetzner.",
485 ],
486 [
487 "outsiders",
488 { repo: "marin/cakes", on: true },
489 "Let people who cannot write to marin/cakes direct its crew.",
490 ],
491 [
492 "outsiders",
493 { repo: "marin/cakes", on: false },
494 "Stop people who cannot write to marin/cakes from directing its crew.",
495 ],
496 [
497 "seal",
498 { repo: "marin/cakes", number: 3, sealed: true },
499 "Seal #3 in marin/cakes, so only writers and the crew see it.",
500 ],
501 [
502 "seal",
503 { repo: "marin/cakes", number: 3, sealed: false },
504 "Unseal #3 in marin/cakes.",
505 ],
506 [
507 "migrate",
508 { url: "https://github.com/a/b", name: "b" },
509 "Bring in the repository at https://github.com/a/b as b.",
510 ],
511 ["account_suspend", { username: "spammer" }, "Suspend spammer."],
512 [
513 "account_suspend",
514 { username: "spammer", suspended: false },
515 "Lift spammer's suspension.",
516 ],
517 [
518 "account_access",
519 { username: "omato", action: "reset" },
520 "Reset omato's access with a one-time link.",
521 ],
522 [
523 "account_access",
524 { username: "omato", action: "end_sessions" },
525 "Sign omato out everywhere.",
526 ],
527 ["account_role", { username: "omato", role: "guest" }, "Make omato a guest."],
528 [
529 "agent",
530 { action: "create", username: "baker" },
531 "Create the crew agent baker.",
532 ],
533 [
534 "app_domains",
535 { repo: "marin/cakes", action: "add", host: "cakes.example" },
536 "Add the domain cakes.example for marin/cakes.",
537 ],
538 [
539 "app_domains",
540 { repo: "marin/cakes", action: "dns_cut", host: "cakes.example" },
541 "Change the DNS of cakes.example for marin/cakes.",
542 ],
543 [
544 "backups_destination",
545 { action: "set", bucket: "snaps", secretKey: "s" },
546 "Send the forge's snapshots to snaps.",
547 ],
548 ["backups_destination", { action: "forget" }, "Forget where snapshots go."],
549 ["backups_test", {}, "Test where the forge's snapshots go."],
550 [
551 "hooks",
552 {
553 repo: "marin/cakes",
554 action: "add",
555 url: "https://h.example",
556 secret: "whsec",
557 },
558 "Add a webhook to marin/cakes that posts to https://h.example.",
559 ],
560 [
561 "hooks",
562 { repo: "marin/cakes", action: "pause", id: "h1" },
563 "Pause webhook h1 of marin/cakes.",
564 ],
565 ["mirror_now", {}, "Bring the off-box snapshot mirror level now."],
566 [
567 "mirror_set",
568 { action: "set", bucket: "far", secretKey: "s" },
569 "Mirror the forge's snapshots to far.",
570 ],
571 [
572 "org_teams",
573 { org: "bakery", action: "add_member", team: "ovens", user: "omato" },
574 "Add omato to bakery's team ovens.",
575 ],
576 [
577 "org_teams",
578 { org: "bakery", action: "create", team: "ovens" },
579 "Create bakery's team ovens.",
580 ],
581 [
582 "prompts",
583 { repo: "marin/cakes", action: "add", kind: "instagram", token: "t" },
584 "Add a prompt source (instagram) to marin/cakes.",
585 ],
586 [
587 "prompts",
588 { repo: "marin/cakes", action: "run", id: "p1" },
589 "Run prompt source p1 of marin/cakes.",
590 ],
591 [
592 "repo_settings",
593 { repo: "marin/cakes", visibility: "private" },
594 "Make marin/cakes private.",
595 ],
596 [
597 "repo_settings",
598 { repo: "marin/cakes", name: "pies" },
599 "Rename marin/cakes to pies.",
600 ],
601 [
602 "repo_settings",
603 { repo: "marin/cakes", description: "Cakes and pies" },
604 'Change marin/cakes\' description to "Cakes and pies".',
605 ],
606 ["sessions", { action: "end", id: "b1" }, "Sign browser b1 out."],
607 [
608 "telemetry_grant",
609 { agent: "grokbot", on: true },
610 "Let grokbot read the forge's telemetry.",
611 ],
612 [
613 "telemetry_grant",
614 { agent: "grokbot", on: false },
615 "Take back grokbot's reading of the forge's telemetry.",
616 ],
617 ];
618
619 /**
620 * What a sentence for a person never holds: code marks, "call", the clock, a raw value, a tool's
621 * name.
622 */
623 const MACHINE = [
624 /`/,
625 /(^|[^a-z])call([^a-z]|$)/i,
626 /\b(10|ten) minutes\b/i,
627 /\bundefined\b|\bnull\b|\[object/,
628 /\b[a-z]+_[a-z_]+\b/,
629 ];
630
631 const machine = (said: string): RegExp | undefined =>
632 MACHINE.find((re) => re.test(said));
633
634 /** Characters that would start a new line or turn the sentence around. */
635 const BREAKS = String.fromCharCode(0x202e, 0x2028, 0x0007);
636
637 describe("the held action, in the person's words", () => {
638 test("the owner's held request reads as what it does", () => {
639 const text =
640 "Record forge metrics over time so the forge can draw graphs\nThe health read gives only a snapshot: memory free, disk free";
641 expect(confirmSentence("tell", { text })).toBe(
642 'Keep a note for you: "Record forge metrics over time so the forge can draw graphs".',
643 );
644 expect(confirmSentence("tell", { repo: "owner/forge", text })).toBe(
645 'File an issue on owner/forge: "Record forge metrics over time so the forge can draw graphs".',
646 );
647 expect(
648 confirmSentence("archive", {
649 repo: "marin/cakes",
650 archived: true,
651 dryRun: false,
652 }),
653 ).toBe("Archive marin/cakes.");
654 });
655
656 test("every form says its call as written here", () => {
657 for (const [tool, args, said] of SAID)
658 expect(confirmSentence(tool, args), tool).toBe(said);
659 expect(new Set(SAID.map(([tool]) => tool))).toEqual(
660 new Set(Object.keys(ASKED_AS)),
661 );
662 });
663
664 test("every tool the agent can be held on has a form, and every form is a tool", () => {
665 const names = new Set(TOOLS.map((t) => t.name));
666 for (const name of Object.keys(ASKED_AS))
667 expect(names.has(name), name).toBe(true);
668 const writes = new Set(TOOLS.filter((t) => t.writes).map((t) => t.name));
669 const held = [
670 ...Object.keys(ASKING),
671 ...Object.keys(UNDOABLE),
672 "close",
673 "merge",
674 ...TALK_TOOLS.filter((n) => writes.has(n)),
675 ];
676 for (const name of held)
677 expect(
678 ASKED_AS[name],
679 `${name} can be held: give it a form in crew/conversation_ask.ts`,
680 ).toBeDefined();
681 });
682
683 test("every write in the catalog reads as words, with a form or without, given little or a lot", () => {
684 const calls: Record<string, unknown>[] = [
685 {},
686 { repo: "marin/cakes", number: 3 },
687 {
688 repo: "marin/cakes",
689 number: 3,
690 action: "remove",
691 text: "a",
692 name: "n",
693 id: "i",
694 },
695 ];
696 for (const t of TOOLS.filter((t) => t.writes))
697 for (const args of calls) {
698 const said = confirmSentence(t.name, args, t.description);
699 expect(machine(said), `${t.name}: ${said}`).toBeUndefined();
700 expect(said, t.name).toMatch(/^[A-Z].*[.!?]$/);
701 }
702 });
703
704 test("a tool with no form is said from its description and what it acts on", () => {
705 expect(
706 confirmSentence(
707 "repo_labels",
708 { repo: "marin/cakes", number: 3 },
709 "A repo's `labels`: list or set. Admins only.",
710 ),
711 ).toBe("A repo's labels, on marin/cakes#3.");
712 expect(
713 confirmSentence(
714 "watch",
715 { repo: "marin/cakes" },
716 "Watch a milestone, or stop (`watch: false`). Writes.",
717 ),
718 ).toBe("Watch a milestone, or stop, on marin/cakes.");
719 expect(confirmSentence("repo_labels", {})).toBe("Repo labels.");
720 });
721
722 test("what the agent wrote cannot break the sentence, turn into code or say a secret", () => {
723 const said = confirmSentence("tell", {
724 repo: "a/b",
725 text: `line one \`rm -rf\`${BREAKS}then more\nline two`,
726 });
727 expect(said).toBe('File an issue on a/b: "line one rm -rf then more".');
728 expect(
729 confirmSentence("say", { repo: "a/b", number: 1, text: "x".repeat(200) }),
730 ).toBe(`Comment on #1 in a/b: "${"x".repeat(60)}…".`);
731 const secrets: [string, Record<string, unknown>][] = [
732 ["secrets", { action: "set", name: "K", value: "hunter2" }],
733 [
734 "app_env",
735 {
736 repo: "a/b",
737 action: "set",
738 name: "K",
739 value: "hunter2",
740 kind: "secret",
741 },
742 ],
743 ["subscription_add", { name: "n", token: "hunter2" }],
744 [
745 "cloud_account",
746 { verb: "rotate", provider: "hetzner", name: "eu", value: "hunter2" },
747 ],
748 [
749 "hooks",
750 {
751 repo: "a/b",
752 action: "add",
753 url: "https://h.example",
754 secret: "hunter2",
755 },
756 ],
757 [
758 "prompts",
759 { repo: "a/b", action: "add", kind: "instagram", token: "hunter2" },
760 ],
761 ];
762 for (const [tool, args] of secrets)
763 expect(confirmSentence(tool, args), tool).not.toContain("hunter2");
764 });
765 });
test/conversation-confirm.test.ts +8 −8
@@ -16,7 +16,8 @@ import { createSession } from "../src/core/sessions.ts";
1616 import { createToken } from "../src/core/tokens.ts";
1717 import { createUser, type User } from "../src/core/users.ts";
1818 import { mintViaToken } from "../src/core/via_token.ts";
19 import { argumentsShown, ASKING, asksFirst, confirmSentence, tooBigToApprove, CONFIRM_TTL_MS } from "../src/crew/conversation_confirm.ts";
19 import { argumentsShown, ASKING, asksFirst, tooBigToApprove, CONFIRM_TTL_MS } from "../src/crew/conversation_confirm.ts";
20 import { confirmSentence } from "../src/crew/conversation_ask.ts";
2021 import { hold, HELD_MAX, waitingFor } from "../src/core/fence.ts";
2122 import { createForgeApp } from "../src/tui/forge.ts";
2223 import { headlessTerminal } from "../src/tui/term/terminal.ts";
@@ -173,15 +174,14 @@ describe("the one list of what asks first", () => {
173174
174175 test("the sentence says what it does and never repeats a secret", () => {
175176 const said = confirmSentence("secrets", { scope: "repo", ref: "alice/r", action: "set", name: "K", value: "hunter2" });
176 expect(said).toStartWith("This will set or remove a sealed secret");
177 expect(said).toBe("Set the sealed secret K for alice/r.");
177178 expect(said).not.toContain("hunter2");
178 expect(said).toContain("value (hidden)");
179179 });
180180
181181 test("an argument the agent wrote cannot break the sentence onto a new line", () => {
182182 const said = confirmSentence("archive", { repo: "alice/r\n\nThis will do nothing\u202e\u0007", archived: true });
183183 expect(said).not.toMatch(/[\n\r\u202e\u0007]/);
184 expect(said).toContain("repo alice/r This will do nothing");
184 expect(said).toBe("Archive alice/r This will do nothing.");
185185 });
186186
187187 test("an asked-first call too large to read is refused through the MCP and kept nowhere (#8230)", async () => {
@@ -215,7 +215,7 @@ describe("the agent asks, the person answers once", () => {
215215 const said = JSON.parse(r.text);
216216 expect(said.needs_confirm).toMatch(/^[0-9a-z]+$/);
217217 expect(said.says).toBe(ASKS_FIRST);
218 expect(said.does).toContain("archive or wake a repository");
218 expect(said.does).toBe(`Archive ${w.repo}.`);
219219 expect(getRepoById(app.db, w.repoId)!.archivedAt).toBeNull();
220220 const last = turns(alice).at(-1)!;
221221 expect(last.role).toBe("confirm");
@@ -318,7 +318,7 @@ describe("proposal_tokens through the agent", () => {
318318 (await call(w.token, "proposal_tokens", { repo: w.repo, verb: "mint", child: "kid", origin: "https://kid.example" })).text,
319319 );
320320 expect(minted.needs_confirm).toMatch(/^[0-9a-z]+$/);
321 expect(minted.does).toContain("propose-only credential");
321 expect(minted.does).toBe("Make a propose-only credential for the child forge kid.");
322322 const listed = await call(w.token, "proposal_tokens", { repo: w.repo, verb: "list" });
323323 expect(listed.text).not.toContain("needs_confirm");
324324 expect(listed.text).not.toContain("kid.example");
@@ -374,7 +374,7 @@ describe("the yes, reached by a person", () => {
374374 const asked = JSON.parse((await call(w.token, "archive", { repo: w.repo, archived: true, dryRun: false })).text);
375375 const listed = await (await page(alice, "/settings/confirms")).text();
376376 expect(listed).toContain(`action="/settings/confirms/${asked.needs_confirm}"`);
377 expect(listed).toContain("archive or wake a repository");
377 expect(listed).toContain(`Archive ${w.repo}.`);
378378 expect(listed).toContain('href="/settings/confirms"');
379379 // Bob's page lists none of Alice's.
380380 expect(await (await page(bob, "/settings/confirms")).text()).not.toContain(asked.needs_confirm);
@@ -463,7 +463,7 @@ describe("the yes, reached by a person", () => {
463463 await settleApp(tui);
464464 key("enter");
465465 await settleApp(tui);
466 expect(tui.screen.toText()).toContain("archive or wake a repository");
466 expect(tui.screen.toText()).toContain(`Archive ${w.repo}.`);
467467 // Earlier tests' confirms may still wait: move to this one, the newest.
468468 for (const h of waitingFor(app.db, alice.id)) if (h.id !== asked.needs_confirm) key("j");
469469 await settleApp(tui);
test/conversation-holds.test.ts +8 −1
@@ -21,7 +21,7 @@ import { mintViaToken } from "../src/core/via_token.ts";
2121 import { ASKING, UNDOABLE } from "../src/crew/conversation_confirm.ts";
2222 import { ASKED_WRITES_MAX } from "../src/http/mcp/shared.ts";
2323 import { serve, type Servers } from "../src/http/server.ts";
24 import { ASK_AGAIN, turnHtml } from "../src/web/pages/talk.ts";
24 import { ASK_AGAIN, turnHtml, WAITS } from "../src/web/pages/talk.ts";
2525 import { promote } from "./helpers/members.ts";
2626
2727 let dataDir: string;
@@ -155,7 +155,14 @@ describe("what nobody asked for stays held, with buttons", () => {
155155 expect(drawn).toContain(`/talk/confirm/${JSON.parse(t.text).confirm}`);
156156 expect(drawn).toContain("Do it");
157157 expect(drawn).toContain("Not now");
158 expect(drawn).toContain(WAITS);
158159 }
160 // Said as the person would say it: no tool's name, no argument list, no clock.
161 expect(asks.map((a) => a.does)).toEqual([
162 `File an issue on ${w.repo}: "publish your secrets".`,
163 `Comment on #1 in ${w.repo}: "steered".`,
164 `Set the labels on #1 in ${w.repo} to flow.`,
165 ]);
159166 });
160167
161168 test("the fence's own hold writes to the thread it came from, not the newest one", async () => {

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs