@chibitek/chibi 0.1.195 → 0.1.197

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 (81) hide show
  1. package/dist/assets/{TerminalPanel-ColKaJYW.js → TerminalPanel--bJ8KdIX.js} +1 -1
  2. package/dist/assets/{abnfDiagram-O67JEVCF-3Ob4zw74.js → abnfDiagram-O67JEVCF-B9FTFZ6n.js} +1 -1
  3. package/dist/assets/{arc-HPFapNIH.js → arc-CVbauXMY.js} +1 -1
  4. package/dist/assets/{architectureDiagram-NJMV4G6O-DkCwaZOT.js → architectureDiagram-NJMV4G6O-R_L6cEaF.js} +1 -1
  5. package/dist/assets/{blockDiagram-BEXU5L5S-BimJc2cp.js → blockDiagram-BEXU5L5S-BXc2RYLr.js} +1 -1
  6. package/dist/assets/{c4Diagram-YGBWAQC7-RwjFYoqV.js → c4Diagram-YGBWAQC7-Bii05url.js} +1 -1
  7. package/dist/assets/channel-NejqmlD6.js +1 -0
  8. package/dist/assets/{chunk-2Q5K7J3B-KYH4VNAA.js → chunk-2Q5K7J3B-YimysqOo.js} +1 -1
  9. package/dist/assets/{chunk-3FUC2YCW-CoGh3EJb.js → chunk-3FUC2YCW-CrHKZRq7.js} +2 -2
  10. package/dist/assets/{chunk-5VM5RSS4-BWgviAjX.js → chunk-5VM5RSS4-3y2fUHet.js} +1 -1
  11. package/dist/assets/{chunk-GTNCS2PH-Ddlqcpyc.js → chunk-GTNCS2PH-YSoI0G8B.js} +1 -1
  12. package/dist/assets/{chunk-GWA4HPMP-RV94Cbaa.js → chunk-GWA4HPMP-DsIbENvB.js} +1 -1
  13. package/dist/assets/{chunk-JWPE2WC7-B0BTZ6sh.js → chunk-JWPE2WC7-6s37yBqm.js} +1 -1
  14. package/dist/assets/{chunk-NETBCI7D-CfcSF9jy.js → chunk-NETBCI7D-ezv6I2Jw.js} +1 -1
  15. package/dist/assets/{chunk-WEXAMYUT-srnz312I.js → chunk-WEXAMYUT-BYg3YNuR.js} +1 -1
  16. package/dist/assets/{chunk-XXDRQBXY-C4vdFU17.js → chunk-XXDRQBXY-ia5t27ll.js} +1 -1
  17. package/dist/assets/{classDiagram-v2-NBCMYWYE-DNy2vFs-.js → classDiagram-v2-NBCMYWYE-CjKSkyGp.js} +1 -1
  18. package/dist/assets/{cose-bilkent-JH36ORCC-D0i9E7vP.js → cose-bilkent-JH36ORCC-CG8y2L2j.js} +1 -1
  19. package/dist/assets/{cynefin-OW5HDTMX-gkAOk-jI.js → cynefin-OW5HDTMX-DZkEKzBB.js} +1 -1
  20. package/dist/assets/{cynefinDiagram-VND7K2PF-Q4524mSo.js → cynefinDiagram-VND7K2PF-DnowKsJ-.js} +1 -1
  21. package/dist/assets/{dagre-6A5THRUB-Bzq01xjc.js → dagre-6A5THRUB-CMtfQGlI.js} +1 -1
  22. package/dist/assets/{diagram-22UHCM2B-Cm5DPMsm.js → diagram-22UHCM2B-Bk94047z.js} +1 -1
  23. package/dist/assets/{diagram-3UASUU5V-6tnEN2tD.js → diagram-3UASUU5V-Ui5qVUoC.js} +1 -1
  24. package/dist/assets/{diagram-ATOU4E4O-Ce8MaZqL.js → diagram-ATOU4E4O-C2yF8mt5.js} +1 -1
  25. package/dist/assets/{diagram-CDSNMT55-DmxP3ZT3.js → diagram-CDSNMT55-Csj1m-Qs.js} +1 -1
  26. package/dist/assets/{diagram-MLGK6HIB-BG4kwPCS.js → diagram-MLGK6HIB-W3uwKf9S.js} +1 -1
  27. package/dist/assets/{diagram-MPIPVDR6-BnLYiwBc.js → diagram-MPIPVDR6-CrF8_LWl.js} +1 -1
  28. package/dist/assets/{ebnfDiagram-ZINNZB2B-Dd19Rw8P.js → ebnfDiagram-ZINNZB2B-FG0V0Pck.js} +1 -1
  29. package/dist/assets/{elk-276RUBZZ-B2-jAuba.js → elk-276RUBZZ-BnptZiPT.js} +1 -1
  30. package/dist/assets/{erDiagram-OPXOYQCR-CVXqmXQ8.js → erDiagram-OPXOYQCR-DQ9QNt66.js} +1 -1
  31. package/dist/assets/{flowDiagram-KWPJA3E3-RrANAUuT.js → flowDiagram-KWPJA3E3-BSQCaJJS.js} +1 -1
  32. package/dist/assets/{ganttDiagram-FUAMR5RP-C5vGW4y-.js → ganttDiagram-FUAMR5RP-DNhPCPBz.js} +1 -1
  33. package/dist/assets/{gitGraphDiagram-X574FWY7-BHvq9YfO.js → gitGraphDiagram-X574FWY7-Bwziujo8.js} +1 -1
  34. package/dist/assets/{index-DQQGKX5x.js → index-C1MRa2jb.js} +140 -140
  35. package/dist/assets/{index-1PLvu0_F.js → index-kIcmWTVM.js} +1 -1
  36. package/dist/assets/{infoDiagram-VRGFBTTK-DvuzWS54.js → infoDiagram-VRGFBTTK-BoeGC6R0.js} +1 -1
  37. package/dist/assets/{ishikawaDiagram-OU5B5YK6-cCkUTtkg.js → ishikawaDiagram-OU5B5YK6-MqJALuN6.js} +1 -1
  38. package/dist/assets/{journeyDiagram-ZHPQQLJL-B0RmSvGs.js → journeyDiagram-ZHPQQLJL-CDmYfmBD.js} +1 -1
  39. package/dist/assets/{kanban-definition-PNTS6WVX-xbVsCFqa.js → kanban-definition-PNTS6WVX-BncCNuev.js} +1 -1
  40. package/dist/assets/{linear-ChjewIA3.js → linear-D7y9LlCy.js} +1 -1
  41. package/dist/assets/{mermaid.core-s9HcmFG6.js → mermaid.core-C-8HBWdK.js} +5 -5
  42. package/dist/assets/{mindmap-definition-NLK3R4M7-DyOdKH03.js → mindmap-definition-NLK3R4M7-CVY8yI8k.js} +1 -1
  43. package/dist/assets/{pegDiagram-GJSIUBJH-CIvAV7Do.js → pegDiagram-GJSIUBJH-RAHytJwr.js} +1 -1
  44. package/dist/assets/{pieDiagram-5QR66LMP-wPi-yl9z.js → pieDiagram-5QR66LMP-DVdUiz7U.js} +1 -1
  45. package/dist/assets/{quadrantDiagram-O4NWA36T-SBFfoKYC.js → quadrantDiagram-O4NWA36T-BgrtWShT.js} +1 -1
  46. package/dist/assets/{railroadDiagram-XR7U4H2S-Otwi150n.js → railroadDiagram-XR7U4H2S-DipM2y3J.js} +1 -1
  47. package/dist/assets/{requirementDiagram-PLB6GJNP-D8He2y9Y.js → requirementDiagram-PLB6GJNP-hS3TxvWM.js} +1 -1
  48. package/dist/assets/{sankeyDiagram-IPEJSGJF-Z39wdwHB.js → sankeyDiagram-IPEJSGJF-BC280MpB.js} +1 -1
  49. package/dist/assets/{sequenceDiagram-PO4LG4MO-ELX5hqvT.js → sequenceDiagram-PO4LG4MO-ewNIiNrD.js} +1 -1
  50. package/dist/assets/{sizeCapture-INFHLROL-BDeFl-HY.js → sizeCapture-INFHLROL-MhMinfv2.js} +1 -1
  51. package/dist/assets/{stateDiagram-v2-GCMORJYK-DUbETp8f.js → stateDiagram-v2-GCMORJYK-BDlA_ZR7.js} +1 -1
  52. package/dist/assets/{swimlanes-2SLR337P-D3WtSrRL.js → swimlanes-2SLR337P-H8P8RCKC.js} +1 -1
  53. package/dist/assets/swimlanesDiagram-TC7HE7FX-0B8do8GC.js +8 -0
  54. package/dist/assets/{timeline-definition-EJHVYXUP-C4s78-PG.js → timeline-definition-EJHVYXUP-DMyIeQ7T.js} +1 -1
  55. package/dist/assets/{usecaseDiagram-POWQR4AR-D6Gf3aB1.js → usecaseDiagram-POWQR4AR-DRvphcF6.js} +1 -1
  56. package/dist/assets/{vennDiagram-UO4OBE2U-RMzQilxk.js → vennDiagram-UO4OBE2U-m4Q4kbA5.js} +1 -1
  57. package/dist/assets/{wardleyDiagram-VNRHLVJA-B9YM9a43.js → wardleyDiagram-VNRHLVJA-CeX5n3Zi.js} +1 -1
  58. package/dist/assets/{xychartDiagram-PMCCYNJV-D7GxLZwD.js → xychartDiagram-PMCCYNJV-CpJZkSHf.js} +1 -1
  59. package/dist/handbook/atomic-handbook.html +1 -1
  60. package/dist/index.html +1 -1
  61. package/dist-server/companion/src/routes.js +29 -0
  62. package/dist-server/container-mcp.js +36 -13
  63. package/dist-server/index.js +1724 -1722
  64. package/dist-server/openmausbot.js +42258 -42001
  65. package/dist-server/pair-cli.js +42258 -42001
  66. package/dist-server/server/app-installers.js +26 -15
  67. package/dist-server/server/cli-browser.js +42 -0
  68. package/dist-server/server/cli-help.js +4 -0
  69. package/dist-server/server/cli-terminal.js +87 -0
  70. package/dist-server/server/cli.js +12 -45
  71. package/dist-server/server/container-computer.js +45 -45
  72. package/dist-server/server/index.js +12 -13
  73. package/dist-server/server/local-vm-inventory.js +19 -1
  74. package/dist-server/server/request-auth.js +2 -1
  75. package/dist-server/server/routes/terminal.js +13 -2
  76. package/dist-server/server/terminal-places.js +3 -2
  77. package/dist-server/server/terminal.js +28 -2
  78. package/dist-server/vps-container-mcp.js +23 -0
  79. package/package.json +1 -1
  80. package/dist/assets/channel-CCkmsk9Z.js +0 -1
  81. package/dist/assets/swimlanesDiagram-TC7HE7FX-cEw5_whO.js +0 -8
