@telora/daemon 0.21.83 → 0.21.134

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 (267) hide show
  1. package/build-info.json +10 -3
  2. package/dist/audit/audit-hooks.d.ts +106 -0
  3. package/dist/audit/audit-hooks.d.ts.map +1 -1
  4. package/dist/audit/audit-hooks.js +149 -17
  5. package/dist/audit/audit-hooks.js.map +1 -1
  6. package/dist/ci/ci-sensor-loop.d.ts +6 -0
  7. package/dist/ci/ci-sensor-loop.d.ts.map +1 -1
  8. package/dist/ci/ci-sensor-loop.js +50 -3
  9. package/dist/ci/ci-sensor-loop.js.map +1 -1
  10. package/dist/ci/ci-status.d.ts +63 -11
  11. package/dist/ci/ci-status.d.ts.map +1 -1
  12. package/dist/ci/ci-status.js +94 -27
  13. package/dist/ci/ci-status.js.map +1 -1
  14. package/dist/completion/coverage-drift-state.d.ts +29 -2
  15. package/dist/completion/coverage-drift-state.d.ts.map +1 -1
  16. package/dist/completion/coverage-drift-state.js +42 -2
  17. package/dist/completion/coverage-drift-state.js.map +1 -1
  18. package/dist/completion/coverage-stabilized.d.ts +58 -0
  19. package/dist/completion/coverage-stabilized.d.ts.map +1 -0
  20. package/dist/completion/coverage-stabilized.js +84 -0
  21. package/dist/completion/coverage-stabilized.js.map +1 -0
  22. package/dist/completion/delivery-advancement-guard.d.ts +21 -0
  23. package/dist/completion/delivery-advancement-guard.d.ts.map +1 -1
  24. package/dist/completion/delivery-advancement-guard.js +31 -3
  25. package/dist/completion/delivery-advancement-guard.js.map +1 -1
  26. package/dist/completion/event-escalations.d.ts +15 -0
  27. package/dist/completion/event-escalations.d.ts.map +1 -1
  28. package/dist/completion/event-escalations.js +42 -4
  29. package/dist/completion/event-escalations.js.map +1 -1
  30. package/dist/completion/event-phases.d.ts.map +1 -1
  31. package/dist/completion/event-phases.js +10 -5
  32. package/dist/completion/event-phases.js.map +1 -1
  33. package/dist/completion/machine-remediable-demotion.d.ts +74 -0
  34. package/dist/completion/machine-remediable-demotion.d.ts.map +1 -0
  35. package/dist/completion/machine-remediable-demotion.js +147 -0
  36. package/dist/completion/machine-remediable-demotion.js.map +1 -0
  37. package/dist/completion/review-exit-escalations.d.ts +36 -1
  38. package/dist/completion/review-exit-escalations.d.ts.map +1 -1
  39. package/dist/completion/review-exit-escalations.js +81 -0
  40. package/dist/completion/review-exit-escalations.js.map +1 -1
  41. package/dist/completion/review-exit-phase.d.ts +4 -2
  42. package/dist/completion/review-exit-phase.d.ts.map +1 -1
  43. package/dist/completion/review-exit-phase.js +49 -54
  44. package/dist/completion/review-exit-phase.js.map +1 -1
  45. package/dist/completion/settle-injection-sweep.d.ts +55 -0
  46. package/dist/completion/settle-injection-sweep.d.ts.map +1 -0
  47. package/dist/completion/settle-injection-sweep.js +88 -0
  48. package/dist/completion/settle-injection-sweep.js.map +1 -0
  49. package/dist/completion/state-cascade.d.ts.map +1 -1
  50. package/dist/completion/state-cascade.js +41 -0
  51. package/dist/completion/state-cascade.js.map +1 -1
  52. package/dist/completion/status-advance-phase.d.ts.map +1 -1
  53. package/dist/completion/status-advance-phase.js +28 -30
  54. package/dist/completion/status-advance-phase.js.map +1 -1
  55. package/dist/completion/team-lifecycle.d.ts +42 -0
  56. package/dist/completion/team-lifecycle.d.ts.map +1 -1
  57. package/dist/completion/team-lifecycle.js +79 -2
  58. package/dist/completion/team-lifecycle.js.map +1 -1
  59. package/dist/delivery/delivery-lifecycle.d.ts +19 -33
  60. package/dist/delivery/delivery-lifecycle.d.ts.map +1 -1
  61. package/dist/delivery/delivery-lifecycle.js +26 -160
  62. package/dist/delivery/delivery-lifecycle.js.map +1 -1
  63. package/dist/delivery/delivery-merge-ops.d.ts +46 -0
  64. package/dist/delivery/delivery-merge-ops.d.ts.map +1 -0
  65. package/dist/delivery/delivery-merge-ops.js +154 -0
  66. package/dist/delivery/delivery-merge-ops.js.map +1 -0
  67. package/dist/delivery/delivery-reconciler-apply.d.ts +108 -66
  68. package/dist/delivery/delivery-reconciler-apply.d.ts.map +1 -1
  69. package/dist/delivery/delivery-reconciler-apply.js +87 -61
  70. package/dist/delivery/delivery-reconciler-apply.js.map +1 -1
  71. package/dist/delivery/delivery-reconciler.d.ts +7 -2
  72. package/dist/delivery/delivery-reconciler.d.ts.map +1 -1
  73. package/dist/delivery/delivery-reconciler.js +34 -5
  74. package/dist/delivery/delivery-reconciler.js.map +1 -1
  75. package/dist/delivery/external-hold-surface.d.ts +32 -0
  76. package/dist/delivery/external-hold-surface.d.ts.map +1 -0
  77. package/dist/delivery/external-hold-surface.js +67 -0
  78. package/dist/delivery/external-hold-surface.js.map +1 -0
  79. package/dist/delivery/external-hold.d.ts +38 -0
  80. package/dist/delivery/external-hold.d.ts.map +1 -1
  81. package/dist/delivery/external-hold.js +69 -6
  82. package/dist/delivery/external-hold.js.map +1 -1
  83. package/dist/delivery/operator-hold.d.ts +1 -2
  84. package/dist/delivery/operator-hold.d.ts.map +1 -1
  85. package/dist/delivery/operator-hold.js +1 -2
  86. package/dist/delivery/operator-hold.js.map +1 -1
  87. package/dist/delivery/paused-revival.d.ts +140 -0
  88. package/dist/delivery/paused-revival.d.ts.map +1 -0
  89. package/dist/delivery/paused-revival.js +229 -0
  90. package/dist/delivery/paused-revival.js.map +1 -0
  91. package/dist/delivery/wait-reachability.d.ts +149 -0
  92. package/dist/delivery/wait-reachability.d.ts.map +1 -0
  93. package/dist/delivery/wait-reachability.js +193 -0
  94. package/dist/delivery/wait-reachability.js.map +1 -0
  95. package/dist/directive/close-loop-dispatcher.d.ts +16 -263
  96. package/dist/directive/close-loop-dispatcher.d.ts.map +1 -1
  97. package/dist/directive/close-loop-dispatcher.js +21 -259
  98. package/dist/directive/close-loop-dispatcher.js.map +1 -1
  99. package/dist/directive/directive-dispatch.d.ts +19 -0
  100. package/dist/directive/directive-dispatch.d.ts.map +1 -1
  101. package/dist/directive/directive-dispatch.js +18 -0
  102. package/dist/directive/directive-dispatch.js.map +1 -1
  103. package/dist/directive/directive-executor.d.ts +1 -3
  104. package/dist/directive/directive-executor.d.ts.map +1 -1
  105. package/dist/directive/directive-executor.js +23 -21
  106. package/dist/directive/directive-executor.js.map +1 -1
  107. package/dist/directive/phase-sync.d.ts +28 -15
  108. package/dist/directive/phase-sync.d.ts.map +1 -1
  109. package/dist/directive/phase-sync.js +28 -36
  110. package/dist/directive/phase-sync.js.map +1 -1
  111. package/dist/directive/resolver-dispatch.d.ts +19 -92
  112. package/dist/directive/resolver-dispatch.d.ts.map +1 -1
  113. package/dist/directive/resolver-dispatch.js +19 -65
  114. package/dist/directive/resolver-dispatch.js.map +1 -1
  115. package/dist/focus/focus-engine.d.ts.map +1 -1
  116. package/dist/focus/focus-engine.js +26 -0
  117. package/dist/focus/focus-engine.js.map +1 -1
  118. package/dist/focus/focus-executor.d.ts.map +1 -1
  119. package/dist/focus/focus-executor.js +290 -256
  120. package/dist/focus/focus-executor.js.map +1 -1
  121. package/dist/focus/focus-loop-registry.d.ts.map +1 -1
  122. package/dist/focus/focus-loop-registry.js +43 -1
  123. package/dist/focus/focus-loop-registry.js.map +1 -1
  124. package/dist/focus/focus-respawn-guard.d.ts.map +1 -1
  125. package/dist/focus/focus-respawn-guard.js +11 -2
  126. package/dist/focus/focus-respawn-guard.js.map +1 -1
  127. package/dist/focus/focus-team-state.d.ts +11 -0
  128. package/dist/focus/focus-team-state.d.ts.map +1 -1
  129. package/dist/focus/focus-team-state.js +17 -0
  130. package/dist/focus/focus-team-state.js.map +1 -1
  131. package/dist/focus/listener-auto-advance.d.ts +13 -1
  132. package/dist/focus/listener-auto-advance.d.ts.map +1 -1
  133. package/dist/focus/listener-auto-advance.js +112 -76
  134. package/dist/focus/listener-auto-advance.js.map +1 -1
  135. package/dist/focus/listener.d.ts.map +1 -1
  136. package/dist/focus/listener.js +141 -75
  137. package/dist/focus/listener.js.map +1 -1
  138. package/dist/focus/tick-deadline.d.ts +55 -0
  139. package/dist/focus/tick-deadline.d.ts.map +1 -0
  140. package/dist/focus/tick-deadline.js +91 -0
  141. package/dist/focus/tick-deadline.js.map +1 -0
  142. package/dist/focus-stage-lifecycle/index.d.ts +18 -25
  143. package/dist/focus-stage-lifecycle/index.d.ts.map +1 -1
  144. package/dist/focus-stage-lifecycle/index.js +26 -38
  145. package/dist/focus-stage-lifecycle/index.js.map +1 -1
  146. package/dist/focus-stage-lifecycle/wedge-cause-arbiter.d.ts +52 -0
  147. package/dist/focus-stage-lifecycle/wedge-cause-arbiter.d.ts.map +1 -0
  148. package/dist/focus-stage-lifecycle/wedge-cause-arbiter.js +94 -0
  149. package/dist/focus-stage-lifecycle/wedge-cause-arbiter.js.map +1 -0
  150. package/dist/focus-stage-lifecycle/wedge-watchdog.d.ts +18 -1
  151. package/dist/focus-stage-lifecycle/wedge-watchdog.d.ts.map +1 -1
  152. package/dist/focus-stage-lifecycle/wedge-watchdog.js +57 -7
  153. package/dist/focus-stage-lifecycle/wedge-watchdog.js.map +1 -1
  154. package/dist/git/merge.d.ts.map +1 -1
  155. package/dist/git/merge.js +12 -3
  156. package/dist/git/merge.js.map +1 -1
  157. package/dist/guard/condition-evaluators.d.ts +9 -0
  158. package/dist/guard/condition-evaluators.d.ts.map +1 -1
  159. package/dist/guard/condition-evaluators.js +15 -0
  160. package/dist/guard/condition-evaluators.js.map +1 -1
  161. package/dist/guard/guard-evaluator.d.ts +17 -1
  162. package/dist/guard/guard-evaluator.d.ts.map +1 -1
  163. package/dist/guard/guard-evaluator.js +61 -2
  164. package/dist/guard/guard-evaluator.js.map +1 -1
  165. package/dist/guard/trigger-executor.d.ts +30 -18
  166. package/dist/guard/trigger-executor.d.ts.map +1 -1
  167. package/dist/guard/trigger-executor.js +55 -31
  168. package/dist/guard/trigger-executor.js.map +1 -1
  169. package/dist/prompt/team-prompt-base.d.ts +1 -1
  170. package/dist/prompt/team-prompt-base.d.ts.map +1 -1
  171. package/dist/prompt/team-prompt-base.js +1 -1
  172. package/dist/prompt/team-prompt-base.js.map +1 -1
  173. package/dist/prompt-sections/persona-sections.d.ts +0 -32
  174. package/dist/prompt-sections/persona-sections.d.ts.map +1 -1
  175. package/dist/prompt-sections/persona-sections.js +19 -88
  176. package/dist/prompt-sections/persona-sections.js.map +1 -1
  177. package/dist/queries/deliveries.d.ts +33 -0
  178. package/dist/queries/deliveries.d.ts.map +1 -1
  179. package/dist/queries/deliveries.js +7 -0
  180. package/dist/queries/deliveries.js.map +1 -1
  181. package/dist/queries/focuses.d.ts +46 -0
  182. package/dist/queries/focuses.d.ts.map +1 -1
  183. package/dist/queries/focuses.js +60 -0
  184. package/dist/queries/focuses.js.map +1 -1
  185. package/dist/queries/guards.d.ts +10 -0
  186. package/dist/queries/guards.d.ts.map +1 -1
  187. package/dist/queries/guards.js +14 -1
  188. package/dist/queries/guards.js.map +1 -1
  189. package/dist/queries/issues.d.ts +65 -1
  190. package/dist/queries/issues.d.ts.map +1 -1
  191. package/dist/queries/issues.js +135 -2
  192. package/dist/queries/issues.js.map +1 -1
  193. package/dist/queries/schemas.d.ts +53 -0
  194. package/dist/queries/schemas.d.ts.map +1 -1
  195. package/dist/queries/schemas.js +38 -0
  196. package/dist/queries/schemas.js.map +1 -1
  197. package/dist/queries/verification.d.ts +5 -6
  198. package/dist/queries/verification.d.ts.map +1 -1
  199. package/dist/queries/verification.js +5 -6
  200. package/dist/queries/verification.js.map +1 -1
  201. package/dist/resolvers/loop-persona.d.ts +1 -11
  202. package/dist/resolvers/loop-persona.d.ts.map +1 -1
  203. package/dist/resolvers/loop-persona.js +2 -16
  204. package/dist/resolvers/loop-persona.js.map +1 -1
  205. package/dist/shell/heartbeat.d.ts +7 -0
  206. package/dist/shell/heartbeat.d.ts.map +1 -1
  207. package/dist/shell/heartbeat.js +1 -1
  208. package/dist/shell/heartbeat.js.map +1 -1
  209. package/dist/shell/unified-shell-provisioning.d.ts +40 -0
  210. package/dist/shell/unified-shell-provisioning.d.ts.map +1 -1
  211. package/dist/shell/unified-shell-provisioning.js +72 -0
  212. package/dist/shell/unified-shell-provisioning.js.map +1 -1
  213. package/dist/shell/unified-shell.d.ts.map +1 -1
  214. package/dist/shell/unified-shell.js +18 -1
  215. package/dist/shell/unified-shell.js.map +1 -1
  216. package/dist/spawn/helpers.d.ts.map +1 -1
  217. package/dist/spawn/helpers.js +6 -1
  218. package/dist/spawn/helpers.js.map +1 -1
  219. package/dist/spawn/process-spawn.d.ts.map +1 -1
  220. package/dist/spawn/process-spawn.js +7 -0
  221. package/dist/spawn/process-spawn.js.map +1 -1
  222. package/dist/spawn/respawn-cycle-escalation.d.ts +41 -0
  223. package/dist/spawn/respawn-cycle-escalation.d.ts.map +1 -0
  224. package/dist/spawn/respawn-cycle-escalation.js +83 -0
  225. package/dist/spawn/respawn-cycle-escalation.js.map +1 -0
  226. package/dist/spawn/spawn-cooldown.d.ts +119 -2
  227. package/dist/spawn/spawn-cooldown.d.ts.map +1 -1
  228. package/dist/spawn/spawn-cooldown.js +120 -10
  229. package/dist/spawn/spawn-cooldown.js.map +1 -1
  230. package/dist/spawn/spawn-decision.d.ts.map +1 -1
  231. package/dist/spawn/spawn-decision.js +33 -1
  232. package/dist/spawn/spawn-decision.js.map +1 -1
  233. package/dist/testing/fixtures/index.d.ts +64 -0
  234. package/dist/testing/fixtures/index.d.ts.map +1 -0
  235. package/dist/testing/fixtures/index.js +220 -0
  236. package/dist/testing/fixtures/index.js.map +1 -0
  237. package/dist/update/build-info.d.ts +1 -0
  238. package/dist/update/build-info.d.ts.map +1 -1
  239. package/dist/update/build-info.js +1 -1
  240. package/dist/update/build-info.js.map +1 -1
  241. package/dist/verify/stall-detector-config.d.ts +8 -0
  242. package/dist/verify/stall-detector-config.d.ts.map +1 -1
  243. package/dist/verify/stall-detector-config.js +40 -0
  244. package/dist/verify/stall-detector-config.js.map +1 -1
  245. package/dist/verify/stall-detectors.d.ts +57 -14
  246. package/dist/verify/stall-detectors.d.ts.map +1 -1
  247. package/dist/verify/stall-detectors.js +72 -55
  248. package/dist/verify/stall-detectors.js.map +1 -1
  249. package/dist/verify/verification-feedback.d.ts +3 -4
  250. package/dist/verify/verification-feedback.d.ts.map +1 -1
  251. package/dist/verify/verification-feedback.js +3 -12
  252. package/dist/verify/verification-feedback.js.map +1 -1
  253. package/dist/workflow/gate-failure-policy.d.ts +48 -0
  254. package/dist/workflow/gate-failure-policy.d.ts.map +1 -0
  255. package/dist/workflow/gate-failure-policy.js +57 -0
  256. package/dist/workflow/gate-failure-policy.js.map +1 -0
  257. package/dist/workflow/pipeline-config.d.ts +2 -2
  258. package/dist/workflow/pipeline-config.js +2 -2
  259. package/package.json +3 -3
  260. package/dist/directive/close-loop-stage.d.ts +0 -50
  261. package/dist/directive/close-loop-stage.d.ts.map +0 -1
  262. package/dist/directive/close-loop-stage.js +0 -210
  263. package/dist/directive/close-loop-stage.js.map +0 -1
  264. package/dist/focus-stage-lifecycle/review-convergence.d.ts +0 -133
  265. package/dist/focus-stage-lifecycle/review-convergence.d.ts.map +0 -1
  266. package/dist/focus-stage-lifecycle/review-convergence.js +0 -237
  267. package/dist/focus-stage-lifecycle/review-convergence.js.map +0 -1
