worktrust 0.6.17 → 0.6.18

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
@@ -145,8 +145,10 @@ nothing it does not:
145
145
  | `day`, `started_at`, `ended_at` | the day, and when the measured stretch began and ended |
146
146
  | `seconds` | measured time: every gap between stamped events up to five minutes |
147
147
  | `model_seconds`, `tool_seconds`, `human_seconds`, `idle_seconds` | what those seconds were: the model answering, tools or an agent run, your own turns, and what a cap cut off |
148
- | `tokens_in`, `tokens_out`, `tokens_cache_read`, `tokens_cache_write` | token counts, when the app records them |
148
+ | `tokens_in`, `tokens_out`, `tokens_cache_read`, `tokens_cache_write` | token counts, when the app records them (one answer counted once, however many lines the app wrote it in) |
149
149
  | `agent_runs`, `agent_seconds`, `agent_peak` | subagents: how many ran, their own time, the most open at once (never added to `seconds`) |
150
+ | `interrupts`, `steers` | how often you stopped the agent mid-answer, and how often your message arrived while it was still mid-task (counts, never the words) |
151
+ | `utc_offset` | your computer's offset from UTC when the stretch began, such as +02:00, so a working day reads in your own local time |
150
152
  | `model` | the model's name as the app reported it |
151
153
  | `kind`, `layer`, `layers` | the kind of work (built, changed, researched) and the area it touched (front end, back end, data …), as the session hook names them |
152
154
  | `exchanges` | how many times you and the model took turns |
@@ -237,7 +239,7 @@ which would delete every password on the computer, and many people rightly keep
237
239
  | **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. |
238
240
  | **Writes** | The key file (above). In each AI app's MCP settings (`~/.claude.json` through `claude mcp`, `~/.cursor/mcp.json`, `~/.codex/config.toml`, `~/.gemini/settings.json`, `~/.gemini/config/mcp_config.json` (Antigravity), VS Code's `mcp.json`, Windsurf's `mcp_config.json`, Hermes's and Goose's `config.yaml`, OpenCode's `opencode.json`, OpenClaw through `openclaw mcp set`) a WorkTrust entry that runs the local bridge, with no key in it; three hooks in `~/.claude/settings.json`; the bridge, the hook and the counter in `~/.worktrust/`. |
239
241
  | **Sends, to pair** | This computer's system (macOS, Windows, Linux) and host name. WorkTrust also records the network address the request arrives from, as a security record kept 90 days and seen only by WorkTrust staff (to answer a theft or fraud report). |
