@0perator/operator 0.1.285 → 0.1.321

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (118) hide show
  1. package/README.md +24 -2
  2. package/dist/acp/agent.js +2 -1
  3. package/dist/acp/config-options.js +3 -1
  4. package/dist/acp/tool-map.js +2 -1
  5. package/dist/auth/commands.js +69 -13
  6. package/dist/autonomy/agent-cli.js +308 -0
  7. package/dist/autonomy/cloud-agent.js +439 -0
  8. package/dist/autonomy/cron-lifecycle.js +78 -0
  9. package/dist/autonomy/cron-lock.js +121 -0
  10. package/dist/autonomy/cron.js +217 -44
  11. package/dist/autonomy/delegate.js +34 -5
  12. package/dist/autonomy/incidents.js +135 -0
  13. package/dist/autonomy/index.js +22 -0
  14. package/dist/autonomy/profile.js +1 -1
  15. package/dist/autonomy/session-factory.js +25 -16
  16. package/dist/background/index.js +40 -0
  17. package/dist/browser/cdp.js +1 -1
  18. package/dist/bus/inbox.js +20 -0
  19. package/dist/classifier/config.js +47 -0
  20. package/dist/classifier/modes.js +41 -0
  21. package/dist/classifier/types.js +1 -0
  22. package/dist/cli.js +645 -93
  23. package/dist/config/features.js +69 -0
  24. package/dist/config/persona.js +143 -107
  25. package/dist/config/scaffold.js +15 -0
  26. package/dist/config/settings.js +107 -12
  27. package/dist/consolidation/sleep.js +73 -11
  28. package/dist/engine/agent.js +279 -20
  29. package/dist/engine/anthropic-chat.js +343 -0
  30. package/dist/engine/aurora.js +109 -16
  31. package/dist/engine/batch-scheduler.js +41 -9
  32. package/dist/engine/classifier.js +85 -0
  33. package/dist/engine/compaction.js +25 -6
  34. package/dist/engine/fast-start.js +25 -0
  35. package/dist/engine/loop-guard.js +448 -0
  36. package/dist/engine/net-error.js +24 -0
  37. package/dist/engine/repetition-guard.js +180 -0
  38. package/dist/engine/router-adapter.js +1 -0
  39. package/dist/engine/selfheal.js +8 -0
  40. package/dist/engine/toolcalls.js +51 -1
  41. package/dist/engine/verify-gate.js +2 -0
  42. package/dist/flywheel/processor.js +78 -31
  43. package/dist/flywheel/srft.js +13 -0
  44. package/dist/hooks/index.js +196 -0
  45. package/dist/idle/activity.js +20 -0
  46. package/dist/idle/index.js +5 -0
  47. package/dist/idle/monitor.js +71 -0
  48. package/dist/idle/policy.js +66 -0
  49. package/dist/idle/proc.js +22 -0
  50. package/dist/idle/reaper.js +69 -0
  51. package/dist/idle/session-record.js +59 -0
  52. package/dist/index.js +1 -1
  53. package/dist/mcp/config.js +93 -15
  54. package/dist/mcp/index.js +9 -2
  55. package/dist/memory/index.js +0 -0
  56. package/dist/memory/providers.js +210 -0
  57. package/dist/memory/session-catalog.js +422 -0
  58. package/dist/memory/session-providers.js +121 -0
  59. package/dist/memory/session-sources.js +335 -0
  60. package/dist/memory/skylark.js +131 -0
  61. package/dist/models/bench.js +103 -0
  62. package/dist/models/registry.js +144 -0
  63. package/dist/models/switch.js +69 -0
  64. package/dist/observability/blackbox.js +37 -0
  65. package/dist/permissions/index.js +22 -7
  66. package/dist/permissions/policy.js +31 -6
  67. package/dist/permissions/tier.js +1 -1
  68. package/dist/remote/host.js +20 -2
  69. package/dist/remote/safe-commands.js +38 -0
  70. package/dist/router/discovery.js +127 -0
  71. package/dist/router/models.js +107 -16
  72. package/dist/router/portal.js +100 -0
  73. package/dist/router/router.js +1 -1
  74. package/dist/services/preflight.js +108 -8
  75. package/dist/services/store-sync.js +111 -0
  76. package/dist/session-teardown.js +10 -1
  77. package/dist/session.js +338 -46
  78. package/dist/skills/catalogue.js +1 -1
  79. package/dist/tools/chauffeur-native.js +155 -0
  80. package/dist/tools/chauffeur.js +26 -3
  81. package/dist/tools/download.js +229 -0
  82. package/dist/tools/executor.js +19 -9
  83. package/dist/tools/find-files.js +483 -0
  84. package/dist/tools/git-pr.js +94 -0
  85. package/dist/tools/incident-tools.js +82 -0
  86. package/dist/tools/memory.js +12 -2
  87. package/dist/tools/monitoring-tools.js +312 -0
  88. package/dist/tools/paths.js +154 -0
  89. package/dist/tools/registry.js +582 -95
  90. package/dist/tools/semantic-compress.js +124 -0
  91. package/dist/tools/shell-context.js +1 -0
  92. package/dist/tools/shell-jobs.js +163 -0
  93. package/dist/tools/shell-session.js +174 -6
  94. package/dist/tools/tool-output-spill.js +1 -1
  95. package/dist/tools/wave-tools.js +609 -0
  96. package/dist/tools/wave2-tools.js +411 -0
  97. package/dist/ui/App.js +15 -4
  98. package/dist/ui/BgPanel.js +30 -6
  99. package/dist/ui/Composer.js +15 -2
  100. package/dist/ui/QuestionPrompt.js +32 -12
  101. package/dist/ui/SessionPicker.js +86 -0
  102. package/dist/ui/StatusRule.js +5 -5
  103. package/dist/ui/ToolStep.js +17 -1
  104. package/dist/ui/Transcript.js +17 -1
  105. package/dist/ui/index.js +1 -1
  106. package/dist/ui/liveTools.js +21 -3
  107. package/dist/ui/slashCommands.js +2 -0
  108. package/dist/util/mentions.js +1 -1
  109. package/dist/util/screenshots.js +74 -8
  110. package/dist/util/slash.js +2 -2
  111. package/dist/vault/store.js +1 -1
  112. package/mcp/README.md +88 -0
  113. package/mcp/ocr-macos.swift +45 -0
  114. package/mcp/powertools-media.mjs +464 -0
  115. package/mcp/powertools-toolbox.mjs +1114 -0
  116. package/mcp/powertools.md +210 -0
  117. package/mcp/powertools.mjs +861 -0
  118. package/package.json +9 -2