@@ -1,85 +1,127 @@
1
1
  /**
2
- * Activation layer for the single-writer delivery reconciler.
2
+ * Thin decision seam over the pure delivery reconciler.
3
3
  *
4
- * Delivery 4 of the Delivery Execution Pathway Consolidation focus (reality-tree
5
- * injection #10). This is the step that makes the pure reconciler
6
- * (delivery-reconciler.ts) the DECISION AUTHORITY for every daemon
7
- * execution_status write, with the two safety properties the focus method
8
- * (characterize -> shadow -> flip, reversible) requires:
4
+ * The pure reconciler (delivery-reconciler.ts) is the DECISION AUTHORITY for
5
+ * every daemon execution_status write. `resolveReconciledWrite` is the single
6
+ * entry point the write sites call to turn a `ReconcileInput` into the status to
7
+ * write; the caller then routes that status through `updateDeliveryStatus` (the
8
+ * sole physical writer).
9
9
  *
10
- * 1. Runtime self-check (replaces the manual prod shadow-observation gate).
11
- * Each write site still computes what the legacy ("old path") logic would
12
- * have written; `resolveReconciledWrite` compares that to the reconciler's
13
- * target and logs `[reconciler-divergence]` on any mismatch. The retained
14
- * legacy computation is exactly what lets prod self-verify the reconciler
15
- * against the prior behavior for one release -- no maintenance-window or
16
- * manual shadow observation needed.
17
- *
18
- * 2. Reversibility. A single switch, `TELORA_RECONCILER_WRITE`, DEFAULT-ON,
19
- * selects whose decision is WRITTEN: ON -> the reconciler; OFF -> the
20
- * retained legacy target. Flip to '0'/'off'/'false'/'no' (and restart) to
21
- * revert instantly; the whole consolidation also reverts as one merge.
22
- *
23
- * Why activation is safe (suite stays green by construction): the reconciler was
24
- * built (Delivery 3) to MIRROR the live writers and proven so by the Delivery 2
25
- * parity tests. So in every characterized case `result.target === legacyTarget`
26
- * -- the write is byte-identical and the characterization suite stays green. The
27
- * self-check exists to catch any UN-characterized prod case where they differ.
10
+ * HISTORY (retired): this module was once an activation layer that ran the
11
+ * reconciler in SHADOW alongside a retained "legacy" per-site computation,
12
+ * logged `[reconciler-divergence]` on any mismatch, and gated the write behind a
13
+ * default-on `TELORA_RECONCILER_WRITE` kill switch (ON -> reconciler, OFF ->
14
+ * legacy target). The characterize -> shadow -> flip migration is complete: the
15
+ * reconciler has been the authoritative writer with zero divergence, so the
16
+ * legacy computation, the divergence log, and the kill switch have all been
17
+ * retired. The reconciler's target IS the write; there is no second path to
18
+ * compare it against.
28
19
  *
29
20
  * The single shared "issues are done" predicate (areDeliveryIssuesDone) and the
30
- * agreed terminal set live in delivery-reconciler.ts. The agreed set is
31
- * {Done, Verified, In Review} (OPEN = {To Do, In Progress, Blocked}); the
32
- * divergent Postgres literal-Done predicate is removed in Delivery 5.
21
+ * agreed terminal set live in delivery-reconciler.ts.
33
22
  */
