worktrust 0.10.20 → 0.10.23

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/README.md CHANGED
@@ -9,12 +9,9 @@ npx worktrust@latest
9
9
 
10
10
  **The official npm package** is `worktrust`, published by the npm account **worktrustio** with
11
11
  provenance from this repository (github.com/fhomey/worktrust-cli). Check it on npmjs.com before you run
12
- it; a package of another name or from another publisher is not ours. Without npm, the same script runs
13
- from WorkTrust's own site:
14
-
15
- ```
16
- curl -fsSO https://app.worktrust.io/counter/worktrust.mjs && node worktrust.mjs
17
- ```
12
+ it; a package of another name or from another publisher is not ours. Use the complete package:
13
+ individual support scripts are no longer downloaded and executed during setup. Version 0.10.22
14
+ adds a signed launcher. Check the registry for availability; 0.10.21 does not include this guard.
18
15
 
19
16
  **Python tool runners:** this repository also builds `worktrust` for `uvx` and `pipx` from the
20
17
  same measurement modules. Native wheels (0.10.13+) include a pinned official Node runtime,
@@ -254,6 +251,12 @@ and counts, exactly as the session hook reads it.
254
251
 
255
252
  ## Rebuild the history
256
253
 
254
+ From **0.10.21**, changed measured history waits for review before it
255
+ can replace measurements already received for that computer, client and historical day.
256
+ The earlier receipt is retained as local activity, not independent proof of human effort.
257
+ Other computers and periods remain on the record, including an unavailable old laptop.
258
+ A support withdrawal is not reversed by reconnecting or running a rebuild.
259
+
257
260
  Since 0.10.5 there is one path: `npx worktrust@latest history` always re-measures and replaces this computer's earlier
258
261
  lines day by day. If a send did not finish, or you merged two keys of one computer, run `npx worktrust@latest` again:
259
262
  it finishes what did not arrive and never counts a day twice.
@@ -385,6 +388,20 @@ which would delete every password on the computer, and many people rightly keep
385
388
 
386
389
  ## What it reads, writes and sends
387
390
 
391
+ From **0.10.21**, before each submission the hook keeps a local
392
+ metadata file in `~/.worktrust/measurements/`. The `worktrust-measurement/1` format retains
393
+ the available timeline, opaque stretch reference, dates, counts and collector identifiers.
394
+ It omits prompts, answers, titles, repository names, file paths, endpoint URLs and credentials.
395
+ Files request mode 0600 in a mode-0700 directory; Windows ACLs need their own validation.
396
+ Retries retain the same metadata once; changed measurements get a separate file. Disconnecting
397
+ does not erase this journal. You control its retention and backups; it is not a remote backup.
398
+ Keep the regular `preserve --archive` archive too if your AI app removes its session files.
399
+ Metadata cannot reconstruct deleted conversation text or observations it never recorded.
400
+
401
+ A successful HTTP response alone does not advance progress. The hook requires an explicit
402
+ receipt; JSON-RPC errors, tool errors, incomplete receipts and partially refused batches are
403
+ retried safely. A row kept pending on WorkTrust remains excluded from counted activity.
404
+
388
405
  | | |
389
406
  |---|---|
390
407
  | **Reads** | Which AI apps are installed (the settings folders of Claude Code, Codex, Cursor, Gemini CLI, Antigravity, VS Code, Windsurf, Hermes Agent, Goose, OpenCode, OpenClaw), and the chats Cursor and Copilot keep (clocks, models and token counts only). Afterwards, the session hook reads Claude Code's, Codex's and Antigravity's session files, the session databases of Hermes, Goose, OpenCode and OpenClaw, and the chats Cursor and Copilot keep, on this computer to measure durations and token counts. |
@@ -403,13 +420,13 @@ never as proof.
403
420
 
404
421
  ## Why you can check it
405
422
 
406
- - **No dependencies and no install scripts.** Plain files, readable
423
+ - **No npm dependencies and no install scripts.** Plain files, readable
407
424
  in an afternoon: `worktrust.mjs` (this command), `setup-mcp.mjs` (writes the MCP entries),
408
425
  `log-session.mjs` (the session hook), `count-behaviour.mjs` (the local counter) and `preserve.mjs`
409
426
  (keep your history), with the readers they import.
410
427
  - **Bundled measurement modules.** The npm package includes its counter and readers. Interactive
411
- commands can check the registry and relay through `npx` to a newer package; that can download code.
412
- The standalone bootstrap can also download support modules. See SECURITY.md for the distinction.
428
+ commands can check the registry for a version notice; they no longer execute another npm
429
+ version automatically. Installation stays with the selected package manager. See SECURITY.md.
413
430
  - **Provenance.** The release workflow requests npm provenance from the public source repository.
414
431
  Verify the actual version's attestation and contents before relying on that origin; the manifest
415
432
  setting alone does not establish it. `npm audit signatures` checks an installed dependency tree.
