@telora/daemon 0.22.97 → 0.22.131

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 (503) hide show
  1. package/build-info.json +4 -3
  2. package/dist/cli/verify-setup-config.d.ts +4 -3
  3. package/dist/cli/verify-setup-config.d.ts.map +1 -1
  4. package/dist/cli/verify-setup-config.js.map +1 -1
  5. package/dist/completion/commit-verdict-release.d.ts +49 -0
  6. package/dist/completion/commit-verdict-release.d.ts.map +1 -0
  7. package/dist/completion/commit-verdict-release.js +240 -0
  8. package/dist/completion/commit-verdict-release.js.map +1 -0
  9. package/dist/completion/completion-phase-registry.d.ts +10 -4
  10. package/dist/completion/completion-phase-registry.d.ts.map +1 -1
  11. package/dist/completion/completion-phase-registry.js +19 -7
  12. package/dist/completion/completion-phase-registry.js.map +1 -1
  13. package/dist/completion/detector.d.ts.map +1 -1
  14. package/dist/completion/detector.js +1 -0
  15. package/dist/completion/detector.js.map +1 -1
  16. package/dist/completion/event-entry-phases.d.ts +6 -3
  17. package/dist/completion/event-entry-phases.d.ts.map +1 -1
  18. package/dist/completion/event-entry-phases.js +135 -76
  19. package/dist/completion/event-entry-phases.js.map +1 -1
  20. package/dist/completion/event-phases.d.ts +24 -3
  21. package/dist/completion/event-phases.d.ts.map +1 -1
  22. package/dist/completion/event-phases.js +9 -9
  23. package/dist/completion/event-phases.js.map +1 -1
  24. package/dist/completion/event.d.ts +8 -0
  25. package/dist/completion/event.d.ts.map +1 -1
  26. package/dist/completion/event.js +47 -21
  27. package/dist/completion/event.js.map +1 -1
  28. package/dist/completion/exit-classification.d.ts.map +1 -1
  29. package/dist/completion/exit-classification.js +1 -0
  30. package/dist/completion/exit-classification.js.map +1 -1
  31. package/dist/completion/merge-phase.d.ts +21 -9
  32. package/dist/completion/merge-phase.d.ts.map +1 -1
  33. package/dist/completion/merge-phase.js +35 -10
  34. package/dist/completion/merge-phase.js.map +1 -1
  35. package/dist/completion/review-auto-approval-record.d.ts +19 -0
  36. package/dist/completion/review-auto-approval-record.d.ts.map +1 -0
  37. package/dist/completion/review-auto-approval-record.js +102 -0
  38. package/dist/completion/review-auto-approval-record.js.map +1 -0
  39. package/dist/completion/review-cycle-cap.d.ts +62 -0
  40. package/dist/completion/review-cycle-cap.d.ts.map +1 -0
  41. package/dist/completion/review-cycle-cap.js +180 -0
  42. package/dist/completion/review-cycle-cap.js.map +1 -0
  43. package/dist/completion/review-exit-deps.d.ts +17 -2
  44. package/dist/completion/review-exit-deps.d.ts.map +1 -1
  45. package/dist/completion/review-exit-deps.js +19 -2
  46. package/dist/completion/review-exit-deps.js.map +1 -1
  47. package/dist/completion/review-exit-escalations.d.ts +45 -23
  48. package/dist/completion/review-exit-escalations.d.ts.map +1 -1
  49. package/dist/completion/review-exit-escalations.js +15 -74
  50. package/dist/completion/review-exit-escalations.js.map +1 -1
  51. package/dist/completion/review-exit-evidence.d.ts +9 -0
  52. package/dist/completion/review-exit-evidence.d.ts.map +1 -1
  53. package/dist/completion/review-exit-evidence.js +4 -1
  54. package/dist/completion/review-exit-evidence.js.map +1 -1
  55. package/dist/completion/review-exit-foreign-findings.d.ts +151 -0
  56. package/dist/completion/review-exit-foreign-findings.d.ts.map +1 -0
  57. package/dist/completion/review-exit-foreign-findings.js +474 -0
  58. package/dist/completion/review-exit-foreign-findings.js.map +1 -0
  59. package/dist/completion/review-exit-phase.d.ts.map +1 -1
  60. package/dist/completion/review-exit-phase.js +71 -64
  61. package/dist/completion/review-exit-phase.js.map +1 -1
  62. package/dist/completion/review-exit-progress.d.ts +20 -0
  63. package/dist/completion/review-exit-progress.d.ts.map +1 -1
  64. package/dist/completion/review-exit-progress.js +28 -19
  65. package/dist/completion/review-exit-progress.js.map +1 -1
  66. package/dist/completion/review-exit-rehoming.d.ts +5 -0
  67. package/dist/completion/review-exit-rehoming.d.ts.map +1 -1
  68. package/dist/completion/review-exit-rehoming.js.map +1 -1
  69. package/dist/completion/review-exit-verdict-gate.d.ts +202 -0
  70. package/dist/completion/review-exit-verdict-gate.d.ts.map +1 -0
  71. package/dist/completion/review-exit-verdict-gate.js +228 -0
  72. package/dist/completion/review-exit-verdict-gate.js.map +1 -0
  73. package/dist/completion/review-next-step.d.ts +62 -0
  74. package/dist/completion/review-next-step.d.ts.map +1 -0
  75. package/dist/completion/review-next-step.js +63 -0
  76. package/dist/completion/review-next-step.js.map +1 -0
  77. package/dist/completion/session-hold-sweep-deps.d.ts +17 -0
  78. package/dist/completion/session-hold-sweep-deps.d.ts.map +1 -0
  79. package/dist/completion/session-hold-sweep-deps.js +89 -0
  80. package/dist/completion/session-hold-sweep-deps.js.map +1 -0
  81. package/dist/completion/session-hold.d.ts +180 -0
  82. package/dist/completion/session-hold.d.ts.map +1 -0
  83. package/dist/completion/session-hold.js +238 -0
  84. package/dist/completion/session-hold.js.map +1 -0
  85. package/dist/completion/state-cascade.d.ts +19 -0
  86. package/dist/completion/state-cascade.d.ts.map +1 -1
  87. package/dist/completion/state-cascade.js +85 -31
  88. package/dist/completion/state-cascade.js.map +1 -1
  89. package/dist/completion/team-lifecycle.d.ts +35 -2
  90. package/dist/completion/team-lifecycle.d.ts.map +1 -1
  91. package/dist/completion/team-lifecycle.js +165 -94
  92. package/dist/completion/team-lifecycle.js.map +1 -1
  93. package/dist/completion/team-phase.d.ts +27 -15
  94. package/dist/completion/team-phase.d.ts.map +1 -1
  95. package/dist/completion/team-phase.js +34 -15
  96. package/dist/completion/team-phase.js.map +1 -1
  97. package/dist/delivery/commit-verdict-hold.d.ts +55 -0
  98. package/dist/delivery/commit-verdict-hold.d.ts.map +1 -0
  99. package/dist/delivery/commit-verdict-hold.js +118 -0
  100. package/dist/delivery/commit-verdict-hold.js.map +1 -0
  101. package/dist/directive/directive-dispatch.d.ts.map +1 -1
  102. package/dist/directive/directive-dispatch.js +10 -3
  103. package/dist/directive/directive-dispatch.js.map +1 -1
  104. package/dist/directive/directive-executor.d.ts.map +1 -1
  105. package/dist/directive/directive-executor.js +1 -0
  106. package/dist/directive/directive-executor.js.map +1 -1
  107. package/dist/directive/directive-queue.d.ts.map +1 -1
  108. package/dist/directive/directive-queue.js +6 -1
  109. package/dist/directive/directive-queue.js.map +1 -1
  110. package/dist/directive/phase-sync.d.ts +29 -2
  111. package/dist/directive/phase-sync.d.ts.map +1 -1
  112. package/dist/directive/phase-sync.js +30 -6
  113. package/dist/directive/phase-sync.js.map +1 -1
  114. package/dist/drift/artifact-ref-shape.d.ts +34 -0
  115. package/dist/drift/artifact-ref-shape.d.ts.map +1 -0
  116. package/dist/drift/artifact-ref-shape.js +94 -0
  117. package/dist/drift/artifact-ref-shape.js.map +1 -0
  118. package/dist/drift/drift-eval-loop.d.ts +7 -0
  119. package/dist/drift/drift-eval-loop.d.ts.map +1 -1
  120. package/dist/drift/drift-eval-loop.js +34 -5
  121. package/dist/drift/drift-eval-loop.js.map +1 -1
  122. package/dist/drift/drift-evaluator.d.ts.map +1 -1
  123. package/dist/drift/drift-evaluator.js +8 -3
  124. package/dist/drift/drift-evaluator.js.map +1 -1
  125. package/dist/focus/awaiting-slot.d.ts +34 -0
  126. package/dist/focus/awaiting-slot.d.ts.map +1 -0
  127. package/dist/focus/awaiting-slot.js +26 -0
  128. package/dist/focus/awaiting-slot.js.map +1 -0
  129. package/dist/focus/focus-lifecycle.js +2 -2
  130. package/dist/focus/focus-lifecycle.js.map +1 -1
  131. package/dist/focus/focus-phase.d.ts.map +1 -1
  132. package/dist/focus/focus-phase.js +3 -1
  133. package/dist/focus/focus-phase.js.map +1 -1
  134. package/dist/focus/focus-spawn-decision.d.ts +62 -0
  135. package/dist/focus/focus-spawn-decision.d.ts.map +1 -0
  136. package/dist/focus/focus-spawn-decision.js +41 -0
  137. package/dist/focus/focus-spawn-decision.js.map +1 -0
  138. package/dist/focus/focus-team-state.d.ts.map +1 -1
  139. package/dist/focus/focus-team-state.js +1 -13
  140. package/dist/focus/focus-team-state.js.map +1 -1
  141. package/dist/focus/listener-spawn.d.ts +16 -55
  142. package/dist/focus/listener-spawn.d.ts.map +1 -1
  143. package/dist/focus/listener-spawn.js +102 -64
  144. package/dist/focus/listener-spawn.js.map +1 -1
  145. package/dist/focus/listener-state.d.ts.map +1 -1
  146. package/dist/focus/listener-state.js +4 -1
  147. package/dist/focus/listener-state.js.map +1 -1
  148. package/dist/focus/listener.d.ts +41 -2
  149. package/dist/focus/listener.d.ts.map +1 -1
  150. package/dist/focus/listener.js +135 -83
  151. package/dist/focus/listener.js.map +1 -1
  152. package/dist/focus/pending-spawn-pass-deps.d.ts +69 -0
  153. package/dist/focus/pending-spawn-pass-deps.d.ts.map +1 -0
  154. package/dist/focus/pending-spawn-pass-deps.js +34 -0
  155. package/dist/focus/pending-spawn-pass-deps.js.map +1 -0
  156. package/dist/focus/pending-spawn-review-next-step.d.ts +83 -0
  157. package/dist/focus/pending-spawn-review-next-step.d.ts.map +1 -0
  158. package/dist/focus/pending-spawn-review-next-step.js +325 -0
  159. package/dist/focus/pending-spawn-review-next-step.js.map +1 -0
  160. package/dist/focus/review-cycle-cap-hold.d.ts +132 -0
  161. package/dist/focus/review-cycle-cap-hold.d.ts.map +1 -0
  162. package/dist/focus/review-cycle-cap-hold.js +178 -0
  163. package/dist/focus/review-cycle-cap-hold.js.map +1 -0
  164. package/dist/focus/team-actionable-work.js +2 -2
  165. package/dist/focus/verify-open-issues.d.ts +22 -0
  166. package/dist/focus/verify-open-issues.d.ts.map +1 -1
  167. package/dist/focus/verify-open-issues.js +118 -57
  168. package/dist/focus/verify-open-issues.js.map +1 -1
  169. package/dist/focus/verify-routing-passes.d.ts +32 -0
  170. package/dist/focus/verify-routing-passes.d.ts.map +1 -0
  171. package/dist/focus/verify-routing-passes.js +18 -0
  172. package/dist/focus/verify-routing-passes.js.map +1 -0
  173. package/dist/git/exec.d.ts.map +1 -1
  174. package/dist/git/exec.js +2 -1
  175. package/dist/git/exec.js.map +1 -1
  176. package/dist/git/index.d.ts.map +1 -1
  177. package/dist/git/index.js +9 -5
  178. package/dist/git/index.js.map +1 -1
  179. package/dist/merge/focus-merge.d.ts +16 -2
  180. package/dist/merge/focus-merge.d.ts.map +1 -1
  181. package/dist/merge/focus-merge.js +53 -30
  182. package/dist/merge/focus-merge.js.map +1 -1
  183. package/dist/merge/merge-back-loop.d.ts +5 -0
  184. package/dist/merge/merge-back-loop.d.ts.map +1 -1
  185. package/dist/merge/merge-back-loop.js +17 -8
  186. package/dist/merge/merge-back-loop.js.map +1 -1
  187. package/dist/merge/merge-gate-coverage.d.ts +94 -0
  188. package/dist/merge/merge-gate-coverage.d.ts.map +1 -0
  189. package/dist/merge/merge-gate-coverage.js +217 -0
  190. package/dist/merge/merge-gate-coverage.js.map +1 -0
  191. package/dist/prompt/focus-prompt-builder.d.ts.map +1 -1
  192. package/dist/prompt/focus-prompt-builder.js +6 -0
  193. package/dist/prompt/focus-prompt-builder.js.map +1 -1
  194. package/dist/prompt/prompt-listing.d.ts.map +1 -1
  195. package/dist/prompt/prompt-listing.js +8 -0
  196. package/dist/prompt/prompt-listing.js.map +1 -1
  197. package/dist/prompt/team-prompt-base.d.ts.map +1 -1
  198. package/dist/prompt/team-prompt-base.js +5 -1
  199. package/dist/prompt/team-prompt-base.js.map +1 -1
  200. package/dist/prompt-sections/execution-sections.d.ts.map +1 -1
  201. package/dist/prompt-sections/execution-sections.js +14 -39
  202. package/dist/prompt-sections/execution-sections.js.map +1 -1
  203. package/dist/prompt-sections/gate-ownership.d.ts +36 -0
  204. package/dist/prompt-sections/gate-ownership.d.ts.map +1 -0
  205. package/dist/prompt-sections/gate-ownership.js +68 -0
  206. package/dist/prompt-sections/gate-ownership.js.map +1 -0
  207. package/dist/prompt-sections/gate-verdict-section.d.ts +58 -0
  208. package/dist/prompt-sections/gate-verdict-section.d.ts.map +1 -0
  209. package/dist/prompt-sections/gate-verdict-section.js +88 -0
  210. package/dist/prompt-sections/gate-verdict-section.js.map +1 -0
  211. package/dist/prompt-sections/persona-sections.d.ts +10 -0
  212. package/dist/prompt-sections/persona-sections.d.ts.map +1 -1
  213. package/dist/prompt-sections/persona-sections.js +35 -11
  214. package/dist/prompt-sections/persona-sections.js.map +1 -1
  215. package/dist/prompt-sections/shared.js +1 -1
  216. package/dist/prompt-sections/shared.js.map +1 -1
  217. package/dist/queries/agent-resolvable-promotion.d.ts +6 -3
  218. package/dist/queries/agent-resolvable-promotion.d.ts.map +1 -1
  219. package/dist/queries/agent-resolvable-promotion.js +20 -9
  220. package/dist/queries/agent-resolvable-promotion.js.map +1 -1
  221. package/dist/queries/deliveries.d.ts +46 -4
  222. package/dist/queries/deliveries.d.ts.map +1 -1
  223. package/dist/queries/deliveries.js +69 -16
  224. package/dist/queries/deliveries.js.map +1 -1
  225. package/dist/queries/delivery-gate-state.d.ts +159 -1
  226. package/dist/queries/delivery-gate-state.d.ts.map +1 -1
  227. package/dist/queries/delivery-gate-state.js +95 -14
  228. package/dist/queries/delivery-gate-state.js.map +1 -1
  229. package/dist/queries/delivery-write-discipline.d.ts +65 -0
  230. package/dist/queries/delivery-write-discipline.d.ts.map +1 -0
  231. package/dist/queries/delivery-write-discipline.js +101 -0
  232. package/dist/queries/delivery-write-discipline.js.map +1 -0
  233. package/dist/queries/escalation-consumption.d.ts +11 -0
  234. package/dist/queries/escalation-consumption.d.ts.map +1 -1
  235. package/dist/queries/escalation-consumption.js +22 -0
  236. package/dist/queries/escalation-consumption.js.map +1 -1
  237. package/dist/queries/escalation-spool.d.ts +75 -0
  238. package/dist/queries/escalation-spool.d.ts.map +1 -0
  239. package/dist/queries/escalation-spool.js +232 -0
  240. package/dist/queries/escalation-spool.js.map +1 -0
  241. package/dist/queries/escalation-suppression.d.ts.map +1 -1
  242. package/dist/queries/escalation-suppression.js +2 -0
  243. package/dist/queries/escalation-suppression.js.map +1 -1
  244. package/dist/queries/escalations.js +1 -1
  245. package/dist/queries/filing-observation.d.ts.map +1 -1
  246. package/dist/queries/filing-observation.js +2 -0
  247. package/dist/queries/filing-observation.js.map +1 -1
  248. package/dist/queries/focus-discovery.d.ts +4 -4
  249. package/dist/queries/focus-discovery.d.ts.map +1 -1
  250. package/dist/queries/focus-discovery.js +1 -0
  251. package/dist/queries/focus-discovery.js.map +1 -1
  252. package/dist/queries/focus-review-approval.d.ts +84 -0
  253. package/dist/queries/focus-review-approval.d.ts.map +1 -0
  254. package/dist/queries/focus-review-approval.js +158 -0
  255. package/dist/queries/focus-review-approval.js.map +1 -0
  256. package/dist/queries/focuses.d.ts +6 -5
  257. package/dist/queries/focuses.d.ts.map +1 -1
  258. package/dist/queries/focuses.js +9 -5
  259. package/dist/queries/focuses.js.map +1 -1
  260. package/dist/queries/incident-correlation.d.ts +5 -4
  261. package/dist/queries/incident-correlation.d.ts.map +1 -1
  262. package/dist/queries/incident-correlation.js +11 -5
  263. package/dist/queries/incident-correlation.js.map +1 -1
  264. package/dist/queries/issues.d.ts.map +1 -1
  265. package/dist/queries/issues.js +2 -1
  266. package/dist/queries/issues.js.map +1 -1
  267. package/dist/queries/loop-refusal-observation.d.ts +64 -0
  268. package/dist/queries/loop-refusal-observation.d.ts.map +1 -0
  269. package/dist/queries/loop-refusal-observation.js +137 -0
  270. package/dist/queries/loop-refusal-observation.js.map +1 -0
  271. package/dist/queries/schemas.d.ts +9 -0
  272. package/dist/queries/schemas.d.ts.map +1 -1
  273. package/dist/queries/schemas.js +11 -3
  274. package/dist/queries/schemas.js.map +1 -1
  275. package/dist/queries/shared.js +1 -1
  276. package/dist/queries/verification.d.ts +15 -0
  277. package/dist/queries/verification.d.ts.map +1 -1
  278. package/dist/queries/verification.js +1 -14
  279. package/dist/queries/verification.js.map +1 -1
  280. package/dist/queries/wire-contract.generated.d.ts +3 -0
  281. package/dist/queries/wire-contract.generated.d.ts.map +1 -1
  282. package/dist/queries/wire-contract.generated.js +3 -0
  283. package/dist/queries/wire-contract.generated.js.map +1 -1
  284. package/dist/resolvers/assembly-engine.d.ts.map +1 -1
  285. package/dist/resolvers/assembly-engine.js +3 -1
  286. package/dist/resolvers/assembly-engine.js.map +1 -1
  287. package/dist/resolvers/git-diff-against-base.d.ts +5 -2
  288. package/dist/resolvers/git-diff-against-base.d.ts.map +1 -1
  289. package/dist/resolvers/git-diff-against-base.js +121 -39
  290. package/dist/resolvers/git-diff-against-base.js.map +1 -1
  291. package/dist/resolvers/shared/git-diff.d.ts +2 -0
  292. package/dist/resolvers/shared/git-diff.d.ts.map +1 -1
  293. package/dist/resolvers/shared/git-diff.js +5 -1
  294. package/dist/resolvers/shared/git-diff.js.map +1 -1
  295. package/dist/resolvers/shared/review-window-commits.d.ts +96 -0
  296. package/dist/resolvers/shared/review-window-commits.d.ts.map +1 -0
  297. package/dist/resolvers/shared/review-window-commits.js +262 -0
  298. package/dist/resolvers/shared/review-window-commits.js.map +1 -0
  299. package/dist/session/session-lineage.d.ts.map +1 -1
  300. package/dist/session/session-lineage.js +4 -1
  301. package/dist/session/session-lineage.js.map +1 -1
  302. package/dist/shell/config.d.ts.map +1 -1
  303. package/dist/shell/config.js +10 -9
  304. package/dist/shell/config.js.map +1 -1
  305. package/dist/shell/fail-stop.d.ts +18 -0
  306. package/dist/shell/fail-stop.d.ts.map +1 -0
  307. package/dist/shell/fail-stop.js +53 -0
  308. package/dist/shell/fail-stop.js.map +1 -0
  309. package/dist/shell/graceful-shutdown.d.ts +48 -0
  310. package/dist/shell/graceful-shutdown.d.ts.map +1 -0
  311. package/dist/shell/graceful-shutdown.js +152 -0
  312. package/dist/shell/graceful-shutdown.js.map +1 -0
  313. package/dist/shell/heartbeat.d.ts.map +1 -1
  314. package/dist/shell/heartbeat.js +5 -4
  315. package/dist/shell/heartbeat.js.map +1 -1
  316. package/dist/shell/log.d.ts.map +1 -1
  317. package/dist/shell/log.js +4 -1
  318. package/dist/shell/log.js.map +1 -1
  319. package/dist/shell/stop-request.d.ts.map +1 -1
  320. package/dist/shell/stop-request.js +2 -1
  321. package/dist/shell/stop-request.js.map +1 -1
  322. package/dist/shell/unified-shell-status.d.ts +6 -0
  323. package/dist/shell/unified-shell-status.d.ts.map +1 -1
  324. package/dist/shell/unified-shell-status.js +9 -2
  325. package/dist/shell/unified-shell-status.js.map +1 -1
  326. package/dist/shell/unified-shell.d.ts.map +1 -1
  327. package/dist/shell/unified-shell.js +41 -114
  328. package/dist/shell/unified-shell.js.map +1 -1
  329. package/dist/spawn/lifecycle.d.ts +12 -0
  330. package/dist/spawn/lifecycle.d.ts.map +1 -1
  331. package/dist/spawn/lifecycle.js +25 -21
  332. package/dist/spawn/lifecycle.js.map +1 -1
  333. package/dist/spawn/prompt-assembly.d.ts +19 -1
  334. package/dist/spawn/prompt-assembly.d.ts.map +1 -1
  335. package/dist/spawn/prompt-assembly.js +70 -21
  336. package/dist/spawn/prompt-assembly.js.map +1 -1
  337. package/dist/spawn/review-hold-park.d.ts.map +1 -1
  338. package/dist/spawn/review-hold-park.js +18 -8
  339. package/dist/spawn/review-hold-park.js.map +1 -1
  340. package/dist/spawn/spawn-cooldown.d.ts.map +1 -1
  341. package/dist/spawn/spawn-cooldown.js +4 -0
  342. package/dist/spawn/spawn-cooldown.js.map +1 -1
  343. package/dist/spawn/spawn-decision.d.ts.map +1 -1
  344. package/dist/spawn/spawn-decision.js +2 -1
  345. package/dist/spawn/spawn-decision.js.map +1 -1
  346. package/dist/spawn/worktree-session.d.ts +6 -0
  347. package/dist/spawn/worktree-session.d.ts.map +1 -1
  348. package/dist/spawn/worktree-session.js +15 -2
  349. package/dist/spawn/worktree-session.js.map +1 -1
  350. package/dist/testing/fixtures/index.d.ts +10 -1
  351. package/dist/testing/fixtures/index.d.ts.map +1 -1
  352. package/dist/testing/fixtures/index.js +59 -1
  353. package/dist/testing/fixtures/index.js.map +1 -1
  354. package/dist/testing/fixtures/pending-spawn-world.d.ts +34 -0
  355. package/dist/testing/fixtures/pending-spawn-world.d.ts.map +1 -0
  356. package/dist/testing/fixtures/pending-spawn-world.js +92 -0
  357. package/dist/testing/fixtures/pending-spawn-world.js.map +1 -0
  358. package/dist/types/config.d.ts +9 -6
  359. package/dist/types/config.d.ts.map +1 -1
  360. package/dist/types/index.js +1 -1
  361. package/dist/verify/commit-gate-configured.d.ts +86 -0
  362. package/dist/verify/commit-gate-configured.d.ts.map +1 -0
  363. package/dist/verify/commit-gate-configured.js +234 -0
  364. package/dist/verify/commit-gate-configured.js.map +1 -0
  365. package/dist/verify/commit-verdict-record.d.ts +98 -0
  366. package/dist/verify/commit-verdict-record.d.ts.map +1 -0
  367. package/dist/verify/commit-verdict-record.js +297 -0
  368. package/dist/verify/commit-verdict-record.js.map +1 -0
  369. package/dist/verify/explicit-gate-outcome.d.ts +161 -0
  370. package/dist/verify/explicit-gate-outcome.d.ts.map +1 -0
  371. package/dist/verify/explicit-gate-outcome.js +215 -0
  372. package/dist/verify/explicit-gate-outcome.js.map +1 -0
  373. package/dist/verify/explicit-rearm.d.ts +27 -0
  374. package/dist/verify/explicit-rearm.d.ts.map +1 -0
  375. package/dist/verify/explicit-rearm.js +161 -0
  376. package/dist/verify/explicit-rearm.js.map +1 -0
  377. package/dist/verify/explicit-run-ledger.d.ts +26 -0
  378. package/dist/verify/explicit-run-ledger.d.ts.map +1 -0
  379. package/dist/verify/explicit-run-ledger.js +93 -0
  380. package/dist/verify/explicit-run-ledger.js.map +1 -0
  381. package/dist/verify/failure-signature.d.ts.map +1 -1
  382. package/dist/verify/failure-signature.js +5 -1
  383. package/dist/verify/failure-signature.js.map +1 -1
  384. package/dist/verify/gate-run-registry.d.ts +105 -0
  385. package/dist/verify/gate-run-registry.d.ts.map +1 -0
  386. package/dist/verify/gate-run-registry.js +111 -0
  387. package/dist/verify/gate-run-registry.js.map +1 -0
  388. package/dist/verify/gate-verdict-source.d.ts +68 -0
  389. package/dist/verify/gate-verdict-source.d.ts.map +1 -0
  390. package/dist/verify/gate-verdict-source.js +143 -0
  391. package/dist/verify/gate-verdict-source.js.map +1 -0
  392. package/dist/verify/judged-commit-gate.d.ts +11 -0
  393. package/dist/verify/judged-commit-gate.d.ts.map +1 -0
  394. package/dist/verify/judged-commit-gate.js +48 -0
  395. package/dist/verify/judged-commit-gate.js.map +1 -0
  396. package/dist/verify/rework-judgment.d.ts +58 -0
  397. package/dist/verify/rework-judgment.d.ts.map +1 -0
  398. package/dist/verify/rework-judgment.js +54 -0
  399. package/dist/verify/rework-judgment.js.map +1 -0
  400. package/dist/verify/verification-attribution.d.ts +105 -0
  401. package/dist/verify/verification-attribution.d.ts.map +1 -0
  402. package/dist/verify/verification-attribution.js +322 -0
  403. package/dist/verify/verification-attribution.js.map +1 -0
  404. package/dist/verify/verification-baseline-run.d.ts +123 -0
  405. package/dist/verify/verification-baseline-run.d.ts.map +1 -0
  406. package/dist/verify/verification-baseline-run.js +386 -0
  407. package/dist/verify/verification-baseline-run.js.map +1 -0
  408. package/dist/verify/verification-baseline.d.ts +117 -28
  409. package/dist/verify/verification-baseline.d.ts.map +1 -1
  410. package/dist/verify/verification-baseline.js +147 -120
  411. package/dist/verify/verification-baseline.js.map +1 -1
  412. package/dist/verify/verification-checkout.d.ts +32 -6
  413. package/dist/verify/verification-checkout.d.ts.map +1 -1
  414. package/dist/verify/verification-checkout.js +132 -8
  415. package/dist/verify/verification-checkout.js.map +1 -1
  416. package/dist/verify/verification-commit-sharing.d.ts +84 -0
  417. package/dist/verify/verification-commit-sharing.d.ts.map +1 -0
  418. package/dist/verify/verification-commit-sharing.js +416 -0
  419. package/dist/verify/verification-commit-sharing.js.map +1 -0
  420. package/dist/verify/verification-config.d.ts +76 -0
  421. package/dist/verify/verification-config.d.ts.map +1 -1
  422. package/dist/verify/verification-config.js +112 -14
  423. package/dist/verify/verification-config.js.map +1 -1
  424. package/dist/verify/verification-default-on.d.ts +102 -19
  425. package/dist/verify/verification-default-on.d.ts.map +1 -1
  426. package/dist/verify/verification-default-on.js +307 -38
  427. package/dist/verify/verification-default-on.js.map +1 -1
  428. package/dist/verify/verification-deps-default.d.ts.map +1 -1
  429. package/dist/verify/verification-deps-default.js +50 -43
  430. package/dist/verify/verification-deps-default.js.map +1 -1
  431. package/dist/verify/verification-deps.d.ts +86 -7
  432. package/dist/verify/verification-deps.d.ts.map +1 -1
  433. package/dist/verify/verification-deterministic.d.ts +56 -2
  434. package/dist/verify/verification-deterministic.d.ts.map +1 -1
  435. package/dist/verify/verification-deterministic.js +44 -25
  436. package/dist/verify/verification-deterministic.js.map +1 -1
  437. package/dist/verify/verification-diagnostics.d.ts +16 -0
  438. package/dist/verify/verification-diagnostics.d.ts.map +1 -0
  439. package/dist/verify/verification-diagnostics.js +219 -0
  440. package/dist/verify/verification-diagnostics.js.map +1 -0
  441. package/dist/verify/verification-engine.d.ts +12 -8
  442. package/dist/verify/verification-engine.d.ts.map +1 -1
  443. package/dist/verify/verification-engine.js +118 -102
  444. package/dist/verify/verification-engine.js.map +1 -1
  445. package/dist/verify/verification-evidence-unavailable-feedback.d.ts +2 -1
  446. package/dist/verify/verification-evidence-unavailable-feedback.d.ts.map +1 -1
  447. package/dist/verify/verification-evidence-unavailable-feedback.js +19 -5
  448. package/dist/verify/verification-evidence-unavailable-feedback.js.map +1 -1
  449. package/dist/verify/verification-feedback.d.ts +21 -34
  450. package/dist/verify/verification-feedback.d.ts.map +1 -1
  451. package/dist/verify/verification-feedback.js +37 -88
  452. package/dist/verify/verification-feedback.js.map +1 -1
  453. package/dist/verify/verification-gate-stages.d.ts +110 -0
  454. package/dist/verify/verification-gate-stages.d.ts.map +1 -0
  455. package/dist/verify/verification-gate-stages.js +179 -0
  456. package/dist/verify/verification-gate-stages.js.map +1 -0
  457. package/dist/verify/verification-history-reset.d.ts +61 -0
  458. package/dist/verify/verification-history-reset.d.ts.map +1 -0
  459. package/dist/verify/verification-history-reset.js +90 -0
  460. package/dist/verify/verification-history-reset.js.map +1 -0
  461. package/dist/verify/verification-manifest.d.ts.map +1 -1
  462. package/dist/verify/verification-manifest.js +3 -1
  463. package/dist/verify/verification-manifest.js.map +1 -1
  464. package/dist/verify/verification-rework-messages.d.ts +19 -0
  465. package/dist/verify/verification-rework-messages.d.ts.map +1 -0
  466. package/dist/verify/verification-rework-messages.js +52 -0
  467. package/dist/verify/verification-rework-messages.js.map +1 -0
  468. package/dist/verify/verification-timeout-fault.d.ts +147 -0
  469. package/dist/verify/verification-timeout-fault.d.ts.map +1 -0
  470. package/dist/verify/verification-timeout-fault.js +211 -0
  471. package/dist/verify/verification-timeout-fault.js.map +1 -0
  472. package/dist/verify/verify-gate-stall.d.ts +5 -1
  473. package/dist/verify/verify-gate-stall.d.ts.map +1 -1
  474. package/dist/verify/verify-gate-stall.js +10 -1
  475. package/dist/verify/verify-gate-stall.js.map +1 -1
  476. package/dist/worktree/install-inputs.d.ts +89 -0
  477. package/dist/worktree/install-inputs.d.ts.map +1 -0
  478. package/dist/worktree/install-inputs.js +625 -0
  479. package/dist/worktree/install-inputs.js.map +1 -0
  480. package/dist/worktree/install-script-effects.d.ts +30 -0
  481. package/dist/worktree/install-script-effects.d.ts.map +1 -0
  482. package/dist/worktree/install-script-effects.js +524 -0
  483. package/dist/worktree/install-script-effects.js.map +1 -0
  484. package/dist/worktree/install-script-tokens.d.ts +57 -0
  485. package/dist/worktree/install-script-tokens.d.ts.map +1 -0
  486. package/dist/worktree/install-script-tokens.js +299 -0
  487. package/dist/worktree/install-script-tokens.js.map +1 -0
  488. package/dist/worktree/provision.d.ts +27 -4
  489. package/dist/worktree/provision.d.ts.map +1 -1
  490. package/dist/worktree/provision.js +46 -7
  491. package/dist/worktree/provision.js.map +1 -1
  492. package/dist/worktree/safety.d.ts +11 -0
  493. package/dist/worktree/safety.d.ts.map +1 -1
  494. package/dist/worktree/safety.js +20 -3
  495. package/dist/worktree/safety.js.map +1 -1
  496. package/dist/worktree/verify-interlock.d.ts.map +1 -1
  497. package/dist/worktree/verify-interlock.js +3 -1
  498. package/dist/worktree/verify-interlock.js.map +1 -1
  499. package/dist/worktree/worktree-package-provisioning.d.ts +75 -0
  500. package/dist/worktree/worktree-package-provisioning.d.ts.map +1 -0
  501. package/dist/worktree/worktree-package-provisioning.js +362 -0
  502. package/dist/worktree/worktree-package-provisioning.js.map +1 -0
  503. package/package.json +1 -1