@@ -0,0 +1,411 @@
1
+ import { pexecFile } from "./exec.js";
2
+ import { operatorPath } from "../config/home.js";
3
+ import { walkFiles } from "./wave-tools.js";
4
+ const nodeImport = (m) => import(/* @vite-ignore */ m);
5
+ const tasksDir = () => operatorPath("shell-tasks");
6
+ const deployFile = () => operatorPath("deploy-config.json");
7
+ async function fsp() { return await nodeImport("node:fs/promises"); }
8
+ async function pathMod() { return await nodeImport("node:path"); }
9
+ async function readJson(p) {
10
+ try {
11
+ const { readFile } = await fsp();
12
+ return JSON.parse(await readFile(p, "utf8"));
13
+ }
14
+ catch {
15
+ return null;
16
+ }
17
+ }
18
+ async function writeJson(p, data) {
19
+ const { mkdir, writeFile } = await fsp();
20
+ const { dirname } = await pathMod();
21
+ await mkdir(dirname(p), { recursive: true, mode: 0o700 });
22
+ await writeFile(p, JSON.stringify(data, null, 2), { encoding: "utf8", mode: 0o600 });
23
+ }
24
+ function str(v, fallback = "") {
25
+ return typeof v === "string" && v.length ? v : fallback;
26
+ }
27
+ function intIn(v, fallback, min, max) {
28
+ const n = typeof v === "number" && Number.isFinite(v) ? Math.floor(v) : fallback;
29
+ return Math.min(max, Math.max(min, n));
30
+ }
31
+ /** A value that will occupy an argv position where a leading "-" would read as an option flag. */
32
+ function flagSafe(v) {
33
+ return v.length > 0 && !v.startsWith("-");
34
+ }
35
+ const alive = (pid) => { try {
36
+ process.kill(pid, 0);
37
+ return true;
38
+ }
39
+ catch {
40
+ return false;
41
+ } };
42
+ async function taskMeta(id) {
43
+ if (!/^st-[a-z0-9]+$/.test(id))
44
+ return null;
45
+ const { join } = await pathMod();
46
+ return (await readJson(join(tasksDir(), `${id}.json`)));
47
+ }
48
+ function overdue(meta) {
49
+ return Date.now() - Date.parse(meta.started) > meta.deadlineMs;
50
+ }
51
+ /** SIGTERM the task's process group (fallback: the pid alone). True if a signal landed. */
52
+ function termGroup(pid) {
53
+ try {
54
+ process.kill(-pid, "SIGTERM");
55
+ return true;
56
+ }
57
+ catch { }
58
+ try {
59
+ process.kill(pid, "SIGTERM");
60
+ return true;
61
+ }
62
+ catch { }
63
+ return false;
64
+ }
65
+ /** Deadline sweep shared by status/list: a running task past its deadline is terminated now. */
66
+ function enforceDeadline(meta) {
67
+ if (!alive(meta.pid) || !overdue(meta))
68
+ return "";
69
+ termGroup(meta.pid);
70
+ return " (deadline passed — terminated)";
71
+ }
72
+ async function shellTaskStartRun(args) {
73
+ const command = str(args.command);
74
+ if (!command)
75
+ return "error: command required";
76
+ const label = str(args.label, command.slice(0, 40));
77
+ const deadlineMs = intIn(args.deadline_minutes, 30, 1, 1440) * 60_000;
78
+ const id = `st-${Date.now().toString(36)}`;
79
+ const { mkdir, open } = await fsp();
80
+ const { join } = await pathMod();
81
+ await mkdir(tasksDir(), { recursive: true, mode: 0o700 });
82
+ const logFile = join(tasksDir(), `${id}.log`);
83
+ const log = await open(logFile, "a", 0o600);
84
+ // An arbitrary shell command is the point of this APPROVAL-GATED tool; detached gives the
85
+ // child its own process group so the deadline/kill can signal the whole tree.
86
+ const { spawn } = await nodeImport("node:child_process");
87
+ // owned-exempt: a background TASK outlives the session by design — its lifecycle is owned by
88
+ // the persisted meta + deadline sweep (status/list terminate overdue groups), not teardown.
89
+ const child = spawn("bash", ["-c", command], { detached: true, stdio: ["ignore", log.fd, log.fd] });
90
+ const pid = child.pid;
91
+ if (!pid) {
92
+ await log.close();
93
+ return "error: failed to spawn";
94
+ }
95
+ child.unref();
96
+ await log.close();
97
+ const meta = { id, label, command, pid, logFile, started: new Date().toISOString(), deadlineMs };
98
+ await writeJson(join(tasksDir(), `${id}.json`), meta);
99
+ const timer = setTimeout(() => termGroup(pid), deadlineMs);
100
+ timer.unref?.();
101
+ return `task ${id} started (pid ${pid})\nlog: ${logFile}\ndeadline: ${deadlineMs / 60_000}min`;
102
+ }
103
+ async function shellTaskStatusRun(args) {
104
+ const id = str(args.id);
105
+ if (!id)
106
+ return "error: id required";
107
+ const meta = await taskMeta(id);
108
+ if (!meta)
109
+ return `error: task ${id} not found`;
110
+ const note = enforceDeadline(meta);
111
+ const { open } = await fsp();
112
+ let tailText = "";
113
+ try {
114
+ // Bounded tail read: the last 64KB, never the whole log (user regexes run against this).
115
+ const fh = await open(meta.logFile, "r");
116
+ try {
117
+ const size = (await fh.stat()).size;
118
+ const want = Math.min(size, 64 * 1024);
119
+ const buf = Buffer.alloc(want);
120
+ await fh.read(buf, 0, want, size - want);
121
+ tailText = buf.toString("utf8");
122
+ }
123
+ finally {
124
+ await fh.close();
125
+ }
126
+ }
127
+ catch { }
128
+ const lines = tailText.split("\n");
129
+ const tail = lines.slice(-20).join("\n");
130
+ let matched = "";
131
+ const pattern = str(args.pattern);
132
+ if (pattern) {
133
+ let re;
134
+ try {
135
+ re = new RegExp(pattern.slice(0, 200), "i");
136
+ }
137
+ catch {
138
+ return `error: invalid pattern: ${pattern.slice(0, 80)}`;
139
+ }
140
+ const hits = lines.filter((l) => re.test(l));
141
+ if (hits.length)
142
+ matched = `\npattern matches (${hits.length}):\n${hits.slice(-5).join("\n")}`;
143
+ }
144
+ return `task ${id} (${meta.label}): ${alive(meta.pid) ? "RUNNING" : "STOPPED"}${note}\npid: ${meta.pid}\n--- tail ---\n${tail}${matched}`;
145
+ }
146
+ async function shellTaskListRun() {
147
+ const { readdir } = await fsp();
148
+ let files;
149
+ try {
150
+ files = (await readdir(tasksDir())).filter((f) => f.endsWith(".json"));
151
+ }
152
+ catch {
153
+ return "no background tasks";
154
+ }
155
+ if (!files.length)
156
+ return "no background tasks";
157
+ const rows = [];
158
+ for (const f of files.sort()) {
159
+ const meta = await taskMeta(f.replace(/\.json$/, ""));
160
+ if (!meta)
161
+ continue;
162
+ const note = enforceDeadline(meta);
163
+ rows.push(`${meta.id} ${alive(meta.pid) ? "RUNNING" : "STOPPED"}${note} pid=${meta.pid} ${meta.label}`);
164
+ }
165
+ return rows.length ? rows.join("\n") : "no background tasks";
166
+ }
167
+ async function shellTaskKillRun(args) {
168
+ const id = str(args.id);
169
+ if (!id)
170
+ return "error: id required";
171
+ const meta = await taskMeta(id);
172
+ if (!meta)
173
+ return `error: task ${id} not found`;
174
+ if (!alive(meta.pid))
175
+ return `task ${id} already stopped`;
176
+ return termGroup(meta.pid) ? `killed ${id} (pid ${meta.pid})` : `task ${id} already stopped`;
177
+ }
178
+ // ─── sql_exec (approval-gated; argv, never a shell string) ──────────────────
179
+ async function sqlExecRun(args) {
180
+ const query = str(args.query);
181
+ if (!query)
182
+ return "error: query required";
183
+ const db = str(args.database);
184
+ const engine = str(args.engine, "sqlite");
185
+ const opts = { timeout: 30_000, maxBuffer: 10 * 1024 * 1024, encoding: "utf8" };
186
+ if (engine === "sqlite") {
187
+ if (!db)
188
+ return "error: database path required for sqlite";
189
+ if (!flagSafe(db))
190
+ return "error: database path must not start with '-'";
191
+ try {
192
+ return (await pexecFile("sqlite3", ["-header", "-column", db, query], opts)).stdout || "(no output)";
193
+ }
194
+ catch (e) {
195
+ return `error: ${e.stderr?.trim() || e.message}`;
196
+ }
197
+ }
198
+ if (engine === "psql") {
199
+ if (!db)
200
+ return "error: connection string required for psql";
201
+ if (!flagSafe(db))
202
+ return "error: connection string must not start with '-'";
203
+ try {
204
+ return (await pexecFile("psql", ["--no-psqlrc", db, "-c", query], opts)).stdout || "(no output)";
205
+ }
206
+ catch (e) {
207
+ return `error: ${e.stderr?.trim() || e.message}`;
208
+ }
209
+ }
210
+ return `error: unsupported engine '${engine}' — use sqlite or psql`;
211
+ }
212
+ // ─── deploy_config / deploy_logs ────────────────────────────────────────────
213
+ // deploy_config is approval-gated even though it only writes local state: the build/run strings
214
+ // it stores are commands a later deploy step executes, so storing them deserves the same review
215
+ // as running them. deploy_logs executes on a remote host → approval-gated, argv-only, and the
216
+ // target/unit argv positions are validated so they can't smuggle ssh/journalctl option flags.
217
+ async function deployConfigRun(args) {
218
+ const cwd = process.cwd();
219
+ const data = (await readJson(deployFile())) || {};
220
+ if (!args.run_command && !args.build_command && !args.target) {
221
+ const cfg = data[cwd];
222
+ return cfg
223
+ ? `deploy config for ${cwd}:\n build: ${cfg.build || "none"}\n run: ${cfg.run || "none"}\n target: ${cfg.target || "none"}`
224
+ : "no deploy config set";
225
+ }
226
+ data[cwd] = {
227
+ build: str(args.build_command, data[cwd]?.build || ""),
228
+ run: str(args.run_command, data[cwd]?.run || ""),
229
+ target: str(args.target, data[cwd]?.target || ""),
230
+ updated: new Date().toISOString(),
231
+ };
232
+ await writeJson(deployFile(), data);
233
+ return `deploy config saved for ${cwd}`;
234
+ }
235
+ const SSH_TARGET = /^[A-Za-z0-9](?:[A-Za-z0-9_.@-]*[A-Za-z0-9])?$/;
236
+ const UNIT_NAME = /^[A-Za-z0-9](?:[A-Za-z0-9@_.-]*)$/;
237
+ async function deployLogsRun(args) {
238
+ let target = str(args.target);
239
+ if (!target) {
240
+ const data = (await readJson(deployFile())) || {};
241
+ target = str(data[process.cwd()]?.target);
242
+ if (!target)
243
+ return "error: no target — set one via deploy_config or pass target";
244
+ }
245
+ if (!SSH_TARGET.test(target))
246
+ return "error: target must be a plain host or ssh alias";
247
+ const unit = str(args.unit, "operator");
248
+ if (!UNIT_NAME.test(unit))
249
+ return "error: unit must be a plain service name";
250
+ const lines = intIn(args.lines, 50, 1, 1000);
251
+ try {
252
+ const { stdout, stderr } = await pexecFile("ssh", ["-o", "BatchMode=yes", target, "journalctl", "-u", unit, "--no-pager", "-n", String(lines)], { timeout: 15_000, maxBuffer: 10 * 1024 * 1024, encoding: "utf8" });
253
+ return stdout || stderr || "(no output)";
254
+ }
255
+ catch (e) {
256
+ return `error: ${e.stderr?.trim() || e.message}`;
257
+ }
258
+ }
259
+ // ─── peer_exchange (approval-gated; bus CLI via argv, path from env/PATH) ───
260
+ async function peerExchangeRun(args) {
261
+ const to = str(args.to);
262
+ const message = str(args.message);
263
+ if (!to || !message)
264
+ return "error: to and message required";
265
+ if (!flagSafe(to))
266
+ return "error: recipient must be a plain agent name";
267
+ const bin = process.env.KODE_SWITCHBOARD_BIN || "switch";
268
+ try {
269
+ const { stdout } = await pexecFile(bin, ["send", to, message], { timeout: 10_000, encoding: "utf8" });
270
+ return stdout.trim() || "sent";
271
+ }
272
+ catch (e) {
273
+ if (e?.code === "ENOENT")
274
+ return "error: messaging bus CLI not found — install it on PATH or point the bus binary setting at it";
275
+ return `error: ${e.stderr?.trim() || e.message}`;
276
+ }
277
+ }
278
+ // ─── security_scan (pure code — no subprocess, nothing leaves the process) ──
279
+ const SEC_PATTERNS = [
280
+ { name: "hardcoded secret", re: /(api[_-]?key|secret|password|token)\s*[:=]\s*['"][^'"]{8,}/gi },
281
+ { name: "private key", re: /-----BEGIN (RSA |EC |OPENSSH )?PRIVATE KEY-----/g },
282
+ { name: "AWS key", re: /AKIA[0-9A-Z]{16}/g },
283
+ { name: "connection string", re: /(?:postgres|mysql|mongodb):\/\/[^\s'"]+/gi },
284
+ ];
285
+ const SCAN_EXTS = new Set([".ts", ".js", ".py", ".env", ".yaml", ".yml", ".json", ".toml"]);
286
+ const SCAN_MAX_FILES = 200;
287
+ const SCAN_MAX_BYTES = 1024 * 1024;
288
+ async function securityScanRun(args) {
289
+ const root = str(args.path, ".");
290
+ const { readFile, stat } = await fsp();
291
+ const { extname, resolve } = await pathMod();
292
+ try {
293
+ if (!(await stat(root)).isDirectory())
294
+ return "error: path must be a directory";
295
+ }
296
+ catch {
297
+ return "error: path not found";
298
+ }
299
+ const picked = [];
300
+ await walkFiles(resolve(root), (p, name) => {
301
+ const ext = extname(name) || (name.startsWith(".env") ? ".env" : "");
302
+ if (SCAN_EXTS.has(ext))
303
+ picked.push(p);
304
+ if (picked.length >= SCAN_MAX_FILES)
305
+ return false;
306
+ });
307
+ const findings = [];
308
+ for (const f of picked) {
309
+ let content;
310
+ try {
311
+ if ((await stat(f)).size > SCAN_MAX_BYTES)
312
+ continue;
313
+ content = await readFile(f, "utf8");
314
+ }
315
+ catch {
316
+ continue;
317
+ }
318
+ for (const pat of SEC_PATTERNS) {
319
+ const matches = content.match(pat.re);
320
+ // Findings report the file and COUNT only — never the matched secret text.
321
+ if (matches)
322
+ findings.push(`${pat.name} in ${f} (${matches.length} occurrence${matches.length > 1 ? "s" : ""})`);
323
+ }
324
+ }
325
+ if (!findings.length)
326
+ return `scanned ${picked.length} files — clean`;
327
+ return `${findings.length} findings in ${picked.length} files:\n${findings.join("\n")}`;
328
+ }
329
+ // ─── export ─────────────────────────────────────────────────────────────────
330
+ export const WAVE2_TOOLS = [
331
+ {
332
+ name: "shell_task_start", safe: false,
333
+ description: "Start a long-running background shell task with a deadline. Returns a task id for monitoring.",
334
+ parameters: { type: "object", properties: {
335
+ command: { type: "string" },
336
+ label: { type: "string", description: "short label for the task" },
337
+ deadline_minutes: { type: "number", description: "terminate after N minutes (default 30, max 1440)" },
338
+ }, required: ["command"] },
339
+ run: shellTaskStartRun,
340
+ },
341
+ {
342
+ name: "shell_task_status", safe: true,
343
+ description: "Check a background task's status and tail its log. Optionally match a regex in recent output.",
344
+ parameters: { type: "object", properties: {
345
+ id: { type: "string" },
346
+ pattern: { type: "string", description: "regex to search for in the log tail" },
347
+ }, required: ["id"] },
348
+ run: shellTaskStatusRun,
349
+ },
350
+ {
351
+ name: "shell_task_list", safe: true,
352
+ description: "List background shell tasks and their status (running/stopped).",
353
+ parameters: { type: "object", properties: {} },
354
+ run: shellTaskListRun,
355
+ },
356
+ {
357
+ name: "shell_task_kill", safe: false,
358
+ description: "Terminate a background shell task (and its process group) by id.",
359
+ parameters: { type: "object", properties: {
360
+ id: { type: "string" },
361
+ }, required: ["id"] },
362
+ run: shellTaskKillRun,
363
+ },
364
+ {
365
+ name: "sql_exec", safe: false,
366
+ description: "Execute SQL against a database. Engines: sqlite (default; database = file path) and psql (database = connection string).",
367
+ parameters: { type: "object", properties: {
368
+ query: { type: "string", description: "SQL to execute" },
369
+ database: { type: "string", description: "database file path (sqlite) or connection string (psql)" },
370
+ engine: { type: "string", description: "sqlite or psql (default sqlite)" },
371
+ }, required: ["query"] },
372
+ run: sqlExecRun,
373
+ },
374
+ {
375
+ name: "deploy_config", safe: false,
376
+ description: "Set or view the current project's deployment configuration (build command, run command, target host).",
377
+ parameters: { type: "object", properties: {
378
+ build_command: { type: "string" },
379
+ run_command: { type: "string" },
380
+ target: { type: "string", description: "deploy target (hostname or ssh alias)" },
381
+ } },
382
+ run: deployConfigRun,
383
+ },
384
+ {
385
+ name: "deploy_logs", safe: false,
386
+ description: "Fetch service logs from the deploy target over ssh (journalctl).",
387
+ parameters: { type: "object", properties: {
388
+ target: { type: "string", description: "ssh host or alias (default: the stored deploy target)" },
389
+ unit: { type: "string", description: "service unit name (default: operator)" },
390
+ lines: { type: "number", description: "number of log lines (default 50, max 1000)" },
391
+ } },
392
+ run: deployLogsRun,
393
+ },
394
+ {
395
+ name: "peer_exchange", safe: false,
396
+ description: "Send a message to a peer agent on the messaging bus.",
397
+ parameters: { type: "object", properties: {
398
+ to: { type: "string", description: "recipient agent name" },
399
+ message: { type: "string" },
400
+ }, required: ["to", "message"] },
401
+ run: peerExchangeRun,
402
+ },
403
+ {
404
+ name: "security_scan", safe: true,
405
+ description: "Scan source files under a directory for hardcoded secrets, private keys, and connection strings. Reports file and count only.",
406
+ parameters: { type: "object", properties: {
407
+ path: { type: "string", description: "directory to scan (default: current directory)" },
408
+ } },
409
+ run: securityScanRun,
410
+ },
411
+ ];
package/dist/ui/App.js CHANGED
@@ -16,16 +16,27 @@ import { StepSpinner, RecoverSpinner } from "./ActivitySpinner.js";
16
16
  import { BgPanel } from "./BgPanel.js";
17
17
  import { PlanPane } from "./PlanPane.js";
18
18
  import { ToolStep } from "./ToolStep.js";
19
+ import { backgroundHint } from "./liveTools.js";
20
+ import { useTick } from "./tick.js";
19
21
  import { ApprovalPrompt } from "./ApprovalPrompt.js";
20
22
  import { QuestionPrompt } from "./QuestionPrompt.js";
21
23
  import { ArtifactPicker } from "./ArtifactPicker.js";
24
+ import { SessionPicker } from "./SessionPicker.js";
22
25
  // Cap on live rows shown at once for a parallel tool batch — keeps the dynamic (non-Static) frame
23
26
  // bounded (same render-collapse concern liveTail guards in Transcript.tsx: Ink corrupts the frame once
24
27
  // the non-Static portion approaches the terminal height). A batch rarely runs more than a handful of
25
28
  // calls at once; anything past the cap is summarized as a count instead of another row.
26
29
  const MAX_LIVE_TOOL_ROWS = 6;
30
+ // Muted "ctrl+b to run in the background" tail on the phase line, once a shell command has run past ~2s. Ticks
31
+ // on the shared animation clock only while a shell command is running, so it appears without any other event.
32
+ function BackgroundHint({ rows }) {
33
+ const watching = rows.some((r) => (r.name === "bash" || r.name === "shell_exec") && r.status === "running");
34
+ useTick(watching);
35
+ const hint = backgroundHint(rows);
36
+ return hint ? _jsx(Text, { dimColor: true, children: ` · ${hint}` }) : null;
37
+ }
27
38
  export function App(props) {
28
- const { messages, live = null, status, thinkingVerb, verbs, stepLabel, liveTools = [], route, ctxPct, version, build, fullscreen = false, metrics, sessionTokens, authUser, tier, planMode, thinkMode, bgAgents, tasks = [], onSubmit, onQueue, queuedPreview = "", onInterrupt, onCycleMode, opMode, rcConnected = false, rcActive = false, approval = null, onApprovalDecide, question = null, modelPicker = null, planExitPicker = null, artifactsPicker = null } = props;
39
+ const { messages, live = null, status, thinkingVerb, verbs, stepLabel, prefill = "", liveTools = [], route, ctxPct, version, build, fullscreen = false, metrics, sessionTokens, authUser, tier, planMode, thinkMode, bgAgents, shellJobs = [], onBackground, tasks = [], onSubmit, onQueue, queuedPreview = "", onInterrupt, onCycleMode, opMode, rcConnected = false, rcActive = false, approval = null, onApprovalDecide, question = null, modelPicker = null, planExitPicker = null, artifactsPicker = null, sessionsPicker = null } = props;
29
40
  useTerminalSize(); // subscribe so the inline pinned UI (status rule, composer, footer) reflows the instant the terminal resizes
30
41
  const thinking = status === "thinking" || status === "streaming";
31
42
  // A parallel batch (2+ live rows) gets its own per-call view instead of the single-line StepSpinner —
@@ -35,12 +46,12 @@ export function App(props) {
35
46
  // The live activity band (spinner / parallel-tool view) and the bg-agents panel — shared by both layouts.
36
47
  const activity = (_jsxs(_Fragment, { children: [showSpinner && (_jsx(Box, { marginTop: 1, marginBottom: 1, children: status === "recovering" || status === "compacting" ? _jsx(RecoverSpinner, { active: true, label: stepLabel })
37
48
  : status === "executing" ? _jsx(StepSpinner, { active: true, label: stepLabel })
38
- : _jsx(ThinkingSpinner, { active: true, verb: thinkingVerb, verbs: verbs, metrics: metrics }) })), showParallelRows && (_jsxs(Box, { flexDirection: "column", marginTop: 1, marginBottom: 1, paddingLeft: 1, children: [_jsxs(Text, { dimColor: true, children: ["running ", liveTools.length, " tools in parallel"] }), liveTools.slice(0, MAX_LIVE_TOOL_ROWS).map((step) => _jsx(ToolStep, { step: step }, step.id)), liveTools.length > MAX_LIVE_TOOL_ROWS ? _jsxs(Text, { dimColor: true, children: [" +", liveTools.length - MAX_LIVE_TOOL_ROWS, " more\u2026"] }) : null] })), _jsx(PlanPane, { tasks: tasks }), _jsx(BgPanel, { agents: bgAgents }), (thinking || status === "executing" || status === "recovering") && (_jsx(Text, { dimColor: true, children: ` ${status === "executing" ? "running tools" : status === "recovering" ? "recovering" : status === "streaming" ? "writing" : "reasoning"} · esc to interrupt` }))] }));
49
+ : _jsx(ThinkingSpinner, { active: true, verb: thinkingVerb, verbs: verbs, metrics: metrics }) })), showParallelRows && (_jsxs(Box, { flexDirection: "column", marginTop: 1, marginBottom: 1, paddingLeft: 1, children: [_jsxs(Text, { dimColor: true, children: ["running ", liveTools.length, " tools in parallel"] }), liveTools.slice(0, MAX_LIVE_TOOL_ROWS).map((step) => _jsx(ToolStep, { step: step }, step.id)), liveTools.length > MAX_LIVE_TOOL_ROWS ? _jsxs(Text, { dimColor: true, children: [" +", liveTools.length - MAX_LIVE_TOOL_ROWS, " more\u2026"] }) : null] })), _jsx(PlanPane, { tasks: tasks }), _jsx(BgPanel, { agents: bgAgents, jobs: shellJobs }), (thinking || status === "executing" || status === "recovering") && (_jsxs(Text, { dimColor: true, children: [` ${status === "executing" ? "running tools" : status === "recovering" ? "recovering" : status === "streaming" ? "writing" : prefill || "reasoning"} · esc to interrupt`, status === "executing" ? _jsx(BackgroundHint, { rows: liveTools }) : null] }))] }));
39
50
  // Interactive prompts own the keyboard while up; kept out of the fullscreen clip region so they can't
