clinkx 0.3.0 → 1.1.0
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/CHANGELOG.md +119 -0
- package/LICENSE +10 -0
- package/README.md +154 -26
- package/clinkx-workflows/dist/allowed-roots.d.ts +1 -0
- package/clinkx-workflows/dist/allowed-roots.js +5 -0
- package/clinkx-workflows/dist/allowed-roots.js.map +1 -0
- package/clinkx-workflows/dist/artifacts.d.ts +20 -1
- package/clinkx-workflows/dist/artifacts.js +38 -9
- package/clinkx-workflows/dist/artifacts.js.map +1 -1
- package/clinkx-workflows/dist/backend.d.ts +4 -0
- package/clinkx-workflows/dist/chairman-knobs.d.ts +24 -0
- package/clinkx-workflows/dist/chairman-knobs.js +27 -0
- package/clinkx-workflows/dist/chairman-knobs.js.map +1 -0
- package/clinkx-workflows/dist/citation-check.d.ts +40 -0
- package/clinkx-workflows/dist/citation-check.js +348 -0
- package/clinkx-workflows/dist/citation-check.js.map +1 -0
- package/clinkx-workflows/dist/clink-client.d.ts +12 -1
- package/clinkx-workflows/dist/clink-client.js +56 -5
- package/clinkx-workflows/dist/clink-client.js.map +1 -1
- package/clinkx-workflows/dist/config.d.ts +173 -16
- package/clinkx-workflows/dist/config.js +417 -26
- package/clinkx-workflows/dist/config.js.map +1 -1
- package/clinkx-workflows/dist/contained-file.d.ts +172 -0
- package/clinkx-workflows/dist/contained-file.js +483 -0
- package/clinkx-workflows/dist/contained-file.js.map +1 -0
- package/clinkx-workflows/dist/context-builder-lifecycle-contract.d.ts +416 -0
- package/clinkx-workflows/dist/context-builder-lifecycle-contract.js +328 -0
- package/clinkx-workflows/dist/context-builder-lifecycle-contract.js.map +1 -0
- package/clinkx-workflows/dist/context-builder-lifecycle-router.d.ts +24 -0
- package/clinkx-workflows/dist/context-builder-lifecycle-router.js +39 -0
- package/clinkx-workflows/dist/context-builder-lifecycle-router.js.map +1 -0
- package/clinkx-workflows/dist/context-cache-key.d.ts +53 -0
- package/clinkx-workflows/dist/context-cache-key.js +91 -0
- package/clinkx-workflows/dist/context-cache-key.js.map +1 -0
- package/clinkx-workflows/dist/context-mode-resolver.d.ts +27 -0
- package/clinkx-workflows/dist/context-mode-resolver.js +126 -0
- package/clinkx-workflows/dist/context-mode-resolver.js.map +1 -0
- package/clinkx-workflows/dist/context-preflight.d.ts +189 -0
- package/clinkx-workflows/dist/context-preflight.js +91 -0
- package/clinkx-workflows/dist/context-preflight.js.map +1 -0
- package/clinkx-workflows/dist/council-execution-policy.d.ts +68 -0
- package/clinkx-workflows/dist/council-execution-policy.js +110 -0
- package/clinkx-workflows/dist/council-execution-policy.js.map +1 -0
- package/clinkx-workflows/dist/council-expander.d.ts +10 -9
- package/clinkx-workflows/dist/council-expander.js +20 -10
- package/clinkx-workflows/dist/council-expander.js.map +1 -1
- package/clinkx-workflows/dist/dashboard/activity-contract.d.ts +5718 -0
- package/clinkx-workflows/dist/dashboard/activity-contract.js +157 -0
- package/clinkx-workflows/dist/dashboard/activity-contract.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/activity-lease.d.ts +25 -0
- package/clinkx-workflows/dist/dashboard/activity-lease.js +34 -0
- package/clinkx-workflows/dist/dashboard/activity-lease.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/activity-reader.d.ts +90 -0
- package/clinkx-workflows/dist/dashboard/activity-reader.js +493 -0
- package/clinkx-workflows/dist/dashboard/activity-reader.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/api-routes.d.ts +40 -0
- package/clinkx-workflows/dist/dashboard/api-routes.js +1155 -0
- package/clinkx-workflows/dist/dashboard/api-routes.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/artifact-index.d.ts +37 -0
- package/clinkx-workflows/dist/dashboard/artifact-index.js +145 -0
- package/clinkx-workflows/dist/dashboard/artifact-index.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/auth/challenge-store.d.ts +31 -0
- package/clinkx-workflows/dist/dashboard/auth/challenge-store.js +65 -0
- package/clinkx-workflows/dist/dashboard/auth/challenge-store.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/auth/controller.d.ts +26 -0
- package/clinkx-workflows/dist/dashboard/auth/controller.js +596 -0
- package/clinkx-workflows/dist/dashboard/auth/controller.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/auth/credential-store.d.ts +60 -0
- package/clinkx-workflows/dist/dashboard/auth/credential-store.js +776 -0
- package/clinkx-workflows/dist/dashboard/auth/credential-store.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/auth/enrollment-gate.d.ts +9 -0
- package/clinkx-workflows/dist/dashboard/auth/enrollment-gate.js +44 -0
- package/clinkx-workflows/dist/dashboard/auth/enrollment-gate.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/auth/session-store.d.ts +17 -0
- package/clinkx-workflows/dist/dashboard/auth/session-store.js +77 -0
- package/clinkx-workflows/dist/dashboard/auth/session-store.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/auth/webauthn-service.d.ts +25 -0
- package/clinkx-workflows/dist/dashboard/auth/webauthn-service.js +71 -0
- package/clinkx-workflows/dist/dashboard/auth/webauthn-service.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/context-builder-invocation-contract.d.ts +3865 -0
- package/clinkx-workflows/dist/dashboard/context-builder-invocation-contract.js +69 -0
- package/clinkx-workflows/dist/dashboard/context-builder-invocation-contract.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/context-run-liveness.d.ts +37 -0
- package/clinkx-workflows/dist/dashboard/context-run-liveness.js +49 -0
- package/clinkx-workflows/dist/dashboard/context-run-liveness.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/context-run-reader.d.ts +256 -0
- package/clinkx-workflows/dist/dashboard/context-run-reader.js +1301 -0
- package/clinkx-workflows/dist/dashboard/context-run-reader.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/contracts.d.ts +28483 -0
- package/clinkx-workflows/dist/dashboard/contracts.js +1284 -0
- package/clinkx-workflows/dist/dashboard/contracts.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/generation.d.ts +14 -0
- package/clinkx-workflows/dist/dashboard/generation.js +41 -0
- package/clinkx-workflows/dist/dashboard/generation.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/index.d.ts +32 -0
- package/clinkx-workflows/dist/dashboard/index.js +20 -0
- package/clinkx-workflows/dist/dashboard/index.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/invocation-contract.d.ts +786 -0
- package/clinkx-workflows/dist/dashboard/invocation-contract.js +201 -0
- package/clinkx-workflows/dist/dashboard/invocation-contract.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/lazy-content.d.ts +114 -0
- package/clinkx-workflows/dist/dashboard/lazy-content.js +799 -0
- package/clinkx-workflows/dist/dashboard/lazy-content.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/native-transcript/contract.d.ts +90 -0
- package/clinkx-workflows/dist/dashboard/native-transcript/contract.js +31 -0
- package/clinkx-workflows/dist/dashboard/native-transcript/contract.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/native-transcript/projection.d.ts +12 -0
- package/clinkx-workflows/dist/dashboard/native-transcript/projection.js +286 -0
- package/clinkx-workflows/dist/dashboard/native-transcript/projection.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/progress-report-contract.d.ts +446 -0
- package/clinkx-workflows/dist/dashboard/progress-report-contract.js +221 -0
- package/clinkx-workflows/dist/dashboard/progress-report-contract.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/progress-report-reader.d.ts +50 -0
- package/clinkx-workflows/dist/dashboard/progress-report-reader.js +529 -0
- package/clinkx-workflows/dist/dashboard/progress-report-reader.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/progress-report-status-overlay.d.ts +89 -0
- package/clinkx-workflows/dist/dashboard/progress-report-status-overlay.js +71 -0
- package/clinkx-workflows/dist/dashboard/progress-report-status-overlay.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/progress-report-status-store.d.ts +29 -0
- package/clinkx-workflows/dist/dashboard/progress-report-status-store.js +111 -0
- package/clinkx-workflows/dist/dashboard/progress-report-status-store.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/prompt-builder-library-contract.d.ts +194 -0
- package/clinkx-workflows/dist/dashboard/prompt-builder-library-contract.js +89 -0
- package/clinkx-workflows/dist/dashboard/prompt-builder-library-contract.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/prompt-builder-library-store.d.ts +26 -0
- package/clinkx-workflows/dist/dashboard/prompt-builder-library-store.js +102 -0
- package/clinkx-workflows/dist/dashboard/prompt-builder-library-store.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/read-model.d.ts +86 -0
- package/clinkx-workflows/dist/dashboard/read-model.js +440 -0
- package/clinkx-workflows/dist/dashboard/read-model.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/request-admission.d.ts +31 -0
- package/clinkx-workflows/dist/dashboard/request-admission.js +130 -0
- package/clinkx-workflows/dist/dashboard/request-admission.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/scanner.d.ts +78 -0
- package/clinkx-workflows/dist/dashboard/scanner.js +1154 -0
- package/clinkx-workflows/dist/dashboard/scanner.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/server-factory.d.ts +63 -0
- package/clinkx-workflows/dist/dashboard/server-factory.js +483 -0
- package/clinkx-workflows/dist/dashboard/server-factory.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/session-log-contract.d.ts +2778 -0
- package/clinkx-workflows/dist/dashboard/session-log-contract.js +506 -0
- package/clinkx-workflows/dist/dashboard/session-log-contract.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/session-log-identity.d.ts +21 -0
- package/clinkx-workflows/dist/dashboard/session-log-identity.js +101 -0
- package/clinkx-workflows/dist/dashboard/session-log-identity.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/session-log-journal.d.ts +43 -0
- package/clinkx-workflows/dist/dashboard/session-log-journal.js +529 -0
- package/clinkx-workflows/dist/dashboard/session-log-journal.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/session-log-reader.d.ts +61 -0
- package/clinkx-workflows/dist/dashboard/session-log-reader.js +378 -0
- package/clinkx-workflows/dist/dashboard/session-log-reader.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/session-log-redaction.d.ts +14 -0
- package/clinkx-workflows/dist/dashboard/session-log-redaction.js +1101 -0
- package/clinkx-workflows/dist/dashboard/session-log-redaction.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/session-log-retention.d.ts +23 -0
- package/clinkx-workflows/dist/dashboard/session-log-retention.js +212 -0
- package/clinkx-workflows/dist/dashboard/session-log-retention.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/static-responses.d.ts +10 -0
- package/clinkx-workflows/dist/dashboard/static-responses.js +94 -0
- package/clinkx-workflows/dist/dashboard/static-responses.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/worker-lock-observer.d.ts +28 -0
- package/clinkx-workflows/dist/dashboard/worker-lock-observer.js +241 -0
- package/clinkx-workflows/dist/dashboard/worker-lock-observer.js.map +1 -0
- package/clinkx-workflows/dist/dashboard-ui/assets/ibm-plex-mono-latin-400-normal-CvHOgSBP.woff +0 -0
- package/clinkx-workflows/dist/dashboard-ui/assets/ibm-plex-mono-latin-400-normal-DMJ8VG8y.woff2 +0 -0
- package/clinkx-workflows/dist/dashboard-ui/assets/ibm-plex-mono-latin-500-normal-CB9ihrfo.woff +0 -0
- package/clinkx-workflows/dist/dashboard-ui/assets/ibm-plex-mono-latin-500-normal-DSY6xOcd.woff2 +0 -0
- package/clinkx-workflows/dist/dashboard-ui/assets/ibm-plex-sans-latin-400-normal-CDDApCn2.woff2 +0 -0
- package/clinkx-workflows/dist/dashboard-ui/assets/ibm-plex-sans-latin-400-normal-CYLoc0-x.woff +0 -0
- package/clinkx-workflows/dist/dashboard-ui/assets/ibm-plex-sans-latin-500-normal-6ng42L7E.woff2 +0 -0
- package/clinkx-workflows/dist/dashboard-ui/assets/ibm-plex-sans-latin-500-normal-BgVn5rGT.woff +0 -0
- package/clinkx-workflows/dist/dashboard-ui/assets/ibm-plex-sans-latin-600-normal-Cu4Hd6ag.woff +0 -0
- package/clinkx-workflows/dist/dashboard-ui/assets/ibm-plex-sans-latin-600-normal-CuJfVYMP.woff2 +0 -0
- package/clinkx-workflows/dist/dashboard-ui/assets/index-JPHQVtn9.js +106 -0
- package/clinkx-workflows/dist/dashboard-ui/assets/jetbrains-mono-latin-400-normal-6-qcROiO.woff +0 -0
- package/clinkx-workflows/dist/dashboard-ui/assets/jetbrains-mono-latin-400-normal-V6pRDFza.woff2 +0 -0
- package/clinkx-workflows/dist/dashboard-ui/assets/jetbrains-mono-latin-500-normal-BWZEU5yA.woff2 +0 -0
- package/clinkx-workflows/dist/dashboard-ui/assets/jetbrains-mono-latin-500-normal-CJOVTJB7.woff +0 -0
- package/clinkx-workflows/dist/dashboard-ui/assets/style-DOMHk-j6.css +1 -0
- package/clinkx-workflows/dist/dashboard-ui/contracts/council-plan-review-input-v1.json +158 -0
- package/clinkx-workflows/dist/dashboard-ui/index.html +15 -0
- package/clinkx-workflows/dist/dashboard-ui/licenses/IBM-Plex-Mono-OFL.txt +93 -0
- package/clinkx-workflows/dist/dashboard-ui/licenses/IBM-Plex-Sans-OFL.txt +93 -0
- package/clinkx-workflows/dist/dashboard-ui/licenses/JetBrains-Mono-OFL.txt +93 -0
- package/clinkx-workflows/dist/dashboard-ui/licenses/NOTICE.md +32 -0
- package/clinkx-workflows/dist/dashboard-ui/theme-init.js +8 -0
- package/clinkx-workflows/dist/definition-normalizer.d.ts +19 -0
- package/clinkx-workflows/dist/definition-normalizer.js.map +1 -1
- package/clinkx-workflows/dist/delegate-finalizer-policy.d.ts +26 -0
- package/clinkx-workflows/dist/delegate-finalizer-policy.js +72 -0
- package/clinkx-workflows/dist/delegate-finalizer-policy.js.map +1 -0
- package/clinkx-workflows/dist/delegate-signature.d.ts +14 -0
- package/clinkx-workflows/dist/delegate-signature.js +14 -0
- package/clinkx-workflows/dist/delegate-signature.js.map +1 -0
- package/clinkx-workflows/dist/delegate-validate.d.ts +108 -0
- package/clinkx-workflows/dist/delegate-validate.js +148 -0
- package/clinkx-workflows/dist/delegate-validate.js.map +1 -0
- package/clinkx-workflows/dist/engine.d.ts +251 -0
- package/clinkx-workflows/dist/engine.js +1342 -92
- package/clinkx-workflows/dist/engine.js.map +1 -1
- package/clinkx-workflows/dist/errors.d.ts +24 -2
- package/clinkx-workflows/dist/errors.js +30 -2
- package/clinkx-workflows/dist/errors.js.map +1 -1
- package/clinkx-workflows/dist/fidelity.d.ts +47 -1
- package/clinkx-workflows/dist/fidelity.js +54 -1
- package/clinkx-workflows/dist/fidelity.js.map +1 -1
- package/clinkx-workflows/dist/fingerprint.d.ts +25 -7
- package/clinkx-workflows/dist/fingerprint.js +33 -10
- package/clinkx-workflows/dist/fingerprint.js.map +1 -1
- package/clinkx-workflows/dist/index.d.ts +19 -0
- package/clinkx-workflows/dist/index.js +68 -1
- package/clinkx-workflows/dist/index.js.map +1 -1
- package/clinkx-workflows/dist/loader.d.ts +9 -3
- package/clinkx-workflows/dist/loader.js +92 -21
- package/clinkx-workflows/dist/loader.js.map +1 -1
- package/clinkx-workflows/dist/logger.d.ts +1 -1
- package/clinkx-workflows/dist/logger.js +17 -3
- package/clinkx-workflows/dist/logger.js.map +1 -1
- package/clinkx-workflows/dist/monotonic-clock.d.ts +19 -0
- package/clinkx-workflows/dist/monotonic-clock.js +22 -0
- package/clinkx-workflows/dist/monotonic-clock.js.map +1 -0
- package/clinkx-workflows/dist/plan-review/admission.d.ts +160 -0
- package/clinkx-workflows/dist/plan-review/admission.js +290 -0
- package/clinkx-workflows/dist/plan-review/admission.js.map +1 -0
- package/clinkx-workflows/dist/plan-review/context-policy.d.ts +55 -0
- package/clinkx-workflows/dist/plan-review/context-policy.js +146 -0
- package/clinkx-workflows/dist/plan-review/context-policy.js.map +1 -0
- package/clinkx-workflows/dist/plan-review/contract.d.ts +763 -0
- package/clinkx-workflows/dist/plan-review/contract.js +289 -0
- package/clinkx-workflows/dist/plan-review/contract.js.map +1 -0
- package/clinkx-workflows/dist/plan-review/digest.d.ts +68 -0
- package/clinkx-workflows/dist/plan-review/digest.js +241 -0
- package/clinkx-workflows/dist/plan-review/digest.js.map +1 -0
- package/clinkx-workflows/dist/plan-review/discovery.d.ts +45 -0
- package/clinkx-workflows/dist/plan-review/discovery.js +36 -0
- package/clinkx-workflows/dist/plan-review/discovery.js.map +1 -0
- package/clinkx-workflows/dist/plan-review/execution-contract.d.ts +298 -0
- package/clinkx-workflows/dist/plan-review/execution-contract.js +194 -0
- package/clinkx-workflows/dist/plan-review/execution-contract.js.map +1 -0
- package/clinkx-workflows/dist/plan-review/expander.d.ts +48 -0
- package/clinkx-workflows/dist/plan-review/expander.js +243 -0
- package/clinkx-workflows/dist/plan-review/expander.js.map +1 -0
- package/clinkx-workflows/dist/plan-review/projector.d.ts +126 -0
- package/clinkx-workflows/dist/plan-review/projector.js +437 -0
- package/clinkx-workflows/dist/plan-review/projector.js.map +1 -0
- package/clinkx-workflows/dist/plan-review/publication.d.ts +95 -0
- package/clinkx-workflows/dist/plan-review/publication.js +182 -0
- package/clinkx-workflows/dist/plan-review/publication.js.map +1 -0
- package/clinkx-workflows/dist/plan-review/ranking-reducer.d.ts +34 -0
- package/clinkx-workflows/dist/plan-review/ranking-reducer.js +139 -0
- package/clinkx-workflows/dist/plan-review/ranking-reducer.js.map +1 -0
- package/clinkx-workflows/dist/plan-review/resume.d.ts +38 -0
- package/clinkx-workflows/dist/plan-review/resume.js +122 -0
- package/clinkx-workflows/dist/plan-review/resume.js.map +1 -0
- package/clinkx-workflows/dist/plan-review/rubric.d.ts +7 -0
- package/clinkx-workflows/dist/plan-review/rubric.js +24 -0
- package/clinkx-workflows/dist/plan-review/rubric.js.map +1 -0
- package/clinkx-workflows/dist/plan-review/run-state.d.ts +398 -0
- package/clinkx-workflows/dist/plan-review/run-state.js +183 -0
- package/clinkx-workflows/dist/plan-review/run-state.js.map +1 -0
- package/clinkx-workflows/dist/plan-review/runtime-policy.d.ts +74 -0
- package/clinkx-workflows/dist/plan-review/runtime-policy.js +186 -0
- package/clinkx-workflows/dist/plan-review/runtime-policy.js.map +1 -0
- package/clinkx-workflows/dist/plan-review/snapshot.d.ts +81 -0
- package/clinkx-workflows/dist/plan-review/snapshot.js +170 -0
- package/clinkx-workflows/dist/plan-review/snapshot.js.map +1 -0
- package/clinkx-workflows/dist/plan-review/stage-error.d.ts +19 -0
- package/clinkx-workflows/dist/plan-review/stage-error.js +20 -0
- package/clinkx-workflows/dist/plan-review/stage-error.js.map +1 -0
- package/clinkx-workflows/dist/post-processors/index.d.ts +20 -0
- package/clinkx-workflows/dist/post-processors/index.js +21 -0
- package/clinkx-workflows/dist/post-processors/index.js.map +1 -0
- package/clinkx-workflows/dist/prompt-budget.d.ts +7 -0
- package/clinkx-workflows/dist/prompt-budget.js +7 -1
- package/clinkx-workflows/dist/prompt-budget.js.map +1 -1
- package/clinkx-workflows/dist/reducers/index.js +2 -0
- package/clinkx-workflows/dist/reducers/index.js.map +1 -1
- package/clinkx-workflows/dist/roster-contract.d.ts +889 -0
- package/clinkx-workflows/dist/roster-contract.js +180 -0
- package/clinkx-workflows/dist/roster-contract.js.map +1 -0
- package/clinkx-workflows/dist/rosters.d.ts +14 -0
- package/clinkx-workflows/dist/rosters.js +169 -0
- package/clinkx-workflows/dist/rosters.js.map +1 -0
- package/clinkx-workflows/dist/run-health.d.ts +7 -0
- package/clinkx-workflows/dist/run-health.js +25 -0
- package/clinkx-workflows/dist/run-health.js.map +1 -0
- package/clinkx-workflows/dist/run-lock-heartbeat.d.ts +2 -0
- package/clinkx-workflows/dist/run-lock-heartbeat.js +3 -0
- package/clinkx-workflows/dist/run-lock-heartbeat.js.map +1 -0
- package/clinkx-workflows/dist/run-summary/cards/council-plan-review.d.ts +34 -0
- package/clinkx-workflows/dist/run-summary/cards/council-plan-review.js +74 -0
- package/clinkx-workflows/dist/run-summary/cards/council-plan-review.js.map +1 -0
- package/clinkx-workflows/dist/run-summary/cards/index.js +5 -0
- package/clinkx-workflows/dist/run-summary/cards/index.js.map +1 -1
- package/clinkx-workflows/dist/run-summary.d.ts +13 -0
- package/clinkx-workflows/dist/run-summary.js +29 -1
- package/clinkx-workflows/dist/run-summary.js.map +1 -1
- package/clinkx-workflows/dist/schema.d.ts +140 -21
- package/clinkx-workflows/dist/schema.js +34 -1
- package/clinkx-workflows/dist/schema.js.map +1 -1
- package/clinkx-workflows/dist/seed-terms.d.ts +30 -0
- package/clinkx-workflows/dist/seed-terms.js +176 -0
- package/clinkx-workflows/dist/seed-terms.js.map +1 -0
- package/clinkx-workflows/dist/server.d.ts +5 -2
- package/clinkx-workflows/dist/server.js +84 -52
- package/clinkx-workflows/dist/server.js.map +1 -1
- package/clinkx-workflows/dist/shutdown.d.ts +29 -18
- package/clinkx-workflows/dist/shutdown.js +90 -64
- package/clinkx-workflows/dist/shutdown.js.map +1 -1
- package/clinkx-workflows/dist/state-schema.d.ts +61 -0
- package/clinkx-workflows/dist/state.d.ts +175 -3
- package/clinkx-workflows/dist/state.js +1398 -44
- package/clinkx-workflows/dist/state.js.map +1 -1
- package/clinkx-workflows/dist/stdio-watchdog.d.ts +52 -0
- package/clinkx-workflows/dist/stdio-watchdog.js +212 -0
- package/clinkx-workflows/dist/stdio-watchdog.js.map +1 -0
- package/clinkx-workflows/dist/transport.d.ts +15 -0
- package/clinkx-workflows/dist/transport.js +19 -10
- package/clinkx-workflows/dist/transport.js.map +1 -1
- package/clinkx-workflows/dist/types.d.ts +20 -2
- package/clinkx-workflows/dist/validators/council.d.ts +334 -101
- package/clinkx-workflows/dist/validators/council.js +52 -13
- package/clinkx-workflows/dist/validators/council.js.map +1 -1
- package/clinkx-workflows/dist/validators/index.d.ts +1 -0
- package/clinkx-workflows/dist/validators/index.js +3 -0
- package/clinkx-workflows/dist/validators/index.js.map +1 -1
- package/clinkx-workflows/dist/validators/plan-review.d.ts +398 -0
- package/clinkx-workflows/dist/validators/plan-review.js +316 -0
- package/clinkx-workflows/dist/validators/plan-review.js.map +1 -0
- package/clinkx-workflows/dist/workflow-receipt.js +188 -4
- package/clinkx-workflows/dist/workflow-receipt.js.map +1 -1
- package/clinkx-workflows/dist/workflow-tools.d.ts +118 -3
- package/clinkx-workflows/dist/workflow-tools.js +2110 -175
- package/clinkx-workflows/dist/workflow-tools.js.map +1 -1
- package/clinkx-workflows/dist/workspace-signature.d.ts +16 -0
- package/clinkx-workflows/dist/workspace-signature.js +388 -0
- package/clinkx-workflows/dist/workspace-signature.js.map +1 -0
- package/clinkx-workflows/templates/council/answer-chairman.txt +3 -0
- package/clinkx-workflows/templates/council/answer-cross-reviewer.txt +3 -0
- package/clinkx-workflows/templates/council/answer-specialist.txt +5 -1
- package/clinkx-workflows/templates/council/chairman.txt +3 -0
- package/clinkx-workflows/templates/council/code-review-chairman.txt +16 -0
- package/clinkx-workflows/templates/council/code-review-cross-reviewer.txt +7 -1
- package/clinkx-workflows/templates/council/code-review-reviewer.txt +22 -3
- package/clinkx-workflows/templates/council/debug-chairman.txt +3 -0
- package/clinkx-workflows/templates/council/debug-cross-reviewer.txt +3 -0
- package/clinkx-workflows/templates/council/debug-debugger.txt +5 -1
- package/clinkx-workflows/templates/council/discover-analyst.txt +5 -1
- package/clinkx-workflows/templates/council/discover-chairman.txt +3 -0
- package/clinkx-workflows/templates/council/discover-cross-reviewer.txt +3 -0
- package/clinkx-workflows/templates/council/member.txt +5 -1
- package/clinkx-workflows/templates/council/plan-review-chairman.txt +71 -0
- package/clinkx-workflows/templates/council/plan-review-cross-reviewer.txt +54 -0
- package/clinkx-workflows/templates/council/plan-review-reviewer.txt +63 -0
- package/clinkx-workflows/templates/council/reviewer.txt +3 -0
- package/clinkx-workflows/templates/plan-review/chairman.txt +48 -0
- package/clinkx-workflows/templates/plan-review/cross-review.txt +52 -0
- package/clinkx-workflows/templates/plan-review/ranking.txt +16 -0
- package/clinkx-workflows/templates/plan-review/reviewer.txt +57 -0
- package/clinkx-workflows/workflows/council-answer.yaml +100 -8
- package/clinkx-workflows/workflows/council-code-review.yaml +106 -8
- package/clinkx-workflows/workflows/council-debug.yaml +100 -8
- package/clinkx-workflows/workflows/council-default.yaml +104 -8
- package/clinkx-workflows/workflows/council-discover.yaml +100 -8
- package/clinkx-workflows/workflows/council-plan-review.yaml +253 -0
- package/clinkx-workflows/workflows/plan-review-receipts.yaml +230 -0
- package/conf/adapters/agy.json +56 -0
- package/conf/adapters/claude.json +12 -0
- package/conf/adapters/codex-app-server.json +44 -0
- package/conf/adapters/codex.json +14 -2
- package/conf/adapters/glm.json +24 -3
- package/conf/adapters/grok.json +67 -0
- package/conf/adapters/hapi/agy.json +59 -0
- package/conf/adapters/hapi/claude.json +12 -0
- package/conf/adapters/hapi/codex.json +14 -2
- package/conf/adapters/hapi/glm.json +25 -4
- package/conf/rosters/default-council.json +21 -0
- package/dist/activity-journal.d.ts +56 -0
- package/dist/activity-journal.js +706 -0
- package/dist/activity-journal.js.map +1 -0
- package/dist/allowed-roots.d.ts +41 -0
- package/dist/allowed-roots.js +125 -3
- package/dist/allowed-roots.js.map +1 -1
- package/dist/codex/activity-session-log.d.ts +14 -0
- package/dist/codex/activity-session-log.js +206 -0
- package/dist/codex/activity-session-log.js.map +1 -0
- package/dist/codex/agent-tools.d.ts +23 -0
- package/dist/codex/agent-tools.js +1306 -0
- package/dist/codex/agent-tools.js.map +1 -0
- package/dist/codex/app-server-client.d.ts +79 -0
- package/dist/codex/app-server-client.js +593 -0
- package/dist/codex/app-server-client.js.map +1 -0
- package/dist/codex/app-server-registry.d.ts +407 -0
- package/dist/codex/app-server-registry.js +1493 -0
- package/dist/codex/app-server-registry.js.map +1 -0
- package/dist/codex/client-types.d.ts +115 -0
- package/dist/codex/client-types.js +2 -0
- package/dist/codex/client-types.js.map +1 -0
- package/dist/codex/protocol.d.ts +5375 -0
- package/dist/codex/protocol.js +614 -0
- package/dist/codex/protocol.js.map +1 -0
- package/dist/codex/session.d.ts +263 -0
- package/dist/codex/session.js +466 -0
- package/dist/codex/session.js.map +1 -0
- package/dist/config.d.ts +386 -23
- package/dist/config.js +184 -15
- package/dist/config.js.map +1 -1
- package/dist/context-builder/anchors.d.ts +1 -0
- package/dist/context-builder/anchors.js +3 -0
- package/dist/context-builder/anchors.js.map +1 -1
- package/dist/context-builder/bundle.d.ts +48 -2
- package/dist/context-builder/bundle.js +388 -2417
- package/dist/context-builder/bundle.js.map +1 -1
- package/dist/context-builder/codemap.d.ts +5 -0
- package/dist/context-builder/codemap.js +387 -13
- package/dist/context-builder/codemap.js.map +1 -1
- package/dist/context-builder/config.d.ts +1 -0
- package/dist/context-builder/config.js +12 -0
- package/dist/context-builder/config.js.map +1 -1
- package/dist/context-builder/context-run-catalog.d.ts +17 -0
- package/dist/context-builder/context-run-catalog.js +99 -0
- package/dist/context-builder/context-run-catalog.js.map +1 -0
- package/dist/context-builder/delegate-finalizer-effective.d.ts +33 -0
- package/dist/context-builder/delegate-finalizer-effective.js +82 -0
- package/dist/context-builder/delegate-finalizer-effective.js.map +1 -0
- package/dist/context-builder/delegate-packet.d.ts +55 -0
- package/dist/context-builder/delegate-packet.js +430 -74
- package/dist/context-builder/delegate-packet.js.map +1 -1
- package/dist/context-builder/delegate-reconstruction.d.ts +29 -0
- package/dist/context-builder/delegate-reconstruction.js +110 -41
- package/dist/context-builder/delegate-reconstruction.js.map +1 -1
- package/dist/context-builder/delegate-validation.d.ts +41 -1
- package/dist/context-builder/delegate-validation.js +237 -48
- package/dist/context-builder/delegate-validation.js.map +1 -1
- package/dist/context-builder/delegate.d.ts +11 -0
- package/dist/context-builder/delegate.js +210 -58
- package/dist/context-builder/delegate.js.map +1 -1
- package/dist/context-builder/diagnostics.d.ts +11 -2
- package/dist/context-builder/diagnostics.js +39 -6
- package/dist/context-builder/diagnostics.js.map +1 -1
- package/dist/context-builder/discovery-progress.d.ts +25 -0
- package/dist/context-builder/discovery-progress.js +64 -0
- package/dist/context-builder/discovery-progress.js.map +1 -0
- package/dist/context-builder/discovery-watchdog.d.ts +15 -0
- package/dist/context-builder/discovery-watchdog.js +39 -0
- package/dist/context-builder/discovery-watchdog.js.map +1 -0
- package/dist/context-builder/discovery.d.ts +36 -1
- package/dist/context-builder/discovery.js +584 -172
- package/dist/context-builder/discovery.js.map +1 -1
- package/dist/context-builder/external-gaps.d.ts +73 -0
- package/dist/context-builder/external-gaps.js +248 -0
- package/dist/context-builder/external-gaps.js.map +1 -0
- package/dist/context-builder/globs.d.ts +1 -0
- package/dist/context-builder/globs.js +25 -10
- package/dist/context-builder/globs.js.map +1 -1
- package/dist/context-builder/handler.d.ts +67 -2
- package/dist/context-builder/handler.js +1810 -2440
- package/dist/context-builder/handler.js.map +1 -1
- package/dist/context-builder/invocation-sidecar.d.ts +41 -0
- package/dist/context-builder/invocation-sidecar.js +189 -0
- package/dist/context-builder/invocation-sidecar.js.map +1 -0
- package/dist/context-builder/lifecycle-contract.d.ts +424 -0
- package/dist/context-builder/lifecycle-contract.js +523 -0
- package/dist/context-builder/lifecycle-contract.js.map +1 -0
- package/dist/context-builder/lifecycle-journal.d.ts +62 -0
- package/dist/context-builder/lifecycle-journal.js +88 -0
- package/dist/context-builder/lifecycle-journal.js.map +1 -0
- package/dist/context-builder/lifecycle-observer.d.ts +102 -0
- package/dist/context-builder/lifecycle-observer.js +258 -0
- package/dist/context-builder/lifecycle-observer.js.map +1 -0
- package/dist/context-builder/lifecycle-reconcile.d.ts +32 -0
- package/dist/context-builder/lifecycle-reconcile.js +191 -0
- package/dist/context-builder/lifecycle-reconcile.js.map +1 -0
- package/dist/context-builder/lifecycle-recovery.d.ts +2 -0
- package/dist/context-builder/lifecycle-recovery.js +14 -0
- package/dist/context-builder/lifecycle-recovery.js.map +1 -0
- package/dist/context-builder/mutation-lock.d.ts +32 -0
- package/dist/context-builder/mutation-lock.js +321 -0
- package/dist/context-builder/mutation-lock.js.map +1 -0
- package/dist/context-builder/path-signals.js +9 -5
- package/dist/context-builder/path-signals.js.map +1 -1
- package/dist/context-builder/progress.d.ts +3 -1
- package/dist/context-builder/progress.js +23 -0
- package/dist/context-builder/progress.js.map +1 -1
- package/dist/context-builder/receipt.d.ts +6 -4
- package/dist/context-builder/receipt.js +12 -1
- package/dist/context-builder/receipt.js.map +1 -1
- package/dist/context-builder/refine-handler.d.ts +14 -0
- package/dist/context-builder/refine-handler.js +790 -0
- package/dist/context-builder/refine-handler.js.map +1 -0
- package/dist/context-builder/review-coverage.d.ts +116 -0
- package/dist/context-builder/review-coverage.js +544 -0
- package/dist/context-builder/review-coverage.js.map +1 -0
- package/dist/context-builder/schema.d.ts +315 -2
- package/dist/context-builder/schema.js +133 -7
- package/dist/context-builder/schema.js.map +1 -1
- package/dist/context-builder/secrets.d.ts +59 -0
- package/dist/context-builder/secrets.js +2255 -44
- package/dist/context-builder/secrets.js.map +1 -1
- package/dist/context-builder/selection.d.ts +7 -3
- package/dist/context-builder/selection.js +200 -738
- package/dist/context-builder/selection.js.map +1 -1
- package/dist/context-builder/session-log-identity.d.ts +1 -0
- package/dist/context-builder/session-log-identity.js +66 -0
- package/dist/context-builder/session-log-identity.js.map +1 -0
- package/dist/context-builder/slice-range-math.d.ts +16 -0
- package/dist/context-builder/slice-range-math.js +137 -0
- package/dist/context-builder/slice-range-math.js.map +1 -0
- package/dist/context-builder/status.d.ts +23 -2
- package/dist/context-builder/status.js +60 -4
- package/dist/context-builder/status.js.map +1 -1
- package/dist/context-builder/storage.d.ts +59 -2
- package/dist/context-builder/storage.js +500 -168
- package/dist/context-builder/storage.js.map +1 -1
- package/dist/context-builder/token-estimate.d.ts +13 -2
- package/dist/context-builder/token-estimate.js +77 -4
- package/dist/context-builder/token-estimate.js.map +1 -1
- package/dist/context-builder/versions.d.ts +44 -0
- package/dist/context-builder/versions.js +45 -0
- package/dist/context-builder/versions.js.map +1 -0
- package/dist/context-builder/workflow-runner.d.ts +75 -0
- package/dist/context-builder/workflow-runner.js +1241 -0
- package/dist/context-builder/workflow-runner.js.map +1 -0
- package/dist/context-builder/write-watchdog.d.ts +14 -0
- package/dist/context-builder/write-watchdog.js +38 -0
- package/dist/context-builder/write-watchdog.js.map +1 -0
- package/dist/dashboard-adapter-catalog.d.ts +9 -0
- package/dist/dashboard-adapter-catalog.js +53 -0
- package/dist/dashboard-adapter-catalog.js.map +1 -0
- package/dist/dashboard-cli.d.ts +81 -0
- package/dist/dashboard-cli.js +623 -0
- package/dist/dashboard-cli.js.map +1 -0
- package/dist/dashboard-companion/client.d.ts +37 -0
- package/dist/dashboard-companion/client.js +229 -0
- package/dist/dashboard-companion/client.js.map +1 -0
- package/dist/dashboard-companion/config.d.ts +8 -0
- package/dist/dashboard-companion/config.js +52 -0
- package/dist/dashboard-companion/config.js.map +1 -0
- package/dist/dashboard-companion/http-proxy.d.ts +10 -0
- package/dist/dashboard-companion/http-proxy.js +234 -0
- package/dist/dashboard-companion/http-proxy.js.map +1 -0
- package/dist/dashboard-companion/protocol.d.ts +80 -0
- package/dist/dashboard-companion/protocol.js +458 -0
- package/dist/dashboard-companion/protocol.js.map +1 -0
- package/dist/dashboard-companion/standalone-assets.d.ts +12 -0
- package/dist/dashboard-companion/standalone-assets.js +72 -0
- package/dist/dashboard-companion/standalone-assets.js.map +1 -0
- package/dist/dashboard-companion/standalone-entry.d.ts +1 -0
- package/dist/dashboard-companion/standalone-entry.js +17 -0
- package/dist/dashboard-companion/standalone-entry.js.map +1 -0
- package/dist/dashboard-gateway/config.d.ts +9 -0
- package/dist/dashboard-gateway/config.js +44 -0
- package/dist/dashboard-gateway/config.js.map +1 -0
- package/dist/dashboard-gateway/index.d.ts +12 -0
- package/dist/dashboard-gateway/index.js +786 -0
- package/dist/dashboard-gateway/index.js.map +1 -0
- package/dist/dashboard-gateway/main.d.ts +1 -0
- package/dist/dashboard-gateway/main.js +25 -0
- package/dist/dashboard-gateway/main.js.map +1 -0
- package/dist/dashboard-pairing-token.d.ts +1 -0
- package/dist/dashboard-pairing-token.js +5 -0
- package/dist/dashboard-pairing-token.js.map +1 -0
- package/dist/elaris/client.d.ts +73 -0
- package/dist/elaris/client.js +825 -0
- package/dist/elaris/client.js.map +1 -0
- package/dist/elaris/config.d.ts +18 -0
- package/dist/elaris/config.js +75 -0
- package/dist/elaris/config.js.map +1 -0
- package/dist/elaris/errors.d.ts +41 -0
- package/dist/elaris/errors.js +205 -0
- package/dist/elaris/errors.js.map +1 -0
- package/dist/elaris/github-repo.d.ts +18 -0
- package/dist/elaris/github-repo.js +89 -0
- package/dist/elaris/github-repo.js.map +1 -0
- package/dist/elaris/index.d.ts +10 -0
- package/dist/elaris/index.js +11 -0
- package/dist/elaris/index.js.map +1 -0
- package/dist/elaris/redact.d.ts +89 -0
- package/dist/elaris/redact.js +423 -0
- package/dist/elaris/redact.js.map +1 -0
- package/dist/elaris/run-id.d.ts +5 -0
- package/dist/elaris/run-id.js +20 -0
- package/dist/elaris/run-id.js.map +1 -0
- package/dist/elaris/status.d.ts +45 -0
- package/dist/elaris/status.js +122 -0
- package/dist/elaris/status.js.map +1 -0
- package/dist/elaris/tool-schemas.d.ts +314 -0
- package/dist/elaris/tool-schemas.js +208 -0
- package/dist/elaris/tool-schemas.js.map +1 -0
- package/dist/elaris/tools.d.ts +73 -0
- package/dist/elaris/tools.js +1065 -0
- package/dist/elaris/tools.js.map +1 -0
- package/dist/elaris/types.d.ts +1541 -0
- package/dist/elaris/types.js +252 -0
- package/dist/elaris/types.js.map +1 -0
- package/dist/errors.d.ts +16 -0
- package/dist/errors.js +19 -0
- package/dist/errors.js.map +1 -1
- package/dist/handler.d.ts +4 -0
- package/dist/handler.js +15 -2
- package/dist/handler.js.map +1 -1
- package/dist/index.d.ts +20 -2
- package/dist/index.js +154 -6
- package/dist/index.js.map +1 -1
- package/dist/local-clink-backend.d.ts +3 -0
- package/dist/local-clink-backend.js +4 -0
- package/dist/local-clink-backend.js.map +1 -1
- package/dist/logger.d.ts +1 -1
- package/dist/logger.js +18 -3
- package/dist/logger.js.map +1 -1
- package/dist/package-info.d.ts +2 -0
- package/dist/package-info.js +18 -0
- package/dist/package-info.js.map +1 -0
- package/dist/parsers/agy-stream-json.d.ts +14 -0
- package/dist/parsers/agy-stream-json.js +172 -0
- package/dist/parsers/agy-stream-json.js.map +1 -0
- package/dist/parsers/codex-jsonl.js +48 -3
- package/dist/parsers/codex-jsonl.js.map +1 -1
- package/dist/parsers/extract.d.ts +10 -1
- package/dist/parsers/extract.js +16 -4
- package/dist/parsers/extract.js.map +1 -1
- package/dist/parsers/observed-invocation.d.ts +20 -0
- package/dist/parsers/observed-invocation.js +42 -0
- package/dist/parsers/observed-invocation.js.map +1 -0
- package/dist/pipeline.d.ts +17 -0
- package/dist/pipeline.js +181 -10
- package/dist/pipeline.js.map +1 -1
- package/dist/progress-report/lock.d.ts +74 -0
- package/dist/progress-report/lock.js +343 -0
- package/dist/progress-report/lock.js.map +1 -0
- package/dist/progress-report/schema.d.ts +808 -0
- package/dist/progress-report/schema.js +119 -0
- package/dist/progress-report/schema.js.map +1 -0
- package/dist/progress-report/store.d.ts +66 -0
- package/dist/progress-report/store.js +766 -0
- package/dist/progress-report/store.js.map +1 -0
- package/dist/progress-report/tools.d.ts +20 -0
- package/dist/progress-report/tools.js +141 -0
- package/dist/progress-report/tools.js.map +1 -0
- package/dist/prompt-mode.d.ts +1 -1
- package/dist/prompt-mode.js +7 -2
- package/dist/prompt-mode.js.map +1 -1
- package/dist/run-dir.d.ts +24 -0
- package/dist/run-dir.js +201 -2
- package/dist/run-dir.js.map +1 -1
- package/dist/runner.d.ts +20 -0
- package/dist/runner.js +192 -16
- package/dist/runner.js.map +1 -1
- package/dist/safety.d.ts +54 -4
- package/dist/safety.js +186 -5
- package/dist/safety.js.map +1 -1
- package/dist/schema.d.ts +15 -7
- package/dist/schema.js +20 -0
- package/dist/schema.js.map +1 -1
- package/dist/server.d.ts +7 -1
- package/dist/server.js +451 -23
- package/dist/server.js.map +1 -1
- package/dist/session-log-stream.d.ts +18 -0
- package/dist/session-log-stream.js +566 -0
- package/dist/session-log-stream.js.map +1 -0
- package/dist/stdio-activity.d.ts +28 -0
- package/dist/stdio-activity.js +72 -0
- package/dist/stdio-activity.js.map +1 -0
- package/package.json +47 -5
- package/conf/adapters/gemini.json +0 -44
- package/conf/adapters/hapi/gemini.json +0 -47
- package/dist/parsers/gemini-json.d.ts +0 -2
- package/dist/parsers/gemini-json.js +0 -72
- package/dist/parsers/gemini-json.js.map +0 -1
|
@@ -12,90 +12,116 @@
|
|
|
12
12
|
import { logger } from "./logger.js";
|
|
13
13
|
/**
|
|
14
14
|
* Manages graceful shutdown across signal handlers and MCP cancellation.
|
|
15
|
+
*
|
|
16
|
+
* Keyed registry: each run registers its own entry so concurrent runs (cap > 1)
|
|
17
|
+
* never clobber each other. Shutdown/cancel iterate over ALL registered entries.
|
|
15
18
|
*/
|
|
16
19
|
export class ShutdownCoordinator {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
controller: null,
|
|
20
|
-
persistState: null,
|
|
21
|
-
};
|
|
20
|
+
entries = new Map();
|
|
21
|
+
nextHandle = 1;
|
|
22
22
|
shuttingDown = false;
|
|
23
|
+
shutdownDrain;
|
|
24
|
+
shutdownSignal;
|
|
23
25
|
/**
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
+
* Synchronously latch shutdown admission and abort every entry currently
|
|
27
|
+
* owned by the coordinator. The asynchronous persistence/termination drain
|
|
28
|
+
* is deliberately separate so no awaited cleanup for one entry can let
|
|
29
|
+
* another registered run continue dispatching work.
|
|
26
30
|
*/
|
|
27
|
-
|
|
28
|
-
this.
|
|
29
|
-
|
|
31
|
+
beginShutdown(signal) {
|
|
32
|
+
if (this.shuttingDown)
|
|
33
|
+
return;
|
|
34
|
+
this.shuttingDown = true;
|
|
35
|
+
this.shutdownSignal = signal;
|
|
36
|
+
logger.info({ signal }, "received shutdown signal");
|
|
37
|
+
const abortReason = new Error(`Shutdown: ${signal}`);
|
|
38
|
+
for (const entry of this.entries.values()) {
|
|
39
|
+
try {
|
|
40
|
+
entry.controller.abort(abortReason);
|
|
41
|
+
}
|
|
42
|
+
catch (err) {
|
|
43
|
+
// AbortController listeners are caller-owned. A faulty listener must
|
|
44
|
+
// not prevent the remaining registered controllers from being latched.
|
|
45
|
+
logger.error({ err: err instanceof Error ? err.message : String(err) }, "failed to abort workflow during shutdown admission latch");
|
|
46
|
+
}
|
|
47
|
+
}
|
|
30
48
|
}
|
|
31
|
-
/**
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
unregister() {
|
|
35
|
-
this.state = { session: null, controller: null, persistState: null };
|
|
49
|
+
/** Internal admission guard used by workflow-tools before acquiring a slot. */
|
|
50
|
+
isShuttingDown() {
|
|
51
|
+
return this.shuttingDown;
|
|
36
52
|
}
|
|
37
53
|
/**
|
|
38
|
-
*
|
|
39
|
-
*
|
|
54
|
+
* Register a run's session and abort controller. Returns an opaque handle
|
|
55
|
+
* to be passed to unregister(). Each call adds a new entry; existing entries
|
|
56
|
+
* are never clobbered. Setup may supply a lazy terminate-only session and a
|
|
57
|
+
* completion fence covering its entire cleanup. Such runs own persistence
|
|
58
|
+
* themselves and pass a no-op persistState callback.
|
|
40
59
|
*/
|
|
41
|
-
|
|
42
|
-
|
|
60
|
+
register(session, controller, persistState, completion) {
|
|
61
|
+
if (this.shuttingDown) {
|
|
62
|
+
try {
|
|
63
|
+
controller.abort(new Error(`Shutdown: ${this.shutdownSignal ?? "unknown"}`));
|
|
64
|
+
}
|
|
65
|
+
catch (err) {
|
|
66
|
+
logger.error({ err: err instanceof Error ? err.message : String(err) }, "failed to abort workflow rejected during shutdown");
|
|
67
|
+
}
|
|
68
|
+
throw new Error("Cannot register workflow after shutdown has started");
|
|
69
|
+
}
|
|
70
|
+
const handle = this.nextHandle;
|
|
71
|
+
this.nextHandle += 1;
|
|
72
|
+
this.entries.set(handle, { session, controller, persistState, completion });
|
|
73
|
+
return handle;
|
|
43
74
|
}
|
|
44
75
|
/**
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
* Does NOT call process.exit — caller decides response behavior.
|
|
76
|
+
* Unregister a single run (on normal completion). Deletes only this handle's
|
|
77
|
+
* entry; other registered runs remain.
|
|
48
78
|
*/
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
return;
|
|
52
|
-
this.shuttingDown = true;
|
|
53
|
-
logger.info("cancelling current workflow run");
|
|
54
|
-
// 1. Abort in-flight calls
|
|
55
|
-
this.state.controller?.abort(new Error("Workflow cancelled"));
|
|
56
|
-
// 2. Best-effort state persistence
|
|
57
|
-
await this.safePersistState();
|
|
58
|
-
// 3. Terminate child session
|
|
59
|
-
await this.safeTerminateSession();
|
|
79
|
+
unregister(handle) {
|
|
80
|
+
this.entries.delete(handle);
|
|
60
81
|
}
|
|
61
82
|
/**
|
|
62
83
|
* Handle process shutdown.
|
|
63
|
-
* Cancel, persist, and terminate. The entrypoint owns
|
|
84
|
+
* Cancel, persist, and terminate all registered runs. The entrypoint owns
|
|
85
|
+
* process.exit.
|
|
64
86
|
*/
|
|
65
87
|
async shutdown(signal) {
|
|
66
|
-
|
|
88
|
+
this.beginShutdown(signal);
|
|
89
|
+
if (this.shutdownDrain !== undefined) {
|
|
67
90
|
logger.warn({ signal }, "duplicate shutdown signal ignored");
|
|
68
|
-
return;
|
|
69
|
-
}
|
|
70
|
-
this.shuttingDown = true;
|
|
71
|
-
logger.info({ signal }, "received shutdown signal");
|
|
72
|
-
// 1. Abort in-flight calls
|
|
73
|
-
this.state.controller?.abort(new Error(`Shutdown: ${signal}`));
|
|
74
|
-
// 2. Best-effort state persistence
|
|
75
|
-
await this.safePersistState();
|
|
76
|
-
// 3. Terminate child session
|
|
77
|
-
await this.safeTerminateSession();
|
|
78
|
-
logger.info({ signal }, "shutdown cleanup complete");
|
|
79
|
-
}
|
|
80
|
-
async safePersistState() {
|
|
81
|
-
if (this.state.persistState == null)
|
|
82
|
-
return;
|
|
83
|
-
try {
|
|
84
|
-
await this.state.persistState();
|
|
85
|
-
}
|
|
86
|
-
catch (err) {
|
|
87
|
-
logger.error({ err: err instanceof Error ? err.message : String(err) }, "failed to persist state during shutdown");
|
|
91
|
+
return await this.shutdownDrain;
|
|
88
92
|
}
|
|
93
|
+
this.shutdownDrain = this.handleAll();
|
|
94
|
+
await this.shutdownDrain;
|
|
95
|
+
logger.info({ signal: this.shutdownSignal ?? signal }, "shutdown cleanup complete");
|
|
89
96
|
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
97
|
+
/** Abort, persist, and terminate every registered entry (best-effort). */
|
|
98
|
+
async handleAll() {
|
|
99
|
+
// Admission is latched and every controller was aborted synchronously.
|
|
100
|
+
// Start all drains before awaiting any run's setup/completion fence.
|
|
101
|
+
const snapshot = Array.from(this.entries.entries());
|
|
102
|
+
await Promise.all(snapshot.map(async ([handle, entry]) => {
|
|
103
|
+
// 2. Best-effort state persistence
|
|
104
|
+
try {
|
|
105
|
+
await entry.persistState();
|
|
106
|
+
}
|
|
107
|
+
catch (err) {
|
|
108
|
+
logger.error({ err: err instanceof Error ? err.message : String(err) }, "failed to persist state during shutdown");
|
|
109
|
+
}
|
|
110
|
+
// 3. Terminate child session
|
|
111
|
+
try {
|
|
112
|
+
await entry.session.terminate();
|
|
113
|
+
}
|
|
114
|
+
catch (err) {
|
|
115
|
+
logger.error({ err: err instanceof Error ? err.message : String(err) }, "failed to terminate child session during shutdown");
|
|
116
|
+
}
|
|
117
|
+
// Owned setup/run entries persist cancellation in their own unwind, then
|
|
118
|
+
// finish backend termination and store.close before resolving this fence.
|
|
119
|
+
// The coordinator never writes their store after it has closed.
|
|
120
|
+
if (entry.completion !== undefined)
|
|
121
|
+
await entry.completion;
|
|
122
|
+
// 4. Delete only the processed handle.
|
|
123
|
+
this.entries.delete(handle);
|
|
124
|
+
}));
|
|
99
125
|
}
|
|
100
126
|
}
|
|
101
127
|
/** Singleton shutdown coordinator. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shutdown.js","sourceRoot":"","sources":["../src/shutdown.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"shutdown.js","sourceRoot":"","sources":["../src/shutdown.ts"],"names":[],"mappings":"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"}
|
|
@@ -19,18 +19,34 @@
|
|
|
19
19
|
*/
|
|
20
20
|
import type { ChildFailureMetadata } from "./errors.js";
|
|
21
21
|
import type { FidelityMetadata } from "./fidelity.js";
|
|
22
|
+
import type { WorkflowContext } from "./context-preflight.js";
|
|
23
|
+
import type { ContextBuilderLifecycleStateV1 } from "./context-builder-lifecycle-contract.js";
|
|
24
|
+
import type { WorkflowContextPolicy } from "./context-mode-resolver.js";
|
|
25
|
+
import type { PlanReviewRunState } from "./plan-review/run-state.js";
|
|
26
|
+
import type { CouncilPlanReviewError } from "./plan-review/publication.js";
|
|
27
|
+
import type { InvocationAuditRead, ObservedInvocationV1 } from "./dashboard/invocation-contract.js";
|
|
28
|
+
import type { ResolvedRoster } from "./roster-contract.js";
|
|
22
29
|
/** Call-level state progression. */
|
|
23
30
|
export type CallState = "pending" | "running" | "succeeded" | "failed" | "cancelled";
|
|
24
31
|
/** Run-level state progression. */
|
|
25
32
|
export type RunStatus = "pending" | "running" | "succeeded" | "failed" | "cancelled";
|
|
26
33
|
/** Failure classification for diagnostics and retry decisions. */
|
|
27
34
|
export type FailureClass = "transient" | "permanent";
|
|
35
|
+
/** The canonical run-level terminal fields overwritten by a generic resume. */
|
|
36
|
+
export interface PreviousTerminalEnvelope {
|
|
37
|
+
readonly status: "succeeded" | "failed" | "cancelled";
|
|
38
|
+
readonly completedAt?: string | undefined;
|
|
39
|
+
readonly error?: string | undefined;
|
|
40
|
+
readonly failureClass?: FailureClass | undefined;
|
|
41
|
+
}
|
|
28
42
|
/** Per-call state entry in the run state. */
|
|
29
43
|
export interface CallStateEntry {
|
|
30
44
|
readonly callId: string;
|
|
31
45
|
readonly stageId: string;
|
|
32
46
|
readonly state: CallState;
|
|
33
47
|
readonly retryCount: number;
|
|
48
|
+
/** Durable count of provider attempts already dispatched for this call. */
|
|
49
|
+
readonly attemptsConsumed?: number | undefined;
|
|
34
50
|
readonly startedAt?: string | undefined;
|
|
35
51
|
readonly completedAt?: string | undefined;
|
|
36
52
|
readonly durationMs?: number | undefined;
|
|
@@ -53,6 +69,16 @@ export interface CallStateEntry {
|
|
|
53
69
|
readonly fidelity?: FidelityMetadata | undefined;
|
|
54
70
|
/** Structured metadata from child _debug block on failure. */
|
|
55
71
|
readonly childDebugMetadata?: ChildFailureMetadata | undefined;
|
|
72
|
+
/**
|
|
73
|
+
* Per-call model/effort provenance. Present only when the root server
|
|
74
|
+
* injected `deriveInvocationAudit`; omitted means "not recorded".
|
|
75
|
+
*/
|
|
76
|
+
readonly invocation?: InvocationAuditRead | undefined;
|
|
77
|
+
/**
|
|
78
|
+
* Runtime-observed model/effort knobs from the child `_debug` block on a
|
|
79
|
+
* succeeded call. Telemetry-only; not fingerprint/cache identity.
|
|
80
|
+
*/
|
|
81
|
+
readonly observedInvocation?: ObservedInvocationV1 | undefined;
|
|
56
82
|
}
|
|
57
83
|
/** Per-stage state entry. */
|
|
58
84
|
export interface StageStateEntry {
|
|
@@ -112,6 +138,10 @@ export interface RunState {
|
|
|
112
138
|
readonly workflowVersion: string;
|
|
113
139
|
/** Overall run status. */
|
|
114
140
|
readonly status: RunStatus;
|
|
141
|
+
/** Most recently overwritten generic terminal envelope; never recursive. */
|
|
142
|
+
readonly previousTerminal?: PreviousTerminalEnvelope | undefined;
|
|
143
|
+
/** Effective context policy fixed at initial admission for deterministic resume. */
|
|
144
|
+
readonly initialContextPolicy?: WorkflowContextPolicy | undefined;
|
|
115
145
|
/** Whether this run is resumable (requires explicit child config). */
|
|
116
146
|
readonly resumable: boolean;
|
|
117
147
|
/** Child config fingerprint for fast mismatch rejection. */
|
|
@@ -130,6 +160,24 @@ export interface RunState {
|
|
|
130
160
|
readonly stages: readonly StageStateEntry[];
|
|
131
161
|
/** Resolved variables snapshot (non-secret only per 0-11a). */
|
|
132
162
|
readonly variables: Readonly<Record<string, unknown>>;
|
|
163
|
+
/** Optional context-builder provenance metadata for preflight-enabled runs. */
|
|
164
|
+
readonly workflow_context?: WorkflowContext | undefined;
|
|
165
|
+
/**
|
|
166
|
+
* Latest live workflow-preflight lifecycle snapshot. This is observability
|
|
167
|
+
* only: workflow_context remains the sole durable completion/reuse fence.
|
|
168
|
+
*/
|
|
169
|
+
readonly context_builder_lifecycle?: ContextBuilderLifecycleStateV1 | undefined;
|
|
170
|
+
/**
|
|
171
|
+
* Optional plan-review aux subtree (A-5). Present only for typed
|
|
172
|
+
* plan-review runs (`plan-review-receipts`, or the pre-rename name
|
|
173
|
+
* `council-plan-review`). Strictly Zod-validated on create and on read —
|
|
174
|
+
* unlike the rest of this state, a corrupt subtree here is a hard failure, not
|
|
175
|
+
* a degraded read, because it is the SOLE resume input for the execution
|
|
176
|
+
* contract, the immutable snapshot, and the per-call bindings.
|
|
177
|
+
*/
|
|
178
|
+
readonly plan_review_state?: PlanReviewRunState | undefined;
|
|
179
|
+
/** Structured plan-review failure details; generic `error` remains canonical for older clients. */
|
|
180
|
+
readonly plan_review_error?: CouncilPlanReviewError | undefined;
|
|
133
181
|
/** Run-level timing. */
|
|
134
182
|
readonly startedAt?: string | undefined;
|
|
135
183
|
readonly completedAt?: string | undefined;
|
|
@@ -138,4 +186,17 @@ export interface RunState {
|
|
|
138
186
|
readonly failureClass?: FailureClass | undefined;
|
|
139
187
|
/** Retain run directory on success for debugging when true. */
|
|
140
188
|
readonly debugKeepArtifacts?: boolean | undefined;
|
|
189
|
+
/** Whether the run was admitted for detached async execution. */
|
|
190
|
+
readonly async?: boolean | undefined;
|
|
191
|
+
/**
|
|
192
|
+
* Requested-value council roster captured at admission (no provenance).
|
|
193
|
+
* Omitted on older state and on non-council / plan-review-receipts runs.
|
|
194
|
+
*/
|
|
195
|
+
readonly resolvedRoster?: ResolvedRoster | undefined;
|
|
196
|
+
/**
|
|
197
|
+
* Named roster preset used at admission. Observability only; resume
|
|
198
|
+
* must not re-read the preset file. Omitted on older state and on
|
|
199
|
+
* runs that did not use a roster.
|
|
200
|
+
*/
|
|
201
|
+
readonly rosterName?: string | undefined;
|
|
141
202
|
}
|
|
@@ -1,23 +1,67 @@
|
|
|
1
1
|
import type { EngineHooks, EngineResumeState } from "./engine.js";
|
|
2
2
|
import type { NormalizedWorkflowDefinition } from "./definition-normalizer.js";
|
|
3
|
-
import type { RunState } from "./state-schema.js";
|
|
4
|
-
|
|
3
|
+
import type { FailureClass, RunState } from "./state-schema.js";
|
|
4
|
+
import { type WorkflowContext } from "./context-preflight.js";
|
|
5
|
+
import type { WorkflowContextBuilderLifecycleTransition } from "./context-builder-lifecycle-router.js";
|
|
6
|
+
import type { WorkflowContextPolicy } from "./context-mode-resolver.js";
|
|
7
|
+
import { type ResolvedRoster } from "./roster-contract.js";
|
|
8
|
+
import { type PlanReviewContextProvenance, type PlanReviewRunState } from "./plan-review/run-state.js";
|
|
9
|
+
import { type CouncilPlanReviewError } from "./plan-review/publication.js";
|
|
10
|
+
/**
|
|
11
|
+
* Reader-side staleness floor the shipped cadence is designed against; the
|
|
12
|
+
* dashboard observer derives its own threshold from the declared interval.
|
|
13
|
+
* Re-exported for tests and cross-module documentation only — nothing in this
|
|
14
|
+
* module consults it, because run-lock CONTROL decisions
|
|
15
|
+
* (`classifyRunLockSync`, `reapRunCancelled`, pruning) must never depend on
|
|
16
|
+
* mtime freshness.
|
|
17
|
+
*/
|
|
18
|
+
export { RUN_LOCK_HEARTBEAT_STALE_FLOOR_MS } from "./run-lock-heartbeat.js";
|
|
19
|
+
/**
|
|
20
|
+
* Run-level error written by reconcileStaleRunDirectories. Deliberately
|
|
21
|
+
* distinct from STALE_RUNNING_RECOVERY_ERROR (the resume-path recovery string)
|
|
22
|
+
* so the two reconcile paths remain distinguishable in persisted state.
|
|
23
|
+
*/
|
|
24
|
+
export declare const STALE_RUN_RECONCILE_ERROR = "Reconciled stale running run: no live worker process";
|
|
25
|
+
export type RunDirectoryClassification = "failed" | "cancelled" | "debug_kept" | "succeeded_async" | "succeeded_sync" | "active_locked" | "running_or_pending" | "unknown";
|
|
5
26
|
export interface PruneRunDirectoriesOptions {
|
|
6
27
|
readonly retainFailedDays?: number | undefined;
|
|
7
28
|
readonly retainCancelledDays?: number | undefined;
|
|
8
29
|
readonly retainDebugDays?: number | undefined;
|
|
30
|
+
readonly retainAsyncDays?: number | undefined;
|
|
31
|
+
readonly retainSucceededDays?: number | undefined;
|
|
9
32
|
}
|
|
10
33
|
export interface PruneRunDirectoriesResult {
|
|
11
34
|
readonly pruned: number;
|
|
12
35
|
readonly skipped: number;
|
|
13
36
|
readonly errors: number;
|
|
14
37
|
}
|
|
38
|
+
export interface ReconcileStaleRunDirectoriesResult {
|
|
39
|
+
readonly scanned: number;
|
|
40
|
+
readonly reconciled: number;
|
|
41
|
+
readonly skipped_held: number;
|
|
42
|
+
readonly skipped_terminal: number;
|
|
43
|
+
readonly errors: number;
|
|
44
|
+
}
|
|
45
|
+
export type RunLockStatus = "held" | "stale_or_absent" | "unknown";
|
|
15
46
|
export interface CreateWorkflowStateOptions {
|
|
16
47
|
readonly runId: string;
|
|
17
48
|
readonly definition: NormalizedWorkflowDefinition;
|
|
18
49
|
readonly variables: Readonly<Record<string, unknown>>;
|
|
19
50
|
readonly runDir?: string | undefined;
|
|
20
51
|
readonly debugKeepArtifacts?: boolean | undefined;
|
|
52
|
+
readonly async?: boolean | undefined;
|
|
53
|
+
readonly initialContextPolicy?: WorkflowContextPolicy | undefined;
|
|
54
|
+
readonly resolvedRoster?: ResolvedRoster | undefined;
|
|
55
|
+
readonly rosterName?: string | undefined;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Warn-only signal recorded at create() when a sibling run with byte-identical
|
|
59
|
+
* workflow + inputs snapshot hashes previously failed with
|
|
60
|
+
* `failureClass:"permanent"`. Advisory only — see detectDuplicateReplay.
|
|
61
|
+
*/
|
|
62
|
+
export interface DuplicateReplaySignal {
|
|
63
|
+
readonly runId: string;
|
|
64
|
+
readonly completedAt?: string | undefined;
|
|
21
65
|
}
|
|
22
66
|
export interface ResumeWorkflowStateOptions {
|
|
23
67
|
readonly runId: string;
|
|
@@ -28,8 +72,15 @@ export declare function classifyRunDirectory(runDirPath: string): RunDirectoryCl
|
|
|
28
72
|
export declare function pruneRunDirectories(runsRootDir: string, options?: PruneRunDirectoriesOptions): Promise<PruneRunDirectoriesResult>;
|
|
29
73
|
export declare class WorkflowStateStore {
|
|
30
74
|
readonly runDir: string;
|
|
75
|
+
/** Portable journal identity; absent only for a legacy or failed-open run. */
|
|
76
|
+
readonly sessionLogGeneration: string | undefined;
|
|
77
|
+
/**
|
|
78
|
+
* Warn-only duplicate-replay signal detected at create(); undefined on
|
|
79
|
+
* resume and when no permanently-failed identical sibling was found.
|
|
80
|
+
*/
|
|
81
|
+
readonly duplicateOfFailedRun: DuplicateReplaySignal | undefined;
|
|
31
82
|
readonly definition: NormalizedWorkflowDefinition;
|
|
32
|
-
|
|
83
|
+
variables: Readonly<Record<string, unknown>>;
|
|
33
84
|
readonly hooks: EngineHooks;
|
|
34
85
|
readonly resume: EngineResumeState;
|
|
35
86
|
private state;
|
|
@@ -37,14 +88,135 @@ export declare class WorkflowStateStore {
|
|
|
37
88
|
private readonly debugKeepArtifacts;
|
|
38
89
|
private writeChain;
|
|
39
90
|
private lockHeld;
|
|
91
|
+
private planReviewTerminalResult;
|
|
92
|
+
private readonly lockToken;
|
|
93
|
+
private heartbeat;
|
|
94
|
+
private heartbeatInFlight;
|
|
95
|
+
private heartbeatError;
|
|
96
|
+
private readonly persistInvocationAuditV2;
|
|
97
|
+
private readonly persistObservedInvocation;
|
|
40
98
|
private constructor();
|
|
41
99
|
static create(options: CreateWorkflowStateOptions): Promise<WorkflowStateStore>;
|
|
42
100
|
static resume(options: ResumeWorkflowStateOptions): Promise<WorkflowStateStore>;
|
|
43
101
|
get runState(): RunState;
|
|
102
|
+
/**
|
|
103
|
+
* Open a new generic resume attempt before any context preflight or provider
|
|
104
|
+
* setup. Provider-call attempt counters remain untouched; only the run-level
|
|
105
|
+
* terminal envelope is cleared so a pre-dispatch failure/cancellation can be
|
|
106
|
+
* persisted as the outcome of this resume attempt.
|
|
107
|
+
*
|
|
108
|
+
* Plan-review stale-run recovery has its own terminal-intent protocol and is
|
|
109
|
+
* deliberately left unchanged here.
|
|
110
|
+
*/
|
|
111
|
+
beginResumeAttempt(): Promise<void>;
|
|
44
112
|
markCancelled(reason?: string): Promise<void>;
|
|
113
|
+
/**
|
|
114
|
+
* Idempotently mark the run failed. Only applies when the current status is
|
|
115
|
+
* non-terminal (pending/running) so it never clobbers a richer engine-emitted
|
|
116
|
+
* terminal status (succeeded/failed/cancelled).
|
|
117
|
+
*/
|
|
118
|
+
markFailed(error: string, failureClass?: FailureClass, planReviewError?: CouncilPlanReviewError): Promise<void>;
|
|
45
119
|
flush(): Promise<void>;
|
|
120
|
+
commitPreflightContext({ variables, workflow_context, }: {
|
|
121
|
+
readonly variables: Readonly<Record<string, unknown>>;
|
|
122
|
+
readonly workflow_context: WorkflowContext;
|
|
123
|
+
}): Promise<void>;
|
|
124
|
+
observeContextBuilderLifecycleTransition(transition: WorkflowContextBuilderLifecycleTransition): Promise<void>;
|
|
125
|
+
/**
|
|
126
|
+
* Persist the plan-review aux subtree (A-5).
|
|
127
|
+
*
|
|
128
|
+
* Called immediately after `create()` and BEFORE any seat can be dispatched.
|
|
129
|
+
* It cannot be a `create()` argument in the runtime path: the subtree binds
|
|
130
|
+
* the canonical snapshot's hash, and the snapshot can only be materialized
|
|
131
|
+
* into a run directory that `create()` itself makes — and the plan requires a
|
|
132
|
+
* snapshot/digest failure to be a POST-state `failed` run, not a pre-state
|
|
133
|
+
* reject. `create()` still validates+persists the subtree when a caller
|
|
134
|
+
* already has one (e.g. a rebuild), so both entry points are strict.
|
|
135
|
+
*/
|
|
136
|
+
commitPlanReviewState(state: PlanReviewRunState): Promise<void>;
|
|
137
|
+
/**
|
|
138
|
+
* Record that the plan-review context policy was actually enforced at the
|
|
139
|
+
* preflight seam, together with the post-filtered copied paths (A-7).
|
|
140
|
+
*
|
|
141
|
+
* Committed before stage dispatch so a resumed run replays the same enforced
|
|
142
|
+
* exclusion instead of re-deriving it from caller variables.
|
|
143
|
+
*/
|
|
144
|
+
commitPlanReviewContextProvenance(provenance: PlanReviewContextProvenance): Promise<void>;
|
|
145
|
+
/** Persisted-state terminal projection used only by the engine's opt-in policy. */
|
|
146
|
+
projectPlanReviewTerminalResult(): Promise<string>;
|
|
147
|
+
/**
|
|
148
|
+
* Refresh this store's own `run.lock` mtime so a reader that cannot verify our
|
|
149
|
+
* PID namespace (a containerized or bind-mounted dashboard) has portable
|
|
150
|
+
* liveness evidence. Observation only — nothing in this module reads the
|
|
151
|
+
* mtime, and no control path consults it.
|
|
152
|
+
*/
|
|
153
|
+
private startHeartbeat;
|
|
154
|
+
/**
|
|
155
|
+
* One descriptor-bound heartbeat beat: open the lock O_NOFOLLOW read-only,
|
|
156
|
+
* fstat + bounded positional read through the SAME handle, verify it is still
|
|
157
|
+
* our token, then utimes that still-open handle. Throws
|
|
158
|
+
* `RunLockOwnershipLostError` only on a complete valid record whose token
|
|
159
|
+
* differs; every other failure is an ordinary Error.
|
|
160
|
+
*/
|
|
161
|
+
private beatRunLock;
|
|
162
|
+
private stopHeartbeat;
|
|
46
163
|
close(): Promise<void>;
|
|
47
164
|
private applyRetryUpdate;
|
|
165
|
+
/** Runs inside the caller's existing queue task; never enqueue from here. */
|
|
166
|
+
private finalizePlanReviewTerminalIntent;
|
|
48
167
|
private enqueueWrite;
|
|
49
168
|
private writeState;
|
|
50
169
|
}
|
|
170
|
+
export declare function readRunStateForStatus(runId: string): Promise<{
|
|
171
|
+
state: RunState;
|
|
172
|
+
lock: RunLockStatus;
|
|
173
|
+
} | null>;
|
|
174
|
+
/**
|
|
175
|
+
* Reap a run that has no live worker (orphaned/stale/prior-process) by writing a
|
|
176
|
+
* terminal "cancelled" state and unlinking its lock. Used by cancel_workflow when
|
|
177
|
+
* the run is not in this process's in-memory cancel registry.
|
|
178
|
+
*
|
|
179
|
+
* The run.lock is the single source of truth for ownership: this acquires the
|
|
180
|
+
* lock itself (reusing acquireRunLock, which atomically creates the lock and
|
|
181
|
+
* reclaims a stale same-host/dead-PID lock) BEFORE mutating, closing the TOCTOU
|
|
182
|
+
* where a concurrent resume_workflow could grab the lock between a caller's
|
|
183
|
+
* status read and the reap write.
|
|
184
|
+
*
|
|
185
|
+
* Returns:
|
|
186
|
+
* - "locked" — a LIVE lock blocks acquisition (held by a running worker, or a
|
|
187
|
+
* same-process blocking run); nothing is mutated.
|
|
188
|
+
* - "ownership_unknown" — the lock is malformed/unreadable; nothing is mutated
|
|
189
|
+
* or reclaimed.
|
|
190
|
+
* - "skipped" — lock acquired but the run is already terminal (not
|
|
191
|
+
* pending/running); the lock is released and nothing is mutated.
|
|
192
|
+
* The caller re-reads to report already_terminal.
|
|
193
|
+
* - "cancelled" — lock acquired and run was pending/running; terminal
|
|
194
|
+
* "cancelled" state is written and the lock removed.
|
|
195
|
+
*
|
|
196
|
+
* NOTE: This intentionally does NOT use WorkflowStateStore.resume() (which
|
|
197
|
+
* recovers + re-locks the run — the wrong intent here).
|
|
198
|
+
*/
|
|
199
|
+
export declare function reapRunCancelled(runId: string): Promise<"cancelled" | "skipped" | "locked" | "ownership_unknown">;
|
|
200
|
+
/**
|
|
201
|
+
* Terminalize run directories frozen as running/pending with no live worker.
|
|
202
|
+
*
|
|
203
|
+
* A worker that dies between state writes (e.g. during a retry backoff delay,
|
|
204
|
+
* where applyRetryUpdate has already persisted errorMessage/failureClass while
|
|
205
|
+
* the call state stays "running") leaves the run persisted as `running`
|
|
206
|
+
* forever: the only other reconcile lives in WorkflowStateStore.resume(),
|
|
207
|
+
* which non-resumable runs never reach, and pruning skips running_or_pending
|
|
208
|
+
* directories. This scan converts such runs to terminal `failed` so status
|
|
209
|
+
* projection and retention can move on. No new persisted status is introduced;
|
|
210
|
+
* STALE_RUN_RECONCILE_ERROR is the distinct terminal representation.
|
|
211
|
+
*
|
|
212
|
+
* Liveness authority is classifyRunLockSync's same-host PID probe only:
|
|
213
|
+
* a run is touched solely when its lock is "stale_or_absent" (missing lock or
|
|
214
|
+
* same-host dead PID). "held" (live PID, or ANY foreign-host lock) and
|
|
215
|
+
* "unknown" (malformed lock) are skipped entirely, and no decision here
|
|
216
|
+
* consults heartbeat mtime freshness. TOCTOU-safety mirrors reapRunCancelled:
|
|
217
|
+
* acquire the run.lock (no heartbeat declaration, like other reap
|
|
218
|
+
* acquisitions), re-read state under the lock, re-verify non-terminal, write
|
|
219
|
+
* once, then release. Idempotent: reconciled runs are terminal `failed` and
|
|
220
|
+
* count as skipped_terminal on re-scan.
|
|
221
|
+
*/
|
|
222
|
+
export declare function reconcileStaleRunDirectories(runsRootDir: string): Promise<ReconcileStaleRunDirectoriesResult>;
|