clinkx 1.0.0 → 1.1.1
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 +95 -0
- package/README.md +184 -112
- 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/clink-client.d.ts +10 -0
- package/clinkx-workflows/dist/clink-client.js +39 -1
- package/clinkx-workflows/dist/clink-client.js.map +1 -1
- package/clinkx-workflows/dist/config.d.ts +29 -1
- package/clinkx-workflows/dist/config.js +35 -2
- package/clinkx-workflows/dist/config.js.map +1 -1
- package/clinkx-workflows/dist/context-preflight.d.ts +5 -0
- package/clinkx-workflows/dist/context-preflight.js.map +1 -1
- 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 +9 -8
- package/clinkx-workflows/dist/council-expander.js +18 -9
- package/clinkx-workflows/dist/council-expander.js.map +1 -1
- package/clinkx-workflows/dist/dashboard/activity-contract.d.ts +5557 -4
- package/clinkx-workflows/dist/dashboard/activity-contract.js +55 -3
- package/clinkx-workflows/dist/dashboard/activity-contract.js.map +1 -1
- package/clinkx-workflows/dist/dashboard/activity-reader.d.ts +9 -5
- package/clinkx-workflows/dist/dashboard/activity-reader.js +15 -2
- package/clinkx-workflows/dist/dashboard/activity-reader.js.map +1 -1
- package/clinkx-workflows/dist/dashboard/api-routes.d.ts +4 -0
- package/clinkx-workflows/dist/dashboard/api-routes.js +133 -25
- package/clinkx-workflows/dist/dashboard/api-routes.js.map +1 -1
- 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-reader.d.ts +36 -2
- package/clinkx-workflows/dist/dashboard/context-run-reader.js +142 -19
- package/clinkx-workflows/dist/dashboard/context-run-reader.js.map +1 -1
- package/clinkx-workflows/dist/dashboard/contracts.d.ts +20027 -480
- package/clinkx-workflows/dist/dashboard/contracts.js +133 -6
- package/clinkx-workflows/dist/dashboard/contracts.js.map +1 -1
- package/clinkx-workflows/dist/dashboard/index.d.ts +4 -0
- package/clinkx-workflows/dist/dashboard/index.js +4 -0
- package/clinkx-workflows/dist/dashboard/index.js.map +1 -1
- 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 +14 -1
- package/clinkx-workflows/dist/dashboard/lazy-content.js +53 -2
- package/clinkx-workflows/dist/dashboard/lazy-content.js.map +1 -1
- 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 +147 -4
- package/clinkx-workflows/dist/dashboard/progress-report-contract.js +11 -11
- package/clinkx-workflows/dist/dashboard/progress-report-contract.js.map +1 -1
- package/clinkx-workflows/dist/dashboard/progress-report-reader.js +4 -56
- package/clinkx-workflows/dist/dashboard/progress-report-reader.js.map +1 -1
- package/clinkx-workflows/dist/dashboard/progress-report-status-store.d.ts +2 -1
- package/clinkx-workflows/dist/dashboard/progress-report-status-store.js +6 -5
- package/clinkx-workflows/dist/dashboard/progress-report-status-store.js.map +1 -1
- 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/request-admission.js +4 -0
- package/clinkx-workflows/dist/dashboard/request-admission.js.map +1 -1
- package/clinkx-workflows/dist/dashboard/scanner.d.ts +3 -0
- package/clinkx-workflows/dist/dashboard/scanner.js +52 -8
- package/clinkx-workflows/dist/dashboard/scanner.js.map +1 -1
- package/clinkx-workflows/dist/dashboard/server-factory.d.ts +14 -1
- package/clinkx-workflows/dist/dashboard/server-factory.js +73 -21
- package/clinkx-workflows/dist/dashboard/server-factory.js.map +1 -1
- package/clinkx-workflows/dist/dashboard/session-log-contract.d.ts +223 -56
- package/clinkx-workflows/dist/dashboard/session-log-contract.js +26 -0
- package/clinkx-workflows/dist/dashboard/session-log-contract.js.map +1 -1
- package/clinkx-workflows/dist/dashboard/session-log-journal.js +10 -3
- package/clinkx-workflows/dist/dashboard/session-log-journal.js.map +1 -1
- package/clinkx-workflows/dist/dashboard/session-log-redaction.d.ts +9 -1
- package/clinkx-workflows/dist/dashboard/session-log-redaction.js +793 -59
- package/clinkx-workflows/dist/dashboard/session-log-redaction.js.map +1 -1
- package/clinkx-workflows/dist/dashboard-ui/assets/index-JPHQVtn9.js +106 -0
- package/clinkx-workflows/dist/dashboard-ui/assets/style-DOMHk-j6.css +1 -0
- package/clinkx-workflows/dist/dashboard-ui/index.html +2 -2
- 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 +32 -2
- package/clinkx-workflows/dist/delegate-validate.js +51 -0
- package/clinkx-workflows/dist/delegate-validate.js.map +1 -1
- package/clinkx-workflows/dist/engine.d.ts +113 -3
- package/clinkx-workflows/dist/engine.js +476 -80
- package/clinkx-workflows/dist/engine.js.map +1 -1
- package/clinkx-workflows/dist/errors.d.ts +22 -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 +24 -6
- package/clinkx-workflows/dist/fingerprint.js +32 -9
- package/clinkx-workflows/dist/fingerprint.js.map +1 -1
- package/clinkx-workflows/dist/index.js +53 -1
- package/clinkx-workflows/dist/index.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/contract.d.ts +52 -52
- package/clinkx-workflows/dist/plan-review/publication.d.ts +4 -4
- package/clinkx-workflows/dist/plan-review/run-state.d.ts +16 -16
- 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/schema.d.ts +64 -0
- package/clinkx-workflows/dist/schema.js +24 -0
- package/clinkx-workflows/dist/schema.js.map +1 -1
- package/clinkx-workflows/dist/server.js +2 -0
- package/clinkx-workflows/dist/server.js.map +1 -1
- package/clinkx-workflows/dist/shutdown.d.ts +15 -2
- package/clinkx-workflows/dist/shutdown.js +60 -16
- package/clinkx-workflows/dist/shutdown.js.map +1 -1
- package/clinkx-workflows/dist/state-schema.d.ts +23 -0
- package/clinkx-workflows/dist/state.d.ts +5 -0
- package/clinkx-workflows/dist/state.js +128 -21
- 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/types.d.ts +6 -0
- package/clinkx-workflows/dist/validators/council.d.ts +50 -50
- package/clinkx-workflows/dist/validators/plan-review.d.ts +3 -3
- package/clinkx-workflows/dist/workflow-tools.d.ts +70 -0
- package/clinkx-workflows/dist/workflow-tools.js +760 -168
- package/clinkx-workflows/dist/workflow-tools.js.map +1 -1
- 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 +3 -0
- package/clinkx-workflows/templates/council/chairman.txt +3 -0
- package/clinkx-workflows/templates/council/code-review-chairman.txt +3 -0
- package/clinkx-workflows/templates/council/code-review-cross-reviewer.txt +3 -0
- package/clinkx-workflows/templates/council/code-review-reviewer.txt +3 -0
- 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 +3 -0
- package/clinkx-workflows/templates/council/discover-analyst.txt +3 -0
- 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 +3 -0
- package/clinkx-workflows/templates/council/plan-review-chairman.txt +3 -0
- package/clinkx-workflows/templates/council/plan-review-cross-reviewer.txt +3 -0
- package/clinkx-workflows/templates/council/plan-review-reviewer.txt +3 -0
- package/clinkx-workflows/templates/council/reviewer.txt +3 -0
- package/clinkx-workflows/workflows/council-answer.yaml +3 -0
- package/clinkx-workflows/workflows/council-code-review.yaml +3 -0
- package/clinkx-workflows/workflows/council-debug.yaml +3 -0
- package/clinkx-workflows/workflows/council-default.yaml +7 -0
- package/clinkx-workflows/workflows/council-discover.yaml +3 -0
- package/clinkx-workflows/workflows/council-plan-review.yaml +3 -0
- package/conf/adapters/agy.json +9 -2
- package/conf/adapters/claude.json +7 -0
- package/conf/adapters/codex.json +7 -0
- package/conf/adapters/glm.json +19 -3
- package/conf/adapters/grok.json +9 -2
- package/conf/adapters/hapi/agy.json +9 -2
- package/conf/adapters/hapi/claude.json +7 -0
- package/conf/adapters/hapi/codex.json +7 -0
- package/conf/adapters/hapi/glm.json +20 -4
- package/conf/rosters/default-council.json +21 -0
- package/dist/activity-journal.d.ts +17 -3
- package/dist/activity-journal.js +404 -79
- package/dist/activity-journal.js.map +1 -1
- package/dist/codex/agent-tools.js +36 -0
- package/dist/codex/agent-tools.js.map +1 -1
- package/dist/codex/app-server-client.d.ts +3 -0
- package/dist/codex/app-server-client.js +11 -0
- package/dist/codex/app-server-client.js.map +1 -1
- package/dist/codex/app-server-registry.d.ts +18 -0
- package/dist/codex/app-server-registry.js +88 -2
- package/dist/codex/app-server-registry.js.map +1 -1
- package/dist/codex/client-types.d.ts +7 -1
- package/dist/codex/protocol.d.ts +4 -4
- package/dist/config.d.ts +220 -23
- package/dist/config.js +104 -1
- package/dist/config.js.map +1 -1
- package/dist/context-builder/bundle.d.ts +13 -0
- package/dist/context-builder/bundle.js +46 -0
- package/dist/context-builder/bundle.js.map +1 -1
- 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 +18 -0
- package/dist/context-builder/delegate-packet.js +73 -9
- 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 +31 -0
- package/dist/context-builder/delegate-validation.js +87 -10
- package/dist/context-builder/delegate-validation.js.map +1 -1
- package/dist/context-builder/delegate.d.ts +9 -0
- package/dist/context-builder/delegate.js +210 -59
- package/dist/context-builder/delegate.js.map +1 -1
- package/dist/context-builder/diagnostics.d.ts +1 -1
- 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 +7 -0
- package/dist/context-builder/discovery.js +119 -7
- 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 +15 -0
- package/dist/context-builder/globs.js.map +1 -1
- package/dist/context-builder/handler.d.ts +42 -1
- package/dist/context-builder/handler.js +690 -62
- 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 +51 -51
- 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/review-coverage.d.ts +32 -0
- package/dist/context-builder/review-coverage.js +130 -23
- package/dist/context-builder/review-coverage.js.map +1 -1
- package/dist/context-builder/schema.d.ts +76 -1
- package/dist/context-builder/schema.js +21 -1
- package/dist/context-builder/schema.js.map +1 -1
- package/dist/context-builder/secrets.d.ts +31 -0
- package/dist/context-builder/secrets.js +871 -84
- package/dist/context-builder/secrets.js.map +1 -1
- package/dist/context-builder/status.d.ts +1 -1
- package/dist/context-builder/status.js +1 -0
- package/dist/context-builder/status.js.map +1 -1
- package/dist/context-builder/storage.d.ts +29 -5
- package/dist/context-builder/storage.js +311 -236
- package/dist/context-builder/storage.js.map +1 -1
- package/dist/context-builder/versions.d.ts +19 -4
- package/dist/context-builder/versions.js +19 -4
- package/dist/context-builder/versions.js.map +1 -1
- package/dist/context-builder/workflow-runner.d.ts +6 -0
- package/dist/context-builder/workflow-runner.js +363 -173
- package/dist/context-builder/workflow-runner.js.map +1 -1
- package/dist/dashboard-adapter-catalog.js +7 -0
- package/dist/dashboard-adapter-catalog.js.map +1 -1
- package/dist/dashboard-cli.d.ts +2 -0
- package/dist/dashboard-cli.js +40 -2
- package/dist/dashboard-cli.js.map +1 -1
- package/dist/dashboard-companion/client.d.ts +1 -0
- package/dist/dashboard-companion/client.js +22 -3
- package/dist/dashboard-companion/client.js.map +1 -1
- package/dist/dashboard-companion/protocol.js +4 -1
- package/dist/dashboard-companion/protocol.js.map +1 -1
- package/dist/dashboard-gateway/index.d.ts +1 -0
- package/dist/dashboard-gateway/index.js +33 -2
- package/dist/dashboard-gateway/index.js.map +1 -1
- package/dist/handler.js +5 -1
- package/dist/handler.js.map +1 -1
- package/dist/index.d.ts +18 -1
- package/dist/index.js +145 -7
- package/dist/index.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/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/extract.js +5 -1
- 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 +13 -0
- package/dist/pipeline.js +60 -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/runner.d.ts +7 -0
- package/dist/runner.js +10 -3
- package/dist/runner.js.map +1 -1
- package/dist/safety.d.ts +50 -0
- package/dist/safety.js +182 -1
- package/dist/safety.js.map +1 -1
- package/dist/schema.d.ts +8 -0
- package/dist/schema.js +20 -0
- package/dist/schema.js.map +1 -1
- package/dist/server.d.ts +6 -1
- package/dist/server.js +94 -8
- package/dist/server.js.map +1 -1
- package/dist/session-log-stream.d.ts +1 -1
- package/dist/session-log-stream.js +280 -33
- package/dist/session-log-stream.js.map +1 -1
- package/dist/stdio-activity.d.ts +28 -0
- package/dist/stdio-activity.js +72 -0
- package/dist/stdio-activity.js.map +1 -0
- package/docs/configuration.md +426 -0
- package/docs/security.md +293 -0
- package/package.json +5 -5
- package/clinkx-workflows/dist/dashboard-ui/assets/index-DOkMXTfB.js +0 -25
- package/clinkx-workflows/dist/dashboard-ui/assets/style-ChJsn0KD.css +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delegate-finalizer-policy.js","sourceRoot":"","sources":["../src/delegate-finalizer-policy.ts"],"names":[],"mappings":"AAOA,mEAAmE;AACnE,0EAA0E;AAC1E,wEAAwE;AACxE,4EAA4E;AAC5E,0DAA0D;AAC1D,MAAM,CAAC,MAAM,0CAA0C,GAAsC;IAC3F,aAAa,EAAE,KAAK;IACpB,qBAAqB,EAAE,KAAK;IAC5B,WAAW,EAAE,IAAI;CAClB,CAAC;AAEF,MAAM,UAAU,yBAAyB,CACvC,QAAyB,EACzB,iBAAoD;IAEpD,IAAI,QAAQ,CAAC,SAAS,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;QAC7C,OAAO,QAAQ,CAAC,SAAS,CAAC,OAAO,CAAC;IACpC,CAAC;IAED,MAAM,OAAO,GAAG,sBAAsB,CAAC,iBAAiB,CAAC,CAAC;IAC1D,OAAO,OAAO,IAAI,IAAI;QACpB,CAAC,CAAC,IAAI;QACN,CAAC,CAAC,0CAA0C,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC;AAClE,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,+CAA+C,CAC7D,KAAyB,EACzB,MAA0B,EAC1B,oBAA6B,EAC7B,OAA2B,EAC3B,QAAiB;IAEjB,MAAM,MAAM,GAAG,oBAAoB;QACjC,CAAC,CAAC,2BAA2B;QAC7B,CAAC,CAAC,wCAAwC,OAAO,uCAAuC,CAAC;IAC3F,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,IAAI,KAAK,KAAK,SAAS;QAAE,KAAK,CAAC,IAAI,CAAC,UAAU,KAAK,GAAG,CAAC,CAAC;IACxD,IAAI,MAAM,KAA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,sBAAsB,CAC7B,iBAAoD;IAEpD,MAAM,OAAO,GAAG,OAAO,iBAAiB,CAAC,YAAY,CAAC,KAAK,QAAQ;QACjE,CAAC,CAAC,iBAAiB,CAAC,YAAY,CAAC,CAAC,IAAI,EAAE;QACxC,CAAC,CAAC,SAAS,CAAC;IACd,OAAO,OAAO,IAAI,IAAI,IAAI,OAAO,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC;AACjE,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The context-builder delegate signature for "the finalizer reported external
|
|
3
|
+
* evidence gaps under external_gap_policy:degrade": status "partial" WITHOUT
|
|
4
|
+
* fallback. No other path produces that pair (fallback always sets
|
|
5
|
+
* fallback_used:true; a clean run is "succeeded"), so it is the single shared
|
|
6
|
+
* definition for engine context_quality, run health, and receipt status.
|
|
7
|
+
*
|
|
8
|
+
* Deliberately narrower than workflow-runner's cache predicate
|
|
9
|
+
* (isDelegateDegradedForCache), which also refuses fallback bundles.
|
|
10
|
+
*/
|
|
11
|
+
export declare function isDelegateExternalGapDegrade(delegate: {
|
|
12
|
+
readonly status?: string;
|
|
13
|
+
readonly fallback_used?: boolean;
|
|
14
|
+
} | undefined): boolean;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The context-builder delegate signature for "the finalizer reported external
|
|
3
|
+
* evidence gaps under external_gap_policy:degrade": status "partial" WITHOUT
|
|
4
|
+
* fallback. No other path produces that pair (fallback always sets
|
|
5
|
+
* fallback_used:true; a clean run is "succeeded"), so it is the single shared
|
|
6
|
+
* definition for engine context_quality, run health, and receipt status.
|
|
7
|
+
*
|
|
8
|
+
* Deliberately narrower than workflow-runner's cache predicate
|
|
9
|
+
* (isDelegateDegradedForCache), which also refuses fallback bundles.
|
|
10
|
+
*/
|
|
11
|
+
export function isDelegateExternalGapDegrade(delegate) {
|
|
12
|
+
return delegate?.status === "partial" && delegate.fallback_used === false;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=delegate-signature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delegate-signature.js","sourceRoot":"","sources":["../src/delegate-signature.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,MAAM,UAAU,4BAA4B,CAC1C,QAAoF;IAEpF,OAAO,QAAQ,EAAE,MAAM,KAAK,SAAS,IAAI,QAAQ,CAAC,aAAa,KAAK,KAAK,CAAC;AAC5E,CAAC"}
|
|
@@ -5,16 +5,24 @@ export declare const WorkflowDelegateSchema: z.ZodDefault<z.ZodUnion<[z.ZodObjec
|
|
|
5
5
|
curator: z.ZodObject<{
|
|
6
6
|
cli_name: z.ZodString;
|
|
7
7
|
role: z.ZodString;
|
|
8
|
+
model: z.ZodOptional<z.ZodString>;
|
|
9
|
+
effort: z.ZodOptional<z.ZodString>;
|
|
8
10
|
}, "strict", z.ZodTypeAny, {
|
|
9
11
|
cli_name: string;
|
|
10
12
|
role: string;
|
|
13
|
+
model?: string | undefined;
|
|
14
|
+
effort?: string | undefined;
|
|
11
15
|
}, {
|
|
12
16
|
cli_name: string;
|
|
13
17
|
role: string;
|
|
18
|
+
model?: string | undefined;
|
|
19
|
+
effort?: string | undefined;
|
|
14
20
|
}>;
|
|
15
21
|
finalizer: z.ZodObject<{
|
|
16
22
|
cli_name: z.ZodString;
|
|
17
23
|
role: z.ZodString;
|
|
24
|
+
model: z.ZodOptional<z.ZodString>;
|
|
25
|
+
effort: z.ZodOptional<z.ZodString>;
|
|
18
26
|
} & {
|
|
19
27
|
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
20
28
|
min_score: z.ZodDefault<z.ZodNumber>;
|
|
@@ -22,46 +30,61 @@ export declare const WorkflowDelegateSchema: z.ZodDefault<z.ZodUnion<[z.ZodObjec
|
|
|
22
30
|
cli_name: string;
|
|
23
31
|
role: string;
|
|
24
32
|
min_score: number;
|
|
33
|
+
model?: string | undefined;
|
|
34
|
+
effort?: string | undefined;
|
|
25
35
|
enabled?: boolean | undefined;
|
|
26
36
|
}, {
|
|
27
37
|
cli_name: string;
|
|
28
38
|
role: string;
|
|
39
|
+
model?: string | undefined;
|
|
40
|
+
effort?: string | undefined;
|
|
29
41
|
enabled?: boolean | undefined;
|
|
30
42
|
min_score?: number | undefined;
|
|
31
43
|
}>;
|
|
32
44
|
timeout_seconds: z.ZodOptional<z.ZodNumber>;
|
|
33
45
|
max_response_chars: z.ZodOptional<z.ZodNumber>;
|
|
34
46
|
failure_policy: z.ZodOptional<z.ZodEnum<["fallback", "fail"]>>;
|
|
47
|
+
external_gap_policy: z.ZodOptional<z.ZodEnum<["fail", "degrade"]>>;
|
|
35
48
|
}, "strict", z.ZodTypeAny, {
|
|
36
49
|
curator: {
|
|
37
50
|
cli_name: string;
|
|
38
51
|
role: string;
|
|
52
|
+
model?: string | undefined;
|
|
53
|
+
effort?: string | undefined;
|
|
39
54
|
};
|
|
40
55
|
finalizer: {
|
|
41
56
|
cli_name: string;
|
|
42
57
|
role: string;
|
|
43
58
|
min_score: number;
|
|
59
|
+
model?: string | undefined;
|
|
60
|
+
effort?: string | undefined;
|
|
44
61
|
enabled?: boolean | undefined;
|
|
45
62
|
};
|
|
46
63
|
enabled: true;
|
|
47
64
|
timeout_seconds?: number | undefined;
|
|
48
65
|
max_response_chars?: number | undefined;
|
|
49
|
-
failure_policy?: "
|
|
66
|
+
failure_policy?: "fail" | "fallback" | undefined;
|
|
67
|
+
external_gap_policy?: "fail" | "degrade" | undefined;
|
|
50
68
|
}, {
|
|
51
69
|
curator: {
|
|
52
70
|
cli_name: string;
|
|
53
71
|
role: string;
|
|
72
|
+
model?: string | undefined;
|
|
73
|
+
effort?: string | undefined;
|
|
54
74
|
};
|
|
55
75
|
finalizer: {
|
|
56
76
|
cli_name: string;
|
|
57
77
|
role: string;
|
|
78
|
+
model?: string | undefined;
|
|
79
|
+
effort?: string | undefined;
|
|
58
80
|
enabled?: boolean | undefined;
|
|
59
81
|
min_score?: number | undefined;
|
|
60
82
|
};
|
|
61
83
|
enabled: true;
|
|
62
84
|
timeout_seconds?: number | undefined;
|
|
63
85
|
max_response_chars?: number | undefined;
|
|
64
|
-
failure_policy?: "
|
|
86
|
+
failure_policy?: "fail" | "fallback" | undefined;
|
|
87
|
+
external_gap_policy?: "fail" | "degrade" | undefined;
|
|
65
88
|
}>, z.ZodObject<{
|
|
66
89
|
enabled: z.ZodDefault<z.ZodLiteral<false>>;
|
|
67
90
|
}, "strict", z.ZodTypeAny, {
|
|
@@ -74,5 +97,12 @@ export declare class WorkflowDelegateValidationError extends Error {
|
|
|
74
97
|
constructor(message: string);
|
|
75
98
|
}
|
|
76
99
|
export declare function parseWorkflowDelegateInput(value: unknown): WorkflowDelegateInput;
|
|
100
|
+
/**
|
|
101
|
+
* Whether a raw (pre-parse) `cb_delegate` value — a JSON string or an object —
|
|
102
|
+
* carries an explicit `finalizer.min_score`. Parsing defaults `min_score`, so
|
|
103
|
+
* explicitness is only observable here. Any unparseable or unexpected shape is
|
|
104
|
+
* not explicit; `parseWorkflowDelegateInput` owns reporting it.
|
|
105
|
+
*/
|
|
106
|
+
export declare function delegateFinalizerMinScoreExplicit(raw: unknown): boolean;
|
|
77
107
|
export declare function isWorkflowDelegateAbsent(value: unknown): boolean;
|
|
78
108
|
export declare function asPreflightDelegateInput(delegate: WorkflowDelegateInput): PreflightContextDelegateInput;
|
|
@@ -3,10 +3,26 @@ const DELEGATE_DEFAULT_FINALIZER_MIN_SCORE = 8.5;
|
|
|
3
3
|
const DELEGATE_MAX_TIMEOUT_SECONDS = 600;
|
|
4
4
|
const DELEGATE_MAX_RESPONSE_CHARS = 200_000;
|
|
5
5
|
const NonBlankStringSchema = z.string().trim().min(1);
|
|
6
|
+
// Keep in sync with schema.ts model regex and MODEL_OVERRIDE_PATTERN (workflow-tools.ts).
|
|
7
|
+
const ModelSchema = z
|
|
8
|
+
.string()
|
|
9
|
+
.trim()
|
|
10
|
+
.min(1)
|
|
11
|
+
.max(128)
|
|
12
|
+
.regex(/^[^\s\u0000-][^\s\u0000]*$/);
|
|
13
|
+
// Keep in sync with schema.ts effort regex and EFFORT_OVERRIDE_PATTERN (workflow-tools.ts).
|
|
14
|
+
const EffortSchema = z
|
|
15
|
+
.string()
|
|
16
|
+
.trim()
|
|
17
|
+
.min(1)
|
|
18
|
+
.max(32)
|
|
19
|
+
.regex(/^[a-z0-9][a-z0-9_-]*$/);
|
|
6
20
|
const DelegateProviderConfigSchema = z
|
|
7
21
|
.object({
|
|
8
22
|
cli_name: NonBlankStringSchema,
|
|
9
23
|
role: NonBlankStringSchema,
|
|
24
|
+
model: ModelSchema.optional(),
|
|
25
|
+
effort: EffortSchema.optional(),
|
|
10
26
|
})
|
|
11
27
|
.strict();
|
|
12
28
|
const DelegateFinalizerConfigSchema = DelegateProviderConfigSchema.extend({
|
|
@@ -40,6 +56,7 @@ const EnabledDelegateSchema = z
|
|
|
40
56
|
.max(DELEGATE_MAX_RESPONSE_CHARS)
|
|
41
57
|
.optional(),
|
|
42
58
|
failure_policy: z.enum(["fallback", "fail"]).optional(),
|
|
59
|
+
external_gap_policy: z.enum(["fail", "degrade"]).optional(),
|
|
43
60
|
})
|
|
44
61
|
.strict();
|
|
45
62
|
export const WorkflowDelegateSchema = z
|
|
@@ -59,6 +76,33 @@ export function parseWorkflowDelegateInput(value) {
|
|
|
59
76
|
}
|
|
60
77
|
return result.data;
|
|
61
78
|
}
|
|
79
|
+
/**
|
|
80
|
+
* Whether a raw (pre-parse) `cb_delegate` value — a JSON string or an object —
|
|
81
|
+
* carries an explicit `finalizer.min_score`. Parsing defaults `min_score`, so
|
|
82
|
+
* explicitness is only observable here. Any unparseable or unexpected shape is
|
|
83
|
+
* not explicit; `parseWorkflowDelegateInput` owns reporting it.
|
|
84
|
+
*/
|
|
85
|
+
export function delegateFinalizerMinScoreExplicit(raw) {
|
|
86
|
+
let value = raw;
|
|
87
|
+
if (typeof raw === "string") {
|
|
88
|
+
try {
|
|
89
|
+
value = JSON.parse(raw);
|
|
90
|
+
}
|
|
91
|
+
catch {
|
|
92
|
+
return false;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
const finalizer = ownPlainProperty(value, "finalizer");
|
|
96
|
+
return ownPlainProperty(finalizer, "min_score") !== undefined;
|
|
97
|
+
}
|
|
98
|
+
function ownPlainProperty(value, key) {
|
|
99
|
+
if (value === null || typeof value !== "object" || Array.isArray(value)) {
|
|
100
|
+
return undefined;
|
|
101
|
+
}
|
|
102
|
+
return Object.hasOwn(value, key)
|
|
103
|
+
? value[key]
|
|
104
|
+
: undefined;
|
|
105
|
+
}
|
|
62
106
|
export function isWorkflowDelegateAbsent(value) {
|
|
63
107
|
return value == null || (typeof value === "string" && value.trim() === "");
|
|
64
108
|
}
|
|
@@ -82,16 +126,23 @@ export function asPreflightDelegateInput(delegate) {
|
|
|
82
126
|
curator: {
|
|
83
127
|
cli_name: delegate.curator.cli_name,
|
|
84
128
|
role: delegate.curator.role,
|
|
129
|
+
...(delegate.curator.model === undefined ? {} : { model: delegate.curator.model }),
|
|
130
|
+
...(delegate.curator.effort === undefined ? {} : { effort: delegate.curator.effort }),
|
|
85
131
|
},
|
|
86
132
|
finalizer: {
|
|
87
133
|
cli_name: delegate.finalizer.cli_name,
|
|
88
134
|
role: delegate.finalizer.role,
|
|
89
135
|
...(delegate.finalizer.enabled === undefined ? {} : { enabled: delegate.finalizer.enabled }),
|
|
90
136
|
min_score: delegate.finalizer.min_score,
|
|
137
|
+
...(delegate.finalizer.model === undefined ? {} : { model: delegate.finalizer.model }),
|
|
138
|
+
...(delegate.finalizer.effort === undefined ? {} : { effort: delegate.finalizer.effort }),
|
|
91
139
|
},
|
|
92
140
|
...(delegate.timeout_seconds === undefined ? {} : { timeout_seconds: delegate.timeout_seconds }),
|
|
93
141
|
...(delegate.max_response_chars === undefined ? {} : { max_response_chars: delegate.max_response_chars }),
|
|
94
142
|
...(delegate.failure_policy === undefined ? {} : { failure_policy: delegate.failure_policy }),
|
|
143
|
+
...(delegate.external_gap_policy === undefined
|
|
144
|
+
? {}
|
|
145
|
+
: { external_gap_policy: delegate.external_gap_policy }),
|
|
95
146
|
};
|
|
96
147
|
}
|
|
97
148
|
//# sourceMappingURL=delegate-validate.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delegate-validate.js","sourceRoot":"","sources":["../src/delegate-validate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,MAAM,oCAAoC,GAAG,GAAG,CAAC;AACjD,MAAM,4BAA4B,GAAG,GAAG,CAAC;AACzC,MAAM,2BAA2B,GAAG,OAAO,CAAC;AAE5C,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"delegate-validate.js","sourceRoot":"","sources":["../src/delegate-validate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,MAAM,oCAAoC,GAAG,GAAG,CAAC;AACjD,MAAM,4BAA4B,GAAG,GAAG,CAAC;AACzC,MAAM,2BAA2B,GAAG,OAAO,CAAC;AAE5C,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AACtD,0FAA0F;AAC1F,MAAM,WAAW,GAAG,CAAC;KAClB,MAAM,EAAE;KACR,IAAI,EAAE;KACN,GAAG,CAAC,CAAC,CAAC;KACN,GAAG,CAAC,GAAG,CAAC;KACR,KAAK,CAAC,4BAA4B,CAAC,CAAC;AACvC,4FAA4F;AAC5F,MAAM,YAAY,GAAG,CAAC;KACnB,MAAM,EAAE;KACR,IAAI,EAAE;KACN,GAAG,CAAC,CAAC,CAAC;KACN,GAAG,CAAC,EAAE,CAAC;KACP,KAAK,CA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QAAQ,CAAC,eAAe,EAAE,CAAC;QAChG,GAAG,CAAC,QAAQ,CAAC,kBAAkB,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,kBAAkB,EAAE,QAAQ,CAAC,kBAAkB,EAAE,CAAC;QACzG,GAAG,CAAC,QAAQ,CAAC,cAAc,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,cAAc,EAAE,QAAQ,CAAC,cAAc,EAAE,CAAC;QAC7F,GAAG,CAAC,QAAQ,CAAC,mBAAmB,KAAK,SAAS;YAC5C,CAAC,CAAC,EAAE;YACJ,CAAC,CAAC,EAAE,mBAAmB,EAAE,QAAQ,CAAC,mBAAmB,EAAE,CAAC;KAC3D,CAAC;AACJ,CAAC"}
|
|
@@ -68,6 +68,7 @@ import { type CouncilPlanReviewError } from "./plan-review/publication.js";
|
|
|
68
68
|
import { type ChildFailureMetadata } from "./errors.js";
|
|
69
69
|
import { type FidelityReport } from "./fidelity.js";
|
|
70
70
|
import type { CallState, FailureClass, RunStatus } from "./state-schema.js";
|
|
71
|
+
import type { InvocationAuditWrite, ObservedInvocationV1 } from "./dashboard/invocation-contract.js";
|
|
71
72
|
import type { ClinkBackend } from "./backend.js";
|
|
72
73
|
import type { ValidatorRegistry } from "./validators/index.js";
|
|
73
74
|
import { type ArtifactRecord } from "./artifacts.js";
|
|
@@ -136,6 +137,8 @@ export interface EngineCallPreparedEvent {
|
|
|
136
137
|
readonly retryCount: number;
|
|
137
138
|
readonly contextProducing: boolean;
|
|
138
139
|
readonly input: Readonly<Record<string, unknown>>;
|
|
140
|
+
/** Root-injected model/effort audit. Omitted when no derive hook is wired. */
|
|
141
|
+
readonly invocation?: InvocationAuditWrite | undefined;
|
|
139
142
|
}
|
|
140
143
|
export interface EngineCallStateChange {
|
|
141
144
|
readonly runId: string;
|
|
@@ -154,6 +157,14 @@ export interface EngineCallStateChange {
|
|
|
154
157
|
readonly fidelity?: FidelityReport | undefined;
|
|
155
158
|
readonly artifact?: ArtifactRecord | undefined;
|
|
156
159
|
readonly childDebugMetadata?: ChildFailureMetadata | undefined;
|
|
160
|
+
/**
|
|
161
|
+
* Runtime-observed model/effort knobs from the child `_debug` block.
|
|
162
|
+
* Attached only on the terminal succeeded emit today: the failed path
|
|
163
|
+
* carries childDebugMetadata, whose ChildFailureMetadata shape has no
|
|
164
|
+
* observed_invocation field, so failed events omit it. Never attached on
|
|
165
|
+
* running events or intermediate retry failures. Telemetry-only.
|
|
166
|
+
*/
|
|
167
|
+
readonly observedInvocation?: ObservedInvocationV1 | undefined;
|
|
157
168
|
}
|
|
158
169
|
export interface EngineRetryEvent {
|
|
159
170
|
readonly runId: string;
|
|
@@ -242,7 +253,25 @@ export interface WorkflowEngineOptions {
|
|
|
242
253
|
readonly commitPlanReviewContextProvenance?: ((provenance: PlanReviewContextProvenance) => Promise<void>) | undefined;
|
|
243
254
|
/** Narrow opt-in terminal projection. All existing workflows use final_call. */
|
|
244
255
|
readonly terminalResultPolicy?: EngineTerminalResultPolicy | undefined;
|
|
256
|
+
/**
|
|
257
|
+
* Optional root-injected model/effort provenance audit. The engine has no
|
|
258
|
+
* adapter registry and cannot derive `adapter_pin` itself. Standalone
|
|
259
|
+
* servers omit this; prepared events then carry no `invocation`.
|
|
260
|
+
*/
|
|
261
|
+
readonly deriveInvocationAudit?: (cliName: string, role: string, knobs: {
|
|
262
|
+
model?: string;
|
|
263
|
+
effort?: string;
|
|
264
|
+
}) => InvocationAuditWrite;
|
|
245
265
|
}
|
|
266
|
+
/**
|
|
267
|
+
* The allowed roots a workflow engine derives for itself when the caller supplies
|
|
268
|
+
* none. Exported so admission-time path checks can validate against the SAME set
|
|
269
|
+
* the engine will enforce at dispatch, rather than re-deriving a near-copy.
|
|
270
|
+
*
|
|
271
|
+
* Note this set is engine-owned: `CLINKX_ALLOWED_ROOTS` is not consulted and
|
|
272
|
+
* cannot widen it.
|
|
273
|
+
*/
|
|
274
|
+
export declare function defaultWorkflowAllowedRoots(runDir: string): readonly string[];
|
|
246
275
|
export declare class WorkflowEngine {
|
|
247
276
|
private readonly definition;
|
|
248
277
|
private readonly session;
|
|
@@ -276,8 +305,31 @@ export declare class WorkflowEngine {
|
|
|
276
305
|
private readonly planReviewCallBindings;
|
|
277
306
|
private readonly commitPlanReviewContextProvenance;
|
|
278
307
|
private readonly terminalResultPolicy;
|
|
308
|
+
private readonly deriveInvocationAudit;
|
|
309
|
+
/**
|
|
310
|
+
* Workflow budget expiry on the MONOTONIC clock (`monotonicNowMs()`), not on
|
|
311
|
+
* the wall clock. Never compare it to `Date.now()`; read it only through
|
|
312
|
+
* `workflowRemainingMs()`.
|
|
313
|
+
*/
|
|
314
|
+
private workflowDeadlineAtMonoMs;
|
|
315
|
+
/**
|
|
316
|
+
* `stage.id`.`call.id` keys already written to a terminal state by
|
|
317
|
+
* `emitTerminalCallAbort`. A parallel stage still surfaces that throw through
|
|
318
|
+
* `materializeUnexpectedFailure`, whose emit carries no startedAt/durationMs
|
|
319
|
+
* and attempt 1 / retryCount 0 — persisted unconditionally, it would erase the
|
|
320
|
+
* terminal entry's timing. Bounded by the run's call count.
|
|
321
|
+
*/
|
|
322
|
+
private readonly terminalizedCallKeys;
|
|
279
323
|
constructor(options: WorkflowEngineOptions);
|
|
280
324
|
execute(): Promise<WorkflowExecutionResult>;
|
|
325
|
+
/**
|
|
326
|
+
* Resume-path entry point. `execute()` is never called on the resume preflight
|
|
327
|
+
* engine, so without this the deadline is never installed and the
|
|
328
|
+
* curator/finalizer delegate runs unbounded. Installs the SAME fresh full
|
|
329
|
+
* `timeout_seconds` budget a resumed run gets (D1), runs preflight under it,
|
|
330
|
+
* and always tears it down.
|
|
331
|
+
*/
|
|
332
|
+
prepareContextPreflightWithDeadline(): Promise<void>;
|
|
281
333
|
/**
|
|
282
334
|
* Complete the workflow context gate without dispatching a provider call.
|
|
283
335
|
* Resume uses this before backend construction when workflow_context is absent.
|
|
@@ -287,6 +339,17 @@ export declare class WorkflowEngine {
|
|
|
287
339
|
private executeParallelStage;
|
|
288
340
|
private executeSequentialStage;
|
|
289
341
|
private executeSingleCall;
|
|
342
|
+
/**
|
|
343
|
+
* Terminalize a call that is about to be abandoned by a throw rather than
|
|
344
|
+
* by the retry loop's own failure path.
|
|
345
|
+
*
|
|
346
|
+
* Both abort/deadline exits from executeSingleCall leave the loop OUTSIDE
|
|
347
|
+
* the attempt `try`, so without this the persisted entry is stranded as
|
|
348
|
+
* "running" with no completedAt — a durable lie that resume, the dashboard
|
|
349
|
+
* and run health all read. The caller still rethrows: this only records the
|
|
350
|
+
* outcome, it never swallows it.
|
|
351
|
+
*/
|
|
352
|
+
private emitTerminalCallAbort;
|
|
290
353
|
/**
|
|
291
354
|
* F4: bounded corrective suffix for the next already-scheduled retry after
|
|
292
355
|
* a JSON/schema-shaped failure. Returns undefined (no suffix) unless ALL of:
|
|
@@ -305,8 +368,24 @@ export declare class WorkflowEngine {
|
|
|
305
368
|
* The suffix is always derived from the ORIGINAL prompt, so it can never
|
|
306
369
|
* stack across attempts, and it is never persisted to state.
|
|
307
370
|
*/
|
|
371
|
+
/**
|
|
372
|
+
* Typed plan review (identity: the plan-review-receipts workflow name, plus
|
|
373
|
+
* the plan-review runtime signals as defense-in-depth). Its dispatch bytes
|
|
374
|
+
* and retry behavior are pinned, so no corrective machinery may touch it.
|
|
375
|
+
*/
|
|
376
|
+
private isTypedPlanReviewCall;
|
|
377
|
+
/**
|
|
378
|
+
* D7: under retry.mode "transport_only" a malformed-JSON answer is a
|
|
379
|
+
* permanent failure, so it would never be retried. A JSON-contract call gets
|
|
380
|
+
* ONE corrective attempt when the failure is primarily JSON-shaped; a
|
|
381
|
+
* secondary-only invalid_json_output reason never creates eligibility.
|
|
382
|
+
* failureClass is not reclassified.
|
|
383
|
+
*/
|
|
384
|
+
private isCorrectiveRetryEligible;
|
|
308
385
|
private buildCorrectiveRetrySuffix;
|
|
309
386
|
private invokeCall;
|
|
387
|
+
private computeDispatchDeadline;
|
|
388
|
+
private prepareDispatchInput;
|
|
310
389
|
private maybeWriteArtifact;
|
|
311
390
|
private resolveDynamicPaths;
|
|
312
391
|
private resolveDynamicPathVariable;
|
|
@@ -322,11 +401,25 @@ export declare class WorkflowEngine {
|
|
|
322
401
|
private deriveContextAvailable;
|
|
323
402
|
/**
|
|
324
403
|
* Build the citation allowlist for a post-processor run: the union of files
|
|
325
|
-
* parsed from the `diff_context` variable, the resolved `context_files`,
|
|
326
|
-
*
|
|
327
|
-
*
|
|
404
|
+
* parsed from the `diff_context` variable, the resolved `context_files`, the
|
|
405
|
+
* resolved `context_bundle_files`, and the source files selected by any
|
|
406
|
+
* curated context-builder bundle among them. Both full paths and basenames
|
|
407
|
+
* are stored so citation matching is lenient.
|
|
408
|
+
*
|
|
409
|
+
* A curated preflight copies only `bundle.md` and `manifest.json` into
|
|
410
|
+
* `context_bundle_files`, so without the manifest's `selected_context`
|
|
411
|
+
* every citation to a real source file would be stripped. Reading from the
|
|
412
|
+
* (persisted) variable keeps this working on resume.
|
|
328
413
|
*/
|
|
329
414
|
private buildPostProcessorAllowlist;
|
|
415
|
+
/**
|
|
416
|
+
* Add each `selected_context` entry of a context-builder manifest to the
|
|
417
|
+
* allowlist: its root-relative `path` and, when its root resolves, the
|
|
418
|
+
* absolute form. The allowlist is advisory, so an unreadable, oversized
|
|
419
|
+
* (> 8 MiB), non-JSON, or non-context-builder manifest is skipped silently
|
|
420
|
+
* and malformed entries are ignored.
|
|
421
|
+
*/
|
|
422
|
+
private addCuratedBundleSelections;
|
|
330
423
|
/**
|
|
331
424
|
* Resolve a path-list variable to absolute paths without enforcing allowed
|
|
332
425
|
* roots (the post-processor allowlist is advisory, not a security boundary).
|
|
@@ -350,12 +443,29 @@ export declare class WorkflowEngine {
|
|
|
350
443
|
private readOptionalBooleanVariable;
|
|
351
444
|
private readStringArrayVariable;
|
|
352
445
|
private createDeadlineController;
|
|
446
|
+
/** Remaining workflow budget in ms; undefined when no deadline is installed. */
|
|
447
|
+
private workflowRemainingMs;
|
|
448
|
+
/**
|
|
449
|
+
* True only while a workflow deadline is set AND already past. Pure: reads
|
|
450
|
+
* the deadline the running `execute()` installed and the clock, nothing else.
|
|
451
|
+
* `execute()` clears `workflowDeadlineAtMonoMs` in its `finally`, so this can
|
|
452
|
+
* never report a stale deadline from a prior run. The reading is monotonic:
|
|
453
|
+
* a wall-clock step (NTP correction, suspend/resume, manual change) can
|
|
454
|
+
* neither manufacture nor erase an exhausted budget.
|
|
455
|
+
*/
|
|
456
|
+
private isWorkflowDeadlineExhausted;
|
|
353
457
|
private throwIfAborted;
|
|
354
458
|
private validateFinalStage;
|
|
355
459
|
private validateAdvertisedCliNames;
|
|
356
460
|
private defaultAllowedRoots;
|
|
357
461
|
private recordPlanReviewDeliveredAliases;
|
|
358
462
|
private buildCallInput;
|
|
463
|
+
/**
|
|
464
|
+
* Derive a per-call invocation audit from the materialized input.
|
|
465
|
+
* Uses the dispatched cli_name/role (plan-review bindings may rewrite
|
|
466
|
+
* cli_name on resume) and never mutates `input`.
|
|
467
|
+
*/
|
|
468
|
+
private maybeInvocationAudit;
|
|
359
469
|
private materializeUnexpectedFailure;
|
|
360
470
|
private emitRunStateChange;
|
|
361
471
|
private emitCallPrepared;
|