@@ -459,3 +476,23 @@ The licence is free of charge. `preserve` (with `--apply`, `--archive`, `--verif
459
476
  with or without an account; every other feature is for WorkTrust account holders, and without an account the rest may
460
477
  only be installed and evaluated. The archives and files the CLI makes from your own data are yours.
461
478
  From 0.10.18 on; versions up to and including 0.10.17 were published under the MIT licence and stay under it.
479
+
480
+ ## Release signatures and the limits of verification
481
+
482
+ From 0.10.22, the official launcher verifies fixed release files through `worktrust-launch.mjs` before
483
+ starting the shared engine. Python uses the `pycryptodomex` library to verify its package and
484
+ bundled runtime before Node executes. Final npm/Python/source/preservation downloads are
485
+ covered by an Ed25519-signed `release-artifacts.json`, containing their SHA-256 values and the
486
+ source commit. Verify against the separately pinned publisher key, not a key supplied by the manifest.
487
+
488
+ The initial package-manager installation and host interpreter are trusted bootstrap boundaries.
489
+ A computer owner can alter or bypass a launcher; software signatures do not attest execution.
490
+
491
+ Local Claude records and other client activity are outside this release manifest. An official
492
+ CLI can read edited input. `cli_digest` remains client-reported diagnostic metadata and cannot
493
+ prove which program ran. SHA-256/SHA-512 are not encryption; HTTPS protects transport. Public
494
+ claim eligibility remains the server publication gate's responsibility.
495
+
496
+ Revoking a computer key stops new submissions, not the validity of every historical publication.
497
+ Passport withdrawal is a separate audited operation. Neither operation automatically erases the
498
+ person's prior data. Release signing keys, computer keys and passport signing keys are separate.
package/SECURITY.md CHANGED
@@ -12,7 +12,7 @@ private transcripts or account data in a public issue.
12
12
  A setup dry run is not a sandbox for the whole invocation: the standalone bootstrap can download
13
13
  scripts first, and the interactive entry can check for a newer release.
14
14
  - Submissions go to the configured WorkTrust MCP endpoint. Interactive commands can also contact
15
- the npm registry and relay through `npx` to a newer version. The npm package bundles its runtime
15
+ the npm registry for a version notice. The unpublished patch based on 0.10.21 no longer executes a newer version from that notice. The npm package bundles its runtime
16
16
  modules, but installation and automatic relay still use the network. `preserve` itself is local.
17
17
  A custom `--origin`, URL or registry override changes whom you trust.
18
18
  - The key it receives is a WorkTrust coupling for this computer: it can submit work metadata to your
@@ -48,6 +48,14 @@ private transcripts or account data in a public issue.
48
48
 
49
49
  ## What measurement signatures establish
50
50
 
51
+ The metadata journal introduced in the 0.10.21 candidate preserves observations, not their
52
+ truth. A user who controls the computer can fabricate session files, timestamps, counters,
53
+ model labels and software-key signatures, or name an official code digest. Server-side
54
+ recalculation detects a conflicting arithmetic claim; it cannot authenticate a fabricated
55
+ timeline. Prior receipts provide a comparison baseline, not independent confirmation.
56
+ Changed historical replacements are held for review without overwriting that baseline.
57
+ The journal is not encrypted storage, hardware attestation or a server-signed archive.
58
+
51
59
  Request proofs authenticate possession of the device key. Archive seals make later changes
52
60
  detectable relative to their trusted key/root. Neither proves that the client is unmodified, that
53
61
  local input files are authentic, or that work really happened. Local-only archive keys do not grant
@@ -70,6 +78,13 @@ are resource bounds, not a sandbox or independent validation of the export's tru
70
78
 
71
79
  ## Verifying a version
72
80
 
81
+ The unpublished maintenance patch based on 0.10.21 removes automatic execution based only on a newer registry
82
+ version string. The separate signed release/receipt components in the monorepo's
83
+ `tools/worktrust-release` are engineering candidates: production signing keys, final artifact
84
+ signing and npm/Python launcher integration are not yet provisioned. The current Python bundle
85
+ manifest detects file corruption but is not itself an authenticated WorkTrust release signature.
86
+ Do not treat its matching SHA-256 values as proof that modified input describes genuine work.
87
+
73
88
  The release configuration names https://github.com/fhomey/worktrust-cli and requests npm provenance.
74
89
  Check the particular published version's attestation and compare its contents to that commit before
75
90
  relying on those properties. A manifest flag or matching version string alone is not proof that an
@@ -0,0 +1 @@
1
+ {"keyId":"608168ccdef72562fc91f9c0f9f2c2d6876bece7f7362cb545b818f7947da6b5","payload":{"files":{"chat-exports.mjs":"04eafe333940ec03d5058d8d51062124aa12ab882bf04db03bcda5613ec69298","claude-mod.mjs":"02d86b0cdddf39879efc5194c0a5be6b41456faedec28963dc123a4e88dc3942","config-edits.mjs":"0eba2f176ef6f7afba071d6e00de0ff19ba2b283180a801dfd957aa38c1edd94","count-behaviour.mjs":"1beaec2a4d0aead76d166f89cc52441a9cf48f2e69da9888ca2091dd3a10a37b","log-session.mjs":"b99f082a58f0a92375026f52b62eb72173f06614b844e3def06b3ed40942b103","orchestration-contract.mjs":"ec08f303a166365b99e70b675de4cfe76c6156c2567e14b5569f6d992f0231b7","orchestration-evidence.mjs":"d0d06cecf0eb08e5c6e653c62a4f45b1eddf2119c2acb8341056b34f488d214a","orchestration-report.mjs":"d4e0a9ad8e4a01b462d22c6b1866aac291565c533ff476085d3367cb6d59bc1b","package-integrity.mjs":"b9d81dc88cf5c19ccfbf334a7af84a0c4e299a0e9e4d4091132253e22f855dc3","preserve-lines.mjs":"18081b745b8c47838448b0a49a129a363e29d3f2f5207bc591187d860157b456","preserve-summary.mjs":"137f781ed7021596a3f0ea67afcf2ab8616ac293f833dbb8f176e838e0ed8321","preserve.mjs":"38f83bd933853a986fef61f4e452c27d4a3adc6000f5c9201ef70f270b404eac","runtime-install.mjs":"b9d2e4febbf400a679eeb3a14b74eef6c2062c5b626d45872a193b7502d3201c","session-databases.mjs":"543fd3b82d28d96d789be0a1dc9186c5fafa783e98b87e5b3b17b211542e2b4d","setup-mcp.mjs":"70f63b61cf1e28fb2b7471e7768d596b0cf166ccdc9d1ce859ee58d29b2ecabc","stack-rules.mjs":"b23c56e72ec56ba02b17ed895f869172d988c468a697e8d6026b0e268f61e489","stretch-evidence.mjs":"5b31a6f29b785d277e92257532f3c7cee366a79759decc7a75cfbaec2686ee13","transcript-readers.mjs":"413948644a74dc0bf1b49548be193bf596bcf82ac7eae668f624345a18e189e7","worktrust-launch.mjs":"f28f699f986c72d99af8a7542d317f6dbb9e26d114f6ad083013567e08b8a650","worktrust.mjs":"b563a702634b41c064fdd0b6ad842c77ff851dfcf682b370c677114f8f75c061"},"format":"worktrust-package/1","kind":"engine","version":"0.10.23"},"signature":"g-Lbodi3WAsZnCC1kW05ecOXhxXCNgSITU67By6g3zJMQB5T7ksGWIO5FIP1d1Yf3IP5PlCyMTiJjm0C__8wCg"}
package/log-session.mjs CHANGED
@@ -60,7 +60,7 @@
60
60
  * honoured here too, matched against the transcript's project directory, before a file is read.
61
61
  */
62
62
  import { execFileSync, spawn, spawnSync } from "node:child_process";
63
- import { copyFileSync, existsSync, mkdirSync, readFileSync, readdirSync, rmSync, statSync, writeFileSync } from "node:fs";
63
+ import { copyFileSync, existsSync, mkdirSync, readFileSync, readdirSync, rmSync, statSync, writeFileSync, lstatSync, openSync, closeSync, fsyncSync, linkSync, unlinkSync, constants } from "node:fs";
64
64
  import { homedir } from "node:os";
65
65
  import { dirname, join, resolve, sep } from "node:path";
66
66
  import { fileURLToPath } from "node:url";
@@ -698,6 +698,43 @@ const noteReceipt = (answer) => {
698
698
  for (const key of Object.keys(RECEIPTS)) RECEIPTS[key] += Number(receipt[key]) || 0;
699
699
  } catch { /* a receipt unread leaves the counts short, never the send */ }
700
700
  };
701
+ /** Only explicit durable receipts authorize a checkpoint. HTTP 200 alone says nothing. */
702
+ function confirmedReceipt(answer, expectedCount = null) {
703
+ try {
704
+ const candidates = answer.trim().startsWith("{") ? [answer] : answer.split(/\r?\n/).filter(line => line.startsWith("data:")).map(line => line.slice(5).trim()).filter(line => line && line !== "[DONE]");
705
+ const replies = candidates.map(text => JSON.parse(text)).filter(reply => reply?.id === 1);
706
+ if (replies.length !== 1) throw Error();
707
+ const reply = replies[0];
708
+ if (reply.jsonrpc !== "2.0" || reply.error || !reply.result || reply.result.isError === true) throw Error();
709
+ const content = reply.result.content;
710
+ if (!Array.isArray(content) || content.length !== 1 || content[0].type !== "text") throw Error();
711
+ const receipt = JSON.parse(content[0].text);
712
+ if (expectedCount === null) {
713
+ if (!(receipt.receipt === "received" && ["accepted", "flagged", "pending"].includes(receipt.status)) && !(receipt.receipt === "unchanged" && receipt.reason === "duplicate")) throw Error();
714
+ } else if (receipt.receipt !== "received" || receipt.received !== expectedCount || receipt.refused !== 0
715
+ || !Number.isInteger(receipt.new) || receipt.new < 0 || !Number.isInteger(receipt.alreadyHeld) || receipt.alreadyHeld < 0
716
+ || receipt.new + receipt.alreadyHeld !== expectedCount) throw Error();
717
+ return receipt;
718
+ } catch { throw Error("WorkTrust did not confirm every line; progress was not advanced. Retained metadata and safe retries remain available."); }
719
+ }
720
+ /** A private metadata journal survives retries, an edited transcript and a later CLI update. */
721
+ function retainMeasurement(payload, source) {
722
+ const fields = ["stretch_ref", "at", "started_at", "timeline", "seconds", "client_seconds", "model_seconds", "tool_seconds", "human_seconds", "idle_seconds", "tokens_in", "tokens_out", "tokens_cache_read", "tokens_cache_write", "exchanges", "interrupts", "steers", "agent_runs", "agent_seconds", "agent_peak", "duration_basis", "token_basis", "turn_basis", "cli_version", "cli_digest"];
723
+ const metadata = Object.fromEntries(fields.filter(key => Object.hasOwn(payload, key)).map(key => [key, payload[key]]));
724
+ const body = JSON.stringify({ format: "worktrust-measurement/1", source: source ?? "claude", metadata }) + "\n";
725
+ const parent = join(homedir(), ".worktrust"), dir = join(parent, "measurements");
726
+ for (const path of [parent, dir]) { mkdirSync(path, { recursive: true, mode: 0o700 }); const st = lstatSync(path); if (!st.isDirectory() || st.isSymbolicLink()) throw Error("WorkTrust metadata directory is not a private directory"); }
727
+ const file = join(dir, createHash("sha256").update(body).digest("hex") + ".json");
728
+ if (existsSync(file)) { const st = lstatSync(file); if (!st.isFile() || st.isSymbolicLink() || readFileSync(file, "utf8") !== body) throw Error("WorkTrust retained metadata did not match its digest"); return; }
729
+ const temporary = join(dir, ".pending-" + randomBytes(18).toString("hex"));
730
+ const fd = openSync(temporary, constants.O_WRONLY | constants.O_CREAT | constants.O_EXCL | (constants.O_NOFOLLOW ?? 0), 0o600);
731
+ try {
732
+ writeFileSync(fd, body); fsyncSync(fd);
733
+ try { linkSync(temporary, file); } catch (error) {
734
+ if (error.code !== "EEXIST" || lstatSync(file).isSymbolicLink() || readFileSync(file, "utf8") !== body) throw error;
735
+ }
736
+ } finally { closeSync(fd); unlinkSync(temporary); }
737
+ }
701
738
  async function sendHistory(door, entries, announce = false, rebuild = false, named = false, { byDay = false, withdrawUnknown = false } = {}) {
702
739
  let accepted = 0;
703
740
  // A Codex entry goes through Codex's own coupling where one exists (see codexDoor), the rest
@@ -714,11 +751,13 @@ async function sendHistory(door, entries, announce = false, rebuild = false, nam
714
751
  // tells the door to replace this computer's earlier lines on the days and for the client the batch carries, and every group names its client.
715
752
  // WITHDRAW UNKNOWN (owner, 2026-10-10): with an export, after the person's yes, `withdraw_unknown: true` also withdraws the AI-app lines on its days.
716
753
  const body = JSON.stringify({ jsonrpc: "2.0", id: 1, method: "tools/call", params: { name: "import_history", arguments: { ...(rebuild ? { rebuild: true } : {}), ...(withdrawUnknown ? { withdraw_unknown: true } : {}), entries: batch.map((entry) => { const { commits, ...rest } = entry; void commits; return rest; }) } } });
754
+ for (const entry of batch) retainMeasurement(entry, source);
717
755
  // `named` (0.10.10): a copied folder's lines name their client too, so the record says which app the copy came from.
718
756
  const response = await fetch(target.url, { method: "POST", headers: { "content-type": "application/json", accept: "application/json, text/event-stream", authorization: `Bearer ${target.token}`, ...clientOf(source, rebuild || named), ...proofFor(target.url, body) }, body });
719
757
  const text = await response.text();
720
758
  if (announce) console.log(`batch ${number}: ${response.status} ${text.slice(0, 200).replace(/\\n/g, " ")}`);
721
759
  if (!response.ok) break;
760
+ try { confirmedReceipt(text, batch.length); } catch { break; }
722
761
  accepted += batch.length;
723
762
  noteReceipt(text);
724
763
  }
@@ -756,10 +795,13 @@ const proofFor = (url, body) => {
756
795
  const clientOf = (source, always = false) => (always || source === "antigravity" || DATABASE_CLIENTS.includes(source) || EXPORT_CLIENTS.includes(source) ? { "user-agent": `${source ?? "claude"}/hook (worktrust-hook)` } : {});
757
796
 
758
797
  async function send(door, payload) {
798
+ retainMeasurement(payload, entrySource.get(payload));
759
799
  const body = JSON.stringify({ jsonrpc: "2.0", id: 1, method: "tools/call", params: { name: "log_work", arguments: payload } });
760
800
  const response = await fetch(door.url, { method: "POST", headers: { "content-type": "application/json", accept: "application/json, text/event-stream", authorization: `Bearer ${door.token}`, ...clientOf(entrySource.get(payload)), ...proofFor(door.url, body) }, body });
761
801
  if (!response.ok) throw new Error(`door said ${response.status}`);
762
- return response.text();
802
+ const text = await response.text();
803
+ confirmedReceipt(text);
804
+ return text;
763
805
  }
764
806
 
765
807
  /**
@@ -1181,7 +1223,7 @@ if (flag("history") && flag("from-archive")) {
1181
1223
  return entry;
1182
1224
  });
1183
1225
  const signedCount = all.filter(({ signed }) => signed).length;
1184
- say(`${all.length} stretches in the archive · ${signedCount} signed by this computer's key (verified) · ${all.length - signedCount} unsigned or signed by another key (reconstructed) · ${entries.length} of them no longer in any AI app here`);
1226
+ say(`${all.length} stretches in the archive · ${signedCount} signed by this computer's key (signature checked) · ${all.length - signedCount} unsigned or signed by another key (reconstructed) · ${entries.length} of them no longer in any AI app here`);
1185
1227
  if (DRY || entries.length === 0) { if (entries[0]) say(`\nthe oldest of them, in full:\n${JSON.stringify(entries[0], null, 1)}`); say(entries.length === 0 ? "Nothing to send." : "\ndry run — nothing sent."); return await exitFlushed(0); }
1186
1228
  if (!(await doorKnowsArchive(door))) { say("WorkTrust does not accept history from an archive yet (the door does not know the mark). Nothing was sent."); return await exitFlushed(1); }
1187
1229
  return await exitFlushed((await sendHistory(door, entries, true)) === entries.length ? 0 : 1);
@@ -0,0 +1,82 @@
1
+ /** Official launcher verification. Pinned keys are generated from reviewed release configuration. */
2
+ import { createHash, createPublicKey, verify, randomBytes } from 'node:crypto';
3
+ import { existsSync, lstatSync, readFileSync, readdirSync, mkdirSync, writeFileSync, renameSync, rmSync } from 'node:fs';
4
+ import { join, dirname } from 'node:path';
5
+
6
+ export const RELEASE_KEYS = {"608168ccdef72562fc91f9c0f9f2c2d6876bece7f7362cb545b818f7947da6b5":"-----BEGIN PUBLIC KEY-----\nMCowBQYDK2VwAyEAxe/h8yLe+e4iKYSx/2lzS7MgHIgzM+mi1XjofW1VKo4=\n-----END PUBLIC KEY-----\n"}; // GENERATED_RELEASE_KEYS
7
+ const hash = bytes => createHash('sha256').update(bytes).digest('hex');
8
+ const canonical = value => {
9
+ if (value === null || typeof value === 'boolean' || typeof value === 'string') return JSON.stringify(value);
10
+ if (typeof value === 'number' && Number.isSafeInteger(value)) return String(value);
11
+ if (Array.isArray(value)) return `[${value.map(canonical).join(',')}]`;
12
+ if (value && Object.getPrototypeOf(value) === Object.prototype) return `{${Object.keys(value).sort().map(k => `${JSON.stringify(k)}:${canonical(value[k])}`).join(',')}}`;
13
+ throw Error('PACKAGE_INVALID_MANIFEST');
14
+ };
15
+ const exact = (value, keys) => value && Object.keys(value).sort().join(',') === keys.sort().join(',');
16
+ const safe = name => {
17
+ if (typeof name !== 'string' || name.length > 240) return false;
18
+ const parts = name.split('/');
19
+ return parts.every((p, i) => (/^[A-Za-z0-9][A-Za-z0-9._-]*$/.test(p) && p !== '..')
20
+ || (p === '.claude-plugin' && i > 0 && i < parts.length - 1 && parts[i - 1] === 'agent'));
21
+ };
22
+ function regular(path) {
23
+ const s = lstatSync(path);
24
+ if (s.isSymbolicLink() || !s.isFile()) throw Error('PACKAGE_NON_REGULAR_FILE');
25
+ return s;
26
+ }
27
+ function filesIn(root, prefix = '') {
28
+ const s = lstatSync(root);
29
+ if (s.isSymbolicLink() || !s.isDirectory()) throw Error('PACKAGE_NON_REGULAR_DIRECTORY');
30
+ return readdirSync(root).flatMap(name => {
31
+ const path = join(root, name), stat = lstatSync(path);
32
+ if (stat.isSymbolicLink()) throw Error('PACKAGE_NON_REGULAR_FILE');
33
+ return stat.isDirectory() ? filesIn(path, prefix + name + '/') : [prefix + name];
34
+ });
35
+ }
36
+ export function verifyPackage(root, kind = 'npm') {
37
+ const signatureName = kind === 'engine' ? 'engine-release.json' : 'package-release.json';
38
+ const path = join(root, signatureName);
39
+ if (regular(path).size > 1024 * 1024) throw Error('PACKAGE_MANIFEST_TOO_LARGE');
40
+ const signed = JSON.parse(readFileSync(path, 'utf8'));
41
+ if (!exact(signed, ['keyId', 'payload', 'signature']) || !Object.hasOwn(RELEASE_KEYS, signed.keyId) || !/^[A-Za-z0-9_-]{86}$/.test(signed.signature)) throw Error('PACKAGE_UNTRUSTED_SIGNATURE');
42
+ const pem = RELEASE_KEYS[signed.keyId], key = createPublicKey(pem);
43
+ if (key.asymmetricKeyType !== 'ed25519' || hash(key.export({ format: 'der', type: 'spki' })) !== signed.keyId
44
+ || !verify(null, Buffer.from('worktrust:package:1\n' + canonical(signed.payload)), key, Buffer.from(signed.signature, 'base64url'))) throw Error('PACKAGE_UNTRUSTED_SIGNATURE');
45
+ const m = signed.payload;
46
+ if (!exact(m, ['format', 'kind', 'version', 'files']) || m.format !== 'worktrust-package/1' || m.kind !== kind || !/^\d+\.\d+\.\d+$/.test(m.version)
47
+ || !m.files || Array.isArray(m.files) || typeof m.files !== 'object' || Object.keys(m.files).length > 2000 || !Object.hasOwn(m.files, 'worktrust.mjs')) throw Error('PACKAGE_INVALID_MANIFEST');
48
+ const expected = Object.keys(m.files).sort();
49
+ for (const name of expected) {
50
+ if (!safe(name) || name === signatureName || !/^[a-f0-9]{64}$/.test(m.files[name])) throw Error('PACKAGE_INVALID_MANIFEST');
51
+ let parent = root;
52
+ for (const part of name.split('/').slice(0, -1)) { parent = join(parent, part); const s = lstatSync(parent); if (s.isSymbolicLink() || !s.isDirectory()) throw Error('PACKAGE_NON_REGULAR_DIRECTORY'); }
53
+ const file = join(root, name);
54
+ if (regular(file).size > 128 * 1024 * 1024 || hash(readFileSync(file)) !== m.files[name]) throw Error('PACKAGE_FILE_CHANGED');
55
+ }
56
+ const found = filesIn(root).filter(name => name !== signatureName && (kind !== 'engine' || name.endsWith('.mjs'))).sort();
57
+ if (JSON.stringify(found) !== JSON.stringify(expected)) throw Error('PACKAGE_FILE_LIST_CHANGED');
58
+ if (/const CLI_VERSION = "([^"]+)";/.exec(readFileSync(join(root, 'worktrust.mjs'), 'utf8'))?.[1] !== m.version) throw Error('PACKAGE_VERSION_MISMATCH');
59
+ return { manifest: m, identity: hash(readFileSync(path)), signatureName };
60
+ }
61
+ export function installSignedPackage(source, home) {
62
+ const checked = verifyPackage(source), store = join(home, 'verified');
63
+ if (!existsSync(home)) mkdirSync(home, { mode: 0o700 });
64
+ const owned = lstatSync(home);
65
+ if (owned.isSymbolicLink() || !owned.isDirectory()) throw Error('PACKAGE_NON_REGULAR_DIRECTORY');
66
+ if (!existsSync(store)) mkdirSync(store, { mode: 0o700 });
67
+ const stored = lstatSync(store);
68
+ if (stored.isSymbolicLink() || !stored.isDirectory()) throw Error('PACKAGE_NON_REGULAR_DIRECTORY');
69
+ const target = join(store, checked.identity);
70
+ if (existsSync(target)) { if (verifyPackage(target).identity !== checked.identity) throw Error('PACKAGE_INSTALLATION_IDENTITY_MISMATCH'); return join(target, 'worktrust-launch.mjs'); }
71
+ const pending = join(store, '.pending-' + randomBytes(16).toString('hex'));
72
+ mkdirSync(pending, { mode: 0o700 });
73
+ try {
74
+ for (const name of [...Object.keys(checked.manifest.files), checked.signatureName]) {
75
+ const path = join(pending, name); mkdirSync(dirname(path), { recursive: true, mode: 0o700 });
76
+ writeFileSync(path, readFileSync(join(source, name)), { flag: 'wx', mode: 0o600 });
77
+ }
78
+ if (verifyPackage(pending).identity !== checked.identity) throw Error('PACKAGE_INSTALLATION_IDENTITY_MISMATCH');
79
+ try { renameSync(pending, target); } catch (error) { if (!existsSync(target)) throw error; if (verifyPackage(target).identity !== checked.identity) throw Error('PACKAGE_INSTALLATION_IDENTITY_MISMATCH'); }
80
+ } finally { rmSync(pending, { recursive: true, force: true }); }
81
+ return join(target, 'worktrust-launch.mjs');
82
+ }
@@ -0,0 +1 @@
1
+ {"keyId":"608168ccdef72562fc91f9c0f9f2c2d6876bece7f7362cb545b818f7947da6b5","payload":{"files":{"AGENTS.md":"d1db152d88338df23b5900beed6a69bedc2900b6f53fef3f036b46dd7a07b841","CLAUDE.md":"5933504f93e5a40369a4790e96dd5dad791d849d3178b1833eb64088e456aaeb","LICENSE":"3096ed1693974a90e1f4f59bf01c9559d94a7941d933e36fb81d3995a97f25c1","README.md":"560104ad89115bb9392a39ba31431546296605e23ba7134aebb65e398b54741d","SECURITY.md":"e3ed1927cbceef97b38ca630aadd0a91a0df02368f822f4fd66e3ed0b6a07e8d","chat-exports.mjs":"04eafe333940ec03d5058d8d51062124aa12ab882bf04db03bcda5613ec69298","claude-mod.mjs":"02d86b0cdddf39879efc5194c0a5be6b41456faedec28963dc123a4e88dc3942","config-edits.mjs":"0eba2f176ef6f7afba071d6e00de0ff19ba2b283180a801dfd957aa38c1edd94","count-behaviour.mjs":"1beaec2a4d0aead76d166f89cc52441a9cf48f2e69da9888ca2091dd3a10a37b","engine-release.json":"1b8113feffe4a6c8c513f885c2a507eac002c661a79526734ac054453a6466a2","log-session.mjs":"b99f082a58f0a92375026f52b62eb72173f06614b844e3def06b3ed40942b103","orchestration-contract.mjs":"ec08f303a166365b99e70b675de4cfe76c6156c2567e14b5569f6d992f0231b7","orchestration-evidence.mjs":"d0d06cecf0eb08e5c6e653c62a4f45b1eddf2119c2acb8341056b34f488d214a","orchestration-report.mjs":"d4e0a9ad8e4a01b462d22c6b1866aac291565c533ff476085d3367cb6d59bc1b","package-integrity.mjs":"b9d81dc88cf5c19ccfbf334a7af84a0c4e299a0e9e4d4091132253e22f855dc3","package.json":"29ed1c5bfa3075d6970b94a7b922d85dfdcce7a4e3afc6808d340ae421a3aa0d","preserve-lines.mjs":"18081b745b8c47838448b0a49a129a363e29d3f2f5207bc591187d860157b456","preserve-summary.mjs":"137f781ed7021596a3f0ea67afcf2ab8616ac293f833dbb8f176e838e0ed8321","preserve.mjs":"38f83bd933853a986fef61f4e452c27d4a3adc6000f5c9201ef70f270b404eac","runtime-install.mjs":"b9d2e4febbf400a679eeb3a14b74eef6c2062c5b626d45872a193b7502d3201c","session-databases.mjs":"543fd3b82d28d96d789be0a1dc9186c5fafa783e98b87e5b3b17b211542e2b4d","setup-mcp.mjs":"70f63b61cf1e28fb2b7471e7768d596b0cf166ccdc9d1ce859ee58d29b2ecabc","stack-rules.mjs":"b23c56e72ec56ba02b17ed895f869172d988c468a697e8d6026b0e268f61e489","stretch-evidence.mjs":"5b31a6f29b785d277e92257532f3c7cee366a79759decc7a75cfbaec2686ee13","transcript-readers.mjs":"413948644a74dc0bf1b49548be193bf596bcf82ac7eae668f624345a18e189e7","worktrust-launch.mjs":"f28f699f986c72d99af8a7542d317f6dbb9e26d114f6ad083013567e08b8a650","worktrust.mjs":"b563a702634b41c064fdd0b6ad842c77ff851dfcf682b370c677114f8f75c061"},"format":"worktrust-package/1","kind":"npm","version":"0.10.23"},"signature":"WESSe1_j0LegjJCE5a8xKYLoeKmDic5pLIK8bUpCSV2yqnU7P4UIfOosoux_buhU6-khECj2I_rNUTz4YQsbCw"}
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "worktrust",
3
- "version": "0.10.20",
3
+ "version": "0.10.23",
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": {
7
- "worktrust": "worktrust.mjs"
7
+ "worktrust": "worktrust-launch.mjs"
8
8
  },