34
- import { type ReconcileInput, type ReconcileResult } from './delivery-reconciler.js';
23
+ import { type ReconcileInput, type ReconcileResult, type ReconcilerIssue } from './delivery-reconciler.js';
35
24
  import type { ExecutionStatus } from '@telora/daemon-core';
36
- /** Reversibility switch. DEFAULT-ON (opt-out), unlike the shadow's opt-in flag. */
37
- export declare const RECONCILER_WRITE_ENV = "TELORA_RECONCILER_WRITE";
38
- /**
39
- * Whether the reconciler's decision is the one WRITTEN. DEFAULT-ON: unset / ''
40
- * / any value other than the explicit off-tokens enables it. Only
41
- * '0'/'off'/'false'/'no' (case-insensitive) revert to writing the legacy target.
42
- *
43
- * This mirrors the opt-OUT semantics of shouldRunLoop (undefined/'' -> on,
44
- * '0' -> off) rather than the shadow harness's opt-IN, because the reconciler is
45
- * the intended default writer after this delivery -- reverting is the exception.
46
- */
47
- export declare function reconcilerWriteEnabled(env?: NodeJS.ProcessEnv): boolean;
25
+ import type { DeliveryGateState, updateDeliveryStatus } from '../queries/deliveries.js';
48
26
  export interface ReconciledWriteDecision {
49
- /**
50
- * The status the caller should WRITE: the reconciler's target when the switch
51
- * is ON (default), otherwise the retained legacy target.
52
- */
27
+ /** The status the caller should WRITE (the reconciler's target). */
53
28
  target: ExecutionStatus;
54
- /** The reconciler's computed result -- always present, regardless of the switch. */
29
+ /** The reconciler's full computed result (canonical + reason), for logging/debug. */
55
30
  result: ReconcileResult;
56
- /** Whether the reconciler's target differs from the legacy target. */
57
- diverged: boolean;
58
- /** Whether the reconciler's decision is the one being written (the switch state). */
59
- reconcilerAuthoritative: boolean;
60
31
  }
