@telora/daemon 0.20.60 → 0.20.89

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 (163) hide show
  1. package/build-info.json +4 -3
  2. package/dist/ai-inspection-context.d.ts.map +1 -1
  3. package/dist/ai-inspection-context.js +4 -2
  4. package/dist/ai-inspection-context.js.map +1 -1
  5. package/dist/audit-phase.d.ts +12 -18
  6. package/dist/audit-phase.d.ts.map +1 -1
  7. package/dist/audit-phase.js +17 -60
  8. package/dist/audit-phase.js.map +1 -1
  9. package/dist/audit-prompt.d.ts +44 -0
  10. package/dist/audit-prompt.d.ts.map +1 -0
  11. package/dist/audit-prompt.js +198 -0
  12. package/dist/audit-prompt.js.map +1 -0
  13. package/dist/ci-sensor-loop.d.ts +38 -1
  14. package/dist/ci-sensor-loop.d.ts.map +1 -1
  15. package/dist/ci-sensor-loop.js +49 -5
  16. package/dist/ci-sensor-loop.js.map +1 -1
  17. package/dist/completion/completion-decision.d.ts +3 -29
  18. package/dist/completion/completion-decision.d.ts.map +1 -1
  19. package/dist/completion/completion-decision.js +3 -15
  20. package/dist/completion/completion-decision.js.map +1 -1
  21. package/dist/completion/event-phases.d.ts +0 -8
  22. package/dist/completion/event-phases.d.ts.map +1 -1
  23. package/dist/completion/event-phases.js +4 -52
  24. package/dist/completion/event-phases.js.map +1 -1
  25. package/dist/completion/event.d.ts +1 -11
  26. package/dist/completion/event.d.ts.map +1 -1
  27. package/dist/completion/event.js +1 -3
  28. package/dist/completion/event.js.map +1 -1
  29. package/dist/delivery-artifacts.d.ts.map +1 -1
  30. package/dist/delivery-artifacts.js +9 -8
  31. package/dist/delivery-artifacts.js.map +1 -1
  32. package/dist/delivery-reconciler.d.ts +3 -0
  33. package/dist/delivery-reconciler.d.ts.map +1 -1
  34. package/dist/delivery-reconciler.js +16 -0
  35. package/dist/delivery-reconciler.js.map +1 -1
  36. package/dist/focus-engine.d.ts.map +1 -1
  37. package/dist/focus-engine.js +12 -1
  38. package/dist/focus-engine.js.map +1 -1
  39. package/dist/focus-executor.d.ts.map +1 -1
  40. package/dist/focus-executor.js +4 -1
  41. package/dist/focus-executor.js.map +1 -1
  42. package/dist/focus-merge.d.ts.map +1 -1
  43. package/dist/focus-merge.js +37 -3
  44. package/dist/focus-merge.js.map +1 -1
  45. package/dist/focus-stage-lifecycle/wedge-watchdog.d.ts.map +1 -1
  46. package/dist/focus-stage-lifecycle/wedge-watchdog.js +9 -1
  47. package/dist/focus-stage-lifecycle/wedge-watchdog.js.map +1 -1
  48. package/dist/listener-auto-advance.d.ts.map +1 -1
  49. package/dist/listener-auto-advance.js +58 -10
  50. package/dist/listener-auto-advance.js.map +1 -1
  51. package/dist/merge-back-loop.d.ts +8 -2
  52. package/dist/merge-back-loop.d.ts.map +1 -1
  53. package/dist/merge-back-loop.js +17 -11
  54. package/dist/merge-back-loop.js.map +1 -1
  55. package/dist/merge-failure-classify.d.ts +39 -0
  56. package/dist/merge-failure-classify.d.ts.map +1 -0
  57. package/dist/merge-failure-classify.js +58 -0
  58. package/dist/merge-failure-classify.js.map +1 -0
  59. package/dist/prompt-sections/execution-sections.d.ts +20 -14
  60. package/dist/prompt-sections/execution-sections.d.ts.map +1 -1
  61. package/dist/prompt-sections/execution-sections.js +97 -141
  62. package/dist/prompt-sections/execution-sections.js.map +1 -1
  63. package/dist/prompt-sections/scoping-sections.d.ts +30 -0
  64. package/dist/prompt-sections/scoping-sections.d.ts.map +1 -0
  65. package/dist/prompt-sections/scoping-sections.js +187 -0
  66. package/dist/prompt-sections/scoping-sections.js.map +1 -0
  67. package/dist/prompt-sections/shared.d.ts +7 -0
  68. package/dist/prompt-sections/shared.d.ts.map +1 -1
  69. package/dist/prompt-sections/shared.js.map +1 -1
  70. package/dist/queries/agent-resolvable-promotion.d.ts +87 -0
  71. package/dist/queries/agent-resolvable-promotion.d.ts.map +1 -0
  72. package/dist/queries/agent-resolvable-promotion.js +152 -0
  73. package/dist/queries/agent-resolvable-promotion.js.map +1 -0
  74. package/dist/queries/cause-key.d.ts +64 -0
  75. package/dist/queries/cause-key.d.ts.map +1 -0
  76. package/dist/queries/cause-key.js +79 -0
  77. package/dist/queries/cause-key.js.map +1 -0
  78. package/dist/queries/deliveries.d.ts +20 -153
  79. package/dist/queries/deliveries.d.ts.map +1 -1
  80. package/dist/queries/deliveries.js +26 -0
  81. package/dist/queries/deliveries.js.map +1 -1
  82. package/dist/queries/delivery-gate-state.d.ts +192 -0
  83. package/dist/queries/delivery-gate-state.d.ts.map +1 -0
  84. package/dist/queries/delivery-gate-state.js +23 -0
  85. package/dist/queries/delivery-gate-state.js.map +1 -0
  86. package/dist/queries/escalation-suppression.d.ts +89 -0
  87. package/dist/queries/escalation-suppression.d.ts.map +1 -0
  88. package/dist/queries/escalation-suppression.js +98 -0
  89. package/dist/queries/escalation-suppression.js.map +1 -0
  90. package/dist/queries/holds.d.ts +52 -59
  91. package/dist/queries/holds.d.ts.map +1 -1
  92. package/dist/queries/holds.js +60 -68
  93. package/dist/queries/holds.js.map +1 -1
  94. package/dist/queries/issues.d.ts +40 -2
  95. package/dist/queries/issues.d.ts.map +1 -1
  96. package/dist/queries/issues.js +55 -2
  97. package/dist/queries/issues.js.map +1 -1
  98. package/dist/queries/verification.d.ts +11 -0
  99. package/dist/queries/verification.d.ts.map +1 -1
  100. package/dist/queries/verification.js.map +1 -1
  101. package/dist/reality-pole.d.ts +5 -3
  102. package/dist/reality-pole.d.ts.map +1 -1
  103. package/dist/reality-pole.js +13 -4
  104. package/dist/reality-pole.js.map +1 -1
  105. package/dist/resolvers/git-diff-against-base.d.ts.map +1 -1
  106. package/dist/resolvers/git-diff-against-base.js +12 -5
  107. package/dist/resolvers/git-diff-against-base.js.map +1 -1
  108. package/dist/resolvers/index.d.ts +1 -1
  109. package/dist/resolvers/index.d.ts.map +1 -1
  110. package/dist/resolvers/index.js +1 -1
  111. package/dist/resolvers/index.js.map +1 -1
  112. package/dist/resolvers/shared/git-diff.d.ts +152 -10
  113. package/dist/resolvers/shared/git-diff.d.ts.map +1 -1
  114. package/dist/resolvers/shared/git-diff.js +292 -14
  115. package/dist/resolvers/shared/git-diff.js.map +1 -1
  116. package/dist/spawn/prompt-assembly.d.ts +3 -0
  117. package/dist/spawn/prompt-assembly.d.ts.map +1 -1
  118. package/dist/spawn/prompt-assembly.js +2 -1
  119. package/dist/spawn/prompt-assembly.js.map +1 -1
  120. package/dist/spawn/worktree-session.d.ts +2 -0
  121. package/dist/spawn/worktree-session.d.ts.map +1 -1
  122. package/dist/spawn/worktree-session.js +20 -1
  123. package/dist/spawn/worktree-session.js.map +1 -1
  124. package/dist/staleness-sensor.d.ts +24 -1
  125. package/dist/staleness-sensor.d.ts.map +1 -1
  126. package/dist/staleness-sensor.js +31 -4
  127. package/dist/staleness-sensor.js.map +1 -1
  128. package/dist/stall-detectors.d.ts +13 -9
  129. package/dist/stall-detectors.d.ts.map +1 -1
  130. package/dist/stall-detectors.js +14 -13
  131. package/dist/stall-detectors.js.map +1 -1
  132. package/dist/team-prompt-base.d.ts +1 -1
  133. package/dist/team-prompt-base.d.ts.map +1 -1
  134. package/dist/team-prompt-base.js +4 -2
  135. package/dist/team-prompt-base.js.map +1 -1
  136. package/dist/templates/claude-md.d.ts +1 -1
  137. package/dist/templates/claude-md.d.ts.map +1 -1
  138. package/dist/templates/claude-md.js +20 -0
  139. package/dist/templates/claude-md.js.map +1 -1
  140. package/dist/verification-default-on.d.ts.map +1 -1
  141. package/dist/verification-default-on.js +5 -0
  142. package/dist/verification-default-on.js.map +1 -1
  143. package/dist/verification-deps.d.ts +151 -0
  144. package/dist/verification-deps.d.ts.map +1 -0
  145. package/dist/verification-deps.js +19 -0
  146. package/dist/verification-deps.js.map +1 -0
  147. package/dist/verification-engine.d.ts +18 -112
  148. package/dist/verification-engine.d.ts.map +1 -1
  149. package/dist/verification-engine.js +90 -103
  150. package/dist/verification-engine.js.map +1 -1
  151. package/dist/verification-evidence.d.ts +106 -0
  152. package/dist/verification-evidence.d.ts.map +1 -0
  153. package/dist/verification-evidence.js +158 -0
  154. package/dist/verification-evidence.js.map +1 -0
  155. package/dist/verification-feedback.d.ts +31 -26
  156. package/dist/verification-feedback.d.ts.map +1 -1
  157. package/dist/verification-feedback.js +77 -76
  158. package/dist/verification-feedback.js.map +1 -1
  159. package/dist/verify-restatement.d.ts +12 -9
  160. package/dist/verify-restatement.d.ts.map +1 -1
  161. package/dist/verify-restatement.js +11 -9
  162. package/dist/verify-restatement.js.map +1 -1
  163. package/package.json +3 -3