9
9
  "files": [
10
10
  "worktrust.mjs",
@@ -29,7 +29,11 @@
29
29
  "orchestration-contract.mjs",
30
30
  "orchestration-evidence.mjs",
31
31
  "orchestration-report.mjs",
32
- "claude-mod.mjs"
32
+ "claude-mod.mjs",
33
+ "package-integrity.mjs",
34
+ "worktrust-launch.mjs",
35
+ "engine-release.json",
36
+ "package-release.json"
33
37
  ],
34
38
  "engines": {
35
39
  "node": ">=18"
@@ -30,6 +30,7 @@ export function installRuntime(runtime, engine, home, moduleNames) {
30
30
  if (!/^[a-z][a-z0-9-]*\.mjs$/.test(name)) throw Error("invalid engine module name");
31
31
  contents.set(`engine/${name}`, checkedBytes(join(engine, name)));
32
32
  }
33
+ if (existsSync(join(engine, "engine-release.json"))) contents.set("engine/engine-release.json", checkedBytes(join(engine, "engine-release.json")));
33
34
  const identities = Object.fromEntries([...contents].map(([name, bytes]) => [name, hash(bytes)]));
34
35
  const identity = Buffer.from(JSON.stringify(identities));
35
36
  const installations = join(home, "installations"), installed = join(installations, hash(identity));
@@ -60,5 +61,5 @@ export function installRuntime(runtime, engine, home, moduleNames) {
60
61
  } finally { rmSync(temporary, { recursive: true, force: true }); }
61
62
  }
