toolroll 0.9.118 → 0.9.120

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/CHANGELOG.md +63 -0
  2. package/README.md +22 -22
  3. package/dist/assignment.js +43 -30
  4. package/dist/browser/workspace.css +1 -1
  5. package/dist/browser/workspace.js +32 -31
  6. package/dist/builder.js +288 -237
  7. package/dist/central-recovery-stage.js +3 -3
  8. package/dist/check-failure.js +2 -2
  9. package/dist/check-levels.js +3 -0
  10. package/dist/check-report.js +58 -7
  11. package/dist/cli-help.js +1 -0
  12. package/dist/codex-limits.js +40 -22
  13. package/dist/contracts/console-api.js +6 -1
  14. package/dist/contracts/engine-api.js +1 -0
  15. package/dist/contracts/release-check.js +7 -4
  16. package/dist/contracts/release-terms.js +11 -2
  17. package/dist/contracts/verification-receipt.js +1 -1
  18. package/dist/deploy-gate.js +7 -1
  19. package/dist/direct-chat.js +3 -3
  20. package/dist/easy-start.js +8 -6
  21. package/dist/engine-reads.js +74 -0
  22. package/dist/flexible-conversation-schema.js +24 -0
  23. package/dist/flexible-conversation.js +162 -0
  24. package/dist/flexible-custody.js +3 -0
  25. package/dist/flexible-import.js +89 -0
  26. package/dist/flexible-save.js +128 -0
  27. package/dist/flexible-session.js +93 -13
  28. package/dist/flexible-ship.js +3 -3
  29. package/dist/flexible-thread.js +2 -2
  30. package/dist/install-mode.js +1 -1
  31. package/dist/local-checks.js +32 -0
  32. package/dist/local-landing.js +758 -0
  33. package/dist/local-owner.js +3 -0
  34. package/dist/operate.js +165 -26
  35. package/dist/passwordless.js +1 -1
  36. package/dist/plan-limits-demand.js +48 -0
  37. package/dist/project-delete.js +1 -0
  38. package/dist/rehearsal.js +27 -0
  39. package/dist/release-adapters.js +170 -2
  40. package/dist/release-approval.js +11 -8
  41. package/dist/release-card.js +7 -2
  42. package/dist/release-carry.js +1 -1
  43. package/dist/release-cli.js +115 -14
  44. package/dist/release-main-proof.js +49 -0
  45. package/dist/release-main.js +110 -0
  46. package/dist/release-recheck.js +10 -3
  47. package/dist/release.js +221 -33
  48. package/dist/reply-shape.js +6 -1
  49. package/dist/result-actions.js +7 -1
  50. package/dist/result-follow-ups.js +30 -12
  51. package/dist/review-context.js +2 -1
  52. package/dist/serve.js +31 -14
  53. package/dist/server/direct-chat.js +109 -3
  54. package/dist/server/engine-api.js +65 -6
  55. package/dist/server/render-results.js +8 -4
  56. package/dist/server/render-tasks.js +10 -1
  57. package/dist/server/route-table.js +15 -1
  58. package/dist/server/send-back-build.js +4 -0
  59. package/dist/server/settings.js +33 -7
  60. package/dist/server/task-views.js +20 -0
  61. package/dist/server/tasks.js +108 -6
  62. package/dist/settings-groups-ui.js +3 -3
  63. package/dist/store.js +29 -4
  64. package/dist/subscription-usage.js +11 -5
  65. package/dist/surface.js +11 -2
  66. package/dist/task-base.js +23 -4
  67. package/dist/task-outcome-cli.js +10 -1
  68. package/dist/tui/darwin-arm64/toolroll-tui +0 -0
  69. package/dist/tui/darwin-x64/toolroll-tui +0 -0
  70. package/dist/tui/linux-arm64/toolroll-tui +0 -0
  71. package/dist/tui/linux-x64/toolroll-tui +0 -0
  72. package/dist/verification-evidence.js +20 -7
  73. package/dist/workspace-ui.js +1 -1
  74. package/package.json +2 -1
  75. package/scripts/release-proof.mjs +240 -0