@@ -291,6 +291,32 @@ export async function recordFocusMerge(params) {
291
291
  },
292
292
  });
293
293
  }
294
+ /**
295
+ * Fetch the RECORDED constituent commit shas for a delivery's merge, keyed by
296
+ * the merge_commit_sha the delivery row carries.
297
+ *
298
+ * Reads focus_merges (via focus_merge_list) -- the durable record the daemon
299
+ * wrote at merge time (extractConstituentCommits -> recordFocusMerge) -- and
300
+ * returns the commit_shas of the row whose merge_commit_sha matches. This is the
301
+ * exact attribution, immune to the fast-forward + rebase failures that corrupt a
302
+ * range re-derived from live branch topology at verify time.
303
+ *
304
+ * Returns [] when the focus/merge is unknown or the API action is unavailable
305
+ * (best-effort): the verify diff resolver then falls through to its
306
+ * live-topology sources rather than blocking.
307
+ */
308
+ export async function getRecordedCommitShasForMerge(focusId, mergeCommitSha) {
309
+ try {
310
+ const result = await callApi('focus_merge_list', { focusId, limit: 500 });
311
+ const row = (result.merges ?? []).find((m) => m.mergeCommitSha === mergeCommitSha);
312
+ return row?.commitShas ?? [];
313
+ }
314
+ catch (err) {
315
+ log.debug(`[focusMerge] commit_shas lookup unavailable for focus ${focusId.slice(0, 8)}: ` +
316
+ `${err.message}`);
317
+ return [];
318
+ }
319
+ }
294
320
  /**
295
321
  * Track consecutive failures per delivery to detect systematic issues.
296
322
  * After FAILURE_THRESHOLD consecutive failures, log at ERROR level.
@@ -1 +1 @@
1
- {"version":3,"file":"deliveries.js","sourceRoot":"","sources":["../../src/queries/deliveries.ts"],"names":[],"mappings":"A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AAS,IAAI,IAAI;QACnC,OAAO,EAAE,MAAM,CAAC,OAAO,IAAI,IAAI;KAChC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,192 @@
1
+ /**
2
+ * The shape of `org_nodes.gate_state` on a delivery row, plus the per-origin
3
+ * detail records that hang off it.
4
+ *
5
+ * Split out of `queries/deliveries.ts` (which holds the API calls) because these
6
+ * are the vocabulary of the verify gate, not of any one query: the verification
7
+ * engine, the feedback/re-work path, the operator- and external-hold gates, and
8
+ * the stall detectors all read and write them. Keeping them here lets those
9
+ * modules depend on the gate's vocabulary without pulling in the query layer.
10
+ *
11
+ * The one rule that shapes every type below: each way the gate can hold a
12
+ * delivery gets its OWN key. A shell-command failure (`verification`), a
13
+ * declared-vs-achieved gap (`shortfallReconciliation`), an unvouchable evidence
14
+ * bundle (`evidenceUnavailable`), an operator hold, and an external dependency
15
+ * are distinct facts about distinct things, and a reader must be able to tell
16
+ * "the gate was blind" from "the work fell short" without inspecting fields.
17
+ *
18
+ * Re-exported from `queries/deliveries.ts`, so both import paths resolve.
19
+ *
20
+ * @module queries/delivery-gate-state
21
+ */
22
+ /**
23
+ * Detail attached to gate_state when a daemon-side deterministic verification
24
+ * run fails. Carries the failing-test names (parsed from the run output) and a
25
+ * pointer to the persistent full-log file so the feedback loop -- dashboard
26
+ * "Waiting on", live-session inject, and the requeue/respawn prompt -- can
27
+ * surface WHAT failed and WHERE to read it, without a cold re-run.
28
+ */
29
+ export interface VerificationFailureDetail {
30
+ /**
31
+ * Failing-test ids that GATE this delivery. When baseline-diff attribution ran,
32
+ * these are the NEW failures the focus introduced; otherwise all parsed failures.
33
+ */
34
+ failingTests: string[];
35
+ /**
36
+ * Failing tests that pre-exist on the focus base -- recorded, non-blocking
37
+ * (they do not gate the focus). Absent when attribution did not run.
38
+ */
39
+ preExisting?: string[];
40
+ /** Absolute path to the persistent full-log file, or null when none was written. */
41
+ logPath: string | null;
42
+ /** Process exit code of the failed run, or null. */
43
+ exitCode: number | null;
44
+ /** ISO timestamp of the failing run. */
45
+ failedAt: string;
46
+ }
47
+ /**
48
+ * Detail attached to gate_state when the verify-shortfall RECONCILIATION (not a
49
+ * deterministic shell run) holds the flip: the achieved outcome fell short of
50
+ * the declared desired effect for one or more targeted nodes. Distinct from
51
+ * VerificationFailureDetail on purpose -- a shortfall hold has no exitCode /
52
+ * failingTests (the deterministic check may well have passed), it has a
53
+ * declared-vs-achieved gap. Keeping it under its own key prevents a reader from
54
+ * seeing a passed:false deterministic_verification whose exitCode is 0.
55
+ */
56
+ export interface ShortfallReconciliationDetail {
57
+ /** ISO timestamp of the reconciliation that held the gate. */
58
+ heldAt: string;
59
+ /** The per-target declared/achieved/reason gaps that withheld the flip. */
60
+ shortfalls: Array<{
61
+ nodeId: string;
62
+ declared: string;
63
+ achieved: string;
64
+ reason: string;
65
+ /** The diff evidence grounding the shortfall, when the judge cited one. */
66
+ diffCitation?: string;
67
+ }>;
68
+ }
69
+ /**
70
+ * Detail attached to gate_state when the verify path could NOT vouch for the
71
+ * evidence it was handed -- an INSTRUMENT FAULT, not a verdict about the work.
72
+ * Two flavours, both BLIND:
73
+ * - EMPTY : no diff / changed-files / inspection finding at all.
74
+ * - INCOMPLETE (half-blind): a non-empty bundle whose resolved diff range does
75
+ * NOT cover the delivery's recorded commit set, so a verdict would judge the
76
+ * work against only part of it. `coverage` is populated in this case.
77
+ * Distinct from VerificationFailureDetail (a shell command failed) and from
78
+ * ShortfallReconciliationDetail (the work fell short of intent): here the
79
+ * reconciliation cannot see the whole delivery, so it must not render any
80
+ * verdict. The delivery is held in `verify` (never routed to verify_failed, so
81
+ * no iteration is consumed) and a first-occurrence escalation names the fault.
82
+ */
83
+ export interface EvidenceUnavailableDetail {
84
+ /** ISO timestamp the instrument-fault hold was recorded. */
85
+ heldAt: string;
86
+ /** Which evidence slots were empty (named, so the hold describes the fault, not the work). */
87
+ missing: string[];
88
+ /**
89
+ * Commits the delivery branch is ahead of the integration base. 0 => the
90
+ * branch already merged / did no work; > 0 => a broken diff MEASUREMENT
91
+ * (commits present but the diff resolved empty). Carried for operator triage.
92
+ */
93
+ commitsAhead: number;
94
+ /**
95
+ * Populated for a HALF-BLIND (incomplete) hold: the resolved range covered
96
+ * only `covered` of the delivery's `recorded` commits. Absent for a plain
97
+ * empty-bundle hold, so the empty case is byte-unchanged.
98
+ */
99
+ coverage?: {
100
+ /** How many commits the durable record (focus_merges.commit_shas) names. */
101
+ recorded: number;
102
+ /** How many of those the resolved diff range actually covered. */
103
+ covered: number;
104
+ };
105
+ }
106
+ /**
107
+ * Shape written into product_deliveries.gate_state when guard evaluation
108
+ * blocks a stage transition. Cleared (set to null) when guards pass.
109
+ *
110
+ * `verification` is populated when the block is a daemon-side deterministic
111
+ * verification failure (Harness-Owned Delivery Verification), carrying the
112
+ * failing tests + log path for the feedback loop; absent for guard-only gates.
113
+ *
114
+ * `shortfallReconciliation` is populated when the block is a verify-shortfall
115
+ * reconciliation hold (declared-vs-achieved gap), NOT a deterministic run; the
116
+ * two are mutually exclusive origins and never share the deterministic guard.
117
+ */
118
+ export interface DeliveryGateState {
119
+ blocking: Array<{
120
+ guardName: string;
121
+ passed: boolean;
122
+ }>;
123
+ warnings: Array<{
124
+ guardName: string;
125
+ passed: boolean;
126
+ }>;
127
+ evaluatedAt: string;
128
+ verification?: VerificationFailureDetail;
129
+ shortfallReconciliation?: ShortfallReconciliationDetail;
130
+ /**
131
+ * Populated when the verify path was handed no evidence it could judge the
132
+ * work against (an instrument fault). Kept under its own key -- never
133
+ * conflated with `verification` (a shell failure) or `shortfallReconciliation`
134
+ * (a work shortfall) -- so a reader can tell "the gate was blind" from "the
135
+ * work fell short". The blocking guard is `verify_evidence_unavailable`.
136
+ */
137
+ evidenceUnavailable?: EvidenceUnavailableDetail;
138
+ /**
139
+ * Undisposed shortfall drift proposal ids holding this delivery in verify.
140
+ *
141
+ * Kept OUT of `blocking` on purpose: that array is guard-verdict data
142
+ * (guardName + passed), and a shortfall hold is not a guard. Synthesizing a
143
+ * fake guardName to smuggle the ids through would make `blocking` lie about
144
+ * what a guard is. `formatGateBlockers` is the single place that merges the
145
+ * two for display.
146
+ *
147
+ * Absent for guard-only gates. Written by the review-exit shortfall hold and
148
+ * cleared, like the rest of gate_state, when the delivery finally routes.
149
+ */
150
+ shortfallProposalIds?: string[];
151
+ /**
152
+ * The open operator-blocked escalation (disposition needs_operator /
153
+ * external_wait, any kind) holding this delivery in verify. Written by the
154
+ * operator-hold gate (operator-hold.ts) so the board can name what the
155
+ * delivery is waiting on without a second escalation being filed; cleared,
156
+ * like the rest of gate_state, when the delivery finally routes. When the hold
157
+ * read itself failed (fail-closed), escalationId is null and readFailed is
158
+ * true -- the delivery is still held, just without a specific escalation to
159
+ * name. Like shortfallProposalIds, kept OUT of `blocking` (a hold is not a
160
+ * guard verdict).
161
+ */
162
+ operatorHold?: {
163
+ escalationId: string | null;
164
+ escalationKind: string | null;
165
+ disposition: string | null;
166
+ readFailed?: boolean;
167
+ };
168
+ /**
169
+ * An irreducibly-external dependency holding this delivery in verify, carried
170
+ * as durable STATE rather than an agent_escalations row (external-hold.ts).
171
+ * The blocking condition and what would clear it live here, attached to the
172
+ * delivery they block; the hold clears by re-evaluating that condition (a
173
+ * re-read of reality), not by a human resolving an inbox item. Kept OUT of
174
+ * `blocking` for the same reason as operatorHold/shortfallProposalIds: a hold
175
+ * is not a guard verdict. Cleared, like the rest of gate_state, when the
176
+ * delivery finally routes.
177
+ */
178
+ externalHold?: ExternalHoldState;
179
+ }
180
+ /**
181
+ * The durable external-hold state on a delivery's gate_state. Distinct from an
182
+ * agent_escalations row: an external dependency is state, not an inbox event.
183
+ */
184
+ export interface ExternalHoldState {
185
+ /** What is blocking -- the irreducibly-external dependency. */
186
+ condition: string;
187
+ /** The condition that, when re-read as true, clears the hold. */
188
+ clearsWhen: string;
189
+ /** ISO timestamp the hold was declared. */
190
+ declaredAt: string;
191
+ }
192
+ //# sourceMappingURL=delivery-gate-state.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delivery-gate-state.d.ts","sourceRoot":"","sources":["../../src/queries/delivery-gate-state.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH;;;;;;GAMG;AACH,MAAM,WAAW,yBAAyB;IACxC;;;OAGG;IACH,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,oFAAoF;IACpF,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,oDAAoD;IACpD,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,wCAAwC;IACxC,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,6BAA6B;IAC5C,8DAA8D;IAC9D,MAAM,EAAE,MAAM,CAAC;IACf,2EAA2E;IAC3E,UAAU,EAAE,KAAK,CAAC;QAChB,MAAM,EAAE,MAAM,CAAC;QACf,QAAQ,EAAE,MAAM,CAAC;QACjB,QAAQ,EAAE,MAAM,CAAC;QACjB,MAAM,EAAE,MAAM,CAAC;QACf,2EAA2E;QAC3E,YAAY,CAAC,EAAE,MAAM,CAAC;KACvB,CAAC,CAAC;CACJ;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,yBAAyB;IACxC,4DAA4D;IAC5D,MAAM,EAAE,MAAM,CAAC;IACf,8FAA8F;IAC9F,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB;;;;OAIG;IACH,YAAY,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,QAAQ,CAAC,EAAE;QACT,4EAA4E;QAC5E,QAAQ,EAAE,MAAM,CAAC;QACjB,kEAAkE;QAClE,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;CACH;AAED;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,KAAK,CAAC;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;IACxD,QAAQ,EAAE,KAAK,CAAC;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;IACxD,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,yBAAyB,CAAC;IACzC,uBAAuB,CAAC,EAAE,6BAA6B,CAAC;IACxD;;;;;;OAMG;IACH,mBAAmB,CAAC,EAAE,yBAAyB,CAAC;IAChD;;;;;;;;;;;OAWG;IACH,oBAAoB,CAAC,EAAE,MAAM,EAAE,CAAC;IAChC;;;;;;;;;;OAUG;IACH,YAAY,CAAC,EAAE;QACb,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;QAC5B,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;QAC9B,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;QAC3B,UAAU,CAAC,EAAE,OAAO,CAAC;KACtB,CAAC;IACF;;;;;;;;;OASG;IACH,YAAY,CAAC,EAAE,iBAAiB,CAAC;CAClC;AAED;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,+DAA+D;IAC/D,SAAS,EAAE,MAAM,CAAC;IAClB,iEAAiE;IACjE,UAAU,EAAE,MAAM,CAAC;IACnB,2CAA2C;IAC3C,UAAU,EAAE,MAAM,CAAC;CACpB"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * The shape of `org_nodes.gate_state` on a delivery row, plus the per-origin
3
+ * detail records that hang off it.
4
+ *
5
+ * Split out of `queries/deliveries.ts` (which holds the API calls) because these
6
+ * are the vocabulary of the verify gate, not of any one query: the verification
7
+ * engine, the feedback/re-work path, the operator- and external-hold gates, and
8
+ * the stall detectors all read and write them. Keeping them here lets those
9
+ * modules depend on the gate's vocabulary without pulling in the query layer.
10
+ *
11
+ * The one rule that shapes every type below: each way the gate can hold a
12
+ * delivery gets its OWN key. A shell-command failure (`verification`), a
13
+ * declared-vs-achieved gap (`shortfallReconciliation`), an unvouchable evidence
14
+ * bundle (`evidenceUnavailable`), an operator hold, and an external dependency
15
+ * are distinct facts about distinct things, and a reader must be able to tell
16
+ * "the gate was blind" from "the work fell short" without inspecting fields.
17
+ *
18
+ * Re-exported from `queries/deliveries.ts`, so both import paths resolve.
19
+ *
20
+ * @module queries/delivery-gate-state
21
+ */
22
+ export {};
23
+ //# sourceMappingURL=delivery-gate-state.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delivery-gate-state.js","sourceRoot":"","sources":["../../src/queries/delivery-gate-state.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG"}
@@ -0,0 +1,89 @@
1
+ /**
2
+ * Cause-keyed escalation suppression + idempotent filing.
3
+ *
4
+ * Generalizes the narrow per-delivery precedent (hasOpenEscalationForDelivery in
5
+ * queries/issues.ts) to EVERY daemon detector via a deterministic cause key
6
+ * (queries/cause-key.ts). Two properties, both DB-backed so they survive a daemon
7
+ * restart:
8
+ *
9
+ * 1. Idempotent while open. While a filing carrying this cause key is OPEN
10
+ * (pending or in_review), a detector re-observing the same cause does not
11
+ * file again -- across ticks, restarts, and detector kinds.
12
+ *
13
+ * 2. Dismissal memory. A DISMISSED filing carrying this cause key keeps the
14
+ * cause silent: the same cause cannot re-file until its subject state
15
+ * changes. Because the subject is encoded IN the cause key, a changed subject
16
+ * (a NEW sha going red) yields a DIFFERENT key with no matching dismissed row
17
+ * and re-files naturally; the SAME sha re-observed yields the SAME key and is
18
+ * suppressed no matter how many scans re-observe it.
19
+ *
20
+ * A RESOLVED filing does NOT suppress: resolve means the cause was addressed, so a
21
+ * recurrence should re-file. This is achieved simply by excluding 'resolved' from
22
+ * the suppression status set below.
23
+ *
24
+ * The cause key is stamped into agent_escalations.metadata.cause_key at file time.
25
+ * metadata JSONB is already persisted by escalation_create and returned by
26
+ * escalation_list, so this stays entirely daemon-side -- no migration or edge
27
+ * change is required (the AC's sanctioned "the cause key can live in metadata plus
28
+ * a suppression check at file time" path).
29
+ */
30
+ import { createEscalation, type CreateEscalationParams } from './issues.js';
31
+ /** Minimal escalation row shape the cause-key suppression check reads. */
32
+ interface CauseKeyEscalationRow {
33
+ id: string;
34
+ status?: string | null;
35
+ metadata?: Record<string, unknown> | null;
36
+ }
37
+ /**
38
+ * Dependency seam. The real implementations query the Telora API / file via
39
+ * createEscalation; tests inject stubs to avoid the fragile bare-specifier
40
+ * `mock.module` path under tsx (same rationale as the stall-detectors /
41
+ * verification-feedback deps seams).
42
+ */
43
+ export interface EscalationSuppressionDeps {
44
+ /** Fetch the open+dismissed escalation rows to scan for a matching cause key. */
45
+ listSuppressingEscalations?: (opts: {
46
+ focusId?: string;
47
+ }) => Promise<CauseKeyEscalationRow[]>;
48
+ /** File a fresh escalation (defaults to the real createEscalation). */
49
+ createEscalation?: typeof createEscalation;
50
+ }
51
+ /**
52
+ * True when an OPEN (pending/in_review) or DISMISSED escalation already carries
53
+ * this cause key -- i.e. a new filing for the same cause must be suppressed.
54
+ *
55
+ * Narrows server-side by open+dismissed statuses (and by focusId when supplied,
56
+ * honored by the live escalation_list handler) so the 500-row page is scoped to
57
+ * the relevant rows rather than the org's newest 500. The cause-key match itself
58
+ * is client-side because cause_key lives in metadata JSONB, not a column.
59
+ */
60
+ export declare function hasSuppressedCauseKey(causeKey: string, opts?: {
61
+ focusId?: string;
62
+ }, deps?: EscalationSuppressionDeps): Promise<boolean>;
63
+ /** Params for an idempotent, cause-keyed filing. */
64
+ export interface FileEscalationIdempotentParams extends CreateEscalationParams {
65
+ /** The deterministic cause key (queries/cause-key.ts). Stamped into metadata.cause_key. */
66
+ causeKey: string;
67
+ }
68
+ /** Outcome of an idempotent filing attempt. */
69
+ export interface FileEscalationIdempotentResult {
70
+ /** Whether a new escalation row was created this call. */
71
+ filed: boolean;
72
+ /** Whether the call was suppressed by an existing open/dismissed cause-key row. */
73
+ suppressed: boolean;
74
+ /** The new escalation id when filed; null when suppressed or the create returned no id. */
75
+ escalationId: string | null;
76
+ }
77
+ /**
78
+ * File an escalation ONLY if its cause key is not already suppressed (open or
79
+ * dismissed). The cause key is stamped into metadata.cause_key so a later
80
+ * re-observation of the same cause is suppressed by hasSuppressedCauseKey.
81
+ *
82
+ * This is the single filing entry point every daemon detector should route
83
+ * through. It replaces per-detector ad-hoc dedup (hasOpenEscalationForDelivery,
84
+ * hasOpenWorktreeDirtyEscalation, hasOpenWedgedFocusEscalation, in-memory Sets)
85
+ * with one cause-keyed gate that also carries dismissal memory.
86
+ */
87
+ export declare function fileEscalationIdempotent(params: FileEscalationIdempotentParams, deps?: EscalationSuppressionDeps): Promise<FileEscalationIdempotentResult>;
88
+ export {};
89
+ //# sourceMappingURL=escalation-suppression.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"escalation-suppression.d.ts","sourceRoot":"","sources":["../../src/queries/escalation-suppression.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAGH,OAAO,EAAE,gBAAgB,EAAE,KAAK,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAY5E,0EAA0E;AAC1E,UAAU,qBAAqB;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;CAC3C;AAED;;;;;GAKG;AACH,MAAM,WAAW,yBAAyB;IACxC,iFAAiF;IACjF,0BAA0B,CAAC,EAAE,CAAC,IAAI,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,OAAO,CAAC,qBAAqB,EAAE,CAAC,CAAC;IAC9F,uEAAuE;IACvE,gBAAgB,CAAC,EAAE,OAAO,gBAAgB,CAAC;CAC5C;AAsBD;;;;;;;;GAQG;AACH,wBAAsB,qBAAqB,CACzC,QAAQ,EAAE,MAAM,EAChB,IAAI,GAAE;IAAE,OAAO,CAAC,EAAE,MAAM,CAAA;CAAO,EAC/B,IAAI,GAAE,yBAA8B,GACnC,OAAO,CAAC,OAAO,CAAC,CAOlB;AAED,oDAAoD;AACpD,MAAM,WAAW,8BAA+B,SAAQ,sBAAsB;IAC5E,2FAA2F;IAC3F,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,+CAA+C;AAC/C,MAAM,WAAW,8BAA8B;IAC7C,0DAA0D;IAC1D,KAAK,EAAE,OAAO,CAAC;IACf,mFAAmF;IACnF,UAAU,EAAE,OAAO,CAAC;IACpB,2FAA2F;IAC3F,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B;AAED;;;;;;;;;GASG;AACH,wBAAsB,wBAAwB,CAC5C,MAAM,EAAE,8BAA8B,EACtC,IAAI,GAAE,yBAA8B,GACnC,OAAO,CAAC,8BAA8B,CAAC,CAmBzC"}
@@ -0,0 +1,98 @@
1
+ /**
2
+ * Cause-keyed escalation suppression + idempotent filing.
3
+ *
4
+ * Generalizes the narrow per-delivery precedent (hasOpenEscalationForDelivery in
5
+ * queries/issues.ts) to EVERY daemon detector via a deterministic cause key
6
+ * (queries/cause-key.ts). Two properties, both DB-backed so they survive a daemon
7
+ * restart:
8
+ *
9
+ * 1. Idempotent while open. While a filing carrying this cause key is OPEN
10
+ * (pending or in_review), a detector re-observing the same cause does not
11
+ * file again -- across ticks, restarts, and detector kinds.
12
+ *
13
+ * 2. Dismissal memory. A DISMISSED filing carrying this cause key keeps the
14
+ * cause silent: the same cause cannot re-file until its subject state
15
+ * changes. Because the subject is encoded IN the cause key, a changed subject
16
+ * (a NEW sha going red) yields a DIFFERENT key with no matching dismissed row
17
+ * and re-files naturally; the SAME sha re-observed yields the SAME key and is
18
+ * suppressed no matter how many scans re-observe it.
19
+ *
20
+ * A RESOLVED filing does NOT suppress: resolve means the cause was addressed, so a
21
+ * recurrence should re-file. This is achieved simply by excluding 'resolved' from
22
+ * the suppression status set below.
23
+ *
24
+ * The cause key is stamped into agent_escalations.metadata.cause_key at file time.
25
+ * metadata JSONB is already persisted by escalation_create and returned by
26
+ * escalation_list, so this stays entirely daemon-side -- no migration or edge
27
+ * change is required (the AC's sanctioned "the cause key can live in metadata plus
28
+ * a suppression check at file time" path).
29
+ */
30
+ import { callApi } from './shared.js';
31
+ import { createEscalation } from './issues.js';
32
+ import { createLogger } from '../log.js';
33
+ const log = createLogger({ module: 'escalations' });
34
+ /**
35
+ * Statuses that SUPPRESS a re-file for a cause key: OPEN (pending/in_review)
36
+ * gives idempotency-while-open; DISMISSED gives dismissal-memory. 'resolved' is
37
+ * deliberately ABSENT -- a resolved cause may recur and should re-file.
38
+ */
39
+ const SUPPRESSING_STATUSES = ['pending', 'in_review', 'dismissed'];
40
+ async function defaultListSuppressingEscalations(opts) {
41
+ const result = await callApi('escalation_list', {
42
+ fields: {
43
+ statuses: SUPPRESSING_STATUSES,
44
+ ...(opts.focusId ? { focusId: opts.focusId } : {}),
45
+ },
46
+ limit: 500,
47
+ });
48
+ return result.escalations ?? [];
49
+ }
50
+ /** Read metadata.cause_key off a row, tolerating the loose JSONB shape. */
51
+ function rowCauseKey(row) {
52
+ const meta = row.metadata ?? null;
53
+ const key = meta?.cause_key;
54
+ return typeof key === 'string' ? key : null;
55
+ }
56
+ /**
57
+ * True when an OPEN (pending/in_review) or DISMISSED escalation already carries
58
+ * this cause key -- i.e. a new filing for the same cause must be suppressed.
59
+ *
60
+ * Narrows server-side by open+dismissed statuses (and by focusId when supplied,
61
+ * honored by the live escalation_list handler) so the 500-row page is scoped to
62
+ * the relevant rows rather than the org's newest 500. The cause-key match itself
63
+ * is client-side because cause_key lives in metadata JSONB, not a column.
64
+ */
65
+ export async function hasSuppressedCauseKey(causeKey, opts = {}, deps = {}) {
66
+ const list = deps.listSuppressingEscalations ?? defaultListSuppressingEscalations;
67
+ const rows = await list({ focusId: opts.focusId });
68
+ return rows.some((e) => {
69
+ if (e.status && !SUPPRESSING_STATUSES.includes(e.status))
70
+ return false;
71
+ return rowCauseKey(e) === causeKey;
72
+ });
73
+ }
74
+ /**
75
+ * File an escalation ONLY if its cause key is not already suppressed (open or
76
+ * dismissed). The cause key is stamped into metadata.cause_key so a later
77
+ * re-observation of the same cause is suppressed by hasSuppressedCauseKey.
78
+ *
79
+ * This is the single filing entry point every daemon detector should route
80
+ * through. It replaces per-detector ad-hoc dedup (hasOpenEscalationForDelivery,
81
+ * hasOpenWorktreeDirtyEscalation, hasOpenWedgedFocusEscalation, in-memory Sets)
82
+ * with one cause-keyed gate that also carries dismissal memory.
83
+ */
84
+ export async function fileEscalationIdempotent(params, deps = {}) {
85
+ const { causeKey, ...createParams } = params;
86
+ const _createEscalation = deps.createEscalation ?? createEscalation;
87
+ const suppressed = await hasSuppressedCauseKey(causeKey, { focusId: createParams.focusId ?? createParams.anchor?.focusId }, deps);
88
+ if (suppressed) {
89
+ log.info(`[escalations] Suppressed duplicate filing for cause key "${causeKey}" (open or dismissed row exists)`);
90
+ return { filed: false, suppressed: true, escalationId: null };
91
+ }
92
+ const { escalationId } = await _createEscalation({
93
+ ...createParams,
94
+ metadata: { ...(createParams.metadata ?? {}), cause_key: causeKey },
95
+ });
96
+ return { filed: true, suppressed: false, escalationId };
97
+ }
98
+ //# sourceMappingURL=escalation-suppression.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"escalation-suppression.js","sourceRoot":"","sources":["../../src/queries/escalation-suppression.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,gBAAgB,EAA+B,MAAM,aAAa,CAAC;AAC5E,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEzC,MAAM,GAAG,GAAG,YAAY,CAAC,EAAE,MAAM,EAAE,aAAa,EAAE,CAAC,CAAC;AAEpD;;;;GAIG;AACH,MAAM,oBAAoB,GAAsB,CAAC,SAAS,EAAE,WAAW,EAAE,WAAW,CAAC,CAAC;AAsBtF,KAAK,UAAU,i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,EACtC,OAAkC,EAAE;IAEpC,MAAM,EAAE,QAAQ,EAAE,GAAG,YAAY,EAAE,GAAG,MAAM,CAAC;IAC7C,MAAM,iBAAiB,GAAG,IAAI,CAAC,gBAAgB,IAAI,gBAAgB,CAAC;IAEpE,MAAM,UAAU,GAAG,MAAM,qBAAqB,CAC5C,QAAQ,EACR,EAAE,OAAO,EAAE,YAAY,CAAC,OAAO,IAAI,YAAY,CAAC,MAAM,EAAE,OAAO,EAAE,EACjE,IAAI,CACL,CAAC;IACF,IAAI,UAAU,EAAE,CAAC;QACf,GAAG,CAAC,IAAI,CAAC,4DAA4D,QAAQ,kCAAkC,CAAC,CAAC;QACjH,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC;IAChE,CAAC;IAED,MAAM,EAAE,YAAY,EAAE,GAAG,MAAM,iBAAiB,CAAC;QAC/C,GAAG,YAAY;QACf,QAAQ,EAAE,EAAE,GAAG,CAAC,YAAY,CAAC,QAAQ,IAAI,EAAE,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE;KACpE,CAAC,CAAC;IACH,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,YAAY,EAAE,CAAC;AAC1D,CAAC"}
@@ -11,9 +11,11 @@
11
11
  * question the daemon reads back to the asking agent. Fails OPEN at its