62
63
  // Existing immutable directories are never replaced, including executables used by Windows processes.
63
- return { executable: join(installed, "runtime", executable), bridge: join(installed, "engine", "worktrust.mjs") };
64
+ return { executable: join(installed, "runtime", executable), bridge: join(installed, "engine", contents.has("engine/engine-release.json") ? "worktrust-launch.mjs" : "worktrust.mjs") };
64
65
  }
@@ -0,0 +1,96 @@
1
+ #!/usr/bin/env node
2
+ // GENERATED by scripts/build-cli-launchers.mjs; verify before importing any local module.
3
+ /** Official launcher verification. Pinned keys are generated from reviewed release configuration. */
4
+ import { createHash, createPublicKey, verify, randomBytes } from 'node:crypto';
5
+ import { existsSync, lstatSync, readFileSync, readdirSync, mkdirSync, writeFileSync, renameSync, rmSync } from 'node:fs';
6
+ import { join, dirname } from 'node:path';
7
+
8
+ const RELEASE_KEYS = {"608168ccdef72562fc91f9c0f9f2c2d6876bece7f7362cb545b818f7947da6b5":"-----BEGIN PUBLIC KEY-----\nMCowBQYDK2VwAyEAxe/h8yLe+e4iKYSx/2lzS7MgHIgzM+mi1XjofW1VKo4=\n-----END PUBLIC KEY-----\n"}; // GENERATED_RELEASE_KEYS
9
+ const hash = bytes => createHash('sha256').update(bytes).digest('hex');
10
+ const canonical = value => {
11
+ if (value === null || typeof value === 'boolean' || typeof value === 'string') return JSON.stringify(value);
12
+ if (typeof value === 'number' && Number.isSafeInteger(value)) return String(value);
13
+ if (Array.isArray(value)) return `[${value.map(canonical).join(',')}]`;
14
+ if (value && Object.getPrototypeOf(value) === Object.prototype) return `{${Object.keys(value).sort().map(k => `${JSON.stringify(k)}:${canonical(value[k])}`).join(',')}}`;
15
+ throw Error('PACKAGE_INVALID_MANIFEST');
16
+ };
17
+ const exact = (value, keys) => value && Object.keys(value).sort().join(',') === keys.sort().join(',');
18
+ const safe = name => {
19
+ if (typeof name !== 'string' || name.length > 240) return false;
20
+ const parts = name.split('/');
21
+ return parts.every((p, i) => (/^[A-Za-z0-9][A-Za-z0-9._-]*$/.test(p) && p !== '..')
22
+ || (p === '.claude-plugin' && i > 0 && i < parts.length - 1 && parts[i - 1] === 'agent'));
23
+ };
24
+ function regular(path) {
25
+ const s = lstatSync(path);
26
+ if (s.isSymbolicLink() || !s.isFile()) throw Error('PACKAGE_NON_REGULAR_FILE');
27
+ return s;
28
+ }
29
+ function filesIn(root, prefix = '') {
30
+ const s = lstatSync(root);
31
+ if (s.isSymbolicLink() || !s.isDirectory()) throw Error('PACKAGE_NON_REGULAR_DIRECTORY');
32
+ return readdirSync(root).flatMap(name => {
33
+ const path = join(root, name), stat = lstatSync(path);
34
+ if (stat.isSymbolicLink()) throw Error('PACKAGE_NON_REGULAR_FILE');
35
+ return stat.isDirectory() ? filesIn(path, prefix + name + '/') : [prefix + name];
36
+ });
37
+ }
38
+ function verifyPackage(root, kind = 'npm') {
39
+ const signatureName = kind === 'engine' ? 'engine-release.json' : 'package-release.json';
40
+ const path = join(root, signatureName);
41
+ if (regular(path).size > 1024 * 1024) throw Error('PACKAGE_MANIFEST_TOO_LARGE');
42
+ const signed = JSON.parse(readFileSync(path, 'utf8'));
43
+ if (!exact(signed, ['keyId', 'payload', 'signature']) || !Object.hasOwn(RELEASE_KEYS, signed.keyId) || !/^[A-Za-z0-9_-]{86}$/.test(signed.signature)) throw Error('PACKAGE_UNTRUSTED_SIGNATURE');
44
+ const pem = RELEASE_KEYS[signed.keyId], key = createPublicKey(pem);
45
+ if (key.asymmetricKeyType !== 'ed25519' || hash(key.export({ format: 'der', type: 'spki' })) !== signed.keyId
46
+ || !verify(null, Buffer.from('worktrust:package:1\n' + canonical(signed.payload)), key, Buffer.from(signed.signature, 'base64url'))) throw Error('PACKAGE_UNTRUSTED_SIGNATURE');
47
+ const m = signed.payload;
48
+ if (!exact(m, ['format', 'kind', 'version', 'files']) || m.format !== 'worktrust-package/1' || m.kind !== kind || !/^\d+\.\d+\.\d+$/.test(m.version)
49
+ || !m.files || Array.isArray(m.files) || typeof m.files !== 'object' || Object.keys(m.files).length > 2000 || !Object.hasOwn(m.files, 'worktrust.mjs')) throw Error('PACKAGE_INVALID_MANIFEST');
50
+ const expected = Object.keys(m.files).sort();
51
+ for (const name of expected) {
52
+ if (!safe(name) || name === signatureName || !/^[a-f0-9]{64}$/.test(m.files[name])) throw Error('PACKAGE_INVALID_MANIFEST');
53
+ let parent = root;
54
+ for (const part of name.split('/').slice(0, -1)) { parent = join(parent, part); const s = lstatSync(parent); if (s.isSymbolicLink() || !s.isDirectory()) throw Error('PACKAGE_NON_REGULAR_DIRECTORY'); }
55
+ const file = join(root, name);
56
+ if (regular(file).size > 128 * 1024 * 1024 || hash(readFileSync(file)) !== m.files[name]) throw Error('PACKAGE_FILE_CHANGED');
57
+ }
58
+ const found = filesIn(root).filter(name => name !== signatureName && (kind !== 'engine' || name.endsWith('.mjs'))).sort();
59
+ if (JSON.stringify(found) !== JSON.stringify(expected)) throw Error('PACKAGE_FILE_LIST_CHANGED');
60
+ if (/const CLI_VERSION = "([^"]+)";/.exec(readFileSync(join(root, 'worktrust.mjs'), 'utf8'))?.[1] !== m.version) throw Error('PACKAGE_VERSION_MISMATCH');
61
+ return { manifest: m, identity: hash(readFileSync(path)), signatureName };
62
+ }
63
+ function installSignedPackage(source, home) {
64
+ const checked = verifyPackage(source), store = join(home, 'verified');
65
+ if (!existsSync(home)) mkdirSync(home, { mode: 0o700 });
66
+ const owned = lstatSync(home);
67
+ if (owned.isSymbolicLink() || !owned.isDirectory()) throw Error('PACKAGE_NON_REGULAR_DIRECTORY');
68
+ if (!existsSync(store)) mkdirSync(store, { mode: 0o700 });
69
+ const stored = lstatSync(store);
70
+ if (stored.isSymbolicLink() || !stored.isDirectory()) throw Error('PACKAGE_NON_REGULAR_DIRECTORY');
71
+ const target = join(store, checked.identity);
72
+ if (existsSync(target)) { if (verifyPackage(target).identity !== checked.identity) throw Error('PACKAGE_INSTALLATION_IDENTITY_MISMATCH'); return join(target, 'worktrust-launch.mjs'); }
73
+ const pending = join(store, '.pending-' + randomBytes(16).toString('hex'));
74
+ mkdirSync(pending, { mode: 0o700 });
75
+ try {
76
+ for (const name of [...Object.keys(checked.manifest.files), checked.signatureName]) {
77
+ const path = join(pending, name); mkdirSync(dirname(path), { recursive: true, mode: 0o700 });
78
+ writeFileSync(path, readFileSync(join(source, name)), { flag: 'wx', mode: 0o600 });
79
+ }
80
+ if (verifyPackage(pending).identity !== checked.identity) throw Error('PACKAGE_INSTALLATION_IDENTITY_MISMATCH');
81
+ try { renameSync(pending, target); } catch (error) { if (!existsSync(target)) throw error; if (verifyPackage(target).identity !== checked.identity) throw Error('PACKAGE_INSTALLATION_IDENTITY_MISMATCH'); }
82
+ } finally { rmSync(pending, { recursive: true, force: true }); }
83
+ return join(target, 'worktrust-launch.mjs');
84
+ }
85
+
86
+ import { fileURLToPath } from 'node:url';
87
+ const root = dirname(fileURLToPath(import.meta.url));
88
+ try {
89
+ verifyPackage(root, existsSync(join(root, 'package.json')) ? 'npm' : 'engine');
90
+ process.argv[1] = join(root, 'worktrust.mjs');
91
+ await import('./worktrust.mjs');
92
+ } catch (error) {
93
+ const category = /^PACKAGE_[A-Z_]+$/.test(error.message) ? error.message : 'PACKAGE_VERIFICATION_FAILED';
94
+ process.stderr.write(`worktrust: ${category}. Execution stopped; reinstall an official WorkTrust release.\n`);
95
+ process.exitCode = 1;
96
+ }
package/worktrust.mjs CHANGED
@@ -78,12 +78,12 @@ const command = args.includes("--help") ? "help" : args.includes("--version") ?
78
78
  const flag = (name) => { const at = args.indexOf(`--${name}`); return at >= 0 ? args[at + 1] : undefined; };