package/CHANGELOG.md CHANGED
@@ -4,6 +4,69 @@ Each release opens with one line on its theme, then **New**, **Changed**, **Fixe
4
4
  the ones it has). Each item is at most two lines and says where to find it. Notes for maintainers (CI, the release
5
5
  tooling) go on the GitHub release, not here. Entries before 0.9.104 use the older format.
6
6
 
7
+ ## 0.9.120 — 2026-11-25
8
+
9
+ Landing puts exactly the change you reviewed on your branch, thread work can reach a local project, and Toolroll
10
+ stops spending plan usage while it sits idle.
11
+
12
+ ### New
13
+
14
+ - **Save a thread's work as a branch** in your project: `S` on a thread in the workbench, **Save as branch** in the
15
+ browser, or `toolroll thread save <id>`. It works after the thread ends and shows the `git merge` to run.
16
+ - **Land from the workbench:** **B** on a finished task (and "Land" in the palette). `task land` is listed in
17
+ `toolroll task --help`, and accepting a task says how to land it.
18
+ - **Reply to a Direct Chat** from its page in the browser.
19
+
20
+ ### Changed
21
+
22
+ - **Land puts one commit on your branch:** exactly the files that were checked, never the attempts you sent back.
23
+ With the branch checked out in your project folder, Toolroll never touches it: it gives you one `git merge` to run.
24
+ - **A sent-back revision shows its whole change since main,** not only what changed since the rejected attempt.
25
+ - **No plan-usage checks while Toolroll is idle:** it reads plan limits only while work runs, or for a few minutes
26
+ after you open Spend.
27
+ - **Build again right away** is offered wherever Approve would work with an empty password field.
28
+ - **Run checks** works from the browser session `toolroll` opens on a solo install, for the check command you approved.
29
+
30
+ ### Fixed
31
+
32
+ - **Running checks again no longer reopens accepted work;** a failing re-check blocks Land and says why.
33
+ - **"Looks right" accepts a passed result** in the browser without asking for a reason.
34
+ - **The task page says "On main"** after you merge the work yourself, and Undo still works.
35
+ - **A thread's Diff refreshes when a turn ends** and says when the agent has edits it hasn't committed.
36
+ - **Settings shows signed-in sessions,** not "devices", and the README's links work from npm.
37
+
38
+ ## 0.9.119 — 2026-11-25
39
+
40
+ Thread agents remember the conversation, accepted work can land on your branch, and releases stop re-running the
41
+ whole test suite.
42
+
43
+ ### New
44
+
45
+ - **Threads remember the conversation.** Each reply's agent gets your earlier messages and its earlier answers, so a
46
+ follow-up builds on what was said. Your messages show in the transcript, in the terminal and the browser.
47
+ - **A Diff for threads:** Tab on a thread in the workbench, or Open on Agents → Live in the browser.
48
+ - **Land a task on your branch:** `toolroll task land <id>`, or **Land it** on the task page, shows what lands where
49
+ first; **Undo** reverts it with a new commit. When your project folder has the branch checked out, it gives you the
50
+ exact `git merge --ff-only` command to run there instead.
51
+ - **Direct Chat pages:** `/direct-chats` lists your chats; each shows its turns, its changes and Ship.
52
+ - **Send back and build again right away**, on the same terms, from the result page.
53
+ - **Releasing Toolroll from main:** `toolroll release prepare <version>`, merge it, then `toolroll release <version>`
54
+ checks a copy of your database in a sealed sandbox in minutes instead of re-running every test.
55
+
56
+ ### Changed
57
+
58
+ - **Accepted work stays accepted** when you change the check command; releases and pull requests still wait for fresh
59
+ checks.
60
+ - **Accept asks for a reason only for an exception;** after "Looks right" it just accepts.
61
+ - **The workbench key bar shows a thread's own keys,** and an ended thread says **T** starts a new one.
62
+
63
+ ### Fixed
64
+
65
+ - **`verify set --repo .`** saves the project, not ".".
66
+ - **Settings → Checks and Pull requests** open your project (or a picker) instead of "No such project".
67
+ - **Task ids work with or without `task-`,** and the README's links work from the installed package.
68
+ - **Quitting after a failed hand-over** no longer says "stopped" while a second Toolroll keeps running.
69
+
7
70
  ## 0.9.118 — 2026-11-25
