@telora/daemon 0.22.104 → 0.22.131
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build-info.json +4 -3
- package/dist/completion/commit-verdict-release.d.ts +49 -0
- package/dist/completion/commit-verdict-release.d.ts.map +1 -0
- package/dist/completion/commit-verdict-release.js +240 -0
- package/dist/completion/commit-verdict-release.js.map +1 -0
- package/dist/completion/completion-phase-registry.d.ts +10 -4
- package/dist/completion/completion-phase-registry.d.ts.map +1 -1
- package/dist/completion/completion-phase-registry.js +19 -7
- package/dist/completion/completion-phase-registry.js.map +1 -1
- package/dist/completion/detector.d.ts.map +1 -1
- package/dist/completion/detector.js +1 -0
- package/dist/completion/detector.js.map +1 -1
- package/dist/completion/event-entry-phases.d.ts +6 -3
- package/dist/completion/event-entry-phases.d.ts.map +1 -1
- package/dist/completion/event-entry-phases.js +135 -76
- package/dist/completion/event-entry-phases.js.map +1 -1
- package/dist/completion/event-phases.d.ts +24 -3
- package/dist/completion/event-phases.d.ts.map +1 -1
- package/dist/completion/event-phases.js +9 -9
- package/dist/completion/event-phases.js.map +1 -1
- package/dist/completion/event.d.ts +8 -0
- package/dist/completion/event.d.ts.map +1 -1
- package/dist/completion/event.js +47 -21
- package/dist/completion/event.js.map +1 -1
- package/dist/completion/exit-classification.d.ts.map +1 -1
- package/dist/completion/exit-classification.js +1 -0
- package/dist/completion/exit-classification.js.map +1 -1
- package/dist/completion/merge-phase.d.ts +21 -9
- package/dist/completion/merge-phase.d.ts.map +1 -1
- package/dist/completion/merge-phase.js +35 -10
- package/dist/completion/merge-phase.js.map +1 -1
- package/dist/completion/review-auto-approval-record.d.ts +19 -0
- package/dist/completion/review-auto-approval-record.d.ts.map +1 -0
- package/dist/completion/review-auto-approval-record.js +102 -0
- package/dist/completion/review-auto-approval-record.js.map +1 -0
- package/dist/completion/review-cycle-cap.d.ts +62 -0
- package/dist/completion/review-cycle-cap.d.ts.map +1 -0
- package/dist/completion/review-cycle-cap.js +180 -0
- package/dist/completion/review-cycle-cap.js.map +1 -0
- package/dist/completion/review-exit-deps.d.ts +17 -2
- package/dist/completion/review-exit-deps.d.ts.map +1 -1
- package/dist/completion/review-exit-deps.js +19 -2
- package/dist/completion/review-exit-deps.js.map +1 -1
- package/dist/completion/review-exit-escalations.d.ts +45 -23
- package/dist/completion/review-exit-escalations.d.ts.map +1 -1
- package/dist/completion/review-exit-escalations.js +15 -74
- package/dist/completion/review-exit-escalations.js.map +1 -1
- package/dist/completion/review-exit-evidence.d.ts +9 -0
- package/dist/completion/review-exit-evidence.d.ts.map +1 -1
- package/dist/completion/review-exit-evidence.js +4 -1
- package/dist/completion/review-exit-evidence.js.map +1 -1
- package/dist/completion/review-exit-foreign-findings.d.ts +151 -0
- package/dist/completion/review-exit-foreign-findings.d.ts.map +1 -0
- package/dist/completion/review-exit-foreign-findings.js +474 -0
- package/dist/completion/review-exit-foreign-findings.js.map +1 -0
- package/dist/completion/review-exit-phase.d.ts.map +1 -1
- package/dist/completion/review-exit-phase.js +71 -64
- package/dist/completion/review-exit-phase.js.map +1 -1
- package/dist/completion/review-exit-progress.d.ts +20 -0
- package/dist/completion/review-exit-progress.d.ts.map +1 -1
- package/dist/completion/review-exit-progress.js +28 -19
- package/dist/completion/review-exit-progress.js.map +1 -1
- package/dist/completion/review-exit-rehoming.d.ts +5 -0
- package/dist/completion/review-exit-rehoming.d.ts.map +1 -1
- package/dist/completion/review-exit-rehoming.js.map +1 -1
- package/dist/completion/review-exit-verdict-gate.d.ts +202 -0
- package/dist/completion/review-exit-verdict-gate.d.ts.map +1 -0
- package/dist/completion/review-exit-verdict-gate.js +228 -0
- package/dist/completion/review-exit-verdict-gate.js.map +1 -0
- package/dist/completion/review-next-step.d.ts +62 -0
- package/dist/completion/review-next-step.d.ts.map +1 -0
- package/dist/completion/review-next-step.js +63 -0
- package/dist/completion/review-next-step.js.map +1 -0
- package/dist/completion/session-hold-sweep-deps.d.ts +17 -0
- package/dist/completion/session-hold-sweep-deps.d.ts.map +1 -0
- package/dist/completion/session-hold-sweep-deps.js +89 -0
- package/dist/completion/session-hold-sweep-deps.js.map +1 -0
- package/dist/completion/session-hold.d.ts +180 -0
- package/dist/completion/session-hold.d.ts.map +1 -0
- package/dist/completion/session-hold.js +238 -0
- package/dist/completion/session-hold.js.map +1 -0
- package/dist/completion/state-cascade.d.ts +19 -0
- package/dist/completion/state-cascade.d.ts.map +1 -1
- package/dist/completion/state-cascade.js +85 -31
- package/dist/completion/state-cascade.js.map +1 -1
- package/dist/completion/team-lifecycle.d.ts +35 -2
- package/dist/completion/team-lifecycle.d.ts.map +1 -1
- package/dist/completion/team-lifecycle.js +165 -94
- package/dist/completion/team-lifecycle.js.map +1 -1
- package/dist/completion/team-phase.d.ts +27 -15
- package/dist/completion/team-phase.d.ts.map +1 -1
- package/dist/completion/team-phase.js +34 -15
- package/dist/completion/team-phase.js.map +1 -1
- package/dist/delivery/commit-verdict-hold.d.ts +55 -0
- package/dist/delivery/commit-verdict-hold.d.ts.map +1 -0
- package/dist/delivery/commit-verdict-hold.js +118 -0
- package/dist/delivery/commit-verdict-hold.js.map +1 -0
- package/dist/directive/directive-dispatch.d.ts.map +1 -1
- package/dist/directive/directive-dispatch.js +10 -3
- package/dist/directive/directive-dispatch.js.map +1 -1
- package/dist/directive/directive-executor.d.ts.map +1 -1
- package/dist/directive/directive-executor.js +1 -0
- package/dist/directive/directive-executor.js.map +1 -1
- package/dist/directive/directive-queue.d.ts.map +1 -1
- package/dist/directive/directive-queue.js +6 -1
- package/dist/directive/directive-queue.js.map +1 -1
- package/dist/directive/phase-sync.d.ts +29 -2
- package/dist/directive/phase-sync.d.ts.map +1 -1
- package/dist/directive/phase-sync.js +30 -6
- package/dist/directive/phase-sync.js.map +1 -1
- package/dist/drift/artifact-ref-shape.d.ts +34 -0
- package/dist/drift/artifact-ref-shape.d.ts.map +1 -0
- package/dist/drift/artifact-ref-shape.js +94 -0
- package/dist/drift/artifact-ref-shape.js.map +1 -0
- package/dist/drift/drift-eval-loop.d.ts +7 -0
- package/dist/drift/drift-eval-loop.d.ts.map +1 -1
- package/dist/drift/drift-eval-loop.js +34 -5
- package/dist/drift/drift-eval-loop.js.map +1 -1
- package/dist/drift/drift-evaluator.d.ts.map +1 -1
- package/dist/drift/drift-evaluator.js +8 -3
- package/dist/drift/drift-evaluator.js.map +1 -1
- package/dist/focus/awaiting-slot.d.ts +34 -0
- package/dist/focus/awaiting-slot.d.ts.map +1 -0
- package/dist/focus/awaiting-slot.js +26 -0
- package/dist/focus/awaiting-slot.js.map +1 -0
- package/dist/focus/focus-lifecycle.js +2 -2
- package/dist/focus/focus-lifecycle.js.map +1 -1
- package/dist/focus/focus-phase.d.ts.map +1 -1
- package/dist/focus/focus-phase.js +3 -1
- package/dist/focus/focus-phase.js.map +1 -1
- package/dist/focus/focus-spawn-decision.d.ts +62 -0
- package/dist/focus/focus-spawn-decision.d.ts.map +1 -0
- package/dist/focus/focus-spawn-decision.js +41 -0
- package/dist/focus/focus-spawn-decision.js.map +1 -0
- package/dist/focus/focus-team-state.d.ts.map +1 -1
- package/dist/focus/focus-team-state.js +1 -13
- package/dist/focus/focus-team-state.js.map +1 -1
- package/dist/focus/listener-spawn.d.ts +16 -55
- package/dist/focus/listener-spawn.d.ts.map +1 -1
- package/dist/focus/listener-spawn.js +102 -64
- package/dist/focus/listener-spawn.js.map +1 -1
- package/dist/focus/listener-state.d.ts.map +1 -1
- package/dist/focus/listener-state.js +4 -1
- package/dist/focus/listener-state.js.map +1 -1
- package/dist/focus/listener.d.ts +41 -2
- package/dist/focus/listener.d.ts.map +1 -1
- package/dist/focus/listener.js +135 -83
- package/dist/focus/listener.js.map +1 -1
- package/dist/focus/pending-spawn-pass-deps.d.ts +69 -0
- package/dist/focus/pending-spawn-pass-deps.d.ts.map +1 -0
- package/dist/focus/pending-spawn-pass-deps.js +34 -0
- package/dist/focus/pending-spawn-pass-deps.js.map +1 -0
- package/dist/focus/pending-spawn-review-next-step.d.ts +83 -0
- package/dist/focus/pending-spawn-review-next-step.d.ts.map +1 -0
- package/dist/focus/pending-spawn-review-next-step.js +325 -0
- package/dist/focus/pending-spawn-review-next-step.js.map +1 -0
- package/dist/focus/review-cycle-cap-hold.d.ts +132 -0
- package/dist/focus/review-cycle-cap-hold.d.ts.map +1 -0
- package/dist/focus/review-cycle-cap-hold.js +178 -0
- package/dist/focus/review-cycle-cap-hold.js.map +1 -0
- package/dist/focus/team-actionable-work.js +2 -2
- package/dist/focus/verify-open-issues.d.ts +22 -0
- package/dist/focus/verify-open-issues.d.ts.map +1 -1
- package/dist/focus/verify-open-issues.js +118 -57
- package/dist/focus/verify-open-issues.js.map +1 -1
- package/dist/focus/verify-routing-passes.d.ts +32 -0
- package/dist/focus/verify-routing-passes.d.ts.map +1 -0
- package/dist/focus/verify-routing-passes.js +18 -0
- package/dist/focus/verify-routing-passes.js.map +1 -0
- package/dist/git/index.d.ts.map +1 -1
- package/dist/git/index.js +9 -5
- package/dist/git/index.js.map +1 -1
- package/dist/merge/focus-merge.d.ts +16 -2
- package/dist/merge/focus-merge.d.ts.map +1 -1
- package/dist/merge/focus-merge.js +53 -30
- package/dist/merge/focus-merge.js.map +1 -1
- package/dist/merge/merge-back-loop.d.ts +5 -0
- package/dist/merge/merge-back-loop.d.ts.map +1 -1
- package/dist/merge/merge-back-loop.js +17 -8
- package/dist/merge/merge-back-loop.js.map +1 -1
- package/dist/merge/merge-gate-coverage.d.ts +94 -0
- package/dist/merge/merge-gate-coverage.d.ts.map +1 -0
- package/dist/merge/merge-gate-coverage.js +217 -0
- package/dist/merge/merge-gate-coverage.js.map +1 -0
- package/dist/prompt/focus-prompt-builder.d.ts.map +1 -1
- package/dist/prompt/focus-prompt-builder.js +6 -0
- package/dist/prompt/focus-prompt-builder.js.map +1 -1
- package/dist/prompt/prompt-listing.d.ts.map +1 -1
- package/dist/prompt/prompt-listing.js +8 -0
- package/dist/prompt/prompt-listing.js.map +1 -1
- package/dist/prompt/team-prompt-base.d.ts.map +1 -1
- package/dist/prompt/team-prompt-base.js +5 -1
- package/dist/prompt/team-prompt-base.js.map +1 -1
- package/dist/prompt-sections/execution-sections.d.ts.map +1 -1
- package/dist/prompt-sections/execution-sections.js +14 -39
- package/dist/prompt-sections/execution-sections.js.map +1 -1
- package/dist/prompt-sections/gate-ownership.d.ts +36 -0
- package/dist/prompt-sections/gate-ownership.d.ts.map +1 -0
- package/dist/prompt-sections/gate-ownership.js +68 -0
- package/dist/prompt-sections/gate-ownership.js.map +1 -0
- package/dist/prompt-sections/gate-verdict-section.d.ts +58 -0
- package/dist/prompt-sections/gate-verdict-section.d.ts.map +1 -0
- package/dist/prompt-sections/gate-verdict-section.js +88 -0
- package/dist/prompt-sections/gate-verdict-section.js.map +1 -0
- package/dist/prompt-sections/persona-sections.d.ts +10 -0
- package/dist/prompt-sections/persona-sections.d.ts.map +1 -1
- package/dist/prompt-sections/persona-sections.js +35 -11
- package/dist/prompt-sections/persona-sections.js.map +1 -1
- package/dist/prompt-sections/shared.js +1 -1
- package/dist/prompt-sections/shared.js.map +1 -1
- package/dist/queries/agent-resolvable-promotion.d.ts +6 -3
- package/dist/queries/agent-resolvable-promotion.d.ts.map +1 -1
- package/dist/queries/agent-resolvable-promotion.js +20 -9
- package/dist/queries/agent-resolvable-promotion.js.map +1 -1
- package/dist/queries/deliveries.d.ts +46 -4
- package/dist/queries/deliveries.d.ts.map +1 -1
- package/dist/queries/deliveries.js +69 -16
- package/dist/queries/deliveries.js.map +1 -1
- package/dist/queries/delivery-gate-state.d.ts +151 -1
- package/dist/queries/delivery-gate-state.d.ts.map +1 -1
- package/dist/queries/delivery-gate-state.js +95 -14
- package/dist/queries/delivery-gate-state.js.map +1 -1
- package/dist/queries/delivery-write-discipline.d.ts +65 -0
- package/dist/queries/delivery-write-discipline.d.ts.map +1 -0
- package/dist/queries/delivery-write-discipline.js +101 -0
- package/dist/queries/delivery-write-discipline.js.map +1 -0
- package/dist/queries/escalation-consumption.d.ts +11 -0
- package/dist/queries/escalation-consumption.d.ts.map +1 -1
- package/dist/queries/escalation-consumption.js +22 -0
- package/dist/queries/escalation-consumption.js.map +1 -1
- package/dist/queries/escalation-spool.d.ts +75 -0
- package/dist/queries/escalation-spool.d.ts.map +1 -0
- package/dist/queries/escalation-spool.js +232 -0
- package/dist/queries/escalation-spool.js.map +1 -0
- package/dist/queries/escalation-suppression.d.ts.map +1 -1
- package/dist/queries/escalation-suppression.js +2 -0
- package/dist/queries/escalation-suppression.js.map +1 -1
- package/dist/queries/escalations.js +1 -1
- package/dist/queries/filing-observation.d.ts.map +1 -1
- package/dist/queries/filing-observation.js +2 -0
- package/dist/queries/filing-observation.js.map +1 -1
- package/dist/queries/focus-discovery.d.ts +4 -4
- package/dist/queries/focus-discovery.d.ts.map +1 -1
- package/dist/queries/focus-discovery.js +1 -0
- package/dist/queries/focus-discovery.js.map +1 -1
- package/dist/queries/focus-review-approval.d.ts +84 -0
- package/dist/queries/focus-review-approval.d.ts.map +1 -0
- package/dist/queries/focus-review-approval.js +158 -0
- package/dist/queries/focus-review-approval.js.map +1 -0
- package/dist/queries/focuses.d.ts +6 -5
- package/dist/queries/focuses.d.ts.map +1 -1
- package/dist/queries/focuses.js +9 -5
- package/dist/queries/focuses.js.map +1 -1
- package/dist/queries/incident-correlation.d.ts +5 -4
- package/dist/queries/incident-correlation.d.ts.map +1 -1
- package/dist/queries/incident-correlation.js +11 -5
- package/dist/queries/incident-correlation.js.map +1 -1
- package/dist/queries/issues.d.ts.map +1 -1
- package/dist/queries/issues.js +2 -1
- package/dist/queries/issues.js.map +1 -1
- package/dist/queries/loop-refusal-observation.d.ts +64 -0
- package/dist/queries/loop-refusal-observation.d.ts.map +1 -0
- package/dist/queries/loop-refusal-observation.js +137 -0
- package/dist/queries/loop-refusal-observation.js.map +1 -0
- package/dist/queries/schemas.d.ts +9 -0
- package/dist/queries/schemas.d.ts.map +1 -1
- package/dist/queries/schemas.js +11 -3
- package/dist/queries/schemas.js.map +1 -1
- package/dist/queries/shared.js +1 -1
- package/dist/queries/verification.d.ts.map +1 -1
- package/dist/queries/verification.js +1 -15
- package/dist/queries/verification.js.map +1 -1
- package/dist/queries/wire-contract.generated.d.ts +3 -0
- package/dist/queries/wire-contract.generated.d.ts.map +1 -1
- package/dist/queries/wire-contract.generated.js +3 -0
- package/dist/queries/wire-contract.generated.js.map +1 -1
- package/dist/resolvers/assembly-engine.d.ts.map +1 -1
- package/dist/resolvers/assembly-engine.js +3 -1
- package/dist/resolvers/assembly-engine.js.map +1 -1
- package/dist/resolvers/git-diff-against-base.d.ts +5 -2
- package/dist/resolvers/git-diff-against-base.d.ts.map +1 -1
- package/dist/resolvers/git-diff-against-base.js +121 -39
- package/dist/resolvers/git-diff-against-base.js.map +1 -1
- package/dist/resolvers/shared/git-diff.d.ts +2 -0
- package/dist/resolvers/shared/git-diff.d.ts.map +1 -1
- package/dist/resolvers/shared/git-diff.js +5 -1
- package/dist/resolvers/shared/git-diff.js.map +1 -1
- package/dist/resolvers/shared/review-window-commits.d.ts +96 -0
- package/dist/resolvers/shared/review-window-commits.d.ts.map +1 -0
- package/dist/resolvers/shared/review-window-commits.js +262 -0
- package/dist/resolvers/shared/review-window-commits.js.map +1 -0
- package/dist/session/session-lineage.d.ts.map +1 -1
- package/dist/session/session-lineage.js +4 -1
- package/dist/session/session-lineage.js.map +1 -1
- package/dist/shell/fail-stop.d.ts +18 -0
- package/dist/shell/fail-stop.d.ts.map +1 -0
- package/dist/shell/fail-stop.js +53 -0
- package/dist/shell/fail-stop.js.map +1 -0
- package/dist/shell/graceful-shutdown.d.ts +48 -0
- package/dist/shell/graceful-shutdown.d.ts.map +1 -0
- package/dist/shell/graceful-shutdown.js +152 -0
- package/dist/shell/graceful-shutdown.js.map +1 -0
- package/dist/shell/heartbeat.d.ts.map +1 -1
- package/dist/shell/heartbeat.js +5 -4
- package/dist/shell/heartbeat.js.map +1 -1
- package/dist/shell/log.d.ts.map +1 -1
- package/dist/shell/log.js +4 -1
- package/dist/shell/log.js.map +1 -1
- package/dist/shell/stop-request.d.ts.map +1 -1
- package/dist/shell/stop-request.js +2 -1
- package/dist/shell/stop-request.js.map +1 -1
- package/dist/shell/unified-shell.d.ts.map +1 -1
- package/dist/shell/unified-shell.js +41 -114
- package/dist/shell/unified-shell.js.map +1 -1
- package/dist/spawn/lifecycle.d.ts +12 -0
- package/dist/spawn/lifecycle.d.ts.map +1 -1
- package/dist/spawn/lifecycle.js +25 -21
- package/dist/spawn/lifecycle.js.map +1 -1
- package/dist/spawn/prompt-assembly.d.ts +19 -1
- package/dist/spawn/prompt-assembly.d.ts.map +1 -1
- package/dist/spawn/prompt-assembly.js +70 -21
- package/dist/spawn/prompt-assembly.js.map +1 -1
- package/dist/spawn/review-hold-park.d.ts.map +1 -1
- package/dist/spawn/review-hold-park.js +18 -8
- package/dist/spawn/review-hold-park.js.map +1 -1
- package/dist/spawn/spawn-cooldown.d.ts.map +1 -1
- package/dist/spawn/spawn-cooldown.js +4 -0
- 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 +2 -1
- package/dist/spawn/spawn-decision.js.map +1 -1
- package/dist/spawn/worktree-session.d.ts +6 -0
- package/dist/spawn/worktree-session.d.ts.map +1 -1
- package/dist/spawn/worktree-session.js +15 -2
- package/dist/spawn/worktree-session.js.map +1 -1
- package/dist/testing/fixtures/index.d.ts +10 -1
- package/dist/testing/fixtures/index.d.ts.map +1 -1
- package/dist/testing/fixtures/index.js +59 -1
- package/dist/testing/fixtures/index.js.map +1 -1
- package/dist/testing/fixtures/pending-spawn-world.d.ts +34 -0
- package/dist/testing/fixtures/pending-spawn-world.d.ts.map +1 -0
- package/dist/testing/fixtures/pending-spawn-world.js +92 -0
- package/dist/testing/fixtures/pending-spawn-world.js.map +1 -0
- package/dist/types/index.js +1 -1
- package/dist/verify/commit-gate-configured.d.ts +86 -0
- package/dist/verify/commit-gate-configured.d.ts.map +1 -0
- package/dist/verify/commit-gate-configured.js +234 -0
- package/dist/verify/commit-gate-configured.js.map +1 -0
- package/dist/verify/commit-verdict-record.d.ts +98 -0
- package/dist/verify/commit-verdict-record.d.ts.map +1 -0
- package/dist/verify/commit-verdict-record.js +297 -0
- package/dist/verify/commit-verdict-record.js.map +1 -0
- package/dist/verify/explicit-gate-outcome.d.ts +161 -0
- package/dist/verify/explicit-gate-outcome.d.ts.map +1 -0
- package/dist/verify/explicit-gate-outcome.js +215 -0
- package/dist/verify/explicit-gate-outcome.js.map +1 -0
- package/dist/verify/explicit-rearm.d.ts +27 -0
- package/dist/verify/explicit-rearm.d.ts.map +1 -0
- package/dist/verify/explicit-rearm.js +161 -0
- package/dist/verify/explicit-rearm.js.map +1 -0
- package/dist/verify/explicit-run-ledger.d.ts +26 -0
- package/dist/verify/explicit-run-ledger.d.ts.map +1 -0
- package/dist/verify/explicit-run-ledger.js +93 -0
- package/dist/verify/explicit-run-ledger.js.map +1 -0
- package/dist/verify/failure-signature.d.ts.map +1 -1
- package/dist/verify/failure-signature.js +5 -1
- package/dist/verify/failure-signature.js.map +1 -1
- package/dist/verify/gate-run-registry.d.ts +105 -0
- package/dist/verify/gate-run-registry.d.ts.map +1 -0
- package/dist/verify/gate-run-registry.js +111 -0
- package/dist/verify/gate-run-registry.js.map +1 -0
- package/dist/verify/gate-verdict-source.d.ts +68 -0
- package/dist/verify/gate-verdict-source.d.ts.map +1 -0
- package/dist/verify/gate-verdict-source.js +143 -0
- package/dist/verify/gate-verdict-source.js.map +1 -0
- package/dist/verify/judged-commit-gate.d.ts +11 -0
- package/dist/verify/judged-commit-gate.d.ts.map +1 -0
- package/dist/verify/judged-commit-gate.js +48 -0
- package/dist/verify/judged-commit-gate.js.map +1 -0
- package/dist/verify/rework-judgment.d.ts +58 -0
- package/dist/verify/rework-judgment.d.ts.map +1 -0
- package/dist/verify/rework-judgment.js +54 -0
- package/dist/verify/rework-judgment.js.map +1 -0
- package/dist/verify/verification-attribution.d.ts +105 -0
- package/dist/verify/verification-attribution.d.ts.map +1 -0
- package/dist/verify/verification-attribution.js +322 -0
- package/dist/verify/verification-attribution.js.map +1 -0
- package/dist/verify/verification-baseline-run.d.ts +123 -0
- package/dist/verify/verification-baseline-run.d.ts.map +1 -0
- package/dist/verify/verification-baseline-run.js +386 -0
- package/dist/verify/verification-baseline-run.js.map +1 -0
- package/dist/verify/verification-baseline.d.ts +75 -33
- package/dist/verify/verification-baseline.d.ts.map +1 -1
- package/dist/verify/verification-baseline.js +92 -105
- package/dist/verify/verification-baseline.js.map +1 -1
- package/dist/verify/verification-checkout.d.ts +13 -0
- package/dist/verify/verification-checkout.d.ts.map +1 -1
- package/dist/verify/verification-checkout.js +39 -2
- package/dist/verify/verification-checkout.js.map +1 -1
- package/dist/verify/verification-commit-sharing.d.ts +84 -0
- package/dist/verify/verification-commit-sharing.d.ts.map +1 -0
- package/dist/verify/verification-commit-sharing.js +416 -0
- package/dist/verify/verification-commit-sharing.js.map +1 -0
- package/dist/verify/verification-config.d.ts.map +1 -1
- package/dist/verify/verification-config.js +12 -2
- package/dist/verify/verification-config.js.map +1 -1
- package/dist/verify/verification-default-on.d.ts +27 -11
- package/dist/verify/verification-default-on.d.ts.map +1 -1
- package/dist/verify/verification-default-on.js +155 -29
- package/dist/verify/verification-default-on.js.map +1 -1
- package/dist/verify/verification-deps-default.d.ts.map +1 -1
- package/dist/verify/verification-deps-default.js +49 -42
- package/dist/verify/verification-deps-default.js.map +1 -1
- package/dist/verify/verification-deps.d.ts +69 -4
- package/dist/verify/verification-deps.d.ts.map +1 -1
- package/dist/verify/verification-deterministic.d.ts +15 -2
- package/dist/verify/verification-deterministic.d.ts.map +1 -1
- package/dist/verify/verification-deterministic.js +12 -3
- package/dist/verify/verification-deterministic.js.map +1 -1
- package/dist/verify/verification-diagnostics.d.ts +16 -0
- package/dist/verify/verification-diagnostics.d.ts.map +1 -0
- package/dist/verify/verification-diagnostics.js +219 -0
- package/dist/verify/verification-diagnostics.js.map +1 -0
- package/dist/verify/verification-engine.d.ts +12 -8
- package/dist/verify/verification-engine.d.ts.map +1 -1
- package/dist/verify/verification-engine.js +110 -92
- package/dist/verify/verification-engine.js.map +1 -1
- package/dist/verify/verification-evidence-unavailable-feedback.d.ts +2 -1
- package/dist/verify/verification-evidence-unavailable-feedback.d.ts.map +1 -1
- package/dist/verify/verification-evidence-unavailable-feedback.js +13 -4
- package/dist/verify/verification-evidence-unavailable-feedback.js.map +1 -1
- package/dist/verify/verification-feedback.d.ts +21 -34
- package/dist/verify/verification-feedback.d.ts.map +1 -1
- package/dist/verify/verification-feedback.js +37 -88
- package/dist/verify/verification-feedback.js.map +1 -1
- package/dist/verify/verification-gate-stages.d.ts +110 -0
- package/dist/verify/verification-gate-stages.d.ts.map +1 -0
- package/dist/verify/verification-gate-stages.js +179 -0
- package/dist/verify/verification-gate-stages.js.map +1 -0
- package/dist/verify/verification-history-reset.d.ts +61 -0
- package/dist/verify/verification-history-reset.d.ts.map +1 -0
- package/dist/verify/verification-history-reset.js +90 -0
- package/dist/verify/verification-history-reset.js.map +1 -0
- package/dist/verify/verification-manifest.d.ts.map +1 -1
- package/dist/verify/verification-manifest.js +2 -1
- package/dist/verify/verification-manifest.js.map +1 -1
- package/dist/verify/verification-rework-messages.d.ts +19 -0
- package/dist/verify/verification-rework-messages.d.ts.map +1 -0
- package/dist/verify/verification-rework-messages.js +52 -0
- package/dist/verify/verification-rework-messages.js.map +1 -0
- package/dist/worktree/install-inputs.d.ts +89 -0
- package/dist/worktree/install-inputs.d.ts.map +1 -0
- package/dist/worktree/install-inputs.js +625 -0
- package/dist/worktree/install-inputs.js.map +1 -0
- package/dist/worktree/install-script-effects.d.ts +30 -0
- package/dist/worktree/install-script-effects.d.ts.map +1 -0
- package/dist/worktree/install-script-effects.js +524 -0
- package/dist/worktree/install-script-effects.js.map +1 -0
- package/dist/worktree/install-script-tokens.d.ts +57 -0
- package/dist/worktree/install-script-tokens.d.ts.map +1 -0
- package/dist/worktree/install-script-tokens.js +299 -0
- package/dist/worktree/install-script-tokens.js.map +1 -0
- package/dist/worktree/provision.d.ts +27 -4
- package/dist/worktree/provision.d.ts.map +1 -1
- package/dist/worktree/provision.js +46 -7
- package/dist/worktree/provision.js.map +1 -1
- package/dist/worktree/safety.d.ts +11 -0
- package/dist/worktree/safety.d.ts.map +1 -1
- package/dist/worktree/safety.js +20 -3
- package/dist/worktree/safety.js.map +1 -1
- package/dist/worktree/verify-interlock.d.ts.map +1 -1
- package/dist/worktree/verify-interlock.js +3 -1
- package/dist/worktree/verify-interlock.js.map +1 -1
- package/dist/worktree/worktree-package-provisioning.d.ts +75 -0
- package/dist/worktree/worktree-package-provisioning.d.ts.map +1 -0
- package/dist/worktree/worktree-package-provisioning.js +362 -0
- package/dist/worktree/worktree-package-provisioning.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,325 @@
|
|
|
1
|
+
// PINNED-BY-BEGIN (generated by gen:pinned-by -- do not hand-edit; checked by lint:pinned-by)
|
|
2
|
+
// Pinned by: packages/daemon/src/completion/review-next-step.test.ts,
|
|
3
|
+
// packages/daemon/src/focus/pending-spawn-review-next-step.test.ts
|
|
4
|
+
// PINNED-BY-END
|
|
5
|
+
/**
|
|
6
|
+
* Pending-spawn gate: a queued NON-review spawn directive is dropped when the
|
|
7
|
+
* focus's next actionable step is a review pass.
|
|
8
|
+
*
|
|
9
|
+
* processPendingSpawnFocuses (focus/listener-spawn.ts) spawns a team from any
|
|
10
|
+
* queued directive. A coding directive stashed by the directive executor's
|
|
11
|
+
* no-active-team fallback can outlive the coding it was for: by the time it is
|
|
12
|
+
* consumed, every delivery is in verify with no open work. The coding lead it
|
|
13
|
+
* spawns has nothing to do, holds the focus's single team slot, and the review
|
|
14
|
+
* the cascade requests a second later cannot spawn (2026-09-15, 03:08:29 spawn /
|
|
15
|
+
* 03:08:30 review_requested_at). The decision is the ONE complete review-next-step
|
|
16
|
+
* decision the cascade also consumes (completion/review-next-step.ts
|
|
17
|
+
* resolveReviewNextStep), derived here with review_requested_at null, so it holds
|
|
18
|
+
* even when the directive is consumed BEFORE the window is stamped.
|
|
19
|
+
*
|
|
20
|
+
* A REVIEW-lineage directive is never dropped here: it is the next step. When the
|
|
21
|
+
* deliveries or issues cannot be read, the directive is DEFERRED: it stays queued
|
|
22
|
+
* and nothing spawns this poll. Spawning the coding lead on an unreadable state
|
|
23
|
+
* would diverge from the cascade, which opens the review window on the delivery
|
|
24
|
+
* census when the issue read fails -- the same mutual wait this gate exists to
|
|
25
|
+
* prevent. Usually the deferral ends on its own: the state reads again, or the
|
|
26
|
+
* review directive the cascade's window triggers replaces the queued entry.
|
|
27
|
+
*
|
|
28
|
+
* The deferral is BOUNDED like every other hold on a queued directive
|
|
29
|
+
* (completion/session-hold.ts). Its clock belongs to the queued directive
|
|
30
|
+
* INSTANCE (the object the queue holds), so a directive removed by any queue
|
|
31
|
+
* path and queued afresh -- even with identical content -- starts a new clock; a
|
|
32
|
+
* readable poll also restarts it. Past UNREADABLE_DEFERRAL_MAX_MS the deferral's
|
|
33
|
+
* terminal outcome is an escalation, and it is made DURABLE before anything is
|
|
34
|
+
* discarded: the escalation is filed first, and only once it is recorded is the
|
|
35
|
+
* directive dropped and "fired: escalation" logged (the session-hold expiry
|
|
36
|
+
* shape). The filing carries a deterministic per-focus metadata.cause_key, so the
|
|
37
|
+
* filing chokepoint's incident correlation records it as its OWN symptom -- attached
|
|
38
|
+
* to an open incident row for the focus, or filed as a row -- and reports it as
|
|
39
|
+
* already carried only when an open row carries THIS condition, never because some
|
|
40
|
+
* unrelated keyless observation shares the focus. A failed filing keeps the
|
|
41
|
+
* directive queued and its expired clock, spawns nothing, logs that the escalation
|
|
42
|
+
* is not yet recorded, and retries on the next poll. The retrying is bounded too:
|
|
43
|
+
* once filings have kept failing for UNREADABLE_DEFERRAL_FILING_RETRY_MAX_MS, the
|
|
44
|
+
* owed escalation is SPOOLED durably on local disk (queries/escalation-spool.ts).
|
|
45
|
+
* Only once the spool entry is written is the directive dropped unspawned, with
|
|
46
|
+
* "fired: escalation (spooled durably, not yet filed: ...)" logged, naming the
|
|
47
|
+
* failed filings, the last error and the entry. Every listener poll drains the
|
|
48
|
+
* spool through the same chokepoint, so the escalation (cause key and all) is filed
|
|
49
|
+
* once the writer recovers, even after a restart. A dead escalation writer cannot
|
|
50
|
+
* hold a queued directive forever, and the hold never ends without a durable record
|
|
51
|
+
* of what it owes. When the spool cannot be written either (the disk refuses it, or
|
|
52
|
+
* there is no organization to file under), the directive stays queued, spawning
|
|
53
|
+
* nothing, and both are retried next poll -- for at most
|
|
54
|
+
* UNREADABLE_DEFERRAL_SPOOL_RETRY_MAX_MS from the first refused spool write. Past
|
|
55
|
+
* that bound nothing can durably record the escalation, so the hold fires teardown
|
|
56
|
+
* as a daemon fail-stop (shell/fail-stop.ts): the daemon shuts down gracefully and
|
|
57
|
+
* exits non-zero, and the stopped daemon (its absent heartbeat, its supervisor's
|
|
58
|
+
* failed exit) is the signal no writer could leave. No queued directive is held
|
|
59
|
+
* without a bound. No spawn cooldown is recorded on any of these paths: nothing
|
|
60
|
+
* spawned.
|
|
61
|
+
*/
|
|
62
|
+
import { ESCALATION_REASONS, ESCALATION_DISPOSITIONS } from '@telora/daemon-core';
|
|
63
|
+
import { getPendingSpawnDirective, clearPendingSpawnDirective } from '../directive/directive-queue.js';
|
|
64
|
+
import { getFocusDeliveries, getFocusIssues } from '../queries/focuses.js';
|
|
65
|
+
import { createEscalation as defaultCreateEscalation } from '../queries/escalations.js';
|
|
66
|
+
import { NO_HUMAN_ACT } from '../queries/filing-observation.js';
|
|
67
|
+
import { computeCauseKey } from '../queries/cause-key.js';
|
|
68
|
+
import { spoolEscalation } from '../queries/escalation-spool.js';
|
|
69
|
+
import { requestDaemonFailStop, FAIL_STOP_EXIT_CODE } from '../shell/fail-stop.js';
|
|
70
|
+
import { resolveReviewNextStep, } from '../completion/review-next-step.js';
|
|
71
|
+
import { deriveFocusPhase } from './focus-phase.js';
|
|
72
|
+
import { config as listenerConfig } from './listener-state.js';
|
|
73
|
+
import { createLogger } from '../shell/log.js';
|
|
74
|
+
const log = createLogger({ module: 'listener' });
|
|
75
|
+
/** Bound on deferring one queued coding directive while the review-next-step state stays unreadable. */
|
|
76
|
+
export const UNREADABLE_DEFERRAL_MAX_MS = 10 * 60_000;
|
|
77
|
+
/** Bound on retrying the expiry escalation for one directive after its first failed filing. */
|
|
78
|
+
export const UNREADABLE_DEFERRAL_FILING_RETRY_MAX_MS = 10 * 60_000;
|
|
79
|
+
/** Bound on retrying a refused spool write after the filing retry bound lapsed; past it the daemon fail-stops. */
|
|
80
|
+
export const UNREADABLE_DEFERRAL_SPOOL_RETRY_MAX_MS = 10 * 60_000;
|
|
81
|
+
/** The hold kind named in the expiry log line (the session-hold expiry shape). */
|
|
82
|
+
export const UNREADABLE_DEFERRAL_HOLD_KIND = 'unreadable_review_next_step_deferral';
|
|
83
|
+
/** metadata.cause stamped on the deferral-expiry escalation. */
|
|
84
|
+
export const UNREADABLE_DEFERRAL_EXPIRED_CAUSE = 'review_next_step_unreadable_deferral_expired';
|
|
85
|
+
/**
|
|
86
|
+
* The deferral-expiry escalation's deterministic cause key (metadata.cause_key):
|
|
87
|
+
* one condition per focus, so incident correlation records it as its own symptom.
|
|
88
|
+
*/
|
|
89
|
+
export function unreadableDeferralCauseKey(focusId) {
|
|
90
|
+
return computeCauseKey(UNREADABLE_DEFERRAL_HOLD_KIND, { focusId });
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Deferral clocks keyed by the queued directive OBJECT, not by focus or content
|
|
94
|
+
* hash: every enqueue creates a new object, so a directive removed by any queue
|
|
95
|
+
* path and queued again -- even with identical content -- never inherits a clock,
|
|
96
|
+
* and a clock for a directive no longer queued is simply unreachable.
|
|
97
|
+
*/
|
|
98
|
+
let deferralClocks = new WeakMap();
|
|
99
|
+
/** Test-only: forget every deferral clock. */
|
|
100
|
+
export function __resetUnreadableDeferralsForTesting() {
|
|
101
|
+
deferralClocks = new WeakMap();
|
|
102
|
+
}
|
|
103
|
+
function asError(err) {
|
|
104
|
+
return err instanceof Error ? err : new Error(String(err));
|
|
105
|
+
}
|
|
106
|
+
/** Read the shared review-next-step decision for the focus. */
|
|
107
|
+
async function readReviewNextStep(focus, deps) {
|
|
108
|
+
let deliveries;
|
|
109
|
+
try {
|
|
110
|
+
deliveries = await (deps.getFocusDeliveries ?? getFocusDeliveries)(focus.focus_id);
|
|
111
|
+
}
|
|
112
|
+
catch (err) {
|
|
113
|
+
return { next: 'unreadable', what: 'deliveries', error: asError(err) };
|
|
114
|
+
}
|
|
115
|
+
const decision = await resolveReviewNextStep({
|
|
116
|
+
// State, not stamp: review_requested_at is deliberately not an input.
|
|
117
|
+
phase: deriveFocusPhase({
|
|
118
|
+
deliveries: deliveries.map((d) => ({ executionStatus: d.executionStatus ?? null })),
|
|
119
|
+
reviewRequestedAt: null,
|
|
120
|
+
}),
|
|
121
|
+
deliveries,
|
|
122
|
+
pipelineConfig: focus.pipeline_config,
|
|
123
|
+
readIssues: () => (deps.getFocusIssues ?? getFocusIssues)(focus.focus_id),
|
|
124
|
+
});
|
|
125
|
+
if (decision.step === 'issues_unreadable')
|
|
126
|
+
return { next: 'unreadable', what: 'issues', error: decision.error };
|
|
127
|
+
return { next: decision.step === 'review' ? 'review' : 'coding' };
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* The ONE escalation an expired unreadable-state deferral owes. Restoring the
|
|
131
|
+
* focus-state read and re-queuing coding work are agent work (read the daemon log,
|
|
132
|
+
* check the product API) -- no human act -- so the filing chokepoint sends it to
|
|
133
|
+
* the machine lane as an observation. Its per-focus cause_key gives it its own
|
|
134
|
+
* incident symptom. THROWS when there is no organization to file under.
|
|
135
|
+
*/
|
|
136
|
+
export function buildUnreadableDeferralEscalation(expiry) {
|
|
137
|
+
const organizationId = listenerConfig?.organizationId;
|
|
138
|
+
if (!organizationId) {
|
|
139
|
+
throw new Error('the listener config carries no organization to file the deferral-expiry escalation under');
|
|
140
|
+
}
|
|
141
|
+
const elapsedSec = Math.round(expiry.elapsedMs / 1000);
|
|
142
|
+
return {
|
|
143
|
+
organizationId,
|
|
144
|
+
sessionId: '',
|
|
145
|
+
issueId: null,
|
|
146
|
+
reasonType: ESCALATION_REASONS.ERROR_ENCOUNTERED,
|
|
147
|
+
disposition: ESCALATION_DISPOSITIONS.NEEDS_OPERATOR,
|
|
148
|
+
humanAct: NO_HUMAN_ACT,
|
|
149
|
+
anchor: { focusId: expiry.focusId },
|
|
150
|
+
metadata: {
|
|
151
|
+
cause: UNREADABLE_DEFERRAL_EXPIRED_CAUSE,
|
|
152
|
+
cause_key: unreadableDeferralCauseKey(expiry.focusId),
|
|
153
|
+
unreadable: expiry.what,
|
|
154
|
+
elapsed_ms: expiry.elapsedMs,
|
|
155
|
+
max_ms: UNREADABLE_DEFERRAL_MAX_MS,
|
|
156
|
+
},
|
|
157
|
+
description: `A queued ${expiry.sessionType} spawn directive for focus "${expiry.focusName}" was deferred for ${elapsedSec}s ` +
|
|
158
|
+
`because its ${expiry.what} could not be read to decide whether a review pass is next ` +
|
|
159
|
+
`(${expiry.error.message}). The ${Math.round(UNREADABLE_DEFERRAL_MAX_MS / 1000)}s bound lapsed, so the directive ` +
|
|
160
|
+
`is dropped, rather than spawned onto an unknown state, once this escalation is durable (recorded, or spooled ` +
|
|
161
|
+
`locally while the escalation writer was unavailable).\n\n` +
|
|
162
|
+
`**Focus ID:** ${expiry.focusId}`,
|
|
163
|
+
whatWasTried: `Re-read the focus ${expiry.what} on every poll for ${elapsedSec}s; every read failed.`,
|
|
164
|
+
helpNeeded: `Restore the focus-state read (check the daemon log and the product API). Any coding work still owed ` +
|
|
165
|
+
`re-surfaces through the ready-focus path once its deliveries are readable.`,
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* File the ONE escalation an expired unreadable-state deferral owes. REJECTS
|
|
170
|
+
* whenever the escalation was not recorded (including when there is no
|
|
171
|
+
* organization to file under), so the gate keeps the directive and retries
|
|
172
|
+
* instead of discarding it.
|
|
173
|
+
*/
|
|
174
|
+
export async function fileUnreadableDeferralExpiry(expiry, deps = { createEscalation: defaultCreateEscalation }) {
|
|
175
|
+
await deps.createEscalation(buildUnreadableDeferralEscalation(expiry));
|
|
176
|
+
}
|
|
177
|
+
/** The filer the gate calls: an injected one, or the production writer over the (injectable) chokepoint. */
|
|
178
|
+
function resolveFiler(deps) {
|
|
179
|
+
if (deps.fileDeferralExpiry)
|
|
180
|
+
return deps.fileDeferralExpiry;
|
|
181
|
+
const createEscalation = deps.createEscalation ?? defaultCreateEscalation;
|
|
182
|
+
return (expiry) => fileUnreadableDeferralExpiry(expiry, { createEscalation });
|
|
183
|
+
}
|
|
184
|
+
/** Retire THIS directive instance and its clock: a directive queued in its place meanwhile is not ours. */
|
|
185
|
+
function dropDeferredDirective(focusId, pending) {
|
|
186
|
+
deferralClocks.delete(pending);
|
|
187
|
+
if (getPendingSpawnDirective(focusId) === pending)
|
|
188
|
+
clearPendingSpawnDirective(focusId);
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* The spool bound's terminal outcome: neither the escalation writer nor the local
|
|
192
|
+
* spool can record what the hold owes, so it fires teardown as a daemon fail-stop.
|
|
193
|
+
* Fired once per directive instance; nothing spawns.
|
|
194
|
+
*/
|
|
195
|
+
function failStopAtSpoolBound(pending, expiry, clock, failed, refusal, deps) {
|
|
196
|
+
clock.failStopped = true;
|
|
197
|
+
const reason = `the escalation owed by the ${UNREADABLE_DEFERRAL_HOLD_KIND} hold on focus "${expiry.focusName}" cannot be recorded: ` +
|
|
198
|
+
`the escalation writer failed ${failed.attempts} filing attempts over ${Math.round(failed.retryingMs / 1000)}s ` +
|
|
199
|
+
`(last: ${failed.last}) and the local escalation spool refused it ${refusal.count} times over ` +
|
|
200
|
+
`${Math.round(refusal.overMs / 1000)}s (last: ${refusal.last})`;
|
|
201
|
+
log.warn(`[session-hold] ${failed.expiredAfter} -- fired: teardown (daemon fail-stop, exit code ${FAIL_STOP_EXIT_CODE}: ` +
|
|
202
|
+
`${reason}; the queued ${pending.sessionType} directive never spawned; ${expiry.what} stayed unreadable: ` +
|
|
203
|
+
`${expiry.error.message})`);
|
|
204
|
+
(deps.failStop ?? requestDaemonFailStop)(reason);
|
|
205
|
+
return true;
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* The retry bound's terminal outcome: spool the owed escalation durably, and only
|
|
209
|
+
* once the entry is written drop THIS directive instance and log "fired:
|
|
210
|
+
* escalation (spooled durably, not yet filed: ...)". When the spool cannot be
|
|
211
|
+
* written either, the directive stays queued and both are retried next poll --
|
|
212
|
+
* until the spool has refused it for UNREADABLE_DEFERRAL_SPOOL_RETRY_MAX_MS, when
|
|
213
|
+
* the hold fires the daemon fail-stop (failStopAtSpoolBound).
|
|
214
|
+
*/
|
|
215
|
+
function spoolAtRetryBound(pending, expiry, clock, failed, deps) {
|
|
216
|
+
const reason = `${failed.attempts} filing attempts failed over ${Math.round(failed.retryingMs / 1000)}s, last: ${failed.last}`;
|
|
217
|
+
let path;
|
|
218
|
+
try {
|
|
219
|
+
path = spoolEscalation({ key: unreadableDeferralCauseKey(expiry.focusId), reason, params: buildUnreadableDeferralEscalation(expiry) }, deps.escalationSpoolDir !== undefined ? { dir: deps.escalationSpoolDir } : {});
|
|
220
|
+
}
|
|
221
|
+
catch (err) {
|
|
222
|
+
clock.spoolFailures += 1;
|
|
223
|
+
clock.firstSpoolFailureMs ??= failed.nowMs;
|
|
224
|
+
const refusal = { count: clock.spoolFailures, overMs: failed.nowMs - clock.firstSpoolFailureMs, last: asError(err).message };
|
|
225
|
+
if (refusal.overMs >= UNREADABLE_DEFERRAL_SPOOL_RETRY_MAX_MS) {
|
|
226
|
+
return failStopAtSpoolBound(pending, expiry, clock, failed, refusal, deps);
|
|
227
|
+
}
|
|
228
|
+
log.warn(`[session-hold] ${failed.expiredAfter} -- escalation NOT yet recorded (filing attempt ${failed.attempts} failed: ` +
|
|
229
|
+
`${failed.last}; spooling it locally failed too: ${asError(err).message}); the queued ${pending.sessionType} ` +
|
|
230
|
+
`directive stays queued and both are retried next poll`);
|
|
231
|
+
return true;
|
|
232
|
+
}
|
|
233
|
+
dropDeferredDirective(expiry.focusId, pending);
|
|
234
|
+
log.warn(`[session-hold] ${failed.expiredAfter} -- fired: escalation (spooled durably, not yet filed: ${reason}; held at ` +
|
|
235
|
+
`${path} and filed by a later poll once the escalation writer recovers; the queued ${pending.sessionType} ` +
|
|
236
|
+
`directive was dropped unspawned and is named in it; ${expiry.what} stayed unreadable: ${expiry.error.message})`);
|
|
237
|
+
return true;
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* The expired deferral's terminal outcome, made durable in order: file the
|
|
241
|
+
* escalation; only once it is recorded, drop THIS directive instance and log
|
|
242
|
+
* "fired: escalation". A failed filing keeps the directive and its expired clock
|
|
243
|
+
* and retries next poll -- until filings have kept failing for
|
|
244
|
+
* UNREADABLE_DEFERRAL_FILING_RETRY_MAX_MS, when the escalation is spooled durably
|
|
245
|
+
* before the directive is dropped (spoolAtRetryBound). Nothing spawns.
|
|
246
|
+
*/
|
|
247
|
+
async function fireDeferralEscalation(focus, pending, clock, read, nowMs, deps) {
|
|
248
|
+
if (clock.failStopped)
|
|
249
|
+
return true; // the daemon is already stopping on this hold's terminal outcome
|
|
250
|
+
const elapsedMs = nowMs - clock.sinceMs;
|
|
251
|
+
const expiredAfter = `${UNREADABLE_DEFERRAL_HOLD_KIND} hold on focus ${focus.focus_id.slice(0, 8)} expired after ` +
|
|
252
|
+
`${Math.round(elapsedMs / 1000)}s`;
|
|
253
|
+
const expiry = {
|
|
254
|
+
focusId: focus.focus_id,
|
|
255
|
+
focusName: focus.focus_name,
|
|
256
|
+
sessionType: pending.sessionType,
|
|
257
|
+
elapsedMs,
|
|
258
|
+
what: read.what,
|
|
259
|
+
error: read.error,
|
|
260
|
+
};
|
|
261
|
+
try {
|
|
262
|
+
await resolveFiler(deps)(expiry);
|
|
263
|
+
}
|
|
264
|
+
catch (err) {
|
|
265
|
+
clock.filingFailures += 1;
|
|
266
|
+
clock.firstFilingFailureMs ??= nowMs;
|
|
267
|
+
const retryingMs = nowMs - clock.firstFilingFailureMs;
|
|
268
|
+
const failure = asError(err).message;
|
|
269
|
+
if (retryingMs >= UNREADABLE_DEFERRAL_FILING_RETRY_MAX_MS) {
|
|
270
|
+
return spoolAtRetryBound(pending, expiry, clock, { expiredAfter, attempts: clock.filingFailures, retryingMs, last: failure, nowMs }, deps);
|
|
271
|
+
}
|
|
272
|
+
log.warn(`[session-hold] ${expiredAfter} -- escalation NOT yet recorded (filing attempt ${clock.filingFailures} failed: ` +
|
|
273
|
+
`${failure}); the queued ${pending.sessionType} directive stays queued and filing is retried next poll`);
|
|
274
|
+
return true;
|
|
275
|
+
}
|
|
276
|
+
dropDeferredDirective(focus.focus_id, pending);
|
|
277
|
+
log.warn(`[session-hold] ${expiredAfter} -- fired: escalation (recorded; the queued ${pending.sessionType} directive was ` +
|
|
278
|
+
`dropped; ${read.what} stayed unreadable: ${read.error.message})`);
|
|
279
|
+
return true;
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* Defer the queued directive on an unreadable state, or -- once this directive
|
|
283
|
+
* instance's deferral has lasted UNREADABLE_DEFERRAL_MAX_MS -- fire its durable
|
|
284
|
+
* terminal escalation. Either way nothing spawns this poll.
|
|
285
|
+
*/
|
|
286
|
+
async function deferOrExpire(focus, pending, read, deps) {
|
|
287
|
+
const nowMs = (deps.now ?? Date.now)();
|
|
288
|
+
let clock = deferralClocks.get(pending);
|
|
289
|
+
if (!clock) {
|
|
290
|
+
clock = { sinceMs: nowMs, filingFailures: 0, firstFilingFailureMs: null, spoolFailures: 0, firstSpoolFailureMs: null, failStopped: false };
|
|
291
|
+
deferralClocks.set(pending, clock);
|
|
292
|
+
}
|
|
293
|
+
const elapsedMs = nowMs - clock.sinceMs;
|
|
294
|
+
if (elapsedMs >= UNREADABLE_DEFERRAL_MAX_MS)
|
|
295
|
+
return fireDeferralEscalation(focus, pending, clock, read, nowMs, deps);
|
|
296
|
+
log.warn(`[listener] Deferring queued ${pending.sessionType} directive for "${focus.focus_name}" -- could not read ` +
|
|
297
|
+
`${read.what} to decide whether a review pass is next (${read.error.message}); it stays queued and is ` +
|
|
298
|
+
`re-read next poll (deferred ${Math.round(elapsedMs / 1000)}s of a ${Math.round(UNREADABLE_DEFERRAL_MAX_MS / 1000)}s bound)`);
|
|
299
|
+
return true;
|
|
300
|
+
}
|
|
301
|
+
/**
|
|
302
|
+
* Gate a queued non-review spawn directive on the focus's next actionable step.
|
|
303
|
+
* Returns true when the caller must NOT spawn this poll: the directive was dropped
|
|
304
|
+
* (a review pass is next, or its bounded unreadable-state deferral ended) or
|
|
305
|
+
* deferred (the state could not be read, or the expiry escalation is not yet
|
|
306
|
+
* durable -- neither recorded nor spooled; it stays queued). Returns false
|
|
307
|
+
* when there is no directive, it is a review directive, or the focus still has
|
|
308
|
+
* coding work.
|
|
309
|
+
*/
|
|
310
|
+
export async function pendingCodingSpawnSupersededByReview(focus, deps = {}) {
|
|
311
|
+
const pending = getPendingSpawnDirective(focus.focus_id);
|
|
312
|
+
if (!pending || pending.lineage === 'review')
|
|
313
|
+
return false;
|
|
314
|
+
const read = await readReviewNextStep(focus, deps);
|
|
315
|
+
if (read.next === 'unreadable')
|
|
316
|
+
return deferOrExpire(focus, pending, read, deps);
|
|
317
|
+
deferralClocks.delete(pending); // a readable poll ends this directive's deferral
|
|
318
|
+
if (read.next === 'coding')
|
|
319
|
+
return false;
|
|
320
|
+
clearPendingSpawnDirective(focus.focus_id);
|
|
321
|
+
log.info(`[listener] Dropping queued ${pending.sessionType} directive for "${focus.focus_name}" -- every delivery is in ` +
|
|
322
|
+
`verify with no open work and review is enabled; the next actionable step is a review pass, not a coding lead`);
|
|
323
|
+
return true;
|
|
324
|
+
}
|
|
325
|
+
//# sourceMappingURL=pending-spawn-review-next-step.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
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|
6
|
+
* Why a hold and not a meter: the cap used to file one review_cycle_cap_exceeded
|
|
7
|
+
* observation and let the loop continue, on the theory that the hand-off breaker
|
|
8
|
+
* (completion/review-exit-escalations.ts recordHandoffAndMaybeTerminate) was the
|
|
9
|
+
* stop valve. That breaker only advances on no-progress exits, and a review that
|
|
10
|
+
* files a new finding every cycle IS progress to it (review-cycle-delta.ts counts
|
|
11
|
+
* issuesFiled), so a loop that never converges was never bounded. 2026-09-15: the
|
|
12
|
+
* observation filed at cycle 8, cycles 9 and 10 plus their coding passes ran
|
|
13
|
+
* (~$183), and only an operator disarm stopped it.
|
|
14
|
+
*
|
|
15
|
+
* ONE decision, read identically by every gate that can spawn a pass for a focus
|
|
16
|
+
* or open the window that spawns one:
|
|
17
|
+
* - the ready-focus spawn gate (focus/focus-spawn-decision.ts decideFocusSpawn)
|
|
18
|
+
* - the pending-directive spawn pass (focus/listener-spawn.ts processPendingSpawnFocuses)
|
|
19
|
+
* - the auto-review window (completion/state-cascade.ts checkAutoReview)
|
|
20
|
+
* spawnFocusTeam has exactly those two callers, and a stage directive never spawns
|
|
21
|
+
* on its own (directive/directive-dispatch.ts stashes it for the pending pass), so
|
|
22
|
+
* these gates are the whole spawn surface.
|
|
23
|
+
*
|
|
24
|
+
* The hold is standing while ANY of three facts holds (isReviewCycleCapHeld):
|
|
25
|
+
* - an OPEN review_cycle_cap_exceeded observation for the focus. The crossing
|
|
26
|
+
* resets review_cycle_count to 0 once that observation is filed
|
|
27
|
+
* (completion/review-cycle-cap.ts), so a fresh cap of cycles is needed to
|
|
28
|
+
* re-cross. The hold is keyed on the machine-lane observation's KIND, never on
|
|
29
|
+
* a human act: the daemon has no human-facing route, and the promotion sweep
|
|
30
|
+
* hands a held focus's observations to the routing decider
|
|
31
|
+
* (queries/agent-resolvable-promotion.ts).
|
|
32
|
+
* - an OPEN lineage CARRIER naming one of the focus's review_cycle_cap_exceeded
|
|
33
|
+
* observations, open or resolved: a human-lane row whose
|
|
34
|
+
* metadata.originalEscalationId names it (queries/escalation-consumption.ts
|
|
35
|
+
* LineageCarrier -- what a routing decider files through telora_agent escalate
|
|
36
|
+
* with sourceEscalationId). The sweep closes the observation auto_swept the
|
|
37
|
+
* moment such a row exists, so without this fact the hold would lift -- and the
|
|
38
|
+
* focus bill another full cap of cycles -- while the human-facing filing still
|
|
39
|
+
* sits unacted. A carrier has its own close-half (its resolution), unlike a
|
|
40
|
+
* correlated or absorbed symptom, which is why carriers are matched by lineage
|
|
41
|
+
* here and hasOpenFocusEscalation's matchCorrelated is not used as the hold.
|
|
42
|
+
* Carriers carry no kind marker (no originalKind; original_cause_key only when
|
|
43
|
+
* the source had a cause_key, which this observation does not), so the match
|
|
44
|
+
* is by source id against the focus's own rows of the kind, any status.
|
|
45
|
+
* - review_cycle_count >= cap: the count is written before the filing, so a
|
|
46
|
+
* filing that fails still holds; the cascade re-files it every poll until it
|
|
47
|
+
* lands (reconcileReviewCycleCapFiling).
|
|
48
|
+
* Resolving the observation with no carrier, or resolving the carrier, lifts the
|
|
49
|
+
* hold (the count is already 0).
|
|
50
|
+
*
|
|
51
|
+
* Fails CLOSED: an unreadable count, observation or carrier read holds. This is a
|
|
52
|
+
* stop gate (workflow/gate-failure-policy.ts, safety class) and every read
|
|
53
|
+
* repeats each poll, so a transient failure delays one poll instead of billing a
|
|
54
|
+
* pass the cap exists to prevent.
|
|
55
|
+
*
|
|
56
|
+
* @module focus/review-cycle-cap-hold
|
|
57
|
+
*/
|
|
58
|
+
import { type AgentResolvableEscalationRow, type LineageCarrier } from '../queries/escalation-consumption.js';
|
|
59
|
+
/** The observation kind the cap files and the hold reads. */
|
|
60
|
+
export declare const REVIEW_CYCLE_CAP_EXCEEDED_KIND = "review_cycle_cap_exceeded";
|
|
61
|
+
/** The facts the cap-held decision reads. `null` = the read failed. */
|
|
62
|
+
export interface ReviewCycleCapFacts {
|
|
63
|
+
/** product_focuses.review_cycle_count: consecutive unconverged review cycles. */
|
|
64
|
+
reviewCycleCount: number | null;
|
|
65
|
+
cap: number;
|
|
66
|
+
/** Whether a review_cycle_cap_exceeded observation is open for the focus. */
|
|
67
|
+
capObservationOpen: boolean | null;
|
|
68
|
+
/**
|
|
69
|
+
* Whether an open lineage carrier names one of the focus's
|
|
70
|
+
* review_cycle_cap_exceeded observations (open or resolved). Read only when it
|
|
71
|
+
* can turn the decision (readReviewCycleCapFacts); false otherwise.
|
|
72
|
+
*/
|
|
73
|
+
capCarrierOpen: boolean | null;
|
|
74
|
+
}
|
|
75
|
+
/** Pure: whether the review-cycle cap holds the focus. An unreadable fact holds. */
|
|
76
|
+
export declare function isReviewCycleCapHeld(facts: ReviewCycleCapFacts): boolean;
|
|
77
|
+
/** Pure: whether an open carrier names one of the given cap observations (matched by source id). */
|
|
78
|
+
export declare function capCarrierNamesObservation(carriers: readonly LineageCarrier[], capObservationIds: ReadonlySet<string>): boolean;
|
|
79
|
+
/** Injectable reads (each defaults to the real implementation). */
|
|
80
|
+
export interface ReviewCycleCapHoldDeps {
|
|
81
|
+
/** Every review_cycle_cap_exceeded row on the focus, ANY status: the open half and the carrier sources. */
|
|
82
|
+
listCapObservations?: (focusId: string) => Promise<readonly AgentResolvableEscalationRow[]>;
|
|
83
|
+
/** The org's OPEN lineage carriers: the read the promotion sweep closes sources on. */
|
|
84
|
+
listOpenLineageCarriers?: () => Promise<readonly LineageCarrier[]>;
|
|
85
|
+
resolveReviewCycleCap?: () => number;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Read the hold's facts for a focus whose review_cycle_count the caller already
|
|
89
|
+
* read (null when it could not). The carrier read is made only when it can turn
|
|
90
|
+
* the decision: skipped (false) when the focus has no cap observation for a
|
|
91
|
+
* carrier to name, or when the other facts already hold.
|
|
92
|
+
*/
|
|
93
|
+
export declare function readReviewCycleCapFacts(focus: {
|
|
94
|
+
focusId: string;
|
|
95
|
+
focusName: string;
|
|
96
|
+
reviewCycleCount: number | null;
|
|
97
|
+
}, deps?: ReviewCycleCapHoldDeps): Promise<ReviewCycleCapFacts>;
|
|
98
|
+
/** Test seam: clear the per-episode log throttle. */
|
|
99
|
+
export declare function __resetReviewCycleCapHoldLog(): void;
|
|
100
|
+
/**
|
|
101
|
+
* Resolve the hold for a focus whose review_cycle_count the caller already read
|
|
102
|
+
* (null when it could not). Reads the facts, applies the one predicate, and logs
|
|
103
|
+
* the held edge once per episode.
|
|
104
|
+
*/
|
|
105
|
+
export declare function resolveReviewCycleCapHold(focus: {
|
|
106
|
+
focusId: string;
|
|
107
|
+
focusName: string;
|
|
108
|
+
reviewCycleCount: number | null;
|
|
109
|
+
}, deps?: ReviewCycleCapHoldDeps): Promise<boolean>;
|
|
110
|
+
/** The slice of an active-focus row the ready-focus reader needs. */
|
|
111
|
+
export interface ReviewCycleCountRow {
|
|
112
|
+
focus_id: string;
|
|
113
|
+
review_cycle_count: number;
|
|
114
|
+
}
|
|
115
|
+
/** Deps for createReadyFocusCapHoldReader. */
|
|
116
|
+
export interface ReadyFocusCapHoldDeps extends ReviewCycleCapHoldDeps {
|
|
117
|
+
getActiveFocuses?: (organizationId: string, productId?: string) => Promise<readonly ReviewCycleCountRow[]>;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* A hold reader for the ready-focus spawn gate. getReadyFocuses rows do not carry
|
|
121
|
+
* review_cycle_count, so the count comes from the active-focus read -- once per
|
|
122
|
+
* product for the reader's lifetime (create one per poll). A failed read, or a
|
|
123
|
+
* ready focus absent from the active read (both filter status='active', so only a
|
|
124
|
+
* same-poll race), leaves the count unreadable: held. The org-wide carrier read is
|
|
125
|
+
* likewise made at most once per reader, however many focuses need it.
|
|
126
|
+
*/
|
|
127
|
+
export declare function createReadyFocusCapHoldReader(organizationId: string, deps?: ReadyFocusCapHoldDeps): (focus: {
|
|
128
|
+
focus_id: string;
|
|
129
|
+
focus_name: string;
|
|
130
|
+
product_id: string | null;
|
|
131
|
+
}) => Promise<boolean>;
|
|
132
|
+
//# sourceMappingURL=review-cycle-cap-hold.d.ts.map
|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