gentle-pi 4.9.0 → 5.1.0

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 (443) hide show
  1. package/README.md +2 -2
  2. package/assets/agents/gentle-ai-explore.md +3 -6
  3. package/assets/agents/gentle-ai-verify.md +2 -2
  4. package/assets/agents/gentle-ai-worker.md +9 -9
  5. package/assets/agents/jd-fix-agent.md +2 -2
  6. package/assets/agents/jd-judge-a.md +0 -1
  7. package/assets/agents/jd-judge-b.md +0 -1
  8. package/assets/migrations/agent-body-history.json +9 -0
  9. package/assets/orchestrator-delegation.md +1 -1
  10. package/assets/orchestrator-full-delegation.md +1 -1
  11. package/assets/orchestrator-maintenance.md +11 -0
  12. package/assets/orchestrator-quota-recovery.md +1 -1
  13. package/assets/orchestrator-skills.md +10 -0
  14. package/assets/orchestrator-tracking.md +2 -2
  15. package/assets/orchestrator-verification.md +10 -8
  16. package/assets/orchestrator.md +2 -2
  17. package/bin/gentle-shell.mjs +69 -17
  18. package/contracts/review-provider-contract-mirror/provider-contract.lock.json +11 -10
  19. package/contracts/review-provider-contract-mirror/{v1.6.0 → v1.7.0}/bundle/manifest.json +5 -5
  20. package/contracts/review-provider-contract-mirror/{v1.6.0 → v1.7.0}/bundle/orchestration/pi.md +5 -3
  21. package/contracts/review-provider-contract-mirror/{v1.6.0 → v1.7.0}/bundle/routing/pi.md +2 -2
  22. package/contracts/review-provider-contract-mirror/{v1.6.0 → v1.7.0}/bundle/schemas/lens.schema.json +3 -3
  23. package/contracts/review-provider-contract-mirror/v1.7.0/bundle/vectors/lens.json +1 -0
  24. package/contracts/review-provider-contract-mirror/{v1.6.0 → v1.7.0}/generated/provider-capabilities.baseline.json +3 -3
  25. package/contracts/review-provider-contract-mirror/{v1.6.0 → v1.7.0}/generated/provider-roles.baseline.json +3 -3
  26. package/docs/bundled-install.md +2 -2
  27. package/docs/delegated-verification.md +10 -6
  28. package/docs/desktop-feed.md +15 -6
  29. package/docs/desktop-rpc.md +298 -30
  30. package/docs/gentle-shell-desktop.md +10 -3
  31. package/docs/gentle-shell.md +25 -19
  32. package/docs/install-wizard.md +7 -5
  33. package/docs/native-authority-architecture.md +3 -3
  34. package/docs/odd-preparation-continuity.md +2 -2
  35. package/docs/permission-modes.md +10 -2
  36. package/docs/readme-reference.md +53 -24
  37. package/docs/review-coordinator.md +4 -2
  38. package/docs/session-profile-format.md +33 -7
  39. package/docs/sound-notifications.md +1 -1
  40. package/docs/work-continuity.md +7 -7
  41. package/docs/yolo-mode.md +1 -1
  42. package/extensions/ask-user-choice.ts +2 -2
  43. package/extensions/ask-user-question.ts +1 -1
  44. package/extensions/child-context.ts +2 -11
  45. package/extensions/gentle-agents.ts +86 -30
  46. package/extensions/gentle-ai.ts +918 -632
  47. package/extensions/gentle-desktop-feed.ts +13 -3
  48. package/extensions/gentle-desktop-rpc.ts +51 -2
  49. package/extensions/gentle-fast.ts +9 -2
  50. package/extensions/gentle-music.ts +2 -0
  51. package/extensions/gentle-notifications.ts +12 -4
  52. package/extensions/gentle-shell.ts +157 -62
  53. package/extensions/gentle-star-prompt.ts +3 -0
  54. package/extensions/gentle-tps.ts +7 -0
  55. package/extensions/history/index.ts +1 -1
  56. package/extensions/quiet-tools.ts +13 -22
  57. package/extensions/skill-registry.ts +9 -1
  58. package/extensions/startup-banner.ts +8 -13
  59. package/herdr/mods/gentle-agents/snapshot.js +30 -23
  60. package/herdr/mods/gentle-chat/feed.js +6 -0
  61. package/herdr/mods/gentle-chat/main.js +76 -16
  62. package/herdr/mods/gentle-chat/session.js +13 -5
  63. package/herdr/mods/gentle-chat/snapshot.js +30 -23
  64. package/herdr/mods/gentle-chat/ui.js +7 -1
  65. package/herdr/mods/gentle-inspector/main.js +2 -0
  66. package/herdr/mods/gentle-inspector/snapshot.js +30 -23
  67. package/herdr/mods/gentle-palette/main.js +1 -1
  68. package/herdr/mods/gentle-palette/snapshot.js +30 -23
  69. package/herdr/mods/gentle-pane/snapshot.js +30 -23
  70. package/herdr/mods/gentle-sidebar/snapshot.js +30 -23
  71. package/herdr/mods/gentle-spaces/snapshot.js +30 -23
  72. package/herdr/mods/gentle-status/snapshot.js +30 -23
  73. package/herdr/mods/gentle-tabs/main.js +3 -2
  74. package/herdr/mods/gentle-tabs/new-tab.js +9 -0
  75. package/herdr/mods/gentle-tabs/snapshot.js +30 -23
  76. package/herdr/mods/gentle-tokens/snapshot.js +30 -23
  77. package/lib/agent-profiles.ts +50 -10
  78. package/lib/agents-config.ts +69 -5
  79. package/lib/agents-runner.ts +34 -1
  80. package/lib/auto-permission-runtime.ts +2 -1
  81. package/lib/background-jobs-tools.ts +24 -16
  82. package/lib/banner-config.ts +69 -0
  83. package/lib/child-session.ts +6 -0
  84. package/lib/claude-bridge-config.ts +41 -0
  85. package/lib/codex-turn-continuation.ts +40 -0
  86. package/lib/compaction-threshold.ts +46 -0
  87. package/lib/context-threshold.ts +5 -5
  88. package/lib/desktop-agent-definitions-service.ts +93 -0
  89. package/lib/desktop-auth-service.ts +102 -0
  90. package/lib/desktop-background-subagents-service.ts +155 -0
  91. package/lib/desktop-command-rpc.ts +71 -0
  92. package/lib/desktop-feed-sources.ts +44 -1
  93. package/lib/desktop-feed.ts +41 -29
  94. package/lib/desktop-rpc-agent-definitions.ts +119 -0
  95. package/lib/desktop-rpc-agents.ts +44 -3
  96. package/lib/desktop-rpc-auth.ts +103 -0
  97. package/lib/desktop-rpc-background-subagents.ts +126 -0
  98. package/lib/desktop-rpc-changes.ts +13 -4
  99. package/lib/desktop-rpc-config.ts +287 -13
  100. package/lib/desktop-rpc-profile-binding.ts +212 -0
  101. package/lib/desktop-rpc-profiles.ts +2 -0
  102. package/lib/desktop-rpc-stats.ts +16 -4
  103. package/lib/desktop-rpc-status.ts +103 -0
  104. package/lib/desktop-status-service.ts +86 -0
  105. package/lib/destructive-command-guard.ts +9 -185
  106. package/lib/exploration-budget.ts +3 -7
  107. package/lib/gentle-design.ts +23 -4
  108. package/lib/gentle-shell-desktop.ts +85 -0
  109. package/lib/gentle-shell-launcher.ts +120 -8
  110. package/lib/mcp-config.ts +214 -0
  111. package/lib/native-choice-list.ts +1 -1
  112. package/lib/native-fullscreen-interaction.ts +3 -0
  113. package/lib/native-pointer-region.ts +1 -1
  114. package/lib/native-review-cli.ts +213 -397
  115. package/lib/odd-phase-inference.ts +1 -1
  116. package/lib/orchestrator-mode-policy.ts +25 -12
  117. package/lib/path-consent-fence.ts +113 -0
  118. package/lib/persona-config.ts +77 -0
  119. package/lib/pi-settings.ts +157 -0
  120. package/lib/questionnaire/questionnaire-view.ts +1 -1
  121. package/lib/review-continuation-registry.ts +9 -26
  122. package/lib/review-coordinator.ts +13 -2
  123. package/lib/review-host-relay.ts +2 -35
  124. package/lib/review-integration-v2.ts +129 -180
  125. package/lib/review-object-store.ts +0 -57
  126. package/lib/review-repository.ts +0 -44
  127. package/lib/review-risk-assessment.ts +11 -36
  128. package/lib/review-start-context.ts +2 -1
  129. package/lib/review-transaction.ts +6 -6
  130. package/lib/sensitive-paths.ts +45 -0
  131. package/lib/session-profile-binding.ts +29 -0
  132. package/lib/session-profile-freeze.ts +11 -4
  133. package/lib/session-worktree-registry.ts +11 -5
  134. package/lib/shell-bar.ts +41 -18
  135. package/lib/shell-card.ts +27 -1
  136. package/lib/shell-changes-view.ts +6 -2
  137. package/lib/shell-changes.ts +94 -37
  138. package/lib/shell-git-worker.ts +158 -0
  139. package/lib/shell-idle-changes.ts +88 -0
  140. package/lib/shell-untracked-cache.ts +142 -0
  141. package/lib/shell-untracked-lines.ts +178 -0
  142. package/lib/stats-collector.ts +24 -0
  143. package/lib/tower-open.ts +8 -1
  144. package/lib/tps-policy.ts +85 -0
  145. package/lib/vim-editor-adapter.ts +9 -2
  146. package/lib/voice-artifacts.ts +8 -1
  147. package/lib/voice-install.ts +7 -3
  148. package/lib/yolo-session-policy.ts +2 -2
  149. package/package.json +1 -1
  150. package/runtime/gentle-shell-desktop.mjs +85 -0
  151. package/runtime/gentle-shell-launcher.mjs +120 -8
  152. package/runtime/native-review-cli.mjs +206 -390
  153. package/runtime/review-integration-v2.mjs +129 -180
  154. package/runtime/review-risk-assessment.mjs +11 -36
  155. package/runtime/sensitive-paths.mjs +46 -0
  156. package/runtime/tower-open.mjs +8 -1
  157. package/scripts/build-runtime-modules.mjs +2 -0
  158. package/scripts/gentle-ai-installer.mjs +13 -14
  159. package/scripts/installer-preflight.mjs +1 -1
  160. package/scripts/main-channel.mjs +47 -11
  161. package/scripts/pi-update.mjs +10 -4
  162. package/scripts/prepare-verifier.mjs +14 -4
  163. package/scripts/verify-package-files.mjs +45 -13
  164. package/skills/judgment-day/SKILL.md +1 -1
  165. package/skills/judgment-day/references/prompts-and-formats.md +1 -1
  166. package/skills/provider-defect-report/SKILL.md +1 -1
  167. package/skills/rdd-defect-workflow/SKILL.md +2 -2
  168. package/skills/skill-creator/SKILL.md +4 -4
  169. package/skills/skill-improver/SKILL.md +4 -4
  170. package/skills/skill-registry/SKILL.md +2 -2
  171. package/tests/agent-profiles-workflow.test.ts +102 -0
  172. package/tests/agent-risk-escalation.test.ts +15 -0
  173. package/tests/agents-config.test.ts +22 -2
  174. package/tests/agents-protocol.test.ts +1 -1
  175. package/tests/agents-runner.test.ts +94 -2
  176. package/tests/append-system-prompt-route.test.ts +16 -11
  177. package/tests/ask-user-choice.test.ts +19 -0
  178. package/tests/ask-user-question.test.ts +23 -4
  179. package/tests/auto-permission-runtime.test.ts +4 -4
  180. package/tests/bounded-stop-contract.test.ts +50 -62
  181. package/tests/built-web-guard.test.ts +32 -0
  182. package/tests/child-context-files.test.ts +6 -6
  183. package/tests/child-ui-extensions.test.ts +125 -0
  184. package/tests/child-web-package.test.ts +1 -1
  185. package/tests/codex-turn-continuation.test.ts +183 -0
  186. package/tests/committed-range-untracked-exclusion.test.ts +18 -0
  187. package/tests/controlled-engineering-editor.test.ts +192 -0
  188. package/tests/controlled-engineering-launch.test.ts +136 -0
  189. package/tests/controlled-engineering.test.ts +244 -0
  190. package/tests/delegate-for-reason-contract.test.ts +1 -1
  191. package/tests/delivery-b-rendered-surfaces.test.ts +1 -1
  192. package/tests/delivery-conflict-markers.test.ts +2 -3
  193. package/tests/desktop-feed-tool-summaries.test.ts +1 -1
  194. package/tests/desktop-feed-transcript.test.ts +17 -0
  195. package/tests/desktop-feed.test.ts +141 -7
  196. package/tests/desktop-liveness.test.ts +125 -0
  197. package/tests/desktop-persona.test.ts +17 -0
  198. package/tests/desktop-rpc-agent-definitions.test.ts +219 -0
  199. package/tests/desktop-rpc-agents.test.ts +113 -3
  200. package/tests/desktop-rpc-auth.test.ts +278 -0
  201. package/tests/desktop-rpc-background-subagents.test.ts +186 -0
  202. package/tests/desktop-rpc-changes.test.ts +81 -4
  203. package/tests/desktop-rpc-config-mcp-fidelity.test.ts +106 -0
  204. package/tests/desktop-rpc-config-readonly-stores.test.ts +458 -0
  205. package/tests/desktop-rpc-config-settings.test.ts +234 -0
  206. package/tests/desktop-rpc-config.test.ts +17 -3
  207. package/tests/desktop-rpc-design.test.ts +30 -1
  208. package/tests/desktop-rpc-jobs.test.ts +9 -1
  209. package/tests/desktop-rpc-permissions.test.ts +9 -1
  210. package/tests/desktop-rpc-profile-binding.test.ts +195 -0
  211. package/tests/desktop-rpc-review.test.ts +1 -1
  212. package/tests/desktop-rpc-session-snapshot-commands.test.ts +50 -0
  213. package/tests/desktop-rpc-session.test.ts +2 -2
  214. package/tests/desktop-rpc-stats.test.ts +42 -11
  215. package/tests/desktop-rpc-status.test.ts +195 -0
  216. package/tests/desktop-rpc-updates.test.ts +1 -1
  217. package/tests/desktop-rpc-usage.test.ts +9 -1
  218. package/tests/desktop-rpc.test.ts +2 -2
  219. package/tests/desktop-session-switch.test.ts +237 -0
  220. package/tests/desktop-target-session.test.ts +104 -0
  221. package/tests/destructive-command-guard.test.ts +187 -0
  222. package/tests/devbinary/pi-host-relay.devtest.ts +73 -9
  223. package/tests/exploration-budget.test.ts +2 -26
  224. package/tests/fixtures/primary-session-prompt/gentleman.golden.md +15 -11
  225. package/tests/full-delegation-closure.test.ts +19 -9
  226. package/tests/generic-agent-tools.test.ts +3 -3
  227. package/tests/gentle-agents.test.ts +215 -10
  228. package/tests/gentle-ai-binary.test.ts +3 -3
  229. package/tests/gentle-ai-exploration-budget.test.ts +3 -2
  230. package/tests/gentle-ai-installer.test.ts +60 -59
  231. package/tests/gentle-ai.test.ts +30 -59
  232. package/tests/gentle-chat-read-failure.test.ts +74 -0
  233. package/tests/gentle-chat-session-read.test.ts +127 -0
  234. package/tests/gentle-design.test.ts +39 -0
  235. package/tests/gentle-notifications.test.ts +43 -5
  236. package/tests/gentle-shell-desktop.test.ts +108 -0
  237. package/tests/gentle-shell-launcher-auto-provision.test.ts +152 -0
  238. package/tests/gentle-shell-launcher-machine-output.test.ts +356 -0
  239. package/tests/gentle-shell-launcher-tower.test.ts +7 -1
  240. package/tests/gentle-shell.test.ts +163 -15
  241. package/tests/gentle-tps.test.ts +57 -0
  242. package/tests/independent-recovery-delivery.test.ts +15 -13
  243. package/tests/installer-preflight.test.ts +3 -2
  244. package/tests/installer-server.test.ts +3 -2
  245. package/tests/installer-windows-bootstrap.test.ts +6 -0
  246. package/tests/job-turn-end-texts.test.ts +57 -0
  247. package/tests/judgment-day-dispatch-diagnostics.test.ts +87 -0
  248. package/tests/lazy-module-contradictions-contract.test.ts +2 -3
  249. package/tests/main-channel-upgrade.test.ts +14 -7
  250. package/tests/main-channel.test.ts +78 -23
  251. package/tests/maintainer/desktop-rpc.maintest.ts +4 -4
  252. package/tests/native-fullscreen-interaction.test.ts +37 -1
  253. package/tests/native-review-capability-contract.test.ts +13 -1
  254. package/tests/native-review-cli-nonblocking-findings.test.ts +9 -84
  255. package/tests/native-review-cli.test.ts +199 -21
  256. package/tests/native-review-consent.test.ts +20 -3
  257. package/tests/native-review-start-escalation-real-binary.test.ts +42 -0
  258. package/tests/no-self-pause-contract.test.ts +8 -7
  259. package/tests/odd-phase-inference.test.ts +2 -2
  260. package/tests/odd-routing-canonical-ratchet.test.ts +1 -1
  261. package/tests/odd-routing-contract.test.ts +2 -2
  262. package/tests/orchestrator-budget.test.ts +7 -2
  263. package/tests/orchestrator-prompt-diet-contract.test.ts +5 -5
  264. package/tests/orchestrator-skills-inline-contract.test.ts +26 -0
  265. package/tests/package-manifest.test.ts +11 -16
  266. package/tests/packaged-agent-codemode.test.ts +79 -0
  267. package/tests/path-consent-fence.test.ts +326 -0
  268. package/tests/persona-config.test.ts +42 -0
  269. package/tests/pi-update-launcher.test.ts +1 -1
  270. package/tests/pi-update-source.test.ts +48 -2
  271. package/tests/primary-session-prompt.test.ts +9 -7
  272. package/tests/profile-fast-tier.test.ts +79 -4
  273. package/tests/progress-rule-contract.test.ts +54 -0
  274. package/tests/rdd-delivery-warning.test.ts +109 -0
  275. package/tests/review-actor-tool-deny.test.ts +1 -2
  276. package/tests/review-agent-end-preflight.test.ts +3 -1
  277. package/tests/review-assess-escalation-forwarding.test.ts +99 -0
  278. package/tests/review-authority-recovery-docs.test.ts +9 -12
  279. package/tests/review-continuation-registry.test.ts +24 -25
  280. package/tests/review-controller-native-recovery.test.ts +165 -178
  281. package/tests/review-controller-native-routing.test.ts +352 -27
  282. package/tests/review-coordinator-correction-gate.test.ts +5 -9
  283. package/tests/review-coordinator-runtime.test.ts +3 -2
  284. package/tests/review-coordinator.test.ts +14 -0
  285. package/tests/review-due-compaction.test.ts +1 -1
  286. package/tests/review-failure-facts.test.ts +2 -2
  287. package/tests/review-host-relay-restart-parity.test.ts +2 -52
  288. package/tests/review-host-relay-routing.test.ts +59 -298
  289. package/tests/review-host-relay.test.ts +0 -46
  290. package/tests/review-integration-nonblocking-findings.test.ts +3 -6
  291. package/tests/review-integration-v2-forward.test.ts +114 -234
  292. package/tests/review-integration-v2.test.ts +85 -39
  293. package/tests/review-json-arguments.test.ts +30 -9
  294. package/tests/review-legacy-check.test.ts +38 -0
  295. package/tests/review-object-store.test.ts +2 -57
  296. package/tests/review-one-call-findings.test.ts +1 -0
  297. package/tests/review-one-call.test.ts +56 -0
  298. package/tests/review-risk-assessment.test.ts +14 -43
  299. package/tests/review-run-escalate-forwarding.test.ts +59 -0
  300. package/tests/review-sidebar-state.test.ts +2 -1
  301. package/tests/review-untracked-inventory-replay.test.ts +181 -0
  302. package/tests/runtime-harness.mjs +30 -4
  303. package/tests/sensitive-path-tools.test.ts +210 -5
  304. package/tests/session-profile-binding-observers.test.ts +47 -0
  305. package/tests/session-profile-extension.test.ts +109 -11
  306. package/tests/session-profile-freeze.test.ts +49 -2
  307. package/tests/session-profile-v1-compat.test.ts +11 -3
  308. package/tests/session-worktree-registry.test.ts +23 -0
  309. package/tests/shell-bar.test.ts +21 -3
  310. package/tests/shell-changes-idle-start.test.ts +510 -0
  311. package/tests/shell-changes-untracked-bound.test.ts +230 -0
  312. package/tests/shell-changes-view.test.ts +8 -2
  313. package/tests/shell-changes.test.ts +134 -0
  314. package/tests/shell-git-runner-stall.test.ts +74 -0
  315. package/tests/shell-git-worker-fallback.test.ts +140 -0
  316. package/tests/shell-git-worker-lifetime.test.ts +91 -0
  317. package/tests/shell-render-cache-runtime.test.ts +256 -3
  318. package/tests/shell-sidebar-layout.test.ts +1 -1
  319. package/tests/shell-sidebar-scroll-benchmark.test.ts +14 -5
  320. package/tests/shell-untracked-cache.test.ts +213 -0
  321. package/tests/short-check-routing-contract.test.ts +11 -7
  322. package/tests/skill-references.test.ts +39 -0
  323. package/tests/skill-registry.test.ts +4 -4
  324. package/tests/startup-banner.test.ts +2 -1
  325. package/tests/status-timing-diagnostics.test.ts +2 -1
  326. package/tests/support/capabilities-v26.ts +22 -0
  327. package/tests/support/chat-ui.ts +39 -0
  328. package/tests/support/review-coordinator-runtime.ts +11 -2
  329. package/tests/support/status-v9.ts +8 -0
  330. package/tests/t7-recovery-preservation.test.ts +68 -0
  331. package/tests/tower-open.test.ts +24 -0
  332. package/tests/tower-pack.test.ts +48 -0
  333. package/tests/tps-policy.test.ts +96 -0
  334. package/tests/turn-end-rule-contract.test.ts +155 -0
  335. package/tests/turn-end-scope.test.ts +39 -0
  336. package/tests/verification-proportionality.test.ts +1 -1
  337. package/tests/verification-scoped-stop-contract.test.ts +1 -1
  338. package/tests/verification-tiers-contract.test.ts +4 -3
  339. package/tests/verifier-admission.test.ts +1 -1
  340. package/tests/verifier-preparation.test.ts +94 -1
  341. package/tests/verifier-settle-reminder.test.ts +1 -1
  342. package/tests/verify-first-launch-contract.test.ts +19 -7
  343. package/tests/vim-editor-adapter.test.ts +12 -2
  344. package/tests/voice-install.test.ts +97 -11
  345. package/tests/windows-hidden-processes.test.ts +11 -44
  346. package/tests/work-continuity-contract.test.ts +48 -55
  347. package/tests/yolo-session-policy.test.ts +2 -0
  348. package/web/tower/dist/assets/BatchableSprite-BJ_TQxjN.js +217 -0
  349. package/web/tower/dist/assets/BufferResource-DeJpHuO6.js +139 -0
  350. package/web/tower/dist/assets/CanvasPool-cwc03T_x.js +23 -0
  351. package/web/tower/dist/assets/CanvasRenderer-DO84oP5R.js +1 -0
  352. package/web/tower/dist/assets/Filter-BKhT9lO8.js +1 -0
  353. package/web/tower/dist/assets/GlUniformGroupSystem-DluI7cqd.js +130 -0
  354. package/web/tower/dist/assets/GpuUboSystem-CM4Dys0F.js +17 -0
  355. package/web/tower/dist/assets/Graphics-3OyUtCzC.js +1 -0
  356. package/web/tower/dist/assets/RenderTargetSystem-X-9GAQ1C.js +184 -0
  357. package/web/tower/dist/assets/WebGLRenderer-I0fqIX1w.js +20 -0
  358. package/web/tower/dist/assets/WebGPURenderer-BRWSXotK.js +79 -0
  359. package/web/tower/dist/assets/_commonjsHelpers-CqkleIqs.js +1 -0
  360. package/web/tower/dist/assets/abnfDiagram-VCTEODGH-C4iBBhTL.js +1 -0
  361. package/web/tower/dist/assets/architectureDiagram-5GKGNRK7-Ih-qvfTu.js +36 -0
  362. package/web/tower/dist/assets/blockDiagram-I7D4REHJ-I9z_u3wb.js +129 -0
  363. package/web/tower/dist/assets/browserAll-gmBFNIA4.js +14 -0
  364. package/web/tower/dist/assets/c4Diagram-7LVT6UL2-DOyk2rEJ.js +38 -0
  365. package/web/tower/dist/assets/canvasUtils-DTaMcbkN.js +1 -0
  366. package/web/tower/dist/assets/channel-wuxBkGGz.js +1 -0
  367. package/web/tower/dist/assets/chunk-2Q5K7J3B-BaJ-OrJ_.js +1 -0
  368. package/web/tower/dist/assets/chunk-5VM5RSS4-wICrhvyw.js +15 -0
  369. package/web/tower/dist/assets/chunk-F27PBJKO-DUQ_JqvZ.js +1 -0
  370. package/web/tower/dist/assets/chunk-IMKFNOWR-DKfgQrGM.js +231 -0
  371. package/web/tower/dist/assets/chunk-JWPE2WC7-1k1LW87d.js +1 -0
  372. package/web/tower/dist/assets/chunk-POPQ4Y6H-Df8cN2w9.js +1 -0
  373. package/web/tower/dist/assets/chunk-SVP7TREG-CxU5LDj8.js +88 -0
  374. package/web/tower/dist/assets/chunk-TICWLB2K-CEuHEBi0.js +206 -0
  375. package/web/tower/dist/assets/chunk-XXDRQBXY-CbSAjj9l.js +1 -0
  376. package/web/tower/dist/assets/classDiagram-ZZMXUADV-DbRmVQRX.js +1 -0
  377. package/web/tower/dist/assets/classDiagram-v2-VYDZK3BY-DbRmVQRX.js +1 -0
  378. package/web/tower/dist/assets/cose-bilkent-JH36ORCC-8xZLSHER.js +1 -0
  379. package/web/tower/dist/assets/cynefin-OW5HDTMX-Cw4XG9Zj.js +166 -0
  380. package/web/tower/dist/assets/cynefinDiagram-5FMLGOSQ-CcQdokUv.js +62 -0
  381. package/web/tower/dist/assets/cytoscape.esm-BHa1VTXv.js +321 -0
  382. package/web/tower/dist/assets/d3-scale-4DPf7zan.js +1 -0
  383. package/web/tower/dist/assets/dagre-GXQ25YYZ-D-Xv7L9X.js +4 -0
  384. package/web/tower/dist/assets/diagram-S7CK7UJ4-Bqy2eT2c.js +30 -0
  385. package/web/tower/dist/assets/diagram-UQ7AKVKN-B2wK2GHj.js +41 -0
  386. package/web/tower/dist/assets/diagram-VSXAHHWV-CIZqh7BH.js +3 -0
  387. package/web/tower/dist/assets/diagram-VX7I27RA-BGX4HBj2.js +24 -0
  388. package/web/tower/dist/assets/diagram-Z3DM3KII-DYpsfaJW.js +24 -0
  389. package/web/tower/dist/assets/ebnfDiagram-PWID7BFC-BNnwCZNv.js +1 -0
  390. package/web/tower/dist/assets/erDiagram-RLTQ6QDP-_MN9W-1E.js +99 -0
  391. package/web/tower/dist/assets/flowDiagram-HODETNUW-D_ndx1UC.js +168 -0
  392. package/web/tower/dist/assets/ganttDiagram-EL5Y4UJY-C8chdEiZ.js +292 -0
  393. package/web/tower/dist/assets/getPo2TextureFromSource-CqJsdi0J.js +1 -0
  394. package/web/tower/dist/assets/getTexelRangeRects-DN3N5aFp.js +57 -0
  395. package/web/tower/dist/assets/getTextureBatchBindGroup-RNSiAVH3.js +1 -0
  396. package/web/tower/dist/assets/gitGraphDiagram-WWUBYQGX-B5ijv7LI.js +106 -0
  397. package/web/tower/dist/assets/index-B1Ho-Igs.css +1 -0
  398. package/web/tower/dist/assets/index-CfNjH1Wr.js +45 -0
  399. package/web/tower/dist/assets/infoDiagram-27XIBGKW-AYbp5ElT.js +2 -0
  400. package/web/tower/dist/assets/ishikawaDiagram-5VMMS53U-DnmwARuR.js +70 -0
  401. package/web/tower/dist/assets/journeyDiagram-3NMN7TZE-CK737kko.js +139 -0
  402. package/web/tower/dist/assets/kanban-definition-UXKFOSKX-0AhM3axC.js +89 -0
  403. package/web/tower/dist/assets/katex-HP8lGamR.js +257 -0
  404. package/web/tower/dist/assets/layout-wOIeK9c_.js +1 -0
  405. package/web/tower/dist/assets/mermaid.core-CGYyw6G7.js +310 -0
  406. package/web/tower/dist/assets/mindmap-definition-YA3MSWOX-CkZ_JOdx.js +96 -0
  407. package/web/tower/dist/assets/pegDiagram-XKGWAZYB-CHAPspih.js +1 -0
  408. package/web/tower/dist/assets/pieDiagram-E7YTZNPT-LwCcZl5o.js +39 -0
  409. package/web/tower/dist/assets/preload-helper-PPVm8Dsz.js +1 -0
  410. package/web/tower/dist/assets/quadrantDiagram-AXDQQJYC-Cm4uijV2.js +7 -0
  411. package/web/tower/dist/assets/railroadDiagram-O6MQD6OU-BPQHZ2b5.js +1 -0
  412. package/web/tower/dist/assets/requirementDiagram-BXWQKSXE-JLtSUDfS.js +84 -0
  413. package/web/tower/dist/assets/sankeyDiagram-P5KCCOFB-DJsYv9ii.js +40 -0
  414. package/web/tower/dist/assets/sequenceDiagram-WJ2MYXX4-Ca8T8sT0.js +162 -0
  415. package/web/tower/dist/assets/sizeCapture-INFHLROL-Ch4i2dS-.js +1 -0
  416. package/web/tower/dist/assets/stateDiagram-D77RDMKH-DDSkncYm.js +1 -0
  417. package/web/tower/dist/assets/stateDiagram-v2-MP3YSRHH-BkO_9mIH.js +1 -0
  418. package/web/tower/dist/assets/swimlanes-42K2YHIH-Bns5iI3y.js +1 -0
  419. package/web/tower/dist/assets/swimlanesDiagram-VR7AAH4N--LEBb1ti.js +8 -0
  420. package/web/tower/dist/assets/timeline-definition-24CTP7MA-QJDuVTb3.js +120 -0
  421. package/web/tower/dist/assets/vennDiagram-4TSXK5OY-pBNxKxOV.js +34 -0
  422. package/web/tower/dist/assets/wardleyDiagram-VM6X3IG4-1PEarjN1.js +78 -0
  423. package/web/tower/dist/assets/webworkerAll-D_Np003p.js +83 -0
  424. package/web/tower/dist/assets/xychartDiagram-S5SC5T6Z-CLwsvOg7.js +7 -0
  425. package/web/tower/dist/index.html +41 -0
  426. package/contracts/review-provider-contract-mirror/v1.6.0/bundle/vectors/lens.json +0 -1
  427. package/docs/review-delivery-preflight.md +0 -22
  428. package/extensions/codegraph-tools.ts +0 -437
  429. package/lib/native-review-authority-quarantine.ts +0 -2
  430. package/lib/review-delivery-preflight.ts +0 -85
  431. package/lib/review-legacy-detector.ts +0 -81
  432. package/tests/child-codegraph-bootstrap.test.ts +0 -74
  433. package/tests/codegraph-tools.test.ts +0 -554
  434. package/tests/fixtures/devbinary/capabilities-v2.1.derived.json +0 -331
  435. package/tests/fixtures/refusal-identity.probe.mjs +0 -139
  436. package/tests/native-review-authority-quarantine.test.ts +0 -10
  437. package/tests/native-review-refusal-identity.test.ts +0 -25
  438. package/tests/review-delivery-preflight.test.ts +0 -462
  439. /package/contracts/review-provider-contract-mirror/{v1.6.0 → v1.7.0}/bundle/README.md +0 -0
  440. /package/contracts/review-provider-contract-mirror/{v1.6.0 → v1.7.0}/bundle/schemas/refuter.schema.json +0 -0
  441. /package/contracts/review-provider-contract-mirror/{v1.6.0 → v1.7.0}/bundle/schemas/targeted-validator.schema.json +0 -0
  442. /package/contracts/review-provider-contract-mirror/{v1.6.0 → v1.7.0}/bundle/vectors/refuter.json +0 -0
  443. /package/contracts/review-provider-contract-mirror/{v1.6.0 → v1.7.0}/bundle/vectors/targeted-validator.json +0 -0