8
71
 
9
72
  Agents can read the project skills they are told about.
package/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  <div align="center">
2
2
 
3
3
  <picture>
4
- <source media="(prefers-color-scheme: dark)" srcset="docs/media/wordmark-dark.svg">
5
- <img src="docs/media/wordmark-light.svg" alt="Toolroll" width="440">
4
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/ap9000/toolroll/main/docs/media/wordmark-dark.svg">
5
+ <img src="https://raw.githubusercontent.com/ap9000/toolroll/main/docs/media/wordmark-light.svg" alt="Toolroll" width="440">
6
6
  </picture>
7
7
 
8
8
  ### Your agents build. You decide.
@@ -10,8 +10,8 @@
10
10
  **Delegate changes. Review verified diffs. Ship in one keystroke — in the native macOS app or your terminal.**
11
11
 
12
12
  <picture>
13
- <source media="(prefers-color-scheme: light)" srcset="docs/media/terminal-workbench-light.png">
14
- <img src="docs/media/terminal-workbench.png" alt="Toolroll: native macOS app and terminal workbench with tasks that need you and live streaming output" width="900">
13
+ <source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/ap9000/toolroll/main/docs/media/terminal-workbench-light.png">
14
+ <img src="https://raw.githubusercontent.com/ap9000/toolroll/main/docs/media/terminal-workbench.png" alt="Toolroll: native macOS app and terminal workbench with tasks that need you and live streaming output" width="900">
15
15
  </picture>
16
16
  <sub>Native SwiftUI macOS app and keyboard-driven terminal workbench, zero Electron, zero telemetry.</sub>
17
17
 
@@ -19,11 +19,11 @@ For Claude Code, Codex, and Gemini — using the subscriptions already on your m
19
19
 
