worktrust 0.11.7 → 0.11.9
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/CHANGELOG.md +380 -0
- package/LICENSE +2 -0
- package/README.md +213 -307
- package/cli-colour.mjs +86 -0
- package/cli-menu-remote.mjs +131 -55
- package/cli-menu.mjs +245 -68
- package/engine-release.json +1 -1
- package/node-guide.mjs +134 -0
- package/package-release.json +1 -1
- package/package.json +4 -1
- package/remote-cli.mjs +2 -1
- package/worktrust.mjs +61 -23
package/package-release.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"keyId":"608168ccdef72562fc91f9c0f9f2c2d6876bece7f7362cb545b818f7947da6b5","payload":{"files":{"AGENTS.md":"e8abb38c293b57b71d3a6163d6242d1f375e773372b91b6d8ce39c584c51262a","CLAUDE.md":"5933504f93e5a40369a4790e96dd5dad791d849d3178b1833eb64088e456aaeb","LICENSE":"
|
|
1
|
+
{"keyId":"608168ccdef72562fc91f9c0f9f2c2d6876bece7f7362cb545b818f7947da6b5","payload":{"files":{"AGENTS.md":"e8abb38c293b57b71d3a6163d6242d1f375e773372b91b6d8ce39c584c51262a","CHANGELOG.md":"3cae60d5eb0302bdcd0c737cc594677ddc8151359bfd3538d6707800225d35fd","CLAUDE.md":"5933504f93e5a40369a4790e96dd5dad791d849d3178b1833eb64088e456aaeb","LICENSE":"8d0383d51db8bb0959eb3fa4eab482337c58492b254406c519e562911537d35f","README.md":"dd395252638bd253766b6b3bfe2362b687e86a17825982432245dcc776206a03","SECURITY.md":"6a798d875f48ae84c3a677397e5611e03b94215944952e0f61e13f6cfc949745","chat-exports.mjs":"f026c5a063f62c22ba6f25474a9d9fdbb6074beebbfe1faff2a876c437a1a000","claude-mod.mjs":"02d86b0cdddf39879efc5194c0a5be6b41456faedec28963dc123a4e88dc3942","cli-colour.mjs":"fa16b61ad179999c5c5365255182acf69bcba1eb5f5ce7b0e1e18c11f56130ae","cli-menu-remote.mjs":"4f7284911d86e4463797e7dec976c4c10f46e6fdb3053c5ad211210e1efe25e5","cli-menu.mjs":"09eed126c220ffdfba8fedd7f2730ddcbc75471c31dcb5ce066c02592aa3b3b9","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":"8d97ea82525b5fcc6680fc8255caabc7ab68f4b04977b0e60e1326e09c6afed5","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":"0c8c690398d7bde34ddd45ae0f73bdf0546e8bc5f71cbf2de1f1db5d9092f5dc","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":"e2ac72ef0f14bb8b8f756f67c65b6adc88bc899e2794e8f0edcf305290ab7f33"},"format":"worktrust-package/1","kind":"npm","version":"0.11.9"},"signature":"9_ypkspVXoOYgaTLdv4CCVZ0IOr5m9RLTjtNVLFw_cl0VaVPbStkxGx9OuPFDcLX7kcP0jt2_EyE6GjaRiKdAw"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "worktrust",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.9",
|
|
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,8 @@
|
|
|
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
|
|
4
|
+
* npx worktrust in a person's own terminal (0.11.7; 0.11.8: Update first; 0.11.9: not connected yet, a short
|
|
5
|
+
* menu: Connect, Preserve, Help): the menu (cli-menu.mjs), one item of which is
|
|
5
6
|
* what the bare command did until then; without a terminal, exactly that:
|
|
6
7
|
* show the plan, ask, approve this computer in the app, couple (0.10.7: a person's
|
|
7
8
|
* command always runs the newest version, whatever npx had cached);
|
|
@@ -11,7 +12,9 @@
|
|
|
11
12
|
* npx worktrust --device a computer without a browser (SSH): type a code on another device
|
|
12
13
|
* npx worktrust connect couple again, also on a computer already coupled
|
|
13
14
|
* npx worktrust update this computer onto the newest CLI, same key, no new pairing (0.10.30: what
|
|
14
|
-
* was agreed before is refreshed unasked; --rebuild agrees to the re-measure
|
|
15
|
+
* was agreed before is refreshed unasked; --rebuild agrees to the re-measure;
|
|
16
|
+
* 0.11.9: already on this version with nothing waiting, it says so and
|
|
17
|
+
* changes nothing; --force sets everything up again all the same)
|
|
15
18
|
* npx worktrust history send this computer's earlier sessions as history (asks first)
|
|
16
19
|
* npx worktrust history --rebuild the same as history (0.10.5: history always re-measures); WorkTrust replaces this computer's
|
|
17
20
|
* earlier lines day by day, never counting a day twice (shows the plan, asks first)
|
|
@@ -80,7 +83,7 @@ const command = args.includes("--help") ? "help" : args.includes("--version") ?
|
|
|
80
83
|
const flag = (name) => { const at = args.indexOf(`--${name}`); return at >= 0 ? args[at + 1] : undefined; };
|
|
81
84
|
const has = (name) => args.includes(`--${name}`);
|
|
82
85
|
/** 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.
|
|
86
|
+
const CLI_VERSION = "0.11.9";
|
|
84
87
|
/**
|
|
85
88
|
* 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
89
|
* to offer). Raised ONLY when what is measured changes: the timeline, the seconds, the tokens, the steering, the session
|
|
@@ -116,17 +119,23 @@ const ORIGIN = (flag("origin") ?? process.env.WORKTRUST_ORIGIN ?? "https://app.w
|
|
|
116
119
|
const MCP = flag("url") ?? process.env.WORKTRUST_MCP_URL ?? `${ORIGIN}/api/mcp`;
|
|
117
120
|
const HOME_DIR = join(homedir(), ".worktrust");
|
|
118
121
|
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"];
|
|
122
|
+
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
123
|
/** The modules the scripts import by name from beside them; a download keeps that name. */
|
|
121
124
|
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
125
|
const downloaded = (name) => (IMPORTED.has(name) ? name : `${name}.download.mjs`);
|
|
123
126
|
const BUNDLED = SCRIPTS.every((name) => existsSync(join(HERE, name)));
|
|
124
127
|
const PLACEHOLDER = `wt_${"0".repeat(43)}`;
|
|
125
|
-
|
|
128
|
+
// COLOUR WITH MEANING (0.11.8, cli-colour.mjs): a status line is painted by the symbol or word it already carries (✓ green,
|
|
129
|
+
// ! yellow, an error red), on a person's terminal only. A hook, the MCP bridge and self-update are read by programs: never
|
|
130
|
+
// painted, whatever the environment says. Colours off (a pipe, NO_COLOR, --no-color, CI), every byte is as before 0.11.8.
|
|
131
|
+
const MACHINE = command === "hook" || command === "self-update" || (command === "mcp" && !["on", "off", "status"].includes(args[args.indexOf("mcp") + 1]));
|
|
132
|
+
const { coloursFor, busyWith = (words, work) => work() } = await import("./cli-colour.mjs").catch(() => ({}));
|
|
133
|
+
const PAINT = coloursFor?.(process.stdout, { machine: MACHINE }) ?? { status: (line) => line }, PAINT_ERR = coloursFor?.(process.stderr, { machine: MACHINE }) ?? { status: (line) => line };
|
|
134
|
+
const say = (line = "") => process.stdout.write(`${PAINT.status(line)}\n`);
|
|
126
135
|
// A reader that closed the pipe (`worktrust status | head`) wants no more: stop quietly, never an EPIPE stack (0.6.16, audit L4).
|
|
127
136
|
process.stdout.on("error", (error) => { if (error?.code === "EPIPE") process.exit(0); throw error; });
|
|
128
137
|
class CliFailure extends Error {}
|
|
129
|
-
const fail = (line) => { process.stderr.write(`worktrust: ${line}\n`); throw new CliFailure(); };
|
|
138
|
+
const fail = (line) => { process.stderr.write(`${PAINT_ERR.status(`worktrust: ${line}`)}\n`); throw new CliFailure(); };
|
|
130
139
|
const NODE_FLAGS = process.versions.node === "26.5.0" ? ["--no-concurrent-sparkplug"] : [];
|
|
131
140
|
const OS = { darwin: "macos", win32: "windows", linux: "linux" }[platform()] ?? "other";
|
|
132
141
|
/** The shells AI agents run commands in (AGENTS.md): a person-only command stops there (main). */
|
|
@@ -695,20 +704,41 @@ async function sessionEnd() {
|
|
|
695
704
|
async function update() {
|
|
696
705
|
const key = await freshKey();
|
|
697
706
|
if (!key) fail("this computer has no WorkTrust key file yet. Run npx worktrust connect.");
|
|
698
|
-
say();
|
|
699
|
-
|
|
700
|
-
|
|
707
|
+
const title = () => { say(); say(` WorkTrust · update ${hostname().replace(/\.local$/i, "")} to ${CLI_VERSION}`); say(); };
|
|
708
|
+
// ALREADY ON THIS VERSION (0.11.9, owner 2026-11-14: "when the latest version is already there it is useless to run the
|
|
709
|
+
// update again"): the second run took every door out and put it back, and said "7 added". Now it says so and changes
|
|
710
|
+
// nothing, but only when NOTHING waits: this version's stable copy, the door chosen, every AI app's door standing by the
|
|
711
|
+
// writer's own reading, nothing new to agree to, no Codex or Antigravity question open. `--force` is the repair road.
|
|
712
|
+
const same = !has("force") && !has("codex") && !has("antigravity") && stableVersion() === CLI_VERSION && existsSync(STABLE) && Boolean(doorState());
|
|
713
|
+
if (!same) title();
|
|
714
|
+
// The plan below asks the writer whether each door names THIS release's bridge, so the bridge's place must be the installed
|
|
715
|
+
// one first; the same release already in ~/.worktrust is only verified here, never written again.
|
|
716
|
+
// The old install is read BEFORE anything is prepared (check-core-logic history-rebuild: the rebuild offer compares it).
|
|
717
|
+
const previous = stableInstall();
|
|
718
|
+
if (same) await prepareBundledRuntime();
|
|
701
719
|
const paths = await scripts();
|
|
702
720
|
if (!doorState() && !has("dry-run")) saveDoorState({ mode: await chooseDoor(), asked: new Date().toISOString() }); // once, for a computer coupled before 0.10.37
|
|
703
721
|
const doorIsOff = doorOff();
|
|
704
|
-
const plan = await run(paths["setup-mcp.mjs"], ["--bridge", STABLE], PLACEHOLDER, true);
|
|
722
|
+
const plan = await busyWith("Reading the AI apps on this computer", () => run(paths["setup-mcp.mjs"], ["--bridge", STABLE], PLACEHOLDER, true));
|
|
705
723
|
// AGREED BEFORE, REFRESHED WITHOUT A QUESTION (0.10.30): an app or hook the person said yes to is brought onto this
|
|
706
724
|
// 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
725
|
const agreed = await consent();
|
|
708
|
-
say(" Every AI app found here gets the WorkTrust door, the local command that reads the key:");
|
|
709
726
|
const found = doorIsOff ? [] : planLines(plan.out, true).filter((line) => !line.includes("not on this machine"));
|
|
710
|
-
if (doorIsOff) say(` the door stays off here (hours only, ${DOOR_SWITCH})`);
|
|
711
727
|
const apps = [...new Set(found.map(labelOf).filter(Boolean))], fresh = apps.filter((app) => !agreed.has(`door:${app}`));
|
|
728
|
+
if (same) {
|
|
729
|
+
const standing = doorIsOff || planLines(plan.out).filter((line) => !line.includes("not on this machine")).every((line) => /^\s+✓ /.test(line));
|
|
730
|
+
const asked = (existsSync(join(homedir(), ".codex")) && !codexNotify().text) || (antigravityHere() && agyHooks() !== null && !agyHooks()?.worktrust);
|
|
731
|
+
if (plan.code === 0 && standing && fresh.length === 0 && agreed.has("session-hook") && !asked) {
|
|
732
|
+
say();
|
|
733
|
+
say(` Already up to date (${CLI_VERSION}). Nothing changed.`);
|
|
734
|
+
if (doorIsOff) say(` the door stays off here (hours only, ${DOOR_SWITCH})`); // a choice the update keeps is still said
|
|
735
|
+
say(" To set this computer up again all the same: npx worktrust update --force");
|
|
736
|
+
return;
|
|
737
|
+
}
|
|
738
|
+
title();
|
|
739
|
+
}
|
|
740
|
+
say(" Every AI app found here gets the WorkTrust door, the local command that reads the key:");
|
|
741
|
+
if (doorIsOff) say(` the door stays off here (hours only, ${DOOR_SWITCH})`);
|
|
712
742
|
for (const app of apps) if (!fresh.includes(app)) say(` ✓ ${app}: refreshed (${agreed.said(`door:${app}`)})`);
|
|
713
743
|
for (const line of found) if (fresh.includes(labelOf(line))) say(`${line} · new`);
|
|
714
744
|
if (found.length === 0 && !doorIsOff) say(" (no AI app found here)");
|
|
@@ -724,7 +754,6 @@ async function update() {
|
|
|
724
754
|
else if (newOnes.length > 0) takeNew = await ask(`Couple the new ${newOnes.length === 1 ? "one" : "ones"} marked "new" (${newOnes.join(", ")})?`, false);
|
|
725
755
|
if (newOnes.length > 0 && !takeNew && !has("yes")) say(" The new ones stay as they are. npx worktrust update asks again.");
|
|
726
756
|
const skip = takeNew ? [] : fresh, hookOn = !hookFresh || takeNew;
|
|
727
|
-
const previous = stableInstall();
|
|
728
757
|
await prepareBundledRuntime();
|
|
729
758
|
ensureHome();
|
|
730
759
|
saveStableEntry();
|
|
@@ -742,7 +771,7 @@ async function update() {
|
|
|
742
771
|
// Codex installed since, or a No said at connect: the one question, asked again (or "already set").
|
|
743
772
|
await offerCodex();
|
|
744
773
|
await offerAntigravity();
|
|
745
|
-
const reported = await accepted(key.url, key.token, key.device, doorModeAgent());
|
|
774
|
+
const reported = await busyWith("Telling WorkTrust the version", () => accepted(key.url, key.token, key.device, doorModeAgent()));
|
|
746
775
|
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
776
|
await offerRebuild(previous, paths, key);
|
|
748
777
|
doubleDoorNotice();
|
|
@@ -1007,7 +1036,7 @@ async function again() {
|
|
|
1007
1036
|
* run was planned. Held-for-review batches stay held. Quiet when nothing was pending.
|
|
1008
1037
|
*/
|
|
1009
1038
|
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 } : {}) });
|
|
1039
|
+
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
1040
|
let did = null;
|
|
1012
1041
|
try { did = JSON.parse(sent.out.trim().split("\n").reverse().find((line) => line.startsWith('{"resumed"')) ?? "null"); } catch { /* nothing pending, or an older hook */ }
|
|
1013
1042
|
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,11 +1402,12 @@ async function status() {
|
|
|
1373
1402
|
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
1403
|
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
1404
|
say(sessionHookHere() ? " Session hook: installed" : " Session hook: not installed");
|
|
1405
|
+
if (typeof globalThis.WebSocket !== "function") say(` Remote Agent: needs Node 22.4 or later (this is ${process.versions.node})`);
|
|
1376
1406
|
say(` AI work lines: ${doorLine()}`);
|
|
1377
1407
|
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
1408
|
// THE LAST UPDATE ON TURN-ON (0.10.37): what happened, in words; the details are in ~/.worktrust/update.log, on this computer only.
|
|
1379
1409
|
{ const state = updateState(); if (state) { const code = (await selfUpdateModule()).updateResult(state);
|
|
1380
|
-
const words = { installed: `updated itself to ${state.version}`, current: `already on ${state.version} or newer`, python: "installed with Python: update it with the package manager you installed WorkTrust with", unsupported: "this installation cannot update itself: run npx worktrust@latest update", unverified: `${state.version} could not be verified, so nothing was installed`, failed: `the update to ${state.version} did not finish; the CLI stays as it was` };
|
|
1410
|
+
const words = { installed: `updated itself to ${state.version}`, current: `already on ${state.version} or newer`, python: "installed with Python: update it with the package manager you installed WorkTrust with", unsupported: "this installation cannot update itself: run npx -y worktrust@latest update", unverified: `${state.version} could not be verified, so nothing was installed`, failed: `the update to ${state.version} did not finish; the CLI stays as it was` };
|
|
1381
1411
|
say(` Update when turned on: ${words[code] ?? `to ${state.version}, under way`}${["unverified", "failed"].includes(code) ? " (~/.worktrust/update.log)" : ""}`); } }
|
|
1382
1412
|
// A TRANSCRIPT THE HOOK COULD NOT READ (0.10.32): the count of its last run that had any, never which file; WorkTrust has the count too.
|
|
1383
1413
|
{ let unread = null; try { unread = JSON.parse(readFileSync(join(HOME_DIR, "sessions.json"), "utf8")).__unreadable ?? null; } catch { /* no state yet */ }
|
|
@@ -1397,7 +1427,7 @@ async function measuredHere() {
|
|
|
1397
1427
|
const hook = join(HERE, "log-session.mjs");
|
|
1398
1428
|
if (!hook) return;
|
|
1399
1429
|
// 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: "" });
|
|
1430
|
+
const read = await busyWith("Counting what this computer measured", () => run(hook, ["--evidence-summary"], "", true, { WORKTRUST_MCP_URL: "", WORKTRUST_HOOK_INPUT: "" }));
|
|
1401
1431
|
let m = null;
|
|
1402
1432
|
try { m = JSON.parse(read.out.trim().split("\n").filter((text) => text.startsWith("{")).pop()); } catch { return; }
|
|
1403
1433
|
if (!m || !m.stretches) { say(" Measured here, last 30 days: no finished work stretch yet."); return; }
|
|
@@ -1641,6 +1671,7 @@ function help() {
|
|
|
1641
1671
|
say("WorkTrust: couple this computer to your record. Metadata only.");
|
|
1642
1672
|
say();
|
|
1643
1673
|
say(" worktrust in your terminal: the menu (every command below, with the short form it runs)");
|
|
1674
|
+
say(" npx -y worktrust skips npm's own \"Ok to proceed?\" question; --no-color (or NO_COLOR) turns colours off");
|
|
1644
1675
|
say(" without a terminal, or with any option: couple this computer: show the plan, ask,");
|
|
1645
1676
|
say(" approve in your browser (already coupled: shows what is coupled here)");
|
|
1646
1677
|
say(" --dry-run the plan only: nothing is written, nothing is sent");
|
|
@@ -1652,6 +1683,8 @@ function help() {
|
|
|
1652
1683
|
say(" --replace yes in advance to coupling a computer that is already coupled");
|
|
1653
1684
|
say(" worktrust update this computer onto the newest CLI: same key, no new pairing; what you agreed to before is");
|
|
1654
1685
|
say(" refreshed without a question, a new AI app or hook is asked about (--yes: skipped)");
|
|
1686
|
+
say(" already on this version with nothing waiting: says so and changes nothing");
|
|
1687
|
+
say(" --force set everything up again all the same (the repair road)");
|
|
1655
1688
|
say(" --rebuild yes in advance to the re-measure update offers after a new version (the plan is still shown)");
|
|
1656
1689
|
say(" --codex yes in advance to letting Codex wake the session hook (also for connect)");
|
|
1657
1690
|
say(" --antigravity yes in advance to letting Antigravity wake the session hook (also for connect)");
|
|
@@ -1753,16 +1786,21 @@ async function relayToNewest() {
|
|
|
1753
1786
|
if (command === "default" && BUNDLED && (await import("./cli-menu.mjs")).menuWanted({ args, env: process.env, stdinTTY: Boolean(process.stdin.isTTY), stdoutTTY: Boolean(process.stdout.isTTY), agentShell })) {
|
|
1754
1787
|
try { keyStore.load(); }
|
|
1755
1788
|
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
|
-
let latest;
|
|
1789
|
+
let latest, latestKnown = false; // 0.11.9: whether the registry answered at all (no answer is not "up to date")
|
|
1757
1790
|
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" } });
|
|
1791
|
+
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
1792
|
child.on("error", () => resolve(1));
|
|
1760
|
-
child.on("exit", (code) => resolve(code ?? 1));
|
|
1793
|
+
child.on("exit", (code, signal) => resolve(code ?? (signal ? 130 : 1))); // stopped by Ctrl+C: 130, which the first menu reads as cancelled
|
|
1761
1794
|
});
|
|
1762
1795
|
const state = async () => {
|
|
1763
|
-
if (latest === undefined) { const v = await newestVersion(); latest = v && semverNewer(v, CLI_VERSION) ? v : null; }
|
|
1796
|
+
if (latest === undefined) { const v = await newestVersion(); latestKnown = v !== null; latest = v && semverNewer(v, CLI_VERSION) ? v : null; }
|
|
1764
1797
|
let key = null; try { key = keyStore.load(); } catch { key = null; }
|
|
1765
|
-
|
|
1798
|
+
// `installed` is read again at every ask (0.11.8): the menu's Update item says "up to date" the moment an update ends.
|
|
1799
|
+
// THE SUMMARY'S FACTS (0.11.9): what this computer's own files say, never the key: its name, the day it was coupled, whether
|
|
1800
|
+
// the session hook stands in Claude Code's settings, and how many AI apps' doors the person agreed to (the consent record).
|
|
1801
|
+
let apps = null; try { apps = Object.keys(JSON.parse(readPrivateFile(CONSENT_FILE) ?? "null")?.entries ?? {}).filter((name) => name.startsWith("door:")).length; } catch { apps = null; }
|
|
1802
|
+
return { version: CLI_VERSION, installed: stableVersion(), latest, latestKnown, connected: Boolean(key), account: key?.account ?? null, door: doorOff() ? "off" : "on",
|
|
1803
|
+
host: hostname().replace(/\.local$/i, ""), since: key?.coupledAt ?? null, hook: sessionHookHere(), apps };
|
|
1766
1804
|
};
|
|
1767
1805
|
return (await import("./cli-menu.mjs")).runMenu({ runCli, state });
|
|
1768
1806
|
}
|
|
@@ -1794,7 +1832,7 @@ else if (command === "antigravity") await offerAntigravity();
|
|
|
1794
1832
|
else if (command === "disconnect") await disconnect();
|
|
1795
1833
|
else if (command === "status") await status();
|
|
1796
1834
|
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 }; } });
|
|
1835
|
+
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
1836
|
else if (command === "preserve") await preserve();
|
|
1799
1837
|
else if (command === "mod") await mod();
|
|
1800
1838
|
else if (command === "git") await gitCommits();
|