@@ -0,0 +1,297 @@
1
+ // PINNED-BY-BEGIN (generated by gen:pinned-by -- do not hand-edit; checked by lint:pinned-by)
2
+ // Pinned by: packages/daemon/src/completion/mid-flight-merge-gate.test.ts,
3
+ // packages/daemon/src/completion/review-exit-verdict-gate.test.ts,
4
+ // packages/daemon/src/completion/teardown-merge-gate.test.ts,
5
+ // packages/daemon/src/focus/listener-product-poll.test.ts,
6
+ // packages/daemon/src/integration/delivery-gate-write-interleaving.test.ts,
7
+ // packages/daemon/src/integration/explicit-gate-identity-unreadable.test.ts,
8
+ // packages/daemon/src/integration/explicit-gate-outcome-restart.test.ts,
9
+ // packages/daemon/src/integration/explicit-verdict-departure-during-removal.test.ts,
10
+ // packages/daemon/src/integration/explicit-verdict-invalidation-restart.test.ts,
11
+ // packages/daemon/src/integration/explicit-verdict-reuse.test.ts,
12
+ // packages/daemon/src/integration/focus-commit-verdict-scenario.test.ts,
13
+ // packages/daemon/src/integration/review-rework-resume-verdict.test.ts,
14
+ // packages/daemon/src/integration/verification-rework-resume-verdict.test.ts,
15
+ // packages/daemon/src/merge/resolved-conflict-merge-gate.test.ts,
16
+ // packages/daemon/src/spawn/prompt-assembly-resume-verdict.test.ts,
17
+ // packages/daemon/src/verify/commit-gate-configured.test.ts,
18
+ // packages/daemon/src/verify/commit-verdict-record.test.ts,
19
+ // packages/daemon/src/verify/gate-verdict-source.test.ts,
20
+ // packages/daemon/src/verify/verification-commit-sharing.test.ts
21
+ // PINNED-BY-END
22
+ /**
23
+ * The deterministic gate verdict for a focus commit, recorded durably.
24
+ *
25
+ * Every delivery on a focus is judged on the same focus-branch HEAD, and a gate
26
+ * on an unchanged tree renders the same verdict -- so the verdict belongs to the
27
+ * COMMIT, not to whichever delivery's dispatch happened to run it. Before this
28
+ * record only a failed sha was durable (per delivery, gate_state
29
+ * verificationHistory.failedAtSha) and a pass was merely the absence of one, so a
30
+ * sibling delivery, a status round trip, or a daemon restart at an already-judged
31
+ * commit paid for the whole gate again.
32
+ *
33
+ * One file per (product, focus, sha, gate) under the global state dir, written
34
+ * atomically (temp + rename) so a reader never sees a torn record. A verdict
35
+ * under one command or timeout says nothing about another, and one commit can
36
+ * carry verdicts of several gates (a sibling's explicit command beside the
37
+ * default-on gate), so no gate's record overwrites another's. A reader that names
38
+ * a gate gets only that gate's verdict -- what every routing decision does; one
39
+ * that names none (the team-facing verdict summary) gets the newest recorded for
40
+ * the commit. A record written before files were keyed by gate is still read, and
41
+ * still only for the gate it carries.
42
+ *
43
+ * What is NOT a verdict, and so is never written: a run killed by its timeout,
44
+ * a run that could not get a checkout (or whose installs moved mid-run), a run
45
+ * whose config was unresolvable (nothing ran), a run the attribution routed to
46
+ * instrument-fault re-work (the gate could not attribute it), and any run with no
47
+ * judged commit. Those leave the commit unjudged, so the next tick asks again.
48
+ *
49
+ * @module commit-verdict-record
50
+ */
51
+ import { createHash } from 'node:crypto';
52
+ import { mkdirSync, readdirSync, readFileSync, renameSync, writeFileSync } from 'node:fs';
53
+ import { basename, resolve } from 'node:path';
54
+ import { resolveGlobalStateDir } from '../shell/daemon-process.js';
55
+ import { judgedFailedSha } from '../queries/delivery-gate-state.js';
56
+ import { DEFAULT_VERIFICATION_TIMEOUT_MS } from './verification-deterministic.js';
57
+ import { createLogger } from '../shell/log.js';
58
+ const log = createLogger({ module: 'verification' });
59
+ function verdictDir() {
60
+ return resolve(resolveGlobalStateDir(), 'verification-verdicts');
61
+ }
62
+ /**
63
+ * The record file for a (product, focus, sha, gate); without a gate, the gate-less
64
+ * file records were written to before they were keyed by gate. `dir` defaults to
65
+ * the global state dir. Exported for tests.
66
+ */
67
+ export function commitVerdictPath(productId, focusId, sha, dir = verdictDir(), gate) {
68
+ const base = `${productId}-${focusId}-${sha}`;
69
+ return resolve(dir, `${gate ? `${base}-${gateKey(gate)}` : base}.json`.replace(/[^a-zA-Z0-9._-]/g, '_'));
70
+ }
71
+ /** A gate's key in a record file name: its command + timeout, hashed. */
72
+ function gateKey(gate) {
73
+ return createHash('sha256').update(JSON.stringify([gate.command, gate.timeoutMs])).digest('hex').slice(0, 12);
74
+ }
75
+ const SHA_RE = /^[0-9a-f]{7,64}$/i;
76
+ function isStringArray(value) {
77
+ return Array.isArray(value) && value.every((s) => typeof s === 'string');
78
+ }
79
+ function optionalString(value) {
80
+ return typeof value === 'string' ? value : undefined;
81
+ }
82
+ /** Validate a parsed record; null when it is not a well-formed verdict. */
83
+ function parseVerdict(raw) {
84
+ if (typeof raw !== 'object' || raw === null)
85
+ return null;
86
+ const r = raw;
87
+ const gate = r.gate;
88
+ if (typeof r.productId !== 'string' || typeof r.focusId !== 'string' || typeof r.judgedDeliveryId !== 'string')
89
+ return null;
90
+ if (typeof r.sha !== 'string' || !SHA_RE.test(r.sha))
91
+ return null;
92
+ if (r.outcome !== 'passed' && r.outcome !== 'failed')
93
+ return null;
94
+ if (typeof gate?.command !== 'string' || typeof gate.timeoutMs !== 'number')
95
+ return null;
96
+ if (typeof r.recordedAt !== 'string')
97
+ return null;
98
+ const rationale = optionalString(r.rationale);
99
+ const failedStage = optionalString(r.failedStage);
100
+ return {
101
+ productId: r.productId,
102
+ focusId: r.focusId,
103
+ sha: r.sha,
104
+ outcome: r.outcome,
105
+ gate: { command: gate.command, timeoutMs: gate.timeoutMs },
106
+ exitCode: typeof r.exitCode === 'number' ? r.exitCode : null,
107
+ judgedDeliveryId: r.judgedDeliveryId,
108
+ recordedAt: r.recordedAt,
109
+ ...(rationale !== undefined ? { rationale } : {}),
110
+ ...(failedStage !== undefined ? { failedStage } : {}),
111
+ ...(isStringArray(r.preExistingStages) ? { preExistingStages: r.preExistingStages } : {}),
112
+ ...(isStringArray(r.newFailures) ? { newFailures: r.newFailures } : {}),
113
+ ...(isStringArray(r.preExisting) ? { preExisting: r.preExisting } : {}),
114
+ ...(typeof r.logPath === 'string' ? { logPath: r.logPath } : {}),
115
+ ...(typeof r.stdoutTail === 'string' ? { stdoutTail: r.stdoutTail } : {}),
116
+ ...(typeof r.stderrTail === 'string' ? { stderrTail: r.stderrTail } : {}),
117
+ ...(typeof r.appliedConfig === 'object' && r.appliedConfig !== null
118
+ ? { appliedConfig: r.appliedConfig }
119
+ : {}),
120
+ };
121
+ }
122
+ /**
123
+ * The recorded verdict for a focus commit, or null on a miss, an unreadable or
124
+ * malformed file, or a record for another commit. With `gate`: only a verdict
125
+ * rendered under that gate. Without: the newest verdict recorded for the commit
126
+ * under any gate.
127
+ */
128
+ export function readCommitVerdict(productId, focusId, sha, opts = {}) {
129
+ const dir = opts.dir ?? verdictDir();
130
+ const gateless = commitVerdictPath(productId, focusId, sha, dir);
131
+ const paths = opts.gate
132
+ ? [commitVerdictPath(productId, focusId, sha, dir, opts.gate), gateless]
133
+ : [gateless, ...gateKeyedPaths(gateless, dir)];
134
+ let newest = null;
135
+ for (const path of paths) {
136
+ const parsed = readVerdictFile(path);
137
+ if (!parsed || parsed.productId !== productId || parsed.focusId !== focusId || parsed.sha !== sha)
138
+ continue;
139
+ if (opts.gate && (parsed.gate.command !== opts.gate.command || parsed.gate.timeoutMs !== opts.gate.timeoutMs))
140
+ continue;
141
+ if (opts.gate)
142
+ return parsed;
143
+ if (newest === null || parsed.recordedAt > newest.recordedAt)
144
+ newest = parsed;
145
+ }
146
+ return newest;
147
+ }
148
+ /** A parsed record file, or null when it is missing, unreadable, or malformed. */
149
+ function readVerdictFile(path) {
150
+ try {
151
+ return parseVerdict(JSON.parse(readFileSync(path, 'utf8')));
152
+ }
153
+ catch {
154
+ return null;
155
+ }
156
+ }
157
+ /** Every gate-keyed record file of the commit whose gate-less record file is `gateless`. */
158
+ function gateKeyedPaths(gateless, dir) {
159
+ const prefix = `${basename(gateless, '.json')}-`;
160
+ try {
161
+ return readdirSync(dir).filter((name) => name.startsWith(prefix) && name.endsWith('.json')).map((name) => resolve(dir, name));
162
+ }
163
+ catch {
164
+ return [];
165
+ }
166
+ }
167
+ /** Write a verdict atomically. Best-effort: returns false (and logs) when the write failed. */
168
+ export function writeCommitVerdict(verdict, dir = verdictDir()) {
169
+ const path = commitVerdictPath(verdict.productId, verdict.focusId, verdict.sha, dir, verdict.gate);
170
+ const tmp = `${path}.${process.pid}.tmp`;
171
+ try {
172
+ mkdirSync(dir, { recursive: true });
173
+ writeFileSync(tmp, JSON.stringify(verdict, null, 2), { mode: 0o600 });
174
+ renameSync(tmp, path);
175
+ return true;
176
+ }
177
+ catch (err) {
178
+ log.warn(`[verification] failed to record the verdict for ${verdict.focusId}@${verdict.sha.slice(0, 8)}:`, err.message);
179
+ return false;
180
+ }
181
+ }
182
+ /**
183
+ * Build the verdict a finished deterministic run renders for its commit, or null
184
+ * when the run rendered none (see the module header). `instrumentFault` is true
185
+ * when attribution routed the run to instrument-fault re-work. Pure.
186
+ */
187
+ export function buildCommitVerdict(subject, result, instrumentFault, now = new Date()) {
188
+ if (instrumentFault || result.timedOut || result.checkoutUnavailable || result.configUnresolved)
189
+ return null;
190
+ const sha = result.outcome === 'failed'
191
+ ? judgedFailedSha(result)
192
+ : result.outcome === 'passed' && result.verifiedSha && SHA_RE.test(result.verifiedSha) ? result.verifiedSha : null;
193
+ if (!sha || (result.outcome !== 'passed' && result.outcome !== 'failed'))
194
+ return null;
195
+ return {
196
+ productId: subject.productId,
197
+ focusId: subject.focusId,
198
+ sha,
199
+ outcome: result.outcome,
200
+ gate: { command: subject.gate.command, timeoutMs: subject.gate.timeoutMs },
201
+ exitCode: typeof result.exitCode === 'number' ? result.exitCode : null,
202
+ judgedDeliveryId: subject.deliveryId,
203
+ recordedAt: now.toISOString(),
204
+ ...pickCarried(result),
205
+ };
206
+ }
207
+ /** The result fields a verdict carries forward to the deliveries that reuse it. */
208
+ function pickCarried(result) {
209
+ return {
210
+ ...(result.rationale !== undefined ? { rationale: result.rationale } : {}),
211
+ ...(result.failedStage !== undefined ? { failedStage: result.failedStage } : {}),
212
+ ...(result.preExistingStages ? { preExistingStages: result.preExistingStages } : {}),
213
+ ...(result.newFailures ? { newFailures: result.newFailures } : {}),
214
+ ...(result.preExisting ? { preExisting: result.preExisting } : {}),
215
+ ...(result.logPath !== undefined ? { logPath: result.logPath } : {}),
216
+ ...(result.stdoutTail !== undefined ? { stdoutTail: result.stdoutTail } : {}),
217
+ ...(result.stderrTail !== undefined ? { stderrTail: result.stderrTail } : {}),
218
+ ...(result.appliedConfig ? { appliedConfig: result.appliedConfig } : {}),
219
+ };
220
+ }
221
+ /**
222
+ * The gate a verification carries: the command + timeout on its config -- a
223
+ * missing or non-positive timeout is the strategy default, exactly as a run
224
+ * applies it -- or null when it carries no command. It keys an explicit row's
225
+ * verdict, and a default-on candidate's only where that candidate runs in place;
226
+ * a default-on run from a checkout of the judged commit is keyed by the gate it
227
+ * applies there (verify/judged-commit-gate.ts).
228
+ */
229
+ export function commitVerdictGateOf(v) {
230
+ const cfg = v.verificationConfig ?? {};
231
+ if (typeof cfg.command !== 'string')
232
+ return null;
233
+ const timeoutMs = typeof cfg.timeoutMs === 'number' && cfg.timeoutMs > 0 ? cfg.timeoutMs : DEFAULT_VERIFICATION_TIMEOUT_MS;
234
+ return { command: cfg.command, timeoutMs };
235
+ }
236
+ /**
237
+ * The identity of the gate an EXPLICIT-METHOD row renders its verdict under: its
238
+ * method and what that method applies -- a deterministic row's command +
239
+ * normalized timeout (commitVerdictGateOf), any other method's whole config.
240
+ * Hashed, so it rides on gate_state; key order in the config does not change it.
241
+ * Two rows that apply the same gate share a key; a changed method, command,
242
+ * timeout or inspection config does not (verify/explicit-gate-outcome.ts). Pure.
243
+ */
244
+ export function explicitGateKeyOf(method, config) {
245
+ const applied = method === 'deterministic' ? commitVerdictGateOf({ verificationConfig: config }) : config;
246
+ return createHash('sha256').update(canonicalJson([method, applied])).digest('hex').slice(0, 16);
247
+ }
248
+ /** JSON with every object's keys sorted, so equal values serialize equally. Pure. */
249
+ function canonicalJson(value) {
250
+ if (Array.isArray(value))
251
+ return `[${value.map(canonicalJson).join(',')}]`;
252
+ if (typeof value === 'object' && value !== null) {
253
+ const record = value;
254
+ return `{${Object.keys(record).sort().map((k) => `${JSON.stringify(k)}:${canonicalJson(record[k])}`).join(',')}}`;
255
+ }
256
+ return JSON.stringify(value) ?? 'null';
257
+ }
258
+ /**
259
+ * Record the verdict a deterministic run rendered for its commit, keyed by the
260
+ * gate the run APPLIED (result.appliedConfig -- for a default-on candidate,
261
+ * re-resolved from the checkout it ran), else by the gate the verification
262
+ * carries. A no-op without a recorder, without a product + focus to key it by, or
263
+ * when the run rendered no verdict.
264
+ */
265
+ export function recordCommitVerdictFor(v, result, instrumentFault, record) {
266
+ const applied = result.appliedConfig;
267
+ const gate = applied ? { command: applied.command, timeoutMs: applied.timeoutMs } : commitVerdictGateOf(v);
268
+ if (!record || !v.productId || !v.focusId || !gate)
269
+ return;
270
+ const verdict = buildCommitVerdict({ productId: v.productId, focusId: v.focusId, deliveryId: v.deliveryId, gate }, result, instrumentFault);
271
+ if (verdict)
272
+ record(verdict);
273
+ }
274
+ /**
275
+ * The StrategyResult a delivery judged on an already-judged commit takes instead
276
+ * of running the gate: the recorded outcome with its attribution, never a
277
+ * timeout or unavailable flag (a record is only ever written for a real verdict).
278
+ */
279
+ export function strategyResultFromVerdict(verdict) {
280
+ const { rationale, failedStage, preExistingStages, newFailures, preExisting, logPath, stdoutTail, stderrTail, appliedConfig } = verdict;
281
+ return {
282
+ outcome: verdict.outcome,
283
+ exitCode: verdict.exitCode,
284
+ verifiedSha: verdict.sha,
285
+ rationale: `reused the verdict recorded for ${verdict.sha.slice(0, 8)} at ${verdict.recordedAt}`
286
+ + (rationale ? `: ${rationale}` : ''),
287
+ ...(failedStage !== undefined ? { failedStage } : {}),
288
+ ...(preExistingStages ? { preExistingStages } : {}),
289
+ ...(newFailures ? { newFailures } : {}),
290
+ ...(preExisting ? { preExisting } : {}),
291
+ ...(logPath !== undefined ? { logPath } : {}),
292
+ ...(stdoutTail !== undefined ? { stdoutTail } : {}),
293
+ ...(stderrTail !== undefined ? { stderrTail } : {}),
294
+ ...(appliedConfig ? { appliedConfig } : {}),
295
+ };
296
+ }
297
+ //# sourceMappingURL=commit-verdict-record.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"commit-verdict-record.js","sourceRoot":"","sources":["../../src/verify/commit-verdict-record.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,2EAA2E;AAC3E,qEAAqE;AACrE,gEAAgE;AAChE,6DAA6D;AAC7D,8EAA8E;AAC9E,+EAA+E;AAC/E,2EAA2E;AAC3E,uFAAuF;AACvF,mFAAmF;AACnF,oEAAoE;AACpE,2EAA2E;AAC3E,0EAA0E;AAC1E,gFAAgF;AAChF,oEAAoE;AACpE,sEAAsE;AACtE,+DAA+D;AAC/D,8DAA8D;AAC9D,4DAA4D;AAC5D,mEAAmE;AACnE,gBAAgB;AAEhB;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,YAAY,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC1F,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AACpE,OAAO,EAAE,+BAA+B,EAAuB,MAAM,iCAAiC,CAAC;AAEvG,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,MAAM,GAAG,GAAG,YAAY,CAAC,EAAE,MAAM,EAAE,cAAc,EAAE,CAAC,CAAC;AAwCrD,SAAS,UAAU;IACjB,OAAO,OAAO,CAAC,qBAAqB,EAAE,EAAE,uBAAuB,CAAC,CAAC;AACnE,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAC/B,SAAiB,EACjB,OAAe,EACf,GAAW,EACX,MAAc,UAAU,EAAE,EAC1B,IAAwB;IAExB,MAAM,IAAI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C,CAAC,EAAE,aAAa,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAC5C,CAAC;AACJ,CAAC"}
@@ -0,0 +1,161 @@
1
+ /**
2
+ * The verdict an EXPLICIT-METHOD verification run rendered for its delivery, kept
3
+ * where a daemon restart cannot lose it, and read by the verify routing it gates.
4
+ *
5
+ * An explicit-method run may write no per-commit verdict record: an in-place run
6
+ * judges no commit and an ai_inspection writes none. Its recorded outcome is then
7
+ * its gate verdict (completion/review-exit-verdict-gate.ts). The in-process
8
+ * registry (verify/gate-run-registry.ts) holds it, but a restart clears that
9
+ * registry, and the delivery row's own verification columns cannot carry the whole
10
+ * verdict: the durable row names the method and records a pass, but the edge
11
+ * records verification_outcome with no judged commit and resets a failure to
12
+ * null. So from the row alone, after a restart, a failure read as pending and a
13
+ * pass applied to whatever commit was judged.
14
+ *
15
+ * So each explicit run's terminal outcome, with the commit it applies to (null
16
+ * when it judged none), is also written to the delivery's gate_state under
17
+ * verificationHistory.explicitOutcome (queries/delivery-gate-state.ts) -- the
18
+ * history every clearing writer already carries forward. No migration and no edge
19
+ * change: gate_state is already the daemon's durable per-delivery record. A run
20
+ * that rendered no verdict removes it.
21
+ *
22
+ * A verdict also belongs to the GATE that rendered it. The edge lets an operator
23
+ * change a row's method or config without resetting its outcome or this history,
24
+ * so a pass gate A rendered at commit H would otherwise read as a pass for gate B
25
+ * at H, which never ran. Both records keep the key of the gate the run applied
26
+ * (commit-verdict-record.ts explicitGateKeyOf), and a reader that names the
27
+ * delivery's current gate (verify/commit-gate-configured.ts) takes only a verdict
28
+ * rendered under it; the explicit re-arm scan runs gate B instead.
29
+ *
30
+ * Invalidate first. The in-process registry forgets the previous run's verdict the
31
+ * moment a replacement run is selected; the durable record must forget it before
32
+ * that run can start. Otherwise a restart while the run waits on the verification
33
+ * semaphore or runs -- or a verdict write after it that fails -- exposes the older
34
+ * verdict as the latest, and a stale pass approves a review the replacement may
35
+ * fail. So the tick removes the record (invalidateExplicitGateOutcome) for every
36
+ * explicit candidate it selects, before any of them waits
37
+ * (verify/verification-commit-sharing.ts), and a candidate whose removal did not
38
+ * land is not started that tick. An explicit DETERMINISTIC candidate whose focus
39
+ * HEAD a per-commit verdict under its own gate already judges is the exception: no
40
+ * run replaces anything at selection, so the removal is deferred to its dispatch
41
+ * and made there only when that dispatch is about to route a verdict -- the
42
+ * per-commit one it takes in place of a run, then recorded here for that commit and
43
+ * gate key, or, finding none after all, its own run's (refused, it routes nothing
44
+ * and starts nothing). The delivery can leave verify while that removal awaits its
45
+ * row write: the removal itself refuses one it finds done or cancelled, and the
46
+ * dispatch re-reads the status once the removal lands, so one that moved anywhere
47
+ * else outside verify is routed nothing either. A reused failure already fed back
48
+ * routes nothing, so it removes nothing and its record stands. ai_inspection and
49
+ * behavioral rows record
50
+ * no per-commit verdict, so theirs is always removed at selection. Until the
51
+ * replacement's own write lands, the durable state reads "no verdict": routing
52
+ * holds, and a restarted daemon selects the row again -- the pending queue lists
53
+ * it, or the explicit re-arm scan finds a row pass with no record of its run.
54
+ *
55
+ * Read: this process's own knowledge first -- a verdict it recorded, or a
56
+ * selection of the row since, which forgets the run before it -- else the durable
57
+ * record on the gate_state the caller read. Routing after a restart therefore
58
+ * consumes the verdict actually rendered and never depends on the registry. The
59
+ * row's own verification_outcome pass names no commit, so it approves nothing:
60
+ * where neither knows the run, the explicit re-arm scan (verify/explicit-rearm.ts)
61
+ * selects the row again, and that run's record binds the verdict to its commit.
62
+ *
63
+ * Direction of error: the removal fails closed -- no replacement run starts over a
64
+ * verdict it could not remove, and the next tick asks again -- while the verdict
65
+ * write after the run is best-effort: a failed write logs and leaves "no verdict"
66
+ * (the removal already landed), never the older record, so routing holds until a
67
+ * later run records one. A recorded verdict can only hold a done route or let
68
+ * re-work route: a failure holds done, and a pass applies only to the commit it
69
+ * judged -- or, when it judged none, to the delivery, exactly as the in-process
70
+ * record always has.
71
+ *
72
+ * Both writers own the record, its run id included, and only they change it. Each
73
+ * reads the row and writes it in the delivery's serialized write turn
74
+ * (queries/delivery-write-discipline.ts, via queries/deliveries.ts
75
+ * rewriteDeliveryGateStateAtOwnStatus), stamps only its own key over that FRESH
76
+ * gate_state, and writes at the fresh status -- nothing to a delivery that is done
77
+ * or cancelled. So a hold written after their read is never erased and a status
78
+ * never moves back; and every other gate_state writer that goes through the single
79
+ * writer sends the row's record, never one its own earlier read carried, so it
80
+ * never resurrects a removed verdict.
81
+ *
82
+ * A stale writer the discipline does not reach cannot bring it back either: a
83
+ * gate_state write that carries the history of a row read before the removal,
84
+ * outside this process's serialized turn, writes the older verdict back after it.
85
+ * So every removal first names a fresh run id in a host-local ledger
86
+ * (verify/explicit-run-ledger.ts): the verdict its dispatch routes -- run or reused
87
+ * -- is recorded with that id, a run a later removal superseded records nothing,
88
+ * and a durable record is a verdict only while its id is the current one -- carried
89
+ * back, it reads as no verdict.
90
+ *
91
+ * @module verify/explicit-gate-outcome
92
+ */
93
+ import { type DeliveryGateRowIo } from '../queries/deliveries.js';
94
+ import { type RecordedExplicitOutcome, type RecordedGateOutcome } from './gate-run-registry.js';
95
+ /** Injected row IO for the durable write (the real row read and physical write by default). */
96
+ export interface ExplicitGateOutcomeWriteDeps extends DeliveryGateRowIo {
97
+ now: () => string;
98
+ /** Name `runId` the delivery's current explicit run in the ledger; throws when that cannot be written. */
99
+ beginRun: (deliveryId: string, runId: string) => void;
100
+ /** Whether `runId` is still the delivery's current explicit run. */
101
+ isCurrentRun: (deliveryId: string, runId: string) => boolean;
102
+ }
103
+ /**
104
+ * Record an explicit-method run's verdict on its delivery's gate_state (see the
105
+ * module header): the verdict it rendered under the gate it applied (`gateKey`),
106
+ * as run `runId` (the id its dispatch named; undefined for a run none named), or
107
+ * no record when it rendered none. Stamped over the FRESH row at the row's OWN
108
+ * status in one serialized write turn, so the gate-only write never moves the
109
+ * delivery and keeps whatever else the row holds. Nothing is written when there is
110
+ * neither a verdict nor a record to remove, for a delivery that is done or
111
+ * cancelled, or for a run a later removal superseded -- asked inside that same
112
+ * turn, so a supersession named while this write waited for it is seen.
113
+ * Best-effort: never throws. Returns whether a write landed.
114
+ */
115
+ export declare function persistExplicitGateOutcome(deliveryId: string, result: {
116
+ outcome: string;
117
+ verifiedSha?: string;
118
+ }, gateKey: string, runId: string | undefined, deps?: Partial<ExplicitGateOutcomeWriteDeps>): Promise<boolean>;
119
+ /**
120
+ * Durably forget the verdict the delivery's previous explicit run rendered, before
121
+ * a replacement verdict is routed (see the module header): `runId`, the
122
+ * replacement, is first named the delivery's current run -- which voids every
123
+ * older record, wherever a writer carries it -- then the record is removed from the
124
+ * FRESH row at the row's OWN status in one serialized write turn, so the gate-only
125
+ * write never moves the delivery and keeps a hold written before it. Nothing is
126
+ * written to the row when there is no record to remove, or for a delivery that is
127
+ * not found or stopped cycling (done or cancelled). Never throws. Returns whether
128
+ * the replacement may be routed: true once the durable state reads "no verdict" for
129
+ * a delivery still cycling. False refuses it: the run could not be named, the row
130
+ * could not be read, or the write failed -- the older verdict may still stand -- or
131
+ * the delivery is not found or stopped cycling, which no verdict is routed to (its
132
+ * run was named first, so a record it keeps reads as no verdict). A delivery that
133
+ * moved to a status that still cycles (verify_failed, coding) has its record removed
134
+ * at that status and resolves true: the dispatch re-reads the status once this
135
+ * lands, and that read refuses it (verify/verification-commit-sharing.ts).
136
+ */
137
+ export declare function invalidateExplicitGateOutcome(deliveryId: string, runId: string, deps?: Partial<ExplicitGateOutcomeWriteDeps>): Promise<boolean>;
138
+ /**
139
+ * The explicit-method verdict to read for the delivery, whatever commit it applies
140
+ * to: this process's own knowledge, else the durable record on `gateState` while
141
+ * the run that recorded it is the delivery's current one; null when neither holds
142
+ * one (no run recorded, the latest run rendered none, or a later run superseded it).
143
+ */
144
+ export declare function readExplicitGateOutcomeRecord(deliveryId: string, gateState: unknown): RecordedExplicitOutcome | null;
145
+ /**
146
+ * The verdict an explicit-method run rendered for the delivery when it applies to
147
+ * `sha` -- the run judged that commit, or judged none -- under `gateKey`, else
148
+ * null. `gateState` is the delivery's gate_state as the caller read it. A null
149
+ * `gateKey` names no explicit gate (the row names no method), so no verdict
150
+ * applies; an undefined one (the delivery's gate could not be read) takes a
151
+ * verdict rendered under any gate.
152
+ */
153
+ export declare function readDeliveryGateOutcome(deliveryId: string, sha: string | null, gateState?: unknown, gateKey?: string | null): RecordedGateOutcome | null;
154
+ /**
155
+ * Whether an explicit-method run rendered a verdict for the delivery, in this
156
+ * process or on `gateState`, whatever commit it applies to. A terminal explicit
157
+ * row leaves daemon_get_pending_verifications, so this is what still says the
158
+ * delivery is gated by its own run (verify/commit-gate-configured.ts).
159
+ */
160
+ export declare function hasRecordedExplicitGateOutcome(deliveryId: string, gateState?: unknown): boolean;
161
+ //# sourceMappingURL=explicit-gate-outcome.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"explicit-gate-outcome.d.ts","sourceRoot":"","sources":["../../src/verify/explicit-gate-outcome.ts"],"names":[],"mappings":"AAWA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2FG;AAEH,OAAO,EAAuC,KAAK,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAMvG,OAAO,EAGL,KAAK,uBAAuB,EAC5B,KAAK,mBAAmB,EACzB,MAAM,wBAAwB,CAAC;AAMhC,+FAA+F;AAC/F,MAAM,WAAW,4BAA6B,SAAQ,iBAAiB;IACrE,GAAG,EAAE,MAAM,MAAM,CAAC;IAClB,0GAA0G;IAC1G,QAAQ,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACtD,oEAAoE;IACpE,YAAY,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC;CAC9D;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,0BAA0B,CAC9C,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE;IAAE,OAAO,EA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