240
- | **Sends, afterwards** | Per measured stretch of work, and nothing else: its durations (`seconds`, `duration_basis`, `model_seconds`, `tool_seconds`, `human_seconds`, `idle_seconds`), token counts (`tokens_in`, `tokens_out`, `tokens_cache_read`, `tokens_cache_write`, `token_basis`), the model's name (`model`), the kind of work and one layer keyword such as frontend or backend (`title`, `kind`, `layer`, `layers`), counts of how you work (`exchanges`, `turn_basis`, `agent_runs`, `agent_seconds`, `agent_peak`), when it ended (`at`), a hash of the session and the day (`stretch_ref`), `steered_from` when it ran over SSH, and, so the work can be matched to GitHub, the repository as its remote's owner/name (`repo`) and the hashes of the commits made in the stretch (`commits`, never their messages). |
242
+ | **Sends, afterwards** | Per measured stretch of work, and nothing else: its durations (`seconds`, `duration_basis`, `model_seconds`, `tool_seconds`, `human_seconds`, `idle_seconds`), token counts (`tokens_in`, `tokens_out`, `tokens_cache_read`, `tokens_cache_write`, `token_basis`), the model's name (`model`), the kind of work and one layer keyword such as frontend or backend (`title`, `kind`, `layer`, `layers`), counts of how you work (`exchanges`, `turn_basis`, `agent_runs`, `agent_seconds`, `agent_peak`, `interrupts`, `steers`), when it began and ended and your computer's offset from UTC (`started_at`, `at`, `utc_offset`), a hash of the session and the day (`stretch_ref`), `steered_from` when it ran over SSH, and, so the work can be matched to GitHub, the repository as its remote's owner/name (`repo`) and the hashes of the commits made in the stretch (`commits`, never their messages). |
241
243
  | **Never sends** | Prompts, answers, code, file names or paths, commit messages, branch names, or the name of your local folder (a repository is named only as its remote's owner/name, above). The door has no field for them and refuses a submission that carries them. |
242
244
 
243
245
  ## Why you can check it
package/log-session.mjs CHANGED
@@ -342,22 +342,45 @@ function stretchesOf(file, since) {
342
342
  }
343
343
  if (messages.length === 0) return [];
344
344
  messages.sort((a, b) => a.at - b.at);
345
+ const byDay = byDayOf(messages);
346
+ const agents = agentsByDay(file, since);
347
+ return [...byDay.entries()].sort(([a], [b]) => a.localeCompare(b)).map(([day, ofDay]) => { const stretch = measure(cwd, ofDay); return stretch && { ...stretch, ref: stretchRef(file, day), steered, agents: agents.get(day) ?? null }; }).filter(Boolean);
348
+ }
349
+
350
+ /**
351
+ * DAYS SPLIT ON THE CLOCK, NOTHING LOST AT MIDNIGHT (0.6.18, audit C14). A stretch is one session's UTC day, and the gap
352
+ * between a day's last message and the next day's first belonged to neither, so a run through the night lost one gap
353
+ * per midnight. A day whose first message follows the last one within the tool cap now opens with a BRIDGE: the message
354
+ * before it, carrying no tokens, no model and no turn, so the gap that crosses midnight is counted once, on the day it
355
+ * ends, under the same caps as any other.
356
+ * Messages must arrive sorted.
357
+ */
358
+ function byDayOf(messages) {
345
359
  const byDay = new Map();
360
+ let prev = null;
346
361
  for (const message of messages) {
347
362
  const day = new Date(message.at).toISOString().slice(0, 10);
348
- if (!byDay.has(day)) byDay.set(day, []);
363
+ // Only a gap the work could have run through (within the tool cap): a session resumed the next morning opens its day as it always did.
364
+ if (!byDay.has(day)) byDay.set(day, prev && message.at - prev.at <= TOOL_CAP * 1000 ? [{ ...prev, usage: null, model: null, cumulative: false, bridge: true }] : []);
349
365
  byDay.get(day).push(message);
366
+ prev = message;
350
367
  }
351
- const agents = agentsByDay(file, since);
352
- return [...byDay.entries()].sort(([a], [b]) => a.localeCompare(b)).map(([day, ofDay]) => { const stretch = measure(cwd, ofDay); return stretch && { ...stretch, ref: stretchRef(file, day), steered, agents: agents.get(day) ?? null }; }).filter(Boolean);
368
+ return byDay;
353
369
  }