12
12
  * call site.
13
13
  *
14
- * Plus SELF_REPORT_STALL_HOLD_KINDS: the kinds that are machine-filed alarms
15
- * ABOUT a delivery's own cycling, excluded from the operator predicate so an
16
- * alarm cannot constitute the condition it reports.
14
+ * Plus two exclusion families the operator predicate drops: SELF_REPORT_STALL_HOLD_KINDS
15
+ * (machine-filed alarms ABOUT a delivery's own cycling, so an alarm cannot
16
+ * constitute the condition it reports) and REFUSED_OPERATOR_HOLD_KINDS (kinds that
17
+ * name no human-only act -- refused at their filing surface and routed to bounded
18
+ * re-work; a legacy row must not hold a delivery out of done).
17
19
  *
18
20
  * Extracted from queries/issues.ts to keep that file under the daemon
19
21
  * file-size limit -- the self-referential-alarm fix pushed it to 844. Bodies
@@ -58,28 +60,39 @@ export declare const OPERATOR_HOLD_DISPOSITIONS: readonly string[];
58
60
  * silence it, and resolving one let the detector file the next on the following
59
61
  * tick.
60
62
  *
61
- * ENUMERATION -- every machine-filed, delivery-anchored needs_operator kind, and
62
- * whether it is a genuine hold or a self-referential stall alarm. The exclusion
63
- * criterion is narrow and precise: exclude a kind IFF (a) it re-arms while the
64
- * delivery is non-terminal AND (b) its ONLY silencing is the delivery reaching
65
- * the terminal state the hold blocks. A kind that describes external reality an
66
- * operator must change, or that is filed once and silenced by operator
67
- * resolution, is a GENUINE hold and stays.
63
+ * ENUMERATION -- every machine-filed, delivery-anchored needs_operator kind,
64
+ * tested against ONE governing rule ("A hold must name a human act", 2026-07-28):
65
+ * does the kind name a specific act ONLY a human can perform? A kind that names
66
+ * one is a GENUINE hold and stays. A kind that names none must NOT hold a
67
+ * delivery out of done: it is refused at its filing surface and routed into the
68
+ * machine's own bounded re-work path, and any legacy row is EXCLUDED from this
69
+ * predicate. (This rule GOVERNS -- it supersedes the older fixpoint-only test,
70
+ * which read a kind's legitimacy from its re-arm behaviour; the two disagreed on
71
+ * verify_evidence_unavailable and this rule is the one that wins.) The parallel
72
+ * self-referential-alarm exclusion still applies too: an alarm ABOUT a delivery's
73
+ * own cycling cannot constitute the hold it reports.
68
74
  *