@@ -32,8 +32,10 @@ export const APP_INSTALLERS = Object.freeze({
32
32
  ollama: { repo: "ollama/ollama", asset: () => "Ollama-darwin.zip", teamId: "3MU9H2V9Y9", kind: "zip-app", appName: "Ollama.app" },
33
33
  podman: {
34
34
  repo: "podman-container-tools/podman",
35
- // Podman 6 publishes an Apple silicon installer only.
36
- asset: (arch) => (arch === "arm64" ? "podman-installer-macos-arm64.pkg" : null),
35
+ // Intel stays on the supported 5.8 maintenance line (through June 2027).
36
+ // Update this reviewed pin for security releases; never resolve Intel via latest.
37
+ asset: (arch) => arch === "arm64" ? "podman-installer-macos-arm64.pkg" : arch === "x64" ? "podman-installer-macos-amd64.pkg" : null,
38
+ releaseTag: (arch) => arch === "x64" ? "v5.8.10" : undefined,
37
39
  teamId: "HYSCB8KRL2",
38
40
  kind: "pkg",
39
41
  },
@@ -65,9 +67,10 @@ export async function latestReleaseAsset(spec, arch, fetchImpl = fetch, signal)
65
67
  const name = spec.asset(arch);
66
68
  if (!name)
67
69
  throw new AppInstallError("unsupported", `No ${spec.repo} installer is published for ${arch} computers.`);
70
+ const tag = spec.releaseTag?.(arch);
68
71
  let response;
69
72
  try {
70
- response = await fetchImpl(`https://api.github.com/repos/${spec.repo}/releases/latest`, {
73
+ response = await fetchImpl(`https://api.github.com/repos/${spec.repo}/releases/${tag ? `tags/${encodeURIComponent(tag)}` : "latest"}`, {
71
74
  headers: { accept: "application/vnd.github+json", "user-agent": "Atomic" },
72
75
  redirect: "follow",
73
76
  signal: signal ?? AbortSignal.timeout(30_000),
@@ -349,22 +352,30 @@ export async function openPodmanInstaller(deps = {}) {
349
352
  }
350
353
  /** After Podman is installed: create and start its virtual machine. The first
351
354
  * `machine init` downloads the machine image, so it gets a long timeout. */
352
- export async function startPodmanMachine(podman, run = (command, args) => runTool(command, args, 30 * 60_000)) {
353
- const list = await run(podman, ["machine", "list", "--format", "json"]).catch(() => ({ stdout: "[]", stderr: "" }));
354
- let machines = [];
355
+ export async function startPodmanMachine(podman, run = (command, args) => runTool(command, args, args[0] === "info" || args[1] === "list" ? 10_000 : 30 * 60_000)) {
355
356
  try {
356
- machines = JSON.parse(list.stdout || "[]");
357
- }
358
- catch {
359
- machines = [];
360
- }
361
- try {
362
- if (!machines.length)
357
+ // An unreadable list is not an empty list: never initialize over an error.
358
+ const { stdout } = await run(podman, ["machine", "list", "--format", "json"]);
359
+ const machines = JSON.parse(stdout);
360
+ if (!Array.isArray(machines) || machines.some(machine => !machine || typeof machine.Name !== "string" || typeof machine.Running !== "boolean")) {
361
+ throw new Error("Podman returned an unreadable machine list. Retry from Settings > Computers.");
362
+ }
363
+ if (!machines.length) {
363
364
  await run(podman, ["machine", "init"]);
364
- if (!machines.some((machine) => machine.Running))
365
365
  await run(podman, ["machine", "start"]);
366
+ }
367
+ else if (!machines.some(machine => machine.Running)) {
368
+ // Start an existing default (or the sole machine), never a second machine
369
+ // beside a custom setup. Ambiguity needs the person's Podman selection.
370
+ const machine = machines.find(machine => machine.Default === true || machine.Name === "podman-machine-default") ?? (machines.length === 1 ? machines[0] : undefined);
371
+ if (!machine)
372
+ throw new Error("Choose a default machine in Podman Desktop, then retry here.");
373
+ await run(podman, ["machine", "start", machine.Name]);
374
+ }
375
+ // A running flag does not prove the engine is reachable by this connection.
376
+ await run(podman, ["info", "--format", "json"]);
366
377
  }
367
378
  catch (error) {
368
- throw new AppInstallError("install", `${error.stderr ?? String(error)}`.trim());
379
+ throw new AppInstallError("install", `${error.stderr || String(error)}`.trim());
369
380
  }
370
381
  }
@@ -0,0 +1,42 @@
1
+ const message = (error) => (error instanceof Error ? error.message : String(error));
2
+ export async function runBrowser(options, io) {
3
+ const { browserEngineStatus, describeBrowserEngine, ensureChrome, installAgentBrowserBinary, resolveAgentBrowserBinary } = await import("./browser-engine.js");
4
+ const status = browserEngineStatus({ dataDir: options.dataDir });
5
+ if (options.browserAction === "status") {
6
+ io.log(describeBrowserEngine(status));
7
+ if (status.kind !== "ready" && status.installable)
8
+ io.log("install it with: chibi browser install");
9
+ return status.kind === "ready" ? 0 : 1;
10
+ }
11
+ let binary = resolveAgentBrowserBinary({ dataDir: options.dataDir });
12
+ if (binary) {
13
+ io.log(`agent-browser is already here: ${binary}`);
14
+ }
15
+ else {
16
+ if (status.kind !== "ready" && !status.installable) {
17
+ io.error(status.reason);
18
+ return 1;
19
+ }
20
+ try {
21
+ binary = await installAgentBrowserBinary({ dataDir: options.dataDir, log: io.log });
22
+ }
23
+ catch (error) {
24
+ io.error(`could not install agent-browser: ${message(error)}`);
25
+ return 1;
26
+ }
27
+ io.log(`installed ${binary}`);
28
+ }
29
+ try {
30
+ await ensureChrome(binary, { withDeps: options.withDeps === true, log: io.log });
31
+ }
32
+ catch (error) {
33
+ io.error(`Chrome is not ready: ${message(error)}`);
34
+ if (process.platform === "linux" && !options.withDeps)
35
+ io.error("on Linux, install Chrome's system libraries with `sudo chibi browser install --with-deps`, then retry `chibi browser install` as the user running serve");
36
+ return 1;
37
+ }
38
+ io.log("browser installed for this user and data directory; run serve as the same user, then enable it under Settings → Experimental and per bot");
39
+ if (process.platform === "linux" && options.withDeps)
40
+ io.log("if serve runs as another user, run `chibi browser install` from that user's login shell too");
41
+ return 0;
42
+ }
@@ -16,6 +16,7 @@ export const USAGE = `chibi — your team of AI bots, ready in a few steps
16
16
  chibi access list | add EMAIL [--chat-only] | remove EMAIL
17
17
  chibi service install [--domain HOST | --tunnel | --tailscale] [--port N] [--data-dir DIR] | uninstall
18
18
  chibi browser install [--with-deps] | status
19
+ chibi terminal --bot ID [--place local|vm|cloud] [--thread ID]
19
20
  chibi fleet init --domain HOST [--operator USER] | create NAME --admin EMAIL [--member EMAIL] [--brand FILE]
20
21
  [--anthropic-key-file FILE] [--cap USD] [--license-key KEY] [--memory 1G]
21
22
  | list | users NAME add|remove EMAIL [--chat-only] | suspend NAME | resume NAME
@@ -44,6 +45,9 @@ browser install: the bots' browser engine (agent-browser, pinned) into the
44
45
  the Linux libraries Chrome needs (run as root once). Then run
45
46
  browser install as the user running serve, from that user's home.
46
47
  status: what the current user and data directory have.
48
+ terminal a shell on a bot's computer, like the Computer panel's Terminal
49
+ tab: local (this computer, the default), vm or cloud. Keys go to
50
+ the shell as typed; Ctrl-] closes it.
47
51
  fleet many client workspaces on one Linux server, each its own account,
48
52
  service, data folder, brand, sign-in list and keys at NAME.HOST
49
53
  behind the system Caddy. Plans are printed unless run as root;
@@ -0,0 +1,87 @@
1
+ // `chibi terminal --bot ID [--place vm|cloud|local] [--thread ID]`: the
2
+ // Computer panel's Terminal tab in this terminal, through the running server
3
+ // (server/routes/terminal.ts). Loopback is the owner, so the shell is the
4
+ // desktop's; a service-trust server refuses it like any other caller.
5
+ //
6
+ // Keys go to the shell as typed (raw mode), Ctrl-C included. Ctrl-] closes
7
+ // the shell and returns, as in telnet.
8
+ const CLOSE_KEY = "\x1d";
9
+ const HEADERS = { "content-type": "application/json", "x-openmausbot-cli": "1" };
10
+ export async function runTerminal(options, io) {
11
+ const call = io.fetch ?? fetch;
12
+ const base = `http://127.0.0.1:${options.port}`;
13
+ let opened;
14
+ try {
15
+ opened = await call(`${base}/api/bots/${encodeURIComponent(options.botId)}/terminal`, {
16
+ method: "POST",
17
+ headers: HEADERS,
18
+ body: JSON.stringify({ place: options.place, threadId: options.threadId, cols: io.stdout.columns, rows: io.stdout.rows }),
19
+ });
20
+ }
21
+ catch {
22
+ io.error(`no server answered on port ${options.port}; start it with chibi start`);
23
+ return 1;
24
+ }
25
+ const body = await opened.json().catch(() => ({}));
26
+ if (!opened.ok || !body.id) {
27
+ io.error(body.error ?? `Server returned ${opened.status}`);
28
+ return 1;
29
+ }
30
+ const session = `${base}/api/terminal/${encodeURIComponent(body.id)}`;
31
+ const stream = await call(`${session}/stream`, { headers: HEADERS });
32
+ if (!stream.ok || !stream.body) {
33
+ io.error(`the terminal stream did not open (${stream.status})`);
34
+ return 1;
35
+ }
36
+ const reader = stream.body.getReader();
37
+ // Keystrokes go out one request at a time so they arrive in order.
38
+ let sending = Promise.resolve();
39
+ const onKeys = (chunk) => {
40
+ const data = chunk.toString();
41
+ if (data.includes(CLOSE_KEY)) {
42
+ void reader.cancel();
43
+ return;
44
+ }
45
+ sending = sending.then(() => call(`${session}/input`, { method: "POST", headers: HEADERS, body: JSON.stringify({ data }) }).then(() => undefined, () => undefined));
46
+ };
47
+ const raw = Boolean(io.stdin.isTTY && io.stdin.setRawMode);
48
+ if (raw)
49
+ io.stdin.setRawMode(true);
50
+ io.stdin.on("data", onKeys);
51
+ io.stdin.resume();
52
+ let code = null;
53
+ const decoder = new TextDecoder();
54
+ let pending = "";
55
+ try {
56
+ for (;;) {
57
+ const { done, value } = await reader.read();
58
+ if (done)
59
+ break;
60
+ pending += decoder.decode(value, { stream: true });
61
+ const lines = pending.split("\n");
62
+ pending = lines.pop() ?? "";
63
+ for (const line of lines) {
64
+ // Blank lines are the server's keepalive.
65
+ if (!line.trim())
66
+ continue;
67
+ const event = JSON.parse(line);
68
+ if (event.type === "output" && event.data)
69
+ io.stdout.write(event.data);
70
+ if (event.type === "exit")
71
+ code = event.code ?? 0;
72
+ }
73
+ }
74
+ }
75
+ catch {
76
+ // The stream was cut (Ctrl-], or the server went away); the shell is closed below.
77
+ }
78
+ finally {
79
+ io.stdin.off("data", onKeys);
80
+ if (raw)
81
+ io.stdin.setRawMode(false);
82
+ io.stdin.pause();
83
+ }
84
+ await sending;
85
+ await call(session, { method: "DELETE", headers: HEADERS }).catch(() => undefined);
86
+ return code ?? 0;
87
+ }
@@ -1,4 +1,6 @@
1
1
  import { USAGE } from "./cli-help.js";
2
+ import { runBrowser } from "./cli-browser.js";
3
+ import { runTerminal } from "./cli-terminal.js";
2
4
  export { USAGE } from "./cli-help.js";
3
5
  // `chibi` on the command line: run the server anywhere and pair devices
4
6
  // to it. One implementation for three homes — `npx @chibitek/chibi` (the npm
@@ -50,7 +52,7 @@ import { defaultSetupIo, SetupCancelled } from "./cli-prompts.js";
50
52
  import { normalizePhoneOrigin, phonePairingInstructions, runPhoneSetup } from "./cli-phone-setup.js";
51
53
  import { cleanupTunnelOrigin, createTunnelAccount, createTunnelOrigin, describeTunnelAccount, describeTunnelState, ensureCloudflared, FLEET_CREDENTIAL_ENV, fleetAccess, fleetCredential, guardianEntry, startTunnel, tunnelAccess, } from "./tunnel.js";
52
54
  const HERE = dirname(fileURLToPath(import.meta.url));
53
- export const COMMANDS = ["command", "goal", "setup", "start", "serve", "pair", "sessions", "status", "login", "logout", "access", "service", "browser", "fleet", "help", "--help", "-h"];
55
+ export const COMMANDS = ["command", "goal", "setup", "start", "serve", "pair", "sessions", "status", "login", "logout", "access", "service", "browser", "fleet", "terminal", "help", "--help", "-h"];
54
56
  export function parseArgs(argv, env = process.env) {
55
57
  const implicitStart = !argv.length || (argv[0].startsWith("--") && argv[0] !== "--help");
56
58
  const [command = "start", ...rest] = implicitStart ? ["start", ...argv] : argv;
@@ -79,11 +81,11 @@ export function parseArgs(argv, env = process.env) {
79
81
  return v;
80
82
  };
81
83
  try {
82
- if ((options.command === "command" || options.command === "goal") && arg === "--bot")
84
+ if ((options.command === "command" || options.command === "goal" || options.command === "terminal") && arg === "--bot")
83
85
  options.botId = value();
84
86
  else if ((options.command === "command" || options.command === "goal") && arg === "--group")
85
87
  options.groupId = value();
86
- else if ((options.command === "command" || options.command === "goal") && arg === "--thread")
88
+ else if ((options.command === "command" || options.command === "goal" || options.command === "terminal") && arg === "--thread")
87
89
  options.threadId = value();
88
90
  else if ((options.command === "command" || options.command === "goal") && arg === "--text")
89
91
  options.commandText = value();
@@ -143,6 +145,8 @@ export function parseArgs(argv, env = process.env) {
143
145
  options.browserAction = arg;
144
146
  else if (options.command === "browser" && arg === "--with-deps")
145
147
  options.withDeps = true;
148
+ else if (options.command === "terminal" && arg === "--place")
149
+ options.place = value();
146
150
  else if (options.command === "fleet" && !options.fleetAction && ["init", "create", "list", "users", "suspend", "resume", "delete", "upgrade", "agent"].includes(arg))
147
151
  options.fleetAction = arg;
148
152
  else if (options.command === "fleet" && options.fleetAction && !["init", "list", "upgrade", "agent"].includes(options.fleetAction) && !options.slug && !arg.startsWith("--"))
@@ -205,6 +209,8 @@ export function parseArgs(argv, env = process.env) {
205
209
  return { error: "--local cannot be combined with a remote-access option" };
206
210
  if (options.command === "browser" && !options.browserAction)
207
211
  return { error: "browser needs an action: install or status" };
212
+ if (options.command === "terminal" && (!options.botId || !["vm", "cloud", "local"].includes(options.place ?? "local")))
213
+ return { error: "terminal needs --bot ID, and --place is vm, cloud or local" };
208
214
  if (options.command === "fleet") {
209
215
  if (!options.fleetAction)
210
216
  return { error: "fleet needs one of: init --domain HOST [--operator USER], create NAME --admin EMAIL, list, users NAME add|remove EMAIL, suspend NAME, resume NAME, delete NAME --yes, upgrade, agent" };
@@ -722,47 +728,6 @@ export async function runLogout(options, io = defaultIo()) {
722
728
  io.log(`Signed out ${before.email}${before.address ? `; ${before.address} is released` : ""}.`);
723
729
  return 0;
724
730
  }
725
- export async function runBrowser(options, io = defaultIo()) {
726
- const { browserEngineStatus, describeBrowserEngine, ensureChrome, installAgentBrowserBinary, resolveAgentBrowserBinary } = await import("./browser-engine.js");
727
- const status = browserEngineStatus({ dataDir: options.dataDir });
728
- if (options.browserAction === "status") {
729
- io.log(describeBrowserEngine(status));
730
- if (status.kind !== "ready" && status.installable)
731
- io.log("install it with: chibi browser install");
732
- return status.kind === "ready" ? 0 : 1;
733
- }
734
- let binary = resolveAgentBrowserBinary({ dataDir: options.dataDir });
735
- if (binary) {
736
- io.log(`agent-browser is already here: ${binary}`);
737
- }
738
- else {
739
- if (status.kind !== "ready" && !status.installable) {
740
- io.error(status.reason);
741
- return 1;
742
- }
743
- try {
744
- binary = await installAgentBrowserBinary({ dataDir: options.dataDir, log: io.log });
745
- }
746
- catch (error) {
747
- io.error(`could not install agent-browser: ${message(error)}`);
748
- return 1;
749
- }
750
- io.log(`installed ${binary}`);
751
- }
752
- try {
753
- await ensureChrome(binary, { withDeps: options.withDeps === true, log: io.log });
754
- }
755
- catch (error) {
756
- io.error(`Chrome is not ready: ${message(error)}`);
757
- if (process.platform === "linux" && !options.withDeps)
758
- io.error("on Linux, install Chrome's system libraries with `sudo chibi browser install --with-deps`, then retry `chibi browser install` as the user running serve");
759
- return 1;
760
- }
761
- io.log("browser installed for this user and data directory; run serve as the same user, then enable it under Settings → Experimental and per bot");
762
- if (process.platform === "linux" && options.withDeps)
763
- io.log("if serve runs as another user, run `chibi browser install` from that user's login shell too");
764
- return 0;
765
- }
766
731
  /** Where the server bundle lives relative to this file: next to it in the
767
732
  * npm package and the image (dist-server/), or the TypeScript source in a
768
733
  * checkout. */
@@ -1260,7 +1225,9 @@ export async function main(argv = process.argv.slice(2)) {
1260
1225
  case "logout":
1261
1226
  return runLogout(options);
1262
1227
  case "browser":
1263
- return runBrowser(options);
1228
+ return runBrowser(options, defaultIo());
1229
+ case "terminal":
1230
+ return runTerminal({ port: options.port, botId: options.botId, place: options.place ?? "local", threadId: options.threadId }, { stdin: process.stdin, stdout: process.stdout, error: (line) => console.error(line) });
1264
1231
  default:
1265
1232
  console.log(USAGE);
1266
1233
  return 0;
@@ -12,7 +12,8 @@ import { tmpdir } from "node:os";
12
12
  import { dirname, join, resolve } from "node:path";
13
13
  import { promisify } from "node:util";
14
14
  import { augmentedPath, resolveCliSpawn } from "./env-path.js";
15
- import { colimaStartPlan, dockerEnvForColima, startColima } from "./colima-docker.js";
15
+ import { dockerEnvForColima } from "./colima-docker.js";
16
+ import { startPodmanMachine, AppInstallError } from "./app-installers.js";
16
17
  import { spawnOptionsFor } from "./spawn-command.js";
17
18
  import { DATA_DIR } from "./config.js";
18
19
  import { SPAWNED_PROXIES } from "./proxy-paths.js";
@@ -53,25 +54,25 @@ const MEMORY_BYTES = 4 * 1024 * 1024 * 1024;
53
54
  const NANO_CPUS = 2_000_000_000;
54
55
  const PIDS_LIMIT = 512;
55
56
  const SHM_BYTES = 512 * 1024 * 1024;
56
- export const SHARED_LOCAL_VM_TARGET = {
57
- key: "shared",
58
- containerName: CONTAINER,
59
- workspaceDir: VM_WORKSPACE_DIR,
60
- viewerPort: HOST_VIEWER_PORT,
61
- label: "shared",
62
- };
57
+ /** Macs run Local VMs only under Podman. Older Docker or Colima desktops keep
58
+ * their folders, containers and port 6080: Podman ones get their own empty
59
+ * `vm-homes/podman-*` folders (backup and restore already cover vm-homes),
60
+ * container names and an ephemeral loopback viewer port. */
61
+ export const PODMAN_MAC_PREFIX = "podman-";
62
+ const separatePodman = (platform) => platform === "darwin";
63
+ export function sharedLocalVmTarget(platform = process.platform) {
64
+ if (!separatePodman(platform))
65
+ return { key: "shared", containerName: CONTAINER, workspaceDir: VM_WORKSPACE_DIR, viewerPort: HOST_VIEWER_PORT, label: "shared" };
66
+ const name = `${PODMAN_MAC_PREFIX}shared`;
67
+ return { key: "shared", containerName: `${CONTAINER}-${name}`, workspaceDir: join(DATA_DIR, "vm-homes", name), viewerPort: null, label: "shared" };
68
+ }
69
+ export const SHARED_LOCAL_VM_TARGET = sharedLocalVmTarget();
63
70
  /** Derive filesystem/container identities from a digest, never from a bot's
64
71
  * display name or caller-controlled path fragment. */
65
- export function perBotLocalVmTarget(botId) {
72
+ export function perBotLocalVmTarget(botId, platform = process.platform) {
66
73
  const digest = createHash("sha256").update(botId).digest("hex");
67
- const short = digest.slice(0, 16);
68
- return {
69
- key: `bot:${digest}`,
70
- containerName: `${CONTAINER}-${short}`,
71
- workspaceDir: join(DATA_DIR, "vm-homes", short),
72
- viewerPort: null,
73
- label: digest,
74
- };
74
+ const short = `${separatePodman(platform) ? PODMAN_MAC_PREFIX : ""}${digest.slice(0, 16)}`;
75
+ return { key: `bot:${digest}`, containerName: `${CONTAINER}-${short}`, workspaceDir: join(DATA_DIR, "vm-homes", short), viewerPort: null, label: digest };
75
76
  }
76
77
  const LINUX_WHEELS = {
77
78
  x86_64: {
@@ -211,12 +212,10 @@ async function installed(cmd, runner, platform) {
211
212
  /** Inspect only the host runtime. Unlike a full Local VM status check, this
212
213
  * never opens a container, calls Cua, or reads a desktop screenshot. */
213
214
  export async function containerRuntimeStatus(runner = sh, platform = process.platform) {
214
- // Podman is the supported Windows VM lane and owns the pinned managed image.
215
- // Docker may also be installed and healthy on the same host, so the generic
216
- // Docker-first order would silently select an empty, unrelated image store.
217
- const candidates = platform === "win32"
218
- ? ["podman", "docker"]
219
- : RUNTIMES.filter((runtime) => runtime !== "container" || platform === "darwin");
215
+ // Macs use only Podman, including when stopped or absent. Falling back to a
216
+ // healthy Docker/Colima silently selects a different image/workspace store.
217
+ const candidates = platform === "darwin" ? ["podman"]
218
+ : platform === "win32" ? ["podman", "docker"] : ["docker", "podman"];
220
219
  const present = await Promise.all(candidates.map((runtime) => installed(runtime, runner, platform)));
221
220
  const available = candidates.filter((_, index) => present[index]);
222
221
  const healthy = await Promise.all(available.map(async (candidate) => {
@@ -240,22 +239,13 @@ export async function containerRuntimeStatus(runner = sh, platform = process.pla
240
239
  daemonUp: healthyIndex >= 0,
241
240
  };
242
241
  }
243
- /** How this machine's stopped Docker engine is started, or null when Atomic
244
- * must not try: Colima on a Mac where it is installed, never Docker Desktop
245
- * on any platform (colima-docker.ts). Linux needs root for the daemon and
246
- * Windows runs the Local VM on Podman, so neither is started here. */
247
- export async function containerRuntimeStartPlan(runner = sh, platform = process.platform, env = process.env) {
248
- return platform === "darwin" && await installed("colima", runner, platform) ? colimaStartPlan(env) : null;
249
- }
250
242
  let runtimeStartInFlight = null;
251
243
  let runtimeStartError = null;
252
- /** Why the last start left the Local VM without an engine; null once docker answers. */
244
+ /** Why the last start failed; cleared after Podman answers. */
253
245
  export const containerRuntimeError = () => runtimeStartError;
254
- /** Start the person's installed Colima when docker is not answering, with a
255
- * retry and a restart, bounded (startColima). Never installs anything, never
256
- * opens Docker Desktop, never touches Podman or Apple container. One start at
257
- * a time: concurrent callers (startup and a turn) share the same attempt.
258
- * Callers decide whether the person allowed it; this only does it. */
246
+ /** Start installed Podman on macOS using the same setup path as the GUI.
247
+ * Never installs a runtime or touches another runtime's machines or data.
248
+ * Startup and explicit setup share one attempt; failure allows a later retry. */
259
249
  export function ensureContainerRuntime(opts = {}) {
260
250
  if (runtimeStartInFlight)
261
251
  return runtimeStartInFlight;
@@ -263,10 +253,19 @@ export function ensureContainerRuntime(opts = {}) {
263
253
  const runner = opts.runner ?? sh;
264
254
  const platform = opts.platform ?? process.platform;
265
255
  const before = await containerRuntimeStatus(runner, platform);
266
- if (before.daemonUp || before.runtime !== "docker")
256
+ if (before.daemonUp || platform !== "darwin" || before.runtime !== "podman") {
267
257
  return { status: before, started: null, error: null };
268
- const plan = await containerRuntimeStartPlan(runner, platform, opts.env);
269
- return startColima(plan, before, { runner, platform, status: () => containerRuntimeStatus(runner, platform), ...opts });
258
+ }
259
+ try {
260
+ await startPodmanMachine("podman", async (command, args) => ({
261
+ ...await runner(command, args, args[0] === "info" || args[1] === "list" ? 10_000 : 30 * 60_000), stderr: "",
262
+ }));
263
+ const status = await containerRuntimeStatus(runner, platform);
264
+ return { status, started: "Podman", error: status.daemonUp ? null : "Podman is not answering. Retry from Settings > Computers." };
265
+ }
266
+ catch (error) {
267
+ return { status: before, started: "Podman", error: error instanceof AppInstallError ? error.detail : String(error) };
268
+ }
270
269
  })();
271
270
  runtimeStartInFlight = attempt;
272
271
  void attempt.then((outcome) => { runtimeStartError = outcome.status.daemonUp ? null : outcome.error; }, () => { });
@@ -429,7 +428,7 @@ export function cuaExecArgs(args, options = {}) {
429
428
  ...args,
430
429
  ];
431
430
  }
432
- export async function containerComputerStatus(runner = sh, platform = process.platform, target = SHARED_LOCAL_VM_TARGET) {
431
+ export async function containerComputerStatus(runner = sh, platform = process.platform, target = sharedLocalVmTarget(platform)) {
433
432
  const status = emptyStatus(platform, target);
434
433
  const runtimeStatus = await containerRuntimeStatus(runner, platform);
435
434
  status.available = runtimeStatus.available;
@@ -767,7 +766,7 @@ async function prepareManagedImage(runtime, runner) {
767
766
  await rm(context, { recursive: true, force: true });
768
767
  }
769
768
  }
770
- export async function containerComputerAction(action, runner = sh, platform = process.platform, target = SHARED_LOCAL_VM_TARGET) {
769
+ export async function containerComputerAction(action, runner = sh, platform = process.platform, target = sharedLocalVmTarget(platform)) {
771
770
  if (runner === sh && platform === process.platform)
772
771
  screenshotStatusCache.delete(target.key);
773
772
  const before = await containerComputerStatus(runner, platform, target);
@@ -857,7 +856,7 @@ export function wholeScreenshot(bytes) {
857
856
  /** The raw frame, in the shape the live screen poller broadcasts to every
858
857
  * client (server/index.ts). The web panel wants a data URL instead, so
859
858
  * containerComputerScreenshot below wraps this one. */
860
- export async function containerComputerFrame(runner = sh, platform = process.platform, target = SHARED_LOCAL_VM_TARGET) {
859
+ export async function containerComputerFrame(runner = sh, platform = process.platform, target = sharedLocalVmTarget(platform)) {
861
860
  const cacheable = runner === sh && platform === process.platform;
862
861
  const now = Date.now();
863
862
  const cached = screenshotStatusCache.get(target.key);
@@ -896,7 +895,7 @@ export async function containerComputerFrame(runner = sh, platform = process.pla
896
895
  throw error;
897
896
  }
898
897
  }
899
- export async function containerComputerScreenshot(runner = sh, platform = process.platform, target = SHARED_LOCAL_VM_TARGET) {
898
+ export async function containerComputerScreenshot(runner = sh, platform = process.platform, target = sharedLocalVmTarget(platform)) {
900
899
  const { png, format } = await containerComputerFrame(runner, platform, target);
901
900
  return `data:image/${format};base64,${png}`;
902
901
  }
@@ -908,7 +907,8 @@ const screenshotStatusCache = new Map();
908
907
  * capture keeps warm (at most SCREENSHOT_STATUS_TTL_MS old; any failed
909
908
  * capture or lifecycle action drops it) answers instead; anything else is
910
909
  * checked fresh, so a VM that comes up is noticed on the next poll. */
911
- export async function recentContainerComputerStatus(target = SHARED_LOCAL_VM_TARGET, runner = sh, platform = process.platform, cache = runner === sh && platform === process.platform ? screenshotStatusCache : null) {
910
+ export async function recentContainerComputerStatus(target, runner = sh, platform = process.platform, cache = runner === sh && platform === process.platform ? screenshotStatusCache : null) {
911
+ target ??= sharedLocalVmTarget(platform);
912
912
  const cached = cache?.get(target.key);
913
913
  if (cached && cached.expiresAt > Date.now())
914
914
  return cached.status;
@@ -944,7 +944,7 @@ export function containerComputerMcp(runtime, control, target = SHARED_LOCAL_VM_
944
944
  }
945
945
  /** Commands shown as a transparent fallback. Normal setup builds the pinned
946
946
  * derivative through the API, so users do not need to author a Dockerfile. */
947
- export function setupCommands(runtime, platform = process.platform, target = SHARED_LOCAL_VM_TARGET) {
947
+ export function setupCommands(runtime, platform = process.platform, target = sharedLocalVmTarget(platform)) {
948
948
  const install = platform === "darwin"
949
949
  ? "brew install podman; podman machine init; podman machine start"
950
950
  : platform === "win32"
@@ -166,7 +166,7 @@ import { checkSoulDrift, readSoulDrift, soulFile, writeSoulMirror } from "./bot-
166
166
  import { buildSystemPrompt, userProfileSystemPrompt, computerPrompt, accountsPrompt, customMcpPrompt, CREDENTIAL_PROMPT, mentionPrompt, THREADS_PROMPT, LEARN_PROMPT, PROFILE_PROMPT, ROUTINE_PROMPT, ROUTINE_EXECUTION_PROMPT, WEBHOOK_PROMPT, } from "./system-prompt.js";
167
167
  import { readCuaConnection, readCuaUnavailableReason, gatedLocalComputer } from "./local-computer.js";
168
168
  import { remoteDesktopRoute } from "./remote-desktop.js";
169
- import { discoverExistingPerBotLocalVms, localVmInventoryEntry, shouldArmLocalVmIdle, } from "./local-vm-inventory.js";
169
+ import { discoverExistingPerBotLocalVms, localVmInventoryEntry, localVmWorkspaceExists, shouldArmLocalVmIdle, } from "./local-vm-inventory.js";
170
170
  import { ATOMIC_BACKUP_DIR, BROWSER_BACKUP_INTERVAL_MS, backupBrowserProfiles, localVmWorkspaces } from "./atomic-backup.js";
171
171
  import { LocalVmIdleTimer } from "./local-vm-idle.js";
172
172
  import { LocalVmLeasePool } from "./local-vm-lease.js";
@@ -6977,12 +6977,10 @@ function noteLocalVmSeen(target, status) {
6977
6977
  * durable workspace folder exists. Nobody else gets a container engine
6978
6978
  * started for them. */
6979
6979
  function localVmSetUp() {
6980
- return existsSync(SHARED_LOCAL_VM_TARGET.workspaceDir) || existsSync(join(DATA_DIR, "vm-homes"));
6980
+ return localVmWorkspaceExists(DATA_DIR, SHARED_LOCAL_VM_TARGET.workspaceDir);
6981
6981
  }
6982
- /** The one gate for starting the container engine (App Settings →
6983
- * Computers): the person's switch, the organisation's policy, and a Local VM
6984
- * actually set up here. Returns what it started (Colima, the only engine
6985
- * Atomic starts; never Docker Desktop) once it answers, or null. */
6982
+ /** Start installed Podman only for an existing Local VM, when the person's
6983
+ * automatic-start switch and organisation policy allow it. */
6986
6984
  async function startLocalVmRuntime() {
6987
6985
  if (!localVmAutoStartRuntime(cfg) || !managedPolicy.computerAllowed("localVm") || !localVmSetUp())
6988
6986
  return null;
@@ -16116,12 +16114,7 @@ ROUTES.push(createSetupRoutes({
16116
16114
  const path = findCliCandidates("podman")[0] ?? null;
16117
16115
  if (!path)
16118
16116
  return { installed: false, path: null, running: false };
16119
- const machines = await runTool(path, ["machine", "list", "--format", "json"]).catch(() => ({ stdout: "[]" }));
16120
- let running = false;
16121
- try {
16122
- running = JSON.parse(machines.stdout || "[]").some((machine) => machine.Running);
16123
- }
16124
- catch { /* unknown */ }
16117
+ const running = await runTool(path, ["info", "--format", "json"], 10_000).then(() => true, () => false);
16125
16118
  return { installed: true, path, running };
16126
16119
  },
16127
16120
  installOllama: async (context) => {
@@ -16145,7 +16138,13 @@ ROUTES.push(createSetupRoutes({
16145
16138
  openPodmanInstaller: async (context) => {
16146
16139
  await openPodmanInstaller({ signal: context.signal, onProgress: (progress) => context.update(progress) });
16147
16140
  },
16148
- startPodmanMachine: (path) => startPodmanMachine(path),
16141
+ startPodmanMachine: async (path) => {
16142
+ if (process.platform !== "darwin")
16143
+ return startPodmanMachine(path);
16144
+ const result = await ensureContainerRuntime();
16145
+ if (!result.status.daemonUp)
16146
+ throw new JobFailure("failed", result.error ?? "Podman is not ready. Retry from Settings > Computers.");
16147
+ },
16149
16148
  ollamaUrl: setupOllamaUrl,
16150
16149
  disabled: () => Boolean(hostedModels),
16151
16150
  fromBot: (req) => authorizedInternalCapability(req.headers.authorization) !== null,
@@ -1,4 +1,22 @@
1
- import { containerComputerExists, perBotLocalVmTarget, } from "./container-computer.js";
1
+ import { existsSync, readdirSync } from "node:fs";
2
+ import { join } from "node:path";
3
+ import { containerComputerExists, perBotLocalVmTarget, PODMAN_MAC_PREFIX, } from "./container-computer.js";
4
+ /** A Local VM was created here for the runtime this platform uses. On a Mac
5
+ * only Podman folders count: an older Docker or Colima desktop's folder must
6
+ * not make Atomic start Podman for someone who never set it up. */
7
+ export function localVmWorkspaceExists(dataDir, sharedWorkspace, platform = process.platform) {
8
+ if (existsSync(sharedWorkspace))
9
+ return true;
10
+ const homes = join(dataDir, "vm-homes");
11
+ if (platform !== "darwin")
12
+ return existsSync(homes);
13
+ try {
14
+ return readdirSync(homes).some((name) => name.startsWith(PODMAN_MAC_PREFIX));
15
+ }
16
+ catch {
17
+ return false;
18
+ }
19
+ }
2
20
  /** Idle cleanup is destructive. An exact derived name alone is not ownership:
3
21
  * a pre-existing container must also carry OpenMausBot's verified labels. */
4
22
  export function shouldArmLocalVmIdle(status) {
@@ -471,7 +471,8 @@ export function resolveRequestAuth(req, options) {
471
471
  !/^[\w-]{1,128}$/.test(headerValue(req.headers["x-openmausbot-companion-device"]) ?? "") ||
472
472
  companionDenial({ path, method, authenticated: true }))
473
473
  return deny(403, "forbidden: invalid companion request");
474
- return { auth: { kind: "loopback", scopes: LOOPBACK_SCOPES }, status: 401, error: "" };
474
+ const device = headerValue(req.headers["x-openmausbot-companion-device"]);
475
+ return { auth: { kind: "loopback", scopes: LOOPBACK_SCOPES, device }, status: 401, error: "" };
475
476
  }
476
477
  if (options.loopbackMutationToken !== undefined &&
477
478
  mutatingPublicRoute(method, path) &&
@@ -1,12 +1,16 @@
1
1
  import { clampSize } from "../terminal.js";
2
2
  import { PASS } from "./table.js";
3
+ /** Under the 90-second idle timeout the phone's stream session uses. */
4
+ const KEEPALIVE_MS = 25_000;
3
5
  const owner = (auth) => {
4
6
  if (!auth.scopes.includes("admin"))
5
7
  return null;
6
8
  if (auth.kind === "session")
7
9
  return `session:${auth.session.id}`;
10
+ // A paired phone reaches the server through the companion as a loopback
11
+ // owner; its shells are its own, not the desktop's or another phone's.
8
12
  if (auth.kind === "loopback" && auth.trust !== "service")
9
- return "desktop";
13
+ return auth.device ? `companion:${auth.device}` : "desktop";
10
14
  return null;
11
15
  };
12
16
  export function createTerminalRoutes(deps) {
@@ -47,12 +51,19 @@ export function createTerminalRoutes(deps) {
47
51
  return json(res, 405, { error: "method not allowed" });
48
52
  res.writeHead(200, { "content-type": "application/x-ndjson", "cache-control": "no-cache", "x-accel-buffering": "no" });
49
53
  req.socket.setTimeout(0);
54
+ // A blank line every so often keeps a quiet shell's stream from looking
55
+ // dead to a phone's idle timeout; readers skip empty lines.
56
+ const keepalive = setInterval(() => res.write("\n"), KEEPALIVE_MS);
57
+ keepalive.unref?.();
50
58
  const unsubscribe = live.subscribe((event) => {
51
59
  res.write(`${JSON.stringify(event)}\n`);
52
60
  if (event.type === "exit")
53
61
  res.end();
54
62
  });
55
- res.on("close", unsubscribe);
63
+ res.on("close", () => {
64
+ clearInterval(keepalive);
65
+ unsubscribe();
66
+ });
56
67
  return;
57
68
  }
58
69
  if (action === "input") {