20
20
  [![npm](https://img.shields.io/npm/v/toolroll?color=171717)](https://www.npmjs.com/package/toolroll)
21
21
  [![CI](https://github.com/ap9000/toolroll/actions/workflows/ci.yml/badge.svg)](https://github.com/ap9000/toolroll/actions/workflows/ci.yml)
22
- [![license](https://img.shields.io/badge/license-MIT-171717)](LICENSE)
22
+ [![license](https://img.shields.io/badge/license-MIT-171717)](https://github.com/ap9000/toolroll/blob/main/LICENSE)
23
23
  [![Homebrew](https://img.shields.io/badge/homebrew-ap9000%2Ftoolroll-171717)](https://github.com/ap9000/homebrew-toolroll)
24
24
  ![node](https://img.shields.io/badge/node-%E2%89%A5%2022.20-171717)
25
25
 
26
- **[Website](https://toolroll.dev)** · [Docs](docs/guide/README.md) · [For agents](docs/agents.md) · [Use cases](https://toolroll.dev/use-cases) · [Changelog](CHANGELOG.md)
26
+ **[Website](https://toolroll.dev)** · [Docs](https://github.com/ap9000/toolroll/blob/main/docs/guide/README.md) · [For agents](https://github.com/ap9000/toolroll/blob/main/docs/agents.md) · [Use cases](https://toolroll.dev/use-cases) · [Changelog](CHANGELOG.md)
27
27
 
28
28
  </div>
29
29
 
@@ -48,7 +48,7 @@ cd mac && bash build-app.sh && open build/Toolroll.app
48
48
  cd mac && bash build-dmg.sh
49
49
  ```
50
50
 
51
- See [macOS release & signing guide](docs/guide/mac-release.md) for Developer ID signing, notarization, and Homebrew Cask automation.
51
+ See [macOS release & signing guide](https://github.com/ap9000/toolroll/blob/main/docs/guide/mac-release.md) for Developer ID signing, notarization, and Homebrew Cask automation.
52
52
 
53
53
  </details>
54
54
 
@@ -76,7 +76,7 @@ npm uninstall -g standing-orders && npm install -g toolroll
76
76
 
77
77
  </details>
78
78
 
79
- Toolroll opens locally with no password and no login file — on your own computer you're already in. Start a **Direct Chat** for fast interactive iteration in an isolated clone, or delegate a **Task** to build while you walk away. Every result returns **Ready** with its diff and real check status; press `⌘⏎` (Mac app) or `a` (terminal) to accept and ship, or send it back with notes. To explore without model calls or spend, run `toolroll demo`. More: [Getting started](docs/guide/getting-started.md).
79
+ Toolroll opens locally with no password and no login file — on your own computer you're already in. Start a **Direct Chat** for fast interactive iteration in an isolated clone, or delegate a **Task** to build while you walk away. Every result returns **Ready** with its diff and real check status; press `⌘⏎` (Mac app) or `a` (terminal) to accept and ship, or send it back with notes. To explore without model calls or spend, run `toolroll demo`. More: [Getting started](https://github.com/ap9000/toolroll/blob/main/docs/guide/getting-started.md).
80
80
 
81
81
  ## The terminal loop
82
82
 
@@ -92,8 +92,8 @@ you. A result becomes **Ready**, awaiting your review, with its diff and actual
92
92
  check status. Accept marks it Complete; publishing and merging need their own
93
93
  approvals. Set your project's check to verify the exact result.
94
94
 
95
- [Coming from herdr](docs/guide/from-herdr.md) ·
96
- [Terminal keys and layouts](docs/guide/getting-started.md#the-terminal-workbench)
95
+ [Coming from herdr](https://github.com/ap9000/toolroll/blob/main/docs/guide/from-herdr.md) ·
96
+ [Terminal keys and layouts](https://github.com/ap9000/toolroll/blob/main/docs/guide/getting-started.md#the-terminal-workbench)
97
97
 
98
98
  ## Use cases
99
99
 
@@ -158,26 +158,26 @@ toolroll contract --commands --json # the whole command surface
158
158
  toolroll skills get operating # the rules, from the binary you're running
159
159
  ```
160
160
 
161
- Start at [docs/agents.md](docs/agents.md). [`llms.txt`](llms.txt) indexes the
161
+ Start at [docs/agents.md](https://github.com/ap9000/toolroll/blob/main/docs/agents.md). [`llms.txt`](https://github.com/ap9000/toolroll/blob/main/llms.txt) indexes the
162
162
  docs for language models.
163
163
 
164
164
  ## Docs
165
165
 
166
- - [Getting started](docs/guide/getting-started.md): install, first task, terminal, desktop app
167
- - [Tasks, results and revisions](docs/guide/tasks.md)
168
- - [Chat and your phone](docs/guide/chat-and-phone.md)
169
- - [Flows](docs/guide/flows.md) · [Steps that reach outside](docs/guide/steps-outside.md) · [Subagents](docs/guide/subagents.md)
170
- - [Running unattended](docs/guide/unattended.md) · [Fleets and trackers](docs/guide/fleet.md)
171
- - [Security](docs/guide/security.md) · [Models, spend and routing](docs/guide/routing.md)
172
- - [A team server](docs/team-server.md) · [Linux](docs/guide/linux.md)
173
- - [All docs](docs/guide/README.md)
166
+ - [Getting started](https://github.com/ap9000/toolroll/blob/main/docs/guide/getting-started.md): install, first task, terminal, desktop app
167
+ - [Tasks, results and revisions](https://github.com/ap9000/toolroll/blob/main/docs/guide/tasks.md)
168
+ - [Chat and your phone](https://github.com/ap9000/toolroll/blob/main/docs/guide/chat-and-phone.md)
169
+ - [Flows](https://github.com/ap9000/toolroll/blob/main/docs/guide/flows.md) · [Steps that reach outside](https://github.com/ap9000/toolroll/blob/main/docs/guide/steps-outside.md) · [Subagents](https://github.com/ap9000/toolroll/blob/main/docs/guide/subagents.md)
170
+ - [Running unattended](https://github.com/ap9000/toolroll/blob/main/docs/guide/unattended.md) · [Fleets and trackers](https://github.com/ap9000/toolroll/blob/main/docs/guide/fleet.md)
171
+ - [Security](https://github.com/ap9000/toolroll/blob/main/docs/guide/security.md) · [Models, spend and routing](https://github.com/ap9000/toolroll/blob/main/docs/guide/routing.md)
172
+ - [A team server](https://github.com/ap9000/toolroll/blob/main/docs/team-server.md) · [Linux](https://github.com/ap9000/toolroll/blob/main/docs/guide/linux.md)
173
+ - [All docs](https://github.com/ap9000/toolroll/blob/main/docs/guide/README.md)
174
174
 
175
175
  ## Contributing
176
176
 
177
177
  Provider adapters are the most useful place to start. See
178
- [CONTRIBUTING.md](CONTRIBUTING.md). Report security issues as
179
- [SECURITY.md](SECURITY.md) describes.
178
+ [CONTRIBUTING.md](https://github.com/ap9000/toolroll/blob/main/CONTRIBUTING.md). Report security issues as
179
+ [SECURITY.md](https://github.com/ap9000/toolroll/blob/main/SECURITY.md) describes.
180
180
 
181
181
  ## License
182
182
 
183
- [MIT](LICENSE)
183
+ [MIT](https://github.com/ap9000/toolroll/blob/main/LICENSE)
@@ -18,7 +18,7 @@ import { historicalAssessmentReason } from "./assignment-presentation.js";
18
18
  import { manualReviewOnly, shownVerdictOf } from "./proof.js";
19
19
  import { ACCEPT_NEEDS_REASON, cantAcceptYetOf } from "./result-acts.js";
20
20
  import { requiredCheckCommandFor, runCheckLevel } from "./check-levels.js";
21
- import { followUpChecksOf, withFollowUps } from "./result-follow-ups.js";
21
+ import { FOLLOW_UP_LOG, FOLLOW_UP_RECEIPT, followUpChecksOf, withFollowUps } from "./result-follow-ups.js";
22
22
  import { buildReviewOf, findingWords } from "./review-switch.js";
23
23
  import { NEEDS, WAITS, processNeedOf, resultHoldUpSentence } from "./needs-you.js";
24
24
  import { assignmentStageOf, checkBackingOf, completionBlockersOf, receiptChecksOf, requirementWordOf } from "./task-status.js";
@@ -76,11 +76,11 @@ function ownerOf(store, rootId, repo) {
76
76
  return { kind: "coordinator", id, label: String(credential?.["name"] ?? "Former lead"),
77
77
  active: credential !== undefined && credential["revoked_at"] === null && repo !== null && Array.isArray(repos) && repos.includes(repo) };
78
78
  }
79
- export function assignmentChecksForRun(given, root, runId, now) {
79
+ export function assignmentChecksForRun(given, root, runId, now, asOf) {
80
80
  const store = readerOf(given);
81
- const own = recordedFailureStands(store, runId, buildChecks(store, root, runId));
81
+ const own = recordedFailureStands(store, runId, buildChecks(store, root, runId, asOf));
82
82
  const run = store.getRun(runId);
83
- const followUps = followUpChecksOf(store, runId, now, root);
83
+ const followUps = followUpChecksOf(store, runId, now, root, asOf);
84
84
  if (followUps.length === 0)
85
85
  return own;
86
86
  const read = withFollowUps({ status: own.status, level: own.level ?? null, exitCode: own.exitCode, head: run?.headRevision ?? null }, followUps);
@@ -106,13 +106,13 @@ function recordedFailureStands(store, runId, own) {
106
106
  detail: `${own.level === "quick" ? "Quick checks" : "Checks"} failed${recorded.exitCode === null ? "" : ` (exit ${recorded.exitCode})`}. ${own.detail}` };
107
107
  }
108
108
  const COMMAND_MISSING_OR_CHANGED = "The original approved verification command is missing or changed.";
109
- function buildChecks(store, root, runId) {
109
+ function buildChecks(store, root, runId, asOf) {
110
110
  const level = runCheckLevel(store, runId);
111
111
  const unavailable = (detail) => ({ status: "unavailable", exitCode: null, command: null, logArtifactId: null, detail, level });
112
112
  if (root === undefined)
113
113
  return unavailable("Saved checks are unavailable.");
114
114
  try {
115
- const gate = verificationEvidence(store, root, runId);
115
+ const gate = verificationEvidence(store, root, runId, asOf);
116
116
  if (!gate.ok) {
117
117
  const run = store.getRun(runId), repo = run === null ? null : store.refById(run.taskRef)?.repo ?? null;
118
118
  const live = repo === null ? null : store.liveVerifyCommand(repo);
@@ -131,9 +131,11 @@ function buildChecks(store, root, runId) {
131
131
  detail: "Checks gave no complete result, so they can't count as a pass." };
132
132
  const sealedLevel = typeof receipt.command?.repo === "string" && receipt.command.repo.startsWith("quick:") ? "quick" : "full";
133
133
  const words = sealedLevel === "quick" ? "Quick checks" : "Checks";
134
+ const deploy = receipt.coverage === "deploy";
134
135
  return { status: ran ? exitCode === 0 ? "passed" : "failed" : "not-run", exitCode,
135
136
  command: receipt.command.command, logArtifactId: receipt.log.artifactId, level: level === null ? null : sealedLevel,
136
- detail: ran ? exitCode === 0 ? `${words} passed.` : `${words} failed (exit ${exitCode}).` : `${words} did not finish.` };
137
+ ...(typeof receipt.coverage === "string" ? { coverage: receipt.coverage } : {}),
138
+ detail: ran ? exitCode === 0 ? deploy ? "The deploy check passed." : `${words} passed.` : `${deploy ? "The deploy check" : words} failed (exit ${exitCode}).` : `${deploy ? "The deploy check" : words} did not finish.` };
137
139
  }
138
140
  catch {
139
141
  return unavailable("Saved checks could not be read.");
@@ -172,29 +174,34 @@ export function assignmentOf(given, taskId, now, access, root, memo) {
172
174
  const reports = artifacts.filter(a => a.kind === "report");
173
175
  const unavailable = family.versions.flatMap(version => store.runsFor(version.refId).flatMap(run => store.artifactsFor(run.id).filter(artifact => root === undefined || !verifyArtifact(root, artifact).ok)
174
176
  .map(artifact => `Saved ${artifact.kind} #${artifact.id} (run ${run.id}) is unavailable or changed.`)));
175
- const ownChecks = result === null ? null : assignmentChecksForRun(store, root, result.id, now);
176
- const checks = ownChecks === null || ownChecks.level !== "off" || ownChecks.status === "passed" || ownChecks.status === "failed" ? ownChecks
177
- : { ...ownChecks, release: releaseCoverageOf(store, root, current.repo, result.headRevision, memo === undefined ? {} : { memo }) };
178
177
  const finishedBuild = result?.role === "builder" && (result.outcome === "built" || result.outcome === "no-change") &&
179
178
  result.finishedAt !== null && /^[a-f0-9]{40}$/.test(result.headRevision ?? "");
180
- const completionKind = result?.role === "scout" && result.outcome === "built" && result.finishedAt !== null ? "research-report"
181
- : finishedBuild && acceptance !== null ? "accepted-exception"
182
- : finishedBuild ? checks?.status === "passed" ? "checked-build" : "finished-build" : null;
183
- const receiptBody = result === null ? null : {
184
- rootId: family.root.id, taskId: current.id, runId: result.id, base: result.baseRevision,
185
- head: result.headRevision, scopeDigest: result.scopeDigest ?? null, proof, completionKind, proofAcceptance: acceptance, checks: checks,
186
- artifacts: artifacts.map(a => ({ id: a.id, kind: a.kind, sha256: a.sha256, bytes: a.bytesStored,
187
- complete: !a.truncated && a.captureStatus !== "failed" })),
188
- caveats: [...(proof?.reasons ?? []), ...unavailable,
189
- ...(completionKind === "research-report" && reports.length !== 1 ? ["The report artifact is missing or ambiguous."] : []), ...(completionKind === "accepted-exception" && !artifacts.some(a => a.kind === "proof") ? ["No builder proof artifact is recorded."] : []),
190
- ...(artifacts.some(a => a.kind === "check-log" && a.truncated) ? ["The check log was shortened when stored; only the retained output is available."] : []),
191
- ...artifacts.filter(a => a.kind !== "check-log" && (a.truncated || a.captureStatus === "failed")).map(a => `Saved ${a.kind} #${a.id} is ${a.captureStatus === "failed" ? "a failed capture" : "incomplete"}.`)],
192
- agentReport: result.handoff, evidence: "recorded",
179
+ const sealFor = (ownChecks, asOf) => {
180
+ const sealed = asOf === undefined ? artifacts : artifacts.filter(a => !(a.kind === "structured-output" && (a.capture === FOLLOW_UP_LOG || a.capture === FOLLOW_UP_RECEIPT)
181
+ && Date.parse(a.createdAt) > asOf.getTime()));
182
+ const checks = ownChecks === null || ownChecks.level !== "off" || ownChecks.status === "passed" || ownChecks.status === "failed" ? ownChecks
183
+ : { ...ownChecks, release: releaseCoverageOf(store, root, current.repo, result.headRevision, memo === undefined ? {} : { memo }) };
184
+ const completionKind = result?.role === "scout" && result.outcome === "built" && result.finishedAt !== null ? "research-report"
185
+ : finishedBuild && acceptance !== null ? "accepted-exception"
186
+ : finishedBuild ? checks?.status === "passed" ? "checked-build" : "finished-build" : null;
187
+ const receiptBody = result === null ? null : {
188
+ rootId: family.root.id, taskId: current.id, runId: result.id, base: result.baseRevision,
189
+ head: result.headRevision, scopeDigest: result.scopeDigest ?? null, proof, completionKind, proofAcceptance: acceptance, checks: checks,
190
+ artifacts: sealed.map(a => ({ id: a.id, kind: a.kind, sha256: a.sha256, bytes: a.bytesStored,
191
+ complete: !a.truncated && a.captureStatus !== "failed" })),
192
+ caveats: [...(proof?.reasons ?? []), ...unavailable,
193
+ ...(completionKind === "research-report" && reports.length !== 1 ? ["The report artifact is missing or ambiguous."] : []), ...(completionKind === "accepted-exception" && !sealed.some(a => a.kind === "proof") ? ["No builder proof artifact is recorded."] : []),
194
+ ...(sealed.some(a => a.kind === "check-log" && a.truncated) ? ["The check log was shortened when stored; only the retained output is available."] : []),
195
+ ...sealed.filter(a => a.kind !== "check-log" && (a.truncated || a.captureStatus === "failed")).map(a => `Saved ${a.kind} #${a.id} is ${a.captureStatus === "failed" ? "a failed capture" : "incomplete"}.`)],
196
+ agentReport: result.handoff, evidence: "recorded",
197
+ };
198
+ const sealedBody = receiptBody === null ? null : { ...receiptBody, checks: sealedChecks(receiptBody.checks) };
199
+ const receipt = receiptBody === null ? null : { ...receiptBody, digest: digest({ receipt: sealedBody,
200
+ scope: scope === null ? null : { digest: scope.digest, approved: approvalOf(scope).approved, termsProblem: scope.termsProblem ?? null },
201
+ versions: family.versions.map(v => ({ id: v.id, state: v.state })) }) };
202
+ return { checks, completionKind, receipt };
193
203
  };
194
- const sealedBody = receiptBody === null ? null : { ...receiptBody, checks: sealedChecks(receiptBody.checks) };
195
- const receipt = receiptBody === null ? null : { ...receiptBody, digest: digest({ receipt: sealedBody,
196
- scope: scope === null ? null : { digest: scope.digest, approved: approvalOf(scope).approved, termsProblem: scope.termsProblem ?? null },
197
- versions: family.versions.map(v => ({ id: v.id, state: v.state })) }) };
204
+ const { completionKind, receipt } = sealFor(result === null ? null : assignmentChecksForRun(store, root, result.id, now));
198
205
  let completion = null;
199
206
  let state = "working";
200
207
  let detail = work.status.detail;
@@ -254,19 +261,25 @@ export function assignmentOf(given, taskId, now, access, root, memo) {
254
261
  : completionKind === "accepted-exception" ? "An operator accepted this result with its recorded limitations. The lead can inspect that decision; the recorded checks are unchanged."
255
262
  : receipt.checks.detail;
256
263
  primaryAction = { code: "open-result", label: completionKind === "research-report" ? "Read report" : "Open result", target: { taskId: current.id, runId: result.id, decisionId: null }, access: "read", retry: "read-again" };
257
- const checked = store.handle.prepare("SELECT actor,at,detail FROM action_ledger WHERE task_id = ? AND run_id = ? AND action = ? AND outcome = ? AND source = 'work' ORDER BY id DESC")
264
+ const exact = store.handle.prepare("SELECT actor,at,detail FROM action_ledger WHERE task_id = ? AND run_id = ? AND action = ? AND outcome = ? AND source = 'work' ORDER BY id DESC")
258
265
  .all(family.root.id, result.id, CHECK_ACTION, receipt.digest).find(row => COMPLETER_ACTOR.test(String(row["actor"])));
266
+ const historical = exact !== undefined ? undefined : store.handle.prepare("SELECT actor,at,detail,outcome FROM action_ledger WHERE task_id = ? AND run_id = ? AND action = ? AND source = 'work' ORDER BY id DESC LIMIT 3")
267
+ .all(family.root.id, result.id, CHECK_ACTION).filter(row => COMPLETER_ACTOR.test(String(row["actor"])) && !Number.isNaN(Date.parse(String(row["at"]))))
268
+ .find(row => sealFor(assignmentChecksForRun(store, root, result.id, now, new Date(String(row["at"]))), new Date(String(row["at"]))).receipt?.digest === String(row["outcome"]));
269
+ const checked = exact ?? historical;
259
270
  if (checked !== undefined) {
260
271
  const rootRef = store.lookupRef(family.root.id);
261
272
  const byLead = rootRef !== null && olderStoreSafe(() => store.taskActs(rootRef.id), []).filter(one => one.act === "completed").at(-1)?.lead === true;
262
273
  const landed = landedReasonOf(String(checked["actor"]), checked["detail"] == null ? null : String(checked["detail"]));
263
- completion = { actor: String(checked["actor"]), at: String(checked["at"]), digest: receipt.digest, ...(byLead && landed === null ? { lead: true } : {}), ...(landed === null ? {} : { landed }) };
274
+ completion = { actor: String(checked["actor"]), at: String(checked["at"]), digest: exact === undefined ? String(checked["outcome"]) : receipt.digest,
275
+ ...(byLead && landed === null ? { lead: true } : {}), ...(landed === null ? {} : { landed }), ...(exact === undefined ? { historical: true } : {}) };
264
276
  state = "complete";
265
277
  primaryAction = { ...primaryAction, label: completionKind === "research-report" ? "Read report" : "Open result" };
266
278
  const label = byLead ? "the lead" : completion.actor.startsWith("operator:") ? completion.actor.slice(9) : owner && completion.actor === actorOf(owner) ? owner.label : "the previous lead";
267
279
  detail = landed !== null ? `Marked complete automatically: ${landed}. ${receipt.checks.detail}`
268
280
  : completionKind === "research-report" ? `Research report checked by ${label}. No deployment is implied.`
269
- : `Handled by ${label}. ${receipt.checks.detail} Publication and deployment are separate.`;
281
+ : exact === undefined ? `Handled by ${label}. Its checks read differently now: ${receipt.checks.detail} Publication and deployment need them to pass again.`
282
+ : `Handled by ${label}. ${receipt.checks.detail} Publication and deployment are separate.`;
270
283
  }
271
284
  }
272
285
  else if (work.status.rank === 0 || (!live && (current.state === "done" || current.state === "failed" || work.status.views.includes("needs-you")))) {