370
+ /** The first message a day really holds (a bridge is the day before's). */
371
+ const firstOf = (messages) => (messages.find((message) => !message.bridge) ?? messages[0]).at;
372
+ /** The computer's offset from UTC at a moment, as +02:00: what the owner's mirror needs to read a working day in local time. */
373
+ const offsetAt = (ms) => { const minutes = -new Date(ms).getTimezoneOffset(), abs = Math.abs(minutes); return `${minutes < 0 ? "-" : "+"}${String(Math.floor(abs / 60)).padStart(2, "0")}:${String(abs % 60).padStart(2, "0")}`; };
374
+ /** Claude Code's own line when the person stops the agent mid-answer (Esc), read for its marker only. */
375
+ const INTERRUPTED = /^\[Request interrupted by user/;
376
+ const textOf = (content) => (typeof content === "string" ? content : Array.isArray(content) ? content.map((block) => (block && typeof block.text === "string" ? block.text : "")).join("") : "");
354
377
 
355
378
  /** One transcript line as the measure reads it: the clock, the role, what KIND of message it is (for the layers), its counts. */
356
379
  const messageOf = (line, at) => {
357
380
  const content = line.message?.content ?? null;
358
381
  const blocks = Array.isArray(content) ? content : [];
359
382
  return {
360
- at, type: line.type, usage: line.message?.usage ?? null, model: line.message?.model ?? null, meta: line.isMeta === true, content,
383
+ at, type: line.type, usage: line.message?.usage ?? null, model: line.message?.model ?? null, messageId: typeof line.message?.id === "string" ? line.message.id : null, meta: line.isMeta === true, content,
361
384
  // A tool's answer comes back on the user role; a line a reader marks `agentic` is an agent run (Copilot's asked → completed).
362
385
  kind: line.type === "assistant" ? "assistant" : blocks.some((block) => block && block.type === "tool_result") ? "tool_result" : "user",
363
386
  toolUse: line.type === "assistant" && blocks.some((block) => block && block.type === "tool_use"),
@@ -456,12 +479,22 @@ function measure(cwd, messages) {
456
479
  const models = new Map();
457
480
  let exchanges = 0;
458
481
  for (const message of messages) {
459
- if (message.type === "user" && !message.meta && isHumanTurn(message.content)) exchanges += 1;
482
+ if (message.type === "user" && !message.meta && !message.bridge && isHumanTurn(message.content)) exchanges += 1;
460
483
  if (message.model) models.set(message.model, (models.get(message.model) ?? 0) + 1);
461
484
  }
462
485
  const model = [...models.entries()].sort((a, b) => b[1] - a[1])[0]?.[0] ?? null;
463
486
  const tokens = tokensOf(messages);
464
- return { cwd, seconds: measured, layers: measured !== null ? timeLayers(messages) : null, ...tokens, cumulative: messages.some((message) => message.cumulative), exchanges, model, from: messages[0].at, to: messages[messages.length - 1].at };
487
+ // HOW THE PERSON STEERED (owner, 2026-10-08): how often they stopped the agent (Claude Code's interruption line), and how
488
+ // often their next turn arrived while the agent was still mid-task (right after a tool call or its result). Counts only.
489
+ let interrupts = 0, steers = 0;
490
+ for (let i = 1; i < messages.length; i += 1) {
491
+ const message = messages[i], prev = messages[i - 1];
492
+ if (message.bridge || message.type !== "user" || message.meta || message.kind === "tool_result") continue;
493
+ if (INTERRUPTED.test(textOf(message.content).trim())) interrupts += 1;
494
+ else if (isHumanTurn(message.content) && (prev.kind === "tool_result" || prev.toolUse)) steers += 1;
495
+ }
496
+ const from = firstOf(messages);
497
+ return { cwd, seconds: measured, layers: measured !== null ? timeLayers(messages) : null, ...tokens, cumulative: messages.some((message) => message.cumulative), exchanges, interrupts, steers, model, from, to: messages[messages.length - 1].at, offset: offsetAt(from) };
465
498
  }
466
499
 
467
500
  /**
@@ -508,9 +541,14 @@ function usageShapeKnown(usage) {
508
541
  }
509
542
  function tokensOf(messages) {
510
543
  let tokensIn = 0, tokensOut = 0, cacheRead = 0, cacheWrite = 0, counted = 0, shapeKnown = true;
544
+ // ONE ANSWER, ONE USAGE (0.6.18): Claude Code writes an answer as a line per content block (thinking, text, each tool
545
+ // call), every one repeating the answer's usage; summed per line, a real session read 2.6 times its output tokens. An
546
+ // answer with an id is counted once; a line without one (Codex's token events) is its own.
547
+ const seen = new Set();
511
548
  for (const message of messages) {
512
549
  const usage = message.usage;
513
550
  if (!usage) continue;
551
+ if (message.messageId) { if (seen.has(message.messageId)) continue; seen.add(message.messageId); }
514
552
  if (!usageShapeKnown(usage)) { shapeKnown = false; break; }
515
553
  counted += 1;
516
554
  tokensIn += (usage.input_tokens ?? 0) + (usage.cache_creation_input_tokens ?? 0);
@@ -565,6 +603,10 @@ function payloadFor(stretch) {
565
603
  // THE LAYERS (2026-10-06), only on a measured stretch, each bounded by a day: what the seconds were. `seconds` above is untouched.
566
604
  ...(stretch.seconds !== null && stretch.layers ? { model_seconds: Math.min(DAY_SECONDS, stretch.layers.model), tool_seconds: Math.min(DAY_SECONDS, stretch.layers.tool), human_seconds: Math.min(DAY_SECONDS, stretch.layers.human), idle_seconds: Math.min(DAY_SECONDS, stretch.layers.idle) } : {}),
567
605
  // THE SUBAGENTS, as agent metadata beside the day: runs, their own seconds, the peak open at once. Never in `seconds`.
606
+ // WHEN AND HOW (0.6.18): the stretch's first moment and the computer's UTC offset then; the person's interruptions and mid-task turns, counts only.
607
+ started_at: new Date(stretch.from).toISOString(), utc_offset: stretch.offset,
608
+ ...(stretch.interrupts > 0 ? { interrupts: Math.min(10000, stretch.interrupts) } : {}),
609
+ ...(stretch.steers > 0 ? { steers: Math.min(10000, stretch.steers) } : {}),
568
610
  ...(stretch.agents && stretch.agents.runs > 0 ? { agent_runs: Math.min(AGENT_RUNS_MAX, stretch.agents.runs), agent_seconds: Math.min(AGENT_SECONDS_MAX, stretch.agents.seconds), agent_peak: Math.min(AGENT_RUNS_MAX, stretch.agents.peak) } : {}),
569
611
  at: new Date(stretch.to).toISOString(),
570
612
  };
@@ -643,23 +685,22 @@ function historyEntries(floor = null, all = false) {
643
685
  const lines = parsedLines(file);
644
686
  if (!lines) continue;
645
687
  let cwd = null, steered = null;
646
- const byDay = new Map();
688
+ const read = [];
647
689
  for (const line of lines) {
648
690
  if (typeof line.cwd === "string") cwd = line.cwd;
649
691
  if (typeof line.steered === "string") steered = line.steered;
650
692
  if (!line.timestamp || (line.type !== "user" && line.type !== "assistant")) continue;
651
693
  const at = Date.parse(line.timestamp);
652
694
  if (!Number.isFinite(at)) continue;
653
- const day = new Date(at).toISOString().slice(0, 10);
654
- if (!byDay.has(day)) byDay.set(day, []);
655
- byDay.get(day).push(messageOf(line, at));
695
+ read.push(messageOf(line, at));
656
696
  }
697
+ read.sort((a, b) => a.at - b.at);
698
+ const byDay = byDayOf(read);
657
699
  const agents = agentsByDay(file, null);
658
700
  for (const [day, messages] of byDay) {
659
701
  if (messages.length === 0) continue;
660
- messages.sort((a, b) => a.at - b.at);
661
702
  // Under-reporting is the safe side (THE FLOORS): a day that began before the account changed is not offered at all.
662
- if (floor !== null && messages[0].at < floor) continue;
703
+ if (floor !== null && firstOf(messages) < floor) continue;
663
704
  const last = messages[messages.length - 1].at;
664
705
  // The live window belongs to the hook: a stretch that log_work may still report is not history.
665
706
  if (!all && Date.now() - last < WINDOW_HOURS * 3600_000) continue;
@@ -668,7 +709,7 @@ function historyEntries(floor = null, all = false) {
668
709
  if (CODEX_ROLLOUT.test(file)) entrySource.set(entry, "codex");
669
710
  if (ANTIGRAVITY_TRANSCRIPT.test(file)) entrySource.set(entry, "antigravity");
670
711
  if (DATABASE_SESSION.test(file)) entrySource.set(entry, file.slice(0, file.indexOf(":")));
671
- entryFile.set(entry, { file, from: messages[0].at, folder: cwd ? String(cwd).split(/[\\/]/).filter(Boolean).pop() ?? null : null });
712
+ entryFile.set(entry, { file, from: firstOf(messages), folder: cwd ? String(cwd).split(/[\\/]/).filter(Boolean).pop() ?? null : null });
672
713
  entries.push(entry);
673
714
  }
674
715
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "worktrust",
3
- "version": "0.6.17",
3
+ "version": "0.6.18",
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": {
package/preserve.mjs CHANGED
@@ -168,7 +168,7 @@ async function apply(list, agreed = false) {
168
168
  }
169
169
 
170
170
  /** THE ALLOWLIST: what a line may carry, each value checked for its type. A key not named here never reaches the archive. */
171
- const COUNTS = ["seconds", "tokens_in", "tokens_out", "tokens_cache_read", "tokens_cache_write", "model_seconds", "tool_seconds", "human_seconds", "idle_seconds", "agent_runs", "agent_seconds", "agent_peak"];
171
+ const COUNTS = ["seconds", "tokens_in", "tokens_out", "tokens_cache_read", "tokens_cache_write", "model_seconds", "tool_seconds", "human_seconds", "idle_seconds", "agent_runs", "agent_seconds", "agent_peak", "interrupts", "steers"];
172
172
  const ISO = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d{1,3})?Z$/;
173
173
  /** The hook's own words for a stretch (work area, kind, how it was steered, the measuring bases), kept as the hook sends them. */
174
174
  const WORDS = ["layer", "kind", "steered_from", "duration_basis", "token_basis", "turn_basis"];
@@ -195,6 +195,8 @@ function archiveLine(entry) {
195
195
  for (const key of WORDS) if (typeof entry[key] === "string" && WORD.test(entry[key])) line[key] = entry[key];
196
196
  if (Array.isArray(entry.layers) && entry.layers.length > 1 && entry.layers.every((word) => typeof word === "string" && WORD.test(word))) line.layers = entry.layers.slice(0, 8);
197
197
  if (typeof entry.exchanges === "number" && Number.isInteger(entry.exchanges) && entry.exchanges > 0) line.exchanges = entry.exchanges;
198
+ // The computer's offset from UTC when the stretch began (0.6.18), so a working day can be read in local time.
199
+ if (typeof entry.utc_offset === "string" && /^[+-]\d{2}:\d{2}$/.test(entry.utc_offset)) line.utc_offset = entry.utc_offset;
198
200
  // Commit hashes the stretch made, never a message: what ties AI time to delivered work in the repository.
199
201
  if (Array.isArray(entry.commits) && entry.commits.length > 0 && entry.commits.every((sha) => typeof sha === "string" && /^[0-9a-f]{7,40}$/.test(sha))) line.commits = entry.commits.slice(0, 50);
200
202
  // The project as a one-way hash of its name (owner/name, else the folder's own name): which days belong together, never which project.
@@ -244,6 +246,8 @@ function check(dir) {
244
246
  }
245
247
  const manifest = readJson(join(dir, "manifest.json")).value;
246
248
  if (rows.length > 0 && (!manifest || manifest.count !== lines.length || manifest.head !== lines.at(-1).hash)) return broken("manifest.json", "its count or head does not match the lines (lines were removed or added outside preserve)");
249
+ // THE MANIFEST'S SEAL (0.6.18, audit C9): a signed count and head, so a cut tail with a manifest edited to match is caught.
250
+ if (manifest && typeof manifest.signature === "string" && !signedBy(manifest)) return broken("manifest.json", "its signature does not verify with the key named in it (the count or the last line was changed)");
247
251
  const days = new Map();
248
252
  for (const line of lines) days.set(line.day, [...(days.get(line.day) ?? []), line]);
249
253
  const mine = deviceKey()?.publicX ?? null;
@@ -255,15 +259,19 @@ function check(dir) {
255
259
  if (!proof || proof.date !== day) return broken(where, "missing or unreadable");
256
260
  if (proof.count !== ofDay.length || proof.root !== rootOf(ofDay.map((line) => line.hash))) return broken(where, "the day's root does not match its lines");
257
261
  if (proof.signature === null) continue;
258
- const { signature, ...body } = proof;
259
- let valid = false;
260
- try { valid = verify(null, Buffer.from(canonical(body)), createPublicKey({ key: { kty: "OKP", crv: "Ed25519", x: body.public_key }, format: "jwk" }), Buffer.from(signature, "base64url")); } catch { valid = false; }
261
- if (!valid) return broken(where, "the signature does not verify with the key named in it");
262
+ if (!signedBy(proof)) return broken(where, "the signature does not verify with the key named in it");
262
263
  signed += 1;
263
- if (body.public_key === mine) ours += 1;
264
+ if (proof.public_key === mine) ours += 1;
264
265
  }
265
- return { lines, days, signed, ours, manifest };
266
+ return { lines, days, signed, ours, manifest, proofs: new Map([...days.keys()].map((day) => [day, readJson(join(dir, "proofs", `${day}.json`)).value])) };
266
267
  }
268
+ /** Whether a signed body (a day's proof, the manifest) verifies under the key it names. */
269
+ function signedBy(document) {
270
+ const { signature, ...body } = document;
271
+ try { return verify(null, Buffer.from(canonical(body)), createPublicKey({ key: { kty: "OKP", crv: "Ed25519", x: body.public_key }, format: "jwk" }), Buffer.from(signature, "base64url")); } catch { return false; }
272
+ }
273
+ /** Signed with this computer's key, or null: the body as it is signed. */
274
+ const sealed = (body, key) => ({ ...body, signature: key ? sign(null, Buffer.from(canonical(body)), key.privateKey).toString("base64url") : null });
267
275
 
268
276
  function archive(dir) {
269
277
  IDS = computerIds();
@@ -297,13 +305,19 @@ function archive(dir) {
297
305
  prev = hashed.hash;
298
306
  }
299
307
  // A day that gained lines gets its root again over all of its lines; the lines themselves are never rewritten.
308
+ // THIS KEY SIGNS ONLY ITS OWN LINES (0.6.18, audit S7): a day is signed when every earlier line of it was already under
309
+ // this key's signature (or there were none); a day that came into the folder from elsewhere keeps an unsigned root.
300
310
  const key = deviceKey();
311
+ const ours = (document) => !document || (key && typeof document.signature === "string" && document.public_key === key.publicX);
301
312
  mkdirSync(join(dir, "proofs"), { recursive: true });
302
313
  for (const day of new Set(fresh.map((line) => line.day))) {
303
- const body = proofBody(day, all.filter((line) => line.day === day), key);
304
- writeFileSync(join(dir, "proofs", `${day}.json`), `${JSON.stringify({ ...body, signature: key ? sign(null, Buffer.from(canonical(body)), key.privateKey).toString("base64url") : null }, null, 1)}\n`);
314
+ const own = !existing.days?.has(day) || ours(existing.proofs?.get(day));
315
+ const body = proofBody(day, all.filter((line) => line.day === day), own ? key : null);
316
+ writeFileSync(join(dir, "proofs", `${day}.json`), `${JSON.stringify(sealed(body, own ? key : null), null, 1)}\n`);
305
317
  }
306
- if (fresh.length > 0 || !existing.manifest) writeFileSync(join(dir, "manifest.json"), `${JSON.stringify({ format: "worktrust-ai-evidence/1", collector_version: COLLECTOR, created: existing.manifest?.created ?? new Date().toISOString(), updated: new Date().toISOString(), clients: [...new Set(all.map((line) => line.client))].sort(), ...IDS, count: all.length, head: prev }, null, 1)}\n`);
318
+ // The manifest is sealed the same way: a new archive, or one whose manifest this key already signed.
319
+ const manifestKey = !existing.manifest || ours(existing.manifest) ? key : null;
320
+ if (fresh.length > 0 || !existing.manifest) writeFileSync(join(dir, "manifest.json"), `${JSON.stringify(sealed({ format: "worktrust-ai-evidence/1", collector_version: COLLECTOR, created: existing.manifest?.created ?? new Date().toISOString(), updated: new Date().toISOString(), clients: [...new Set(all.map((line) => line.client))].sort(), ...IDS, count: all.length, head: prev, ...(manifestKey ? { public_key: manifestKey.publicX } : {}) }, manifestKey), null, 1)}\n`);
307
321
  say();
308
322
  say(` ✓ ${fresh.length} new day-stretch${fresh.length === 1 ? "" : "es"} archived in ${dir}: it holds ${all.length}, the session hook measures ${measured.size} finished ones here now${key ? ", each day's root signed with this computer's device key" : ", unsigned (no device key on this computer)"}.`);
309
323
  if (waiting > 0) say(` ${waiting} of today wait for tomorrow's run: a day is archived once it is over.`);
@@ -314,8 +328,9 @@ function verifyArchive(dir) {
314
328
  const result = check(dir);
315
329
  if (result.broken) { say(` BROKEN ${result.broken}`); process.exit(1); }
316
330
  if (result.lines.length === 0) { say(` Nothing to verify in ${dir}.`); return; }
317
- const signedBy = result.signed === 0 ? "no day signed" : result.ours === result.signed ? `${result.signed} signed by this computer's key` : `${result.signed} signed (${result.ours} by this computer's key, ${result.signed - result.ours} by another key named in them)`;
318
- say(` OK ${result.lines.length} stretches · ${result.days.size} days · the chain is whole · every day's root matches · ${signedBy}`);
331
+ const daySeal = result.signed === 0 ? "no day signed" : result.ours === result.signed ? `${result.signed} signed by this computer's key` : `${result.signed} signed (${result.ours} by this computer's key, ${result.signed - result.ours} by another key named in them)`;
332
+ const seal = typeof result.manifest?.signature !== "string" ? "manifest unsigned" : result.manifest.public_key === deviceKey()?.publicX ? "manifest signed by this computer's key" : "manifest signed by another key named in it";
333
+ say(` OK ${result.lines.length} stretches · ${result.days.size} days · the chain is whole · every day's root matches · ${daySeal} · ${seal}`);
319
334
  }
320
335
 
321
336
  /** --summary: what a person or a team reads from the archive, counted locally (preserve-summary.mjs) once the chain checks out. */
package/worktrust.mjs CHANGED
@@ -71,7 +71,7 @@ const command = args.find((arg, at) => !arg.startsWith("--") && !(at > 0 && VALU
71
71
  const flag = (name) => { const at = args.indexOf(`--${name}`); return at >= 0 ? args[at + 1] : undefined; };
72
72
  const has = (name) => args.includes(`--${name}`);
73
73
  /** 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). */
74
- const CLI_VERSION = "0.6.17";
74
+ const CLI_VERSION = "0.6.18";
75
75
  const ORIGIN = (flag("origin") ?? process.env.WORKTRUST_ORIGIN ?? "https://app.worktrust.io").replace(/\/$/, "");
76
76
  const MCP = flag("url") ?? process.env.WORKTRUST_MCP_URL ?? `${ORIGIN}/api/mcp`;
77
77
  const HOME_DIR = join(homedir(), ".worktrust");
@@ -670,7 +670,8 @@ async function offerRebuild(previousVersion, paths, key) {
670
670
  if (!previousVersion || previousVersion === CLI_VERSION) return;
671
671
  say();
672
672
  say(` This computer's earlier lines in WorkTrust were measured by worktrust ${previousVersion}. Version ${CLI_VERSION} measures`);
673
- say(" differently (what the seconds were, your own turns, tokens with the cache, more AI apps). You can re-measure the");
673
+ say(" differently (each answer's tokens counted once, nothing lost at midnight, when each stretch began, how you steered");
674
+ say(" the agent, what the seconds were, more AI apps). You can re-measure the");
674
675
  say(" sessions still on this computer and have WorkTrust replace this computer's earlier lines, day by day, never counting");
675
676
  say(" a day twice. Later: npx worktrust@latest history --rebuild");
676
677
  if (!(await ask("Show the plan and rebuild now?", false))) { say(" Not now."); return; }