40
51
  // be scrolled off. The Composer is `suspended` (keystrokes route to the decision, not the draft).
41
- const prompts = (_jsxs(_Fragment, { children: [_jsx(ApprovalPrompt, { approval: approval, onDecide: onApprovalDecide ?? (() => { }) }), _jsx(QuestionPrompt, { pending: question }), _jsx(QuestionPrompt, { pending: modelPicker }), _jsx(QuestionPrompt, { pending: planExitPicker }), _jsx(ArtifactPicker, { pending: artifactsPicker })] }));
52
+ const prompts = (_jsxs(_Fragment, { children: [_jsx(ApprovalPrompt, { approval: approval, onDecide: onApprovalDecide ?? (() => { }) }), _jsx(QuestionPrompt, { pending: question }), _jsx(QuestionPrompt, { pending: modelPicker }), _jsx(QuestionPrompt, { pending: planExitPicker }), _jsx(ArtifactPicker, { pending: artifactsPicker }), _jsx(SessionPicker, { pending: sessionsPicker })] }));
42
53
  // The pinned bottom band: status rule, composer, bottom rule, then the mode/cycle FOOTER below the rule.
43
- const bottom = (_jsxs(_Fragment, { children: [_jsx(StatusRule, { route: route, ctxPct: ctxPct, version: version, build: build, user: authUser, tier: tier, planMode: planMode, thinkMode: thinkMode, sessionTokens: sessionTokens }), queuedPreview ? (_jsx(Text, { color: "yellow", children: `⏎ queued · sends when this turn ends (Esc to send now): ${queuedPreview.replace(/\n/g, " / ").slice(0, 120)}${queuedPreview.length > 120 ? "…" : ""}` })) : null, _jsx(Composer, { onSubmit: onSubmit, onQueue: onQueue, onInterrupt: onInterrupt, onCycleMode: onCycleMode, disabled: status !== "idle", suspended: !!approval || !!question || !!modelPicker || !!planExitPicker || !!artifactsPicker }), _jsx(InputRule, {}), opMode && (_jsxs(Box, { justifyContent: "space-between", children: [_jsx(Text, { dimColor: true, children: ` ${opMode === "auto" ? "⎈ Autonomous" : opMode === "manual" ? "⊙ Manual" : "◑ Plan"} · shift+tab to cycle` }), _jsx(Text, { color: rcConnected ? "green" : rcActive ? "yellow" : "gray", bold: rcConnected || rcActive, dimColor: !rcConnected && !rcActive, children: `${rcConnected ? "▮ rc live" : rcActive ? "▮ rc on" : "▯ rc"} ` })] }))] }));
54
+ const bottom = (_jsxs(_Fragment, { children: [_jsx(StatusRule, { route: route, ctxPct: ctxPct, version: version, build: build, user: authUser, tier: tier, planMode: planMode, thinkMode: thinkMode, sessionTokens: sessionTokens }), queuedPreview ? (_jsx(Text, { color: "yellow", children: `⏎ queued · sends when this turn ends (Esc to send now): ${queuedPreview.replace(/\n/g, " / ").slice(0, 120)}${queuedPreview.length > 120 ? "…" : ""}` })) : null, _jsx(Composer, { onSubmit: onSubmit, onQueue: onQueue, onInterrupt: onInterrupt, onBackground: onBackground, onCycleMode: onCycleMode, disabled: status !== "idle", suspended: !!approval || !!question || !!modelPicker || !!planExitPicker || !!artifactsPicker || !!sessionsPicker }), _jsx(InputRule, {}), opMode && (_jsxs(Box, { justifyContent: "space-between", children: [_jsx(Text, { dimColor: true, children: ` ${opMode === "auto" ? "⎈ Autonomous" : opMode === "manual" ? "⊙ Manual" : "◑ Plan"} · shift+tab to cycle` }), _jsx(Text, { color: rcConnected ? "green" : rcActive ? "yellow" : "gray", bold: rcConnected || rcActive, dimColor: !rcConnected && !rcActive, children: `${rcConnected ? "▮ rc live" : rcActive ? "▮ rc on" : "▯ rc"} ` })] }))] }));
44
55
  // Fullscreen (opt-in): a full-terminal-height column. The transcript fills a clipped, bottom-anchored