@@ -18,10 +18,13 @@ import {
18
18
  decodeReviewStatusV3,
19
19
  decodeReviewTargetedValidationRequestV1,
20
20
  } from "../lib/review-integration-v2.ts";
21
+ import { capabilitiesV26 } from "./support/capabilities-v26.ts";
22
+ import { statusV9 } from "./support/status-v9.ts";
21
23
 
22
24
  const fixtureRoot = join(process.cwd(), "contracts", "review-integration", "v2", "fixtures");
23
25
  const devFixtureRoot = join(process.cwd(), "tests", "fixtures", "devbinary");
24
26
  const fixture = <T = unknown>(name: string): T => JSON.parse(readFileSync(join(fixtureRoot, name), "utf8")) as T;
27
+ const capabilitiesFixture = <T = Record<string, unknown>>(): T => capabilitiesV26(fixture<Record<string, unknown>>("capabilities.fixture.json")) as T;
25
28
  const devFixture = <T = unknown>(name: string): T => JSON.parse(readFileSync(join(devFixtureRoot, name), "utf8")) as T;
26
29
  const executableDigest = "dcc846103b16d365eaeeb9d7f289c23fc4f2897f23def1cb3fe7f05557b64705";
27
30
  const digest = `sha256:${"a".repeat(64)}`;
