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