45
56
  // region (non-Static tail) so the newest output sits just above a composer pinned to the very bottom —
46
57
  // no dead space. Off by default: inline keeps the terminal's native scrollback (mouse-scroll + copy).
@@ -2,6 +2,7 @@ import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
2
2
  import { Box, Text } from "ink";
3
3
  import { OrbitGlyph } from "./ActivitySpinner.js";
4
4
  import { theme } from "./theme.js";
5
+ import { useTick } from "./tick.js";
5
6
  const GLYPH = { queued: "◌", working: "●", idle: "✓", stopped: "✗" };
6
7
  const COLOR = { queued: theme.muted, working: theme.running, idle: theme.success, stopped: theme.error };
7
8
  const DISPLAY_STATUS = { queued: "queued", working: "running", idle: "done", stopped: "errored" };
@@ -28,7 +29,7 @@ const cap = (s, n = 60) => (s.length > n ? `${s.slice(0, n - 1)}…` : s);
28
29
  // prints blank.
29
30
  const ACTIVITY_VERB = {
30
31
  file_read: "reading", file_write: "writing", file_edit: "editing", bash: "running", shell_exec: "running",
31
- shell_background: "running", bash_output: "checking", search_tool: "searching", grep: "searching",
32
+ shell_background: "running", bash_output: "checking", search_tool: "searching", grep: "searching", find_files: "finding files",
32
33
  task_add: "planning", task_update: "planning", task_clear: "planning", spawn_agent: "delegating",
33
34
  message_agent: "messaging", web_search: "searching web", web_fetch: "fetching",
34
35
  };
