@telora/daemon 0.22.85 → 0.22.91
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.
- package/build-info.json +4 -3
- package/dist/backends/index.d.ts +1 -1
- package/dist/backends/index.d.ts.map +1 -1
- package/dist/backends/index.js +1 -1
- package/dist/backends/index.js.map +1 -1
- package/dist/backends/resolve.d.ts +37 -8
- package/dist/backends/resolve.d.ts.map +1 -1
- package/dist/backends/resolve.js +62 -28
- package/dist/backends/resolve.js.map +1 -1
- package/dist/ci/ci-escalation.d.ts +17 -1
- package/dist/ci/ci-escalation.d.ts.map +1 -1
- package/dist/ci/ci-escalation.js +51 -3
- package/dist/ci/ci-escalation.js.map +1 -1
- package/dist/ci/ci-red-attribution.d.ts +85 -0
- package/dist/ci/ci-red-attribution.d.ts.map +1 -0
- package/dist/ci/ci-red-attribution.js +108 -0
- package/dist/ci/ci-red-attribution.js.map +1 -0
- package/dist/ci/ci-sensor-loop.d.ts +84 -80
- package/dist/ci/ci-sensor-loop.d.ts.map +1 -1
- package/dist/ci/ci-sensor-loop.js +132 -129
- package/dist/ci/ci-sensor-loop.js.map +1 -1
- package/dist/cli/connect/config-write.d.ts +7 -4
- package/dist/cli/connect/config-write.d.ts.map +1 -1
- package/dist/cli/connect/config-write.js +13 -7
- package/dist/cli/connect/config-write.js.map +1 -1
- package/dist/cli/connect.d.ts.map +1 -1
- package/dist/cli/connect.js +11 -1
- package/dist/cli/connect.js.map +1 -1
- package/dist/cli/update-commands.d.ts.map +1 -1
- package/dist/cli/update-commands.js +2 -1
- package/dist/cli/update-commands.js.map +1 -1
- package/dist/completion/coverage-stabilized.d.ts.map +1 -1
- package/dist/completion/coverage-stabilized.js +1 -1
- package/dist/completion/coverage-stabilized.js.map +1 -1
- package/dist/completion/escalations.d.ts +40 -5
- package/dist/completion/escalations.d.ts.map +1 -1
- package/dist/completion/escalations.js +19 -11
- package/dist/completion/escalations.js.map +1 -1
- package/dist/completion/event-escalations.d.ts +12 -1
- package/dist/completion/event-escalations.d.ts.map +1 -1
- package/dist/completion/event-escalations.js +73 -37
- package/dist/completion/event-escalations.js.map +1 -1
- package/dist/completion/event.d.ts +4 -1
- package/dist/completion/event.d.ts.map +1 -1
- package/dist/completion/event.js +1 -1
- package/dist/completion/event.js.map +1 -1
- package/dist/completion/human-only-act.d.ts +1 -1
- package/dist/completion/human-only-act.js +1 -1
- package/dist/completion/machine-remediable-demotion.d.ts +28 -1
- package/dist/completion/machine-remediable-demotion.d.ts.map +1 -1
- package/dist/completion/machine-remediable-demotion.js +9 -6
- package/dist/completion/machine-remediable-demotion.js.map +1 -1
- package/dist/completion/read-only-pristine.d.ts.map +1 -1
- package/dist/completion/read-only-pristine.js +4 -0
- package/dist/completion/read-only-pristine.js.map +1 -1
- package/dist/completion/review-exit-deps.js +1 -1
- package/dist/completion/review-exit-deps.js.map +1 -1
- package/dist/completion/review-exit-escalations.d.ts +10 -0
- package/dist/completion/review-exit-escalations.d.ts.map +1 -1
- package/dist/completion/review-exit-escalations.js +38 -3
- package/dist/completion/review-exit-escalations.js.map +1 -1
- package/dist/completion/review-exit-phase.d.ts.map +1 -1
- package/dist/completion/review-exit-phase.js +8 -7
- package/dist/completion/review-exit-phase.js.map +1 -1
- package/dist/completion/review-exit-shortfall.d.ts +5 -1
- package/dist/completion/review-exit-shortfall.d.ts.map +1 -1
- package/dist/completion/review-exit-shortfall.js +8 -3
- package/dist/completion/review-exit-shortfall.js.map +1 -1
- package/dist/completion/status-advance-phase.d.ts +2 -0
- package/dist/completion/status-advance-phase.d.ts.map +1 -1
- package/dist/completion/status-advance-phase.js +2 -1
- package/dist/completion/status-advance-phase.js.map +1 -1
- package/dist/completion/terminated-work-reconcile.js +2 -2
- package/dist/completion/terminated-work-reconcile.js.map +1 -1
- package/dist/delivery/delivery-advance-block.d.ts +3 -3
- package/dist/delivery/delivery-advance-block.d.ts.map +1 -1
- package/dist/delivery/delivery-advance-block.js +13 -8
- package/dist/delivery/delivery-advance-block.js.map +1 -1
- package/dist/delivery/delivery-lifecycle.d.ts +10 -0
- package/dist/delivery/delivery-lifecycle.d.ts.map +1 -1
- package/dist/delivery/delivery-lifecycle.js +12 -6
- package/dist/delivery/delivery-lifecycle.js.map +1 -1
- package/dist/delivery/delivery-merge-ops.d.ts.map +1 -1
- package/dist/delivery/delivery-merge-ops.js +39 -21
- package/dist/delivery/delivery-merge-ops.js.map +1 -1
- package/dist/delivery/external-hold.d.ts +8 -2
- package/dist/delivery/external-hold.d.ts.map +1 -1
- package/dist/delivery/external-hold.js +12 -5
- package/dist/delivery/external-hold.js.map +1 -1
- package/dist/delivery/operator-hold.d.ts +6 -1
- package/dist/delivery/operator-hold.d.ts.map +1 -1
- package/dist/delivery/operator-hold.js +31 -10
- package/dist/delivery/operator-hold.js.map +1 -1
- package/dist/delivery/paused-revival.d.ts +6 -0
- package/dist/delivery/paused-revival.d.ts.map +1 -1
- package/dist/delivery/paused-revival.js +3 -1
- package/dist/delivery/paused-revival.js.map +1 -1
- package/dist/directive/directive-dispatch.d.ts.map +1 -1
- package/dist/directive/directive-dispatch.js +6 -3
- package/dist/directive/directive-dispatch.js.map +1 -1
- package/dist/directive/directive-queue.d.ts.map +1 -1
- package/dist/directive/directive-queue.js +4 -1
- package/dist/directive/directive-queue.js.map +1 -1
- package/dist/drift/staleness-sensor.d.ts +20 -0
- package/dist/drift/staleness-sensor.d.ts.map +1 -1
- package/dist/drift/staleness-sensor.js +54 -21
- package/dist/drift/staleness-sensor.js.map +1 -1
- package/dist/drift/staleness.d.ts +18 -5
- package/dist/drift/staleness.d.ts.map +1 -1
- package/dist/drift/staleness.js +28 -15
- package/dist/drift/staleness.js.map +1 -1
- package/dist/focus/focus-executor.d.ts.map +1 -1
- package/dist/focus/focus-executor.js +6 -8
- package/dist/focus/focus-executor.js.map +1 -1
- package/dist/focus/focus-loop-registry.d.ts.map +1 -1
- package/dist/focus/focus-loop-registry.js +23 -13
- package/dist/focus/focus-loop-registry.js.map +1 -1
- package/dist/focus/focus-respawn-guard.d.ts.map +1 -1
- package/dist/focus/focus-respawn-guard.js +21 -4
- package/dist/focus/focus-respawn-guard.js.map +1 -1
- package/dist/focus/listener-auto-advance.d.ts.map +1 -1
- package/dist/focus/listener-auto-advance.js +10 -6
- package/dist/focus/listener-auto-advance.js.map +1 -1
- package/dist/focus/verify-open-issues.d.ts.map +1 -1
- package/dist/focus/verify-open-issues.js +21 -1
- package/dist/focus/verify-open-issues.js.map +1 -1
- package/dist/focus-stage-lifecycle/wedge-watchdog.d.ts.map +1 -1
- package/dist/focus-stage-lifecycle/wedge-watchdog.js +35 -14
- package/dist/focus-stage-lifecycle/wedge-watchdog.js.map +1 -1
- package/dist/loops/index.d.ts.map +1 -1
- package/dist/loops/index.js +2 -1
- package/dist/loops/index.js.map +1 -1
- package/dist/merge/focus-merge.d.ts +1 -1
- package/dist/merge/focus-merge.d.ts.map +1 -1
- package/dist/merge/focus-merge.js +5 -1
- package/dist/merge/focus-merge.js.map +1 -1
- package/dist/merge/merge-back-loop.d.ts +2 -1
- package/dist/merge/merge-back-loop.d.ts.map +1 -1
- package/dist/merge/merge-back-loop.js +15 -12
- package/dist/merge/merge-back-loop.js.map +1 -1
- package/dist/merge/merge-conflict-escalation.d.ts.map +1 -1
- package/dist/merge/merge-conflict-escalation.js +4 -0
- package/dist/merge/merge-conflict-escalation.js.map +1 -1
- package/dist/nexus/return.d.ts +14 -15
- package/dist/nexus/return.d.ts.map +1 -1
- package/dist/nexus/return.js +41 -31
- package/dist/nexus/return.js.map +1 -1
- package/dist/prompt-sections/execution-sections.d.ts +13 -5
- package/dist/prompt-sections/execution-sections.d.ts.map +1 -1
- package/dist/prompt-sections/execution-sections.js +78 -18
- package/dist/prompt-sections/execution-sections.js.map +1 -1
- package/dist/prompt-sections/routing-decider-sections.d.ts +60 -0
- package/dist/prompt-sections/routing-decider-sections.d.ts.map +1 -0
- package/dist/prompt-sections/routing-decider-sections.js +197 -0
- package/dist/prompt-sections/routing-decider-sections.js.map +1 -0
- package/dist/queries/agent-resolvable-aging.d.ts +4 -3
- package/dist/queries/agent-resolvable-aging.d.ts.map +1 -1
- package/dist/queries/agent-resolvable-aging.js +5 -4
- package/dist/queries/agent-resolvable-aging.js.map +1 -1
- package/dist/queries/agent-resolvable-promotion.d.ts +172 -124
- package/dist/queries/agent-resolvable-promotion.d.ts.map +1 -1
- package/dist/queries/agent-resolvable-promotion.js +332 -307
- package/dist/queries/agent-resolvable-promotion.js.map +1 -1
- package/dist/queries/agent-resolvable-retirement.d.ts +105 -0
- package/dist/queries/agent-resolvable-retirement.d.ts.map +1 -0
- package/dist/queries/agent-resolvable-retirement.js +227 -0
- package/dist/queries/agent-resolvable-retirement.js.map +1 -0
- package/dist/queries/cause-key.d.ts +109 -0
- package/dist/queries/cause-key.d.ts.map +1 -1
- package/dist/queries/cause-key.js +93 -1
- package/dist/queries/cause-key.js.map +1 -1
- package/dist/queries/deliveries.d.ts +14 -0
- package/dist/queries/deliveries.d.ts.map +1 -1
- package/dist/queries/deliveries.js +20 -2
- package/dist/queries/deliveries.js.map +1 -1
- package/dist/queries/delivery-gate-state.d.ts +130 -5
- package/dist/queries/delivery-gate-state.d.ts.map +1 -1
- package/dist/queries/delivery-gate-state.js +111 -2
- package/dist/queries/delivery-gate-state.js.map +1 -1
- package/dist/queries/escalation-consumption.d.ts +95 -15
- package/dist/queries/escalation-consumption.d.ts.map +1 -1
- package/dist/queries/escalation-consumption.js +162 -24
- package/dist/queries/escalation-consumption.js.map +1 -1
- package/dist/queries/escalation-dispositions.d.ts +19 -7
- package/dist/queries/escalation-dispositions.d.ts.map +1 -1
- package/dist/queries/escalation-dispositions.js +7 -0
- package/dist/queries/escalation-dispositions.js.map +1 -1
- package/dist/queries/escalation-suppression.d.ts +63 -19
- package/dist/queries/escalation-suppression.d.ts.map +1 -1
- package/dist/queries/escalation-suppression.js +64 -35
- package/dist/queries/escalation-suppression.js.map +1 -1
- package/dist/queries/escalations.d.ts +127 -70
- package/dist/queries/escalations.d.ts.map +1 -1
- package/dist/queries/escalations.js +170 -188
- package/dist/queries/escalations.js.map +1 -1
- package/dist/queries/filing-observation.d.ts +82 -0
- package/dist/queries/filing-observation.d.ts.map +1 -0
- package/dist/queries/filing-observation.js +157 -0
- package/dist/queries/filing-observation.js.map +1 -0
- package/dist/queries/holds.d.ts +69 -2
- package/dist/queries/holds.d.ts.map +1 -1
- package/dist/queries/holds.js +106 -11
- package/dist/queries/holds.js.map +1 -1
- package/dist/queries/incident-correlation.d.ts +291 -0
- package/dist/queries/incident-correlation.d.ts.map +1 -0
- package/dist/queries/incident-correlation.js +408 -0
- package/dist/queries/incident-correlation.js.map +1 -0
- package/dist/queries/routing-measurement.d.ts +48 -1
- package/dist/queries/routing-measurement.d.ts.map +1 -1
- package/dist/queries/routing-measurement.js +64 -2
- package/dist/queries/routing-measurement.js.map +1 -1
- package/dist/queries/routing-quality.d.ts +8 -0
- package/dist/queries/routing-quality.d.ts.map +1 -1
- package/dist/queries/routing-quality.js +12 -3
- package/dist/queries/routing-quality.js.map +1 -1
- package/dist/queries/shared.js +1 -1
- package/dist/shell/crash-recovery.d.ts.map +1 -1
- package/dist/shell/crash-recovery.js +6 -6
- package/dist/shell/crash-recovery.js.map +1 -1
- package/dist/shell/heartbeat-metadata.d.ts +18 -0
- package/dist/shell/heartbeat-metadata.d.ts.map +1 -1
- package/dist/shell/heartbeat-metadata.js +24 -0
- package/dist/shell/heartbeat-metadata.js.map +1 -1
- package/dist/shell/heartbeat.d.ts.map +1 -1
- package/dist/shell/heartbeat.js +6 -17
- package/dist/shell/heartbeat.js.map +1 -1
- package/dist/shell/install-probe-tick.d.ts.map +1 -1
- package/dist/shell/install-probe-tick.js +3 -1
- package/dist/shell/install-probe-tick.js.map +1 -1
- package/dist/shell/model-resolution.d.ts +9 -4
- package/dist/shell/model-resolution.d.ts.map +1 -1
- package/dist/shell/model-resolution.js +46 -7
- package/dist/shell/model-resolution.js.map +1 -1
- package/dist/shell/unified-init.d.ts +24 -0
- package/dist/shell/unified-init.d.ts.map +1 -1
- package/dist/shell/unified-init.js +22 -17
- package/dist/shell/unified-init.js.map +1 -1
- package/dist/spawn/model-id-guards.d.ts +50 -0
- package/dist/spawn/model-id-guards.d.ts.map +1 -0
- package/dist/spawn/model-id-guards.js +110 -0
- package/dist/spawn/model-id-guards.js.map +1 -0
- package/dist/spawn/model-routing.d.ts +1 -43
- package/dist/spawn/model-routing.d.ts.map +1 -1
- package/dist/spawn/model-routing.js +3 -94
- package/dist/spawn/model-routing.js.map +1 -1
- package/dist/spawn/respawn-cycle-escalation.d.ts +10 -2
- package/dist/spawn/respawn-cycle-escalation.d.ts.map +1 -1
- package/dist/spawn/respawn-cycle-escalation.js +16 -2
- package/dist/spawn/respawn-cycle-escalation.js.map +1 -1
- package/dist/spawn/routing-decider-spawn.d.ts +93 -0
- package/dist/spawn/routing-decider-spawn.d.ts.map +1 -0
- package/dist/spawn/routing-decider-spawn.js +185 -0
- package/dist/spawn/routing-decider-spawn.js.map +1 -0
- package/dist/spawn/routing-decider.d.ts +42 -0
- package/dist/spawn/routing-decider.d.ts.map +1 -0
- package/dist/spawn/routing-decider.js +95 -0
- package/dist/spawn/routing-decider.js.map +1 -0
- package/dist/spawn/shared.d.ts +8 -0
- package/dist/spawn/shared.d.ts.map +1 -1
- package/dist/spawn/shared.js +1 -1
- package/dist/spawn/shared.js.map +1 -1
- package/dist/spawn/spawn-decision.d.ts +24 -16
- package/dist/spawn/spawn-decision.d.ts.map +1 -1
- package/dist/spawn/spawn-decision.js +28 -11
- package/dist/spawn/spawn-decision.js.map +1 -1
- package/dist/spawn/worktree-session.d.ts +23 -7
- package/dist/spawn/worktree-session.d.ts.map +1 -1
- package/dist/spawn/worktree-session.js +54 -22
- package/dist/spawn/worktree-session.js.map +1 -1
- package/dist/testing/fixtures/index.js +1 -1
- package/dist/types/index.js +1 -1
- package/dist/update/auto-update.d.ts +20 -3
- package/dist/update/auto-update.d.ts.map +1 -1
- package/dist/update/auto-update.js +8 -24
- package/dist/update/auto-update.js.map +1 -1
- package/dist/update/self-update.d.ts +43 -4
- package/dist/update/self-update.d.ts.map +1 -1
- package/dist/update/self-update.js +61 -38
- package/dist/update/self-update.js.map +1 -1
- package/dist/update/version-check.d.ts +29 -45
- package/dist/update/version-check.d.ts.map +1 -1
- package/dist/update/version-check.js +48 -79
- package/dist/update/version-check.js.map +1 -1
- package/dist/verify/failure-signature.d.ts +91 -0
- package/dist/verify/failure-signature.d.ts.map +1 -0
- package/dist/verify/failure-signature.js +233 -0
- package/dist/verify/failure-signature.js.map +1 -0
- package/dist/verify/shortfall-repeat.d.ts +12 -9
- package/dist/verify/shortfall-repeat.d.ts.map +1 -1
- package/dist/verify/shortfall-repeat.js +38 -14
- package/dist/verify/shortfall-repeat.js.map +1 -1
- package/dist/verify/stall-detectors.d.ts +19 -43
- package/dist/verify/stall-detectors.d.ts.map +1 -1
- package/dist/verify/stall-detectors.js +26 -101
- package/dist/verify/stall-detectors.js.map +1 -1
- package/dist/verify/unreviewed-settle-detector.d.ts +8 -0
- package/dist/verify/unreviewed-settle-detector.d.ts.map +1 -1
- package/dist/verify/unreviewed-settle-detector.js +15 -1
- package/dist/verify/unreviewed-settle-detector.js.map +1 -1
- package/dist/verify/verification-deps-default.d.ts.map +1 -1
- package/dist/verify/verification-deps-default.js +14 -2
- package/dist/verify/verification-deps-default.js.map +1 -1
- package/dist/verify/verification-evidence-unavailable-feedback.d.ts.map +1 -1
- package/dist/verify/verification-evidence-unavailable-feedback.js +8 -2
- package/dist/verify/verification-evidence-unavailable-feedback.js.map +1 -1
- package/dist/verify/verification-feedback.d.ts +62 -14
- package/dist/verify/verification-feedback.d.ts.map +1 -1
- package/dist/verify/verification-feedback.js +101 -28
- package/dist/verify/verification-feedback.js.map +1 -1
- package/dist/verify/verify-gate-stall.d.ts +116 -0
- package/dist/verify/verify-gate-stall.d.ts.map +1 -0
- package/dist/verify/verify-gate-stall.js +169 -0
- package/dist/verify/verify-gate-stall.js.map +1 -0
- package/dist/verify/verify-restatement.d.ts.map +1 -1
- package/dist/verify/verify-restatement.js +2 -1
- package/dist/verify/verify-restatement.js.map +1 -1
- package/package.json +3 -3
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
// PINNED-BY-BEGIN (generated by gen:pinned-by -- do not hand-edit; checked by lint:pinned-by)
|
|
2
2
|
// Pinned by: packages/daemon/src/completion/machine-remediable-demotion.test.ts,
|
|
3
|
+
// packages/daemon/src/integration/resolution-class-routing-flow.test.ts,
|
|
4
|
+
// packages/daemon/src/integration/verification-history-round-trip.test.ts,
|
|
3
5
|
// packages/daemon/src/queries/escalation-cause-key.test.ts,
|
|
4
6
|
// packages/daemon/src/queries/escalation-noise-regressions.test.ts,
|
|
7
|
+
// packages/daemon/src/queries/filing-chokepoint.test.ts,
|
|
8
|
+
// packages/daemon/src/queries/incident-correlation.test.ts,
|
|
5
9
|
// packages/daemon/src/spawn/spawn-cooldown.test.ts, packages/daemon/src/verify/shortfall-routing.test.ts,
|
|
6
10
|
// packages/daemon/src/verify/stall-detectors.test.ts,
|
|
7
11
|
// packages/daemon/src/verify/unreviewed-settle-detector.test.ts
|
|
@@ -10,33 +14,35 @@
|
|
|
10
14
|
* Cause-keyed escalation suppression + idempotent filing.
|
|
11
15
|
*
|
|
12
16
|
* Generalizes the narrow per-delivery precedent (hasOpenEscalationForDelivery in
|
|
13
|
-
* queries/
|
|
14
|
-
* (queries/cause-key.ts). Two properties, both DB-backed so they survive a
|
|
15
|
-
* restart:
|
|
17
|
+
* queries/escalations.ts) to EVERY daemon detector via a deterministic cause key
|
|
18
|
+
* (queries/cause-key.ts). Two properties, both DB-backed so they survive a
|
|
19
|
+
* daemon restart:
|
|
16
20
|
*
|
|
17
21
|
* 1. Idempotent while open. While a filing carrying this cause key is OPEN
|
|
18
|
-
* (pending or in_review)
|
|
19
|
-
*
|
|
22
|
+
* (pending or in_review) -- as the row's own cause key OR as a symptom
|
|
23
|
+
* correlated onto an open incident row -- a detector re-observing the same
|
|
24
|
+
* cause does not file again (nor append a duplicate symptom).
|
|
20
25
|
*
|
|
21
26
|
* 2. Dismissal memory. A DISMISSED filing carrying this cause key keeps the
|
|
22
27
|
* cause silent: the same cause cannot re-file until its subject state
|
|
23
28
|
* changes. Because the subject is encoded IN the cause key, a changed subject
|
|
24
29
|
* (a NEW sha going red) yields a DIFFERENT key with no matching dismissed row
|
|
25
|
-
* and re-files naturally
|
|
26
|
-
*
|
|
30
|
+
* and re-files naturally. Dismissal memory stays per cause key: a dismissed
|
|
31
|
+
* incident row's correlated symptoms do not suppress.
|
|
27
32
|
*
|
|
28
33
|
* A RESOLVED filing does NOT suppress: resolve means the cause was addressed, so a
|
|
29
34
|
* recurrence should re-file. This is achieved simply by excluding 'resolved' from
|
|
30
35
|
* the suppression status set below.
|
|
31
36
|
*
|
|
32
37
|
* The cause key is stamped into agent_escalations.metadata.cause_key at file time.
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
38
|
+
* Cross-detector correlation (one incident per root cause) is NOT decided here: an
|
|
39
|
+
* unsuppressed filing goes to createEscalation, whose ONE incident reducer
|
|
40
|
+
* (queries/incident-correlation.ts) attaches every daemon filing -- this path's and
|
|
41
|
+
* the direct filers' alike -- to its incident's open lane row.
|
|
37
42
|
*/
|
|
38
43
|
import { callApi } from './shared.js';
|
|
39
44
|
import { createEscalation } from './escalations.js';
|
|
45
|
+
import { openRowSymptomCauseKeys } from './incident-correlation.js';
|
|
40
46
|
import { createLogger } from '../shell/log.js';
|
|
41
47
|
const log = createLogger({ module: 'escalations' });
|
|
42
48
|
/**
|
|
@@ -45,8 +51,9 @@ const log = createLogger({ module: 'escalations' });
|
|
|
45
51
|
* deliberately ABSENT -- a resolved cause may recur and should re-file.
|
|
46
52
|
*/
|
|
47
53
|
const SUPPRESSING_STATUSES = ['pending', 'in_review', 'dismissed'];
|
|
48
|
-
async function defaultListSuppressingEscalations(opts) {
|
|
49
|
-
const
|
|
54
|
+
async function defaultListSuppressingEscalations(opts, deps) {
|
|
55
|
+
const call = deps.callApi ?? callApi;
|
|
56
|
+
const result = await call('escalation_list', {
|
|
50
57
|
fields: {
|
|
51
58
|
statuses: SUPPRESSING_STATUSES,
|
|
52
59
|
...(opts.focusId ? { focusId: opts.focusId } : {}),
|
|
@@ -55,11 +62,31 @@ async function defaultListSuppressingEscalations(opts) {
|
|
|
55
62
|
});
|
|
56
63
|
return result.escalations ?? [];
|
|
57
64
|
}
|
|
58
|
-
|
|
59
|
-
|
|
65
|
+
function listFor(deps) {
|
|
66
|
+
return deps.listSuppressingEscalations ?? ((opts) => defaultListSuppressingEscalations(opts, deps));
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* The cause keys a row answers for, tolerating the loose JSONB shape: its own
|
|
70
|
+
* metadata.cause_key, plus metadata.original_cause_key on a hand-off row -- a
|
|
71
|
+
* routing decider's human-facing filing (MCP escalate sourceCauseKey) or a historic
|
|
72
|
+
* promotion refile -- so an open hand-off row keeps the detector's original cause
|
|
73
|
+
* silent exactly as the source did.
|
|
74
|
+
*/
|
|
75
|
+
function rowCauseKeys(row) {
|
|
60
76
|
const meta = row.metadata ?? null;
|
|
61
|
-
|
|
62
|
-
|
|
77
|
+
return [meta?.cause_key, meta?.original_cause_key].filter((k) => typeof k === 'string');
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Pure: whether already-fetched rows suppress a re-file of `causeKey` -- an OPEN
|
|
81
|
+
* or DISMISSED row carrying it as its own (or original) cause key, or an OPEN row
|
|
82
|
+
* carrying it as a correlated symptom.
|
|
83
|
+
*/
|
|
84
|
+
export function rowsSuppressCauseKey(rows, causeKey) {
|
|
85
|
+
return rows.some((e) => {
|
|
86
|
+
if (e.status && !SUPPRESSING_STATUSES.includes(e.status))
|
|
87
|
+
return false;
|
|
88
|
+
return rowCauseKeys(e).includes(causeKey) || openRowSymptomCauseKeys(e).includes(causeKey);
|
|
89
|
+
});
|
|
63
90
|
}
|
|
64
91
|
/**
|
|
65
92
|
* True when an OPEN (pending/in_review) or DISMISSED escalation already carries
|
|
@@ -71,36 +98,38 @@ function rowCauseKey(row) {
|
|
|
71
98
|
* is client-side because cause_key lives in metadata JSONB, not a column.
|
|
72
99
|
*/
|
|
73
100
|
export async function hasSuppressedCauseKey(causeKey, opts = {}, deps = {}) {
|
|
74
|
-
|
|
75
|
-
const rows = await list({ focusId: opts.focusId });
|
|
76
|
-
return rows.some((e) => {
|
|
77
|
-
if (e.status && !SUPPRESSING_STATUSES.includes(e.status))
|
|
78
|
-
return false;
|
|
79
|
-
return rowCauseKey(e) === causeKey;
|
|
80
|
-
});
|
|
101
|
+
return rowsSuppressCauseKey(await listFor(deps)({ focusId: opts.focusId }), causeKey);
|
|
81
102
|
}
|
|
82
103
|
/**
|
|
83
|
-
* File an escalation ONLY if its cause key is not already suppressed (open
|
|
84
|
-
* dismissed). The cause key is stamped into
|
|
85
|
-
* re-observation of the same cause is suppressed
|
|
104
|
+
* File an escalation ONLY if its cause key is not already suppressed (open,
|
|
105
|
+
* dismissed, or an open incident's symptom). The cause key is stamped into
|
|
106
|
+
* metadata.cause_key so a later re-observation of the same cause is suppressed;
|
|
107
|
+
* createEscalation then correlates the filing onto its incident (see the header).
|
|
86
108
|
*
|
|
87
|
-
* This is the single
|
|
109
|
+
* This is the single cause-keyed entry point every daemon detector should route
|
|
88
110
|
* through. It replaces per-detector ad-hoc dedup (hasOpenEscalationForDelivery,
|
|
89
111
|
* hasOpenWorktreeDirtyEscalation, hasOpenWedgedFocusEscalation, in-memory Sets)
|
|
90
112
|
* with one cause-keyed gate that also carries dismissal memory.
|
|
91
113
|
*/
|
|
92
114
|
export async function fileEscalationIdempotent(params, deps = {}) {
|
|
93
115
|
const { causeKey, ...createParams } = params;
|
|
94
|
-
const
|
|
95
|
-
|
|
96
|
-
if (suppressed) {
|
|
116
|
+
const rows = await listFor(deps)({ focusId: createParams.focusId ?? createParams.anchor?.focusId });
|
|
117
|
+
if (rowsSuppressCauseKey(rows, causeKey)) {
|
|
97
118
|
log.info(`[escalations] Suppressed duplicate filing for cause key "${causeKey}" (open or dismissed row exists)`);
|
|
98
|
-
return { filed: false, suppressed: true, escalationId: null };
|
|
119
|
+
return { filed: false, suppressed: true, escalationId: null, correlated: false, incidentEscalationId: null };
|
|
99
120
|
}
|
|
100
|
-
const
|
|
121
|
+
const keyed = {
|
|
101
122
|
...createParams,
|
|
102
123
|
metadata: { ...(createParams.metadata ?? {}), cause_key: causeKey },
|
|
103
|
-
}
|
|
104
|
-
|
|
124
|
+
};
|
|
125
|
+
const created = await (deps.createEscalation ?? createEscalation)(keyed, deps.callApi ? { callApi: deps.callApi } : {});
|
|
126
|
+
const correlated = created.correlated === true;
|
|
127
|
+
return {
|
|
128
|
+
filed: !correlated,
|
|
129
|
+
suppressed: false,
|
|
130
|
+
escalationId: correlated ? null : created.escalationId,
|
|
131
|
+
correlated,
|
|
132
|
+
incidentEscalationId: created.incidentEscalationId ?? null,
|
|
133
|
+
};
|
|
105
134
|
}
|
|
106
135
|
//# sourceMappingURL=escalation-suppression.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"escalation-suppression.js","sourceRoot":"","sources":["../../src/queries/escalation-suppression.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,iFAAiF;AACjF,8DAA8D;AAC9D,sEAAsE;AACtE,4GAA4G;AAC5G,wDAAwD;AACxD,kEAAkE;AAClE,gBAAgB;AAEhB
|
|
1
|
+
{"version":3,"file":"escalation-suppression.js","sourceRoot":"","sources":["../../src/queries/escalation-suppression.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,iFAAiF;AACjF,2EAA2E;AAC3E,6EAA6E;AAC7E,8DAA8D;AAC9D,sEAAsE;AACtE,2DAA2D;AAC3D,8DAA8D;AAC9D,4GAA4G;AAC5G,wDAAwD;AACxD,kEAAkE;AAClE,gBAAgB;AAEhB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,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EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,oBAAoB,EAAE,IAAI,EAAE,CAAC;IAC/G,CAAC;IAED,MAAM,KAAK,GAA2B;QACpC,GAAG,YAAY;QACf,QAAQ,EAAE,EAAE,GAAG,CAAC,YAAY,CAAC,QAAQ,IAAI,EAAE,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE;KACpE,CAAC;IACF,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,gBAAgB,IAAI,gBAAgB,CAAC,CAAC,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IACxH,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,KAAK,IAAI,CAAC;IAC/C,OAAO;QACL,KAAK,EAAE,CAAC,UAAU;QAClB,UAAU,EAAE,KAAK;QACjB,YAAY,EAAE,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,YAAY;QACtD,UAAU;QACV,oBAAoB,EAAE,OAAO,CAAC,oBAAoB,IAAI,IAAI;KAC3D,CAAC;AACJ,CAAC"}
|
|
@@ -6,25 +6,23 @@
|
|
|
6
6
|
* working -- the same shape as the queries/holds.ts split.
|
|
7
7
|
*
|
|
8
8
|
* This module must NOT take a runtime (value) import of `@telora/daemon-core`
|
|
9
|
-
* (
|
|
10
|
-
*
|
|
11
|
-
* (.../src/queries/@telora/daemon-core) and dies with ERR_MODULE_NOT_FOUND --
|
|
12
|
-
* so every test that registers a mock.module and transitively loads this file
|
|
13
|
-
* fails to even start. The disposition vocabulary is therefore mirrored as
|
|
14
|
-
* type-pinned local literals (DISPOSITION_AGENT_RESOLVABLE / _NEEDS_INTENT);
|
|
15
|
-
* the same quirk keeps src/shell/log.ts daemon-local.
|
|
9
|
+
* (type imports only): under the node:test module-mock loader a bare `@telora/*`
|
|
10
|
+
* value specifier dies with ERR_MODULE_NOT_FOUND (see escalation-dispositions.ts).
|
|
16
11
|
*/
|
|
12
|
+
import type { EscalationResolutionClass } from '@telora/daemon-core';
|
|
17
13
|
import { type CallApiDeps } from './shared.js';
|
|
18
14
|
import { resolveProvenance, type EscalationAnchor } from '../completion/escalation-provenance.js';
|
|
15
|
+
import { type HumanAct } from './filing-observation.js';
|
|
16
|
+
import { type IncidentRow, type SymptomClearing } from './incident-correlation.js';
|
|
19
17
|
/**
|
|
20
18
|
* The escalation `description` hard cap enforced server-side by
|
|
21
19
|
* supabase/functions/_shared/validation.ts (validateMaxLength(description, 5000)).
|
|
22
20
|
* Every daemon-side producer that composes a description MUST fit it under this
|
|
23
21
|
* ONE number rather than compose blind and let the edge reject on length --
|
|
24
22
|
* the disagreement that let an over-cap description be re-submitted forever
|
|
25
|
-
* (Nexus notifications, and the agent_resolvable promotion refile
|
|
26
|
-
* producer (nexus/return.ts)
|
|
27
|
-
*
|
|
23
|
+
* (Nexus notifications, and the former agent_resolvable promotion refile, which
|
|
24
|
+
* the daemon no longer files). The Nexus producer (nexus/return.ts) imports it
|
|
25
|
+
* from here so producer and server agree on the limit.
|
|
28
26
|
*/
|
|
29
27
|
export declare const ESCALATION_DESCRIPTION_MAX = 5000;
|
|
30
28
|
/**
|
|
@@ -83,32 +81,51 @@ export interface CreateEscalationParams {
|
|
|
83
81
|
* over the derived values (caller intent beats derivation).
|
|
84
82
|
*/
|
|
85
83
|
anchor?: EscalationAnchor;
|
|
84
|
+
/**
|
|
85
|
+
* The act the detector PROPOSES only a human can perform (irreversible / outward /
|
|
86
|
+
* unreachable capability), or NO_HUMAN_ACT. Never a route: it travels as
|
|
87
|
+
* metadata.observation.proposed_human_act on the machine-lane observation
|
|
88
|
+
* (queries/filing-observation.ts routeFilingDisposition).
|
|
89
|
+
*/
|
|
90
|
+
humanAct?: HumanAct | null;
|
|
86
91
|
}
|
|
87
92
|
/**
|
|
88
|
-
*
|
|
89
|
-
*
|
|
90
|
-
*
|
|
91
|
-
* resolveProvenance and merged with any explicit productId/focusId/deliveryId
|
|
92
|
-
* on params (explicit wins). This is the single stamping point that closes
|
|
93
|
-
* Delivery C: every site routes through here and provenance is guaranteed
|
|
94
|
-
* whenever an anchor is available. resolveProvenance never throws, so a
|
|
95
|
-
* derivation miss degrades to the explicit fields (or none) rather than
|
|
96
|
-
* aborting the escalation.
|
|
97
|
-
*/
|
|
98
|
-
/**
|
|
99
|
-
* Injectable deps for createEscalation. Two-dep cascade: the shared path calls
|
|
100
|
-
* BOTH callApi (to write the row) AND resolveProvenance (to derive the anchor's
|
|
101
|
-
* product/focus/delivery columns). CallApiDeps only covers callApi, so this
|
|
102
|
-
* local interface adds the provenance seam. A test injects fakes THROUGH deps,
|
|
103
|
-
* registering ZERO mock.module (which would poison the daemon-core mock-loader);
|
|
104
|
-
* production callers pass nothing and get the real imports.
|
|
93
|
+
* Injectable deps for createEscalation: callApi (writes the row) + resolveProvenance
|
|
94
|
+
* (derives the anchor's product/focus/delivery columns). Tests inject fakes THROUGH
|
|
95
|
+
* deps, registering ZERO mock.module; production callers pass nothing.
|
|
105
96
|
*/
|
|
106
97
|
export interface CreateEscalationDeps extends CallApiDeps {
|
|
107
98
|
resolveProvenance?: typeof resolveProvenance;
|
|
99
|
+
/** ISO-8601 clock for the symptom's observed_at. */
|
|
100
|
+
now?: () => string;
|
|
108
101
|
}
|
|
109
|
-
|
|
102
|
+
/** Outcome of a filing through the chokepoint. */
|
|
103
|
+
export interface CreateEscalationResult {
|
|
104
|
+
/** The row filed; null when correlated onto an existing row (or the create returned no id). */
|
|
110
105
|
escalationId: string | null;
|
|
111
|
-
|
|
106
|
+
/** Whether the filing was attached to (or already carried by) its incident's open lane row instead of filed. */
|
|
107
|
+
correlated?: boolean;
|
|
108
|
+
/** The lane row it correlated onto, or whose attach failed before this row was filed; else null. */
|
|
109
|
+
incidentEscalationId?: string | null;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Create an escalation request -- the single filing chokepoint. Provenance is
|
|
113
|
+
* derived from `anchor` via resolveProvenance (explicit productId/focusId/deliveryId
|
|
114
|
+
* win; a derivation miss degrades, never aborts). The disposition is routed by
|
|
115
|
+
* routeFilingDisposition: a daemon filing enters the machine lane WHATEVER
|
|
116
|
+
* disposition it names -- needs_operator / external_wait / needs_intent /
|
|
117
|
+
* needs_clarification are sent agent_resolvable as an observation carrying the
|
|
118
|
+
* proposed disposition and any proposed human act. The daemon files no
|
|
119
|
+
* human-facing row; only an agent that has assembled the intent ladder makes a
|
|
120
|
+
* filing human-facing (MCP escalate). A stop or hold the detector reported stays
|
|
121
|
+
* in force on its observation (queries/holds.ts isMachineStopObservation and
|
|
122
|
+
* findOpenOperatorHoldForDelivery). The RESOLVED provenance (plus a branch the site carries) yields metadata.incident_key
|
|
123
|
+
* (a key already in metadata wins; inbound-notification kinds carry none), and the
|
|
124
|
+
* ONE incident reducer (queries/incident-correlation.ts correlateFiling) either
|
|
125
|
+
* attaches the filing to its incident's open row in the same lane -- no row filed
|
|
126
|
+
* -- or the row is filed stamped with the key and its own symptom.
|
|
127
|
+
*/
|
|
128
|
+
export declare function createEscalation(params: CreateEscalationParams, deps?: CreateEscalationDeps): Promise<CreateEscalationResult>;
|
|
112
129
|
/**
|
|
113
130
|
* Minimal shape of an escalation row returned by listPendingEscalations.
|
|
114
131
|
* Only includes the fields needed by the merge-back loop.
|
|
@@ -120,6 +137,7 @@ export interface PendingEscalation {
|
|
|
120
137
|
whatWasTried: string | null;
|
|
121
138
|
helpNeeded: string | null;
|
|
122
139
|
escalationKind?: string | null;
|
|
140
|
+
focusId?: string | null;
|
|
123
141
|
metadata?: Record<string, unknown> | null;
|
|
124
142
|
}
|
|
125
143
|
/**
|
|
@@ -153,6 +171,15 @@ export declare function listPendingEscalations(deps?: CallApiDeps): Promise<Pend
|
|
|
153
171
|
export declare function hasOpenTeamFailureEscalation(focusId: string, deps?: CallApiDeps, opts?: {
|
|
154
172
|
excludeAgentResolvable?: boolean;
|
|
155
173
|
}): Promise<boolean>;
|
|
174
|
+
/**
|
|
175
|
+
* DEDUP-only sibling of hasOpenTeamFailureEscalation, for the team_failure RE-FILE
|
|
176
|
+
* guards (completion/event.ts): also counts an open row on the focus answering for
|
|
177
|
+
* team_failure as a promotion refile (originalKind / original_cause_key) or a
|
|
178
|
+
* carried symptom, so a promoted team_failure is not re-filed. The respawn guard
|
|
179
|
+
* keeps the kind-column read -- a HOLD must not match a condition whose kind-keyed
|
|
180
|
+
* close-half would never release it.
|
|
181
|
+
*/
|
|
182
|
+
export declare function hasOpenTeamFailureEscalationForDedup(focusId: string, deps?: CallApiDeps): Promise<boolean>;
|
|
156
183
|
/**
|
|
157
184
|
* Returns true when an open (status pending or in_review) escalation exists
|
|
158
185
|
* for the given delivery + kind discriminator.
|
|
@@ -163,7 +190,9 @@ export declare function hasOpenTeamFailureEscalation(focusId: string, deps?: Cal
|
|
|
163
190
|
* COLUMNS in preference to the metadata bag. A metadata fallback is retained
|
|
164
191
|
* for back-compat with rows already open at deploy time (filed before this
|
|
165
192
|
* promotion, which carry the discriminator only in metadata.kind /
|
|
166
|
-
* metadata.deliveryId).
|
|
193
|
+
* metadata.deliveryId). A pure DEDUP read, so it also sees a promotion refile
|
|
194
|
+
* (metadata.originalKind + the delivery's carried incident_key) and a symptom
|
|
195
|
+
* correlated onto the delivery's incident row (rowAnswersForKind / rowNamesDelivery).
|
|
167
196
|
*
|
|
168
197
|
* Used by the delivery advance-block path so a delivery stuck across many
|
|
169
198
|
* polls files exactly one open escalation instead of one per tick.
|
|
@@ -233,25 +262,11 @@ export declare const WEDGED_FOCUS_ESCALATION_KIND = "wedged_focus";
|
|
|
233
262
|
* (the 172-duplicate storm class). Keying on the focus + escalation_kind COLUMNS
|
|
234
263
|
* collapses the threshold-crossing escalation to at most one open row per focus.
|
|
235
264
|
*
|
|
236
|
-
*
|
|
237
|
-
*
|
|
238
|
-
*
|
|
239
|
-
* status + focus + kind predicate is ALSO applied client-side as defense-in-depth.
|
|
240
|
-
* Because it queries the DB rather than an in-memory Set, the dedup SURVIVES A
|
|
241
|
-
* DAEMON RESTART -- a restart cannot re-storm a focus that is still wedged.
|
|
265
|
+
* Delegates to hasOpenFocusEscalation (server-side focusId + open-status narrowing,
|
|
266
|
+
* client-side re-check). Because it queries the DB rather than an in-memory Set,
|
|
267
|
+
* the dedup SURVIVES A DAEMON RESTART -- a restart cannot re-storm a wedged focus.
|
|
242
268
|
*/
|
|
243
269
|
export declare function hasOpenWedgedFocusEscalation(focusId: string): Promise<boolean>;
|
|
244
|
-
/**
|
|
245
|
-
* Returns true when an OPEN (status pending or in_review) escalation of the
|
|
246
|
-
* given `escalationKind` already exists for the given FOCUS. Generic per-focus
|
|
247
|
-
* dedup, mirroring hasOpenWedgedFocusEscalation but parameterized on the kind.
|
|
248
|
-
*
|
|
249
|
-
* Used by the targeted stall detectors (review_window_stalled) so a focus that
|
|
250
|
-
* stays stalled across many poll ticks files exactly one open escalation
|
|
251
|
-
* instead of one per tick. Queries the DB (not an in-memory Set), so the dedup
|
|
252
|
-
* survives a daemon restart. Narrows server-side by focusId + open statuses and
|
|
253
|
-
* re-applies the status/focus/kind predicate client-side as defense-in-depth.
|
|
254
|
-
*/
|
|
255
270
|
/**
|
|
256
271
|
* The escalation_kind the review-exit drift-streak breaker files when a focus
|
|
257
272
|
* branch keeps advancing DURING each review pass (review-exit-escalations.ts).
|
|
@@ -266,10 +281,50 @@ export declare const REVIEW_COVERAGE_INCOMPLETE_ESCALATION_KIND = "review_covera
|
|
|
266
281
|
* fired parks its re-review spawns instead of burning a review cycle every
|
|
267
282
|
* spawn cooldown while the escalation sits open (the 2026-08-06 incident: the
|
|
268
283
|
* breaker fired 4 minutes in, but nothing stopped the loop for 4.5h). Mirrors
|
|
269
|
-
* hasOpenTeamFailureEscalation
|
|
284
|
+
* hasOpenTeamFailureEscalation's excludeAgentResolvable (TEL-2), but the respawn
|
|
285
|
+
* guard does NOT pass it: the coverage hold is a machine wait-state the coverage
|
|
286
|
+
* stabilizer clears, so it parks the spawn whatever its disposition.
|
|
287
|
+
*/
|
|
288
|
+
export declare function hasOpenReviewCoverageIncompleteEscalation(focusId: string, deps?: CallApiDeps, opts?: {
|
|
289
|
+
excludeAgentResolvable?: boolean;
|
|
290
|
+
}): Promise<boolean>;
|
|
291
|
+
/**
|
|
292
|
+
* Returns true when an OPEN (status pending or in_review) escalation of the
|
|
293
|
+
* given `escalationKind` already exists for the given FOCUS. Generic per-focus
|
|
294
|
+
* dedup (review_window_stalled, wedged_focus, the review breakers): one open row
|
|
295
|
+
* per focus across poll ticks and daemon restarts. Narrows server-side by
|
|
296
|
+
* focusId + open statuses and re-applies status/focus/kind client-side.
|
|
297
|
+
* Dedup callers pass no opts (every open row counts, observations included).
|
|
298
|
+
*
|
|
299
|
+
* `matchCorrelated` is for PURE dedup reads only: it also counts a promotion
|
|
300
|
+
* refile (metadata.originalKind) and a symptom correlated onto an open incident
|
|
301
|
+
* row on the focus. It is opt-in because two callers read this as a HOLD (the
|
|
302
|
+
* respawn guard's review_coverage_incomplete, the state cascade's breaker hold),
|
|
303
|
+
* and a promoted or absorbed condition has no close-half that would release it.
|
|
304
|
+
*/
|
|
305
|
+
export declare function hasOpenFocusEscalation(focusId: string, escalationKind: string, deps?: CallApiDeps, opts?: {
|
|
306
|
+
excludeAgentResolvable?: boolean;
|
|
307
|
+
matchCorrelated?: boolean;
|
|
308
|
+
}): Promise<boolean>;
|
|
309
|
+
/**
|
|
310
|
+
* List the escalation_kind of every OPEN (pending/in_review) escalation naming a
|
|
311
|
+
* focus -- the raw evidence the wedge-cause arbiter (TEL-3) draws on -- plus every
|
|
312
|
+
* symptom kind correlated onto those rows, so a cause absorbed into an incident
|
|
313
|
+
* row still counts. Any-kind (no server kind filter); the caller narrows to wedge
|
|
314
|
+
* causes. Column-first with the metadata.focusId fallback for pre-backfill rows.
|
|
270
315
|
*/
|
|
271
|
-
export declare function
|
|
272
|
-
|
|
316
|
+
export declare function listOpenFocusEscalationKinds(focusId: string, deps?: CallApiDeps): Promise<string[]>;
|
|
317
|
+
/**
|
|
318
|
+
* Read the OPEN (pending or in_review) escalations of `escalationKind` for a
|
|
319
|
+
* focus, returning each row's id + metadata. The read sibling of
|
|
320
|
+
* resolveOpenFocusEscalationsOfKind, for close-halves whose clearing condition
|
|
321
|
+
* is per-row (e.g. review_coverage_incomplete clears only when the focus branch
|
|
322
|
+
* has stabilized at the tip recorded in the row's metadata at filing).
|
|
323
|
+
*/
|
|
324
|
+
export declare function listOpenFocusEscalationsOfKind(focusId: string, escalationKind: string, deps?: CallApiDeps): Promise<Array<{
|
|
325
|
+
id: string;
|
|
326
|
+
metadata: Record<string, unknown> | null;
|
|
327
|
+
}>>;
|
|
273
328
|
/**
|
|
274
329
|
* The close half for a per-FOCUS escalation kind: resolve every open (pending or
|
|
275
330
|
* in_review) escalation of `escalationKind` for the focus, once the daemon has
|
|
@@ -283,25 +338,16 @@ export declare function hasOpenFocusEscalation(focusId: string, escalationKind:
|
|
|
283
338
|
* so the caller's primary work (advancing a delivery) is not blocked. Returns the
|
|
284
339
|
* count resolved.
|
|
285
340
|
*/
|
|
341
|
+
export declare function resolveOpenFocusEscalationsOfKind(focusId: string, escalationKind: string, resolutionClass: EscalationResolutionClass, resolutionNotes: string, deps?: CallApiDeps): Promise<number>;
|
|
286
342
|
/**
|
|
287
|
-
*
|
|
288
|
-
*
|
|
289
|
-
*
|
|
290
|
-
* is per-row (e.g. review_coverage_incomplete clears only when the focus branch
|
|
291
|
-
* has stabilized at the tip recorded in the row's metadata at filing).
|
|
343
|
+
* Retire a clearing's absorbed symptoms over the API (incident-correlation.ts retireClearedSymptoms,
|
|
344
|
+
* rule 6) -- for the resolve helpers here and for sweeps elsewhere that resolve their own rows.
|
|
345
|
+
* Best-effort: logs, never throws. Returns the count of symptoms retired.
|
|
292
346
|
*/
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
* the metadata.focusId fallback for pre-backfill rows.
|
|
298
|
-
*/
|
|
299
|
-
export declare function listOpenFocusEscalationKinds(focusId: string, deps?: CallApiDeps): Promise<string[]>;
|
|
300
|
-
export declare function listOpenFocusEscalationsOfKind(focusId: string, escalationKind: string, deps?: CallApiDeps): Promise<Array<{
|
|
301
|
-
id: string;
|
|
302
|
-
metadata: Record<string, unknown> | null;
|
|
303
|
-
}>>;
|
|
304
|
-
export declare function resolveOpenFocusEscalationsOfKind(focusId: string, escalationKind: string, resolutionNotes: string, deps?: CallApiDeps, resolutionClass?: string): Promise<number>;
|
|
347
|
+
export declare function retireAbsorbedSymptoms(clearing: SymptomClearing, opts?: {
|
|
348
|
+
rows?: readonly IncidentRow[];
|
|
349
|
+
skipIds?: readonly string[];
|
|
350
|
+
}, deps?: CallApiDeps): Promise<number>;
|
|
305
351
|
/**
|
|
306
352
|
* The escalation kinds that describe a focus that cannot converge -- the review
|
|
307
353
|
* hand-off breaker family plus team_failure. When the focus DOES converge, each
|
|
@@ -340,8 +386,11 @@ export declare function resolveConvergedFocusEscalations(focusId: string, resolu
|
|
|
340
386
|
* actually resolves -- e.g. a clean worktree clears advance_blocked /
|
|
341
387
|
* merge_refused_dirty but NOT merge_conflict (a content conflict is not a dirty
|
|
342
388
|
* worktree), and a successful merge clears merge_conflict.
|
|
389
|
+
*
|
|
390
|
+
* `resolutionClass` is REQUIRED: the class of actor that observed the clearing
|
|
391
|
+
* (the daemon's condition-cleared callers pass 'auto_swept').
|
|
343
392
|
*/
|
|
344
|
-
export declare function resolveOpenWorktreeDirtyEscalations(focusId: string, kinds: readonly string[], resolutionNotes?: string, deps?: CallApiDeps): Promise<number>;
|
|
393
|
+
export declare function resolveOpenWorktreeDirtyEscalations(focusId: string, kinds: readonly string[], resolutionClass: EscalationResolutionClass, resolutionNotes?: string, deps?: CallApiDeps): Promise<number>;
|
|
345
394
|
/**
|
|
346
395
|
* Returns true when an OPEN (status pending or in_review) PRD machine escalation
|
|
347
396
|
* of the given `discriminator` already exists for the given PRD.
|
|
@@ -369,7 +418,15 @@ export declare function resolveOpenWorktreeDirtyEscalations(focusId: string, kin
|
|
|
369
418
|
*/
|
|
370
419
|
export declare function hasOpenPrdEscalation(prdId: string, discriminator: string): Promise<boolean>;
|
|
371
420
|
/**
|
|
372
|
-
* Mark an escalation as resolved
|
|
421
|
+
* Mark an escalation as resolved, recording WHO actually resolved it.
|
|
422
|
+
*
|
|
423
|
+
* `resolutionClass` is REQUIRED and typed: every daemon close path must state the
|
|
424
|
+
* class of actor it observed (a condition-cleared sweep or a promotion/demotion
|
|
425
|
+
* refile is 'auto_swept'; an agent's own progress is 'agent_session'). It feeds
|
|
426
|
+
* the routing-quality mis-route measurement (queries/routing-quality.ts), which
|
|
427
|
+
* differences a filing's declared disposition against this recorded class --
|
|
428
|
+
* when it was optional no caller passed it, so every resolved row read null and
|
|
429
|
+
* the measurement fail-opened forever on judged=0.
|
|
373
430
|
*/
|
|
374
|
-
export declare function markEscalationResolved(escalationId: string, resolutionNotes?: string, deps?: CallApiDeps
|
|
431
|
+
export declare function markEscalationResolved(escalationId: string, resolutionClass: EscalationResolutionClass, resolutionNotes?: string, deps?: CallApiDeps): Promise<void>;
|
|
375
432
|
//# sourceMappingURL=escalations.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"escalations.d.ts","sourceRoot":"","sources":["../../src/queries/escalations.ts"],"names":[],"mappings":"AAIA
|
|
1
|
+
{"version":3,"file":"escalations.d.ts","sourceRoot":"","sources":["../../src/queries/escalations.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AACrE,OAAO,EAAW,KAAK,WAAW,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,KAAK,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AAGlG,OAAO,EAA0B,KAAK,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAChF,OAAO,EAWL,KAAK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