worktrust 0.11.7 → 0.11.8

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.
package/node-guide.mjs ADDED
@@ -0,0 +1,134 @@
1
+ /**
2
+ * REMOTE AGENT ON A NODE THAT IS TOO OLD: THE WAYS FORWARD (CLI 0.11.8, owner 2026-11-13). package.json promises Node 18
3
+ * for measuring; Remote Agent's one live connection needs the WebSocket Node has from 22.4. A `remote` command there does
4
+ * not end at a refusal: it says so plainly, says measuring keeps working, and shows the ways to a working Remote Agent,
5
+ * each with its exact command.
6
+ *
7
+ * WHAT THIS MODULE MAY RUN, AND HOW (held by check-cli-package's node-guide rule):
8
+ * - only a command from its OWN CLOSED LIST below (RUNNABLE): never a word from a person's input, a file or the network;
9
+ * - as an argv array handed to spawn, never a shell string, never `shell: true`;
10
+ * - only a user-level tool (fnm, volta, Homebrew, pipx): never sudo, never a system package manager, never an installer
11
+ * that asks for an administrator; those are printed for the person to run;
12
+ * - only after the exact command was shown and the person typed yes (Enter is No). Without a terminal, or with --yes,
13
+ * nothing is asked and nothing runs: the text is printed and the command ends with a failure code.
14
+ * nvm is a shell function and asdf's words differ per version: both are printed, never run. There is no "newer Node just
15
+ * for WorkTrust through npx": that Node would come from npm's `node` package, which nothing here verifies; the Python
16
+ * package is that way, with the official Node it locks by hash.
17
+ */
18
+ import { spawn, spawnSync } from "node:child_process";
19
+ import { existsSync, realpathSync } from "node:fs";
20
+ import { delimiter, join } from "node:path";
21
+ import { createInterface } from "node:readline/promises";
22
+
23
+ export const NODE_FLOOR = [22, 4];
24
+ /** The one sentence a script reads (stderr, exit 1); null where this Node can hold the connection. */
25
+ export const remoteNeedsNode = (has = typeof globalThis.WebSocket === "function", version = process.versions.node) =>
26
+ (has ? null : `remote needs Node 22.4 or later for its connection (this is ${version}); the Python package bundles one`);
27
+ export const nodeIsEnough = (version) => { const [a, b] = String(version).replace(/^v/, "").split(".").map(Number); return a > NODE_FLOOR[0] || (a === NODE_FLOOR[0] && b >= NODE_FLOOR[1]); };
28
+
29
+ /**
30
+ * Whether a `remote <sub>` command stops at the ways forward on this Node (asked by remote-cli.mjs before anything is read,
31
+ * asked, written or sent). Node before 22.4 has no WebSocket, so nothing that starts, links, allows or changes something
32
+ * runs. The ways to LOOK and to STOP stay: a person who moved to an older Node can still see the state, pause it, turn it
33
+ * off and close its connections.
34
+ */
35
+ const REMOTE_WITHOUT = new Set(["status", "pause", "disable", "disconnect"]);
36
+ export const remoteStopsHere = (sub, has = typeof globalThis.WebSocket === "function") => !REMOTE_WITHOUT.has(sub) && !has;
37
+
38
+ /** The closed list: every command this module can run. A way's `argv` is built from these words and nothing else. */
39
+ const RUNNABLE = Object.freeze({
40
+ fnm: [["fnm", "install", "22"], ["fnm", "default", "22"]],
41
+ volta: [["volta", "install", "node@22"]],
42
+ brew: [["brew", "upgrade", "node"]],
43
+ });
44
+ const shown = (argvs) => argvs.map((argv) => argv.join(" ")).join(" && ");
45
+
46
+ /** An executable of this name on PATH (its full path), or null. Reads directories only; runs nothing. */
47
+ export function onPath(name, env = process.env, platform = process.platform) {
48
+ const exts = platform === "win32" ? (env.PATHEXT ?? ".EXE;.CMD;.BAT").split(";") : [""];
49
+ for (const dir of (env.PATH ?? env.Path ?? "").split(delimiter).filter(Boolean)) for (const ext of exts) { const file = join(dir, name + ext); if (existsSync(file)) return file; }
50
+ return null;
51
+ }
52
+
53
+ /**
54
+ * How this computer's Node is installed, by where the running Node lives, and the command that updates it. Pure: `has(name)`
55
+ * says whether a tool is on PATH. `argv` is set only for a user-level manager this module may run; otherwise the command
56
+ * is for the person (`argv: null`).
57
+ */
58
+ export function nodeManager({ execPath = process.execPath, env = process.env, platform = process.platform, has = (name) => Boolean(onPath(name)) } = {}) {
59
+ const path = String(execPath).replace(/\\/g, "/");
60
+ const way = (id, name, text, argv = null) => ({ id, name, shown: text, argv });
61
+ if (path.includes("/.nvm/") || (env.NVM_DIR && path.startsWith(String(env.NVM_DIR).replace(/\\/g, "/")))) return way("nvm", "nvm", "nvm install 22 && nvm alias default 22");
62
+ if (/\/fnm(_multishells)?\/|\/\.fnm\//.test(path) || (env.FNM_DIR && path.startsWith(String(env.FNM_DIR).replace(/\\/g, "/")))) return way("fnm", "fnm", shown(RUNNABLE.fnm), has("fnm") ? RUNNABLE.fnm : null);
63
+ if (path.includes("/.volta/") || (env.VOLTA_HOME && path.startsWith(String(env.VOLTA_HOME).replace(/\\/g, "/")))) return way("volta", "Volta", shown(RUNNABLE.volta), has("volta") ? RUNNABLE.volta : null);
64
+ if (path.includes("/.asdf/")) return way("asdf", "asdf", "asdf install nodejs latest:22 (then make it your default: asdf set -u nodejs latest:22, or asdf global on asdf before 0.16)");
65
+ if (/^\/opt\/homebrew\/|^\/usr\/local\/(Cellar|opt)\/|^\/home\/linuxbrew\//.test(path)) {
66
+ if (/\/node@\d+\//.test(path)) return way("brew", "Homebrew", "brew install node@22 && brew link --overwrite --force node@22");
67
+ return way("brew", "Homebrew", shown(RUNNABLE.brew), has("brew") ? RUNNABLE.brew : null);
68
+ }
69
+ if (platform === "win32") return way("windows", "the Windows installer", "winget upgrade OpenJS.NodeJS.LTS (or the installer from https://nodejs.org/en/download)");
70
+ return way("system", "your system's own package", "install Node 22 from https://nodejs.org/en/download (or your distribution's NodeSource package)");
71
+ }
72
+
73
+ /** The Python package: run through pipx where pipx is, else the line that installs it. */
74
+ export function pythonWay(args, has = (name) => Boolean(onPath(name))) {
75
+ if (has("pipx")) return { id: "pipx", shown: `pipx run worktrust ${args.join(" ")}`.trimEnd(), argv: [["pipx", "run", "worktrust", ...args]] };
76
+ if (has("python3") || has("python")) return { id: "pip", shown: `${has("python3") ? "python3" : "python"} -m pip install worktrust (then: worktrust ${args.join(" ")})`.replace(/ \)$/, ")"), argv: null };
77
+ return { id: "none", shown: "install Python 3.10 or later, then: pip install worktrust", argv: null };
78
+ }
79
+
80
+ /** What is said, the same bytes with or without a terminal. */
81
+ export function guidanceLines({ version = process.versions.node, manager, python }) {
82
+ return [
83
+ "",
84
+ ` Remote Agent needs Node 22.4 or later for its live connection. This computer runs Node ${version}.`,
85
+ " Measuring your work keeps working as it is.",
86
+ "",
87
+ " Ways forward:",
88
+ ` 1 Update this computer's Node (${manager.name})`,
89
+ ` ${manager.shown}`,
90
+ " 2 Use the Python package, which brings its own Node",
91
+ ` ${python.shown}`,
92
+ ];
93
+ }
94
+
95
+ const runArgv = (argv) => new Promise((resolve) => {
96
+ const child = spawn(argv[0], argv.slice(1), { stdio: "inherit" });
97
+ child.on("error", () => resolve(1));
98
+ child.on("exit", (code) => resolve(code ?? 1));
99
+ });
100
+ const typedLine = async (question) => { const prompt = createInterface({ input: process.stdin, output: process.stdout }); const answer = (await prompt.question(question)).trim().toLowerCase(); prompt.close(); return answer; };
101
+ const nodeOnPath = () => { const node = onPath("node"); if (!node) return null; const asked = spawnSync(node, ["--version"], { encoding: "utf8", timeout: 10_000 }); return asked.status === 0 ? { path: realpathSync(node), version: asked.stdout.trim().replace(/^v/, "") } : null; };
102
+
103
+ /**
104
+ * A `remote` command on a Node without the WebSocket: say it, show the ways, and (a person's terminal only) take one on a
105
+ * typed yes. `io`: the CLI's say, fail, ask and has. `deps` are the seams the tests hold: interactive, line, run, findNode,
106
+ * rerun(nodePath, args) → the exit code of this same CLI started again under that Node, connected.
107
+ */
108
+ export async function guideToNode(io, args, deps = {}) {
109
+ const sentence = remoteNeedsNode(false, deps.version ?? process.versions.node);
110
+ const manager = deps.manager ?? nodeManager(), python = deps.python ?? pythonWay(args);
111
+ const interactive = deps.interactive ?? (Boolean(process.stdin.isTTY) && Boolean(process.stdout.isTTY) && !io.has("yes"));
112
+ // Started again: this same CLI (the launcher this process was started with, verified as always) under the Node just found.
113
+ const rerun = deps.rerun ?? ((nodePath, cliArgs) => runArgv([nodePath, process.argv[1], ...cliArgs]));
114
+ const run = deps.run ?? runArgv, again = `npx worktrust ${args.join(" ")}`.trimEnd();
115
+ for (const line of guidanceLines({ version: deps.version, manager, python })) io.say(line);
116
+ const leave = (words) => { io.say(` ${words}`); io.fail(sentence); };
117
+ if (!interactive) leave("Nothing was installed or changed.");
118
+ io.say(" q Leave");
119
+ const pick = await (deps.line ?? typedLine)(" Choose 1 or 2, or q to leave [1]: ");
120
+ const way = pick === "" || pick === "1" ? manager : pick === "2" ? python : null;
121
+ if (!way) leave("Nothing was installed or changed.");
122
+ if (!way.argv) leave(`That one is yours to run: ${way.shown}. Then run \`${again}\` again. Nothing was installed or changed.`);
123
+ io.say(` This runs: ${way.shown}`);
124
+ if (!(await io.ask("Run it now?", false))) leave("Nothing was run. Nothing was installed or changed.");
125
+ for (const argv of way.argv) { const code = await run(argv); if (code !== 0) leave(`\`${argv.join(" ")}\` ended with code ${code}. WorkTrust changed nothing.`); }
126
+ if (way === python) return; // pipx ran this same command with the Python package's own Node
127
+ const node = (deps.findNode ?? nodeOnPath)();
128
+ if (!node || !nodeIsEnough(node.version)) leave(`Node on this terminal's PATH is ${node ? `still ${node.version}` : "not found"}. Open a new terminal and run \`${again}\` again.`);
129
+ io.say(` ✓ Node is now ${node.version}.`);
130
+ // The session hook and the AI-app doors name a Node by its path: `update` under the new one repairs a path that moved.
131
+ if (deps.connected) { io.say(" Bringing the session hook and your AI apps onto it (npx worktrust update):"); await rerun(node.path, ["update"]); }
132
+ io.say(` Continuing: ${again}`);
133
+ process.exitCode = await rerun(node.path, args);
134
+ }
@@ -1 +1 @@
1
- {"keyId":"608168ccdef72562fc91f9c0f9f2c2d6876bece7f7362cb545b818f7947da6b5","payload":{"files":{"AGENTS.md":"e8abb38c293b57b71d3a6163d6242d1f375e773372b91b6d8ce39c584c51262a","CLAUDE.md":"5933504f93e5a40369a4790e96dd5dad791d849d3178b1833eb64088e456aaeb","LICENSE":"b38ea343eb95892d4164274be4184d6e34eade9d4c454e1dcf8bc7735736425e","README.md":"0c877624eff2c9aaf0bcbf52fba9ed532c3646f818c5bea34723632626cab73f","SECURITY.md":"6a798d875f48ae84c3a677397e5611e03b94215944952e0f61e13f6cfc949745","chat-exports.mjs":"f026c5a063f62c22ba6f25474a9d9fdbb6074beebbfe1faff2a876c437a1a000","claude-mod.mjs":"02d86b0cdddf39879efc5194c0a5be6b41456faedec28963dc123a4e88dc3942","cli-menu-remote.mjs":"b7dc18ced2b9cedec5e2263f42265973fcb96b16e34b88ac91e8b53c8be62c68","cli-menu.mjs":"6cf2b7b510bd4c81818885afddb5da0e9c60c4bcdf36280497f7ba3d4ebf30e6","commit-rules.mjs":"e94cc32a5415f6d9e978145ab9505ac4ae0bac9431e6e9104b9b37155260b51f","config-edits.mjs":"527a7674f9d52b284bfda3b8089eb4b930a709bf14aedbec7f6eef1e59ef52ee","count-behaviour.mjs":"06b0ecbc222087160dc64c0b302391631e8e799038364c317c6cd28449c5044d","credential-store.mjs":"a4b3540a61f4ce19e535c7f1d260c0d817686cd066d559a76db2ab108144abba","credential-vault-scripts.mjs":"7e42fe1db3885c2dec6f1de87bebfbefe2292d29179a68f3da87d19eb6c7704b","credential-vault.mjs":"279baabb217e2a3f170e8d7f2b271a88484531f9031c441360ea91561a70da99","engine-release.json":"c02fbb7a91195330a6719c931e7af3246a3991f4a727ab1051fb72103b464b85","export-facts.mjs":"3bbb46c80e8678b5cea7e15dcbfc456a2b48595053241c2b3cea508092f9b917","folder-picker.mjs":"daeb379626d5716f91f588064c6b4083618279320c006c177960cc93f056d96a","git-commits.mjs":"af0ed45a2a42c8e17cabfb3649a2f524dbf80230f8a6ec1c6b775fed7d34dc9c","history-outbox.mjs":"85c70389effc5b4ec9d9b33af9192314e67f47af2752515b42a7959344ce2354","history-progress.mjs":"dcc25ee94b727f2605a763349a4d8764640335d6cf0043fb6108cebeed16dcb9","log-session.mjs":"167fe3718415fe690c9e4f7a3a993520e8c652edcf61184cc14cfec2db67d7bc","orchestration-contract.mjs":"ec08f303a166365b99e70b675de4cfe76c6156c2567e14b5569f6d992f0231b7","orchestration-evidence.mjs":"d0d06cecf0eb08e5c6e653c62a4f45b1eddf2119c2acb8341056b34f488d214a","orchestration-report.mjs":"d4e0a9ad8e4a01b462d22c6b1866aac291565c533ff476085d3367cb6d59bc1b","package-integrity.mjs":"a8210c9494a56bfb9a5ea3d10064c7a269f0b6330c0af7c0700e706c3c0224e3","package.json":"700538ff928a540e53362e371d7b2b5e952674879a330fb730dcb42923e942c2","preserve-lines.mjs":"2df64a69687aa51219bf7b86b88d175cc50990fa29574b31897e41a9ebeecf43","preserve-summary.mjs":"137f781ed7021596a3f0ea67afcf2ab8616ac293f833dbb8f176e838e0ed8321","preserve.mjs":"cd111cae0f53a25a2d878a158479abfb1ace353361454843f91a16d241101d46","project-modes.mjs":"ada26e68297fbeb90e4e91d75a90fd2d7cc107b999a9702840675b5a7529463e","remote-adapter-claude-code.mjs":"6db24891f7b0c56c00b337e52f4d4aeb8c9a0413b3bf46d0fc8a45328ea71b3e","remote-adapter-codex.mjs":"d2fd6c61d9e3c4a45e9b10da1aa3c15d45c86629d6456e4a8d25ad95b13eb209","remote-adapter-opencode.mjs":"ddd7f3ec0b4ba92f4744453d60fda338b63550e3ec7b23fa3acc668df1d64eb7","remote-adapter-terminal.mjs":"9237d3747a25126fcdad42c0eab10e69393754388a6014b30fb0890b9c735888","remote-admin.mjs":"ac4d434c0a374159b27accac3fdd0324ff96ffe32227fba054cc62d00e58d35b","remote-agent-switch.mjs":"7ff5448f29f05a47d7298d730b21243a1bcf8a215b434a0c7fbf5f3cb0889041","remote-approval-bridge.mjs":"092f17b7969e4f35bea064315d04dcde1faa6a3fd3e737dcc05aece82c7a37c4","remote-approvals.mjs":"63847226e398f9eb5b8d3989ba2b2436fbedd898385eb5f2f63bbdf07fbe6852","remote-attachments.mjs":"2e9c1277329a45cf26c0c62abda632cf0ab9fad78d0504416ecee9805220e16c","remote-cdp.mjs":"70e333a1ebe845e872cc3a703a0a507391f8ce59640bdbd662bdad55eeff216b","remote-changes.mjs":"2141fece4961a5bc1bb1b046f78222812617457b1ba6452275eac6a897e62e19","remote-claude-events.mjs":"58822471203c6a1b66cf81c115c4d713657c3dea5c7b98df959f894ee5b2e704","remote-claude-progress.mjs":"2ca626d3dbc16d8d570abe1df6477b7e44ffb43c1d9145228ec5ea1928e415ca","remote-cli.mjs":"33a6194e0653b78cf075edd2aae083179af2ca9aeae190a225aeeabb03a43f67","remote-coalesce.mjs":"cb0967d9cfe81e3892bcade8349d6814db98be8c2adbdb54df0b8d1b142f65d1","remote-codex-events.mjs":"58657d6070a50c837737cb85f5a1eaf9c2cbc4e1adfe3e970748ab3b2af94631","remote-connections.mjs":"e24ff04ed61647e164b6f055d4f691366f3204fe445140afc5f34abbed5d4080","remote-countdown.mjs":"85cf2d01fe5ca49895e08a3d5de346bb5e4a8dd31b9fda3fd9f9534d9e1e47cf","remote-daemon.mjs":"94d4896b0e1203f7a5bc7224a6221a36f4c20be89caee78b3ab37b9b6a2dac1d","remote-endorse.mjs":"89eda4883567176703e01e44d83e987271bc2a6134e108f517b3b213719a21f9","remote-inventory.mjs":"a8245604d41373819738eaf06ec1d2242cb5f7b2e60aa316f31d2f8742b8c70d","remote-journal.mjs":"907ebd48c53162b22dc743ef95b53c1a6be6886a7495605b5cfa820b8de9d330","remote-live-preview.mjs":"faa70f9260ac05037204c2a0c3facf4ffe42f68408948390b341b453a2932289","remote-opencode-events.mjs":"3108375501ead2c2c78bce1435cc2a9fe6d2af1d7ff1fb42e12ff3e0f5d9af9c","remote-opencode-session.mjs":"681b201d833a7d7d025122b3a79663bcdc0a989aefd39d8018a28113d8810caf","remote-pairing.mjs":"d8c2aba394fe73d850ea000c758e6b926c87b122eaf5c6aa92ec1183e90f90e1","remote-pipeline-config.mjs":"00cde6a61ce21144c51ac56fce42fee159aa9dba6586218a7ea790ce4a6bd40b","remote-pipeline-parsers.mjs":"43ca0d332d7bc883c4759a754a555815ae5dfe133446b91ba9f2e48a350fa20f","remote-pipeline.mjs":"b856ead989b29ddb618ef69bbacd104bae2b02c9d1c5214291d08ce469a8b24e","remote-policy.mjs":"16ea015ad5de3c357bce730ea8ea98571dc981d8591fb5156b1941b2c557a381","remote-preview.mjs":"fe504ad6f83dcb4a4ebdcc018686a9a5a900c47cdf8c45b75e7d02e2f3056155","remote-projects.mjs":"ec8c530ad3e880bca21a4d4078ecd68b6aaafcc442b50087127868d952034d5f","remote-protocol.mjs":"93f8c2031895d4e01006a1951d7c0e79ef71b86b2777eed5dfa966ab131e446d","remote-qr.mjs":"b80e2b4a5bc020cf6ed92e91d06b327cb5197de1c35b3445a0fc2c7a3bf1ab3f","remote-release-plans.mjs":"11884a62b7d6dcccb5e154a26603bdf650f7b40f946329fb174d8c13729bec74","remote-releases.mjs":"fb08b72593ea00013c8b679e0c0d7dee95b0fd7cc5fd31b80ac575d0e340927d","remote-run.mjs":"c180c401613e0c01dfc471bb6226ebb035a7299839f81c6e38ff714d75d68c3f","remote-screen-approvals.mjs":"c43ab286d36a38d17639d155782ffa017f1a9b6806a09b82ed0142a1290b6000","remote-screen-push.mjs":"4ee8bd48d24b2c87581e9f33d8354a86381f7febd82f89ed509a7a87c1442608","remote-screen-states.mjs":"7c3c86a584bebf52461f3cab39c05ea2a13910061704d48fc622956e842940f7","remote-service.mjs":"a3a5502e0f6f43b04e37ee778f43d88f4c219776439cfed0d8fa0b511e0c9637","remote-session-list.mjs":"494fdbe20f0542806ac6c42ad149c52e2d3ace23a3a7567f96dc7e80d092c727","remote-sessions.mjs":"1efb7869cef6090cbbeae15ff1e5ffe99dca3742f9c245686d6758bb705587d6","remote-settings.mjs":"ca16f39416a457bd5ceb1df847596e1b4bcd2894310eb6514664a619dee4981f","remote-steered.mjs":"d7afde92c62c87abbdb84b0cfea2eea4752e90a2e453e52a54812c4fe0395190","remote-steering.mjs":"7ba22e6110cea3ac75a4f084f8f92a5bd90c31a19d3ce58a88a0843bdadea834","remote-store.mjs":"7226d006d03788ea2a8de30226ab5f6bf45b1bcbb10ee7d4e28bf2c3cca5a2a7","remote-terminal-cli.mjs":"82a048b75e412d0b6db076afbb84cab7c754dec72b6c8b6af4d4906b38e988a7","remote-terminal-sessions.mjs":"6ab51824890a18768d23cedc499f3840b2b02a8ed651463c1fe2d74dd352a361","remote-transport.mjs":"68650fd77ea09b5762377f87cabdc1c73a34d77324aa5bf0cd9742094a50c32b","runtime-install.mjs":"aab47b52c79d726ef428a24f982c648fa3f1c2dc2b574f633611d02924864e5f","self-update.mjs":"378e3620d48c72cf0bf812be408883b995cdb2223de34a20f762dd73eeffb258","session-databases.mjs":"a16ffbc50ccc0e78f370ebe07f871d1a80f1977472e478e3599e7abfdc90c1b7","session-local-models.mjs":"bacd38ff8dd3056b552982ec52eb57c7b8ca86e1a46cd4cba30fc340e3e28fd4","setup-mcp.mjs":"b732e3dd9b3e522b7cc8acf167ce28ba8f1a8dee797ee15bd7c3b02919b13e6f","stack-rules.mjs":"b23c56e72ec56ba02b17ed895f869172d988c468a697e8d6026b0e268f61e489","stretch-evidence.mjs":"5f5667b92adf11b1a5a6330a0f26dd6db73d56fe60823d9a5246dab71d27d380","transcript-readers.mjs":"e9f20415c2b5d62a09f35a63075002ebd1da56edb32f242d52822d58ecbd8ac3","worktrust-launch.mjs":"84801bd29d472d48188c126b9ebe3989a3132b54e13cc4fe534ff7c383a294ee","worktrust.mjs":"a42bf1c5ad9b74bae6109eb6ac3259ded36c4fd26a4ee72fbf67076e0e849177"},"format":"worktrust-package/1","kind":"npm","version":"0.11.7"},"signature":"j6lZJonU8TufZbDcVrgSvKc0Szzb89gldIxkkygjWbZesfTt5jdjbmxnG-7XREgiUCF9l5sIZsjgctE68ZulAA"}
1
+ {"keyId":"608168ccdef72562fc91f9c0f9f2c2d6876bece7f7362cb545b818f7947da6b5","payload":{"files":{"AGENTS.md":"e8abb38c293b57b71d3a6163d6242d1f375e773372b91b6d8ce39c584c51262a","CHANGELOG.md":"c307685ed7d0afd3a75193e60d051a44fa56eb5278b2417c5182dc6f019f628f","CLAUDE.md":"5933504f93e5a40369a4790e96dd5dad791d849d3178b1833eb64088e456aaeb","LICENSE":"b38ea343eb95892d4164274be4184d6e34eade9d4c454e1dcf8bc7735736425e","README.md":"6b714719a918730db48c4d329cd17ffbb83acc1941fb5d8e54f6e237f588b512","SECURITY.md":"6a798d875f48ae84c3a677397e5611e03b94215944952e0f61e13f6cfc949745","chat-exports.mjs":"f026c5a063f62c22ba6f25474a9d9fdbb6074beebbfe1faff2a876c437a1a000","claude-mod.mjs":"02d86b0cdddf39879efc5194c0a5be6b41456faedec28963dc123a4e88dc3942","cli-colour.mjs":"fa16b61ad179999c5c5365255182acf69bcba1eb5f5ce7b0e1e18c11f56130ae","cli-menu-remote.mjs":"6477b3c6986290a9ac70f1f7310abcc0415dfbe9e08f412c48dd41b60c4b6c44","cli-menu.mjs":"566a8cb60a050a506101b2900358d31c05907d66565ff194cd8efe9039e04ca5","commit-rules.mjs":"e94cc32a5415f6d9e978145ab9505ac4ae0bac9431e6e9104b9b37155260b51f","config-edits.mjs":"527a7674f9d52b284bfda3b8089eb4b930a709bf14aedbec7f6eef1e59ef52ee","count-behaviour.mjs":"06b0ecbc222087160dc64c0b302391631e8e799038364c317c6cd28449c5044d","credential-store.mjs":"a4b3540a61f4ce19e535c7f1d260c0d817686cd066d559a76db2ab108144abba","credential-vault-scripts.mjs":"7e42fe1db3885c2dec6f1de87bebfbefe2292d29179a68f3da87d19eb6c7704b","credential-vault.mjs":"279baabb217e2a3f170e8d7f2b271a88484531f9031c441360ea91561a70da99","engine-release.json":"dc8d2c5721938373efa50729790128ddee5f26476cc24c710b1349c7fdbfee75","export-facts.mjs":"3bbb46c80e8678b5cea7e15dcbfc456a2b48595053241c2b3cea508092f9b917","folder-picker.mjs":"daeb379626d5716f91f588064c6b4083618279320c006c177960cc93f056d96a","git-commits.mjs":"af0ed45a2a42c8e17cabfb3649a2f524dbf80230f8a6ec1c6b775fed7d34dc9c","history-outbox.mjs":"85c70389effc5b4ec9d9b33af9192314e67f47af2752515b42a7959344ce2354","history-progress.mjs":"dcc25ee94b727f2605a763349a4d8764640335d6cf0043fb6108cebeed16dcb9","log-session.mjs":"167fe3718415fe690c9e4f7a3a993520e8c652edcf61184cc14cfec2db67d7bc","node-guide.mjs":"5bf52c5028b07a80ec4d41be365eb025dfce74328f41f928a26ce6737b1f9cc4","orchestration-contract.mjs":"ec08f303a166365b99e70b675de4cfe76c6156c2567e14b5569f6d992f0231b7","orchestration-evidence.mjs":"d0d06cecf0eb08e5c6e653c62a4f45b1eddf2119c2acb8341056b34f488d214a","orchestration-report.mjs":"d4e0a9ad8e4a01b462d22c6b1866aac291565c533ff476085d3367cb6d59bc1b","package-integrity.mjs":"a8210c9494a56bfb9a5ea3d10064c7a269f0b6330c0af7c0700e706c3c0224e3","package.json":"612abff8a1013c28fd8f68402b8b9b466925e5289c6a1c6214c01c165cfa44cd","preserve-lines.mjs":"2df64a69687aa51219bf7b86b88d175cc50990fa29574b31897e41a9ebeecf43","preserve-summary.mjs":"137f781ed7021596a3f0ea67afcf2ab8616ac293f833dbb8f176e838e0ed8321","preserve.mjs":"cd111cae0f53a25a2d878a158479abfb1ace353361454843f91a16d241101d46","project-modes.mjs":"ada26e68297fbeb90e4e91d75a90fd2d7cc107b999a9702840675b5a7529463e","remote-adapter-claude-code.mjs":"6db24891f7b0c56c00b337e52f4d4aeb8c9a0413b3bf46d0fc8a45328ea71b3e","remote-adapter-codex.mjs":"d2fd6c61d9e3c4a45e9b10da1aa3c15d45c86629d6456e4a8d25ad95b13eb209","remote-adapter-opencode.mjs":"ddd7f3ec0b4ba92f4744453d60fda338b63550e3ec7b23fa3acc668df1d64eb7","remote-adapter-terminal.mjs":"9237d3747a25126fcdad42c0eab10e69393754388a6014b30fb0890b9c735888","remote-admin.mjs":"ac4d434c0a374159b27accac3fdd0324ff96ffe32227fba054cc62d00e58d35b","remote-agent-switch.mjs":"7ff5448f29f05a47d7298d730b21243a1bcf8a215b434a0c7fbf5f3cb0889041","remote-approval-bridge.mjs":"092f17b7969e4f35bea064315d04dcde1faa6a3fd3e737dcc05aece82c7a37c4","remote-approvals.mjs":"63847226e398f9eb5b8d3989ba2b2436fbedd898385eb5f2f63bbdf07fbe6852","remote-attachments.mjs":"2e9c1277329a45cf26c0c62abda632cf0ab9fad78d0504416ecee9805220e16c","remote-cdp.mjs":"70e333a1ebe845e872cc3a703a0a507391f8ce59640bdbd662bdad55eeff216b","remote-changes.mjs":"2141fece4961a5bc1bb1b046f78222812617457b1ba6452275eac6a897e62e19","remote-claude-events.mjs":"58822471203c6a1b66cf81c115c4d713657c3dea5c7b98df959f894ee5b2e704","remote-claude-progress.mjs":"2ca626d3dbc16d8d570abe1df6477b7e44ffb43c1d9145228ec5ea1928e415ca","remote-cli.mjs":"651a7f16e7475029985007ea97f4b838f8378ab620d3f3c2ab718da155fce94d","remote-coalesce.mjs":"cb0967d9cfe81e3892bcade8349d6814db98be8c2adbdb54df0b8d1b142f65d1","remote-codex-events.mjs":"58657d6070a50c837737cb85f5a1eaf9c2cbc4e1adfe3e970748ab3b2af94631","remote-connections.mjs":"e24ff04ed61647e164b6f055d4f691366f3204fe445140afc5f34abbed5d4080","remote-countdown.mjs":"85cf2d01fe5ca49895e08a3d5de346bb5e4a8dd31b9fda3fd9f9534d9e1e47cf","remote-daemon.mjs":"94d4896b0e1203f7a5bc7224a6221a36f4c20be89caee78b3ab37b9b6a2dac1d","remote-endorse.mjs":"89eda4883567176703e01e44d83e987271bc2a6134e108f517b3b213719a21f9","remote-inventory.mjs":"a8245604d41373819738eaf06ec1d2242cb5f7b2e60aa316f31d2f8742b8c70d","remote-journal.mjs":"907ebd48c53162b22dc743ef95b53c1a6be6886a7495605b5cfa820b8de9d330","remote-live-preview.mjs":"faa70f9260ac05037204c2a0c3facf4ffe42f68408948390b341b453a2932289","remote-opencode-events.mjs":"3108375501ead2c2c78bce1435cc2a9fe6d2af1d7ff1fb42e12ff3e0f5d9af9c","remote-opencode-session.mjs":"681b201d833a7d7d025122b3a79663bcdc0a989aefd39d8018a28113d8810caf","remote-pairing.mjs":"d8c2aba394fe73d850ea000c758e6b926c87b122eaf5c6aa92ec1183e90f90e1","remote-pipeline-config.mjs":"00cde6a61ce21144c51ac56fce42fee159aa9dba6586218a7ea790ce4a6bd40b","remote-pipeline-parsers.mjs":"43ca0d332d7bc883c4759a754a555815ae5dfe133446b91ba9f2e48a350fa20f","remote-pipeline.mjs":"b856ead989b29ddb618ef69bbacd104bae2b02c9d1c5214291d08ce469a8b24e","remote-policy.mjs":"16ea015ad5de3c357bce730ea8ea98571dc981d8591fb5156b1941b2c557a381","remote-preview.mjs":"fe504ad6f83dcb4a4ebdcc018686a9a5a900c47cdf8c45b75e7d02e2f3056155","remote-projects.mjs":"ec8c530ad3e880bca21a4d4078ecd68b6aaafcc442b50087127868d952034d5f","remote-protocol.mjs":"93f8c2031895d4e01006a1951d7c0e79ef71b86b2777eed5dfa966ab131e446d","remote-qr.mjs":"b80e2b4a5bc020cf6ed92e91d06b327cb5197de1c35b3445a0fc2c7a3bf1ab3f","remote-release-plans.mjs":"11884a62b7d6dcccb5e154a26603bdf650f7b40f946329fb174d8c13729bec74","remote-releases.mjs":"fb08b72593ea00013c8b679e0c0d7dee95b0fd7cc5fd31b80ac575d0e340927d","remote-run.mjs":"c180c401613e0c01dfc471bb6226ebb035a7299839f81c6e38ff714d75d68c3f","remote-screen-approvals.mjs":"c43ab286d36a38d17639d155782ffa017f1a9b6806a09b82ed0142a1290b6000","remote-screen-push.mjs":"4ee8bd48d24b2c87581e9f33d8354a86381f7febd82f89ed509a7a87c1442608","remote-screen-states.mjs":"7c3c86a584bebf52461f3cab39c05ea2a13910061704d48fc622956e842940f7","remote-service.mjs":"a3a5502e0f6f43b04e37ee778f43d88f4c219776439cfed0d8fa0b511e0c9637","remote-session-list.mjs":"494fdbe20f0542806ac6c42ad149c52e2d3ace23a3a7567f96dc7e80d092c727","remote-sessions.mjs":"1efb7869cef6090cbbeae15ff1e5ffe99dca3742f9c245686d6758bb705587d6","remote-settings.mjs":"ca16f39416a457bd5ceb1df847596e1b4bcd2894310eb6514664a619dee4981f","remote-steered.mjs":"d7afde92c62c87abbdb84b0cfea2eea4752e90a2e453e52a54812c4fe0395190","remote-steering.mjs":"7ba22e6110cea3ac75a4f084f8f92a5bd90c31a19d3ce58a88a0843bdadea834","remote-store.mjs":"7226d006d03788ea2a8de30226ab5f6bf45b1bcbb10ee7d4e28bf2c3cca5a2a7","remote-terminal-cli.mjs":"82a048b75e412d0b6db076afbb84cab7c754dec72b6c8b6af4d4906b38e988a7","remote-terminal-sessions.mjs":"6ab51824890a18768d23cedc499f3840b2b02a8ed651463c1fe2d74dd352a361","remote-transport.mjs":"68650fd77ea09b5762377f87cabdc1c73a34d77324aa5bf0cd9742094a50c32b","runtime-install.mjs":"aab47b52c79d726ef428a24f982c648fa3f1c2dc2b574f633611d02924864e5f","self-update.mjs":"378e3620d48c72cf0bf812be408883b995cdb2223de34a20f762dd73eeffb258","session-databases.mjs":"a16ffbc50ccc0e78f370ebe07f871d1a80f1977472e478e3599e7abfdc90c1b7","session-local-models.mjs":"bacd38ff8dd3056b552982ec52eb57c7b8ca86e1a46cd4cba30fc340e3e28fd4","setup-mcp.mjs":"b732e3dd9b3e522b7cc8acf167ce28ba8f1a8dee797ee15bd7c3b02919b13e6f","stack-rules.mjs":"b23c56e72ec56ba02b17ed895f869172d988c468a697e8d6026b0e268f61e489","stretch-evidence.mjs":"5f5667b92adf11b1a5a6330a0f26dd6db73d56fe60823d9a5246dab71d27d380","transcript-readers.mjs":"e9f20415c2b5d62a09f35a63075002ebd1da56edb32f242d52822d58ecbd8ac3","worktrust-launch.mjs":"84801bd29d472d48188c126b9ebe3989a3132b54e13cc4fe534ff7c383a294ee","worktrust.mjs":"81a0b8f83b5c0bbbd8c4599071585520cb6ad1ebaa2e5824c51bb5f6dd0ab6e8"},"format":"worktrust-package/1","kind":"npm","version":"0.11.8"},"signature":"xmOaY-LlVHJMteyQeg9o341pooWfqpDK5bRLmtoynFcHrdwtwH-xcmpuDwUAODbjHwI-gIMKbmI54WqI-bVxCQ"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "worktrust",
3
- "version": "0.11.7",
3
+ "version": "0.11.8",
4
4
  "description": "Couple this computer to WorkTrust: approve a code in your browser, and every AI app here reports what you built. Metadata only, no dependencies.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -24,6 +24,7 @@
24
24
  "stack-rules.mjs",
25
25
  "runtime-install.mjs",
26
26
  "README.md",
27
+ "CHANGELOG.md",
27
28
  "SECURITY.md",
28
29
  "LICENSE",
29
30
  "AGENTS.md",
@@ -95,6 +96,8 @@
95
96
  "folder-picker.mjs",
96
97
  "cli-menu.mjs",
97
98
  "cli-menu-remote.mjs",
99
+ "cli-colour.mjs",
100
+ "node-guide.mjs",
98
101
  "remote-countdown.mjs",
99
102
  "remote-connections.mjs",
100
103
  "remote-admin.mjs"
package/remote-cli.mjs CHANGED
@@ -49,6 +49,7 @@ import { askLine, connectionsCommand, disconnectCommand, removePhones } from "./
49
49
  import { installService, removeService, serviceState, servicePlatform } from "./remote-service.mjs";
50
50
  import { qrMatrix, renderQr } from "./remote-qr.mjs";
51
51
  import { webSocketAvailable } from "./remote-transport.mjs";
52
+ import { guideToNode, remoteStopsHere } from "./node-guide.mjs";
52
53
  import { inventory } from "./remote-inventory.mjs";
53
54
  import { allowCommand, parsePipelineConfig, PIPELINE_FILE } from "./remote-pipeline-config.mjs";
54
55
  import { pipelineState, projectReviewHash, readProjectFile } from "./remote-pipeline.mjs";
@@ -77,7 +78,6 @@ function needPaired(io) {
77
78
 
78
79
  /** `remote app` | `remote web`: the two roads to approve this computer; each does all of what `remote enable` did. */
79
80
  async function approve(io, road) {
80
- if (!webSocketAvailable()) io.fail(`remote needs Node 22.4 or later for its connection (this is ${process.versions.node}); the Python package bundles one`);
81
81
  const settings = loadSettings();
82
82
  const gateway = io.flag("gateway") ?? process.env.WORKTRUST_REMOTE_GATEWAY ?? settings.gateway;
83
83
  if (gateway && !P.isGatewayOrigin(gateway)) io.fail("--gateway is an origin: wss://host[:port], or ws://127.0.0.1:<port> for the dev relay");
@@ -299,6 +299,7 @@ function status(io) {
299
299
 
300
300
  export async function remoteCommand(args, io) {
301
301
  const [sub = "help", ...rest] = args;
302
+ if (remoteStopsHere(sub)) return guideToNode(io, ["remote", ...args], { connected: io.connected?.() }); // Node before 22.4: node-guide.mjs
302
303
  if (sub === "app" || sub === "web") return approve(io, sub);
303
304
  if (sub === "pair") return pair(io);
304
305
  if (sub === "status") return status(io);
package/worktrust.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  /**
3
3
  * WorkTrust on a computer, in one command — like `gh auth login` (2026-10-03).
4
- * npx worktrust in a person's own terminal (0.11.7): the menu (cli-menu.mjs), whose first item is
4
+ * npx worktrust in a person's own terminal (0.11.7; 0.11.8: Update first): the menu (cli-menu.mjs), one item of which is
5
5
  * what the bare command did until then; without a terminal, exactly that:
6
6
  * show the plan, ask, approve this computer in the app, couple (0.10.7: a person's
7
7
  * command always runs the newest version, whatever npx had cached);
@@ -80,7 +80,7 @@ const command = args.includes("--help") ? "help" : args.includes("--version") ?
80
80
  const flag = (name) => { const at = args.indexOf(`--${name}`); return at >= 0 ? args[at + 1] : undefined; };
81
81
  const has = (name) => args.includes(`--${name}`);
82
82
  /** This CLI's version, said to the door so the app can tell which computer runs an old one (check-cli-package holds it equal to package.json). */
83
- const CLI_VERSION = "0.11.7";
83
+ const CLI_VERSION = "0.11.8";
84
84
  /**
85
85
  * HOW THIS CLI MEASURES, AS A NUMBER OF ITS OWN (0.10.31; owner, 2026-10-28: 0.10.30 offered a re-measure it had no reason
86
86
  * to offer). Raised ONLY when what is measured changes: the timeline, the seconds, the tokens, the steering, the session
@@ -116,17 +116,23 @@ const ORIGIN = (flag("origin") ?? process.env.WORKTRUST_ORIGIN ?? "https://app.w
116
116
  const MCP = flag("url") ?? process.env.WORKTRUST_MCP_URL ?? `${ORIGIN}/api/mcp`;
117
117
  const HOME_DIR = join(homedir(), ".worktrust");
118
118
  const HERE = dirname(fileURLToPath(import.meta.url));
119
- const SCRIPTS = ["credential-store.mjs", "remote-protocol.mjs", "remote-store.mjs", "remote-policy.mjs", "remote-journal.mjs", "remote-steered.mjs", "remote-inventory.mjs", "remote-claude-events.mjs", "remote-claude-progress.mjs", "remote-attachments.mjs", "remote-preview.mjs", "remote-coalesce.mjs", "remote-steering.mjs", "remote-codex-events.mjs", "remote-adapter-codex.mjs", "remote-opencode-events.mjs", "remote-adapter-opencode.mjs", "remote-opencode-session.mjs", "remote-adapter-terminal.mjs", "remote-terminal-sessions.mjs", "remote-terminal-cli.mjs", "remote-screen-states.mjs", "remote-screen-approvals.mjs", "remote-screen-push.mjs", "remote-cdp.mjs", "remote-live-preview.mjs", "remote-projects.mjs", "remote-pipeline-config.mjs", "remote-pipeline-parsers.mjs", "remote-pipeline.mjs", "remote-releases.mjs", "remote-release-plans.mjs", "remote-adapter-claude-code.mjs", "remote-approval-bridge.mjs", "remote-approvals.mjs", "remote-sessions.mjs", "remote-session-list.mjs", "remote-changes.mjs", "remote-endorse.mjs", "remote-daemon.mjs", "remote-transport.mjs", "remote-run.mjs", "remote-service.mjs", "remote-pairing.mjs", "remote-qr.mjs", "remote-cli.mjs", "remote-agent-switch.mjs", "remote-settings.mjs", "folder-picker.mjs", "cli-menu.mjs", "cli-menu-remote.mjs", "remote-countdown.mjs", "remote-connections.mjs", "remote-admin.mjs", "credential-vault.mjs", "credential-vault-scripts.mjs", "history-outbox.mjs", "setup-mcp.mjs", "log-session.mjs", "count-behaviour.mjs", "transcript-readers.mjs", "session-databases.mjs", "session-local-models.mjs", "config-edits.mjs", "stretch-evidence.mjs", "chat-exports.mjs", "export-facts.mjs", "stack-rules.mjs", "runtime-install.mjs", "orchestration-contract.mjs", "orchestration-evidence.mjs", "orchestration-report.mjs", "claude-mod.mjs", "package-integrity.mjs", "worktrust-launch.mjs", "project-modes.mjs", "commit-rules.mjs", "git-commits.mjs", "self-update.mjs", "history-progress.mjs"];
119
+ const SCRIPTS = ["credential-store.mjs", "remote-protocol.mjs", "remote-store.mjs", "remote-policy.mjs", "remote-journal.mjs", "remote-steered.mjs", "remote-inventory.mjs", "remote-claude-events.mjs", "remote-claude-progress.mjs", "remote-attachments.mjs", "remote-preview.mjs", "remote-coalesce.mjs", "remote-steering.mjs", "remote-codex-events.mjs", "remote-adapter-codex.mjs", "remote-opencode-events.mjs", "remote-adapter-opencode.mjs", "remote-opencode-session.mjs", "remote-adapter-terminal.mjs", "remote-terminal-sessions.mjs", "remote-terminal-cli.mjs", "remote-screen-states.mjs", "remote-screen-approvals.mjs", "remote-screen-push.mjs", "remote-cdp.mjs", "remote-live-preview.mjs", "remote-projects.mjs", "remote-pipeline-config.mjs", "remote-pipeline-parsers.mjs", "remote-pipeline.mjs", "remote-releases.mjs", "remote-release-plans.mjs", "remote-adapter-claude-code.mjs", "remote-approval-bridge.mjs", "remote-approvals.mjs", "remote-sessions.mjs", "remote-session-list.mjs", "remote-changes.mjs", "remote-endorse.mjs", "remote-daemon.mjs", "remote-transport.mjs", "remote-run.mjs", "remote-service.mjs", "remote-pairing.mjs", "remote-qr.mjs", "remote-cli.mjs", "remote-agent-switch.mjs", "remote-settings.mjs", "folder-picker.mjs", "cli-menu.mjs", "cli-menu-remote.mjs", "cli-colour.mjs", "node-guide.mjs", "remote-countdown.mjs", "remote-connections.mjs", "remote-admin.mjs", "credential-vault.mjs", "credential-vault-scripts.mjs", "history-outbox.mjs", "setup-mcp.mjs", "log-session.mjs", "count-behaviour.mjs", "transcript-readers.mjs", "session-databases.mjs", "session-local-models.mjs", "config-edits.mjs", "stretch-evidence.mjs", "chat-exports.mjs", "export-facts.mjs", "stack-rules.mjs", "runtime-install.mjs", "orchestration-contract.mjs", "orchestration-evidence.mjs", "orchestration-report.mjs", "claude-mod.mjs", "package-integrity.mjs", "worktrust-launch.mjs", "project-modes.mjs", "commit-rules.mjs", "git-commits.mjs", "self-update.mjs", "history-progress.mjs"];
120
120
  /** The modules the scripts import by name from beside them; a download keeps that name. */
121
121
  const IMPORTED = new Set(["project-modes.mjs", "transcript-readers.mjs", "session-databases.mjs", "session-local-models.mjs", "config-edits.mjs", "stretch-evidence.mjs", "chat-exports.mjs", "export-facts.mjs", "stack-rules.mjs", "runtime-install.mjs", "orchestration-contract.mjs", "orchestration-evidence.mjs", "orchestration-report.mjs", "commit-rules.mjs", "git-commits.mjs"]);
122
122
  const downloaded = (name) => (IMPORTED.has(name) ? name : `${name}.download.mjs`);
123
123
  const BUNDLED = SCRIPTS.every((name) => existsSync(join(HERE, name)));
124
124
  const PLACEHOLDER = `wt_${"0".repeat(43)}`;
125
- const say = (line = "") => process.stdout.write(`${line}\n`);
125
+ // COLOUR WITH MEANING (0.11.8, cli-colour.mjs): a status line is painted by the symbol or word it already carries (✓ green,
126
+ // ! yellow, an error red), on a person's terminal only. A hook, the MCP bridge and self-update are read by programs: never
127
+ // painted, whatever the environment says. Colours off (a pipe, NO_COLOR, --no-color, CI), every byte is as before 0.11.8.
128
+ const MACHINE = command === "hook" || command === "self-update" || (command === "mcp" && !["on", "off", "status"].includes(args[args.indexOf("mcp") + 1]));
129
+ const { coloursFor, busyWith = (words, work) => work() } = await import("./cli-colour.mjs").catch(() => ({}));
130
+ const PAINT = coloursFor?.(process.stdout, { machine: MACHINE }) ?? { status: (line) => line }, PAINT_ERR = coloursFor?.(process.stderr, { machine: MACHINE }) ?? { status: (line) => line };
131
+ const say = (line = "") => process.stdout.write(`${PAINT.status(line)}\n`);
126
132
  // A reader that closed the pipe (`worktrust status | head`) wants no more: stop quietly, never an EPIPE stack (0.6.16, audit L4).
127
133
  process.stdout.on("error", (error) => { if (error?.code === "EPIPE") process.exit(0); throw error; });
128
134
  class CliFailure extends Error {}
129
- const fail = (line) => { process.stderr.write(`worktrust: ${line}\n`); throw new CliFailure(); };
135
+ const fail = (line) => { process.stderr.write(`${PAINT_ERR.status(`worktrust: ${line}`)}\n`); throw new CliFailure(); };
130
136
  const NODE_FLAGS = process.versions.node === "26.5.0" ? ["--no-concurrent-sparkplug"] : [];
131
137
  const OS = { darwin: "macos", win32: "windows", linux: "linux" }[platform()] ?? "other";
132
138
  /** The shells AI agents run commands in (AGENTS.md): a person-only command stops there (main). */
@@ -701,7 +707,7 @@ async function update() {
701
707
  const paths = await scripts();
702
708
  if (!doorState() && !has("dry-run")) saveDoorState({ mode: await chooseDoor(), asked: new Date().toISOString() }); // once, for a computer coupled before 0.10.37
703
709
  const doorIsOff = doorOff();
704
- const plan = await run(paths["setup-mcp.mjs"], ["--bridge", STABLE], PLACEHOLDER, true);
710
+ const plan = await busyWith("Reading the AI apps on this computer", () => run(paths["setup-mcp.mjs"], ["--bridge", STABLE], PLACEHOLDER, true));
705
711
  // AGREED BEFORE, REFRESHED WITHOUT A QUESTION (0.10.30): an app or hook the person said yes to is brought onto this
706
712
  // version's launcher; only what is NEW here is shown in full and asked about, and --yes leaves the new ones as they are.
707
713
  const agreed = await consent();
@@ -742,7 +748,7 @@ async function update() {
742
748
  // Codex installed since, or a No said at connect: the one question, asked again (or "already set").
743
749
  await offerCodex();
744
750
  await offerAntigravity();
745
- const reported = await accepted(key.url, key.token, key.device, doorModeAgent());
751
+ const reported = await busyWith("Telling WorkTrust the version", () => accepted(key.url, key.token, key.device, doorModeAgent()));
746
752
  say(reported === true ? ` ✓ WorkTrust received CLI version ${CLI_VERSION}.` : " ! Installed locally. WorkTrust could not confirm the version yet; it will be reported on the next connection.");
747
753
  await offerRebuild(previous, paths, key);
748
754
  doubleDoorNotice();
@@ -1007,7 +1013,7 @@ async function again() {
1007
1013
  * run was planned. Held-for-review batches stay held. Quiet when nothing was pending.
1008
1014
  */
1009
1015
  async function resendHistory(key) {
1010
- const paths = await scripts(), sent = await run(paths["log-session.mjs"], ["--history", "--resume"], key.token, true, { WORKTRUST_MCP_URL: key.url, ...(key.device ? { WORKTRUST_DEVICE_KEY: key.device } : {}) });
1016
+ const paths = await scripts(), sent = await busyWith("Checking for earlier history still waiting", () => run(paths["log-session.mjs"], ["--history", "--resume"], key.token, true, { WORKTRUST_MCP_URL: key.url, ...(key.device ? { WORKTRUST_DEVICE_KEY: key.device } : {}) }));
1011
1017
  let did = null;
1012
1018
  try { did = JSON.parse(sent.out.trim().split("\n").reverse().find((line) => line.startsWith('{"resumed"')) ?? "null"); } catch { /* nothing pending, or an older hook */ }
1013
1019
  if (Number(did?.resumed) > 0) { say(); say(` ✓ ${did.resumed} lines of earlier history that had not reached WorkTrust were sent; WorkTrust keeps them and rebuilds the days itself.`); }
@@ -1373,6 +1379,7 @@ async function status() {
1373
1379
  say(key ? ` Key: in ${KEY_PLACE}, ${key.device ? "bound to this computer, " : ""}last renewed ${String(key.renewedAt ?? "").slice(0, 10) || "never"}` : " Key: not on this computer (or written into the apps' settings with --direct)");
1374
1380
  if (key) say(key.account ? ` Account: ${key.account}${key.coupledAt ? `, coupled ${String(key.coupledAt).slice(0, 10)}` : ""}` : " Account: not recorded (coupled by an older version; `npx worktrust connect` records it)");
1375
1381
  say(sessionHookHere() ? " Session hook: installed" : " Session hook: not installed");
1382
+ if (typeof globalThis.WebSocket !== "function") say(` Remote Agent: needs Node 22.4 or later (this is ${process.versions.node})`);
1376
1383
  say(` AI work lines: ${doorLine()}`);
1377
1384
  if (measurePaused()) say(` Measuring: paused by you in Sources since ${String(measureState()?.since ?? "").slice(0, 10)}; nothing is measured or sent until you turn it on there`);
1378
1385
  // THE LAST UPDATE ON TURN-ON (0.10.37): what happened, in words; the details are in ~/.worktrust/update.log, on this computer only.
@@ -1397,7 +1404,7 @@ async function measuredHere() {
1397
1404
  const hook = join(HERE, "log-session.mjs");
1398
1405
  if (!hook) return;
1399
1406
  // Through the CLI's one way of starting a script (never a synchronous child: check-computer-pairing), with no door to send to.
1400
- const read = await run(hook, ["--evidence-summary"], "", true, { WORKTRUST_MCP_URL: "", WORKTRUST_HOOK_INPUT: "" });
1407
+ const read = await busyWith("Counting what this computer measured", () => run(hook, ["--evidence-summary"], "", true, { WORKTRUST_MCP_URL: "", WORKTRUST_HOOK_INPUT: "" }));
1401
1408
  let m = null;
1402
1409
  try { m = JSON.parse(read.out.trim().split("\n").filter((text) => text.startsWith("{")).pop()); } catch { return; }
1403
1410
  if (!m || !m.stretches) { say(" Measured here, last 30 days: no finished work stretch yet."); return; }
@@ -1641,6 +1648,7 @@ function help() {
1641
1648
  say("WorkTrust: couple this computer to your record. Metadata only.");
1642
1649
  say();
1643
1650
  say(" worktrust in your terminal: the menu (every command below, with the short form it runs)");
1651
+ say(" npx -y worktrust skips npm's own \"Ok to proceed?\" question; --no-color (or NO_COLOR) turns colours off");
1644
1652
  say(" without a terminal, or with any option: couple this computer: show the plan, ask,");
1645
1653
  say(" approve in your browser (already coupled: shows what is coupled here)");
1646
1654
  say(" --dry-run the plan only: nothing is written, nothing is sent");
@@ -1755,14 +1763,15 @@ if (command === "default" && BUNDLED && (await import("./cli-menu.mjs")).menuWan
1755
1763
  catch { fail("The local WorkTrust key file is unsafe or damaged, or the OS vault is locked or unavailable. Unlock your OS vault and retry. Do not delete the key file or reset the keychain."); }
1756
1764
  let latest;
1757
1765
  const runCli = (cliArgs) => new Promise((resolve) => {
1758
- const child = spawn(moduleExecutable(HERE), [...moduleArgs(HERE, "worktrust.mjs", cliArgs)], { stdio: "inherit", env: { ...process.env, WORKTRUST_MENU: "off", WORKTRUST_RELAYED: "1" } });
1766
+ const child = spawn(moduleExecutable(HERE), [...moduleArgs(HERE, "worktrust.mjs", cliArgs)], { stdio: "inherit", env: { ...process.env, WORKTRUST_MENU: "off", WORKTRUST_RELAYED: "1", ...(has("no-color") || has("no-colour") ? { NO_COLOR: "1" } : {}) } });
1759
1767
  child.on("error", () => resolve(1));
1760
1768
  child.on("exit", (code) => resolve(code ?? 1));
1761
1769
  });
1762
1770
  const state = async () => {
1763
1771
  if (latest === undefined) { const v = await newestVersion(); latest = v && semverNewer(v, CLI_VERSION) ? v : null; }
1764
1772
  let key = null; try { key = keyStore.load(); } catch { key = null; }
1765
- return { version: CLI_VERSION, latest, connected: Boolean(key), account: key?.account ?? null, door: doorOff() ? "off" : "on" };
1773
+ // `installed` is read again at every ask (0.11.8): the menu's Update item says "up to date" the moment an update ends.
1774
+ return { version: CLI_VERSION, installed: stableVersion(), latest, connected: Boolean(key), account: key?.account ?? null, door: doorOff() ? "off" : "on" };
1766
1775
  };
1767
1776
  return (await import("./cli-menu.mjs")).runMenu({ runCli, state });
1768
1777
  }
@@ -1794,7 +1803,7 @@ else if (command === "antigravity") await offerAntigravity();
1794
1803
  else if (command === "disconnect") await disconnect();
1795
1804
  else if (command === "status") await status();
1796
1805
  else if (command === "project") { if (!projectCommand) fail("worktrust project needs the complete WorkTrust package. Nothing was changed."); projectCommand(args.slice(args.indexOf("project") + 1).filter((arg) => !arg.startsWith("--")), { say, fail }); }
1797
- else if (command === "remote") await (await import("./remote-cli.mjs")).remoteCommand(args.slice(args.indexOf("remote") + 1).filter((a, i, all) => !a.startsWith("--") && !(i > 0 && ["--gateway", "--origin"].includes(all[i - 1]))), { say, fail, ask, has, flag, origin: ORIGIN, os: OS, openBrowser, prepare: async () => { await prepareBundledRuntime(); return { node: NODE, nodeArgs: [...NODE_FLAGS, ...NODE_ARGS], entry: STABLE }; } });
1806
+ else if (command === "remote") await (await import("./remote-cli.mjs")).remoteCommand(args.slice(args.indexOf("remote") + 1).filter((a, i, all) => !a.startsWith("--") && !(i > 0 && ["--gateway", "--origin"].includes(all[i - 1]))), { say, fail, ask, has, flag, connected: () => { try { return Boolean(keyStore.load()); } catch { return false; } }, origin: ORIGIN, os: OS, openBrowser, prepare: async () => { await prepareBundledRuntime(); return { node: NODE, nodeArgs: [...NODE_FLAGS, ...NODE_ARGS], entry: STABLE }; } });
1798
1807
  else if (command === "preserve") await preserve();
1799
1808
  else if (command === "mod") await mod();
1800
1809
  else if (command === "git") await gitCommits();