@@ -60,13 +63,13 @@ function assertAdditionalProperty(decoder: Decoder, source: JsonObject, path: re
60
63
  }
61
64
 
62
65
  test("current review integration fixtures decode", () => {
63
- assert.equal(decodeReviewCapabilitiesV2(fixture("capabilities.fixture.json"), executableDigest).contract, REVIEW_INTEGRATION_CONTRACT);
66
+ assert.equal(decodeReviewCapabilitiesV2(capabilitiesFixture(), executableDigest).contract, REVIEW_INTEGRATION_CONTRACT);
64
67
  assert.equal(decodeReviewStartV3(fixture("start.fixture.json")).riskLevel, "high");
65
68
  assert.equal(decodeReviewConsentV2(fixture("consent.fixture.json")).action, "consent_required");
66
69
  });
67
70
 
68
71
  test("capabilities enforce every required top-level and nested property", () => {
69
- const source = fixture<JsonObject>("capabilities.fixture.json");
72
+ const source = capabilitiesFixture<JsonObject>();
70
73
  const decode: Decoder = (value) => decodeReviewCapabilitiesV2(value, executableDigest);
71
74
  assertRequired(decode, source, ["schema", "contract", "protocol", "package", "build", "executable", "operations", "gates", "projections", "schemas", "features", "compatibility"]);
72
75
  assertNestedRequired(decode, source, ["protocol"], ["major", "minor"]);
@@ -74,11 +77,62 @@ test("capabilities enforce every required top-level and nested property", () =>
74
77
  assertNestedRequired(decode, source, ["build"], ["id", "go_version", "module_version", "vcs", "vcs_revision", "vcs_time", "vcs_modified"]);
75
78
  assertNestedRequired(decode, source, ["executable"], ["sha256", "evidence", "verification"]);
76
79
  assertNestedRequired(decode, source, ["features"], ["mandatory", "optional"]);
77
- assertNestedRequired(decode, source, ["compatibility"], ["minimum_protocol_major", "maximum_protocol_major", "additive_minor_policy", "unknown_mandatory", "unknown_optional", "modes", "legacy_window"]);
80
+ assertNestedRequired(decode, source, ["compatibility"], ["minimum_protocol_major", "maximum_protocol_major", "additive_minor_policy", "unknown_mandatory", "unknown_optional", "modes"]);
81
+ });
82
+
83
+ test("capabilities v2.6 keep decoding the legacy-announcing v4.6.0 advertisement", () => {
84
+ const source = capabilitiesFixture<JsonObject>();
85
+ const features = source.features as { mandatory: Array<{ name: string }> };
86
+ assert.ok(features.mandatory.some((feature) => feature.name === "legacy_v1_target_scoped_read_only"));
87
+ assert.deepEqual((source.compatibility as JsonObject).modes, ["compact-v2", "legacy-v1"]);
88
+ const decoded = decodeReviewCapabilitiesV2(source, executableDigest);
89
+ assert.ok(decoded.mandatoryFeatures.has("legacy_v1_target_scoped_read_only"));
90
+ assert.equal(decoded.mandatoryFeatures.size, 7);
91
+ });
92
+
93
+ test("capabilities v2.6 without legacy feature, with compact-v2 only modes and no legacy_window decode", () => {
94
+ const source = capabilitiesFixture<JsonObject>();
95
+ const features = source.features as { mandatory: Array<{ name: string }> };
96
+ features.mandatory = features.mandatory.filter((feature) => feature.name !== "legacy_v1_target_scoped_read_only");
97
+ const compatibility = source.compatibility as JsonObject;
98
+ compatibility.modes = ["compact-v2"];
99
+ delete compatibility.legacy_window;
100
+ const decoded = decodeReviewCapabilitiesV2(source, executableDigest);
101
+ assert.equal(decoded.mandatoryFeatures.has("legacy_v1_target_scoped_read_only"), false);
102
+ assert.equal(decoded.mandatoryFeatures.size, 6);
103
+ // modes ["compact-v2","legacy-v1"] without a legacy_window also decodes.
104
+ compatibility.modes = ["compact-v2", "legacy-v1"];
105
+ assert.doesNotThrow(() => decodeReviewCapabilitiesV2(source, executableDigest));
106
+ });
107
+
108
+ test("capabilities v2.6 refuse unsupported modes and a malformed legacy_window", () => {
109
+ const decode = (value: JsonObject) => decodeReviewCapabilitiesV2(value, executableDigest);
110
+ for (const modes of [["legacy-v1"], ["compact-v2", "unknown"], ["unknown"], ["legacy-v1", "compact-v2"], [], ["compact-v2", "compact-v2"], ["compact-v2", "legacy-v1", "extra"]]) {
111
+ const candidate = capabilitiesFixture<JsonObject>();
112
+ (candidate.compatibility as JsonObject).modes = modes;
113
+ assert.throws(() => decode(candidate), undefined, JSON.stringify(modes));
114
+ }
115
+ const badWindow = capabilitiesFixture<JsonObject>();
116
+ ((badWindow.compatibility as JsonObject).legacy_window as JsonObject).state = "bogus";
117
+ assert.throws(() => decode(badWindow), /legacy_window\.state/);
118
+ const extraWindow = capabilitiesFixture<JsonObject>();
119
+ ((extraWindow.compatibility as JsonObject).legacy_window as JsonObject).unadvertised = true;
120
+ assert.throws(() => decode(extraWindow), /not allowed/);
121
+ const missingField = capabilitiesFixture<JsonObject>();
122
+ delete ((missingField.compatibility as JsonObject).legacy_window as JsonObject).removal;
123
+ assert.throws(() => decode(missingField), /removal is required/);
124
+ const duplicateLegacy = capabilitiesFixture<JsonObject>();
125
+ const mandatory = (duplicateLegacy.features as { mandatory: Array<{ name: string }> }).mandatory;
126
+ mandatory.push(structuredClone(mandatory.find((feature) => feature.name === "legacy_v1_target_scoped_read_only")!));
127
+ assert.throws(() => decode(duplicateLegacy));
128
+ const missingRequired = capabilitiesFixture<JsonObject>();
129
+ const m2 = (missingRequired.features as { mandatory: Array<{ name: string }> }).mandatory;
130
+ (missingRequired.features as { mandatory: unknown }).mandatory = m2.filter((feature) => feature.name !== "compact_v2_authority");
131
+ assert.throws(() => decode(missingRequired), /mandatory capabilities/);
78
132
  });
79
133
 
80
134
  test("capabilities reject additional properties at every exact object boundary", () => {
81
- const source = fixture<JsonObject>("capabilities.fixture.json");
135
+ const source = capabilitiesFixture<JsonObject>();
82
136
  const decode: Decoder = (value) => decodeReviewCapabilitiesV2(value, executableDigest);
83
137
  for (const path of [[], ["protocol"], ["package"], ["build"], ["executable"], ["features"], ["compatibility"], ["compatibility", "legacy_window"]] as const) {
84
138
  assertAdditionalProperty(decode, source, path);
@@ -86,7 +140,7 @@ test("capabilities reject additional properties at every exact object boundary",
86
140
  });
87
141
 
88
142
  test("capabilities reject an incompatible protocol identity", () => {
89
- const source = fixture<JsonObject>("capabilities.fixture.json");
143
+ const source = capabilitiesFixture<JsonObject>();
90
144
  const decode: Decoder = (value) => decodeReviewCapabilitiesV2(value, executableDigest);
91
145
  const wrongMajor = clone(source);
92
146
  (wrongMajor.protocol as JsonObject).major = 1;
@@ -151,10 +205,10 @@ test("start/v3 transports the published selected_lenses wire contract without Pi
151
205
  assert.throws(() => decodeReviewStartV3(invalidLensesRequired), /lenses_required/);
152
206
  });
153
207
 
154
- test("historical status fixture with a receipt is rejected after receipt retirement", () => {
208
+ test("historical status fixture with a receipt is refused as older than the supported status/v9", () => {
155
209
  // This archived fixture is pinned for schema-rejection coverage only. Its
156
210
  // bytes retain the retired receipt surface and must never regain authority.
157
- assert.throws(() => decodeReviewStatusV3(fixture("status.fixture.json")), /receipt.*not allowed/);
211
+ assert.throws(() => decodeReviewStatusV3(fixture("status.fixture.json")), /status\/v3 is older than the supported v9/);
158
212
  });
159
213
 
160
214
  test("projection enforces every required property and rejects additional keys", () => {
@@ -290,7 +344,7 @@ test("repair execute-without-execution is rejected", () => {
290
344
  });
291
345
 
292
346
  test("capabilities enforce the exact mandatory feature set while accepting a superset of advertised operations", () => {
293
- const source = fixture<JsonObject>("capabilities.fixture.json");
347
+ const source = capabilitiesFixture<JsonObject>();
294
348
  const decode = (value: unknown) => decodeReviewCapabilitiesV2(value, executableDigest);
295
349
  const decoded = decode(source) as { mandatoryFeatures: ReadonlySet<string>; operations: ReadonlySet<string> };
296
350
  assert.equal(decoded.mandatoryFeatures.has("compact_v2_authority"), true);
@@ -316,7 +370,7 @@ test("capabilities enforce the exact mandatory feature set while accepting a sup
316
370
  });
317
371
 
318
372
  test("capabilities gates and projections accept an additive superset beyond the required floor", () => {
319
- const source = fixture<JsonObject>("capabilities.fixture.json");
373
+ const source = capabilitiesFixture<JsonObject>();
320
374
  const decode = (value: unknown) => decodeReviewCapabilitiesV2(value, executableDigest);
321
375
 
322
376
  const extraGate = clone(source);
@@ -339,7 +393,7 @@ test("capabilities gates and projections accept an additive superset beyond the
339
393
  });
340
394
 
341
395
  test("capabilities gates and projections still enforce the required floor", () => {
342
- const source = fixture<JsonObject>("capabilities.fixture.json");
396
+ const source = capabilitiesFixture<JsonObject>();
343
397
  const decode = (value: unknown) => decodeReviewCapabilitiesV2(value, executableDigest);
344
398
 
345
399
  const missingGate = clone(source);
@@ -839,7 +893,7 @@ test("next_transition decodes the self-contained provider role capture vectors s
839
893
  }] },
840
894
  });
841
895
 
842
- const decodeRoleTransition = (value: unknown) => decodeReviewNextTransitionV3(value, { v5: true });
896
+ const decodeRoleTransition = (value: unknown) => decodeReviewNextTransitionV3(value, { v9: true });
843
897
  const refuter = roleInput("provider_refuter", "review.capture-refuter", "https://gentle-ai.dev/schema/review/refuter/v1");
844
898
  const decodedRefuter = decodeRoleTransition(refuter);
845
899
  assert.equal(decodedRefuter.collect?.inputs[0]?.captureOperation, "review.capture-refuter");
@@ -849,11 +903,11 @@ test("next_transition decodes the self-contained provider role capture vectors s
849
903
  () => decodeRoleTransition(roleInput("provider_refuter", "review.capture-refuter", "https://gentle-ai.dev/schema/review/reviewer/v1")),
850
904
  /schema must be https:\/\/gentle-ai\.dev\/schema\/review\/refuter\/v1/,
851
905
  );
852
- // This fixture decodes on the v5 surface only (no v9): a submission
853
- // descriptor on a role input is rejected for lacking the v9 provider
854
- // contract, before the materialize/execute discriminator is even read.
906
+ // Outside the status/v9 surface (the embedded START/v4 transition) a
907
+ // submission descriptor on a role input is rejected for lacking the v9
908
+ // provider contract, before the materialize/execute discriminator is read.
855
909
  assert.throws(
856
- () => decodeRoleTransition(roleInput("provider_refuter", "review.capture-refuter", "https://gentle-ai.dev/schema/review/refuter/v1", {
910
+ () => decodeReviewNextTransitionV3(roleInput("provider_refuter", "review.capture-refuter", "https://gentle-ai.dev/schema/review/refuter/v1", {
857
911
  submission: { operation_token: "capture-refuter", argument_tokens: ["--input={{value}}"], values: [{ slot: "{{value}}", domain: "artifact-path", substitution_location: 0 }] },
858
912
  })),
859
913
  /submission requires the v9 provider contract/,
@@ -911,11 +965,10 @@ test("next_transition decodes the v9 host-mediated provider role submission form
911
965
  substitutionLocation: materializeArguments.length,
912
966
  }]);
913
967
 
914
- // The exact same payload under v8 (or any earlier non-v9 rung) is
915
- // rejected: v8 only extended the reviewer-result transition for OpenCode
916
- // provider tasks and never renders a role submission descriptor.
968
+ // Outside the status/v9 surface (the embedded START/v4 transition) the same
969
+ // payload is still rejected: only status/v9 renders a role submission.
917
970
  assert.throws(
918
- () => decodeReviewNextTransitionV3(refuter, { v6: true }),
971
+ () => decodeReviewNextTransitionV3(refuter),
919
972
  /submission requires the v9 provider contract/,
920
973
  );
921
974
 
@@ -1035,7 +1088,7 @@ test("v5 targeted-validator collect inputs carry the exact provider-owned valida
1035
1088
  validation_request: validationRequest,
1036
1089
  };
1037
1090
  const transition = { kind: "collect" as const, reason_code: "targeted_validation_required", collect: { inputs: [input] } };
1038
- const decoded = decodeReviewNextTransitionV3(transition, { v5: true });
1091
+ const decoded = decodeReviewNextTransitionV3(transition, { v9: true });
1039
1092
  const decodedRequest = decoded.collect?.inputs[0]?.validationRequest;
1040
1093
  assert.equal(decodedRequest?.requestHash, requestHash);
1041
1094
  assert.equal(decodedRequest?.correctionTargetIdentity, correctionTargetIdentity);
@@ -1083,42 +1136,35 @@ test("v5 targeted-validator collect inputs carry the exact provider-owned valida
1083
1136
  }]);
1084
1137
  assert.equal(decodedHostMediated.collect?.inputs[0]?.validationRequest?.requestHash, requestHash);
1085
1138
 
1086
- // The identical v8 surface (v6/v7/v8 all decode collect inputs alike)
1087
- // rejects the same host-mediated submission: only v9 renders it.
1088
- assert.throws(
1089
- () => decodeReviewNextTransitionV3(hostMediatedTransition, { v6: true }),
1090
- /submission requires the v9 provider contract/,
1091
- );
1092
-
1093
1139
  const missingRequest = clone(transition);
1094
1140
  delete (missingRequest.collect.inputs[0] as JsonObject).validation_request;
1095
- assert.throws(() => decodeReviewNextTransitionV3(missingRequest, { v5: true }), /validation_request is required/);
1141
+ assert.throws(() => decodeReviewNextTransitionV3(missingRequest, { v9: true }), /validation_request is required/);
1096
1142
 
1097
1143
  const mismatchedRequestHash = clone(transition);
1098
1144
  ((mismatchedRequestHash.collect.inputs[0] as JsonObject).validation_request as JsonObject).request_hash = `sha256:${"0".repeat(64)}`;
1099
- assert.throws(() => decodeReviewNextTransitionV3(mismatchedRequestHash, { v5: true }), /request-hash/);
1145
+ assert.throws(() => decodeReviewNextTransitionV3(mismatchedRequestHash, { v9: true }), /request-hash/);
1100
1146
 
1101
1147
  const refuter = clone(transition);
1102
1148
  const refuterInput = refuter.collect.inputs[0] as JsonObject;
1103
1149
  refuterInput.name = "provider_refuter";
1104
1150
  refuterInput.schema = "https://gentle-ai.dev/schema/review/refuter/v1";
1105
1151
  refuterInput.capture_operation = "review.capture-refuter";
1106
- assert.throws(() => decodeReviewNextTransitionV3(refuter, { v5: true }), /validation_request.*targeted-validator/);
1152
+ assert.throws(() => decodeReviewNextTransitionV3(refuter, { v9: true }), /validation_request.*targeted-validator/);
1107
1153
 
1108
1154
  const malformedRequest = clone(transition);
1109
1155
  ((malformedRequest.collect.inputs[0] as JsonObject).validation_request as JsonObject).unadvertised = true;
1110
- assert.throws(() => decodeReviewNextTransitionV3(malformedRequest, { v5: true }), /not allowed/);
1156
+ assert.throws(() => decodeReviewNextTransitionV3(malformedRequest, { v9: true }), /not allowed/);
1111
1157
 
1112
1158
  const emptyPolicyRequest = clone(transition);
1113
1159
  ((emptyPolicyRequest.collect.inputs[0] as JsonObject).validation_request as JsonObject).policy_content = "";
1114
- assert.equal(decodeReviewNextTransitionV3(emptyPolicyRequest, { v5: true }).collect?.inputs[0]?.validationRequest?.policyContent, "");
1160
+ assert.equal(decodeReviewNextTransitionV3(emptyPolicyRequest, { v9: true }).collect?.inputs[0]?.validationRequest?.policyContent, "");
1115
1161
  const malformedPolicyRequest = clone(transition);
1116
1162
  ((malformedPolicyRequest.collect.inputs[0] as JsonObject).validation_request as JsonObject).policy_content = null;
1117
- assert.throws(() => decodeReviewNextTransitionV3(malformedPolicyRequest, { v5: true }), /policy_content/);
1163
+ assert.throws(() => decodeReviewNextTransitionV3(malformedPolicyRequest, { v9: true }), /policy_content/);
1118
1164
  });
1119
1165
 
1120
1166
  test("status.frozen carries the optional frozen manifest digest", () => {
1121
- const current = devFixture<JsonObject>("status-v5-repository-context.captured.json");
1167
+ const current = statusV9(devFixture<JsonObject>("status-v5-repository-context.captured.json"));
1122
1168
  delete current.receipt;
1123
1169
  if (current.action === "finalize") {
1124
1170
  current.action = "stop";
@@ -1141,18 +1187,18 @@ test("a capture-result collect input decodes without changed_path_manifest, whic
1141
1187
  const inputs = ((transition.collect as JsonObject | undefined)?.inputs ?? []) as JsonObject[];
1142
1188
  const captureInput = inputs.find((input) => input.capture_operation === "review.capture-result");
1143
1189
  assert.ok(captureInput, "the status fixture carries a capture-result collect input");
1144
- assert.doesNotThrow(() => decodeReviewNextTransitionV3(transition, { v5: true, v6: true }), "with the manifest");
1190
+ assert.doesNotThrow(() => decodeReviewNextTransitionV3(transition, { v9: true }), "with the manifest");
1145
1191
  delete captureInput.changed_path_manifest;
1146
- const decoded = decodeReviewNextTransitionV3(transition, { v5: true, v6: true });
1192
+ const decoded = decodeReviewNextTransitionV3(transition, { v9: true });
1147
1193
  const decodedInput = decoded.collect?.inputs.find((input) => input.captureOperation === "review.capture-result");
1148
1194
  assert.ok(decodedInput?.artifactSubject?.changedPathManifestSha256, "the digest on the artifact subject is the binding");
1149
1195
  assert.equal(decodedInput?.changedPathManifest, undefined);
1150
1196
  delete captureInput.artifact_subject;
1151
- assert.throws(() => decodeReviewNextTransitionV3(transition, { v5: true, v6: true }), /requires artifact_subject, base_tree, and candidate_tree/);
1197
+ assert.throws(() => decodeReviewNextTransitionV3(transition, { v9: true }), /requires artifact_subject, base_tree, and candidate_tree/);
1152
1198
  });
1153
1199
 
1154
1200
  test("status enforces authority/frozen/receipt conditionals and decodes the required repair field", () => {
1155
- const current = devFixture<JsonObject>("status-v5-repository-context.captured.json");
1201
+ const current = statusV9(devFixture<JsonObject>("status-v5-repository-context.captured.json"));
1156
1202
  delete current.receipt;
1157
1203
  if (current.action === "finalize") {
1158
1204
  current.action = "stop";
@@ -1192,7 +1238,7 @@ test("next_transition.execute.binding stays open, as its schema declares no prop
1192
1238
  });
1193
1239
 
1194
1240
  test("capabilities retain request-context and START preflight features only when supported", () => {
1195
- const source = fixture<any>("capabilities.fixture.json");
1241
+ const source = capabilitiesFixture<any>();
1196
1242
  source.features.optional.push({ name: "start_request_context", supported: true, requires: [] }, { name: "start_options_preflight", supported: false, requires: [] });
1197
1243
  const result = decodeReviewCapabilitiesV2(source, executableDigest);
1198
1244
  assert.equal(result.optionalFeatures.has("start_request_context"), true);
@@ -82,7 +82,13 @@ test("public Anthropic non-strict adapter preserves the complete review tool dec
82
82
  for (const input of inputs) {
83
83
  const args = validateToolArguments({ ...tools.get("gentle_review"), parameters: controller }, { type: "toolCall", id: "provider-shell", name: "gentle_review", arguments: { operation, input } });
84
84
  assert.deepEqual(args.input, input, "provider-shell validation accepts and retains this input");
85
- await assert.rejects(__testing.executeReviewControllerOperation(args, process.cwd(), native));
85
+ if (input === null) {
86
+ await assert.rejects(__testing.executeReviewControllerOperation(args, process.cwd(), native));
87
+ } else {
88
+ const outcome: any = await __testing.executeReviewControllerOperation(args, process.cwd(), native);
89
+ assert.equal(outcome.status, "blocked", `${operation}: a foreign object is refused by the operation's own input validation`);
90
+ assert.equal(outcome.mutation_performed, false);
91
+ }
86
92
  }
87
93
  }
88
94
  assert.equal(nativeCalls, 0);
@@ -242,18 +248,33 @@ test("validation and facade keep arrays, primitives and null fail-closed", async
242
248
  assert.equal(calls, 0);
243
249
  });
244
250
 
245
- test("all other controller operations keep object input fail-closed at the facade boundary (#1698)", async () => {
246
- const operations = (tools.get("gentle_review").parameters.properties.operation.enum as string[]).filter((operation) => operation !== "start" && operation !== "assess" && operation !== "answer-consent" && operation !== "abandon" && operation !== "status" && operation !== "select-intended-untracked");
247
- let calls = 0;
248
- const native = new Proxy({}, { get() { return async () => { calls++; throw new Error("unexpected native execution"); }; } }) as NativeReviewCli;
251
+ test("every controller operation serializes a schema-admitted object input like its string form (#3023)", () => {
252
+ const input = { actor: "maintainer", reason: "operator_disposition", nested: { values: [1, "two", null] } };
253
+ const operations = (tools.get("gentle_review").parameters.properties.operation.enum as string[]).filter((operation) => operation !== "select-intended-untracked");
249
254
  for (const operation of operations) {
250
- const args = { operation, lineageId: "l", input: { consentBinding: "opaque", answer: "granted" } };
255
+ const args = validate("gentle_review", { operation, lineageId: "review-1", input });
256
+ assert.deepEqual(args.input, input, `${operation}: the tool schema admits the object`);
257
+ assert.equal(__testing.parseReviewControllerParameters(args).input, JSON.stringify(input), `${operation}: the facade must not reject what its schema admitted`);
258
+ }
259
+ for (const operation of ["inspect", "reset", "recover"]) {
260
+ assert.equal(
261
+ __testing.parseReviewControllerParameters({ operation, lineageId: "review-1", input: JSON.stringify(input) }).input,
262
+ __testing.parseReviewControllerParameters({ operation, lineageId: "review-1", input }).input,
263
+ `${operation}: object and serialized forms reach native validation as the same bytes`,
264
+ );
265
+ }
266
+ });
267
+
268
+ test("repair names the input it never reads instead of silently ignoring it (#3023)", async () => {
269
+ let statusCalls = 0;
270
+ const native = { targetStatus: async () => { statusCalls++; return { targetIdentity: "t1" }; } } as unknown as NativeReviewCli;
271
+ for (const input of [{ repairAuthorization: "caller-supplied" }, JSON.stringify({ repairAuthorization: "caller-supplied" })]) {
251
272
  await assert.rejects(
252
- __testing.executeReviewControllerOperation(args, process.cwd(), native),
253
- /Review controller input must be a string/,
273
+ __testing.executeReviewControllerOperation(validate("gentle_review", { operation: "repair", lineageId: "review-1", input }), process.cwd(), native),
274
+ /Review repair does not accept input; call it with only lineageId and optional workspaceRoot/,
254
275
  );
255
276
  }
256
- assert.equal(calls, 0);
277
+ assert.equal(statusCalls, 0);
257
278
  });
258
279
 
259
280
  test("facade rejects non-JSON runtime objects without lossy serialization or native execution", async () => {
@@ -0,0 +1,38 @@
1
+ import assert from "node:assert/strict";
2
+ import { execFileSync } from "node:child_process";
3
+ import { existsSync, mkdirSync, mkdtempSync, realpathSync, writeFileSync } from "node:fs";
4
+ import { tmpdir } from "node:os";
5
+ import { join } from "node:path";
6
+ import test from "node:test";
7
+ import { ReviewTransactionStore } from "../lib/review-transaction.ts";
8
+
9
+ function repository(): string {
10
+ const repo = realpathSync(mkdtempSync(join(tmpdir(), "legacy-check-")));
11
+ const git = (...args: string[]) => execFileSync("git", args, { cwd: repo, stdio: "ignore" });
12
+ git("init", "-q");
13
+ writeFileSync(join(repo, "a.txt"), "a\n");
14
+ git("add", "a.txt");
15
+ git("-c", "user.name=t", "-c", "user.email=t@example.invalid", "commit", "-q", "-m", "init");
16
+ return repo;
17
+ }
18
+
19
+ test("pre-graph legacy review data refuses with the directories to remove and deletes nothing", () => {
20
+ const repo = repository();
21
+ const lineages = join(repo, ".git", "gentle-ai", "reviews", "lineages");
22
+ const locks = join(repo, ".git", "gentle-ai", "reviews", "locks");
23
+ mkdirSync(join(lineages, "old"), { recursive: true });
24
+ mkdirSync(locks, { recursive: true });
25
+ assert.throws(
26
+ () => ReviewTransactionStore.forRepository(repo),
27
+ { message: `legacy review authority data is no longer supported; remove these directories to continue: ${lineages}, ${locks}` },
28
+ );
29
+ assert.ok(existsSync(join(lineages, "old")));
30
+ assert.ok(existsSync(locks));
31
+ });
32
+
33
+ test("a repository without legacy review data opens the graph store", () => {
34
+ const repo = repository();
35
+ assert.ok(ReviewTransactionStore.forRepository(repo));
36
+ mkdirSync(join(repo, ".git", "gentle-ai", "reviews", "control"), { recursive: true });
37
+ assert.ok(ReviewTransactionStore.forRepository(repo));
38
+ });
@@ -1,6 +1,6 @@
1
1
  import assert from "node:assert/strict";
2
2
  import { execFileSync } from "node:child_process";
3
- import { mkdtempSync, mkdirSync, rmSync, unlinkSync, writeFileSync } from "node:fs";
3
+ import { mkdtempSync, mkdirSync, rmSync, writeFileSync } from "node:fs";
4
4
  import { tmpdir } from "node:os";
5
5
  import { join } from "node:path";
6
6
  import test from "node:test";
@@ -84,57 +84,7 @@ test("root publication exposes the old quorum when a fault occurs before the sec
84
84
  }
85
85
  });
86
86
 
87
- test("genesis quorum-loss crash is forward-recoverable when exactly one unambiguous candidate root set exists", () => {
88
- const root = temporaryRoot();
89
- try {
90
- let fired = false;
91
- const store = new ReviewGraphObjectStoreV1(root, hash, "b".repeat(64), {
92
- faultInjector(point: ReviewObjectStoreFaultPoint) {
93
- if (point === "before-current-slot-1-replace" && !fired) {
94
- fired = true;
95
- throw new Error("injected genesis quorum-loss fault");
96
- }
97
- },
98
- });
99
- const genesisRoot = store.installRootSet({ schema: "gentle-ai.review-root-set/v1", repository_id: hash, authority_id: "b".repeat(64), generation: 0, predecessor_root_set_id: null, lineages: [] });
100
- // Only CURRENT.0 was durably written before the crash.
101
- assert.throws(() => store.publishRootSet(genesisRoot), /injected genesis quorum-loss fault/);
102
- assert.throws(() => store.readCurrent(), /quorum/i);
103
- store.repairCurrentPointers();
104
- assert.equal(store.readCurrent().root_set_id, genesisRoot.root_set_id);
105
- } finally {
106
- rmSync(root, { recursive: true, force: true });
107
- }
108
- });
109
-
110
- test("genesis repair stays fail closed when two candidate root sets are ambiguous", () => {
111
- const root = temporaryRoot();
112
- try {
113
- const store = new ReviewGraphObjectStoreV1(root, hash, "b".repeat(64));
114
- store.installRootSet({ schema: "gentle-ai.review-root-set/v1", repository_id: hash, authority_id: "b".repeat(64), generation: 0, predecessor_root_set_id: null, lineages: [] });
115
- store.installRootSet({ schema: "gentle-ai.review-root-set/v1", repository_id: hash, authority_id: "b".repeat(64), generation: 0, predecessor_root_set_id: null, lineages: [{ lineage_id: "x", mode: "graph" }] });
116
- assert.throws(() => store.readCurrent(), /quorum/i);
117
- assert.throws(() => store.repairCurrentPointers(), /quorum/i);
118
- } finally {
119
- rmSync(root, { recursive: true, force: true });
120
- }
121
- });
122
-
123
- test("genesis repair stays fail closed when the sole candidate root set is corrupted", () => {
124
- const root = temporaryRoot();
125
- try {
126
- const store = new ReviewGraphObjectStoreV1(root, hash, "b".repeat(64));
127
- const genesisRoot = store.installRootSet({ schema: "gentle-ai.review-root-set/v1", repository_id: hash, authority_id: "b".repeat(64), generation: 0, predecessor_root_set_id: null, lineages: [] });
128
- const path = join(root, "roots", "sha256", genesisRoot.root_set_id.slice(0, 2), genesisRoot.root_set_id.slice(2));
129
- writeFileSync(path, "not canonical json");
130
- assert.throws(() => store.readCurrent(), /quorum/i);
131
- assert.throws(() => store.repairCurrentPointers(), /quorum/i);
132
- } finally {
133
- rmSync(root, { recursive: true, force: true });
134
- }
135
- });
136
-
137
- test("root successors must name the current root and repair restores only a quorum-backed pointer", () => {
87
+ test("root successors must name the current root", () => {
138
88
  const root = temporaryRoot();
139
89
  try {
140
90
  const store = new ReviewGraphObjectStoreV1(root, hash, "b".repeat(64));
@@ -142,12 +92,7 @@ test("root successors must name the current root and repair restores only a quor
142
92
  store.publishRootSet(first);
143
93
  const fork = store.installRootSet({ schema: "gentle-ai.review-root-set/v1", repository_id: hash, authority_id: "b".repeat(64), generation: 1, predecessor_root_set_id: "c".repeat(64), lineages: [] });
144
94
  assert.throws(() => store.publishRootSet(fork), /predecessor|descendant/i);
145
- unlinkSync(join(root, "CURRENT.2"));
146
- store.repairCurrentPointers();
147
95
  assert.equal(store.readCurrent().root_set_id, first.root_set_id);
148
- writeFileSync(join(root, "CURRENT.0"), "broken");
149
- writeFileSync(join(root, "CURRENT.1"), "also-broken");
150
- assert.throws(() => store.repairCurrentPointers(), /quorum/i);
151
96
  } finally {
152
97
  rmSync(root, { recursive: true, force: true });
153
98
  }
@@ -128,4 +128,5 @@ test("S3/S5: the run guidance relays correction findings and their claims as the
128
128
  assert.ok(run.promptGuidelines.includes("When non_blocking_findings.statement_truncated is true, say the provider statement was truncated at 1,024 UTF-8 bytes; do not present it as complete or infer missing text."));
129
129
  assert.match(run.description, /input-required \(correction plan; with its findings and the non-blocking findings when the provider reports the non-blocking ones\)/);
130
130
  assert.match(run.description, /stopped \(escalated: with the non-blocking findings\)/);
131
+ assert.ok(run.promptGuidelines.includes("When a stopped run returns targeted_validator_evidence, the validator rejected the correction: relay its checks, named regressions and follow_ups unchanged. It explains the stop; it never routes the run or grants delivery."));
131
132
  });
@@ -450,3 +450,59 @@ test("S6: START consent returns consent-required without a UI and when the human
450
450
  assert.equal(prompts, hasUI ? 1 : 0, `${label}: the consent dialog is shown only with a UI`);
451
451
  }
452
452
  });
453
+
454
+ test("gentle_review_run forwards escalate to native assess and proceeds past not-due", async () => {
455
+ const cwd = scratchRepo();
456
+ const escalate = { item: 3, reason: "touches the auth boundary" };
457
+ const runtime = createCoordinatorRuntime(cwd, "coordinator", { mediumAssess: true, hasUI: false });
458
+ try {
459
+ const result = await runtime.invoke("gentle_review_run", { escalate });
460
+ assert.notEqual((result as { details?: { outcome?: string } }).details?.outcome ?? (result as { outcome?: string }).outcome, "not-due");
461
+ const assess = runtime.nativeRequests.find((entry) => entry.operation === "assess")!.request as { escalate?: unknown };
462
+ assert.deepEqual(assess.escalate, escalate);
463
+ } finally { runtime.close(); }
464
+ });
465
+
466
+ test("gentle_review_run never sends the escalation to a host STATUS; over an existing lineage it behaves exactly like without it", async () => {
467
+ const escalate = { item: 3, reason: "touches the auth boundary" };
468
+ const outcomes: unknown[] = [];
469
+ for (const extra of [{}, { escalate }]) {
470
+ const runtime = createCoordinatorRuntime(scratchRepo(), "coordinator", { hasUI: false });
471
+ try {
472
+ const result = await runtime.invoke("gentle_review_run", extra) as { details?: { outcome?: string }; outcome?: string };
473
+ outcomes.push(result.details?.outcome ?? result.outcome);
474
+ for (const entry of runtime.nativeRequests.filter((request) => request.operation === "target-status")) assert.equal("escalate" in (entry.request as object), false, "no host STATUS carries the escalation");
475
+ } finally { runtime.close(); }
476
+ }
477
+ assert.equal(outcomes[1], outcomes[0]);
478
+ assert.notEqual(outcomes[0], "blocked");
479
+ });
480
+
481
+ test("gentle_review_run with a due escalation sends it to assess and START only, never to a host STATUS", async () => {
482
+ const runtime = createCoordinatorRuntime(scratchRepo(), "coordinator", { mediumAssess: true, hasUI: false });
483
+ try {
484
+ await runtime.invoke("gentle_review_run", { escalate: { item: 3, reason: "touches the auth boundary" } }).catch(() => undefined);
485
+ assert.ok(runtime.nativeRequests.some((entry) => entry.operation === "assess" && (entry.request as { escalate?: unknown }).escalate !== undefined));
486
+ for (const entry of runtime.nativeRequests.filter((request) => request.operation === "target-status")) assert.equal("escalate" in (entry.request as object), false, "no host STATUS carries the escalation");
487
+ } finally { runtime.close(); }
488
+ });
489
+
490
+ test("gentle_review_run without escalate keeps a medium candidate not-due", async () => {
491
+ const runtime = createCoordinatorRuntime(scratchRepo(), "coordinator", { mediumAssess: true, hasUI: false });
492
+ try {
493
+ const result = await runtime.invoke("gentle_review_run", {}) as { details?: { outcome?: string }; outcome?: string };
494
+ assert.equal(result.details?.outcome ?? result.outcome, "not-due");
495
+ const assess = runtime.nativeRequests.find((entry) => entry.operation === "assess")!.request as { escalate?: unknown };
496
+ assert.equal(assess.escalate, undefined);
497
+ } finally { runtime.close(); }
498
+ });
499
+
500
+ test("gentle_review_run rejects an invalid escalate before any native call", async () => {
501
+ const runtime = createCoordinatorRuntime(scratchRepo(), "coordinator", { mediumAssess: true, hasUI: false });
502
+ try {
503
+ for (const escalate of [{ item: 7, reason: "x" }, { item: 2, reason: " " }, { item: 2, reason: "é".repeat(251) }, { item: 2, reason: "two\nlines" }, { item: 2 }, "high"]) {
504
+ await assert.rejects(Promise.resolve().then(() => runtime.invoke("gentle_review_run", { escalate })), /escalate/);
505
+ }
506
+ assert.deepEqual(runtime.nativeRequests.filter((entry) => entry.operation === "assess"), []);
507
+ } finally { runtime.close(); }
508
+ });
@@ -190,11 +190,9 @@ test("decodeReviewAssessmentV1 rejects malformed consumed, review_due, and revie
190
190
  }
191
191
  });
192
192
 
193
- // gentle-pi#1175 (T2): the native schema fixes review_due by reason
194
- // (true for high_risk and slice_budget_reached, false for passive,
195
- // under_budget, and already_reviewed). Consumed candidates must report
196
- // already_reviewed, but an acknowledged predecessor plus a passive delta can
197
- // also produce that reason without consuming this exact candidate (#1954).
193
+ // Native review_due/review_due_reason/consumed combinations; the decoder
194
+ // reads them as-is. An acknowledged predecessor plus a passive delta can
195
+ // report already_reviewed without consuming this candidate (#1954).
198
196
  interface ReviewDuePair {
199
197
  reason: string;
200
198
  due: boolean;
@@ -230,18 +228,6 @@ test("decodeReviewAssessmentV1 accepts every consistent review_due/review_due_re
230
228
  assert.equal(decodeReviewAssessmentV1(newEnvelope({ next_transition: undefined })).reviewDueReason, "high_risk");
231
229
  });
232
230
 
233
- test("decodeReviewAssessmentV1 rejects a review_due boolean that contradicts review_due_reason", () => {
234
- for (const pair of CONSISTENT_REVIEW_DUE_PAIRS) {
235
- const contradictory = newEnvelope({
236
- candidate: { kind: "current-changes", consumed: pair.consumed },
237
- review_due: !pair.due,
238
- review_due_reason: pair.reason,
239
- next_transition: undefined,
240
- });
241
- assert.throws(() => decodeReviewAssessmentV1(contradictory), TypeError, `review_due ${!pair.due} with ${pair.reason} must be rejected`);
242
- }
243
- });
244
-
245
231
  function reviewedPredecessorEnvelope(): Record<string, unknown> {
246
232
  // The executable range still has medium risk; only the delta after the
247
233
  // acknowledged committed predecessor is a passive ODD note.
@@ -268,29 +254,6 @@ test("decodeReviewAssessmentV1 accepts an already-reviewed predecessor without c
268
254
  assert.equal(Object.hasOwn(decoded, "nextTransition"), false);
269
255
  });
270
256
 
271
- test("decodeReviewAssessmentV1 rejects already_reviewed with missing consumed evidence", () => {
272
- // Native v2 requires consumed; older envelopes omit the entire due pair.
273
- assert.throws(
274
- () => decodeReviewAssessmentV1(newEnvelope({ candidate: { kind: "current-changes" }, review_due: false, review_due_reason: "already_reviewed", next_transition: undefined })),
275
- TypeError,
276
- );
277
- });
278
-
279
- test("decodeReviewAssessmentV1 rejects a consumed candidate reported with any reason other than already_reviewed", () => {
280
- for (const pair of CONSISTENT_REVIEW_DUE_PAIRS.filter((entry) => entry.reason !== "already_reviewed")) {
281
- assert.throws(
282
- () => decodeReviewAssessmentV1(newEnvelope({
283
- candidate: { kind: "current-changes", consumed: true },
284
- review_due: pair.due,
285
- review_due_reason: pair.reason,
286
- next_transition: pair.due ? nextTransition() : undefined,
287
- })),
288
- TypeError,
289
- `consumed with ${pair.reason} must be rejected`,
290
- );
291
- }
292
- });
293
-
294
257
  test("decodeReviewAssessmentV1 still accepts an older envelope without the review_due pair", () => {
295
258
  assert.equal(decodeReviewAssessmentV1(validEnvelope()).risk, "medium");
296
259
  assert.equal(Object.hasOwn(decodeReviewAssessmentV1(validEnvelope({ risk: "passive", reasons: [] })), "reviewDue"), false);
@@ -301,7 +264,7 @@ test("decodeReviewAssessmentV1 rejects only one of the review_due/review_due_rea
301
264
  assert.throws(() => decodeReviewAssessmentV1(validEnvelope({ review_due_reason: "passive" })), TypeError);
302
265
  });
303
266
 
304
- test("decodeReviewAssessmentV1 rejects a malformed next_transition or one not backed by review_due true", () => {
267
+ test("decodeReviewAssessmentV1 rejects a malformed next_transition", () => {
305
268
  const malformed: Record<string, unknown>[] = [
306
269
  nextTransition({ operation: "review.start" }),
307
270
  nextTransition({ extra: true }),
@@ -320,8 +283,16 @@ test("decodeReviewAssessmentV1 rejects a malformed next_transition or one not ba
320
283
  assert.throws(() => decodeReviewAssessmentV1(newEnvelope({ next_transition: transition })), TypeError, `next_transition ${JSON.stringify(transition)} must be rejected`);
321
284
  }
322
285
  assert.throws(() => decodeReviewAssessmentV1(newEnvelope({ next_transition: null })), TypeError);
323
- assert.throws(() => decodeReviewAssessmentV1(newEnvelope({ review_due: false, review_due_reason: "passive" })), TypeError, "next_transition requires review_due true");
324
- assert.throws(() => decodeReviewAssessmentV1(validEnvelope({ next_transition: nextTransition() })), TypeError, "next_transition requires review_due true");
286
+ });
287
+
288
+ test("decodeReviewAssessmentV1 decodes the native due value as-is and never audits its coherence", () => {
289
+ const decoded = decodeReviewAssessmentV1(newEnvelope({ review_due: false, review_due_reason: "high_risk", next_transition: nextTransition() }));
290
+ assert.equal(decoded.reviewDue, false);
291
+ assert.equal(decoded.reviewDueReason, "high_risk");
292
+ assert.deepEqual(decoded.nextTransition, nextTransition());
293
+ const consumed = decodeReviewAssessmentV1(newEnvelope({ candidate: { kind: "current-changes", consumed: true }, review_due: true, review_due_reason: "under_budget", next_transition: undefined }));
294
+ assert.equal(consumed.reviewDue, true);
295
+ assert.equal(consumed.candidate.consumed, true);
325
296
  });
326
297
 
327
298
  test("decodeReviewAssessmentV1 ignores unknown top-level fields and never projects them", () => {