69
75
  * verify_gate_unclearable (stall-detectors.ts) -- SELF-REFERENTIAL. Trigger
70
76
  * (iteration_count) is monotonic and re-arms every tick while non-terminal;
71
- * silenced only by done/cancelled, which the hold blocks. EXCLUDE.
72
- * verify_evidence_unavailable (verification-feedback.ts) -- self-REPORT of an
73
- * instrument fault, but filed ONCE per delivery (idempotent, never re-armed)
74
- * and silenced by operator resolution, not by `done`. It also already holds
75
- * the delivery via its OWN gate_state.blocking guard, so it does not lean on
76
- * this predicate. Not a fixpoint -> KEEP as a hold.
77
- * schema_drift_blocked (listener-auto-advance.ts) -- operator must apply a
78
- * migration (external reality). KEEP.
77
+ * silenced only by done/cancelled, which the hold blocks. It IS the sole
78
+ * surviving human residue of the bounded re-work cap, and it names a human
79
+ * act (an operator must decide the unclearable delivery's fate), so it holds
80
+ * -- but it must not hold ITSELF, hence the exclusion below. EXCLUDE from the
81
+ * predicate for its own delivery (SELF_REPORT_STALL_HOLD_KINDS).
82
+ * verify_evidence_unavailable (verification-feedback.ts) -- NAMES NO HUMAN ACT.
83
+ * Its ask was "fix the diff range / confirm the merge / clear the delivery" --
84
+ * the gate reporting its own BLINDNESS, not work an operator must do. As of
85
+ * "A hold must name a human act" it is refused at the filing surface (nothing
86
+ * files it; the empty-bundle path re-enters bounded verify_failed re-work in
87
+ * verification-engine/feedback) and any legacy open row is EXCLUDED here
88
+ * (REFUSED_OPERATOR_HOLD_KINDS) so it cannot hold a delivery out of done.
89
+ * REFUSED + ROUTED, no longer a hold.
90
+ * schema_drift_blocked (listener-auto-advance.ts) -- an operator must apply a
91
+ * migration (a human-only act on external reality). KEEP.
79
92
  * advance_blocked (delivery-advance-block.ts) -- dirty worktree / lockfile
80
- * state an operator or agent must resolve. KEEP.
93
+ * state an operator or agent must resolve on the host. KEEP.
81
94
  * cd_push_failed (ci-escalation.ts) / ci_run_red (ci-sensor-loop.ts) --
82
- * external CI/CD state. KEEP.
95
+ * external CI/CD state a human must act on. KEEP.
83
96
  * propagation_stale (staleness-sensor.ts) -- external propagation state. KEEP.
84
97
  *
85
98
  * (Focus-anchored kinds -- merge_conflict, merge_refused_dirty,
@@ -94,6 +107,25 @@ export declare const OPERATOR_HOLD_DISPOSITIONS: readonly string[];
94
107
  * with stall-detectors.VERIFY_GATE_UNCLEARABLE_KIND and the DB CHECK.
95
108
  */
96
109
  export declare const SELF_REPORT_STALL_HOLD_KINDS: readonly string[];
110
+ /**
111
+ * escalation_kind discriminators that are REFUSED at their filing surface and
112
+ * routed into the machine's own bounded re-work path because they NAME NO ACT
113
+ * ONLY A HUMAN CAN PERFORM ("A hold must name a human act", 2026-07-28). Nothing
114
+ * files these anymore, but a LEGACY row opened before the filing refusal deployed
115
+ * must not hold its delivery out of done -- so it is excluded from the
116
+ * operator-hold predicate here, and the delivery clears itself via re-work
117
+ * instead of parking on a human inbox.
118
+ *
119
+ * verify_evidence_unavailable -- the verify gate reporting its own blindness
120
+ * (empty judgeable bundle). Its ask named no human-only act; the empty-bundle
121
+ * path now re-enters bounded verify_failed re-work (verification-feedback.ts
122
+ * requeueEvidenceUnavailableAsRework), and verify_gate_unclearable (the
123
+ * iteration cap) is the sole surviving human residue.
124
+ *
125
+ * Daemon-local string literal for the same node:test module-mock-loader reason as
126
+ * SELF_REPORT_STALL_HOLD_KINDS / OPERATOR_HOLD_DISPOSITIONS above.
127
+ */
128
+ export declare const REFUSED_OPERATOR_HOLD_KINDS: readonly string[];
97
129
  /** The open operator-hold escalation a delivery is blocked on (for gate_state). */
98
130
  export interface OperatorHoldEscalation {
99
131
  id: string;
@@ -135,43 +167,4 @@ export declare function findOpenOperatorHoldForDelivery(deliveryId: string, focu
135
167
  * only need to know whether the hold exists (not which escalation it is).
136
168
  */
137
169
  export declare function hasOpenOperatorHoldForDelivery(deliveryId: string, focusId?: string): Promise<boolean>;
138
- /**
139
- * The escalation dispositions that mean "a human must STEER before this team's
140
- * work can proceed": needs_intent (scope/direction/priority) and
141
- * needs_clarification (ambiguity to resolve). These are exactly the two the
142
- * escalation tool documents as answerable via the `answer` field -- a DIRECTED
143
- * question the daemon reads back to the asking agent, distinct from the
144
- * operator-hold dispositions (needs_operator / external_wait, a blocked-on-reality
145
- * signal) and agent_resolvable (no human at all).
146
- *
147
- * Daemon-local literals for the same reason as OPERATOR_HOLD_DISPOSITIONS above:
148
- * a bare `@telora/*` value import in a query module pulled into a mocked
149
- * node:test fails to resolve under the module-mock loader. The canonical enum is
150
- * packages/daemon-core/src/disposition.ts and the DB CHECK on
151
- * agent_escalations.disposition is the real constraint; these strings must stay
152
- * in sync with it.
153
- */
154
- export declare const DIRECTED_HOLD_DISPOSITIONS: readonly string[];
155
- /**
156
- * Returns the OPEN (pending|in_review) DIRECTED-hold escalation anchored to the
157
- * given delivery, or null when none is open. Disposition-keyed sibling of
158
- * findOpenOperatorHoldForDelivery, keyed on DIRECTED_HOLD_DISPOSITIONS
159
- * (needs_intent / needs_clarification) instead of the operator-hold set.
160
- *
161
- * This is the vocabulary the completion-event no-progress guard previously
162
- * lacked: a team parked on its own unanswered directed question could not be
163
- * told apart from a team that has stalled, so the scope-coverage guard counted
164
- * the wait as no-progress, re-engaged the team (real model spend), and
165
- * eventually filed a team_failure ON TOP of the question.
166
- *
167
- * FAIL DIRECTION IS THE OPPOSITE of findOpenOperatorHoldForDelivery. The
168
- * operator-hold gate's CALLER fails CLOSED (a lookup error => held) because a
169
- * missed hold lets an operator-blocked delivery reach done. HERE the consuming
170
- * guard must fail OPEN: a lookup error must NOT suppress a genuine stall
171
- * escalation, so the caller treats an error as "not blocked". This function
172
- * still reports what it finds and THROWS on a hard API error; the fail-open
173
- * decision lives at the call site (completion/event-phases.computeCompletionFacts),
174
- * which catches and defaults to not-blocked.
175
- */
176
- export declare function findOpenDirectedHoldForDelivery(deliveryId: string, focusId?: string): Promise<OperatorHoldEscalation | null>;
177
170
  //# sourceMappingURL=holds.d.ts.map