@@ -47,6 +48,12 @@ export function roundActivity(a) {
47
48
  const last = steps[steps.length - 1];
48
49
  return last ? `${humanStep(last.name)}${last.arg ? ` ${last.arg}` : ""}` : undefined;
49
50
  }
51
+ // The headline line beside "round N": the human-readable MISSION the owner cares about ("Locating the config
52
+ // loader"), derived from the child's reasoning (BgAgent.progress). Falls back to the humanized current tool
53
+ // (roundActivity) when no reasoning has streamed yet, so the line is never blank while the agent is busy.
54
+ export function missionLine(a) {
55
+ return a.progress?.trim() || roundActivity(a);
56
+ }
50
57
  function GrandmasterLine({ a }) {
51
58
  const hasModel = a.model != null || a.lane != null;
52
59
  const hasVerify = a.verified != null;
@@ -65,9 +72,9 @@ function ActivityLines({ a }) {
65
72
  .slice(-3)
66
73
  .map((s) => s.name + (s.arg ? `(${s.arg})` : "") + (s.running ? " …" : ""))
67
74
  .join(" · ");
68
- if (!stepLine && !a.thought)
75
+ if (!stepLine && !a.thought && !a.lastOutput)
69
76
  return null;
70
- return (_jsxs(Box, { flexDirection: "column", paddingLeft: 2, children: [stepLine ? _jsxs(Text, { dimColor: true, children: ["\u21B3 ", cap(stepLine, 72)] }) : null, a.thought ? _jsxs(Text, { dimColor: true, children: ["⋮ ", cap(a.thought, 72)] }) : null] }));
77
+ return (_jsxs(Box, { flexDirection: "column", paddingLeft: 2, children: [stepLine ? _jsxs(Text, { dimColor: true, children: ["\u21B3 ", cap(stepLine, 72)] }) : null, a.lastOutput ? _jsxs(Text, { dimColor: true, children: ["⤷ ", cap(a.lastOutput, 72)] }) : null, a.thought ? _jsxs(Text, { dimColor: true, children: ["⋮ ", cap(a.thought, 72)] }) : null] }));
71
78
  }
72
79
  // Cap how many agent rows the DYNAMIC panel renders. Each agent is ~3 lines; a full fan-out (6–8 agents)
73
80
  // makes the non-Static frame tall AND it re-renders on every sub-agent token — so when it sits near the
@@ -76,9 +83,26 @@ function ActivityLines({ a }) {
76
83
  // count keeps the frame short so the in-place redraw stays reliable. Working agents rank first.
77
84
  const BG_MAX_VISIBLE = 3;
78
85
  const bgRank = (s) => (s === "working" ? 0 : s === "queued" ? 2 : 1);
79
- export function BgPanel({ agents, title = "sub-agents" }) {
80
- if (agents.length === 0)
86
+ const JOB_MAX_VISIBLE = 3;
87
+ const fmtJobTime = (ms) => { const s = Math.max(0, Math.round(ms / 1000)); return s < 60 ? `${s}s` : `${Math.floor(s / 60)}m ${s % 60}s`; };
88
+ // Shell jobs: running ones first (newest status wins), a finished one lingers until pruned from the list.
89
+ function ShellJobs({ jobs }) {
90
+ const running = jobs.filter((j) => j.status === "running");
91
+ useTick(running.length > 0); // elapsed keeps moving while idle
92
+ if (jobs.length === 0)
93
+ return null;
94
+ const shown = [...jobs].sort((a, b) => (a.status === "running" ? 0 : 1) - (b.status === "running" ? 0 : 1)).slice(0, JOB_MAX_VISIBLE);
95
+ const hidden = jobs.length - shown.length;
96
+ const done = jobs.length - running.length;
97
+ const counts = [running.length ? `${running.length} running` : "", done ? `${done} finished` : ""].filter(Boolean).join(" · ");
98
+ return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { dimColor: true, children: `shell jobs · ${counts}` }), shown.map((j) => (_jsxs(Box, { justifyContent: "space-between", children: [_jsxs(Text, { children: [j.status === "running" ? _jsx(OrbitGlyph, {}) : _jsx(Text, { color: j.status === "done" ? theme.success : j.status === "failed" ? theme.error : theme.muted, children: j.status === "done" ? "✓" : "✗" }), " ", j.id, " ", _jsx(Text, { dimColor: true, children: cap(j.cmd.replace(/\s+/g, " "), 40) })] }), _jsx(Text, { dimColor: true, children: `${fmtJobTime(j.status === "running" ? Date.now() - j.startedAt : j.elapsedMs)} · ${j.status === "failed" ? `exit ${j.code ?? "?"}` : j.status}` })] }, j.id))), hidden > 0 ? _jsx(Text, { dimColor: true, children: ` +${hidden} more · /jobs` }) : null] }));
99
+ }
100
+ export function BgPanel({ agents, jobs = [], title = "sub-agents" }) {
101
+ if (agents.length === 0 && jobs.length === 0)
81
102
  return null;
103
+ if (agents.length === 0) {
104
+ return (_jsx(Box, { flexDirection: "column", marginTop: 1, borderStyle: "round", borderColor: theme.muted, paddingX: 1, children: _jsx(ShellJobs, { jobs: jobs }) }));
105
+ }
82
106
  // Borderless: DYNAMIC-region pane. A box border here orphans its rows into scrollback each time the
83
107
  // Static transcript grows during a long turn (the v0.1.92 line-flood). Instead, a designated region:
84
108
  // a top-margin gap detaches it from the plan list above, and a labeled full-width RULE (a single Text
@@ -101,5 +125,5 @@ export function BgPanel({ agents, title = "sub-agents" }) {
101
125
  // frame SHORT — BG_MAX_VISIBLE caps rows, activity lines are capped — so the box stays a few rows tall.
102
126
  // If stray border rows ever reappear on a very long turn, drop `borderStyle`/`borderColor` for the
103
127
  // borderless column (the label line alone still heads it).
104
- return (_jsxs(Box, { flexDirection: "column", marginTop: 1, borderStyle: "round", borderColor: theme.muted, paddingX: 1, children: [_jsx(Text, { dimColor: true, children: label }), shown.map((a) => (_jsxs(Box, { flexDirection: "column", children: [_jsxs(Box, { justifyContent: "space-between", children: [_jsxs(Text, { children: [a.status === "working" ? _jsx(OrbitGlyph, {}) : _jsx(Text, { color: COLOR[a.status], children: GLYPH[a.status] }), " ", a.label, a.round != null ? ` · round ${a.round}` : "", a.status === "working" && roundActivity(a) ? _jsxs(Text, { color: theme.accent, children: [" \u00B7 ", cap(roundActivity(a), 28)] }) : null] }), _jsx(Text, { dimColor: true, children: (() => { const m = metrics(a); const ds = DISPLAY_STATUS[a.status]; return m ? `${m} · ${ds}` : ds; })() })] }), _jsx(ActivityLines, { a: a }), _jsx(GrandmasterLine, { a: a }), a.status === "idle" && _jsx(Box, { paddingLeft: 2, children: _jsx(Text, { dimColor: true, children: "result posted \u2014 scroll up or /agents to review" }) }), a.status === "stopped" && _jsx(Box, { paddingLeft: 2, children: _jsx(Text, { dimColor: true, children: "errored \u2014 check transcript for details" }) })] }, a.id))), hidden > 0 ? _jsx(Text, { dimColor: true, children: ` +${hidden} more running` }) : null] }));
128
+ return (_jsxs(Box, { flexDirection: "column", marginTop: 1, borderStyle: "round", borderColor: theme.muted, paddingX: 1, children: [_jsx(Text, { dimColor: true, children: label }), shown.map((a) => (_jsxs(Box, { flexDirection: "column", children: [_jsxs(Box, { justifyContent: "space-between", children: [_jsxs(Text, { children: [a.status === "working" ? _jsx(OrbitGlyph, {}) : _jsx(Text, { color: COLOR[a.status], children: GLYPH[a.status] }), " ", a.label, a.round != null ? ` · round ${a.round}` : "", a.status === "working" && missionLine(a) ? _jsxs(Text, { color: theme.accent, children: [" \u00B7 ", cap(missionLine(a), 36)] }) : null] }), _jsx(Text, { dimColor: true, children: (() => { const m = metrics(a); const ds = DISPLAY_STATUS[a.status]; return m ? `${m} · ${ds}` : ds; })() })] }), _jsx(ActivityLines, { a: a }), _jsx(GrandmasterLine, { a: a }), a.status === "idle" && _jsx(Box, { paddingLeft: 2, children: _jsx(Text, { dimColor: true, children: "result posted \u2014 scroll up or /agents to review" }) }), a.status === "stopped" && _jsx(Box, { paddingLeft: 2, children: _jsx(Text, { dimColor: true, children: "errored \u2014 check transcript for details" }) })] }, a.id))), hidden > 0 ? _jsx(Text, { dimColor: true, children: ` +${hidden} more running` }) : null, _jsx(ShellJobs, { jobs: jobs })] }));
105
129
  }
@@ -18,9 +18,10 @@ import { useEffect, useRef, useState } from "react";
18
18
  import { Box, Text, useInput, useStdin } from "ink";
19
19
  import { InputHistory } from "./useInputHistory.js";
20
20
  import { matchSlashCommands } from "./slashCommands.js";
21
+ import { touchInput } from "../idle/activity.js";
21
22
  const PASTE_START = "\x1b[200~";
22
23
  const PASTE_END = "\x1b[201~";
23
- export function Composer({ onSubmit, onInterrupt, onQueue, disabled, suspended, onCycleMode, prompt = "› " }) {
24
+ export function Composer({ onSubmit, onInterrupt, onQueue, disabled, suspended, onCycleMode, onBackground, prompt = "› " }) {
24
25
  const [value, setValue] = useState("");
25
26
  const [selIdx, setSelIdx] = useState(0); // highlighted row in the "/" command menu
26
27
  const pasteCountRef = useRef(0);
@@ -58,6 +59,7 @@ export function Composer({ onSubmit, onInterrupt, onQueue, disabled, suspended,
58
59
  }
59
60
  };
60
61
  const onData = (chunk) => {
62
+ touchInput(); // any byte from the keyboard/paste is the owner being here (idle/activity.ts)
61
63
  const s = typeof chunk === "string" ? chunk : chunk.toString("utf8");
62
64
  if (pasteBufRef.current !== null) {
63
65
  const end = s.indexOf(PASTE_END);
@@ -125,11 +127,12 @@ export function Composer({ onSubmit, onInterrupt, onQueue, disabled, suspended,
125
127
  return text;
126
128
  };
127
129
  useInput((ch, key) => {
130
+ touchInput(); // before the suspended guard: answering an approval prompt is activity too
128
131
  if (suspended)
129
132
  return; // an approval prompt owns the keyboard — don't consume or echo keystrokes
130
133
  if (pasteBufRef.current !== null || pasteGuardRef.current)
131
134
  return; // paste bytes owned by onData
132
- // Shift+Tab cycles the operating mode (Claude-Code parity). Terminals send backtab as ESC[Z, which
135
+ // Shift+Tab cycles the operating mode (matches Claude Code). Terminals send backtab as ESC[Z, which
133
136
  // Ink surfaces as key.tab + key.shift. Handled before text so it never lands a character in the draft.
134
137
  if (key.tab && key.shift) {
135
138
  onCycleMode?.();
@@ -142,6 +145,12 @@ export function Composer({ onSubmit, onInterrupt, onQueue, disabled, suspended,
142
145
  setValue(`/${menuMatches[menuSel].name} `);
143
146
  return;
144
147
  }
148
+ // ctrl+b moves the running command to the background (matches Claude Code). Inside tmux the first ctrl+b is
149
+ // tmux's prefix, so ctrl+z is the same action without the clash. Swallowed either way: never lands in the draft.
150
+ if (isBackgroundKey(ch, key)) {
151
+ onBackground?.();
152
+ return;
153
+ }
145
154
  // ESC / Ctrl+C: apply the pure interruptPlan. ESC mid-turn with a pending draft flushes it into
146
155
  // the queue (so it goes through right after the interrupt, via the turn-finally drain), then
147
156
  // interrupts; an empty-draft ESC and every Ctrl+C are plain interrupts. See interruptPlan below.
@@ -312,3 +321,7 @@ export function interruptPlan(key, ctx) {
312
321
  return { flushDraft: false, interrupt: true };
313
322
  return { flushDraft: false, interrupt: false };
314
323
  }
324
+ /** ctrl+b, or its tmux-safe alias ctrl+z (the shell's own "send to background" key). */
325
+ export function isBackgroundKey(ch, key) {
326
+ return !!key.ctrl && (ch === "b" || ch === "z");
327
+ }