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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { link as fsLink, open as fsOpen, mkdir as fsMkdir, readFile as fsReadFile, rename as fsRename, rm as fsRm, stat as fsStat, writeFile as fsWriteFile, } from "node:fs/promises";
|
|
1
|
+
import { link as fsLink, lstat as fsLstat, open as fsOpen, mkdir as fsMkdir, readdir as fsReaddir, readFile as fsReadFile, rename as fsRename, rm as fsRm, stat as fsStat, writeFile as fsWriteFile, } from "node:fs/promises";
|
|
2
2
|
import { randomBytes } from "node:crypto";
|
|
3
3
|
import { hostname } from "node:os";
|
|
4
4
|
import { basename, dirname, isAbsolute, join, relative, resolve } from "node:path";
|
|
@@ -6,12 +6,15 @@ import { CancellationError, ExecutionError, InvalidParamsError } from "../errors
|
|
|
6
6
|
import { validateProspectiveChildPath } from "../paths.js";
|
|
7
7
|
import { contextBuilderInternalCapsForManifest, CONTEXT_BUILDER_INTERNAL_CAP_DEFAULTS, resolveContextBuilderRunsDir, } from "./config.js";
|
|
8
8
|
import { boundContextBuilderOmissions, boundContextBuilderWarnings, } from "./diagnostics.js";
|
|
9
|
-
import { cloneContextBuilderDelegateReceiptMetadata, CONTEXT_BUILDER_DELEGATE_SCHEMA_VERSION, CONTEXT_BUILDER_NO_DELEGATE_ARTIFACT_KEYS, CONTEXT_BUILDER_NO_DELEGATE_SCHEMA_VERSION, CONTEXT_BUILDER_SCHEMA_VERSION, isContextBuilderDelegateReceiptMetadata, } from "./receipt.js";
|
|
9
|
+
import { cloneContextBuilderDelegateReceiptMetadata, CONTEXT_BUILDER_DELEGATE_SCHEMA_VERSION, CONTEXT_BUILDER_LEGACY_ARTIFACT_KEYS, CONTEXT_BUILDER_NO_DELEGATE_ARTIFACT_KEYS, CONTEXT_BUILDER_NO_DELEGATE_SCHEMA_VERSION, CONTEXT_BUILDER_SCHEMA_VERSION, isContextBuilderDelegateReceiptMetadata, } from "./receipt.js";
|
|
10
10
|
import { validateCallerRunId } from "./run-id.js";
|
|
11
11
|
import { scanSecretPath } from "./secrets.js";
|
|
12
|
+
import { CONTEXT_BUILDER_INVOCATION_AUDIT_FILENAME, readContextBuilderInvocationAuditSidecar, } from "./invocation-sidecar.js";
|
|
13
|
+
import { withContextBuilderMutationLock, } from "./mutation-lock.js";
|
|
12
14
|
export const CONTEXT_BUILDER_ARTIFACT_FILE_NAMES = Object.freeze({
|
|
13
15
|
manifest_json: "manifest.json",
|
|
14
16
|
bundle_md: "bundle.md",
|
|
17
|
+
selected_context_jsonl: "selected-context.jsonl",
|
|
15
18
|
tree_json: "tree.json",
|
|
16
19
|
search_jsonl: "search.jsonl",
|
|
17
20
|
slices_jsonl: "slices.jsonl",
|
|
@@ -25,8 +28,10 @@ const DEFAULT_STORAGE_OPS = {
|
|
|
25
28
|
rename: fsRename,
|
|
26
29
|
rm: fsRm,
|
|
27
30
|
open: fsOpen,
|
|
31
|
+
lstat: fsLstat,
|
|
28
32
|
link: fsLink,
|
|
29
33
|
stat: fsStat,
|
|
34
|
+
readdir: fsReaddir,
|
|
30
35
|
};
|
|
31
36
|
const CONTEXT_BUILDER_METRIC_TYPES = Object.freeze({
|
|
32
37
|
files_seen: "number",
|
|
@@ -44,10 +49,38 @@ const CONTEXT_BUILDER_METRIC_TYPES = Object.freeze({
|
|
|
44
49
|
truncated: "boolean",
|
|
45
50
|
});
|
|
46
51
|
const CONTEXT_BUILDER_INTERNAL_CAP_KEYS = Object.keys(CONTEXT_BUILDER_INTERNAL_CAP_DEFAULTS);
|
|
47
|
-
const
|
|
48
|
-
const
|
|
49
|
-
const
|
|
50
|
-
const
|
|
52
|
+
export const WORKFLOW_CONTEXT_CACHE_MAX_ENTRIES_ENV = "CLINKX_WORKFLOWS_CONTEXT_CACHE_MAX_ENTRIES";
|
|
53
|
+
export const WORKFLOW_CONTEXT_CACHE_TTL_SECONDS_ENV = "CLINKX_WORKFLOWS_CONTEXT_CACHE_TTL_SECONDS";
|
|
54
|
+
export const DEFAULT_WORKFLOW_CONTEXT_CACHE_MAX_ENTRIES = 50;
|
|
55
|
+
export const DEFAULT_WORKFLOW_CONTEXT_CACHE_TTL_SECONDS = 86_400;
|
|
56
|
+
const DEFAULT_WORKFLOW_CONTEXT_TEMP_TTL_SECONDS = 3_600;
|
|
57
|
+
export class ContextBuilderAncillaryPromotionError extends ExecutionError {
|
|
58
|
+
reasonCode;
|
|
59
|
+
constructor(reasonCode) {
|
|
60
|
+
super("context_builder invocation audit ancillary promotion failed");
|
|
61
|
+
this.name = "ContextBuilderAncillaryPromotionError";
|
|
62
|
+
this.reasonCode = reasonCode;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
export class ContextBuilderRunClaimConflictError extends InvalidParamsError {
|
|
66
|
+
constructor(runId) {
|
|
67
|
+
super(`context_builder run_id already exists: ${runId}`);
|
|
68
|
+
this.name = "ContextBuilderRunClaimConflictError";
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
export class ContextBuilderActiveRunClaimConflictError extends ExecutionError {
|
|
72
|
+
constructor(runId) {
|
|
73
|
+
super(`context_builder run_id conflicts with an incomplete or active run: ${runId}`);
|
|
74
|
+
this.name = "ContextBuilderActiveRunClaimConflictError";
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
export class ContextBuilderCommittedRunChangedError extends ExecutionError {
|
|
78
|
+
constructor(runId) {
|
|
79
|
+
super(`context_builder committed run changed before lease admission: ${runId}`);
|
|
80
|
+
this.name = "ContextBuilderCommittedRunChangedError";
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
const HELD_CONTEXT_BUILDER_MUTATION_LOCKS = Symbol("heldContextBuilderMutationLocks");
|
|
51
84
|
export function resolveContextBuilderRunPaths(runsDir, runId) {
|
|
52
85
|
validateCallerRunId(runId);
|
|
53
86
|
const resolvedRunsDir = resolve(runsDir);
|
|
@@ -112,7 +145,7 @@ export async function createContextBuilderRun(input, ops = DEFAULT_STORAGE_OPS)
|
|
|
112
145
|
}
|
|
113
146
|
export async function writeContextBuilderArtifact(storage, key, content, ops = DEFAULT_STORAGE_OPS) {
|
|
114
147
|
const canonicalStorage = canonicalizeContextBuilderStorage(storage);
|
|
115
|
-
await
|
|
148
|
+
await withContextBuilderStorageMutationLock(canonicalStorage, ops, async () => {
|
|
116
149
|
await assertManifestAbsentForMutation(canonicalStorage, ops);
|
|
117
150
|
await writeAtomicText(canonicalStorage.artifacts[key], content, ops, {
|
|
118
151
|
mustNotExistPath: canonicalStorage.manifestJson,
|
|
@@ -123,7 +156,7 @@ export async function commitContextBuilderRun(storage, manifest, optionsOrOps =
|
|
|
123
156
|
const { options, ops } = normalizeCommitArguments(optionsOrOps, maybeOps);
|
|
124
157
|
const canonicalStorage = canonicalizeContextBuilderStorage(storage);
|
|
125
158
|
const ownerNonce = options.ownerNonce ?? canonicalStorage.ownerNonce;
|
|
126
|
-
await
|
|
159
|
+
await withContextBuilderStorageMutationLock(canonicalStorage, ops, async () => {
|
|
127
160
|
await assertManifestAbsentForMutation(canonicalStorage, ops);
|
|
128
161
|
await assertRequiredArtifactsReadable(canonicalStorage, ops);
|
|
129
162
|
throwIfCancelledBeforeManifest(options);
|
|
@@ -147,7 +180,7 @@ export async function writeContextBuilderArtifactsAndCommit(storage, contents, m
|
|
|
147
180
|
const ops = options.ops ?? DEFAULT_STORAGE_OPS;
|
|
148
181
|
const canonicalStorage = canonicalizeContextBuilderStorage(storage);
|
|
149
182
|
const ownerNonce = options.ownerNonce ?? canonicalStorage.ownerNonce;
|
|
150
|
-
await
|
|
183
|
+
await withContextBuilderStorageMutationLock(canonicalStorage, ops, async () => {
|
|
151
184
|
await assertManifestAbsentForMutation(canonicalStorage, ops);
|
|
152
185
|
for (const [key, content] of Object.entries(contents)) {
|
|
153
186
|
if (options.signal?.aborted === true) {
|
|
@@ -157,6 +190,7 @@ export async function writeContextBuilderArtifactsAndCommit(storage, contents, m
|
|
|
157
190
|
}
|
|
158
191
|
throwIfCancelledBeforeManifest(options.signal === undefined ? {} : { signal: options.signal });
|
|
159
192
|
await assertRequiredArtifactsReadable(canonicalStorage, ops);
|
|
193
|
+
await options.beforeManifestCommit?.();
|
|
160
194
|
const internalCaps = contextBuilderInternalCapsForManifest(manifest.internal_caps);
|
|
161
195
|
const { delegate, ...manifestWithoutDelegate } = manifest;
|
|
162
196
|
const boundedDelegate = normalizeManifestDelegateMetadata(delegate);
|
|
@@ -173,13 +207,358 @@ export async function writeContextBuilderArtifactsAndCommit(storage, contents, m
|
|
|
173
207
|
await writeExclusiveText(canonicalStorage.manifestJson, `${JSON.stringify(completeManifest)}\n`, ops, options.signal === undefined ? {} : { signal: options.signal });
|
|
174
208
|
}, { ownerNonce });
|
|
175
209
|
}
|
|
210
|
+
export async function promoteContextBuilderRun(tempRunDir, targetRunId, ops = DEFAULT_STORAGE_OPS) {
|
|
211
|
+
return await withPromotedContextBuilderRun(tempRunDir, targetRunId, async (storage) => storage, ops);
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Acquire source before target, then retain the target lease through its
|
|
215
|
+
* caller's manifest re-read and materialization callback.
|
|
216
|
+
*/
|
|
217
|
+
export async function withPromotedContextBuilderRun(tempRunDir, targetRunId, callback, ops = DEFAULT_STORAGE_OPS) {
|
|
218
|
+
const resolvedTempRunDir = resolve(tempRunDir);
|
|
219
|
+
const tempStorage = resolveContextBuilderRunPaths(dirname(resolvedTempRunDir), basename(resolvedTempRunDir));
|
|
220
|
+
return await withCommittedContextBuilderRunMutationLease(tempStorage, async (sourceOps) => {
|
|
221
|
+
const tempManifest = await readContextBuilderManifest(tempStorage.manifestJson, sourceOps);
|
|
222
|
+
if (tempStorage.runDir !== resolvedTempRunDir
|
|
223
|
+
|| tempManifest.run_id !== tempStorage.runId) {
|
|
224
|
+
throw new ExecutionError("context_builder cannot promote an uncommitted or mismatched temp run");
|
|
225
|
+
}
|
|
226
|
+
let invocationAudit;
|
|
227
|
+
try {
|
|
228
|
+
invocationAudit = await readContextBuilderInvocationAuditSidecar(tempStorage.runDir);
|
|
229
|
+
}
|
|
230
|
+
catch {
|
|
231
|
+
throw new ContextBuilderAncillaryPromotionError("invalid_source");
|
|
232
|
+
}
|
|
233
|
+
const targetStorage = resolveContextBuilderRunPaths(tempStorage.runsDir, targetRunId);
|
|
234
|
+
await claimContextBuilderRunDir(targetStorage, sourceOps);
|
|
235
|
+
let targetCommitted = false;
|
|
236
|
+
try {
|
|
237
|
+
await sourceOps.mkdir(targetStorage.artifactDir, { recursive: false, mode: 0o700 });
|
|
238
|
+
return await withContextBuilderStorageMutationLock(targetStorage, sourceOps, async (targetOps) => {
|
|
239
|
+
await assertManifestAbsentForMutation(targetStorage, targetOps);
|
|
240
|
+
const artifactEntries = Object.entries(tempManifest.artifacts);
|
|
241
|
+
for (const [key, sourcePath] of artifactEntries) {
|
|
242
|
+
if (key === "manifest_json") {
|
|
243
|
+
continue;
|
|
244
|
+
}
|
|
245
|
+
const targetPath = targetStorage.artifacts[key];
|
|
246
|
+
const sourceContent = await targetOps.readFile(sourcePath, "utf8");
|
|
247
|
+
const targetContent = key === "summary_json"
|
|
248
|
+
? rewriteContextBuilderSummaryRunId(sourceContent, targetRunId)
|
|
249
|
+
: sourceContent;
|
|
250
|
+
await writeAtomicText(targetPath, targetContent, targetOps, {
|
|
251
|
+
mustNotExistPath: targetStorage.manifestJson,
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
if (invocationAudit !== undefined) {
|
|
255
|
+
try {
|
|
256
|
+
await writeAtomicText(join(targetStorage.runDir, CONTEXT_BUILDER_INVOCATION_AUDIT_FILENAME), invocationAudit.serialized, targetOps, { mustNotExistPath: targetStorage.manifestJson });
|
|
257
|
+
}
|
|
258
|
+
catch {
|
|
259
|
+
throw new ContextBuilderAncillaryPromotionError("copy_failed");
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
const targetArtifacts = Object.fromEntries(Object.keys(tempManifest.artifacts).map((key) => [
|
|
263
|
+
key,
|
|
264
|
+
targetStorage.artifacts[key],
|
|
265
|
+
]));
|
|
266
|
+
const targetManifest = {
|
|
267
|
+
...tempManifest,
|
|
268
|
+
run_id: targetRunId,
|
|
269
|
+
artifacts: targetArtifacts,
|
|
270
|
+
};
|
|
271
|
+
await writeExclusiveText(targetStorage.manifestJson, `${JSON.stringify(targetManifest)}\n`, targetOps);
|
|
272
|
+
if (!await isContextBuilderRunCommitted(targetStorage.runDir, targetOps)) {
|
|
273
|
+
throw new ExecutionError(`context_builder promoted run failed validation: ${targetRunId}`);
|
|
274
|
+
}
|
|
275
|
+
targetCommitted = true;
|
|
276
|
+
await (targetOps.rm ?? fsRm)(resolvedTempRunDir, { recursive: true, force: true }).catch(() => { });
|
|
277
|
+
await syncDirectoryBestEffort(tempStorage.runsDir, targetOps);
|
|
278
|
+
return await callback(targetStorage, targetOps);
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
catch (error) {
|
|
282
|
+
if (!targetCommitted) {
|
|
283
|
+
// This call claimed the uncommitted target, so it owns cleanup.
|
|
284
|
+
await (sourceOps.rm ?? fsRm)(targetStorage.runDir, {
|
|
285
|
+
recursive: true,
|
|
286
|
+
force: true,
|
|
287
|
+
}).catch(() => { });
|
|
288
|
+
await syncDirectoryBestEffort(targetStorage.runsDir, sourceOps);
|
|
289
|
+
}
|
|
290
|
+
throw error;
|
|
291
|
+
}
|
|
292
|
+
}, ops);
|
|
293
|
+
}
|
|
294
|
+
export async function evictWorkflowContextRuns(runsDir, options = {}) {
|
|
295
|
+
const ops = options.ops ?? DEFAULT_STORAGE_OPS;
|
|
296
|
+
const readdir = ops.readdir ?? fsReaddir;
|
|
297
|
+
const resolvedRunsDir = await resolveContextBuilderRunsDir(runsDir);
|
|
298
|
+
const bounds = resolveWorkflowContextEvictionBounds(options);
|
|
299
|
+
const nowMs = options.nowMs ?? Date.now();
|
|
300
|
+
const protectedRunIds = new Set(options.protectedRunIds ?? []);
|
|
301
|
+
const entries = await readdir(resolvedRunsDir, { withFileTypes: true });
|
|
302
|
+
const committedCacheEntries = [];
|
|
303
|
+
const removeSet = new Map();
|
|
304
|
+
let scanned = 0;
|
|
305
|
+
let skipped = 0;
|
|
306
|
+
let failed = 0;
|
|
307
|
+
for (const entry of entries) {
|
|
308
|
+
if (!entry.isDirectory() || !isWorkflowContextRunId(entry.name)) {
|
|
309
|
+
continue;
|
|
310
|
+
}
|
|
311
|
+
scanned += 1;
|
|
312
|
+
try {
|
|
313
|
+
const storage = resolveContextBuilderRunPaths(resolvedRunsDir, entry.name);
|
|
314
|
+
const directoryAdmission = await admitContextBuilderRunDirectory(storage, ops);
|
|
315
|
+
if (directoryAdmission === undefined) {
|
|
316
|
+
skipped += 1;
|
|
317
|
+
continue;
|
|
318
|
+
}
|
|
319
|
+
const admission = await admitCommittedContextBuilderRun(storage, ops);
|
|
320
|
+
if (admission === undefined) {
|
|
321
|
+
skipped += 1;
|
|
322
|
+
continue;
|
|
323
|
+
}
|
|
324
|
+
const currentDirectoryAdmission = await admitContextBuilderRunDirectory(storage, ops);
|
|
325
|
+
if (currentDirectoryAdmission === undefined
|
|
326
|
+
|| !contextBuilderRunDirectoryAdmissionsEqual(directoryAdmission, currentDirectoryAdmission)) {
|
|
327
|
+
skipped += 1;
|
|
328
|
+
continue;
|
|
329
|
+
}
|
|
330
|
+
const mtimeMs = Number(directoryAdmission.mtimeNs) / 1_000_000;
|
|
331
|
+
const candidate = {
|
|
332
|
+
storage,
|
|
333
|
+
mtimeMs,
|
|
334
|
+
admission,
|
|
335
|
+
directoryAdmission,
|
|
336
|
+
};
|
|
337
|
+
const isProtected = protectedRunIds.has(storage.runId);
|
|
338
|
+
if (entry.name.startsWith("wfctx-")) {
|
|
339
|
+
// Protected cache entries are excluded from LRU survivor accounting so
|
|
340
|
+
// they can never be selected for the max-entries trim below either.
|
|
341
|
+
if (!isProtected) {
|
|
342
|
+
committedCacheEntries.push(candidate);
|
|
343
|
+
}
|
|
344
|
+
if (nowMs - mtimeMs > bounds.cacheTtlMs) {
|
|
345
|
+
if (isProtected) {
|
|
346
|
+
skipped += 1;
|
|
347
|
+
}
|
|
348
|
+
else {
|
|
349
|
+
removeSet.set(storage.runId, candidate);
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
continue;
|
|
353
|
+
}
|
|
354
|
+
if (nowMs - mtimeMs > bounds.tempTtlMs) {
|
|
355
|
+
if (isProtected) {
|
|
356
|
+
skipped += 1;
|
|
357
|
+
}
|
|
358
|
+
else {
|
|
359
|
+
removeSet.set(storage.runId, candidate);
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
catch {
|
|
364
|
+
failed += 1;
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
const cacheSurvivors = committedCacheEntries
|
|
368
|
+
.filter(({ storage }) => !removeSet.has(storage.runId))
|
|
369
|
+
.sort((a, b) => a.mtimeMs - b.mtimeMs);
|
|
370
|
+
cacheSurvivors
|
|
371
|
+
.slice(0, Math.max(0, cacheSurvivors.length - bounds.maxEntries))
|
|
372
|
+
.forEach((candidate) => {
|
|
373
|
+
removeSet.set(candidate.storage.runId, candidate);
|
|
374
|
+
});
|
|
375
|
+
let evicted = 0;
|
|
376
|
+
for (const { storage, admission, directoryAdmission } of removeSet.values()) {
|
|
377
|
+
try {
|
|
378
|
+
const didRemove = await removeCommittedWorkflowContextRun(storage, admission, directoryAdmission, ops);
|
|
379
|
+
if (didRemove) {
|
|
380
|
+
evicted += 1;
|
|
381
|
+
}
|
|
382
|
+
else {
|
|
383
|
+
skipped += 1;
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
catch (error) {
|
|
387
|
+
if (isNodeError(error) && error.code === "ENOENT") {
|
|
388
|
+
skipped += 1;
|
|
389
|
+
}
|
|
390
|
+
else {
|
|
391
|
+
failed += 1;
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
if (evicted > 0) {
|
|
396
|
+
await syncDirectoryBestEffort(resolvedRunsDir, ops);
|
|
397
|
+
}
|
|
398
|
+
return { scanned, evicted, skipped, failed };
|
|
399
|
+
}
|
|
176
400
|
export async function cleanupContextBuilderIncompleteRun(storage, ownerNonce, ops = DEFAULT_STORAGE_OPS) {
|
|
177
401
|
const canonicalStorage = canonicalizeContextBuilderStorage(storage);
|
|
178
|
-
return
|
|
402
|
+
return withContextBuilderStorageMutationLock(canonicalStorage, ops, async () => cleanupContextBuilderIncompleteRunLocked(canonicalStorage, ownerNonce, ops), {
|
|
179
403
|
ownerNonce,
|
|
180
|
-
|
|
404
|
+
canRecoverStale: async () => (await canRemoveIncompleteRunDir(canonicalStorage, ownerNonce, ops)).removable,
|
|
181
405
|
});
|
|
182
406
|
}
|
|
407
|
+
/** Hold one run's mutation lock, reusing it for nested storage operations. */
|
|
408
|
+
export async function withContextBuilderRunMutationLease(storage, callback, ops = DEFAULT_STORAGE_OPS, options = {}) {
|
|
409
|
+
const canonicalStorage = canonicalizeContextBuilderStorage(storage);
|
|
410
|
+
const effectiveOps = ops ?? DEFAULT_STORAGE_OPS;
|
|
411
|
+
return await withContextBuilderStorageMutationLock(canonicalStorage, effectiveOps, callback, options);
|
|
412
|
+
}
|
|
413
|
+
/**
|
|
414
|
+
* Admit one exact committed-run incarnation, recover only a stale lock bound to
|
|
415
|
+
* that admission, and recheck the manifest after acquiring the lease.
|
|
416
|
+
*/
|
|
417
|
+
export async function withCommittedContextBuilderRunMutationLease(storage, callback, ops = DEFAULT_STORAGE_OPS) {
|
|
418
|
+
const canonicalStorage = canonicalizeContextBuilderStorage(storage);
|
|
419
|
+
const admitted = await admitCommittedContextBuilderRun(canonicalStorage, ops);
|
|
420
|
+
if (admitted === undefined) {
|
|
421
|
+
throw new ContextBuilderCommittedRunChangedError(canonicalStorage.runId);
|
|
422
|
+
}
|
|
423
|
+
return await withAdmittedCommittedContextBuilderRunMutationLease(canonicalStorage, admitted, callback, ops);
|
|
424
|
+
}
|
|
425
|
+
async function withAdmittedCommittedContextBuilderRunMutationLease(storage, admitted, callback, ops) {
|
|
426
|
+
return await withContextBuilderStorageMutationLock(storage, ops, async (leasedOps) => {
|
|
427
|
+
const current = await admitCommittedContextBuilderRun(storage, leasedOps);
|
|
428
|
+
if (current === undefined
|
|
429
|
+
|| !committedRunAdmissionsEqual(admitted, current)) {
|
|
430
|
+
throw new ContextBuilderCommittedRunChangedError(storage.runId);
|
|
431
|
+
}
|
|
432
|
+
return await callback(leasedOps);
|
|
433
|
+
}, {
|
|
434
|
+
canRecoverStale: async () => {
|
|
435
|
+
const current = await admitCommittedContextBuilderRun(storage, ops);
|
|
436
|
+
return current !== undefined
|
|
437
|
+
&& committedRunAdmissionsEqual(admitted, current);
|
|
438
|
+
},
|
|
439
|
+
});
|
|
440
|
+
}
|
|
441
|
+
async function withContextBuilderStorageMutationLock(storage, ops, callback, options = {}) {
|
|
442
|
+
const heldLocks = ops[HELD_CONTEXT_BUILDER_MUTATION_LOCKS];
|
|
443
|
+
if (heldLocks?.has(storage.runDir) === true) {
|
|
444
|
+
return await callback(ops);
|
|
445
|
+
}
|
|
446
|
+
return await withContextBuilderMutationLock(storage, ops, async () => await callback(markContextBuilderMutationLockHeld(ops, storage.runDir)), options);
|
|
447
|
+
}
|
|
448
|
+
function markContextBuilderMutationLockHeld(ops, runDir) {
|
|
449
|
+
const inherited = ops[HELD_CONTEXT_BUILDER_MUTATION_LOCKS];
|
|
450
|
+
const heldLocks = new Set(inherited ?? []);
|
|
451
|
+
heldLocks.add(runDir);
|
|
452
|
+
const leasedOps = Object.create(ops);
|
|
453
|
+
Object.defineProperty(leasedOps, HELD_CONTEXT_BUILDER_MUTATION_LOCKS, {
|
|
454
|
+
value: heldLocks,
|
|
455
|
+
});
|
|
456
|
+
return leasedOps;
|
|
457
|
+
}
|
|
458
|
+
async function admitCommittedContextBuilderRun(storage, ops) {
|
|
459
|
+
const lstat = ops.lstat ?? fsLstat;
|
|
460
|
+
const open = ops.open ?? fsOpen;
|
|
461
|
+
let handle;
|
|
462
|
+
try {
|
|
463
|
+
const pathStats = await lstat(storage.manifestJson, { bigint: true });
|
|
464
|
+
if (!pathStats.isFile()) {
|
|
465
|
+
return undefined;
|
|
466
|
+
}
|
|
467
|
+
handle = await open(storage.manifestJson, "r");
|
|
468
|
+
const before = await handle.stat({ bigint: true });
|
|
469
|
+
if (!before.isFile()
|
|
470
|
+
|| before.nlink === 0n
|
|
471
|
+
|| !sameCommittedRunIncarnation(committedRunFingerprintFromStats(pathStats), committedRunFingerprintFromStats(before))) {
|
|
472
|
+
return undefined;
|
|
473
|
+
}
|
|
474
|
+
const serializedManifest = await handle.readFile({ encoding: "utf8" });
|
|
475
|
+
const afterRead = await handle.stat({ bigint: true });
|
|
476
|
+
const beforeFingerprint = committedRunFingerprintFromStats(before);
|
|
477
|
+
const afterReadFingerprint = committedRunFingerprintFromStats(afterRead);
|
|
478
|
+
if (afterRead.nlink === 0n
|
|
479
|
+
|| !committedRunFingerprintsEqual(beforeFingerprint, afterReadFingerprint)) {
|
|
480
|
+
return undefined;
|
|
481
|
+
}
|
|
482
|
+
const parsed = JSON.parse(serializedManifest);
|
|
483
|
+
if (!isValidContextBuilderManifest(parsed, storage.runId)) {
|
|
484
|
+
return undefined;
|
|
485
|
+
}
|
|
486
|
+
const artifactKeys = supportedArtifactKeys(parsed.artifacts);
|
|
487
|
+
if (artifactKeys == null
|
|
488
|
+
|| !artifactPathsExactlyMatch(parsed.artifacts, storage.artifacts, artifactKeys)) {
|
|
489
|
+
return undefined;
|
|
490
|
+
}
|
|
491
|
+
await assertRequiredArtifactsReadable(storage, ops, artifactKeys);
|
|
492
|
+
const afterArtifacts = await handle.stat({ bigint: true });
|
|
493
|
+
const finalFingerprint = committedRunFingerprintFromStats(afterArtifacts);
|
|
494
|
+
if (afterArtifacts.nlink === 0n
|
|
495
|
+
|| !committedRunFingerprintsEqual(afterReadFingerprint, finalFingerprint)) {
|
|
496
|
+
return undefined;
|
|
497
|
+
}
|
|
498
|
+
return { serializedManifest, fingerprint: finalFingerprint };
|
|
499
|
+
}
|
|
500
|
+
catch {
|
|
501
|
+
return undefined;
|
|
502
|
+
}
|
|
503
|
+
finally {
|
|
504
|
+
await handle?.close().catch(() => { });
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
function committedRunFingerprintFromStats(stats) {
|
|
508
|
+
return {
|
|
509
|
+
dev: stats.dev,
|
|
510
|
+
ino: stats.ino,
|
|
511
|
+
mtimeNs: stats.mtimeNs,
|
|
512
|
+
ctimeNs: stats.ctimeNs,
|
|
513
|
+
size: stats.size,
|
|
514
|
+
nlink: stats.nlink,
|
|
515
|
+
};
|
|
516
|
+
}
|
|
517
|
+
function sameCommittedRunIncarnation(left, right) {
|
|
518
|
+
return left.dev === right.dev && left.ino === right.ino;
|
|
519
|
+
}
|
|
520
|
+
function committedRunFingerprintsEqual(left, right) {
|
|
521
|
+
return sameCommittedRunIncarnation(left, right)
|
|
522
|
+
&& left.mtimeNs === right.mtimeNs
|
|
523
|
+
&& left.ctimeNs === right.ctimeNs
|
|
524
|
+
&& left.size === right.size
|
|
525
|
+
&& left.nlink === right.nlink;
|
|
526
|
+
}
|
|
527
|
+
function committedRunAdmissionsEqual(left, right) {
|
|
528
|
+
return left.serializedManifest === right.serializedManifest
|
|
529
|
+
&& committedRunFingerprintsEqual(left.fingerprint, right.fingerprint);
|
|
530
|
+
}
|
|
531
|
+
async function admitContextBuilderRunDirectory(storage, ops) {
|
|
532
|
+
const lstat = ops.lstat ?? fsLstat;
|
|
533
|
+
try {
|
|
534
|
+
const stats = await lstat(storage.runDir, { bigint: true });
|
|
535
|
+
if (!stats.isDirectory() || stats.nlink === 0n) {
|
|
536
|
+
return undefined;
|
|
537
|
+
}
|
|
538
|
+
return {
|
|
539
|
+
dev: stats.dev,
|
|
540
|
+
ino: stats.ino,
|
|
541
|
+
mtimeNs: stats.mtimeNs,
|
|
542
|
+
ctimeNs: stats.ctimeNs,
|
|
543
|
+
size: stats.size,
|
|
544
|
+
nlink: stats.nlink,
|
|
545
|
+
};
|
|
546
|
+
}
|
|
547
|
+
catch (error) {
|
|
548
|
+
if (isNodeError(error) && error.code === "ENOENT") {
|
|
549
|
+
return undefined;
|
|
550
|
+
}
|
|
551
|
+
throw error;
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
function contextBuilderRunDirectoryAdmissionsEqual(left, right) {
|
|
555
|
+
return left.dev === right.dev
|
|
556
|
+
&& left.ino === right.ino
|
|
557
|
+
&& left.mtimeNs === right.mtimeNs
|
|
558
|
+
&& left.ctimeNs === right.ctimeNs
|
|
559
|
+
&& left.size === right.size
|
|
560
|
+
&& left.nlink === right.nlink;
|
|
561
|
+
}
|
|
183
562
|
async function cleanupContextBuilderIncompleteRunLocked(storage, ownerNonce, ops) {
|
|
184
563
|
if (!await mayRemoveIncompleteRunDir(storage, ownerNonce, ops)) {
|
|
185
564
|
return false;
|
|
@@ -202,10 +581,12 @@ export async function isContextBuilderRunCommitted(runDir, ops = DEFAULT_STORAGE
|
|
|
202
581
|
if (expectedStorage.runDir !== resolvedRunDir) {
|
|
203
582
|
return false;
|
|
204
583
|
}
|
|
205
|
-
|
|
584
|
+
const artifactKeys = supportedArtifactKeys(parsed.artifacts);
|
|
585
|
+
if (artifactKeys == null
|
|
586
|
+
|| !artifactPathsExactlyMatch(parsed.artifacts, expectedStorage.artifacts, artifactKeys)) {
|
|
206
587
|
return false;
|
|
207
588
|
}
|
|
208
|
-
await assertRequiredArtifactsReadable(expectedStorage, ops);
|
|
589
|
+
await assertRequiredArtifactsReadable(expectedStorage, ops, artifactKeys);
|
|
209
590
|
return true;
|
|
210
591
|
}
|
|
211
592
|
catch {
|
|
@@ -218,13 +599,46 @@ function canonicalizeContextBuilderStorage(storage) {
|
|
|
218
599
|
|| storage.artifactDir !== expected.artifactDir
|
|
219
600
|
|| storage.buildingJson !== expected.buildingJson
|
|
220
601
|
|| storage.manifestJson !== expected.manifestJson
|
|
221
|
-
|| !artifactPathsExactlyMatch(storage.artifacts, expected.artifacts)) {
|
|
602
|
+
|| !artifactPathsExactlyMatch(storage.artifacts, expected.artifacts, CONTEXT_BUILDER_NO_DELEGATE_ARTIFACT_KEYS)) {
|
|
222
603
|
throw new ExecutionError("context_builder storage paths do not match run_id and runs_dir");
|
|
223
604
|
}
|
|
224
605
|
return storage.ownerNonce === undefined
|
|
225
606
|
? expected
|
|
226
607
|
: { ...expected, ownerNonce: storage.ownerNonce };
|
|
227
608
|
}
|
|
609
|
+
async function readContextBuilderManifest(manifestPath, ops) {
|
|
610
|
+
let parsed;
|
|
611
|
+
try {
|
|
612
|
+
parsed = JSON.parse(await ops.readFile(manifestPath, "utf8"));
|
|
613
|
+
}
|
|
614
|
+
catch (error) {
|
|
615
|
+
throw new ExecutionError(`context_builder cannot read manifest for promotion: ${nodeErrorCode(error)}`);
|
|
616
|
+
}
|
|
617
|
+
const parsedRunId = parsed !== null && typeof parsed === "object"
|
|
618
|
+
? parsed.run_id
|
|
619
|
+
: undefined;
|
|
620
|
+
if (typeof parsedRunId !== "string"
|
|
621
|
+
|| !isValidContextBuilderManifest(parsed, parsedRunId)) {
|
|
622
|
+
throw new ExecutionError("context_builder cannot promote run with an invalid manifest");
|
|
623
|
+
}
|
|
624
|
+
return parsed;
|
|
625
|
+
}
|
|
626
|
+
function rewriteContextBuilderSummaryRunId(summaryText, targetRunId) {
|
|
627
|
+
let parsed;
|
|
628
|
+
try {
|
|
629
|
+
parsed = JSON.parse(summaryText);
|
|
630
|
+
}
|
|
631
|
+
catch {
|
|
632
|
+
throw new ExecutionError("context_builder cannot promote run with an invalid summary artifact");
|
|
633
|
+
}
|
|
634
|
+
if (parsed === null || typeof parsed !== "object") {
|
|
635
|
+
throw new ExecutionError("context_builder cannot promote run with an invalid summary artifact");
|
|
636
|
+
}
|
|
637
|
+
return `${JSON.stringify({
|
|
638
|
+
...parsed,
|
|
639
|
+
run_id: targetRunId,
|
|
640
|
+
})}\n`;
|
|
641
|
+
}
|
|
228
642
|
async function mayRemoveIncompleteRunDir(storage, ownerNonce, ops) {
|
|
229
643
|
return (await canRemoveIncompleteRunDir(storage, ownerNonce, ops)).removable;
|
|
230
644
|
}
|
|
@@ -274,9 +688,9 @@ async function claimContextBuilderRunDir(paths, ops) {
|
|
|
274
688
|
catch (error) {
|
|
275
689
|
if (isNodeError(error) && error.code === "EEXIST") {
|
|
276
690
|
if (await isContextBuilderRunCommitted(paths.runDir, ops)) {
|
|
277
|
-
throw new
|
|
691
|
+
throw new ContextBuilderRunClaimConflictError(paths.runId);
|
|
278
692
|
}
|
|
279
|
-
throw new
|
|
693
|
+
throw new ContextBuilderActiveRunClaimConflictError(paths.runId);
|
|
280
694
|
}
|
|
281
695
|
throw error;
|
|
282
696
|
}
|
|
@@ -302,149 +716,9 @@ function isStorageOps(value) {
|
|
|
302
716
|
|| "open" in value
|
|
303
717
|
|| "link" in value);
|
|
304
718
|
}
|
|
305
|
-
async function
|
|
306
|
-
const lockPath = mutationLockPathForStorage(storage);
|
|
307
|
-
const lockHandle = await acquireContextBuilderMutationLock(storage, lockPath, ops, options);
|
|
308
|
-
try {
|
|
309
|
-
return await callback();
|
|
310
|
-
}
|
|
311
|
-
finally {
|
|
312
|
-
await lockHandle.close().catch(() => { });
|
|
313
|
-
await (ops.rm ?? fsRm)(lockPath, { force: true }).catch(() => { });
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
async function acquireContextBuilderMutationLock(storage, lockPath, ops, options) {
|
|
317
|
-
const open = ops.open ?? fsOpen;
|
|
318
|
-
for (let attempt = 0; attempt < CONTEXT_BUILDER_MUTATION_LOCK_ATTEMPTS; attempt += 1) {
|
|
319
|
-
try {
|
|
320
|
-
const handle = await open(lockPath, "wx", 0o600);
|
|
321
|
-
try {
|
|
322
|
-
await writeMutationLockMetadata(handle, options.ownerNonce);
|
|
323
|
-
return handle;
|
|
324
|
-
}
|
|
325
|
-
catch (error) {
|
|
326
|
-
await handle.close().catch(() => { });
|
|
327
|
-
await (ops.rm ?? fsRm)(lockPath, { force: true }).catch(() => { });
|
|
328
|
-
throw error;
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
catch (error) {
|
|
332
|
-
if (isNodeError(error) && error.code === "EEXIST") {
|
|
333
|
-
if (options.recoverStaleForCleanup === true
|
|
334
|
-
&& await breakStaleCleanupMutationLock(storage, lockPath, options.ownerNonce, ops)) {
|
|
335
|
-
continue;
|
|
336
|
-
}
|
|
337
|
-
await delay(CONTEXT_BUILDER_MUTATION_LOCK_RETRY_MS);
|
|
338
|
-
continue;
|
|
339
|
-
}
|
|
340
|
-
throw error;
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
throw new ExecutionError("context_builder timed out waiting for the run mutation lock");
|
|
344
|
-
}
|
|
345
|
-
function mutationLockPathForStorage(storage) {
|
|
346
|
-
validateCallerRunId(storage.runId);
|
|
347
|
-
const resolvedRunsDir = resolve(storage.runsDir);
|
|
348
|
-
const resolvedRunDir = resolve(storage.runDir);
|
|
349
|
-
if (!isPathInsideDirectory(resolvedRunDir, resolvedRunsDir)) {
|
|
350
|
-
throw new ExecutionError("context_builder refused mutation lock outside runs directory");
|
|
351
|
-
}
|
|
352
|
-
return join(resolvedRunsDir, `.${storage.runId}${CONTEXT_BUILDER_MUTATION_LOCK_SUFFIX}`);
|
|
353
|
-
}
|
|
354
|
-
async function writeMutationLockMetadata(handle, ownerNonce) {
|
|
355
|
-
const metadata = {
|
|
356
|
-
pid: process.pid,
|
|
357
|
-
hostname: hostname(),
|
|
358
|
-
created_at: new Date().toISOString(),
|
|
359
|
-
...(ownerNonce == null ? {} : { owner_nonce: ownerNonce }),
|
|
360
|
-
};
|
|
361
|
-
await handle.writeFile(`${JSON.stringify(metadata)}\n`, { encoding: "utf8" });
|
|
362
|
-
}
|
|
363
|
-
async function breakStaleCleanupMutationLock(storage, lockPath, ownerNonce, ops) {
|
|
364
|
-
if (ownerNonce == null) {
|
|
365
|
-
return false;
|
|
366
|
-
}
|
|
367
|
-
const cleanupDecision = await canRemoveIncompleteRunDir(storage, ownerNonce, ops);
|
|
368
|
-
if (!cleanupDecision.removable) {
|
|
369
|
-
return false;
|
|
370
|
-
}
|
|
371
|
-
if (!await isMutationLockOldEnough(lockPath, ops)) {
|
|
372
|
-
return false;
|
|
373
|
-
}
|
|
374
|
-
const metadata = await readMutationLockMetadata(lockPath, ops);
|
|
375
|
-
if (metadata !== "invalid" && !isStaleMutationLockMetadata(metadata)) {
|
|
376
|
-
return false;
|
|
377
|
-
}
|
|
378
|
-
await (ops.rm ?? fsRm)(lockPath, { force: true }).catch(() => { });
|
|
379
|
-
return true;
|
|
380
|
-
}
|
|
381
|
-
async function isMutationLockOldEnough(lockPath, ops) {
|
|
382
|
-
const stat = ops.stat ?? fsStat;
|
|
383
|
-
try {
|
|
384
|
-
const lockStat = await stat(lockPath);
|
|
385
|
-
return Date.now() - lockStat.mtimeMs >= CONTEXT_BUILDER_STALE_MUTATION_LOCK_MS;
|
|
386
|
-
}
|
|
387
|
-
catch {
|
|
388
|
-
return false;
|
|
389
|
-
}
|
|
390
|
-
}
|
|
391
|
-
async function readMutationLockMetadata(lockPath, ops) {
|
|
392
|
-
let parsed;
|
|
393
|
-
try {
|
|
394
|
-
parsed = JSON.parse(await ops.readFile(lockPath, "utf8"));
|
|
395
|
-
}
|
|
396
|
-
catch {
|
|
397
|
-
return "invalid";
|
|
398
|
-
}
|
|
399
|
-
if (parsed === null || typeof parsed !== "object") {
|
|
400
|
-
return "invalid";
|
|
401
|
-
}
|
|
402
|
-
const metadata = parsed;
|
|
403
|
-
if (typeof metadata.pid !== "number"
|
|
404
|
-
|| !Number.isInteger(metadata.pid)
|
|
405
|
-
|| typeof metadata.hostname !== "string"
|
|
406
|
-
|| typeof metadata.created_at !== "string") {
|
|
407
|
-
return "invalid";
|
|
408
|
-
}
|
|
409
|
-
if (metadata.owner_nonce !== undefined
|
|
410
|
-
&& typeof metadata.owner_nonce !== "string") {
|
|
411
|
-
return "invalid";
|
|
412
|
-
}
|
|
413
|
-
return {
|
|
414
|
-
pid: metadata.pid,
|
|
415
|
-
hostname: metadata.hostname,
|
|
416
|
-
created_at: metadata.created_at,
|
|
417
|
-
...(metadata.owner_nonce === undefined
|
|
418
|
-
? {}
|
|
419
|
-
: { owner_nonce: metadata.owner_nonce }),
|
|
420
|
-
};
|
|
421
|
-
}
|
|
422
|
-
function isStaleMutationLockMetadata(metadata) {
|
|
423
|
-
const createdAtMs = Date.parse(metadata.created_at);
|
|
424
|
-
if (!Number.isFinite(createdAtMs)
|
|
425
|
-
|| Date.now() - createdAtMs < CONTEXT_BUILDER_STALE_MUTATION_LOCK_MS) {
|
|
426
|
-
return false;
|
|
427
|
-
}
|
|
428
|
-
if (metadata.hostname !== hostname()) {
|
|
429
|
-
return false;
|
|
430
|
-
}
|
|
431
|
-
return !isProcessAlive(metadata.pid);
|
|
432
|
-
}
|
|
433
|
-
function isProcessAlive(pid) {
|
|
434
|
-
if (pid <= 0) {
|
|
435
|
-
return false;
|
|
436
|
-
}
|
|
437
|
-
try {
|
|
438
|
-
process.kill(pid, 0);
|
|
439
|
-
return true;
|
|
440
|
-
}
|
|
441
|
-
catch (error) {
|
|
442
|
-
return !(isNodeError(error) && error.code === "ESRCH");
|
|
443
|
-
}
|
|
444
|
-
}
|
|
445
|
-
async function assertRequiredArtifactsReadable(storage, ops) {
|
|
719
|
+
async function assertRequiredArtifactsReadable(storage, ops, artifactKeys = CONTEXT_BUILDER_NO_DELEGATE_ARTIFACT_KEYS) {
|
|
446
720
|
const missing = [];
|
|
447
|
-
for (const key of
|
|
721
|
+
for (const key of artifactKeys) {
|
|
448
722
|
if (key === "manifest_json") {
|
|
449
723
|
continue;
|
|
450
724
|
}
|
|
@@ -471,11 +745,11 @@ async function assertManifestAbsentForMutation(storage, ops) {
|
|
|
471
745
|
}
|
|
472
746
|
throw new ExecutionError("context_builder cannot mutate committed run: manifest already exists");
|
|
473
747
|
}
|
|
474
|
-
function artifactPathsExactlyMatch(actual, expected) {
|
|
475
|
-
if (!hasExactArtifactKeys(actual)) {
|
|
748
|
+
function artifactPathsExactlyMatch(actual, expected, artifactKeys) {
|
|
749
|
+
if (!hasExactArtifactKeys(actual, artifactKeys)) {
|
|
476
750
|
return false;
|
|
477
751
|
}
|
|
478
|
-
for (const key of
|
|
752
|
+
for (const key of artifactKeys) {
|
|
479
753
|
if (actual[key] !== expected[key]) {
|
|
480
754
|
return false;
|
|
481
755
|
}
|
|
@@ -533,12 +807,22 @@ function hasRequiredArtifactPaths(value) {
|
|
|
533
807
|
return false;
|
|
534
808
|
}
|
|
535
809
|
const artifacts = value;
|
|
536
|
-
|
|
810
|
+
const artifactKeys = supportedArtifactKeys(artifacts);
|
|
811
|
+
return artifactKeys != null && artifactKeys.every((key) => (typeof artifacts[key] === "string"));
|
|
537
812
|
}
|
|
538
|
-
function
|
|
539
|
-
|
|
813
|
+
function supportedArtifactKeys(value) {
|
|
814
|
+
if (hasExactArtifactKeys(value, CONTEXT_BUILDER_NO_DELEGATE_ARTIFACT_KEYS)) {
|
|
815
|
+
return CONTEXT_BUILDER_NO_DELEGATE_ARTIFACT_KEYS;
|
|
816
|
+
}
|
|
817
|
+
if (hasExactArtifactKeys(value, CONTEXT_BUILDER_LEGACY_ARTIFACT_KEYS)) {
|
|
818
|
+
return CONTEXT_BUILDER_LEGACY_ARTIFACT_KEYS;
|
|
819
|
+
}
|
|
820
|
+
return undefined;
|
|
821
|
+
}
|
|
822
|
+
function hasExactArtifactKeys(value, expectedArtifactKeys) {
|
|
823
|
+
const expectedKeys = new Set(expectedArtifactKeys);
|
|
540
824
|
const actualKeys = Object.keys(value);
|
|
541
|
-
return (actualKeys.length ===
|
|
825
|
+
return (actualKeys.length === expectedArtifactKeys.length
|
|
542
826
|
&& actualKeys.every((key) => expectedKeys.has(key)));
|
|
543
827
|
}
|
|
544
828
|
function hasRequiredMetrics(value) {
|
|
@@ -660,6 +944,57 @@ async function syncDirectoryBestEffort(path, ops) {
|
|
|
660
944
|
}
|
|
661
945
|
}
|
|
662
946
|
}
|
|
947
|
+
async function removeCommittedWorkflowContextRun(storage, admission, directoryAdmission, ops) {
|
|
948
|
+
if (!isWorkflowContextRunId(storage.runId)) {
|
|
949
|
+
return false;
|
|
950
|
+
}
|
|
951
|
+
try {
|
|
952
|
+
return await withAdmittedCommittedContextBuilderRunMutationLease(storage, admission, async (leasedOps) => {
|
|
953
|
+
const currentDirectoryAdmission = await admitContextBuilderRunDirectory(storage, leasedOps);
|
|
954
|
+
if (currentDirectoryAdmission === undefined
|
|
955
|
+
|| !contextBuilderRunDirectoryAdmissionsEqual(directoryAdmission, currentDirectoryAdmission)) {
|
|
956
|
+
return false;
|
|
957
|
+
}
|
|
958
|
+
await (leasedOps.rm ?? fsRm)(storage.runDir, { recursive: true, force: true });
|
|
959
|
+
return true;
|
|
960
|
+
}, ops);
|
|
961
|
+
}
|
|
962
|
+
catch (error) {
|
|
963
|
+
if (error instanceof ContextBuilderCommittedRunChangedError) {
|
|
964
|
+
return false;
|
|
965
|
+
}
|
|
966
|
+
throw error;
|
|
967
|
+
}
|
|
968
|
+
}
|
|
969
|
+
function isWorkflowContextRunId(runId) {
|
|
970
|
+
return runId.startsWith("wfctx-") || runId.startsWith("wfpre-");
|
|
971
|
+
}
|
|
972
|
+
function resolveWorkflowContextEvictionBounds(options) {
|
|
973
|
+
const env = options.env ?? process.env;
|
|
974
|
+
const maxEntries = normalizeNonNegativeInteger(options.maxEntries, parseNonNegativeInteger(env[WORKFLOW_CONTEXT_CACHE_MAX_ENTRIES_ENV], DEFAULT_WORKFLOW_CONTEXT_CACHE_MAX_ENTRIES));
|
|
975
|
+
const cacheTtlSeconds = normalizeNonNegativeInteger(options.cacheTtlSeconds, parseNonNegativeInteger(env[WORKFLOW_CONTEXT_CACHE_TTL_SECONDS_ENV], DEFAULT_WORKFLOW_CONTEXT_CACHE_TTL_SECONDS));
|
|
976
|
+
const tempTtlSeconds = normalizeNonNegativeInteger(options.tempTtlSeconds, Math.min(cacheTtlSeconds, DEFAULT_WORKFLOW_CONTEXT_TEMP_TTL_SECONDS));
|
|
977
|
+
return {
|
|
978
|
+
maxEntries,
|
|
979
|
+
cacheTtlMs: cacheTtlSeconds * 1_000,
|
|
980
|
+
// Provenance-only temp runs are useful for debugging recent misses, but they
|
|
981
|
+
// are not reusable cache entries, so they get a shorter bounded lifetime.
|
|
982
|
+
tempTtlMs: tempTtlSeconds * 1_000,
|
|
983
|
+
};
|
|
984
|
+
}
|
|
985
|
+
function parseNonNegativeInteger(value, fallback) {
|
|
986
|
+
if (value == null || value.trim() === "") {
|
|
987
|
+
return fallback;
|
|
988
|
+
}
|
|
989
|
+
const parsed = Number(value);
|
|
990
|
+
return normalizeNonNegativeInteger(parsed, fallback);
|
|
991
|
+
}
|
|
992
|
+
function normalizeNonNegativeInteger(value, fallback) {
|
|
993
|
+
if (value === undefined) {
|
|
994
|
+
return fallback;
|
|
995
|
+
}
|
|
996
|
+
return Number.isSafeInteger(value) && value >= 0 ? value : fallback;
|
|
997
|
+
}
|
|
663
998
|
function isNodeError(error) {
|
|
664
999
|
return error instanceof Error && "code" in error;
|
|
665
1000
|
}
|
|
@@ -736,9 +1071,6 @@ function diagnosticText(value, fallback) {
|
|
|
736
1071
|
function isRecord(value) {
|
|
737
1072
|
return value !== null && typeof value === "object";
|
|
738
1073
|
}
|
|
739
|
-
async function delay(ms) {
|
|
740
|
-
await new Promise((resolve) => setTimeout(resolve, ms));
|
|
741
|
-
}
|
|
742
1074
|
function isPathInsideDirectory(candidate, directory) {
|
|
743
1075
|
const relation = relative(directory, candidate);
|
|
744
1076
|
return relation !== "" && !relation.startsWith("..") && !isAbsolute(relation);
|