61
32
  export interface ResolveReconciledWriteParams {
62
- /** Short site label for the divergence log (e.g. 'auto-advance', 'completion'). */
63
- site: string;
64
- deliveryId: string;
65
- deliveryName: string;
66
33
  /** The full signal for the reconciler. currentStatus is the status at THIS step. */
67
34
  input: ReconcileInput;
68
- /** What the legacy/old-path code decided to write for this same step. */
69
- legacyTarget: ExecutionStatus;
70
35
  }
71
- export interface ReconciledWriteDeps {
72
- /** Divergence sink. Defaults to console.log; injected in tests for capture. */
73
- log?: (message: string) => void;
74
- /** Switch state. Defaults to reconcilerWriteEnabled(); injected in tests. */
75
- writeEnabled?: () => boolean;
36
+ /**
37
+ * Decide what status to write for one transition step. Single-step: callers that
38
+ * walk multiple steps in one pass (e.g. queued -> coding -> verify) call this
39
+ * once per actual write, keying `input.currentStatus` to that step, so the
40
+ * reconciler's single-step decision corresponds 1:1 to each write.
41
+ */
42
+ export declare function resolveReconciledWrite(params: ResolveReconciledWriteParams): ReconciledWriteDecision;
43
+ /**
44
+ * The reconciler input for the WORK-START crossing (queued -> coding the moment a
45
+ * work issue is In Progress). This exact input is built identically at all three
46
+ * work-start sites -- the live poll tick (listener-auto-advance.checkDeliveryWorkStart),
47
+ * the teamless auto-advance queued step (listener-auto-advance.checkDeliveryAutoAdvance),
48
+ * and the team-exit completion path (completion/status-advance-phase) -- so it has
49
+ * ONE definition here. A queued delivery is not git-touching to cross, so the
50
+ * worktree is treated as committed; there is no guard or review signal at this edge.
51
+ */
52
+ export declare function workStartReconcileInput(issues: readonly ReconcilerIssue[]): ReconcileInput;
53
+ /**
54
+ * The reconciler input for a RECONCILER-DRIVEN advance step -- the daemon walks a
55
+ * `coding` / `queued` / `verify_failed` delivery forward and the reconciler
56
+ * decides the target. This is the SINGLE construction site for that input, shared
57
+ * by the team path (delivery-lifecycle.advanceDeliveryStage) and the teamless path
58
+ * (listener-auto-advance), so "which fields the reconciler sees at an advance" has
59
+ * ONE definition rather than a hand-spelled object at each call site.
60
+ *
61
+ * `guardVerdict` is a REQUIRED argument on purpose (TEL-1: "measure the inputs at
62
+ * a single site ... so bypassing a measurement requires removing it"): a caller
63
+ * cannot OMIT it and silently get an unmeasured guard. Passing `null` is the
64
+ * EXPLICIT, reviewable choice made only at edges that genuinely have no guard
65
+ * (queued->coding; the verify_failed->queued re-queue). At the coding->verify edge
66
+ * the caller passes the MEASURED verdict (delivery-lifecycle's measureGuard /
67
+ * listener-auto-advance's measureGuardAtAdvance) -- the same measurement on both
68
+ * paths (the D6 parity invariant). gitState is committed BY CONTRACT
69
+ * (ensureWorktreeCommittedBeforeAdvance runs before this input is built) and there
70
+ * is no review signal at these edges (verify->done review routing is a separate
71
+ * path).
72
+ */
73
+ export declare function advanceReconcileInput(params: {
74
+ currentStatus: ExecutionStatus;
75
+ issues: readonly ReconcilerIssue[];
76
+ guardVerdict: {
77
+ blocked: boolean;
78
+ } | null;
79
+ discoveryOnly?: boolean;
80
+ }): ReconcileInput;
81
+ /** The write callback shape the step applier needs (matches queries/deliveries.updateDeliveryStatus). */
82
+ export type UpdateDeliveryStatusFn = typeof updateDeliveryStatus;
83
+ export interface ApplyReconciledStepParams {
84
+ deliveryId: string;
85
+ /** The delivery's current status; the reconciler decides the step FROM here. */
86
+ fromStatus: ExecutionStatus;
87
+ input: ReconcileInput;
88
+ /** The workflow stages, to resolve the target status's stage id. */
89
+ stages: ReadonlyArray<{
90
+ id: string;
91
+ name: string;
92
+ }>;
93
+ organizationId: string;
94
+ /** gate_state to write with the transition (default: leave untouched). */
95
+ gateState?: DeliveryGateState | null;
96
+ /**
97
+ * When true, DO NOT write if the target status has no matching workflow stage
98
+ * (the completion path warns and leaves the delivery put in that case). When
99
+ * false (default), write regardless -- the target's stage id is best-effort
100
+ * (the live poll-tick path always writes the reconciler target). This flag is
101
+ * how one primitive reproduces both sites' stage-not-found behavior exactly.
102
+ */
103
+ requireStageToWrite?: boolean;
104
+ }
105
+ export interface ApplyReconciledStepResult {
106
+ /** The reconciler's target for this step. */
107
+ target: ExecutionStatus;
108
+ /** True when the reconciler moved off fromStatus (a crossing is due). */
109
+ changed: boolean;
110
+ /** True when a status write was actually issued. */
111
+ written: boolean;
112
+ /** The resolved stage for the target, if the workflow names one. */
113
+ stageId: string | undefined;
114
+ /** False when `changed` but the target has no matching workflow stage. */
115
+ stageFound: boolean;
76
116
  }
77
117
  /**
78
- * Decide what status to write for one transition step, with the runtime
79
- * self-check. Single-step: callers that walk multiple steps in one pass
80
- * (e.g. queued -> coding -> verify) call this once per actual write, keying
81
- * `input.currentStatus` + `legacyTarget` to that step, so the reconciler's
82
- * single-step decision and the legacy step correspond 1:1.
118
+ * Reconcile ONE transition step and write it through the single physical writer
119
+ * (updateDeliveryStatus), keyed on `fromStatus`. Shared by the poll-tick and
120
+ * team-exit advancement paths so the reconcile -> find-stage -> write mechanic
121
+ * has one definition; callers keep their own logging / teamState bookkeeping,
122
+ * driven by the returned {changed, written, stageFound, target}. Never writes a
123
+ * no-op (target === fromStatus). See `requireStageToWrite` for the stage-missing
124
+ * behavior each caller selects.
83
125
  */
84
- export declare function resolveReconciledWrite(params: ResolveReconciledWriteParams, deps?: ReconciledWriteDeps): ReconciledWriteDecision;
126
+ export declare function applyReconciledStep(update: UpdateDeliveryStatusFn, params: ApplyReconciledStepParams): Promise<ApplyReconciledStepResult>;
85
127
  //# sourceMappingURL=delivery-reconciler-apply.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"delivery-reconciler-apply.d.ts","sourceRoot":"","sources":["../../src/delivery/delivery-reconciler-apply.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,eAAe,EACrB,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAO3D,mFAAmF;AACnF,eAAO,MAAM,oBAAoB,4BAA4B,CAAC;AAE9D;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,OAAO,CAEpF;AAED,MAAM,WAAW,uBAAuB;IACtC;;;OAGG;IACH,MAAM,EAAE,eAAe,CAAC;IACxB,oFAAoF;IACpF,MAAM,EAAE,eAAe,CAAC;IACxB,sEAAsE;IACtE,QAAQ,EAAE,OAAO,CAAC;IAClB,qFAAqF;IACrF,uBAAuB,EAAE,OAAO,CAAC;CAClC;AAED,MAAM,WAAW,4BAA4B;IAC3C,mFAAmF;IACnF,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,oFAAoF;IACpF,KAAK,EAAE,cAAc,CAAC;IACtB,yEAAyE;IACzE,YAAY,EAAE,eAAe,CAAC;CAC/B;AAED,MAAM,WAAW,mBAAmB;IAClC,+EAA+E;IAC/E,GAAG,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,6EAA6E;IAC7E,YAAY,CAAC,EAAE,MAAM,OAAO,CAAC;CAC9B;AAED;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,4BAA4B,EACpC,IAAI,GAAE,mBAAwB,GAC7B,uBAAuB,CAsBzB"}
1
+ {"version":3,"file":"delivery-reconciler-apply.d.ts","sourceRoot":"","sources":["../../src/delivery/delivery-reconciler-apply.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,eAAe,EACrB,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,KAAK,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAExF,MAAM,WAAW,uBAAuB;IACtC,oEAAoE;IACpE,MAAM,EAAE,eAAe,CAAC;IACxB,qFAAqF;IACrF,MAAM,EAAE,eAAe,CAAC;CACzB;AAED,MAAM,WAAW,4BAA4B;IAC3C,oFAAoF;IACpF,KAAK,EAAE,cAAc,CAAC;CACvB;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,4BAA4B,GACnC,uBAAuB,CAGzB;AAED;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,SAAS,eAAe,EAAE,GAAG,cAAc,CAQ1F;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE;IAC5C,aAAa,EAAE,eAAe,CAAC;IAC/B,MAAM,EAAE,SAAS,eAAe,EAAE,CAAC;IACnC,YAAY,EAAE;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,GAAG,IAAI,CAAC;IAC1C,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,GAAG,cAAc,CASjB;AAED,yGAAyG;AACzG,MAAM,MAAM,sBAAsB,GAAG,OAAO,oBAAoB,CAAC;AAEjE,MAAM,WAAW,yBAAyB;IACxC,UAAU,EAAE,MAAM,CAAC;IACnB,gFAAgF;IAChF,UAAU,EAAE,eAAe,CAAC;IAC5B,KAAK,EAAE,cAAc,CAAC;IACtB,oEAAoE;IACpE,MAAM,EAAE,aAAa,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACpD,cAAc,EAAE,MAAM,CAAC;IACvB,0EAA0E;IAC1E,SAAS,CAAC,EAAE,iBAAiB,GAAG,IAAI,CAAC;IACrC;;;;;;OAMG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED,MAAM,WAAW,yBAAyB;IACxC,6CAA6C;IAC7C,MAAM,EAAE,eAAe,CAAC;IACxB,yEAAyE;IACzE,OAAO,EAAE,OAAO,CAAC;IACjB,oDAAoD;IACpD,OAAO,EAAE,OAAO,CAAC;IACjB,oEAAoE;IACpE,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,0EAA0E;IAC1E,UAAU,EAAE,OAAO,CAAC;CACrB;AAED;;;;;;;;GAQG;AACH,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,sBAAsB,EAC9B,MAAM,EAAE,yBAAyB,GAChC,OAAO,CAAC,yBAAyB,CAAC,CAkBpC"}
@@ -1,77 +1,103 @@
1
1
  /**
2
- * Activation layer for the single-writer delivery reconciler.
2
+ * Thin decision seam over the pure delivery reconciler.
3
3
  *
4
- * Delivery 4 of the Delivery Execution Pathway Consolidation focus (reality-tree
5
- * injection #10). This is the step that makes the pure reconciler
6
- * (delivery-reconciler.ts) the DECISION AUTHORITY for every daemon
7
- * execution_status write, with the two safety properties the focus method
8
- * (characterize -> shadow -> flip, reversible) requires:
4
+ * The pure reconciler (delivery-reconciler.ts) is the DECISION AUTHORITY for
5
+ * every daemon execution_status write. `resolveReconciledWrite` is the single
6
+ * entry point the write sites call to turn a `ReconcileInput` into the status to
7
+ * write; the caller then routes that status through `updateDeliveryStatus` (the
8
+ * sole physical writer).
9
9
  *
10
- * 1. Runtime self-check (replaces the manual prod shadow-observation gate).
11
- * Each write site still computes what the legacy ("old path") logic would
12
- * have written; `resolveReconciledWrite` compares that to the reconciler's
13
- * target and logs `[reconciler-divergence]` on any mismatch. The retained
14
- * legacy computation is exactly what lets prod self-verify the reconciler
15
- * against the prior behavior for one release -- no maintenance-window or
16
- * manual shadow observation needed.
17
- *
18
- * 2. Reversibility. A single switch, `TELORA_RECONCILER_WRITE`, DEFAULT-ON,
19
- * selects whose decision is WRITTEN: ON -> the reconciler; OFF -> the
20
- * retained legacy target. Flip to '0'/'off'/'false'/'no' (and restart) to
21
- * revert instantly; the whole consolidation also reverts as one merge.
22
- *
23
- * Why activation is safe (suite stays green by construction): the reconciler was
24
- * built (Delivery 3) to MIRROR the live writers and proven so by the Delivery 2
25
- * parity tests. So in every characterized case `result.target === legacyTarget`
26
- * -- the write is byte-identical and the characterization suite stays green. The
27
- * self-check exists to catch any UN-characterized prod case where they differ.
10
+ * HISTORY (retired): this module was once an activation layer that ran the
11
+ * reconciler in SHADOW alongside a retained "legacy" per-site computation,
12
+ * logged `[reconciler-divergence]` on any mismatch, and gated the write behind a
13
+ * default-on `TELORA_RECONCILER_WRITE` kill switch (ON -> reconciler, OFF ->
14
+ * legacy target). The characterize -> shadow -> flip migration is complete: the
15
+ * reconciler has been the authoritative writer with zero divergence, so the
16
+ * legacy computation, the divergence log, and the kill switch have all been
17
+ * retired. The reconciler's target IS the write; there is no second path to
18
+ * compare it against.
28
19
  *
29
20
  * The single shared "issues are done" predicate (areDeliveryIssuesDone) and the
30
- * agreed terminal set live in delivery-reconciler.ts. The agreed set is
31
- * {Done, Verified, In Review} (OPEN = {To Do, In Progress, Blocked}); the
32
- * divergent Postgres literal-Done predicate is removed in Delivery 5.
21
+ * agreed terminal set live in delivery-reconciler.ts.
33
22
  */
34
23
  import { reconcileDeliveryStatus, } from './delivery-reconciler.js';
35
- import { createLogger } from '../shell/log.js';
36
- import { loadEnvConfig } from '@telora/daemon-core';
37
- const dlog = createLogger({ module: 'delivery-reconciler-apply' });
38
- /** Reversibility switch. DEFAULT-ON (opt-out), unlike the shadow's opt-in flag. */
39
- export const RECONCILER_WRITE_ENV = 'TELORA_RECONCILER_WRITE';
40
24
  /**
41
- * Whether the reconciler's decision is the one WRITTEN. DEFAULT-ON: unset / ''
42
- * / any value other than the explicit off-tokens enables it. Only
43
- * '0'/'off'/'false'/'no' (case-insensitive) revert to writing the legacy target.
44
- *
45
- * This mirrors the opt-OUT semantics of shouldRunLoop (undefined/'' -> on,
46
- * '0' -> off) rather than the shadow harness's opt-IN, because the reconciler is
47
- * the intended default writer after this delivery -- reverting is the exception.
25
+ * Decide what status to write for one transition step. Single-step: callers that
26
+ * walk multiple steps in one pass (e.g. queued -> coding -> verify) call this
27
+ * once per actual write, keying `input.currentStatus` to that step, so the
28
+ * reconciler's single-step decision corresponds 1:1 to each write.
48
29
  */
49
- export function reconcilerWriteEnabled(env = process.env) {
50
- return loadEnvConfig(env).TELORA_RECONCILER_WRITE;
30
+ export function resolveReconciledWrite(params) {
31
+ const result = reconcileDeliveryStatus(params.input);
32
+ return { target: result.target, result };
51
33
  }
52
34
  /**
53
- * Decide what status to write for one transition step, with the runtime
54
- * self-check. Single-step: callers that walk multiple steps in one pass
55
- * (e.g. queued -> coding -> verify) call this once per actual write, keying
56
- * `input.currentStatus` + `legacyTarget` to that step, so the reconciler's
57
- * single-step decision and the legacy step correspond 1:1.
35
+ * The reconciler input for the WORK-START crossing (queued -> coding the moment a
36
+ * work issue is In Progress). This exact input is built identically at all three
37
+ * work-start sites -- the live poll tick (listener-auto-advance.checkDeliveryWorkStart),
38
+ * the teamless auto-advance queued step (listener-auto-advance.checkDeliveryAutoAdvance),
39
+ * and the team-exit completion path (completion/status-advance-phase) -- so it has
40
+ * ONE definition here. A queued delivery is not git-touching to cross, so the
41
+ * worktree is treated as committed; there is no guard or review signal at this edge.
58
42
  */
59
- export function resolveReconciledWrite(params, deps = {}) {
60
- const log = deps.log ?? ((m) => dlog.info(m));
61
- const writeEnabled = (deps.writeEnabled ?? reconcilerWriteEnabled)();
62
- const result = reconcileDeliveryStatus(params.input);
63
- const diverged = result.target !== params.legacyTarget;
64
- if (diverged) {
65
- log(`[reconciler-divergence] site=${params.site} delivery=${params.deliveryId} ` +
66
- `("${params.deliveryName}") legacy=${params.legacyTarget} ` +
67
- `reconciled=${result.target} canonical=${result.canonical} ` +
68
- `reason="${result.reason}"`);
69
- }
43
+ export function workStartReconcileInput(issues) {
70
44
  return {
71
- target: writeEnabled ? result.target : params.legacyTarget,
72
- result,
73
- diverged,
74
- reconcilerAuthoritative: writeEnabled,
45
+ currentStatus: 'queued',
46
+ issues: issues.map((i) => ({ status: i.status, issueType: i.issueType })),
47
+ gitState: { worktreeCommitted: true },
48
+ guardVerdict: null,
49
+ reviewState: null,
75
50
  };
76
51
  }
52
+ /**
53
+ * The reconciler input for a RECONCILER-DRIVEN advance step -- the daemon walks a
54
+ * `coding` / `queued` / `verify_failed` delivery forward and the reconciler
55
+ * decides the target. This is the SINGLE construction site for that input, shared
56
+ * by the team path (delivery-lifecycle.advanceDeliveryStage) and the teamless path
57
+ * (listener-auto-advance), so "which fields the reconciler sees at an advance" has
58
+ * ONE definition rather than a hand-spelled object at each call site.
59
+ *
60
+ * `guardVerdict` is a REQUIRED argument on purpose (TEL-1: "measure the inputs at
61
+ * a single site ... so bypassing a measurement requires removing it"): a caller
62
+ * cannot OMIT it and silently get an unmeasured guard. Passing `null` is the
63
+ * EXPLICIT, reviewable choice made only at edges that genuinely have no guard
64
+ * (queued->coding; the verify_failed->queued re-queue). At the coding->verify edge
65
+ * the caller passes the MEASURED verdict (delivery-lifecycle's measureGuard /
66
+ * listener-auto-advance's measureGuardAtAdvance) -- the same measurement on both
67
+ * paths (the D6 parity invariant). gitState is committed BY CONTRACT
68
+ * (ensureWorktreeCommittedBeforeAdvance runs before this input is built) and there
69
+ * is no review signal at these edges (verify->done review routing is a separate
70
+ * path).
71
+ */
72
+ export function advanceReconcileInput(params) {
73
+ return {
74
+ currentStatus: params.currentStatus,
75
+ issues: params.issues.map((i) => ({ status: i.status, issueType: i.issueType })),
76
+ gitState: { worktreeCommitted: true },
77
+ guardVerdict: params.guardVerdict,
78
+ reviewState: null,
79
+ ...(params.discoveryOnly !== undefined ? { discoveryOnly: params.discoveryOnly } : {}),
80
+ };
81
+ }
82
+ /**
83
+ * Reconcile ONE transition step and write it through the single physical writer
84
+ * (updateDeliveryStatus), keyed on `fromStatus`. Shared by the poll-tick and
85
+ * team-exit advancement paths so the reconcile -> find-stage -> write mechanic
86
+ * has one definition; callers keep their own logging / teamState bookkeeping,
87
+ * driven by the returned {changed, written, stageFound, target}. Never writes a
88
+ * no-op (target === fromStatus). See `requireStageToWrite` for the stage-missing
89
+ * behavior each caller selects.
90
+ */
91
+ export async function applyReconciledStep(update, params) {
92
+ const { target } = resolveReconciledWrite({ input: params.input });
93
+ if (target === params.fromStatus) {
94
+ return { target, changed: false, written: false, stageId: undefined, stageFound: false };
95
+ }
96
+ const stage = params.stages.find((s) => s.name === target);
97
+ if (params.requireStageToWrite && !stage) {
98
+ return { target, changed: true, written: false, stageId: undefined, stageFound: false };
99
+ }
100
+ await update(params.deliveryId, target, stage?.id, params.gateState, undefined, { organizationId: params.organizationId, fromStatus: params.fromStatus });
101
+ return { target, changed: true, written: true, stageId: stage?.id, stageFound: !!stage };
102
+ }
77
103
  //# sourceMappingURL=delivery-reconciler-apply.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"delivery-reconciler-apply.js","sourceRoot":"","sources":["../../src/delivery/delivery-reconciler-apply.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA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AAI,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,UAAU,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC;AAC3F,CAAC"}
@@ -210,8 +210,13 @@ export { isAuditPhaseFocus, isDiscoveryOnlyDelivery, type DiscoveryOnlySignal, }
210
210
  * otherwise -> stay verify (awaiting review outcome).
211
211
  * - verify_failed : open work -> queued (re-queue);
212
212
  * all done -> coding (re-iterate).
213
- * - draft/planning/paused/done/cancelled : stay (out of reconciler scope;
214
- * paused is cleared by a human re-queue, terminal states are final).
213
+ * - paused : blocking guard cleared on re-eval (guardVerdict not blocked)
214
+ * -> queued (daemon-traversable revival; the
215
+ * normal walk re-drives and re-hits the gate);
216
+ * otherwise (guard still blocks / no re-eval) -> stay paused
217
+ * (named human-act hold, watchdog-surfaced).
218
+ * - draft/planning/done/cancelled : stay (out of reconciler scope;
219
+ * terminal states are final, draft/planning await scoping).
215
220
  */
216
221
  export declare function reconcileDeliveryStatus(input: ReconcileInput): ReconcileResult;
217
222
  //# sourceMappingURL=delivery-reconciler.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"delivery-reconciler.d.ts","sourceRoot":"","sources":["../../src/delivery/delivery-reconciler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AAIH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAE3D,gDAAgD;AAChD,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB;;;;;;;;OAQG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,+DAA+D;AAC/D,MAAM,WAAW,kBAAkB;IACjC;;;;;OAKG;IACH,iBAAiB,EAAE,OAAO,CAAC;CAC5B;AAED,8EAA8E;AAC9E,MAAM,WAAW,sBAAsB;IACrC,wEAAwE;IACxE,OAAO,E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;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,cAAc,GAAG,eAAe,CA0I9E"}
@@ -134,8 +134,13 @@ function result(currentStatus, target, reason) {
134
134
  * otherwise -> stay verify (awaiting review outcome).
135
135
  * - verify_failed : open work -> queued (re-queue);
136
136
  * all done -> coding (re-iterate).
137
- * - draft/planning/paused/done/cancelled : stay (out of reconciler scope;
138
- * paused is cleared by a human re-queue, terminal states are final).
137
+ * - paused : blocking guard cleared on re-eval (guardVerdict not blocked)
138
+ * -> queued (daemon-traversable revival; the
139
+ * normal walk re-drives and re-hits the gate);
140
+ * otherwise (guard still blocks / no re-eval) -> stay paused
141
+ * (named human-act hold, watchdog-surfaced).
142
+ * - draft/planning/done/cancelled : stay (out of reconciler scope;
143
+ * terminal states are final, draft/planning await scoping).
139
144
  */
140
145
  export function reconcileDeliveryStatus(input) {
141
146
  const { currentStatus, issues, gitState, guardVerdict, reviewState, discoveryOnly } = input;
@@ -239,9 +244,33 @@ export function reconcileDeliveryStatus(input) {
239
244
  }
240
245
  return result(currentStatus, DELIVERY_STATUS.CODING, 'verify_failed, work done -> coding (re-iterate)');
241
246
  }
242
- // draft / planning / paused / done / cancelled: not driven by the
243
- // issue-rollup reconciler. paused is cleared by a human re-queue;
244
- // terminal states are final.
247
+ case DELIVERY_STATUS.PAUSED: {
248
+ // A pause is a guard BLOCK on a transition (coding->verify or
249
+ // verify->done), never a terminal state. The daemon owns its exit: a
250
+ // paused-delivery consumer re-evaluates the SAME blocking guard each tick
251
+ // and passes the fresh verdict here. When the guard has CLEARED
252
+ // (guardVerdict present and not blocked), the delivery revives to `queued`
253
+ // -- the canonical, origin-independent revival edge
254
+ // (EXECUTION_STATUS_TRANSITIONS: paused -> queued) -- and the normal walk
255
+ // (queued -> coding -> verify -> done) re-drives it, re-hitting the same
256
+ // gates. This is the daemon-traversable exit that keeps an armed focus
257
+ // from waiting on a human re-queue (2026-07-28 ruling: decide-and-record).
258
+ //
259
+ // It is the REVERSIBLE choice by construction: revival only fires once the
260
+ // gate has cleared, so the delivery cannot immediately re-pause, and the
261
+ // daemon never OVERRIDES an unclear gate (the irreversible act reserved for
262
+ // the human `override` decision path). Absent a re-evaluated verdict
263
+ // (guardVerdict null -- no consumer ran) the delivery STAYS paused: the
264
+ // named human-act hold in gate_state / the block's `override` decision path
265
+ // is the human arm, surfaced by the wedge watchdog. So a bare paused is
266
+ // never left with no consumer, and a paused is never revived on stale signal.
267
+ if (guardVerdict && !guardVerdict.blocked) {
268
+ return result(currentStatus, DELIVERY_STATUS.QUEUED, 'blocking guard cleared on re-eval -> revive paused to queued (daemon-traversable exit; normal walk re-drives)');
269
+ }
270
+ return result(currentStatus, DELIVERY_STATUS.PAUSED, 'guard still blocks or no re-eval -> stay paused (named human-act hold, watchdog-surfaced)');
271
+ }
272
+ // draft / planning / done / cancelled: not driven by the issue-rollup
273
+ // reconciler. Terminal states are final; draft/planning await scoping.
245
274
  default:
246
275
  return result(currentStatus, currentStatus, `status '${currentStatus}' is not reconciler-driven -> stay`);
247
276
  }
@@ -1 +1 @@
1
- {"version":3,"file":"delivery-reconciler.js","sourceRoot":"","sources":["../../src/delivery/delivery-reconciler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AAEH,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC9E,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAoHzE,wEAAwE;AAExE;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,qBAAqB,CAAC,MAAsC;IAC1E,MAAM,IAAI,GAAG,gBAAgB,CAAC,CAAC,GAAG,MAAM,CAAsB,CAAC,CAAC;IAChE,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IACnC,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,CAA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ACrE,wEAAwE;YACxE,4EAA4E;YAC5E,wEAAwE;YACxE,8EAA8E;YAC9E,IAAI,YAAY,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC;gBAC1C,OAAO,MAAM,CAAC,aAAa,EAAE,eAAe,CAAC,MAAM,EAAE,+GAA+G,CAAC,CAAC;YACxK,CAAC;YACD,OAAO,MAAM,CAAC,aAAa,EAAE,eAAe,CAAC,MAAM,EAAE,2FAA2F,CAAC,CAAC;QACpJ,CAAC;QAED,sEAAsE;QACtE,uEAAuE;QACvE;YACE,OAAO,MAAM,CAAC,aAAa,EAAE,aAAa,EAAE,WAAW,aAAa,oCAAoC,CAAC,CAAC;IAC9G,CAAC;AACH,CAAC"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Operator-visible surfacing for a STALE reference-less external hold (TEL-5,
3
+ * delivery 2).
4
+ *
5
+ * A reference-less external hold has nothing for the daemon to re-read, so it can
6
+ * never self-clear; once it sits past the staleness age bound (decided by
7
+ * external-hold.ts isReferenceLessHoldStale) it withholds the delivery from done
8
+ * -- and the focus from winding_down -- indefinitely. It is NOT an inbox question
9
+ * the daemon can answer, so it is surfaced as durable operator-visible STATE (a
10
+ * health event, deduped per delivery), naming that a human must re-declare it
11
+ * with a clearing reference or clear it.
12
+ *
13
+ * Lives in its own module (not external-hold.ts) because it needs the
14
+ * @telora/daemon-core `healthEvents` VALUE import, which external-hold.ts must
15
+ * avoid: that module is pulled into listener tests under the node:test
16
+ * module-mock loader, where a bare `@telora/*` value specifier mis-resolves.
17
+ */
18
+ import type { ExternalHoldState } from '../queries/deliveries.js';
19
+ /** Health-event code for a reference-less external hold held past the age bound. */
20
+ export declare const EXTERNAL_HOLD_REFERENCE_LESS_STALE_CODE = "external_hold.reference_less_stale";
21
+ /** Test-only: clear the dedup state. */
22
+ export declare function __resetExternalHoldSurfaceForTests(): void;
23
+ /**
24
+ * Surface (or clear) the stale reference-less signal for one delivery.
25
+ *
26
+ * Call after every resolveExternalHold. When `staleReferenceLess` is true, emit
27
+ * the health event once per delivery. When it is false (hold cleared, gained a
28
+ * reference, or still within the bound), drop the dedup entry so a later staleness
29
+ * re-surfaces cleanly, and pair a resolution so the operator view clears.
30
+ */
31
+ export declare function surfaceStaleReferenceLessExternalHold(deliveryId: string, deliveryName: string, staleReferenceLess: boolean, hold: Pick<ExternalHoldState, 'condition' | 'clearsWhen' | 'declaredAt'> | null): void;
32
+ //# sourceMappingURL=external-hold-surface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"external-hold-surface.d.ts","sourceRoot":"","sources":["../../src/delivery/external-hold-surface.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAKlE,oFAAoF;AACpF,eAAO,MAAM,uCAAuC,uCAAuC,CAAC;AAU5F,wCAAwC;AACxC,wBAAgB,kCAAkC,IAAI,IAAI,CAEzD;AAED;;;;;;;GAOG;AACH,wBAAgB,qCAAqC,CACnD,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,MAAM,EACpB,kBAAkB,EAAE,OAAO,EAC3B,IAAI,EAAE,IAAI,CAAC,iBAAiB,EAAE,WAAW,GAAG,YAAY,GAAG,YAAY,CAAC,GAAG,IAAI,GAC9E,IAAI,CA2BN"}
@@ -0,0 +1,67 @@
1
+ /**
2
+ * Operator-visible surfacing for a STALE reference-less external hold (TEL-5,
3
+ * delivery 2).
4
+ *
5
+ * A reference-less external hold has nothing for the daemon to re-read, so it can
6
+ * never self-clear; once it sits past the staleness age bound (decided by
7
+ * external-hold.ts isReferenceLessHoldStale) it withholds the delivery from done
8
+ * -- and the focus from winding_down -- indefinitely. It is NOT an inbox question
9
+ * the daemon can answer, so it is surfaced as durable operator-visible STATE (a
10
+ * health event, deduped per delivery), naming that a human must re-declare it
11
+ * with a clearing reference or clear it.
12
+ *
13
+ * Lives in its own module (not external-hold.ts) because it needs the
14
+ * @telora/daemon-core `healthEvents` VALUE import, which external-hold.ts must
15
+ * avoid: that module is pulled into listener tests under the node:test
16
+ * module-mock loader, where a bare `@telora/*` value specifier mis-resolves.
17
+ */
18
+ import { healthEvents } from '@telora/daemon-core';
19
+ import { createLogger } from '../shell/log.js';
20
+ const log = createLogger({ module: 'external-hold' });
21
+ /** Health-event code for a reference-less external hold held past the age bound. */
22
+ export const EXTERNAL_HOLD_REFERENCE_LESS_STALE_CODE = 'external_hold.reference_less_stale';
23
+ /**
24
+ * Deliveries already surfaced as holding a stale reference-less external hold, so
25
+ * the event fires once per delivery instead of every verify->done evaluation.
26
+ * Cleared for a delivery when its hold clears (surfaceStaleReferenceLessExternalHold
27
+ * is called with held=false). Module-level so it persists across ticks.
28
+ */
29
+ const surfacedStaleHolds = new Set();
30
+ /** Test-only: clear the dedup state. */
31
+ export function __resetExternalHoldSurfaceForTests() {
32
+ surfacedStaleHolds.clear();
33
+ }
34
+ /**
35
+ * Surface (or clear) the stale reference-less signal for one delivery.
36
+ *
37
+ * Call after every resolveExternalHold. When `staleReferenceLess` is true, emit
38
+ * the health event once per delivery. When it is false (hold cleared, gained a
39
+ * reference, or still within the bound), drop the dedup entry so a later staleness
40
+ * re-surfaces cleanly, and pair a resolution so the operator view clears.
41
+ */
42
+ export function surfaceStaleReferenceLessExternalHold(deliveryId, deliveryName, staleReferenceLess, hold) {
43
+ if (staleReferenceLess && hold) {
44
+ if (surfacedStaleHolds.has(deliveryId))
45
+ return;
46
+ surfacedStaleHolds.add(deliveryId);
47
+ log.warn(`[external-hold] Delivery "${deliveryName}" (${deliveryId}) has a REFERENCE-LESS external ` +
48
+ `hold held since ${hold.declaredAt} with no machine-readable clearing reference -- it cannot ` +
49
+ `self-clear; surfacing as ${EXTERNAL_HOLD_REFERENCE_LESS_STALE_CODE}.`);
50
+ healthEvents.emit({
51
+ severity: 'error',
52
+ source: `delivery:${deliveryId}`,
53
+ code: EXTERNAL_HOLD_REFERENCE_LESS_STALE_CODE,
54
+ message: `Delivery "${deliveryName}" is held out of done by a reference-less external hold ` +
55
+ `("${hold.condition}"; clears when: ${hold.clearsWhen}) declared ${hold.declaredAt}. It has no ` +
56
+ `re-readable clearing reference, so the daemon cannot self-clear it -- re-declare the hold with ` +
57
+ `a clearing reference, or clear it, so the delivery (and its focus) can reach done.`,
58
+ });
59
+ return;
60
+ }
61
+ // Not stale (or not held / gained a reference): drop the dedup entry so a future
62
+ // staleness re-surfaces, and pair a resolution.
63
+ if (surfacedStaleHolds.delete(deliveryId)) {
64
+ healthEvents.resolveByCode(EXTERNAL_HOLD_REFERENCE_LESS_STALE_CODE);
65
+ }
66
+ }
67
+ //# sourceMappingURL=external-hold-surface.js.map