79
79
  const has = (name) => args.includes(`--${name}`);
80
80
  /** 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). */
81
- const CLI_VERSION = "0.10.20";
81
+ const CLI_VERSION = "0.10.23";
82
82
  const ORIGIN = (flag("origin") ?? process.env.WORKTRUST_ORIGIN ?? "https://app.worktrust.io").replace(/\/$/, "");
83
83
  const MCP = flag("url") ?? process.env.WORKTRUST_MCP_URL ?? `${ORIGIN}/api/mcp`;
84
84
  const HOME_DIR = join(homedir(), ".worktrust");
85
85
  const HERE = dirname(fileURLToPath(import.meta.url));
86
- const SCRIPTS = ["setup-mcp.mjs", "log-session.mjs", "count-behaviour.mjs", "transcript-readers.mjs", "session-databases.mjs", "config-edits.mjs", "stretch-evidence.mjs", "chat-exports.mjs", "stack-rules.mjs", "runtime-install.mjs", "orchestration-contract.mjs", "orchestration-evidence.mjs", "orchestration-report.mjs", "claude-mod.mjs"];
86
+ const SCRIPTS = ["setup-mcp.mjs", "log-session.mjs", "count-behaviour.mjs", "transcript-readers.mjs", "session-databases.mjs", "config-edits.mjs", "stretch-evidence.mjs", "chat-exports.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"];
87
87
  /** The modules the scripts import by name from beside them; a download keeps that name. */
88
88
  const IMPORTED = new Set(["transcript-readers.mjs", "session-databases.mjs", "config-edits.mjs", "stretch-evidence.mjs", "chat-exports.mjs", "stack-rules.mjs", "runtime-install.mjs", "orchestration-contract.mjs", "orchestration-evidence.mjs", "orchestration-report.mjs"]);
89
89
  const downloaded = (name) => (IMPORTED.has(name) ? name : `${name}.download.mjs`);
@@ -128,15 +128,7 @@ async function post(path, body) {
128
128
  /** The three scripts: from the package when it carries them; otherwise from the same site, once, into ~/.worktrust. */
129
129
  async function scripts() {
130
130
  if (BUNDLED) return Object.fromEntries(SCRIPTS.map((name) => [name, join(HERE, name)]));
131
- mkdirSync(HOME_DIR, { recursive: true, mode: 0o700 });
132
- const paths = {};
133
- for (const name of SCRIPTS) {
134
- const response = await fetch(`${ORIGIN}/counter/${name}`);
135
- if (!response.ok) fail(`could not download ${name} (${response.status}).`);
136
- paths[name] = join(HOME_DIR, downloaded(name));
137
- writeFileSync(paths[name], await response.text(), { mode: 0o600 });
138
- }
139
- return paths;
131
+ fail("Use the complete official npm/Python package or preservation kit. Individual scripts are not downloaded or executed without release verification.");
140
132
  }
141
133
 
142
134
  /** Run a script; its output is shown, or collected for the plan. The key travels in the environment only. */
@@ -277,7 +269,14 @@ const ensureHome = () => { mkdirSync(HOME_DIR, { recursive: true, mode: 0o700 })
277
269
 
278
270
  /** A tool-runner cache is disposable. Install the whole verified runtime/engine before changing wiring. */
279
271
  async function prepareBundledRuntime() {
280
- if (!process.env.WORKTRUST_BUNDLED_RUNTIME_DIR || runtimePrepared) return;
272
+ if (runtimePrepared) return;
273
+ if (!process.env.WORKTRUST_BUNDLED_RUNTIME_DIR) {
274
+ if (existsSync(join(HERE, "package-release.json"))) {
275
+ if (existsSync(HOME_DIR) && (!lstatSync(HOME_DIR).isDirectory() || lstatSync(HOME_DIR).isSymbolicLink())) fail("the WorkTrust directory must be a directory, not a symlink.");
276
+ ensureHome(); const { installSignedPackage } = await import("./package-integrity.mjs"); STABLE = installSignedPackage(HERE, HOME_DIR); runtimePrepared = true;
277
+ }
278
+ return;
279
+ }
281
280
  const { installRuntime } = await import("./runtime-install.mjs");
282
281
  if (existsSync(HOME_DIR) && (!lstatSync(HOME_DIR).isDirectory() || lstatSync(HOME_DIR).isSymbolicLink())) fail("the WorkTrust directory must be a directory, not a symlink.");
283
282
  ensureHome();
@@ -683,6 +682,8 @@ async function offerHistory(paths, token, devicePem, url = MCP, rebuild = false)
683
682
  if (rebuild) {
684
683
  for (const row of found.clients ?? []) say(` ${row.client.padEnd(12)} ${String(row.days).padStart(4)} days ${row.first} … ${row.last}`);
685
684
  say(" Re-measured with the current rules (what the seconds were, your own turns, tokens with the cache, every AI app above).");
685
+ say(" Changed measured history is held for review; earlier measurements remain in your record.");
686
+ say(" For older unmeasured history only:");
686
687
  say(" WorkTrust REPLACES this computer's earlier lines for those days and apps: each earlier line is withdrawn and kept,");
687
688
  say(" never deleted, so a day is counted once. Other computers, web sources and days not listed are not touched.");
688
689
  }
@@ -1191,15 +1192,10 @@ if (agentShell && PERSON_ONLY.has(command)) {
1191
1192
  return (process.exitCode = 3);
1192
1193
  }
1193
1194
 
1194
- /**
1195
- * ALWAYS THE NEWEST, WHATEVER WAS TYPED (0.10.7, owner: "npx worktrust should simply be right"). npx runs whatever version
1196
- * it cached, and a person should never need `@latest` or `--prefer-online`. A command a PERSON runs in a terminal asks npm
1197
- * which version is newest (the version string only, nothing of this computer, two seconds at most) and, when this one is
1198
- * older, hands the same command to the newest through npx and steps aside. Offline, npm slow, no terminal (a script, a
1199
- * test), an AI agent's shell: this version runs as it is. The bridge and the hook, which run many times a day from the
1200
- * stable copy, never ask.
1195
+ /** Interactive version notice only. Registry metadata is not a trusted signed release catalogue.
1196
+ * Hooks, bridge and offline preserve never check. Installation remains with the person's package manager
1197
+ * until the signed release updater has a provisioned trust root and has passed the distribution gates.
1201
1198
  */
1202
- // NOT `preserve` (0.10.8): it promises no network connection at all (the site and its kit say so), so it never asks npm.
1203
1199
  const RELAY_COMMANDS = new Set(["default", "connect", "update", "history", "status", "disconnect", "codex", "antigravity"]);
1204
1200
  const semverNewer = (a, b) => { const x = a.split(".").map(Number), y = b.split(".").map(Number); for (let i = 0; i < 3; i += 1) if (x[i] !== y[i]) return x[i] > y[i]; return false; };
1205
1201
  async function newestVersion() {
@@ -1214,15 +1210,8 @@ async function relayToNewest() {
1214
1210
  if (process.env.WORKTRUST_RELAYED === "1" || !RELAY_COMMANDS.has(command) || !process.stdin.isTTY || !process.stdout.isTTY) return;
1215
1211
  const latest = await newestVersion();
1216
1212
  if (!latest || !semverNewer(latest, CLI_VERSION)) return;
1217
- say(` worktrust ${CLI_VERSION} is not the newest: running ${latest} instead.`);
1218
- const argv = ["--yes", `worktrust@${latest}`, ...args];
1219
- const env = { ...process.env, WORKTRUST_RELAYED: "1" };
1220
- // A .cmd shim on Windows needs a shell: one line, each argument quoted for cmd.exe, never an argument list beside it.
1221
- const quote = (arg) => (/^[\w@%+=:,./\\-]+$/.test(arg) ? arg : `"${String(arg).replace(/"/g, '\\"')}"`);
1222
- const child = platform() === "win32" ? spawn(["npx", ...argv].map(quote).join(" "), { stdio: "inherit", env, shell: true }) : spawn("npx", argv, { stdio: "inherit", env });
1223
- const code = await new Promise((done) => { child.on("error", () => done(null)); child.on("close", (exit) => done(exit)); });
1224
- if (code === null) { say(" The newest could not be started; this version runs instead."); return; }
1225
- process.exitCode = code; return true;
1213
+ say(` WorkTrust ${latest} is available. Automatic execution is paused until signed release verification is configured.`);
1214
+ say(" Update explicitly using the package manager you installed with. This invocation keeps its current version.");
1226
1215
  }
1227
1216
  if (await relayToNewest()) return;
1228
1217