@principles/core 1.73.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/dist/adapters/code-review/code-review-pain-adapter.d.ts +13 -0
- package/dist/adapters/code-review/code-review-pain-adapter.d.ts.map +1 -0
- package/dist/adapters/code-review/code-review-pain-adapter.js +139 -0
- package/dist/adapters/code-review/code-review-pain-adapter.js.map +1 -0
- package/dist/adapters/code-review/index.d.ts +6 -0
- package/dist/adapters/code-review/index.d.ts.map +1 -0
- package/dist/adapters/code-review/index.js +2 -0
- package/dist/adapters/code-review/index.js.map +1 -0
- package/dist/adapters/code-review/review-event-types.d.ts +54 -0
- package/dist/adapters/code-review/review-event-types.d.ts.map +1 -0
- package/dist/adapters/code-review/review-event-types.js +8 -0
- package/dist/adapters/code-review/review-event-types.js.map +1 -0
- package/dist/adapters/coding/index.d.ts +6 -0
- package/dist/adapters/coding/index.d.ts.map +1 -0
- package/dist/adapters/coding/index.js +5 -0
- package/dist/adapters/coding/index.js.map +1 -0
- package/dist/adapters/coding/openclaw-event-types.d.ts +26 -0
- package/dist/adapters/coding/openclaw-event-types.d.ts.map +1 -0
- package/dist/adapters/coding/openclaw-event-types.js +9 -0
- package/dist/adapters/coding/openclaw-event-types.js.map +1 -0
- package/dist/adapters/coding/openclaw-pain-adapter.d.ts +27 -0
- package/dist/adapters/coding/openclaw-pain-adapter.d.ts.map +1 -0
- package/dist/adapters/coding/openclaw-pain-adapter.js +102 -0
- package/dist/adapters/coding/openclaw-pain-adapter.js.map +1 -0
- package/dist/adapters/writing/index.d.ts +6 -0
- package/dist/adapters/writing/index.d.ts.map +1 -0
- package/dist/adapters/writing/index.js +5 -0
- package/dist/adapters/writing/index.js.map +1 -0
- package/dist/adapters/writing/writing-pain-adapter.d.ts +22 -0
- package/dist/adapters/writing/writing-pain-adapter.d.ts.map +1 -0
- package/dist/adapters/writing/writing-pain-adapter.js +62 -0
- package/dist/adapters/writing/writing-pain-adapter.js.map +1 -0
- package/dist/adapters/writing/writing-types.d.ts +34 -0
- package/dist/adapters/writing/writing-types.d.ts.map +1 -0
- package/dist/adapters/writing/writing-types.js +9 -0
- package/dist/adapters/writing/writing-types.js.map +1 -0
- package/dist/evolution-hook.d.ts +70 -0
- package/dist/evolution-hook.d.ts.map +1 -0
- package/dist/evolution-hook.js +10 -0
- package/dist/evolution-hook.js.map +1 -0
- package/dist/evolution-store.d.ts +56 -0
- package/dist/evolution-store.d.ts.map +1 -0
- package/dist/evolution-store.js +150 -0
- package/dist/evolution-store.js.map +1 -0
- package/dist/index.d.ts +62 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +64 -0
- package/dist/index.js.map +1 -0
- package/dist/io.d.ts +36 -0
- package/dist/io.d.ts.map +1 -0
- package/dist/io.js +99 -0
- package/dist/io.js.map +1 -0
- package/dist/pain-flag-resolver.d.ts +18 -0
- package/dist/pain-flag-resolver.d.ts.map +1 -0
- package/dist/pain-flag-resolver.js +21 -0
- package/dist/pain-flag-resolver.js.map +1 -0
- package/dist/pain-recorder.d.ts +38 -0
- package/dist/pain-recorder.d.ts.map +1 -0
- package/dist/pain-recorder.js +62 -0
- package/dist/pain-recorder.js.map +1 -0
- package/dist/pain-signal-adapter.d.ts +37 -0
- package/dist/pain-signal-adapter.d.ts.map +1 -0
- package/dist/pain-signal-adapter.js +2 -0
- package/dist/pain-signal-adapter.js.map +1 -0
- package/dist/pain-signal.d.ts +76 -0
- package/dist/pain-signal.d.ts.map +1 -0
- package/dist/pain-signal.js +125 -0
- package/dist/pain-signal.js.map +1 -0
- package/dist/principle-injector.d.ts +67 -0
- package/dist/principle-injector.d.ts.map +1 -0
- package/dist/principle-injector.js +89 -0
- package/dist/principle-injector.js.map +1 -0
- package/dist/principle-tree-ledger.d.ts +106 -0
- package/dist/principle-tree-ledger.d.ts.map +1 -0
- package/dist/principle-tree-ledger.js +254 -0
- package/dist/principle-tree-ledger.js.map +1 -0
- package/dist/prompt-builder/__tests__/empathy-keyword-matching.test.d.ts +2 -0
- package/dist/prompt-builder/__tests__/empathy-keyword-matching.test.d.ts.map +1 -0
- package/dist/prompt-builder/__tests__/empathy-keyword-matching.test.js +380 -0
- package/dist/prompt-builder/__tests__/empathy-keyword-matching.test.js.map +1 -0
- package/dist/prompt-builder/__tests__/focus-compression.test.d.ts +2 -0
- package/dist/prompt-builder/__tests__/focus-compression.test.d.ts.map +1 -0
- package/dist/prompt-builder/__tests__/focus-compression.test.js +265 -0
- package/dist/prompt-builder/__tests__/focus-compression.test.js.map +1 -0
- package/dist/prompt-builder/__tests__/principle-selection.test.d.ts +7 -0
- package/dist/prompt-builder/__tests__/principle-selection.test.d.ts.map +1 -0
- package/dist/prompt-builder/__tests__/principle-selection.test.js +214 -0
- package/dist/prompt-builder/__tests__/principle-selection.test.js.map +1 -0
- package/dist/prompt-builder/__tests__/prompt-builder-core.test.d.ts +7 -0
- package/dist/prompt-builder/__tests__/prompt-builder-core.test.d.ts.map +1 -0
- package/dist/prompt-builder/__tests__/prompt-builder-core.test.js +283 -0
- package/dist/prompt-builder/__tests__/prompt-builder-core.test.js.map +1 -0
- package/dist/prompt-builder/__tests__/routing-guidance.test.d.ts +11 -0
- package/dist/prompt-builder/__tests__/routing-guidance.test.d.ts.map +1 -0
- package/dist/prompt-builder/__tests__/routing-guidance.test.js +305 -0
- package/dist/prompt-builder/__tests__/routing-guidance.test.js.map +1 -0
- package/dist/prompt-builder/attitude-directive.d.ts +7 -0
- package/dist/prompt-builder/attitude-directive.d.ts.map +1 -0
- package/dist/prompt-builder/attitude-directive.js +39 -0
- package/dist/prompt-builder/attitude-directive.js.map +1 -0
- package/dist/prompt-builder/correction-cue.d.ts +15 -0
- package/dist/prompt-builder/correction-cue.d.ts.map +1 -0
- package/dist/prompt-builder/correction-cue.js +39 -0
- package/dist/prompt-builder/correction-cue.js.map +1 -0
- package/dist/prompt-builder/empathy-keyword-matching.d.ts +30 -0
- package/dist/prompt-builder/empathy-keyword-matching.d.ts.map +1 -0
- package/dist/prompt-builder/empathy-keyword-matching.js +142 -0
- package/dist/prompt-builder/empathy-keyword-matching.js.map +1 -0
- package/dist/prompt-builder/empathy-types.d.ts +62 -0
- package/dist/prompt-builder/empathy-types.d.ts.map +1 -0
- package/dist/prompt-builder/empathy-types.js +88 -0
- package/dist/prompt-builder/empathy-types.js.map +1 -0
- package/dist/prompt-builder/focus-compression.d.ts +63 -0
- package/dist/prompt-builder/focus-compression.d.ts.map +1 -0
- package/dist/prompt-builder/focus-compression.js +448 -0
- package/dist/prompt-builder/focus-compression.js.map +1 -0
- package/dist/prompt-builder/index.d.ts +29 -0
- package/dist/prompt-builder/index.d.ts.map +1 -0
- package/dist/prompt-builder/index.js +27 -0
- package/dist/prompt-builder/index.js.map +1 -0
- package/dist/prompt-builder/message-extraction.d.ts +7 -0
- package/dist/prompt-builder/message-extraction.d.ts.map +1 -0
- package/dist/prompt-builder/message-extraction.js +23 -0
- package/dist/prompt-builder/message-extraction.js.map +1 -0
- package/dist/prompt-builder/minimal-trigger.d.ts +7 -0
- package/dist/prompt-builder/minimal-trigger.d.ts.map +1 -0
- package/dist/prompt-builder/minimal-trigger.js +11 -0
- package/dist/prompt-builder/minimal-trigger.js.map +1 -0
- package/dist/prompt-builder/principle-selection.d.ts +68 -0
- package/dist/prompt-builder/principle-selection.d.ts.map +1 -0
- package/dist/prompt-builder/principle-selection.js +140 -0
- package/dist/prompt-builder/principle-selection.js.map +1 -0
- package/dist/prompt-builder/routing-guidance.d.ts +64 -0
- package/dist/prompt-builder/routing-guidance.d.ts.map +1 -0
- package/dist/prompt-builder/routing-guidance.js +227 -0
- package/dist/prompt-builder/routing-guidance.js.map +1 -0
- package/dist/prompt-builder/size-guard.d.ts +35 -0
- package/dist/prompt-builder/size-guard.d.ts.map +1 -0
- package/dist/prompt-builder/size-guard.js +144 -0
- package/dist/prompt-builder/size-guard.js.map +1 -0
- package/dist/prompt-builder/types.d.ts +28 -0
- package/dist/prompt-builder/types.d.ts.map +1 -0
- package/dist/prompt-builder/types.js +7 -0
- package/dist/prompt-builder/types.js.map +1 -0
- package/dist/runtime-v2/__tests__/admission-gate.test.d.ts +2 -0
- package/dist/runtime-v2/__tests__/admission-gate.test.d.ts.map +1 -0
- package/dist/runtime-v2/__tests__/admission-gate.test.js +126 -0
- package/dist/runtime-v2/__tests__/admission-gate.test.js.map +1 -0
- package/dist/runtime-v2/__tests__/architecture-regression.test.d.ts +2 -0
- package/dist/runtime-v2/__tests__/architecture-regression.test.d.ts.map +1 -0
- package/dist/runtime-v2/__tests__/architecture-regression.test.js +2990 -0
- package/dist/runtime-v2/__tests__/architecture-regression.test.js.map +1 -0
- package/dist/runtime-v2/__tests__/artificer-runner-vslice.test.d.ts +2 -0
- package/dist/runtime-v2/__tests__/artificer-runner-vslice.test.d.ts.map +1 -0
- package/dist/runtime-v2/__tests__/artificer-runner-vslice.test.js +608 -0
- package/dist/runtime-v2/__tests__/artificer-runner-vslice.test.js.map +1 -0
- package/dist/runtime-v2/__tests__/attack-e2e-pipeline-smoke.test.d.ts +20 -0
- package/dist/runtime-v2/__tests__/attack-e2e-pipeline-smoke.test.d.ts.map +1 -0
- package/dist/runtime-v2/__tests__/attack-e2e-pipeline-smoke.test.js +473 -0
- package/dist/runtime-v2/__tests__/attack-e2e-pipeline-smoke.test.js.map +1 -0
- package/dist/runtime-v2/__tests__/candidate-audit.test.d.ts +2 -0
- package/dist/runtime-v2/__tests__/candidate-audit.test.d.ts.map +1 -0
- package/dist/runtime-v2/__tests__/candidate-audit.test.js +100 -0
- package/dist/runtime-v2/__tests__/candidate-audit.test.js.map +1 -0
- package/dist/runtime-v2/__tests__/chain-integrity-attack.test.d.ts +2 -0
- package/dist/runtime-v2/__tests__/chain-integrity-attack.test.d.ts.map +1 -0
- package/dist/runtime-v2/__tests__/chain-integrity-attack.test.js +276 -0
- package/dist/runtime-v2/__tests__/chain-integrity-attack.test.js.map +1 -0
- package/dist/runtime-v2/__tests__/chain-integrity-real-path.test.d.ts +2 -0
- package/dist/runtime-v2/__tests__/chain-integrity-real-path.test.d.ts.map +1 -0
- package/dist/runtime-v2/__tests__/chain-integrity-real-path.test.js +561 -0
- package/dist/runtime-v2/__tests__/chain-integrity-real-path.test.js.map +1 -0
- package/dist/runtime-v2/__tests__/control-plane-triage.test.d.ts +2 -0
- package/dist/runtime-v2/__tests__/control-plane-triage.test.d.ts.map +1 -0
- package/dist/runtime-v2/__tests__/control-plane-triage.test.js +107 -0
- package/dist/runtime-v2/__tests__/control-plane-triage.test.js.map +1 -0
- package/dist/runtime-v2/__tests__/correction-proposal.test.d.ts +2 -0
- package/dist/runtime-v2/__tests__/correction-proposal.test.d.ts.map +1 -0
- package/dist/runtime-v2/__tests__/correction-proposal.test.js +486 -0
- package/dist/runtime-v2/__tests__/correction-proposal.test.js.map +1 -0
- package/dist/runtime-v2/__tests__/dreamer-output-validator.test.d.ts +2 -0
- package/dist/runtime-v2/__tests__/dreamer-output-validator.test.d.ts.map +1 -0
- package/dist/runtime-v2/__tests__/dreamer-output-validator.test.js +171 -0
- package/dist/runtime-v2/__tests__/dreamer-output-validator.test.js.map +1 -0
- package/dist/runtime-v2/__tests__/dreamer-runner-real-llm.test.d.ts +2 -0
- package/dist/runtime-v2/__tests__/dreamer-runner-real-llm.test.d.ts.map +1 -0
- package/dist/runtime-v2/__tests__/dreamer-runner-real-llm.test.js +155 -0
- package/dist/runtime-v2/__tests__/dreamer-runner-real-llm.test.js.map +1 -0
- package/dist/runtime-v2/__tests__/dreamer-runner-vslice.test.d.ts +2 -0
- package/dist/runtime-v2/__tests__/dreamer-runner-vslice.test.d.ts.map +1 -0
- package/dist/runtime-v2/__tests__/dreamer-runner-vslice.test.js +515 -0
- package/dist/runtime-v2/__tests__/dreamer-runner-vslice.test.js.map +1 -0
- package/dist/runtime-v2/__tests__/dreamer-runner.test.d.ts +2 -0
- package/dist/runtime-v2/__tests__/dreamer-runner.test.d.ts.map +1 -0
- package/dist/runtime-v2/__tests__/dreamer-runner.test.js +348 -0
- package/dist/runtime-v2/__tests__/dreamer-runner.test.js.map +1 -0
- package/dist/runtime-v2/__tests__/error-categories.test.d.ts +2 -0
- package/dist/runtime-v2/__tests__/error-categories.test.d.ts.map +1 -0
- package/dist/runtime-v2/__tests__/error-categories.test.js +149 -0
- package/dist/runtime-v2/__tests__/error-categories.test.js.map +1 -0
- package/dist/runtime-v2/__tests__/evaluator-runner-vslice.test.d.ts +2 -0
- package/dist/runtime-v2/__tests__/evaluator-runner-vslice.test.d.ts.map +1 -0
- package/dist/runtime-v2/__tests__/evaluator-runner-vslice.test.js +1047 -0
- package/dist/runtime-v2/__tests__/evaluator-runner-vslice.test.js.map +1 -0
- package/dist/runtime-v2/__tests__/fixtures/index.d.ts +4 -0
- package/dist/runtime-v2/__tests__/fixtures/index.d.ts.map +1 -0
- package/dist/runtime-v2/__tests__/fixtures/index.js +3 -0
- package/dist/runtime-v2/__tests__/fixtures/index.js.map +1 -0
- package/dist/runtime-v2/__tests__/fixtures/llm-e2e-config.d.ts +20 -0
- package/dist/runtime-v2/__tests__/fixtures/llm-e2e-config.d.ts.map +1 -0
- package/dist/runtime-v2/__tests__/fixtures/llm-e2e-config.js +39 -0
- package/dist/runtime-v2/__tests__/fixtures/llm-e2e-config.js.map +1 -0
- package/dist/runtime-v2/__tests__/fixtures/llm-e2e-config.test.d.ts +2 -0
- package/dist/runtime-v2/__tests__/fixtures/llm-e2e-config.test.d.ts.map +1 -0
- package/dist/runtime-v2/__tests__/fixtures/llm-e2e-config.test.js +111 -0
- package/dist/runtime-v2/__tests__/fixtures/llm-e2e-config.test.js.map +1 -0
- package/dist/runtime-v2/__tests__/fixtures/test-helpers.d.ts +20 -0
- package/dist/runtime-v2/__tests__/fixtures/test-helpers.d.ts.map +1 -0
- package/dist/runtime-v2/__tests__/fixtures/test-helpers.js +37 -0
- package/dist/runtime-v2/__tests__/fixtures/test-helpers.js.map +1 -0
- package/dist/runtime-v2/__tests__/full-chain-real-llm.test.d.ts +2 -0
- package/dist/runtime-v2/__tests__/full-chain-real-llm.test.d.ts.map +1 -0
- package/dist/runtime-v2/__tests__/full-chain-real-llm.test.js +152 -0
- package/dist/runtime-v2/__tests__/full-chain-real-llm.test.js.map +1 -0
- package/dist/runtime-v2/__tests__/full-trace-contract.test.d.ts +2 -0
- package/dist/runtime-v2/__tests__/full-trace-contract.test.d.ts.map +1 -0
- package/dist/runtime-v2/__tests__/full-trace-contract.test.js +552 -0
- package/dist/runtime-v2/__tests__/full-trace-contract.test.js.map +1 -0
- package/dist/runtime-v2/__tests__/gfi-workspace-health.test.d.ts +2 -0
- package/dist/runtime-v2/__tests__/gfi-workspace-health.test.d.ts.map +1 -0
- package/dist/runtime-v2/__tests__/gfi-workspace-health.test.js +128 -0
- package/dist/runtime-v2/__tests__/gfi-workspace-health.test.js.map +1 -0
- package/dist/runtime-v2/__tests__/golden-trace-candidate-builder.test.d.ts +2 -0
- package/dist/runtime-v2/__tests__/golden-trace-candidate-builder.test.d.ts.map +1 -0
- package/dist/runtime-v2/__tests__/golden-trace-candidate-builder.test.js +759 -0
- package/dist/runtime-v2/__tests__/golden-trace-candidate-builder.test.js.map +1 -0
- package/dist/runtime-v2/__tests__/golden-trace-replay-validator.test.d.ts +2 -0
- package/dist/runtime-v2/__tests__/golden-trace-replay-validator.test.d.ts.map +1 -0
- package/dist/runtime-v2/__tests__/golden-trace-replay-validator.test.js +231 -0
- package/dist/runtime-v2/__tests__/golden-trace-replay-validator.test.js.map +1 -0
- package/dist/runtime-v2/__tests__/golden-trace.test.d.ts +2 -0
- package/dist/runtime-v2/__tests__/golden-trace.test.d.ts.map +1 -0
- package/dist/runtime-v2/__tests__/golden-trace.test.js +335 -0
- package/dist/runtime-v2/__tests__/golden-trace.test.js.map +1 -0
- package/dist/runtime-v2/__tests__/intake-to-internalization-bridge.test.d.ts +2 -0
- package/dist/runtime-v2/__tests__/intake-to-internalization-bridge.test.d.ts.map +1 -0
- package/dist/runtime-v2/__tests__/intake-to-internalization-bridge.test.js +307 -0
- package/dist/runtime-v2/__tests__/intake-to-internalization-bridge.test.js.map +1 -0
- package/dist/runtime-v2/__tests__/internalization-chain-integrity-read-model.test.d.ts +2 -0
- package/dist/runtime-v2/__tests__/internalization-chain-integrity-read-model.test.d.ts.map +1 -0
- package/dist/runtime-v2/__tests__/internalization-chain-integrity-read-model.test.js +268 -0
- package/dist/runtime-v2/__tests__/internalization-chain-integrity-read-model.test.js.map +1 -0
- package/dist/runtime-v2/__tests__/internalization-contracts.test.d.ts +2 -0
- package/dist/runtime-v2/__tests__/internalization-contracts.test.d.ts.map +1 -0
- package/dist/runtime-v2/__tests__/internalization-contracts.test.js +78 -0
- package/dist/runtime-v2/__tests__/internalization-contracts.test.js.map +1 -0
- package/dist/runtime-v2/__tests__/internalization-integrity-remediation.test.d.ts +2 -0
- package/dist/runtime-v2/__tests__/internalization-integrity-remediation.test.d.ts.map +1 -0
- package/dist/runtime-v2/__tests__/internalization-integrity-remediation.test.js +218 -0
- package/dist/runtime-v2/__tests__/internalization-integrity-remediation.test.js.map +1 -0
- package/dist/runtime-v2/__tests__/internalization-orchestrator.test.d.ts +2 -0
- package/dist/runtime-v2/__tests__/internalization-orchestrator.test.d.ts.map +1 -0
- package/dist/runtime-v2/__tests__/internalization-orchestrator.test.js +569 -0
- package/dist/runtime-v2/__tests__/internalization-orchestrator.test.js.map +1 -0
- package/dist/runtime-v2/__tests__/internalization-peer-runner-contracts.test.d.ts +2 -0
- package/dist/runtime-v2/__tests__/internalization-peer-runner-contracts.test.d.ts.map +1 -0
- package/dist/runtime-v2/__tests__/internalization-peer-runner-contracts.test.js +448 -0
- package/dist/runtime-v2/__tests__/internalization-peer-runner-contracts.test.js.map +1 -0
- package/dist/runtime-v2/__tests__/internalization-queue-read-model.test.d.ts +2 -0
- package/dist/runtime-v2/__tests__/internalization-queue-read-model.test.d.ts.map +1 -0
- package/dist/runtime-v2/__tests__/internalization-queue-read-model.test.js +415 -0
- package/dist/runtime-v2/__tests__/internalization-queue-read-model.test.js.map +1 -0
- package/dist/runtime-v2/__tests__/internalization-route.test.d.ts +2 -0
- package/dist/runtime-v2/__tests__/internalization-route.test.d.ts.map +1 -0
- package/dist/runtime-v2/__tests__/internalization-route.test.js +136 -0
- package/dist/runtime-v2/__tests__/internalization-route.test.js.map +1 -0
- package/dist/runtime-v2/__tests__/internalization-state-machine.test.d.ts +2 -0
- package/dist/runtime-v2/__tests__/internalization-state-machine.test.d.ts.map +1 -0
- package/dist/runtime-v2/__tests__/internalization-state-machine.test.js +679 -0
- package/dist/runtime-v2/__tests__/internalization-state-machine.test.js.map +1 -0
- package/dist/runtime-v2/__tests__/l1-hard-cap.test.d.ts +2 -0
- package/dist/runtime-v2/__tests__/l1-hard-cap.test.d.ts.map +1 -0
- package/dist/runtime-v2/__tests__/l1-hard-cap.test.js +157 -0
- package/dist/runtime-v2/__tests__/l1-hard-cap.test.js.map +1 -0
- package/dist/runtime-v2/__tests__/nocturnal-compliance-trust-boundary.test.d.ts +2 -0
- package/dist/runtime-v2/__tests__/nocturnal-compliance-trust-boundary.test.d.ts.map +1 -0
- package/dist/runtime-v2/__tests__/nocturnal-compliance-trust-boundary.test.js +215 -0
- package/dist/runtime-v2/__tests__/nocturnal-compliance-trust-boundary.test.js.map +1 -0
- package/dist/runtime-v2/__tests__/operator-health-cold-start-guard.test.d.ts +2 -0
- package/dist/runtime-v2/__tests__/operator-health-cold-start-guard.test.d.ts.map +1 -0
- package/dist/runtime-v2/__tests__/operator-health-cold-start-guard.test.js +102 -0
- package/dist/runtime-v2/__tests__/operator-health-cold-start-guard.test.js.map +1 -0
- package/dist/runtime-v2/__tests__/operator-health-gfi-degraded.test.d.ts +2 -0
- package/dist/runtime-v2/__tests__/operator-health-gfi-degraded.test.d.ts.map +1 -0
- package/dist/runtime-v2/__tests__/operator-health-gfi-degraded.test.js +148 -0
- package/dist/runtime-v2/__tests__/operator-health-gfi-degraded.test.js.map +1 -0
- package/dist/runtime-v2/__tests__/operator-health-gfi.test.d.ts +2 -0
- package/dist/runtime-v2/__tests__/operator-health-gfi.test.d.ts.map +1 -0
- package/dist/runtime-v2/__tests__/operator-health-gfi.test.js +113 -0
- package/dist/runtime-v2/__tests__/operator-health-gfi.test.js.map +1 -0
- package/dist/runtime-v2/__tests__/operator-health-read-model.test.d.ts +2 -0
- package/dist/runtime-v2/__tests__/operator-health-read-model.test.d.ts.map +1 -0
- package/dist/runtime-v2/__tests__/operator-health-read-model.test.js +136 -0
- package/dist/runtime-v2/__tests__/operator-health-read-model.test.js.map +1 -0
- package/dist/runtime-v2/__tests__/pain-chain-read-model.test.d.ts +2 -0
- package/dist/runtime-v2/__tests__/pain-chain-read-model.test.d.ts.map +1 -0
- package/dist/runtime-v2/__tests__/pain-chain-read-model.test.js +248 -0
- package/dist/runtime-v2/__tests__/pain-chain-read-model.test.js.map +1 -0
- package/dist/runtime-v2/__tests__/pain-evidence-contract.test.d.ts +2 -0
- package/dist/runtime-v2/__tests__/pain-evidence-contract.test.d.ts.map +1 -0
- package/dist/runtime-v2/__tests__/pain-evidence-contract.test.js +328 -0
- package/dist/runtime-v2/__tests__/pain-evidence-contract.test.js.map +1 -0
- package/dist/runtime-v2/__tests__/pain-flood-simulation.test.d.ts +2 -0
- package/dist/runtime-v2/__tests__/pain-flood-simulation.test.d.ts.map +1 -0
- package/dist/runtime-v2/__tests__/pain-flood-simulation.test.js +267 -0
- package/dist/runtime-v2/__tests__/pain-flood-simulation.test.js.map +1 -0
- package/dist/runtime-v2/__tests__/pain-signal-bridge-retried.test.d.ts +2 -0
- package/dist/runtime-v2/__tests__/pain-signal-bridge-retried.test.d.ts.map +1 -0
- package/dist/runtime-v2/__tests__/pain-signal-bridge-retried.test.js +147 -0
- package/dist/runtime-v2/__tests__/pain-signal-bridge-retried.test.js.map +1 -0
- package/dist/runtime-v2/__tests__/pain-signal-observability.test.d.ts +2 -0
- package/dist/runtime-v2/__tests__/pain-signal-observability.test.d.ts.map +1 -0
- package/dist/runtime-v2/__tests__/pain-signal-observability.test.js +151 -0
- package/dist/runtime-v2/__tests__/pain-signal-observability.test.js.map +1 -0
- package/dist/runtime-v2/__tests__/pain-to-principle-service.test.d.ts +2 -0
- package/dist/runtime-v2/__tests__/pain-to-principle-service.test.d.ts.map +1 -0
- package/dist/runtime-v2/__tests__/pain-to-principle-service.test.js +209 -0
- package/dist/runtime-v2/__tests__/pain-to-principle-service.test.js.map +1 -0
- package/dist/runtime-v2/__tests__/philosopher-runner-real-llm.test.d.ts +2 -0
- package/dist/runtime-v2/__tests__/philosopher-runner-real-llm.test.d.ts.map +1 -0
- package/dist/runtime-v2/__tests__/philosopher-runner-real-llm.test.js +167 -0
- package/dist/runtime-v2/__tests__/philosopher-runner-real-llm.test.js.map +1 -0
- package/dist/runtime-v2/__tests__/philosopher-runner-vslice.test.d.ts +2 -0
- package/dist/runtime-v2/__tests__/philosopher-runner-vslice.test.d.ts.map +1 -0
- package/dist/runtime-v2/__tests__/philosopher-runner-vslice.test.js +338 -0
- package/dist/runtime-v2/__tests__/philosopher-runner-vslice.test.js.map +1 -0
- package/dist/runtime-v2/__tests__/pi-artifact-store.test.d.ts +2 -0
- package/dist/runtime-v2/__tests__/pi-artifact-store.test.d.ts.map +1 -0
- package/dist/runtime-v2/__tests__/pi-artifact-store.test.js +247 -0
- package/dist/runtime-v2/__tests__/pi-artifact-store.test.js.map +1 -0
- package/dist/runtime-v2/__tests__/pitask-metadata.test.d.ts +8 -0
- package/dist/runtime-v2/__tests__/pitask-metadata.test.d.ts.map +1 -0
- package/dist/runtime-v2/__tests__/pitask-metadata.test.js +333 -0
- package/dist/runtime-v2/__tests__/pitask-metadata.test.js.map +1 -0
- package/dist/runtime-v2/__tests__/principle-compiler-core.test.d.ts +2 -0
- package/dist/runtime-v2/__tests__/principle-compiler-core.test.d.ts.map +1 -0
- package/dist/runtime-v2/__tests__/principle-compiler-core.test.js +141 -0
- package/dist/runtime-v2/__tests__/principle-compiler-core.test.js.map +1 -0
- package/dist/runtime-v2/__tests__/production-canary-fixture-gate.test.d.ts +2 -0
- package/dist/runtime-v2/__tests__/production-canary-fixture-gate.test.d.ts.map +1 -0
- package/dist/runtime-v2/__tests__/production-canary-fixture-gate.test.js +524 -0
- package/dist/runtime-v2/__tests__/production-canary-fixture-gate.test.js.map +1 -0
- package/dist/runtime-v2/__tests__/proven-channel-baseline.test.d.ts +2 -0
- package/dist/runtime-v2/__tests__/proven-channel-baseline.test.d.ts.map +1 -0
- package/dist/runtime-v2/__tests__/proven-channel-baseline.test.js +428 -0
- package/dist/runtime-v2/__tests__/proven-channel-baseline.test.js.map +1 -0
- package/dist/runtime-v2/__tests__/pruning-read-model.test.d.ts +2 -0
- package/dist/runtime-v2/__tests__/pruning-read-model.test.d.ts.map +1 -0
- package/dist/runtime-v2/__tests__/pruning-read-model.test.js +783 -0
- package/dist/runtime-v2/__tests__/pruning-read-model.test.js.map +1 -0
- package/dist/runtime-v2/__tests__/pruning-review-log.test.d.ts +2 -0
- package/dist/runtime-v2/__tests__/pruning-review-log.test.d.ts.map +1 -0
- package/dist/runtime-v2/__tests__/pruning-review-log.test.js +159 -0
- package/dist/runtime-v2/__tests__/pruning-review-log.test.js.map +1 -0
- package/dist/runtime-v2/__tests__/recovery-sweep-service.test.d.ts +2 -0
- package/dist/runtime-v2/__tests__/recovery-sweep-service.test.d.ts.map +1 -0
- package/dist/runtime-v2/__tests__/recovery-sweep-service.test.js +83 -0
- package/dist/runtime-v2/__tests__/recovery-sweep-service.test.js.map +1 -0
- package/dist/runtime-v2/__tests__/remediation-contract.test.d.ts +2 -0
- package/dist/runtime-v2/__tests__/remediation-contract.test.d.ts.map +1 -0
- package/dist/runtime-v2/__tests__/remediation-contract.test.js +39 -0
- package/dist/runtime-v2/__tests__/remediation-contract.test.js.map +1 -0
- package/dist/runtime-v2/__tests__/rollout-reviewer-runner-vslice.test.d.ts +2 -0
- package/dist/runtime-v2/__tests__/rollout-reviewer-runner-vslice.test.d.ts.map +1 -0
- package/dist/runtime-v2/__tests__/rollout-reviewer-runner-vslice.test.js +658 -0
- package/dist/runtime-v2/__tests__/rollout-reviewer-runner-vslice.test.js.map +1 -0
- package/dist/runtime-v2/__tests__/rule-host-evaluator.test.d.ts +2 -0
- package/dist/runtime-v2/__tests__/rule-host-evaluator.test.d.ts.map +1 -0
- package/dist/runtime-v2/__tests__/rule-host-evaluator.test.js +509 -0
- package/dist/runtime-v2/__tests__/rule-host-evaluator.test.js.map +1 -0
- package/dist/runtime-v2/__tests__/rulehost-oob-defense-simulation.test.d.ts +2 -0
- package/dist/runtime-v2/__tests__/rulehost-oob-defense-simulation.test.d.ts.map +1 -0
- package/dist/runtime-v2/__tests__/rulehost-oob-defense-simulation.test.js +535 -0
- package/dist/runtime-v2/__tests__/rulehost-oob-defense-simulation.test.js.map +1 -0
- package/dist/runtime-v2/__tests__/runtime-config-boundary.test.d.ts +2 -0
- package/dist/runtime-v2/__tests__/runtime-config-boundary.test.d.ts.map +1 -0
- package/dist/runtime-v2/__tests__/runtime-config-boundary.test.js +256 -0
- package/dist/runtime-v2/__tests__/runtime-config-boundary.test.js.map +1 -0
- package/dist/runtime-v2/__tests__/runtime-state-handle.test.d.ts +2 -0
- package/dist/runtime-v2/__tests__/runtime-state-handle.test.d.ts.map +1 -0
- package/dist/runtime-v2/__tests__/runtime-state-handle.test.js +76 -0
- package/dist/runtime-v2/__tests__/runtime-state-handle.test.js.map +1 -0
- package/dist/runtime-v2/__tests__/schema-conformance-read-model.test.d.ts +2 -0
- package/dist/runtime-v2/__tests__/schema-conformance-read-model.test.d.ts.map +1 -0
- package/dist/runtime-v2/__tests__/schema-conformance-read-model.test.js +208 -0
- package/dist/runtime-v2/__tests__/schema-conformance-read-model.test.js.map +1 -0
- package/dist/runtime-v2/__tests__/scribe-runner-real-llm.test.d.ts +2 -0
- package/dist/runtime-v2/__tests__/scribe-runner-real-llm.test.d.ts.map +1 -0
- package/dist/runtime-v2/__tests__/scribe-runner-real-llm.test.js +156 -0
- package/dist/runtime-v2/__tests__/scribe-runner-real-llm.test.js.map +1 -0
- package/dist/runtime-v2/__tests__/scribe-runner-vslice.test.d.ts +2 -0
- package/dist/runtime-v2/__tests__/scribe-runner-vslice.test.d.ts.map +1 -0
- package/dist/runtime-v2/__tests__/scribe-runner-vslice.test.js +430 -0
- package/dist/runtime-v2/__tests__/scribe-runner-vslice.test.js.map +1 -0
- package/dist/runtime-v2/__tests__/sqlite-confirm-first-state-store.test.d.ts +2 -0
- package/dist/runtime-v2/__tests__/sqlite-confirm-first-state-store.test.d.ts.map +1 -0
- package/dist/runtime-v2/__tests__/sqlite-confirm-first-state-store.test.js +148 -0
- package/dist/runtime-v2/__tests__/sqlite-confirm-first-state-store.test.js.map +1 -0
- package/dist/runtime-v2/__tests__/sqlite-connection-readonly.test.d.ts +2 -0
- package/dist/runtime-v2/__tests__/sqlite-connection-readonly.test.d.ts.map +1 -0
- package/dist/runtime-v2/__tests__/sqlite-connection-readonly.test.js +95 -0
- package/dist/runtime-v2/__tests__/sqlite-connection-readonly.test.js.map +1 -0
- package/dist/runtime-v2/__tests__/story-a-demo.test.d.ts +2 -0
- package/dist/runtime-v2/__tests__/story-a-demo.test.d.ts.map +1 -0
- package/dist/runtime-v2/__tests__/story-a-demo.test.js +257 -0
- package/dist/runtime-v2/__tests__/story-a-demo.test.js.map +1 -0
- package/dist/runtime-v2/__tests__/synthetic-baseline.test.d.ts +2 -0
- package/dist/runtime-v2/__tests__/synthetic-baseline.test.d.ts.map +1 -0
- package/dist/runtime-v2/__tests__/synthetic-baseline.test.js +155 -0
- package/dist/runtime-v2/__tests__/synthetic-baseline.test.js.map +1 -0
- package/dist/runtime-v2/__tests__/task-state-semantics.test.d.ts +2 -0
- package/dist/runtime-v2/__tests__/task-state-semantics.test.d.ts.map +1 -0
- package/dist/runtime-v2/__tests__/task-state-semantics.test.js +145 -0
- package/dist/runtime-v2/__tests__/task-state-semantics.test.js.map +1 -0
- package/dist/runtime-v2/__tests__/task-three-strikes.test.d.ts +2 -0
- package/dist/runtime-v2/__tests__/task-three-strikes.test.d.ts.map +1 -0
- package/dist/runtime-v2/__tests__/task-three-strikes.test.js +268 -0
- package/dist/runtime-v2/__tests__/task-three-strikes.test.js.map +1 -0
- package/dist/runtime-v2/__tests__/trace-refiner-agent.test.d.ts +2 -0
- package/dist/runtime-v2/__tests__/trace-refiner-agent.test.d.ts.map +1 -0
- package/dist/runtime-v2/__tests__/trace-refiner-agent.test.js +726 -0
- package/dist/runtime-v2/__tests__/trace-refiner-agent.test.js.map +1 -0
- package/dist/runtime-v2/__tests__/trace-refiner.test.d.ts +2 -0
- package/dist/runtime-v2/__tests__/trace-refiner.test.d.ts.map +1 -0
- package/dist/runtime-v2/__tests__/trace-refiner.test.js +527 -0
- package/dist/runtime-v2/__tests__/trace-refiner.test.js.map +1 -0
- package/dist/runtime-v2/__tests__/trainer-output-validator.test.d.ts +2 -0
- package/dist/runtime-v2/__tests__/trainer-output-validator.test.d.ts.map +1 -0
- package/dist/runtime-v2/__tests__/trainer-output-validator.test.js +257 -0
- package/dist/runtime-v2/__tests__/trainer-output-validator.test.js.map +1 -0
- package/dist/runtime-v2/__tests__/trainer-runner-vslice.test.d.ts +2 -0
- package/dist/runtime-v2/__tests__/trainer-runner-vslice.test.d.ts.map +1 -0
- package/dist/runtime-v2/__tests__/trainer-runner-vslice.test.js +506 -0
- package/dist/runtime-v2/__tests__/trainer-runner-vslice.test.js.map +1 -0
- package/dist/runtime-v2/__tests__/trajectory-store.test.d.ts +2 -0
- package/dist/runtime-v2/__tests__/trajectory-store.test.d.ts.map +1 -0
- package/dist/runtime-v2/__tests__/trajectory-store.test.js +127 -0
- package/dist/runtime-v2/__tests__/trajectory-store.test.js.map +1 -0
- package/dist/runtime-v2/activation/__tests__/activation-dispatcher.test.d.ts +2 -0
- package/dist/runtime-v2/activation/__tests__/activation-dispatcher.test.d.ts.map +1 -0
- package/dist/runtime-v2/activation/__tests__/activation-dispatcher.test.js +510 -0
- package/dist/runtime-v2/activation/__tests__/activation-dispatcher.test.js.map +1 -0
- package/dist/runtime-v2/activation/__tests__/approval-context-types.test.d.ts +2 -0
- package/dist/runtime-v2/activation/__tests__/approval-context-types.test.d.ts.map +1 -0
- package/dist/runtime-v2/activation/__tests__/approval-context-types.test.js +117 -0
- package/dist/runtime-v2/activation/__tests__/approval-context-types.test.js.map +1 -0
- package/dist/runtime-v2/activation/__tests__/approval-queue.test.d.ts +2 -0
- package/dist/runtime-v2/activation/__tests__/approval-queue.test.d.ts.map +1 -0
- package/dist/runtime-v2/activation/__tests__/approval-queue.test.js +179 -0
- package/dist/runtime-v2/activation/__tests__/approval-queue.test.js.map +1 -0
- package/dist/runtime-v2/activation/__tests__/approval-store-extended.test.d.ts +2 -0
- package/dist/runtime-v2/activation/__tests__/approval-store-extended.test.d.ts.map +1 -0
- package/dist/runtime-v2/activation/__tests__/approval-store-extended.test.js +174 -0
- package/dist/runtime-v2/activation/__tests__/approval-store-extended.test.js.map +1 -0
- package/dist/runtime-v2/activation/__tests__/memory-activation-state-store.test.d.ts +2 -0
- package/dist/runtime-v2/activation/__tests__/memory-activation-state-store.test.d.ts.map +1 -0
- package/dist/runtime-v2/activation/__tests__/memory-activation-state-store.test.js +244 -0
- package/dist/runtime-v2/activation/__tests__/memory-activation-state-store.test.js.map +1 -0
- package/dist/runtime-v2/activation/__tests__/sqlite-activation-state-store.test.d.ts +2 -0
- package/dist/runtime-v2/activation/__tests__/sqlite-activation-state-store.test.d.ts.map +1 -0
- package/dist/runtime-v2/activation/__tests__/sqlite-activation-state-store.test.js +109 -0
- package/dist/runtime-v2/activation/__tests__/sqlite-activation-state-store.test.js.map +1 -0
- package/dist/runtime-v2/activation/__tests__/sqlite-approval-store.test.d.ts +2 -0
- package/dist/runtime-v2/activation/__tests__/sqlite-approval-store.test.d.ts.map +1 -0
- package/dist/runtime-v2/activation/__tests__/sqlite-approval-store.test.js +124 -0
- package/dist/runtime-v2/activation/__tests__/sqlite-approval-store.test.js.map +1 -0
- package/dist/runtime-v2/activation/activation-dispatcher.d.ts +18 -0
- package/dist/runtime-v2/activation/activation-dispatcher.d.ts.map +1 -0
- package/dist/runtime-v2/activation/activation-dispatcher.js +231 -0
- package/dist/runtime-v2/activation/activation-dispatcher.js.map +1 -0
- package/dist/runtime-v2/activation/activation-types.d.ts +195 -0
- package/dist/runtime-v2/activation/activation-types.d.ts.map +1 -0
- package/dist/runtime-v2/activation/activation-types.js +29 -0
- package/dist/runtime-v2/activation/activation-types.js.map +1 -0
- package/dist/runtime-v2/activation/approval-queue.d.ts +15 -0
- package/dist/runtime-v2/activation/approval-queue.d.ts.map +1 -0
- package/dist/runtime-v2/activation/approval-queue.js +50 -0
- package/dist/runtime-v2/activation/approval-queue.js.map +1 -0
- package/dist/runtime-v2/activation/index.d.ts +15 -0
- package/dist/runtime-v2/activation/index.d.ts.map +1 -0
- package/dist/runtime-v2/activation/index.js +11 -0
- package/dist/runtime-v2/activation/index.js.map +1 -0
- package/dist/runtime-v2/activation/low-risk-writers.d.ts +14 -0
- package/dist/runtime-v2/activation/low-risk-writers.d.ts.map +1 -0
- package/dist/runtime-v2/activation/low-risk-writers.js +83 -0
- package/dist/runtime-v2/activation/low-risk-writers.js.map +1 -0
- package/dist/runtime-v2/activation/memory-activation-state-store.d.ts +13 -0
- package/dist/runtime-v2/activation/memory-activation-state-store.d.ts.map +1 -0
- package/dist/runtime-v2/activation/memory-activation-state-store.js +28 -0
- package/dist/runtime-v2/activation/memory-activation-state-store.js.map +1 -0
- package/dist/runtime-v2/activation/memory-approval-store.d.ts +12 -0
- package/dist/runtime-v2/activation/memory-approval-store.d.ts.map +1 -0
- package/dist/runtime-v2/activation/memory-approval-store.js +102 -0
- package/dist/runtime-v2/activation/memory-approval-store.js.map +1 -0
- package/dist/runtime-v2/activation/sqlite-activation-state-store.d.ts +10 -0
- package/dist/runtime-v2/activation/sqlite-activation-state-store.d.ts.map +1 -0
- package/dist/runtime-v2/activation/sqlite-activation-state-store.js +87 -0
- package/dist/runtime-v2/activation/sqlite-activation-state-store.js.map +1 -0
- package/dist/runtime-v2/activation/sqlite-approval-store.d.ts +14 -0
- package/dist/runtime-v2/activation/sqlite-approval-store.d.ts.map +1 -0
- package/dist/runtime-v2/activation/sqlite-approval-store.js +138 -0
- package/dist/runtime-v2/activation/sqlite-approval-store.js.map +1 -0
- package/dist/runtime-v2/activation/sqlite-confirm-first-state-store.d.ts +22 -0
- package/dist/runtime-v2/activation/sqlite-confirm-first-state-store.d.ts.map +1 -0
- package/dist/runtime-v2/activation/sqlite-confirm-first-state-store.js +136 -0
- package/dist/runtime-v2/activation/sqlite-confirm-first-state-store.js.map +1 -0
- package/dist/runtime-v2/activation/writers/__tests__/rule-host-writer.test.d.ts +2 -0
- package/dist/runtime-v2/activation/writers/__tests__/rule-host-writer.test.d.ts.map +1 -0
- package/dist/runtime-v2/activation/writers/__tests__/rule-host-writer.test.js +615 -0
- package/dist/runtime-v2/activation/writers/__tests__/rule-host-writer.test.js.map +1 -0
- package/dist/runtime-v2/activation/writers/index.d.ts +3 -0
- package/dist/runtime-v2/activation/writers/index.d.ts.map +1 -0
- package/dist/runtime-v2/activation/writers/index.js +2 -0
- package/dist/runtime-v2/activation/writers/index.js.map +1 -0
- package/dist/runtime-v2/activation/writers/rule-host-writer.d.ts +14 -0
- package/dist/runtime-v2/activation/writers/rule-host-writer.d.ts.map +1 -0
- package/dist/runtime-v2/activation/writers/rule-host-writer.js +135 -0
- package/dist/runtime-v2/activation/writers/rule-host-writer.js.map +1 -0
- package/dist/runtime-v2/adapter/__tests__/chaos-json-repair.test.d.ts +2 -0
- package/dist/runtime-v2/adapter/__tests__/chaos-json-repair.test.d.ts.map +1 -0
- package/dist/runtime-v2/adapter/__tests__/chaos-json-repair.test.js +553 -0
- package/dist/runtime-v2/adapter/__tests__/chaos-json-repair.test.js.map +1 -0
- package/dist/runtime-v2/adapter/__tests__/json-extractor.test.d.ts +2 -0
- package/dist/runtime-v2/adapter/__tests__/json-extractor.test.d.ts.map +1 -0
- package/dist/runtime-v2/adapter/__tests__/json-extractor.test.js +148 -0
- package/dist/runtime-v2/adapter/__tests__/json-extractor.test.js.map +1 -0
- package/dist/runtime-v2/adapter/__tests__/openclaw-cli-runtime-adapter.test.d.ts +2 -0
- package/dist/runtime-v2/adapter/__tests__/openclaw-cli-runtime-adapter.test.d.ts.map +1 -0
- package/dist/runtime-v2/adapter/__tests__/openclaw-cli-runtime-adapter.test.js +565 -0
- package/dist/runtime-v2/adapter/__tests__/openclaw-cli-runtime-adapter.test.js.map +1 -0
- package/dist/runtime-v2/adapter/__tests__/output-repair-contract.test.d.ts +2 -0
- package/dist/runtime-v2/adapter/__tests__/output-repair-contract.test.d.ts.map +1 -0
- package/dist/runtime-v2/adapter/__tests__/output-repair-contract.test.js +305 -0
- package/dist/runtime-v2/adapter/__tests__/output-repair-contract.test.js.map +1 -0
- package/dist/runtime-v2/adapter/__tests__/pi-ai-runtime-adapter.test.d.ts +2 -0
- package/dist/runtime-v2/adapter/__tests__/pi-ai-runtime-adapter.test.d.ts.map +1 -0
- package/dist/runtime-v2/adapter/__tests__/pi-ai-runtime-adapter.test.js +1362 -0
- package/dist/runtime-v2/adapter/__tests__/pi-ai-runtime-adapter.test.js.map +1 -0
- package/dist/runtime-v2/adapter/__tests__/runtime-config-contract.test.d.ts +2 -0
- package/dist/runtime-v2/adapter/__tests__/runtime-config-contract.test.d.ts.map +1 -0
- package/dist/runtime-v2/adapter/__tests__/runtime-config-contract.test.js +245 -0
- package/dist/runtime-v2/adapter/__tests__/runtime-config-contract.test.js.map +1 -0
- package/dist/runtime-v2/adapter/__tests__/structured-output-repair.test.d.ts +2 -0
- package/dist/runtime-v2/adapter/__tests__/structured-output-repair.test.d.ts.map +1 -0
- package/dist/runtime-v2/adapter/__tests__/structured-output-repair.test.js +494 -0
- package/dist/runtime-v2/adapter/__tests__/structured-output-repair.test.js.map +1 -0
- package/dist/runtime-v2/adapter/__tests__/test-double-runtime-adapter.test.d.ts +2 -0
- package/dist/runtime-v2/adapter/__tests__/test-double-runtime-adapter.test.d.ts.map +1 -0
- package/dist/runtime-v2/adapter/__tests__/test-double-runtime-adapter.test.js +123 -0
- package/dist/runtime-v2/adapter/__tests__/test-double-runtime-adapter.test.js.map +1 -0
- package/dist/runtime-v2/adapter/index.d.ts +10 -0
- package/dist/runtime-v2/adapter/index.d.ts.map +1 -0
- package/dist/runtime-v2/adapter/index.js +6 -0
- package/dist/runtime-v2/adapter/index.js.map +1 -0
- package/dist/runtime-v2/adapter/json-extractor.d.ts +14 -0
- package/dist/runtime-v2/adapter/json-extractor.d.ts.map +1 -0
- package/dist/runtime-v2/adapter/json-extractor.js +97 -0
- package/dist/runtime-v2/adapter/json-extractor.js.map +1 -0
- package/dist/runtime-v2/adapter/openclaw-cli-runtime-adapter.d.ts +66 -0
- package/dist/runtime-v2/adapter/openclaw-cli-runtime-adapter.d.ts.map +1 -0
- package/dist/runtime-v2/adapter/openclaw-cli-runtime-adapter.js +705 -0
- package/dist/runtime-v2/adapter/openclaw-cli-runtime-adapter.js.map +1 -0
- package/dist/runtime-v2/adapter/output-repair-contract.d.ts +50 -0
- package/dist/runtime-v2/adapter/output-repair-contract.d.ts.map +1 -0
- package/dist/runtime-v2/adapter/output-repair-contract.js +96 -0
- package/dist/runtime-v2/adapter/output-repair-contract.js.map +1 -0
- package/dist/runtime-v2/adapter/pi-ai-runtime-adapter.d.ts +114 -0
- package/dist/runtime-v2/adapter/pi-ai-runtime-adapter.d.ts.map +1 -0
- package/dist/runtime-v2/adapter/pi-ai-runtime-adapter.js +1109 -0
- package/dist/runtime-v2/adapter/pi-ai-runtime-adapter.js.map +1 -0
- package/dist/runtime-v2/adapter/principle-tree-ledger-adapter.d.ts +22 -0
- package/dist/runtime-v2/adapter/principle-tree-ledger-adapter.d.ts.map +1 -0
- package/dist/runtime-v2/adapter/principle-tree-ledger-adapter.js +84 -0
- package/dist/runtime-v2/adapter/principle-tree-ledger-adapter.js.map +1 -0
- package/dist/runtime-v2/adapter/structured-output-repair.d.ts +95 -0
- package/dist/runtime-v2/adapter/structured-output-repair.d.ts.map +1 -0
- package/dist/runtime-v2/adapter/structured-output-repair.js +259 -0
- package/dist/runtime-v2/adapter/structured-output-repair.js.map +1 -0
- package/dist/runtime-v2/adapter/test-double-runtime-adapter.d.ts +35 -0
- package/dist/runtime-v2/adapter/test-double-runtime-adapter.d.ts.map +1 -0
- package/dist/runtime-v2/adapter/test-double-runtime-adapter.js +94 -0
- package/dist/runtime-v2/adapter/test-double-runtime-adapter.js.map +1 -0
- package/dist/runtime-v2/adapter/tools/diagnostician-tool.d.ts +21 -0
- package/dist/runtime-v2/adapter/tools/diagnostician-tool.d.ts.map +1 -0
- package/dist/runtime-v2/adapter/tools/diagnostician-tool.js +20 -0
- package/dist/runtime-v2/adapter/tools/diagnostician-tool.js.map +1 -0
- package/dist/runtime-v2/admission-gate.d.ts +27 -0
- package/dist/runtime-v2/admission-gate.d.ts.map +1 -0
- package/dist/runtime-v2/admission-gate.js +57 -0
- package/dist/runtime-v2/admission-gate.js.map +1 -0
- package/dist/runtime-v2/agent-spec.d.ts +86 -0
- package/dist/runtime-v2/agent-spec.d.ts.map +1 -0
- package/dist/runtime-v2/agent-spec.js +74 -0
- package/dist/runtime-v2/agent-spec.js.map +1 -0
- package/dist/runtime-v2/candidate-audit.d.ts +8 -0
- package/dist/runtime-v2/candidate-audit.d.ts.map +1 -0
- package/dist/runtime-v2/candidate-audit.js +47 -0
- package/dist/runtime-v2/candidate-audit.js.map +1 -0
- package/dist/runtime-v2/candidate-intake-service.d.ts +43 -0
- package/dist/runtime-v2/candidate-intake-service.d.ts.map +1 -0
- package/dist/runtime-v2/candidate-intake-service.js +117 -0
- package/dist/runtime-v2/candidate-intake-service.js.map +1 -0
- package/dist/runtime-v2/candidate-intake.d.ts +219 -0
- package/dist/runtime-v2/candidate-intake.d.ts.map +1 -0
- package/dist/runtime-v2/candidate-intake.js +178 -0
- package/dist/runtime-v2/candidate-intake.js.map +1 -0
- package/dist/runtime-v2/cli/diagnose.d.ts +127 -0
- package/dist/runtime-v2/cli/diagnose.d.ts.map +1 -0
- package/dist/runtime-v2/cli/diagnose.js +113 -0
- package/dist/runtime-v2/cli/diagnose.js.map +1 -0
- package/dist/runtime-v2/cli/index.d.ts +5 -0
- package/dist/runtime-v2/cli/index.d.ts.map +1 -0
- package/dist/runtime-v2/cli/index.js +3 -0
- package/dist/runtime-v2/cli/index.js.map +1 -0
- package/dist/runtime-v2/cli/probe.d.ts +31 -0
- package/dist/runtime-v2/cli/probe.d.ts.map +1 -0
- package/dist/runtime-v2/cli/probe.js +58 -0
- package/dist/runtime-v2/cli/probe.js.map +1 -0
- package/dist/runtime-v2/context-payload.d.ts +298 -0
- package/dist/runtime-v2/context-payload.d.ts.map +1 -0
- package/dist/runtime-v2/context-payload.js +140 -0
- package/dist/runtime-v2/context-payload.js.map +1 -0
- package/dist/runtime-v2/control-plane-triage.d.ts +32 -0
- package/dist/runtime-v2/control-plane-triage.d.ts.map +1 -0
- package/dist/runtime-v2/control-plane-triage.js +220 -0
- package/dist/runtime-v2/control-plane-triage.js.map +1 -0
- package/dist/runtime-v2/correction/correction-types.d.ts +87 -0
- package/dist/runtime-v2/correction/correction-types.d.ts.map +1 -0
- package/dist/runtime-v2/correction/correction-types.js +66 -0
- package/dist/runtime-v2/correction/correction-types.js.map +1 -0
- package/dist/runtime-v2/correction/index.d.ts +2 -0
- package/dist/runtime-v2/correction/index.d.ts.map +1 -0
- package/dist/runtime-v2/correction/index.js +2 -0
- package/dist/runtime-v2/correction/index.js.map +1 -0
- package/dist/runtime-v2/diagnostician/__tests__/diagnostician-prompt-builder.integration.test.d.ts +2 -0
- package/dist/runtime-v2/diagnostician/__tests__/diagnostician-prompt-builder.integration.test.d.ts.map +1 -0
- package/dist/runtime-v2/diagnostician/__tests__/diagnostician-prompt-builder.integration.test.js +170 -0
- package/dist/runtime-v2/diagnostician/__tests__/diagnostician-prompt-builder.integration.test.js.map +1 -0
- package/dist/runtime-v2/diagnostician/__tests__/diagnostician-prompt-builder.test.d.ts +2 -0
- package/dist/runtime-v2/diagnostician/__tests__/diagnostician-prompt-builder.test.d.ts.map +1 -0
- package/dist/runtime-v2/diagnostician/__tests__/diagnostician-prompt-builder.test.js +314 -0
- package/dist/runtime-v2/diagnostician/__tests__/diagnostician-prompt-builder.test.js.map +1 -0
- package/dist/runtime-v2/diagnostician-output.d.ts +94 -0
- package/dist/runtime-v2/diagnostician-output.d.ts.map +1 -0
- package/dist/runtime-v2/diagnostician-output.js +65 -0
- package/dist/runtime-v2/diagnostician-output.js.map +1 -0
- package/dist/runtime-v2/diagnostician-prompt-builder.d.ts +125 -0
- package/dist/runtime-v2/diagnostician-prompt-builder.d.ts.map +1 -0
- package/dist/runtime-v2/diagnostician-prompt-builder.js +154 -0
- package/dist/runtime-v2/diagnostician-prompt-builder.js.map +1 -0
- package/dist/runtime-v2/error-categories.d.ts +42 -0
- package/dist/runtime-v2/error-categories.d.ts.map +1 -0
- package/dist/runtime-v2/error-categories.js +119 -0
- package/dist/runtime-v2/error-categories.js.map +1 -0
- package/dist/runtime-v2/evolution/evolution-types.d.ts +709 -0
- package/dist/runtime-v2/evolution/evolution-types.d.ts.map +1 -0
- package/dist/runtime-v2/evolution/evolution-types.js +410 -0
- package/dist/runtime-v2/evolution/evolution-types.js.map +1 -0
- package/dist/runtime-v2/evolution/index.d.ts +2 -0
- package/dist/runtime-v2/evolution/index.d.ts.map +1 -0
- package/dist/runtime-v2/evolution/index.js +2 -0
- package/dist/runtime-v2/evolution/index.js.map +1 -0
- package/dist/runtime-v2/feature-flags/__tests__/feature-flag-contract.test.d.ts +2 -0
- package/dist/runtime-v2/feature-flags/__tests__/feature-flag-contract.test.d.ts.map +1 -0
- package/dist/runtime-v2/feature-flags/__tests__/feature-flag-contract.test.js +298 -0
- package/dist/runtime-v2/feature-flags/__tests__/feature-flag-contract.test.js.map +1 -0
- package/dist/runtime-v2/feature-flags/feature-flag-contract.d.ts +35 -0
- package/dist/runtime-v2/feature-flags/feature-flag-contract.d.ts.map +1 -0
- package/dist/runtime-v2/feature-flags/feature-flag-contract.js +124 -0
- package/dist/runtime-v2/feature-flags/feature-flag-contract.js.map +1 -0
- package/dist/runtime-v2/feature-flags/index.d.ts +3 -0
- package/dist/runtime-v2/feature-flags/index.d.ts.map +1 -0
- package/dist/runtime-v2/feature-flags/index.js +2 -0
- package/dist/runtime-v2/feature-flags/index.js.map +1 -0
- package/dist/runtime-v2/full-trace-contract.d.ts +79 -0
- package/dist/runtime-v2/full-trace-contract.d.ts.map +1 -0
- package/dist/runtime-v2/full-trace-contract.js +464 -0
- package/dist/runtime-v2/full-trace-contract.js.map +1 -0
- package/dist/runtime-v2/gfi/__tests__/gfi-kernel.test.d.ts +2 -0
- package/dist/runtime-v2/gfi/__tests__/gfi-kernel.test.d.ts.map +1 -0
- package/dist/runtime-v2/gfi/__tests__/gfi-kernel.test.js +626 -0
- package/dist/runtime-v2/gfi/__tests__/gfi-kernel.test.js.map +1 -0
- package/dist/runtime-v2/gfi/__tests__/gfi-read-model.test.d.ts +2 -0
- package/dist/runtime-v2/gfi/__tests__/gfi-read-model.test.d.ts.map +1 -0
- package/dist/runtime-v2/gfi/__tests__/gfi-read-model.test.js +212 -0
- package/dist/runtime-v2/gfi/__tests__/gfi-read-model.test.js.map +1 -0
- package/dist/runtime-v2/gfi/gfi-kernel.d.ts +12 -0
- package/dist/runtime-v2/gfi/gfi-kernel.d.ts.map +1 -0
- package/dist/runtime-v2/gfi/gfi-kernel.js +148 -0
- package/dist/runtime-v2/gfi/gfi-kernel.js.map +1 -0
- package/dist/runtime-v2/gfi/gfi-policy.d.ts +3 -0
- package/dist/runtime-v2/gfi/gfi-policy.d.ts.map +1 -0
- package/dist/runtime-v2/gfi/gfi-policy.js +23 -0
- package/dist/runtime-v2/gfi/gfi-policy.js.map +1 -0
- package/dist/runtime-v2/gfi/gfi-read-model.d.ts +78 -0
- package/dist/runtime-v2/gfi/gfi-read-model.d.ts.map +1 -0
- package/dist/runtime-v2/gfi/gfi-read-model.js +129 -0
- package/dist/runtime-v2/gfi/gfi-read-model.js.map +1 -0
- package/dist/runtime-v2/gfi/gfi-types.d.ts +70 -0
- package/dist/runtime-v2/gfi/gfi-types.d.ts.map +1 -0
- package/dist/runtime-v2/gfi/gfi-types.js +2 -0
- package/dist/runtime-v2/gfi/gfi-types.js.map +1 -0
- package/dist/runtime-v2/gfi/index.d.ts +6 -0
- package/dist/runtime-v2/gfi/index.d.ts.map +1 -0
- package/dist/runtime-v2/gfi/index.js +4 -0
- package/dist/runtime-v2/gfi/index.js.map +1 -0
- package/dist/runtime-v2/golden-trace-candidate-builder.d.ts +23 -0
- package/dist/runtime-v2/golden-trace-candidate-builder.d.ts.map +1 -0
- package/dist/runtime-v2/golden-trace-candidate-builder.js +193 -0
- package/dist/runtime-v2/golden-trace-candidate-builder.js.map +1 -0
- package/dist/runtime-v2/golden-trace-replay-adapter.d.ts +18 -0
- package/dist/runtime-v2/golden-trace-replay-adapter.d.ts.map +1 -0
- package/dist/runtime-v2/golden-trace-replay-adapter.js +18 -0
- package/dist/runtime-v2/golden-trace-replay-adapter.js.map +1 -0
- package/dist/runtime-v2/golden-trace-replay-validator.d.ts +42 -0
- package/dist/runtime-v2/golden-trace-replay-validator.d.ts.map +1 -0
- package/dist/runtime-v2/golden-trace-replay-validator.js +220 -0
- package/dist/runtime-v2/golden-trace-replay-validator.js.map +1 -0
- package/dist/runtime-v2/golden-trace.d.ts +80 -0
- package/dist/runtime-v2/golden-trace.d.ts.map +1 -0
- package/dist/runtime-v2/golden-trace.js +158 -0
- package/dist/runtime-v2/golden-trace.js.map +1 -0
- package/dist/runtime-v2/idle-trigger/__tests__/idle-trigger-config-resolve.test.d.ts +2 -0
- package/dist/runtime-v2/idle-trigger/__tests__/idle-trigger-config-resolve.test.d.ts.map +1 -0
- package/dist/runtime-v2/idle-trigger/__tests__/idle-trigger-config-resolve.test.js +92 -0
- package/dist/runtime-v2/idle-trigger/__tests__/idle-trigger-config-resolve.test.js.map +1 -0
- package/dist/runtime-v2/idle-trigger/__tests__/idle-trigger-decision.test.d.ts +2 -0
- package/dist/runtime-v2/idle-trigger/__tests__/idle-trigger-decision.test.d.ts.map +1 -0
- package/dist/runtime-v2/idle-trigger/__tests__/idle-trigger-decision.test.js +134 -0
- package/dist/runtime-v2/idle-trigger/__tests__/idle-trigger-decision.test.js.map +1 -0
- package/dist/runtime-v2/idle-trigger/__tests__/idle-trigger-edge-cases.test.d.ts +2 -0
- package/dist/runtime-v2/idle-trigger/__tests__/idle-trigger-edge-cases.test.d.ts.map +1 -0
- package/dist/runtime-v2/idle-trigger/__tests__/idle-trigger-edge-cases.test.js +226 -0
- package/dist/runtime-v2/idle-trigger/__tests__/idle-trigger-edge-cases.test.js.map +1 -0
- package/dist/runtime-v2/idle-trigger/idle-trigger-decision.d.ts +3 -0
- package/dist/runtime-v2/idle-trigger/idle-trigger-decision.d.ts.map +1 -0
- package/dist/runtime-v2/idle-trigger/idle-trigger-decision.js +5 -0
- package/dist/runtime-v2/idle-trigger/idle-trigger-decision.js.map +1 -0
- package/dist/runtime-v2/idle-trigger/idle-trigger-policy.d.ts +4 -0
- package/dist/runtime-v2/idle-trigger/idle-trigger-policy.d.ts.map +1 -0
- package/dist/runtime-v2/idle-trigger/idle-trigger-policy.js +81 -0
- package/dist/runtime-v2/idle-trigger/idle-trigger-policy.js.map +1 -0
- package/dist/runtime-v2/idle-trigger/idle-trigger-types.d.ts +29 -0
- package/dist/runtime-v2/idle-trigger/idle-trigger-types.d.ts.map +1 -0
- package/dist/runtime-v2/idle-trigger/idle-trigger-types.js +15 -0
- package/dist/runtime-v2/idle-trigger/idle-trigger-types.js.map +1 -0
- package/dist/runtime-v2/idle-trigger/index.d.ts +5 -0
- package/dist/runtime-v2/idle-trigger/index.d.ts.map +1 -0
- package/dist/runtime-v2/idle-trigger/index.js +4 -0
- package/dist/runtime-v2/idle-trigger/index.js.map +1 -0
- package/dist/runtime-v2/index.d.ts +281 -0
- package/dist/runtime-v2/index.d.ts.map +1 -0
- package/dist/runtime-v2/index.js +224 -0
- package/dist/runtime-v2/index.js.map +1 -0
- package/dist/runtime-v2/internalization/__tests__/artificer-prompt-builder.test.d.ts +2 -0
- package/dist/runtime-v2/internalization/__tests__/artificer-prompt-builder.test.d.ts.map +1 -0
- package/dist/runtime-v2/internalization/__tests__/artificer-prompt-builder.test.js +57 -0
- package/dist/runtime-v2/internalization/__tests__/artificer-prompt-builder.test.js.map +1 -0
- package/dist/runtime-v2/internalization/__tests__/dreamer-prompt-builder.test.d.ts +2 -0
- package/dist/runtime-v2/internalization/__tests__/dreamer-prompt-builder.test.d.ts.map +1 -0
- package/dist/runtime-v2/internalization/__tests__/dreamer-prompt-builder.test.js +182 -0
- package/dist/runtime-v2/internalization/__tests__/dreamer-prompt-builder.test.js.map +1 -0
- package/dist/runtime-v2/internalization/__tests__/evaluator-prompt-builder.test.d.ts +2 -0
- package/dist/runtime-v2/internalization/__tests__/evaluator-prompt-builder.test.d.ts.map +1 -0
- package/dist/runtime-v2/internalization/__tests__/evaluator-prompt-builder.test.js +112 -0
- package/dist/runtime-v2/internalization/__tests__/evaluator-prompt-builder.test.js.map +1 -0
- package/dist/runtime-v2/internalization/__tests__/internalization-job-graph.test.d.ts +2 -0
- package/dist/runtime-v2/internalization/__tests__/internalization-job-graph.test.d.ts.map +1 -0
- package/dist/runtime-v2/internalization/__tests__/internalization-job-graph.test.js +176 -0
- package/dist/runtime-v2/internalization/__tests__/internalization-job-graph.test.js.map +1 -0
- package/dist/runtime-v2/internalization/__tests__/internalization-task-guards.test.d.ts +2 -0
- package/dist/runtime-v2/internalization/__tests__/internalization-task-guards.test.d.ts.map +1 -0
- package/dist/runtime-v2/internalization/__tests__/internalization-task-guards.test.js +297 -0
- package/dist/runtime-v2/internalization/__tests__/internalization-task-guards.test.js.map +1 -0
- package/dist/runtime-v2/internalization/__tests__/philosopher-prompt-builder.test.d.ts +2 -0
- package/dist/runtime-v2/internalization/__tests__/philosopher-prompt-builder.test.d.ts.map +1 -0
- package/dist/runtime-v2/internalization/__tests__/philosopher-prompt-builder.test.js +149 -0
- package/dist/runtime-v2/internalization/__tests__/philosopher-prompt-builder.test.js.map +1 -0
- package/dist/runtime-v2/internalization/__tests__/queue-actionability.test.d.ts +2 -0
- package/dist/runtime-v2/internalization/__tests__/queue-actionability.test.d.ts.map +1 -0
- package/dist/runtime-v2/internalization/__tests__/queue-actionability.test.js +92 -0
- package/dist/runtime-v2/internalization/__tests__/queue-actionability.test.js.map +1 -0
- package/dist/runtime-v2/internalization/__tests__/refiner-rulehost-gate.test.d.ts +2 -0
- package/dist/runtime-v2/internalization/__tests__/refiner-rulehost-gate.test.d.ts.map +1 -0
- package/dist/runtime-v2/internalization/__tests__/refiner-rulehost-gate.test.js +431 -0
- package/dist/runtime-v2/internalization/__tests__/refiner-rulehost-gate.test.js.map +1 -0
- package/dist/runtime-v2/internalization/__tests__/refiner-sandbox-wrapper.test.d.ts +2 -0
- package/dist/runtime-v2/internalization/__tests__/refiner-sandbox-wrapper.test.d.ts.map +1 -0
- package/dist/runtime-v2/internalization/__tests__/refiner-sandbox-wrapper.test.js +763 -0
- package/dist/runtime-v2/internalization/__tests__/refiner-sandbox-wrapper.test.js.map +1 -0
- package/dist/runtime-v2/internalization/__tests__/rollout-reviewer-prompt-builder.test.d.ts +2 -0
- package/dist/runtime-v2/internalization/__tests__/rollout-reviewer-prompt-builder.test.d.ts.map +1 -0
- package/dist/runtime-v2/internalization/__tests__/rollout-reviewer-prompt-builder.test.js +75 -0
- package/dist/runtime-v2/internalization/__tests__/rollout-reviewer-prompt-builder.test.js.map +1 -0
- package/dist/runtime-v2/internalization/__tests__/scribe-prompt-builder.test.d.ts +2 -0
- package/dist/runtime-v2/internalization/__tests__/scribe-prompt-builder.test.d.ts.map +1 -0
- package/dist/runtime-v2/internalization/__tests__/scribe-prompt-builder.test.js +56 -0
- package/dist/runtime-v2/internalization/__tests__/scribe-prompt-builder.test.js.map +1 -0
- package/dist/runtime-v2/internalization/__tests__/trainer-prompt-builder.test.d.ts +2 -0
- package/dist/runtime-v2/internalization/__tests__/trainer-prompt-builder.test.d.ts.map +1 -0
- package/dist/runtime-v2/internalization/__tests__/trainer-prompt-builder.test.js +141 -0
- package/dist/runtime-v2/internalization/__tests__/trainer-prompt-builder.test.js.map +1 -0
- package/dist/runtime-v2/internalization/artificer-output.d.ts +67 -0
- package/dist/runtime-v2/internalization/artificer-output.d.ts.map +1 -0
- package/dist/runtime-v2/internalization/artificer-output.js +103 -0
- package/dist/runtime-v2/internalization/artificer-output.js.map +1 -0
- package/dist/runtime-v2/internalization/artificer-prompt-builder.d.ts +24 -0
- package/dist/runtime-v2/internalization/artificer-prompt-builder.d.ts.map +1 -0
- package/dist/runtime-v2/internalization/artificer-prompt-builder.js +62 -0
- package/dist/runtime-v2/internalization/artificer-prompt-builder.js.map +1 -0
- package/dist/runtime-v2/internalization/artificer-runner.d.ts +77 -0
- package/dist/runtime-v2/internalization/artificer-runner.d.ts.map +1 -0
- package/dist/runtime-v2/internalization/artificer-runner.js +521 -0
- package/dist/runtime-v2/internalization/artificer-runner.js.map +1 -0
- package/dist/runtime-v2/internalization/compile-result.d.ts +20 -0
- package/dist/runtime-v2/internalization/compile-result.d.ts.map +1 -0
- package/dist/runtime-v2/internalization/compile-result.js +8 -0
- package/dist/runtime-v2/internalization/compile-result.js.map +1 -0
- package/dist/runtime-v2/internalization/correction-proposal.d.ts +38 -0
- package/dist/runtime-v2/internalization/correction-proposal.d.ts.map +1 -0
- package/dist/runtime-v2/internalization/correction-proposal.js +322 -0
- package/dist/runtime-v2/internalization/correction-proposal.js.map +1 -0
- package/dist/runtime-v2/internalization/deprecated-readiness.d.ts +20 -0
- package/dist/runtime-v2/internalization/deprecated-readiness.d.ts.map +1 -0
- package/dist/runtime-v2/internalization/deprecated-readiness.js +75 -0
- package/dist/runtime-v2/internalization/deprecated-readiness.js.map +1 -0
- package/dist/runtime-v2/internalization/deprecated-readiness.test.d.ts +2 -0
- package/dist/runtime-v2/internalization/deprecated-readiness.test.d.ts.map +1 -0
- package/dist/runtime-v2/internalization/deprecated-readiness.test.js +127 -0
- package/dist/runtime-v2/internalization/deprecated-readiness.test.js.map +1 -0
- package/dist/runtime-v2/internalization/dreamer-output.d.ts +120 -0
- package/dist/runtime-v2/internalization/dreamer-output.d.ts.map +1 -0
- package/dist/runtime-v2/internalization/dreamer-output.js +92 -0
- package/dist/runtime-v2/internalization/dreamer-output.js.map +1 -0
- package/dist/runtime-v2/internalization/dreamer-prompt-builder.d.ts +41 -0
- package/dist/runtime-v2/internalization/dreamer-prompt-builder.d.ts.map +1 -0
- package/dist/runtime-v2/internalization/dreamer-prompt-builder.js +43 -0
- package/dist/runtime-v2/internalization/dreamer-prompt-builder.js.map +1 -0
- package/dist/runtime-v2/internalization/dreamer-runner.d.ts +134 -0
- package/dist/runtime-v2/internalization/dreamer-runner.d.ts.map +1 -0
- package/dist/runtime-v2/internalization/dreamer-runner.js +636 -0
- package/dist/runtime-v2/internalization/dreamer-runner.js.map +1 -0
- package/dist/runtime-v2/internalization/evaluator-output.d.ts +71 -0
- package/dist/runtime-v2/internalization/evaluator-output.d.ts.map +1 -0
- package/dist/runtime-v2/internalization/evaluator-output.js +113 -0
- package/dist/runtime-v2/internalization/evaluator-output.js.map +1 -0
- package/dist/runtime-v2/internalization/evaluator-prompt-builder.d.ts +24 -0
- package/dist/runtime-v2/internalization/evaluator-prompt-builder.d.ts.map +1 -0
- package/dist/runtime-v2/internalization/evaluator-prompt-builder.js +49 -0
- package/dist/runtime-v2/internalization/evaluator-prompt-builder.js.map +1 -0
- package/dist/runtime-v2/internalization/evaluator-runner.d.ts +80 -0
- package/dist/runtime-v2/internalization/evaluator-runner.d.ts.map +1 -0
- package/dist/runtime-v2/internalization/evaluator-runner.js +661 -0
- package/dist/runtime-v2/internalization/evaluator-runner.js.map +1 -0
- package/dist/runtime-v2/internalization/index.d.ts +81 -0
- package/dist/runtime-v2/internalization/index.d.ts.map +1 -0
- package/dist/runtime-v2/internalization/index.js +47 -0
- package/dist/runtime-v2/internalization/index.js.map +1 -0
- package/dist/runtime-v2/internalization/intake-to-internalization-bridge.d.ts +57 -0
- package/dist/runtime-v2/internalization/intake-to-internalization-bridge.d.ts.map +1 -0
- package/dist/runtime-v2/internalization/intake-to-internalization-bridge.js +99 -0
- package/dist/runtime-v2/internalization/intake-to-internalization-bridge.js.map +1 -0
- package/dist/runtime-v2/internalization/internalization-job-graph.d.ts +78 -0
- package/dist/runtime-v2/internalization/internalization-job-graph.d.ts.map +1 -0
- package/dist/runtime-v2/internalization/internalization-job-graph.js +153 -0
- package/dist/runtime-v2/internalization/internalization-job-graph.js.map +1 -0
- package/dist/runtime-v2/internalization/internalization-orchestrator.d.ts +182 -0
- package/dist/runtime-v2/internalization/internalization-orchestrator.d.ts.map +1 -0
- package/dist/runtime-v2/internalization/internalization-orchestrator.js +355 -0
- package/dist/runtime-v2/internalization/internalization-orchestrator.js.map +1 -0
- package/dist/runtime-v2/internalization/internalization-route.d.ts +28 -0
- package/dist/runtime-v2/internalization/internalization-route.d.ts.map +1 -0
- package/dist/runtime-v2/internalization/internalization-route.js +112 -0
- package/dist/runtime-v2/internalization/internalization-route.js.map +1 -0
- package/dist/runtime-v2/internalization/internalization-state-machine.d.ts +157 -0
- package/dist/runtime-v2/internalization/internalization-state-machine.d.ts.map +1 -0
- package/dist/runtime-v2/internalization/internalization-state-machine.js +274 -0
- package/dist/runtime-v2/internalization/internalization-state-machine.js.map +1 -0
- package/dist/runtime-v2/internalization/internalization-task-guards.d.ts +92 -0
- package/dist/runtime-v2/internalization/internalization-task-guards.d.ts.map +1 -0
- package/dist/runtime-v2/internalization/internalization-task-guards.js +152 -0
- package/dist/runtime-v2/internalization/internalization-task-guards.js.map +1 -0
- package/dist/runtime-v2/internalization/lifecycle-datasource.d.ts +18 -0
- package/dist/runtime-v2/internalization/lifecycle-datasource.d.ts.map +1 -0
- package/dist/runtime-v2/internalization/lifecycle-datasource.js +2 -0
- package/dist/runtime-v2/internalization/lifecycle-datasource.js.map +1 -0
- package/dist/runtime-v2/internalization/lifecycle-metrics.d.ts +24 -0
- package/dist/runtime-v2/internalization/lifecycle-metrics.d.ts.map +1 -0
- package/dist/runtime-v2/internalization/lifecycle-metrics.js +124 -0
- package/dist/runtime-v2/internalization/lifecycle-metrics.js.map +1 -0
- package/dist/runtime-v2/internalization/lifecycle-metrics.test.d.ts +2 -0
- package/dist/runtime-v2/internalization/lifecycle-metrics.test.d.ts.map +1 -0
- package/dist/runtime-v2/internalization/lifecycle-metrics.test.js +201 -0
- package/dist/runtime-v2/internalization/lifecycle-metrics.test.js.map +1 -0
- package/dist/runtime-v2/internalization/lifecycle-read-model.d.ts +11 -0
- package/dist/runtime-v2/internalization/lifecycle-read-model.d.ts.map +1 -0
- package/dist/runtime-v2/internalization/lifecycle-read-model.js +155 -0
- package/dist/runtime-v2/internalization/lifecycle-read-model.js.map +1 -0
- package/dist/runtime-v2/internalization/lifecycle-read-model.test.d.ts +2 -0
- package/dist/runtime-v2/internalization/lifecycle-read-model.test.d.ts.map +1 -0
- package/dist/runtime-v2/internalization/lifecycle-read-model.test.js +408 -0
- package/dist/runtime-v2/internalization/lifecycle-read-model.test.js.map +1 -0
- package/dist/runtime-v2/internalization/lifecycle-types.d.ts +75 -0
- package/dist/runtime-v2/internalization/lifecycle-types.d.ts.map +1 -0
- package/dist/runtime-v2/internalization/lifecycle-types.js +2 -0
- package/dist/runtime-v2/internalization/lifecycle-types.js.map +1 -0
- package/dist/runtime-v2/internalization/peer-runner-contracts.d.ts +140 -0
- package/dist/runtime-v2/internalization/peer-runner-contracts.d.ts.map +1 -0
- package/dist/runtime-v2/internalization/peer-runner-contracts.js +124 -0
- package/dist/runtime-v2/internalization/peer-runner-contracts.js.map +1 -0
- package/dist/runtime-v2/internalization/philosopher-output.d.ts +56 -0
- package/dist/runtime-v2/internalization/philosopher-output.d.ts.map +1 -0
- package/dist/runtime-v2/internalization/philosopher-output.js +69 -0
- package/dist/runtime-v2/internalization/philosopher-output.js.map +1 -0
- package/dist/runtime-v2/internalization/philosopher-prompt-builder.d.ts +41 -0
- package/dist/runtime-v2/internalization/philosopher-prompt-builder.d.ts.map +1 -0
- package/dist/runtime-v2/internalization/philosopher-prompt-builder.js +50 -0
- package/dist/runtime-v2/internalization/philosopher-prompt-builder.js.map +1 -0
- package/dist/runtime-v2/internalization/philosopher-runner.d.ts +103 -0
- package/dist/runtime-v2/internalization/philosopher-runner.d.ts.map +1 -0
- package/dist/runtime-v2/internalization/philosopher-runner.js +519 -0
- package/dist/runtime-v2/internalization/philosopher-runner.js.map +1 -0
- package/dist/runtime-v2/internalization/pi-artifact-store.d.ts +13 -0
- package/dist/runtime-v2/internalization/pi-artifact-store.d.ts.map +1 -0
- package/dist/runtime-v2/internalization/pi-artifact-store.js +65 -0
- package/dist/runtime-v2/internalization/pi-artifact-store.js.map +1 -0
- package/dist/runtime-v2/internalization/pi-artifact.d.ts +23 -0
- package/dist/runtime-v2/internalization/pi-artifact.d.ts.map +1 -0
- package/dist/runtime-v2/internalization/pi-artifact.js +2 -0
- package/dist/runtime-v2/internalization/pi-artifact.js.map +1 -0
- package/dist/runtime-v2/internalization/pitask-metadata.d.ts +80 -0
- package/dist/runtime-v2/internalization/pitask-metadata.d.ts.map +1 -0
- package/dist/runtime-v2/internalization/pitask-metadata.js +194 -0
- package/dist/runtime-v2/internalization/pitask-metadata.js.map +1 -0
- package/dist/runtime-v2/internalization/queue-actionability.d.ts +37 -0
- package/dist/runtime-v2/internalization/queue-actionability.d.ts.map +1 -0
- package/dist/runtime-v2/internalization/queue-actionability.js +50 -0
- package/dist/runtime-v2/internalization/queue-actionability.js.map +1 -0
- package/dist/runtime-v2/internalization/refiner-rulehost-gate.d.ts +20 -0
- package/dist/runtime-v2/internalization/refiner-rulehost-gate.d.ts.map +1 -0
- package/dist/runtime-v2/internalization/refiner-rulehost-gate.js +151 -0
- package/dist/runtime-v2/internalization/refiner-rulehost-gate.js.map +1 -0
- package/dist/runtime-v2/internalization/refiner-sandbox-wrapper.d.ts +36 -0
- package/dist/runtime-v2/internalization/refiner-sandbox-wrapper.d.ts.map +1 -0
- package/dist/runtime-v2/internalization/refiner-sandbox-wrapper.js +227 -0
- package/dist/runtime-v2/internalization/refiner-sandbox-wrapper.js.map +1 -0
- package/dist/runtime-v2/internalization/rollout-reviewer-output.d.ts +74 -0
- package/dist/runtime-v2/internalization/rollout-reviewer-output.d.ts.map +1 -0
- package/dist/runtime-v2/internalization/rollout-reviewer-output.js +117 -0
- package/dist/runtime-v2/internalization/rollout-reviewer-output.js.map +1 -0
- package/dist/runtime-v2/internalization/rollout-reviewer-prompt-builder.d.ts +24 -0
- package/dist/runtime-v2/internalization/rollout-reviewer-prompt-builder.d.ts.map +1 -0
- package/dist/runtime-v2/internalization/rollout-reviewer-prompt-builder.js +52 -0
- package/dist/runtime-v2/internalization/rollout-reviewer-prompt-builder.js.map +1 -0
- package/dist/runtime-v2/internalization/rollout-reviewer-runner.d.ts +76 -0
- package/dist/runtime-v2/internalization/rollout-reviewer-runner.d.ts.map +1 -0
- package/dist/runtime-v2/internalization/rollout-reviewer-runner.js +538 -0
- package/dist/runtime-v2/internalization/rollout-reviewer-runner.js.map +1 -0
- package/dist/runtime-v2/internalization/routing-policy.d.ts +24 -0
- package/dist/runtime-v2/internalization/routing-policy.d.ts.map +1 -0
- package/dist/runtime-v2/internalization/routing-policy.js +169 -0
- package/dist/runtime-v2/internalization/routing-policy.js.map +1 -0
- package/dist/runtime-v2/internalization/routing-policy.test.d.ts +2 -0
- package/dist/runtime-v2/internalization/routing-policy.test.d.ts.map +1 -0
- package/dist/runtime-v2/internalization/routing-policy.test.js +286 -0
- package/dist/runtime-v2/internalization/routing-policy.test.js.map +1 -0
- package/dist/runtime-v2/internalization/rule-code-validator.d.ts +21 -0
- package/dist/runtime-v2/internalization/rule-code-validator.d.ts.map +1 -0
- package/dist/runtime-v2/internalization/rule-code-validator.js +42 -0
- package/dist/runtime-v2/internalization/rule-code-validator.js.map +1 -0
- package/dist/runtime-v2/internalization/rule-host-adapter.d.ts +16 -0
- package/dist/runtime-v2/internalization/rule-host-adapter.d.ts.map +1 -0
- package/dist/runtime-v2/internalization/rule-host-adapter.js +13 -0
- package/dist/runtime-v2/internalization/rule-host-adapter.js.map +1 -0
- package/dist/runtime-v2/internalization/rule-host-contracts.d.ts +61 -0
- package/dist/runtime-v2/internalization/rule-host-contracts.d.ts.map +1 -0
- package/dist/runtime-v2/internalization/rule-host-contracts.js +14 -0
- package/dist/runtime-v2/internalization/rule-host-contracts.js.map +1 -0
- package/dist/runtime-v2/internalization/rule-host-evaluator.d.ts +36 -0
- package/dist/runtime-v2/internalization/rule-host-evaluator.d.ts.map +1 -0
- package/dist/runtime-v2/internalization/rule-host-evaluator.js +103 -0
- package/dist/runtime-v2/internalization/rule-host-evaluator.js.map +1 -0
- package/dist/runtime-v2/internalization/rule-host-helpers.d.ts +27 -0
- package/dist/runtime-v2/internalization/rule-host-helpers.d.ts.map +1 -0
- package/dist/runtime-v2/internalization/rule-host-helpers.js +27 -0
- package/dist/runtime-v2/internalization/rule-host-helpers.js.map +1 -0
- package/dist/runtime-v2/internalization/scribe-output.d.ts +74 -0
- package/dist/runtime-v2/internalization/scribe-output.d.ts.map +1 -0
- package/dist/runtime-v2/internalization/scribe-output.js +98 -0
- package/dist/runtime-v2/internalization/scribe-output.js.map +1 -0
- package/dist/runtime-v2/internalization/scribe-prompt-builder.d.ts +24 -0
- package/dist/runtime-v2/internalization/scribe-prompt-builder.d.ts.map +1 -0
- package/dist/runtime-v2/internalization/scribe-prompt-builder.js +60 -0
- package/dist/runtime-v2/internalization/scribe-prompt-builder.js.map +1 -0
- package/dist/runtime-v2/internalization/scribe-runner.d.ts +77 -0
- package/dist/runtime-v2/internalization/scribe-runner.d.ts.map +1 -0
- package/dist/runtime-v2/internalization/scribe-runner.js +518 -0
- package/dist/runtime-v2/internalization/scribe-runner.js.map +1 -0
- package/dist/runtime-v2/internalization/template-generator.d.ts +21 -0
- package/dist/runtime-v2/internalization/template-generator.d.ts.map +1 -0
- package/dist/runtime-v2/internalization/template-generator.js +61 -0
- package/dist/runtime-v2/internalization/template-generator.js.map +1 -0
- package/dist/runtime-v2/internalization/trainer-output.d.ts +122 -0
- package/dist/runtime-v2/internalization/trainer-output.d.ts.map +1 -0
- package/dist/runtime-v2/internalization/trainer-output.js +223 -0
- package/dist/runtime-v2/internalization/trainer-output.js.map +1 -0
- package/dist/runtime-v2/internalization/trainer-prompt-builder.d.ts +24 -0
- package/dist/runtime-v2/internalization/trainer-prompt-builder.d.ts.map +1 -0
- package/dist/runtime-v2/internalization/trainer-prompt-builder.js +57 -0
- package/dist/runtime-v2/internalization/trainer-prompt-builder.js.map +1 -0
- package/dist/runtime-v2/internalization/trainer-runner.d.ts +76 -0
- package/dist/runtime-v2/internalization/trainer-runner.d.ts.map +1 -0
- package/dist/runtime-v2/internalization/trainer-runner.js +538 -0
- package/dist/runtime-v2/internalization/trainer-runner.js.map +1 -0
- package/dist/runtime-v2/internalization-chain-integrity-read-model.d.ts +42 -0
- package/dist/runtime-v2/internalization-chain-integrity-read-model.d.ts.map +1 -0
- package/dist/runtime-v2/internalization-chain-integrity-read-model.js +413 -0
- package/dist/runtime-v2/internalization-chain-integrity-read-model.js.map +1 -0
- package/dist/runtime-v2/internalization-integrity-remediation.d.ts +17 -0
- package/dist/runtime-v2/internalization-integrity-remediation.d.ts.map +1 -0
- package/dist/runtime-v2/internalization-integrity-remediation.js +269 -0
- package/dist/runtime-v2/internalization-integrity-remediation.js.map +1 -0
- package/dist/runtime-v2/internalization-queue-read-model.d.ts +93 -0
- package/dist/runtime-v2/internalization-queue-read-model.d.ts.map +1 -0
- package/dist/runtime-v2/internalization-queue-read-model.js +217 -0
- package/dist/runtime-v2/internalization-queue-read-model.js.map +1 -0
- package/dist/runtime-v2/l1-hard-cap.d.ts +21 -0
- package/dist/runtime-v2/l1-hard-cap.d.ts.map +1 -0
- package/dist/runtime-v2/l1-hard-cap.js +51 -0
- package/dist/runtime-v2/l1-hard-cap.js.map +1 -0
- package/dist/runtime-v2/nocturnal/candidate-scoring.d.ts +486 -0
- package/dist/runtime-v2/nocturnal/candidate-scoring.d.ts.map +1 -0
- package/dist/runtime-v2/nocturnal/candidate-scoring.js +493 -0
- package/dist/runtime-v2/nocturnal/candidate-scoring.js.map +1 -0
- package/dist/runtime-v2/nocturnal/index.d.ts +9 -0
- package/dist/runtime-v2/nocturnal/index.d.ts.map +1 -0
- package/dist/runtime-v2/nocturnal/index.js +5 -0
- package/dist/runtime-v2/nocturnal/index.js.map +1 -0
- package/dist/runtime-v2/nocturnal/nocturnal-compliance.d.ts +185 -0
- package/dist/runtime-v2/nocturnal/nocturnal-compliance.d.ts.map +1 -0
- package/dist/runtime-v2/nocturnal/nocturnal-compliance.js +912 -0
- package/dist/runtime-v2/nocturnal/nocturnal-compliance.js.map +1 -0
- package/dist/runtime-v2/nocturnal/snapshot-contract.d.ts +192 -0
- package/dist/runtime-v2/nocturnal/snapshot-contract.d.ts.map +1 -0
- package/dist/runtime-v2/nocturnal/snapshot-contract.js +185 -0
- package/dist/runtime-v2/nocturnal/snapshot-contract.js.map +1 -0
- package/dist/runtime-v2/nocturnal/trinity-types.d.ts +421 -0
- package/dist/runtime-v2/nocturnal/trinity-types.d.ts.map +1 -0
- package/dist/runtime-v2/nocturnal/trinity-types.js +182 -0
- package/dist/runtime-v2/nocturnal/trinity-types.js.map +1 -0
- package/dist/runtime-v2/observer/__tests__/agent-scheduler.test.d.ts +2 -0
- package/dist/runtime-v2/observer/__tests__/agent-scheduler.test.d.ts.map +1 -0
- package/dist/runtime-v2/observer/__tests__/agent-scheduler.test.js +49 -0
- package/dist/runtime-v2/observer/__tests__/agent-scheduler.test.js.map +1 -0
- package/dist/runtime-v2/observer/__tests__/correction-observer.test.d.ts +2 -0
- package/dist/runtime-v2/observer/__tests__/correction-observer.test.d.ts.map +1 -0
- package/dist/runtime-v2/observer/__tests__/correction-observer.test.js +144 -0
- package/dist/runtime-v2/observer/__tests__/correction-observer.test.js.map +1 -0
- package/dist/runtime-v2/observer/__tests__/empathy-observer.real-e2e.test.d.ts +2 -0
- package/dist/runtime-v2/observer/__tests__/empathy-observer.real-e2e.test.d.ts.map +1 -0
- package/dist/runtime-v2/observer/__tests__/empathy-observer.real-e2e.test.js +67 -0
- package/dist/runtime-v2/observer/__tests__/empathy-observer.real-e2e.test.js.map +1 -0
- package/dist/runtime-v2/observer/__tests__/empathy-observer.test.d.ts +2 -0
- package/dist/runtime-v2/observer/__tests__/empathy-observer.test.d.ts.map +1 -0
- package/dist/runtime-v2/observer/__tests__/empathy-observer.test.js +84 -0
- package/dist/runtime-v2/observer/__tests__/empathy-observer.test.js.map +1 -0
- package/dist/runtime-v2/observer/agent-scheduler.d.ts +40 -0
- package/dist/runtime-v2/observer/agent-scheduler.d.ts.map +1 -0
- package/dist/runtime-v2/observer/agent-scheduler.js +30 -0
- package/dist/runtime-v2/observer/agent-scheduler.js.map +1 -0
- package/dist/runtime-v2/observer/correction-observer.d.ts +59 -0
- package/dist/runtime-v2/observer/correction-observer.d.ts.map +1 -0
- package/dist/runtime-v2/observer/correction-observer.js +178 -0
- package/dist/runtime-v2/observer/correction-observer.js.map +1 -0
- package/dist/runtime-v2/observer/empathy-observer.d.ts +35 -0
- package/dist/runtime-v2/observer/empathy-observer.d.ts.map +1 -0
- package/dist/runtime-v2/observer/empathy-observer.js +98 -0
- package/dist/runtime-v2/observer/empathy-observer.js.map +1 -0
- package/dist/runtime-v2/operator-health-read-model.d.ts +45 -0
- package/dist/runtime-v2/operator-health-read-model.d.ts.map +1 -0
- package/dist/runtime-v2/operator-health-read-model.js +189 -0
- package/dist/runtime-v2/operator-health-read-model.js.map +1 -0
- package/dist/runtime-v2/pain-chain-read-model.d.ts +40 -0
- package/dist/runtime-v2/pain-chain-read-model.d.ts.map +1 -0
- package/dist/runtime-v2/pain-chain-read-model.js +293 -0
- package/dist/runtime-v2/pain-chain-read-model.js.map +1 -0
- package/dist/runtime-v2/pain-flood-simulation.d.ts +62 -0
- package/dist/runtime-v2/pain-flood-simulation.d.ts.map +1 -0
- package/dist/runtime-v2/pain-flood-simulation.js +152 -0
- package/dist/runtime-v2/pain-flood-simulation.js.map +1 -0
- package/dist/runtime-v2/pain-signal-bridge.d.ts +72 -0
- package/dist/runtime-v2/pain-signal-bridge.d.ts.map +1 -0
- package/dist/runtime-v2/pain-signal-bridge.js +340 -0
- package/dist/runtime-v2/pain-signal-bridge.js.map +1 -0
- package/dist/runtime-v2/pain-signal-observability.d.ts +19 -0
- package/dist/runtime-v2/pain-signal-observability.d.ts.map +1 -0
- package/dist/runtime-v2/pain-signal-observability.js +161 -0
- package/dist/runtime-v2/pain-signal-observability.js.map +1 -0
- package/dist/runtime-v2/pain-signal-runtime-factory.d.ts +82 -0
- package/dist/runtime-v2/pain-signal-runtime-factory.d.ts.map +1 -0
- package/dist/runtime-v2/pain-signal-runtime-factory.js +279 -0
- package/dist/runtime-v2/pain-signal-runtime-factory.js.map +1 -0
- package/dist/runtime-v2/pain-to-principle-service.d.ts +53 -0
- package/dist/runtime-v2/pain-to-principle-service.d.ts.map +1 -0
- package/dist/runtime-v2/pain-to-principle-service.js +114 -0
- package/dist/runtime-v2/pain-to-principle-service.js.map +1 -0
- package/dist/runtime-v2/proven-channel-baseline.d.ts +56 -0
- package/dist/runtime-v2/proven-channel-baseline.d.ts.map +1 -0
- package/dist/runtime-v2/proven-channel-baseline.js +480 -0
- package/dist/runtime-v2/proven-channel-baseline.js.map +1 -0
- package/dist/runtime-v2/pruning-mask.d.ts +27 -0
- package/dist/runtime-v2/pruning-mask.d.ts.map +1 -0
- package/dist/runtime-v2/pruning-mask.js +59 -0
- package/dist/runtime-v2/pruning-mask.js.map +1 -0
- package/dist/runtime-v2/pruning-read-model.d.ts +76 -0
- package/dist/runtime-v2/pruning-read-model.d.ts.map +1 -0
- package/dist/runtime-v2/pruning-read-model.js +266 -0
- package/dist/runtime-v2/pruning-read-model.js.map +1 -0
- package/dist/runtime-v2/pruning-review-log.d.ts +41 -0
- package/dist/runtime-v2/pruning-review-log.d.ts.map +1 -0
- package/dist/runtime-v2/pruning-review-log.js +106 -0
- package/dist/runtime-v2/pruning-review-log.js.map +1 -0
- package/dist/runtime-v2/recovery-sweep-service.d.ts +14 -0
- package/dist/runtime-v2/recovery-sweep-service.d.ts.map +1 -0
- package/dist/runtime-v2/recovery-sweep-service.js +26 -0
- package/dist/runtime-v2/recovery-sweep-service.js.map +1 -0
- package/dist/runtime-v2/remediation-contract.d.ts +46 -0
- package/dist/runtime-v2/remediation-contract.d.ts.map +1 -0
- package/dist/runtime-v2/remediation-contract.js +29 -0
- package/dist/runtime-v2/remediation-contract.js.map +1 -0
- package/dist/runtime-v2/runner/__tests__/default-validator.test.d.ts +2 -0
- package/dist/runtime-v2/runner/__tests__/default-validator.test.d.ts.map +1 -0
- package/dist/runtime-v2/runner/__tests__/default-validator.test.js +526 -0
- package/dist/runtime-v2/runner/__tests__/default-validator.test.js.map +1 -0
- package/dist/runtime-v2/runner/__tests__/diagnose.test.d.ts +2 -0
- package/dist/runtime-v2/runner/__tests__/diagnose.test.d.ts.map +1 -0
- package/dist/runtime-v2/runner/__tests__/diagnose.test.js +81 -0
- package/dist/runtime-v2/runner/__tests__/diagnose.test.js.map +1 -0
- package/dist/runtime-v2/runner/__tests__/diagnostician-runner.integration.test.d.ts +2 -0
- package/dist/runtime-v2/runner/__tests__/diagnostician-runner.integration.test.d.ts.map +1 -0
- package/dist/runtime-v2/runner/__tests__/diagnostician-runner.integration.test.js +378 -0
- package/dist/runtime-v2/runner/__tests__/diagnostician-runner.integration.test.js.map +1 -0
- package/dist/runtime-v2/runner/__tests__/diagnostician-runner.test.d.ts +2 -0
- package/dist/runtime-v2/runner/__tests__/diagnostician-runner.test.d.ts.map +1 -0
- package/dist/runtime-v2/runner/__tests__/diagnostician-runner.test.js +642 -0
- package/dist/runtime-v2/runner/__tests__/diagnostician-runner.test.js.map +1 -0
- package/dist/runtime-v2/runner/__tests__/diagnostician-telemetry.test.d.ts +2 -0
- package/dist/runtime-v2/runner/__tests__/diagnostician-telemetry.test.d.ts.map +1 -0
- package/dist/runtime-v2/runner/__tests__/diagnostician-telemetry.test.js +286 -0
- package/dist/runtime-v2/runner/__tests__/diagnostician-telemetry.test.js.map +1 -0
- package/dist/runtime-v2/runner/__tests__/dual-track-e2e.test.d.ts +2 -0
- package/dist/runtime-v2/runner/__tests__/dual-track-e2e.test.d.ts.map +1 -0
- package/dist/runtime-v2/runner/__tests__/dual-track-e2e.test.js +320 -0
- package/dist/runtime-v2/runner/__tests__/dual-track-e2e.test.js.map +1 -0
- package/dist/runtime-v2/runner/__tests__/lease-expiration-recovery.integration.test.d.ts +2 -0
- package/dist/runtime-v2/runner/__tests__/lease-expiration-recovery.integration.test.d.ts.map +1 -0
- package/dist/runtime-v2/runner/__tests__/lease-expiration-recovery.integration.test.js +261 -0
- package/dist/runtime-v2/runner/__tests__/lease-expiration-recovery.integration.test.js.map +1 -0
- package/dist/runtime-v2/runner/__tests__/m5-05-e2e.test.d.ts +2 -0
- package/dist/runtime-v2/runner/__tests__/m5-05-e2e.test.d.ts.map +1 -0
- package/dist/runtime-v2/runner/__tests__/m5-05-e2e.test.js +405 -0
- package/dist/runtime-v2/runner/__tests__/m5-05-e2e.test.js.map +1 -0
- package/dist/runtime-v2/runner/__tests__/m6-06-e2e.test.d.ts +2 -0
- package/dist/runtime-v2/runner/__tests__/m6-06-e2e.test.d.ts.map +1 -0
- package/dist/runtime-v2/runner/__tests__/m6-06-e2e.test.js +347 -0
- package/dist/runtime-v2/runner/__tests__/m6-06-e2e.test.js.map +1 -0
- package/dist/runtime-v2/runner/__tests__/m6-06-legacy.test.d.ts +2 -0
- package/dist/runtime-v2/runner/__tests__/m6-06-legacy.test.d.ts.map +1 -0
- package/dist/runtime-v2/runner/__tests__/m6-06-legacy.test.js +186 -0
- package/dist/runtime-v2/runner/__tests__/m6-06-legacy.test.js.map +1 -0
- package/dist/runtime-v2/runner/__tests__/m6-06-real-path.test.d.ts +2 -0
- package/dist/runtime-v2/runner/__tests__/m6-06-real-path.test.d.ts.map +1 -0
- package/dist/runtime-v2/runner/__tests__/m6-06-real-path.test.js +355 -0
- package/dist/runtime-v2/runner/__tests__/m6-06-real-path.test.js.map +1 -0
- package/dist/runtime-v2/runner/__tests__/m8-02-e2e.test.d.ts +2 -0
- package/dist/runtime-v2/runner/__tests__/m8-02-e2e.test.d.ts.map +1 -0
- package/dist/runtime-v2/runner/__tests__/m8-02-e2e.test.js +488 -0
- package/dist/runtime-v2/runner/__tests__/m8-02-e2e.test.js.map +1 -0
- package/dist/runtime-v2/runner/__tests__/m9-adapter-integration.test.d.ts +2 -0
- package/dist/runtime-v2/runner/__tests__/m9-adapter-integration.test.d.ts.map +1 -0
- package/dist/runtime-v2/runner/__tests__/m9-adapter-integration.test.js +171 -0
- package/dist/runtime-v2/runner/__tests__/m9-adapter-integration.test.js.map +1 -0
- package/dist/runtime-v2/runner/__tests__/m9-e2e.test.d.ts +2 -0
- package/dist/runtime-v2/runner/__tests__/m9-e2e.test.d.ts.map +1 -0
- package/dist/runtime-v2/runner/__tests__/m9-e2e.test.js +182 -0
- package/dist/runtime-v2/runner/__tests__/m9-e2e.test.js.map +1 -0
- package/dist/runtime-v2/runner/__tests__/max-attempts-exceeded.integration.test.d.ts +2 -0
- package/dist/runtime-v2/runner/__tests__/max-attempts-exceeded.integration.test.d.ts.map +1 -0
- package/dist/runtime-v2/runner/__tests__/max-attempts-exceeded.integration.test.js +276 -0
- package/dist/runtime-v2/runner/__tests__/max-attempts-exceeded.integration.test.js.map +1 -0
- package/dist/runtime-v2/runner/__tests__/pain-signal-bridge-admission.test.d.ts +2 -0
- package/dist/runtime-v2/runner/__tests__/pain-signal-bridge-admission.test.d.ts.map +1 -0
- package/dist/runtime-v2/runner/__tests__/pain-signal-bridge-admission.test.js +462 -0
- package/dist/runtime-v2/runner/__tests__/pain-signal-bridge-admission.test.js.map +1 -0
- package/dist/runtime-v2/runner/__tests__/pain-signal-bridge.test.d.ts +2 -0
- package/dist/runtime-v2/runner/__tests__/pain-signal-bridge.test.d.ts.map +1 -0
- package/dist/runtime-v2/runner/__tests__/pain-signal-bridge.test.js +160 -0
- package/dist/runtime-v2/runner/__tests__/pain-signal-bridge.test.js.map +1 -0
- package/dist/runtime-v2/runner/__tests__/retry-wait-recovery.integration.test.d.ts +2 -0
- package/dist/runtime-v2/runner/__tests__/retry-wait-recovery.integration.test.d.ts.map +1 -0
- package/dist/runtime-v2/runner/__tests__/retry-wait-recovery.integration.test.js +272 -0
- package/dist/runtime-v2/runner/__tests__/retry-wait-recovery.integration.test.js.map +1 -0
- package/dist/runtime-v2/runner/__tests__/start-run-input.test.d.ts +2 -0
- package/dist/runtime-v2/runner/__tests__/start-run-input.test.d.ts.map +1 -0
- package/dist/runtime-v2/runner/__tests__/start-run-input.test.js +67 -0
- package/dist/runtime-v2/runner/__tests__/start-run-input.test.js.map +1 -0
- package/dist/runtime-v2/runner/default-validator.d.ts +10 -0
- package/dist/runtime-v2/runner/default-validator.d.ts.map +1 -0
- package/dist/runtime-v2/runner/default-validator.js +168 -0
- package/dist/runtime-v2/runner/default-validator.js.map +1 -0
- package/dist/runtime-v2/runner/diagnostician-runner-options.d.ts +37 -0
- package/dist/runtime-v2/runner/diagnostician-runner-options.d.ts.map +1 -0
- package/dist/runtime-v2/runner/diagnostician-runner-options.js +19 -0
- package/dist/runtime-v2/runner/diagnostician-runner-options.js.map +1 -0
- package/dist/runtime-v2/runner/diagnostician-runner.d.ts +87 -0
- package/dist/runtime-v2/runner/diagnostician-runner.d.ts.map +1 -0
- package/dist/runtime-v2/runner/diagnostician-runner.js +417 -0
- package/dist/runtime-v2/runner/diagnostician-runner.js.map +1 -0
- package/dist/runtime-v2/runner/diagnostician-validator.d.ts +56 -0
- package/dist/runtime-v2/runner/diagnostician-validator.d.ts.map +1 -0
- package/dist/runtime-v2/runner/diagnostician-validator.js +11 -0
- package/dist/runtime-v2/runner/diagnostician-validator.js.map +1 -0
- package/dist/runtime-v2/runner/runner-phase.d.ts +21 -0
- package/dist/runtime-v2/runner/runner-phase.d.ts.map +1 -0
- package/dist/runtime-v2/runner/runner-phase.js +22 -0
- package/dist/runtime-v2/runner/runner-phase.js.map +1 -0
- package/dist/runtime-v2/runner/runner-result.d.ts +20 -0
- package/dist/runtime-v2/runner/runner-result.d.ts.map +1 -0
- package/dist/runtime-v2/runner/runner-result.js +2 -0
- package/dist/runtime-v2/runner/runner-result.js.map +1 -0
- package/dist/runtime-v2/runtime-protocol.d.ts +165 -0
- package/dist/runtime-v2/runtime-protocol.d.ts.map +1 -0
- package/dist/runtime-v2/runtime-protocol.js +130 -0
- package/dist/runtime-v2/runtime-protocol.js.map +1 -0
- package/dist/runtime-v2/runtime-selector.d.ts +77 -0
- package/dist/runtime-v2/runtime-selector.d.ts.map +1 -0
- package/dist/runtime-v2/runtime-selector.js +23 -0
- package/dist/runtime-v2/runtime-selector.js.map +1 -0
- package/dist/runtime-v2/runtime-state-handle.d.ts +10 -0
- package/dist/runtime-v2/runtime-state-handle.d.ts.map +1 -0
- package/dist/runtime-v2/runtime-state-handle.js +30 -0
- package/dist/runtime-v2/runtime-state-handle.js.map +1 -0
- package/dist/runtime-v2/schema-conformance-read-model.d.ts +24 -0
- package/dist/runtime-v2/schema-conformance-read-model.d.ts.map +1 -0
- package/dist/runtime-v2/schema-conformance-read-model.js +178 -0
- package/dist/runtime-v2/schema-conformance-read-model.js.map +1 -0
- package/dist/runtime-v2/schema-version.d.ts +20 -0
- package/dist/runtime-v2/schema-version.d.ts.map +1 -0
- package/dist/runtime-v2/schema-version.js +20 -0
- package/dist/runtime-v2/schema-version.js.map +1 -0
- package/dist/runtime-v2/store/artifact/artifact-store.d.ts +28 -0
- package/dist/runtime-v2/store/artifact/artifact-store.d.ts.map +1 -0
- package/dist/runtime-v2/store/artifact/artifact-store.js +2 -0
- package/dist/runtime-v2/store/artifact/artifact-store.js.map +1 -0
- package/dist/runtime-v2/store/artifact/index.d.ts +4 -0
- package/dist/runtime-v2/store/artifact/index.d.ts.map +1 -0
- package/dist/runtime-v2/store/artifact/index.js +3 -0
- package/dist/runtime-v2/store/artifact/index.js.map +1 -0
- package/dist/runtime-v2/store/artifact/memory-artifact-store.d.ts +14 -0
- package/dist/runtime-v2/store/artifact/memory-artifact-store.d.ts.map +1 -0
- package/dist/runtime-v2/store/artifact/memory-artifact-store.js +25 -0
- package/dist/runtime-v2/store/artifact/memory-artifact-store.js.map +1 -0
- package/dist/runtime-v2/store/artifact/sqlite-artifact-store.d.ts +12 -0
- package/dist/runtime-v2/store/artifact/sqlite-artifact-store.d.ts.map +1 -0
- package/dist/runtime-v2/store/artifact/sqlite-artifact-store.js +51 -0
- package/dist/runtime-v2/store/artifact/sqlite-artifact-store.js.map +1 -0
- package/dist/runtime-v2/store/artifact/sqlite-pi-artifact-store.d.ts +13 -0
- package/dist/runtime-v2/store/artifact/sqlite-pi-artifact-store.d.ts.map +1 -0
- package/dist/runtime-v2/store/artifact/sqlite-pi-artifact-store.js +98 -0
- package/dist/runtime-v2/store/artifact/sqlite-pi-artifact-store.js.map +1 -0
- package/dist/runtime-v2/store/candidate/__tests__/recommendation-kind-resolver.test.d.ts +2 -0
- package/dist/runtime-v2/store/candidate/__tests__/recommendation-kind-resolver.test.d.ts.map +1 -0
- package/dist/runtime-v2/store/candidate/__tests__/recommendation-kind-resolver.test.js +34 -0
- package/dist/runtime-v2/store/candidate/__tests__/recommendation-kind-resolver.test.js.map +1 -0
- package/dist/runtime-v2/store/candidate/candidate-store.d.ts +42 -0
- package/dist/runtime-v2/store/candidate/candidate-store.d.ts.map +1 -0
- package/dist/runtime-v2/store/candidate/candidate-store.js +2 -0
- package/dist/runtime-v2/store/candidate/candidate-store.js.map +1 -0
- package/dist/runtime-v2/store/candidate/index.d.ts +4 -0
- package/dist/runtime-v2/store/candidate/index.d.ts.map +1 -0
- package/dist/runtime-v2/store/candidate/index.js +3 -0
- package/dist/runtime-v2/store/candidate/index.js.map +1 -0
- package/dist/runtime-v2/store/candidate/memory-candidate-store.d.ts +22 -0
- package/dist/runtime-v2/store/candidate/memory-candidate-store.d.ts.map +1 -0
- package/dist/runtime-v2/store/candidate/memory-candidate-store.js +36 -0
- package/dist/runtime-v2/store/candidate/memory-candidate-store.js.map +1 -0
- package/dist/runtime-v2/store/candidate/recommendation-kind-resolver.d.ts +4 -0
- package/dist/runtime-v2/store/candidate/recommendation-kind-resolver.d.ts.map +1 -0
- package/dist/runtime-v2/store/candidate/recommendation-kind-resolver.js +14 -0
- package/dist/runtime-v2/store/candidate/recommendation-kind-resolver.js.map +1 -0
- package/dist/runtime-v2/store/candidate/sqlite-candidate-store.d.ts +13 -0
- package/dist/runtime-v2/store/candidate/sqlite-candidate-store.d.ts.map +1 -0
- package/dist/runtime-v2/store/candidate/sqlite-candidate-store.js +61 -0
- package/dist/runtime-v2/store/candidate/sqlite-candidate-store.js.map +1 -0
- package/dist/runtime-v2/store/commit/commit-store.d.ts +19 -0
- package/dist/runtime-v2/store/commit/commit-store.d.ts.map +1 -0
- package/dist/runtime-v2/store/commit/commit-store.js +2 -0
- package/dist/runtime-v2/store/commit/commit-store.js.map +1 -0
- package/dist/runtime-v2/store/commit/diagnostician-committer.d.ts +47 -0
- package/dist/runtime-v2/store/commit/diagnostician-committer.d.ts.map +1 -0
- package/dist/runtime-v2/store/commit/diagnostician-committer.js +140 -0
- package/dist/runtime-v2/store/commit/diagnostician-committer.js.map +1 -0
- package/dist/runtime-v2/store/commit/index.d.ts +7 -0
- package/dist/runtime-v2/store/commit/index.d.ts.map +1 -0
- package/dist/runtime-v2/store/commit/index.js +4 -0
- package/dist/runtime-v2/store/commit/index.js.map +1 -0
- package/dist/runtime-v2/store/commit/memory-commit-store.d.ts +16 -0
- package/dist/runtime-v2/store/commit/memory-commit-store.d.ts.map +1 -0
- package/dist/runtime-v2/store/commit/memory-commit-store.js +18 -0
- package/dist/runtime-v2/store/commit/memory-commit-store.js.map +1 -0
- package/dist/runtime-v2/store/commit/sqlite-commit-store.d.ts +11 -0
- package/dist/runtime-v2/store/commit/sqlite-commit-store.d.ts.map +1 -0
- package/dist/runtime-v2/store/commit/sqlite-commit-store.js +25 -0
- package/dist/runtime-v2/store/commit/sqlite-commit-store.js.map +1 -0
- package/dist/runtime-v2/store/concurrent-lease.test.d.ts +2 -0
- package/dist/runtime-v2/store/concurrent-lease.test.d.ts.map +1 -0
- package/dist/runtime-v2/store/concurrent-lease.test.js +129 -0
- package/dist/runtime-v2/store/concurrent-lease.test.js.map +1 -0
- package/dist/runtime-v2/store/context/context-assembler.d.ts +19 -0
- package/dist/runtime-v2/store/context/context-assembler.d.ts.map +1 -0
- package/dist/runtime-v2/store/context/context-assembler.js +2 -0
- package/dist/runtime-v2/store/context/context-assembler.js.map +1 -0
- package/dist/runtime-v2/store/context/index.d.ts +4 -0
- package/dist/runtime-v2/store/context/index.d.ts.map +1 -0
- package/dist/runtime-v2/store/context/index.js +3 -0
- package/dist/runtime-v2/store/context/index.js.map +1 -0
- package/dist/runtime-v2/store/context/resilient-context-assembler.d.ts +13 -0
- package/dist/runtime-v2/store/context/resilient-context-assembler.d.ts.map +1 -0
- package/dist/runtime-v2/store/context/resilient-context-assembler.js +72 -0
- package/dist/runtime-v2/store/context/resilient-context-assembler.js.map +1 -0
- package/dist/runtime-v2/store/context/resilient-context-assembler.test.d.ts +2 -0
- package/dist/runtime-v2/store/context/resilient-context-assembler.test.d.ts.map +1 -0
- package/dist/runtime-v2/store/context/resilient-context-assembler.test.js +113 -0
- package/dist/runtime-v2/store/context/resilient-context-assembler.test.js.map +1 -0
- package/dist/runtime-v2/store/context/sqlite-context-assembler.d.ts +28 -0
- package/dist/runtime-v2/store/context/sqlite-context-assembler.d.ts.map +1 -0
- package/dist/runtime-v2/store/context/sqlite-context-assembler.js +277 -0
- package/dist/runtime-v2/store/context/sqlite-context-assembler.js.map +1 -0
- package/dist/runtime-v2/store/context/sqlite-context-assembler.test.d.ts +2 -0
- package/dist/runtime-v2/store/context/sqlite-context-assembler.test.d.ts.map +1 -0
- package/dist/runtime-v2/store/context/sqlite-context-assembler.test.js +1181 -0
- package/dist/runtime-v2/store/context/sqlite-context-assembler.test.js.map +1 -0
- package/dist/runtime-v2/store/diagnostician-committer.test.d.ts +2 -0
- package/dist/runtime-v2/store/diagnostician-committer.test.d.ts.map +1 -0
- package/dist/runtime-v2/store/diagnostician-committer.test.js +326 -0
- package/dist/runtime-v2/store/diagnostician-committer.test.js.map +1 -0
- package/dist/runtime-v2/store/event-emitter.d.ts +18 -0
- package/dist/runtime-v2/store/event-emitter.d.ts.map +1 -0
- package/dist/runtime-v2/store/event-emitter.js +78 -0
- package/dist/runtime-v2/store/event-emitter.js.map +1 -0
- package/dist/runtime-v2/store/history/history-query.d.ts +57 -0
- package/dist/runtime-v2/store/history/history-query.d.ts.map +1 -0
- package/dist/runtime-v2/store/history/history-query.js +7 -0
- package/dist/runtime-v2/store/history/history-query.js.map +1 -0
- package/dist/runtime-v2/store/history/index.d.ts +5 -0
- package/dist/runtime-v2/store/history/index.d.ts.map +1 -0
- package/dist/runtime-v2/store/history/index.js +4 -0
- package/dist/runtime-v2/store/history/index.js.map +1 -0
- package/dist/runtime-v2/store/history/resilient-history-query.d.ts +20 -0
- package/dist/runtime-v2/store/history/resilient-history-query.d.ts.map +1 -0
- package/dist/runtime-v2/store/history/resilient-history-query.js +40 -0
- package/dist/runtime-v2/store/history/resilient-history-query.js.map +1 -0
- package/dist/runtime-v2/store/history/resilient-history-query.test.d.ts +2 -0
- package/dist/runtime-v2/store/history/resilient-history-query.test.d.ts.map +1 -0
- package/dist/runtime-v2/store/history/resilient-history-query.test.js +128 -0
- package/dist/runtime-v2/store/history/resilient-history-query.test.js.map +1 -0
- package/dist/runtime-v2/store/history/sqlite-history-query.d.ts +24 -0
- package/dist/runtime-v2/store/history/sqlite-history-query.d.ts.map +1 -0
- package/dist/runtime-v2/store/history/sqlite-history-query.js +166 -0
- package/dist/runtime-v2/store/history/sqlite-history-query.js.map +1 -0
- package/dist/runtime-v2/store/history/sqlite-history-query.test.d.ts +2 -0
- package/dist/runtime-v2/store/history/sqlite-history-query.test.d.ts.map +1 -0
- package/dist/runtime-v2/store/history/sqlite-history-query.test.js +536 -0
- package/dist/runtime-v2/store/history/sqlite-history-query.test.js.map +1 -0
- package/dist/runtime-v2/store/idempotent-transitions.test.d.ts +2 -0
- package/dist/runtime-v2/store/idempotent-transitions.test.d.ts.map +1 -0
- package/dist/runtime-v2/store/idempotent-transitions.test.js +168 -0
- package/dist/runtime-v2/store/idempotent-transitions.test.js.map +1 -0
- package/dist/runtime-v2/store/lifecycle/index.d.ts +7 -0
- package/dist/runtime-v2/store/lifecycle/index.d.ts.map +1 -0
- package/dist/runtime-v2/store/lifecycle/index.js +4 -0
- package/dist/runtime-v2/store/lifecycle/index.js.map +1 -0
- package/dist/runtime-v2/store/lifecycle/lease-manager.d.ts +91 -0
- package/dist/runtime-v2/store/lifecycle/lease-manager.d.ts.map +1 -0
- package/dist/runtime-v2/store/lifecycle/lease-manager.js +154 -0
- package/dist/runtime-v2/store/lifecycle/lease-manager.js.map +1 -0
- package/dist/runtime-v2/store/lifecycle/lease-manager.test.d.ts +2 -0
- package/dist/runtime-v2/store/lifecycle/lease-manager.test.d.ts.map +1 -0
- package/dist/runtime-v2/store/lifecycle/lease-manager.test.js +243 -0
- package/dist/runtime-v2/store/lifecycle/lease-manager.test.js.map +1 -0
- package/dist/runtime-v2/store/lifecycle/recovery-sweep.d.ts +82 -0
- package/dist/runtime-v2/store/lifecycle/recovery-sweep.d.ts.map +1 -0
- package/dist/runtime-v2/store/lifecycle/recovery-sweep.js +145 -0
- package/dist/runtime-v2/store/lifecycle/recovery-sweep.js.map +1 -0
- package/dist/runtime-v2/store/lifecycle/recovery-sweep.test.d.ts +2 -0
- package/dist/runtime-v2/store/lifecycle/recovery-sweep.test.d.ts.map +1 -0
- package/dist/runtime-v2/store/lifecycle/recovery-sweep.test.js +318 -0
- package/dist/runtime-v2/store/lifecycle/recovery-sweep.test.js.map +1 -0
- package/dist/runtime-v2/store/lifecycle/retry-policy.d.ts +105 -0
- package/dist/runtime-v2/store/lifecycle/retry-policy.d.ts.map +1 -0
- package/dist/runtime-v2/store/lifecycle/retry-policy.js +48 -0
- package/dist/runtime-v2/store/lifecycle/retry-policy.js.map +1 -0
- package/dist/runtime-v2/store/lifecycle/retry-policy.test.d.ts +2 -0
- package/dist/runtime-v2/store/lifecycle/retry-policy.test.d.ts.map +1 -0
- package/dist/runtime-v2/store/lifecycle/retry-policy.test.js +86 -0
- package/dist/runtime-v2/store/lifecycle/retry-policy.test.js.map +1 -0
- package/dist/runtime-v2/store/run/index.d.ts +4 -0
- package/dist/runtime-v2/store/run/index.d.ts.map +1 -0
- package/dist/runtime-v2/store/run/index.js +3 -0
- package/dist/runtime-v2/store/run/index.js.map +1 -0
- package/dist/runtime-v2/store/run/memory-run-store.d.ts +15 -0
- package/dist/runtime-v2/store/run/memory-run-store.d.ts.map +1 -0
- package/dist/runtime-v2/store/run/memory-run-store.js +33 -0
- package/dist/runtime-v2/store/run/memory-run-store.js.map +1 -0
- package/dist/runtime-v2/store/run/run-store.d.ts +43 -0
- package/dist/runtime-v2/store/run/run-store.d.ts.map +1 -0
- package/dist/runtime-v2/store/run/run-store.js +2 -0
- package/dist/runtime-v2/store/run/run-store.js.map +1 -0
- package/dist/runtime-v2/store/run/sqlite-run-store.d.ts +14 -0
- package/dist/runtime-v2/store/run/sqlite-run-store.d.ts.map +1 -0
- package/dist/runtime-v2/store/run/sqlite-run-store.js +108 -0
- package/dist/runtime-v2/store/run/sqlite-run-store.js.map +1 -0
- package/dist/runtime-v2/store/runtime-state-manager.d.ts +116 -0
- package/dist/runtime-v2/store/runtime-state-manager.d.ts.map +1 -0
- package/dist/runtime-v2/store/runtime-state-manager.integration.test.d.ts +2 -0
- package/dist/runtime-v2/store/runtime-state-manager.integration.test.d.ts.map +1 -0
- package/dist/runtime-v2/store/runtime-state-manager.integration.test.js +187 -0
- package/dist/runtime-v2/store/runtime-state-manager.integration.test.js.map +1 -0
- package/dist/runtime-v2/store/runtime-state-manager.js +321 -0
- package/dist/runtime-v2/store/runtime-state-manager.js.map +1 -0
- package/dist/runtime-v2/store/schema-conformance.test.d.ts +2 -0
- package/dist/runtime-v2/store/schema-conformance.test.d.ts.map +1 -0
- package/dist/runtime-v2/store/schema-conformance.test.js +607 -0
- package/dist/runtime-v2/store/schema-conformance.test.js.map +1 -0
- package/dist/runtime-v2/store/sqlite-connection-close.test.d.ts +2 -0
- package/dist/runtime-v2/store/sqlite-connection-close.test.d.ts.map +1 -0
- package/dist/runtime-v2/store/sqlite-connection-close.test.js +57 -0
- package/dist/runtime-v2/store/sqlite-connection-close.test.js.map +1 -0
- package/dist/runtime-v2/store/sqlite-connection-pragma.test.d.ts +2 -0
- package/dist/runtime-v2/store/sqlite-connection-pragma.test.d.ts.map +1 -0
- package/dist/runtime-v2/store/sqlite-connection-pragma.test.js +261 -0
- package/dist/runtime-v2/store/sqlite-connection-pragma.test.js.map +1 -0
- package/dist/runtime-v2/store/sqlite-connection.d.ts +39 -0
- package/dist/runtime-v2/store/sqlite-connection.d.ts.map +1 -0
- package/dist/runtime-v2/store/sqlite-connection.js +364 -0
- package/dist/runtime-v2/store/sqlite-connection.js.map +1 -0
- package/dist/runtime-v2/store/sqlite-run-store.test.d.ts +2 -0
- package/dist/runtime-v2/store/sqlite-run-store.test.d.ts.map +1 -0
- package/dist/runtime-v2/store/sqlite-run-store.test.js +152 -0
- package/dist/runtime-v2/store/sqlite-run-store.test.js.map +1 -0
- package/dist/runtime-v2/store/sqlite-task-store.test.d.ts +2 -0
- package/dist/runtime-v2/store/sqlite-task-store.test.d.ts.map +1 -0
- package/dist/runtime-v2/store/sqlite-task-store.test.js +166 -0
- package/dist/runtime-v2/store/sqlite-task-store.test.js.map +1 -0
- package/dist/runtime-v2/store/task/index.d.ts +4 -0
- package/dist/runtime-v2/store/task/index.d.ts.map +1 -0
- package/dist/runtime-v2/store/task/index.js +3 -0
- package/dist/runtime-v2/store/task/index.js.map +1 -0
- package/dist/runtime-v2/store/task/memory-task-store.d.ts +15 -0
- package/dist/runtime-v2/store/task/memory-task-store.d.ts.map +1 -0
- package/dist/runtime-v2/store/task/memory-task-store.js +43 -0
- package/dist/runtime-v2/store/task/memory-task-store.js.map +1 -0
- package/dist/runtime-v2/store/task/sqlite-task-store.d.ts +14 -0
- package/dist/runtime-v2/store/task/sqlite-task-store.d.ts.map +1 -0
- package/dist/runtime-v2/store/task/sqlite-task-store.js +144 -0
- package/dist/runtime-v2/store/task/sqlite-task-store.js.map +1 -0
- package/dist/runtime-v2/store/task/task-store.d.ts +48 -0
- package/dist/runtime-v2/store/task/task-store.d.ts.map +1 -0
- package/dist/runtime-v2/store/task/task-store.js +2 -0
- package/dist/runtime-v2/store/task/task-store.js.map +1 -0
- package/dist/runtime-v2/store/task-migration.d.ts +89 -0
- package/dist/runtime-v2/store/task-migration.d.ts.map +1 -0
- package/dist/runtime-v2/store/task-migration.js +79 -0
- package/dist/runtime-v2/store/task-migration.js.map +1 -0
- package/dist/runtime-v2/store/trajectory/index.d.ts +5 -0
- package/dist/runtime-v2/store/trajectory/index.d.ts.map +1 -0
- package/dist/runtime-v2/store/trajectory/index.js +3 -0
- package/dist/runtime-v2/store/trajectory/index.js.map +1 -0
- package/dist/runtime-v2/store/trajectory/source-trace-locator.d.ts +40 -0
- package/dist/runtime-v2/store/trajectory/source-trace-locator.d.ts.map +1 -0
- package/dist/runtime-v2/store/trajectory/source-trace-locator.js +18 -0
- package/dist/runtime-v2/store/trajectory/source-trace-locator.js.map +1 -0
- package/dist/runtime-v2/store/trajectory/source-trace-locator.test.d.ts +2 -0
- package/dist/runtime-v2/store/trajectory/source-trace-locator.test.d.ts.map +1 -0
- package/dist/runtime-v2/store/trajectory/source-trace-locator.test.js +320 -0
- package/dist/runtime-v2/store/trajectory/source-trace-locator.test.js.map +1 -0
- package/dist/runtime-v2/store/trajectory/sqlite-source-trace-locator.d.ts +23 -0
- package/dist/runtime-v2/store/trajectory/sqlite-source-trace-locator.d.ts.map +1 -0
- package/dist/runtime-v2/store/trajectory/sqlite-source-trace-locator.js +140 -0
- package/dist/runtime-v2/store/trajectory/sqlite-source-trace-locator.js.map +1 -0
- package/dist/runtime-v2/store/trajectory/sqlite-trajectory-locator.d.ts +27 -0
- package/dist/runtime-v2/store/trajectory/sqlite-trajectory-locator.d.ts.map +1 -0
- package/dist/runtime-v2/store/trajectory/sqlite-trajectory-locator.js +183 -0
- package/dist/runtime-v2/store/trajectory/sqlite-trajectory-locator.js.map +1 -0
- package/dist/runtime-v2/store/trajectory/sqlite-trajectory-locator.test.d.ts +2 -0
- package/dist/runtime-v2/store/trajectory/sqlite-trajectory-locator.test.d.ts.map +1 -0
- package/dist/runtime-v2/store/trajectory/sqlite-trajectory-locator.test.js +328 -0
- package/dist/runtime-v2/store/trajectory/sqlite-trajectory-locator.test.js.map +1 -0
- package/dist/runtime-v2/store/trajectory/trajectory-locator.d.ts +30 -0
- package/dist/runtime-v2/store/trajectory/trajectory-locator.d.ts.map +1 -0
- package/dist/runtime-v2/store/trajectory/trajectory-locator.js +2 -0
- package/dist/runtime-v2/store/trajectory/trajectory-locator.js.map +1 -0
- package/dist/runtime-v2/store/workspace-isolation.test.d.ts +2 -0
- package/dist/runtime-v2/store/workspace-isolation.test.d.ts.map +1 -0
- package/dist/runtime-v2/store/workspace-isolation.test.js +139 -0
- package/dist/runtime-v2/store/workspace-isolation.test.js.map +1 -0
- package/dist/runtime-v2/story-a-demo.d.ts +67 -0
- package/dist/runtime-v2/story-a-demo.d.ts.map +1 -0
- package/dist/runtime-v2/story-a-demo.js +188 -0
- package/dist/runtime-v2/story-a-demo.js.map +1 -0
- package/dist/runtime-v2/synthetic-baseline.d.ts +28 -0
- package/dist/runtime-v2/synthetic-baseline.d.ts.map +1 -0
- package/dist/runtime-v2/synthetic-baseline.js +116 -0
- package/dist/runtime-v2/synthetic-baseline.js.map +1 -0
- package/dist/runtime-v2/task-status.d.ts +99 -0
- package/dist/runtime-v2/task-status.d.ts.map +1 -0
- package/dist/runtime-v2/task-status.js +88 -0
- package/dist/runtime-v2/task-status.js.map +1 -0
- package/dist/runtime-v2/trace-refiner-agent.d.ts +71 -0
- package/dist/runtime-v2/trace-refiner-agent.d.ts.map +1 -0
- package/dist/runtime-v2/trace-refiner-agent.js +239 -0
- package/dist/runtime-v2/trace-refiner-agent.js.map +1 -0
- package/dist/runtime-v2/trace-refiner.d.ts +47 -0
- package/dist/runtime-v2/trace-refiner.d.ts.map +1 -0
- package/dist/runtime-v2/trace-refiner.js +261 -0
- package/dist/runtime-v2/trace-refiner.js.map +1 -0
- package/dist/runtime-v2/types/artifact-lineage.d.ts +19 -0
- package/dist/runtime-v2/types/artifact-lineage.d.ts.map +1 -0
- package/dist/runtime-v2/types/artifact-lineage.js +6 -0
- package/dist/runtime-v2/types/artifact-lineage.js.map +1 -0
- package/dist/runtime-v2/types/event-payload.d.ts +232 -0
- package/dist/runtime-v2/types/event-payload.d.ts.map +1 -0
- package/dist/runtime-v2/types/event-payload.js +149 -0
- package/dist/runtime-v2/types/event-payload.js.map +1 -0
- package/dist/runtime-v2/types/event-types.d.ts +843 -0
- package/dist/runtime-v2/types/event-types.d.ts.map +1 -0
- package/dist/runtime-v2/types/event-types.js +486 -0
- package/dist/runtime-v2/types/event-types.js.map +1 -0
- package/dist/runtime-v2/types/hygiene-types.d.ts +40 -0
- package/dist/runtime-v2/types/hygiene-types.d.ts.map +1 -0
- package/dist/runtime-v2/types/hygiene-types.js +30 -0
- package/dist/runtime-v2/types/hygiene-types.js.map +1 -0
- package/dist/runtime-v2/types/index.d.ts +32 -0
- package/dist/runtime-v2/types/index.d.ts.map +1 -0
- package/dist/runtime-v2/types/index.js +17 -0
- package/dist/runtime-v2/types/index.js.map +1 -0
- package/dist/runtime-v2/types/pain-signal.d.ts +63 -0
- package/dist/runtime-v2/types/pain-signal.d.ts.map +1 -0
- package/dist/runtime-v2/types/pain-signal.js +118 -0
- package/dist/runtime-v2/types/pain-signal.js.map +1 -0
- package/dist/runtime-v2/types/pd-task-types.d.ts +139 -0
- package/dist/runtime-v2/types/pd-task-types.d.ts.map +1 -0
- package/dist/runtime-v2/types/pd-task-types.js +99 -0
- package/dist/runtime-v2/types/pd-task-types.js.map +1 -0
- package/dist/runtime-v2/types/principle-dependency.d.ts +15 -0
- package/dist/runtime-v2/types/principle-dependency.d.ts.map +1 -0
- package/dist/runtime-v2/types/principle-dependency.js +8 -0
- package/dist/runtime-v2/types/principle-dependency.js.map +1 -0
- package/dist/runtime-v2/types/principle-enums.d.ts +19 -0
- package/dist/runtime-v2/types/principle-enums.d.ts.map +1 -0
- package/dist/runtime-v2/types/principle-enums.js +59 -0
- package/dist/runtime-v2/types/principle-enums.js.map +1 -0
- package/dist/runtime-v2/types/principle-lifecycle-event.d.ts +28 -0
- package/dist/runtime-v2/types/principle-lifecycle-event.d.ts.map +1 -0
- package/dist/runtime-v2/types/principle-lifecycle-event.js +24 -0
- package/dist/runtime-v2/types/principle-lifecycle-event.js.map +1 -0
- package/dist/runtime-v2/types/principle-schema.d.ts +136 -0
- package/dist/runtime-v2/types/principle-schema.d.ts.map +1 -0
- package/dist/runtime-v2/types/principle-schema.js +71 -0
- package/dist/runtime-v2/types/principle-schema.js.map +1 -0
- package/dist/runtime-v2/types/principle-tree-store.d.ts +89 -0
- package/dist/runtime-v2/types/principle-tree-store.d.ts.map +1 -0
- package/dist/runtime-v2/types/principle-tree-store.js +11 -0
- package/dist/runtime-v2/types/principle-tree-store.js.map +1 -0
- package/dist/runtime-v2/types/principle-value-metrics.d.ts +27 -0
- package/dist/runtime-v2/types/principle-value-metrics.d.ts.map +1 -0
- package/dist/runtime-v2/types/principle-value-metrics.js +14 -0
- package/dist/runtime-v2/types/principle-value-metrics.js.map +1 -0
- package/dist/runtime-v2/types/queue-types.d.ts +51 -0
- package/dist/runtime-v2/types/queue-types.d.ts.map +1 -0
- package/dist/runtime-v2/types/queue-types.js +44 -0
- package/dist/runtime-v2/types/queue-types.js.map +1 -0
- package/dist/runtime-v2/types/replay-types.d.ts +40 -0
- package/dist/runtime-v2/types/replay-types.d.ts.map +1 -0
- package/dist/runtime-v2/types/replay-types.js +2 -0
- package/dist/runtime-v2/types/replay-types.js.map +1 -0
- package/dist/runtime-v2/types/runtime-summary-types.d.ts +93 -0
- package/dist/runtime-v2/types/runtime-summary-types.d.ts.map +1 -0
- package/dist/runtime-v2/types/runtime-summary-types.js +35 -0
- package/dist/runtime-v2/types/runtime-summary-types.js.map +1 -0
- package/dist/runtime-v2/utils/cli-process-runner.d.ts +35 -0
- package/dist/runtime-v2/utils/cli-process-runner.d.ts.map +1 -0
- package/dist/runtime-v2/utils/cli-process-runner.js +259 -0
- package/dist/runtime-v2/utils/cli-process-runner.js.map +1 -0
- package/dist/runtime-v2/utils/cli-process-runner.test.d.ts +2 -0
- package/dist/runtime-v2/utils/cli-process-runner.test.d.ts.map +1 -0
- package/dist/runtime-v2/utils/cli-process-runner.test.js +111 -0
- package/dist/runtime-v2/utils/cli-process-runner.test.js.map +1 -0
- package/dist/storage-adapter.d.ts +59 -0
- package/dist/storage-adapter.d.ts.map +1 -0
- package/dist/storage-adapter.js +2 -0
- package/dist/storage-adapter.js.map +1 -0
- package/dist/telemetry-event.d.ts +102 -0
- package/dist/telemetry-event.d.ts.map +1 -0
- package/dist/telemetry-event.js +186 -0
- package/dist/telemetry-event.js.map +1 -0
- package/dist/trajectory-store.d.ts +45 -0
- package/dist/trajectory-store.d.ts.map +1 -0
- package/dist/trajectory-store.js +139 -0
- package/dist/trajectory-store.js.map +1 -0
- package/dist/types/workspace-resolver.d.ts +25 -0
- package/dist/types/workspace-resolver.d.ts.map +1 -0
- package/dist/types/workspace-resolver.js +10 -0
- package/dist/types/workspace-resolver.js.map +1 -0
- package/dist/types.d.ts +56 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +16 -0
- package/dist/types.js.map +1 -0
- package/dist/workflow-funnel-loader.d.ts +143 -0
- package/dist/workflow-funnel-loader.d.ts.map +1 -0
- package/dist/workflow-funnel-loader.js +174 -0
- package/dist/workflow-funnel-loader.js.map +1 -0
- package/package.json +100 -0
|
@@ -0,0 +1,1362 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PiAiRuntimeAdapter unit tests.
|
|
3
|
+
*
|
|
4
|
+
* Verifies all PDRuntimeAdapter interface methods, pi-ai API usage,
|
|
5
|
+
* error mapping, DiagnosticianOutputV1 validation, retry logic,
|
|
6
|
+
* and telemetry emission.
|
|
7
|
+
*
|
|
8
|
+
* All pi-ai calls are mocked — no real API keys needed.
|
|
9
|
+
*/
|
|
10
|
+
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
|
|
11
|
+
import { PDRuntimeError } from '../../error-categories.js';
|
|
12
|
+
// Mock @mariozechner/pi-ai at module level
|
|
13
|
+
vi.mock('@mariozechner/pi-ai', () => ({
|
|
14
|
+
getModel: vi.fn(),
|
|
15
|
+
getProviders: vi.fn(() => ['openrouter', 'anthropic', 'openai', 'google']),
|
|
16
|
+
completeSimple: vi.fn(),
|
|
17
|
+
}));
|
|
18
|
+
// Mock store/event-emitter to capture telemetry calls
|
|
19
|
+
vi.mock('../../store/event-emitter.js', () => ({
|
|
20
|
+
storeEmitter: { emitTelemetry: vi.fn() },
|
|
21
|
+
}));
|
|
22
|
+
import { getModel, completeSimple } from '@mariozechner/pi-ai';
|
|
23
|
+
import { storeEmitter } from '../../store/event-emitter.js';
|
|
24
|
+
import { PiAiRuntimeAdapter } from '../pi-ai-runtime-adapter.js';
|
|
25
|
+
const mockGetModel = getModel;
|
|
26
|
+
const mockComplete = completeSimple;
|
|
27
|
+
const mockEmitTelemetry = storeEmitter.emitTelemetry;
|
|
28
|
+
// ── Fixtures ──
|
|
29
|
+
const VALID_DIAGNOSIS = {
|
|
30
|
+
valid: true,
|
|
31
|
+
diagnosisId: 'diag-test-1',
|
|
32
|
+
summary: 'Test summary',
|
|
33
|
+
rootCause: 'Test root cause',
|
|
34
|
+
violatedPrinciples: [],
|
|
35
|
+
evidence: [],
|
|
36
|
+
recommendations: [],
|
|
37
|
+
confidence: 0.9,
|
|
38
|
+
};
|
|
39
|
+
function makeAssistantMessage(text, overrides = {}) {
|
|
40
|
+
return {
|
|
41
|
+
content: [{ type: 'text', text }],
|
|
42
|
+
role: 'assistant',
|
|
43
|
+
stopReason: 'stop',
|
|
44
|
+
api: 'openai-completions',
|
|
45
|
+
provider: 'openrouter',
|
|
46
|
+
model: 'anthropic/claude-sonnet-4',
|
|
47
|
+
usage: { input: 10, output: 5, cacheRead: 0, cacheWrite: 0, totalTokens: 15, cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total: 0 } },
|
|
48
|
+
timestamp: Date.now(),
|
|
49
|
+
...overrides,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
/** Create an AssistantMessage that resolved with stopReason:'error'. */
|
|
53
|
+
function makeErrorResponse(errorMessage, overrides = {}) {
|
|
54
|
+
return makeAssistantMessage('', {
|
|
55
|
+
stopReason: 'error',
|
|
56
|
+
errorMessage,
|
|
57
|
+
content: [],
|
|
58
|
+
...overrides,
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
/** Create an AssistantMessage that resolved with stopReason:'aborted'. */
|
|
62
|
+
function makeAbortedResponse(errorMessage = 'The operation was aborted') {
|
|
63
|
+
return makeAssistantMessage('', {
|
|
64
|
+
stopReason: 'aborted',
|
|
65
|
+
errorMessage,
|
|
66
|
+
content: [],
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
function makeStartRunInput(overrides = {}) {
|
|
70
|
+
return {
|
|
71
|
+
agentSpec: { agentId: 'diagnostician', schemaVersion: 'v1' },
|
|
72
|
+
inputPayload: 'Diagnose this pain signal',
|
|
73
|
+
contextItems: [],
|
|
74
|
+
timeoutMs: 60_000,
|
|
75
|
+
...overrides,
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
function makeAdapter(overrides = {}) {
|
|
79
|
+
return new PiAiRuntimeAdapter({
|
|
80
|
+
provider: 'openrouter',
|
|
81
|
+
model: 'anthropic/claude-sonnet-4',
|
|
82
|
+
apiKeyEnv: 'TEST_API_KEY',
|
|
83
|
+
_testBackoffDelayMs: 0,
|
|
84
|
+
outputPathStrategy: 'free_form_only', // Default to free_form for existing tests
|
|
85
|
+
...overrides,
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Helper: assert that startRun rejects with a PDRuntimeError of the given category.
|
|
90
|
+
* Uses a fresh adapter and mock setup to avoid mock-consumption issues.
|
|
91
|
+
*/
|
|
92
|
+
async function expectStartRunError(category, mockSetup, adapterOverrides = {}) {
|
|
93
|
+
mockSetup();
|
|
94
|
+
const adapter = makeAdapter(adapterOverrides);
|
|
95
|
+
let caught = undefined;
|
|
96
|
+
try {
|
|
97
|
+
await adapter.startRun(makeStartRunInput());
|
|
98
|
+
}
|
|
99
|
+
catch (err) {
|
|
100
|
+
caught = err instanceof PDRuntimeError ? err : undefined;
|
|
101
|
+
}
|
|
102
|
+
expect(caught).toBeInstanceOf(PDRuntimeError);
|
|
103
|
+
expect(caught?.category).toBe(category);
|
|
104
|
+
}
|
|
105
|
+
/** Extract the first emitted telemetry event matching the given eventType. */
|
|
106
|
+
function findTelemetryEvent(eventType) {
|
|
107
|
+
const call = mockEmitTelemetry.mock.calls.find((c) => c[0].eventType === eventType);
|
|
108
|
+
return call ? call[0] : undefined;
|
|
109
|
+
}
|
|
110
|
+
// ── Tests ──
|
|
111
|
+
describe('PiAiRuntimeAdapter', () => {
|
|
112
|
+
beforeEach(() => {
|
|
113
|
+
vi.clearAllMocks();
|
|
114
|
+
process.env.TEST_API_KEY = 'test-key-123';
|
|
115
|
+
// Default mock: getModel returns a model object, complete returns valid diagnosis
|
|
116
|
+
mockGetModel.mockReturnValue({ id: 'anthropic/claude-sonnet-4' });
|
|
117
|
+
mockComplete.mockResolvedValue(makeAssistantMessage(JSON.stringify(VALID_DIAGNOSIS)));
|
|
118
|
+
});
|
|
119
|
+
afterEach(() => {
|
|
120
|
+
delete process.env.TEST_API_KEY;
|
|
121
|
+
});
|
|
122
|
+
// ── kind() ──
|
|
123
|
+
describe('kind()', () => {
|
|
124
|
+
it('returns "pi-ai" (RS-02)', () => {
|
|
125
|
+
const adapter = makeAdapter();
|
|
126
|
+
expect(adapter.kind()).toBe('pi-ai');
|
|
127
|
+
});
|
|
128
|
+
});
|
|
129
|
+
// ── getCapabilities() ──
|
|
130
|
+
describe('getCapabilities()', () => {
|
|
131
|
+
it('returns correct RuntimeCapabilities shape', async () => {
|
|
132
|
+
const adapter = makeAdapter();
|
|
133
|
+
const caps = await adapter.getCapabilities();
|
|
134
|
+
expect(caps.supportsStructuredJsonOutput).toBe(true);
|
|
135
|
+
expect(caps.supportsToolUse).toBe(false);
|
|
136
|
+
expect(caps.supportsWorkingDirectory).toBe(false);
|
|
137
|
+
expect(caps.supportsModelSelection).toBe(true);
|
|
138
|
+
expect(caps.supportsLongRunningSessions).toBe(false);
|
|
139
|
+
expect(caps.supportsCancellation).toBe(true);
|
|
140
|
+
expect(caps.supportsArtifactWriteBack).toBe(false);
|
|
141
|
+
expect(caps.supportsConcurrentRuns).toBe(false);
|
|
142
|
+
expect(caps.supportsStreaming).toBe(false);
|
|
143
|
+
});
|
|
144
|
+
});
|
|
145
|
+
// ── healthCheck() ──
|
|
146
|
+
describe('healthCheck()', () => {
|
|
147
|
+
it('returns healthy=true when apiKey exists, getModel succeeds, and complete probe returns {"ok":true}', async () => {
|
|
148
|
+
mockComplete.mockResolvedValueOnce(makeAssistantMessage('{"ok":true}'));
|
|
149
|
+
const adapter = makeAdapter();
|
|
150
|
+
const health = await adapter.healthCheck();
|
|
151
|
+
expect(health.healthy).toBe(true);
|
|
152
|
+
expect(health.degraded).toBe(false);
|
|
153
|
+
expect(health.warnings).toEqual([]);
|
|
154
|
+
expect(mockGetModel).toHaveBeenCalledWith('openrouter', 'anthropic/claude-sonnet-4');
|
|
155
|
+
});
|
|
156
|
+
it('returns healthy=false when apiKeyEnv is missing', async () => {
|
|
157
|
+
delete process.env.TEST_API_KEY;
|
|
158
|
+
const adapter = makeAdapter();
|
|
159
|
+
const health = await adapter.healthCheck();
|
|
160
|
+
expect(health.healthy).toBe(false);
|
|
161
|
+
expect(health.degraded).toBe(false);
|
|
162
|
+
expect(health.warnings.some(w => w.includes('TEST_API_KEY'))).toBe(true);
|
|
163
|
+
});
|
|
164
|
+
it('returns healthy=false when getModel throws', async () => {
|
|
165
|
+
mockGetModel.mockImplementationOnce(() => { throw new Error('invalid provider'); });
|
|
166
|
+
const adapter = makeAdapter();
|
|
167
|
+
const health = await adapter.healthCheck();
|
|
168
|
+
expect(health.healthy).toBe(false);
|
|
169
|
+
expect(health.degraded).toBe(false);
|
|
170
|
+
expect(health.warnings.some(w => w.includes('invalid provider'))).toBe(true);
|
|
171
|
+
});
|
|
172
|
+
it('returns healthy=false with degraded=true when complete probe returns unexpected result', async () => {
|
|
173
|
+
mockComplete.mockResolvedValueOnce(makeAssistantMessage('{"unexpected": true}'));
|
|
174
|
+
const adapter = makeAdapter();
|
|
175
|
+
const health = await adapter.healthCheck();
|
|
176
|
+
expect(health.healthy).toBe(false);
|
|
177
|
+
expect(health.degraded).toBe(true);
|
|
178
|
+
expect(health.warnings.some(w => w.includes('unexpected result'))).toBe(true);
|
|
179
|
+
});
|
|
180
|
+
it('returns healthy=false with degraded=true when probe times out', async () => {
|
|
181
|
+
mockComplete.mockImplementationOnce(() => {
|
|
182
|
+
const err = new DOMException('The operation was aborted', 'AbortError');
|
|
183
|
+
throw err;
|
|
184
|
+
});
|
|
185
|
+
const adapter = makeAdapter();
|
|
186
|
+
const health = await adapter.healthCheck();
|
|
187
|
+
expect(health.healthy).toBe(false);
|
|
188
|
+
expect(health.degraded).toBe(true);
|
|
189
|
+
expect(health.warnings.some(w => w.includes('timed out'))).toBe(true);
|
|
190
|
+
});
|
|
191
|
+
it('returns healthy=false with degraded=true when complete resolves with stopReason:error + timeout message', async () => {
|
|
192
|
+
mockComplete.mockResolvedValueOnce(makeErrorResponse('Request timed out.'));
|
|
193
|
+
const adapter = makeAdapter();
|
|
194
|
+
const health = await adapter.healthCheck();
|
|
195
|
+
expect(health.healthy).toBe(false);
|
|
196
|
+
expect(health.degraded).toBe(true);
|
|
197
|
+
expect(health.warnings.some(w => w.includes('timed out'))).toBe(true);
|
|
198
|
+
// Must NOT say "no text content"
|
|
199
|
+
expect(health.warnings.every(w => !w.includes('no text content'))).toBe(true);
|
|
200
|
+
});
|
|
201
|
+
it('returns healthy=false with degraded=false when complete resolves with stopReason:error + auth error', async () => {
|
|
202
|
+
mockComplete.mockResolvedValueOnce(makeErrorResponse('401 Unauthorized'));
|
|
203
|
+
const adapter = makeAdapter();
|
|
204
|
+
const health = await adapter.healthCheck();
|
|
205
|
+
expect(health.healthy).toBe(false);
|
|
206
|
+
expect(health.degraded).toBe(false);
|
|
207
|
+
expect(health.warnings.some(w => w.includes('execution failed') || w.includes('401'))).toBe(true);
|
|
208
|
+
// Must NOT misclassify as "no text content"
|
|
209
|
+
expect(health.warnings.every(w => !w.includes('no text content'))).toBe(true);
|
|
210
|
+
});
|
|
211
|
+
it('respects config.timeoutMs for probe timeout', async () => {
|
|
212
|
+
// Capture the timeoutMs passed to complete
|
|
213
|
+
let capturedTimeoutMs = undefined;
|
|
214
|
+
mockComplete.mockImplementationOnce(async (_model, _ctx, opts) => {
|
|
215
|
+
capturedTimeoutMs = opts.timeoutMs;
|
|
216
|
+
return makeAssistantMessage('{"ok":true}');
|
|
217
|
+
});
|
|
218
|
+
const adapter = makeAdapter({ timeoutMs: 15_000 });
|
|
219
|
+
await adapter.healthCheck();
|
|
220
|
+
expect(capturedTimeoutMs).toBe(15_000);
|
|
221
|
+
});
|
|
222
|
+
});
|
|
223
|
+
// ── startRun() — success path ──
|
|
224
|
+
describe('startRun()', () => {
|
|
225
|
+
it('calls getModel with provider and model from config', async () => {
|
|
226
|
+
const adapter = makeAdapter();
|
|
227
|
+
await adapter.startRun(makeStartRunInput());
|
|
228
|
+
expect(mockGetModel).toHaveBeenCalledWith('openrouter', 'anthropic/claude-sonnet-4');
|
|
229
|
+
});
|
|
230
|
+
it('calls complete with correct context including UserMessage with timestamp', async () => {
|
|
231
|
+
const adapter = makeAdapter();
|
|
232
|
+
await adapter.startRun(makeStartRunInput());
|
|
233
|
+
expect(mockComplete).toHaveBeenCalledTimes(1);
|
|
234
|
+
const [, context] = mockComplete.mock.calls[0];
|
|
235
|
+
expect(context.messages).toHaveLength(1);
|
|
236
|
+
expect(context.messages[0]).toBeDefined();
|
|
237
|
+
if (context.messages[0]) {
|
|
238
|
+
expect(context.messages[0].role).toBe('user');
|
|
239
|
+
expect(context.messages[0].content).toBe('Diagnose this pain signal');
|
|
240
|
+
expect(typeof context.messages[0].timestamp).toBe('number');
|
|
241
|
+
}
|
|
242
|
+
});
|
|
243
|
+
it('passes apiKey, effectiveTimeoutMs (input > config > default), and maxRetries: 0 to complete options', async () => {
|
|
244
|
+
const adapter = makeAdapter({ maxRetries: 3, timeoutMs: 120_000 });
|
|
245
|
+
await adapter.startRun(makeStartRunInput({ timeoutMs: 90_000 }));
|
|
246
|
+
const [, , options] = mockComplete.mock.calls[0];
|
|
247
|
+
expect(options.apiKey).toBe('test-key-123');
|
|
248
|
+
expect(options.maxRetries).toBe(0);
|
|
249
|
+
expect(options.timeoutMs).toBe(90_000);
|
|
250
|
+
});
|
|
251
|
+
it('returns RunHandle with runId, runtimeKind="pi-ai", and valid ISO startedAt', async () => {
|
|
252
|
+
const adapter = makeAdapter();
|
|
253
|
+
const handle = await adapter.startRun(makeStartRunInput());
|
|
254
|
+
expect(handle.runId).toBeTruthy();
|
|
255
|
+
expect(handle.runtimeKind).toBe('pi-ai');
|
|
256
|
+
expect(new Date(handle.startedAt).toISOString()).toBe(handle.startedAt);
|
|
257
|
+
});
|
|
258
|
+
it('stores output in memory (fetchOutput works after startRun completes)', async () => {
|
|
259
|
+
const adapter = makeAdapter();
|
|
260
|
+
const handle = await adapter.startRun(makeStartRunInput());
|
|
261
|
+
const output = await adapter.fetchOutput(handle.runId);
|
|
262
|
+
expect(output).not.toBeNull();
|
|
263
|
+
expect(output?.runId).toBe(handle.runId);
|
|
264
|
+
expect(output?.payload).toMatchObject({ diagnosisId: 'diag-test-1' });
|
|
265
|
+
});
|
|
266
|
+
it('serializes non-string inputPayload to JSON for the UserMessage', async () => {
|
|
267
|
+
const adapter = makeAdapter();
|
|
268
|
+
await adapter.startRun(makeStartRunInput({ inputPayload: { pain: 'signal', severity: 0.8 } }));
|
|
269
|
+
const [, context] = mockComplete.mock.calls[0];
|
|
270
|
+
expect(context.messages[0]).toBeDefined();
|
|
271
|
+
if (context.messages[0]) {
|
|
272
|
+
expect(context.messages[0].content).toBe('{"pain":"signal","severity":0.8}');
|
|
273
|
+
}
|
|
274
|
+
});
|
|
275
|
+
});
|
|
276
|
+
// ── JSON extraction (balanced parsing) ──
|
|
277
|
+
describe('JSON extraction (balanced parsing)', () => {
|
|
278
|
+
it('parses plain JSON from LLM response', async () => {
|
|
279
|
+
mockComplete.mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(VALID_DIAGNOSIS)));
|
|
280
|
+
const adapter = makeAdapter();
|
|
281
|
+
const handle = await adapter.startRun(makeStartRunInput());
|
|
282
|
+
const output = await adapter.fetchOutput(handle.runId);
|
|
283
|
+
expect(output?.payload).toMatchObject({ diagnosisId: 'diag-test-1' });
|
|
284
|
+
});
|
|
285
|
+
it('parses JSON wrapped in prose text', async () => {
|
|
286
|
+
const proseWrapped = `Here is the analysis:\n${JSON.stringify(VALID_DIAGNOSIS)}\nDone.`;
|
|
287
|
+
mockComplete.mockResolvedValueOnce(makeAssistantMessage(proseWrapped));
|
|
288
|
+
const adapter = makeAdapter();
|
|
289
|
+
const handle = await adapter.startRun(makeStartRunInput());
|
|
290
|
+
const output = await adapter.fetchOutput(handle.runId);
|
|
291
|
+
expect(output?.payload).toMatchObject({ diagnosisId: 'diag-test-1' });
|
|
292
|
+
});
|
|
293
|
+
it('parses JSON inside code fences', async () => {
|
|
294
|
+
const codeFenced = '```json\n' + JSON.stringify(VALID_DIAGNOSIS) + '\n```';
|
|
295
|
+
mockComplete.mockResolvedValueOnce(makeAssistantMessage(codeFenced));
|
|
296
|
+
const adapter = makeAdapter();
|
|
297
|
+
const handle = await adapter.startRun(makeStartRunInput());
|
|
298
|
+
const output = await adapter.fetchOutput(handle.runId);
|
|
299
|
+
expect(output?.payload).toMatchObject({ diagnosisId: 'diag-test-1' });
|
|
300
|
+
});
|
|
301
|
+
it('throws output_invalid when no JSON object found in response', async () => {
|
|
302
|
+
await expectStartRunError('output_invalid', () => {
|
|
303
|
+
mockComplete.mockReset();
|
|
304
|
+
mockComplete.mockResolvedValue(makeAssistantMessage('No JSON here at all'));
|
|
305
|
+
});
|
|
306
|
+
});
|
|
307
|
+
});
|
|
308
|
+
// ── startRun() error mapping ──
|
|
309
|
+
describe('startRun() error mapping', () => {
|
|
310
|
+
it('throws PDRuntimeError("runtime_unavailable") when apiKeyEnv missing from process.env', async () => {
|
|
311
|
+
await expectStartRunError('runtime_unavailable', () => {
|
|
312
|
+
delete process.env.TEST_API_KEY;
|
|
313
|
+
});
|
|
314
|
+
});
|
|
315
|
+
it('throws PDRuntimeError("timeout") when LLM request is aborted/timed out', async () => {
|
|
316
|
+
await expectStartRunError('timeout', () => {
|
|
317
|
+
mockComplete.mockReset();
|
|
318
|
+
mockComplete.mockImplementation(() => {
|
|
319
|
+
throw new DOMException('The operation was aborted', 'AbortError');
|
|
320
|
+
});
|
|
321
|
+
});
|
|
322
|
+
});
|
|
323
|
+
it('throws PDRuntimeError("output_invalid") when LLM response contains no parseable JSON', async () => {
|
|
324
|
+
await expectStartRunError('output_invalid', () => {
|
|
325
|
+
mockComplete.mockReset();
|
|
326
|
+
mockComplete.mockResolvedValue(makeAssistantMessage('Just plain text, no JSON at all'));
|
|
327
|
+
});
|
|
328
|
+
});
|
|
329
|
+
it('skips schema validation when no outputSchemaRef is provided (backward compatible)', async () => {
|
|
330
|
+
mockComplete.mockReset();
|
|
331
|
+
mockComplete.mockResolvedValue(makeAssistantMessage(JSON.stringify({ valid: true, missing: 'fields' })));
|
|
332
|
+
const adapter = makeAdapter();
|
|
333
|
+
const handle = await adapter.startRun(makeStartRunInput());
|
|
334
|
+
const output = await adapter.fetchOutput(handle.runId);
|
|
335
|
+
expect(output?.payload).toMatchObject({ valid: true, missing: 'fields' });
|
|
336
|
+
});
|
|
337
|
+
it('throws PDRuntimeError("output_invalid") when parsed JSON does not match schema for given outputSchemaRef', async () => {
|
|
338
|
+
mockComplete.mockReset();
|
|
339
|
+
mockComplete.mockResolvedValue(makeAssistantMessage(JSON.stringify({ valid: true, missing: 'fields' })));
|
|
340
|
+
const adapter = makeAdapter();
|
|
341
|
+
await expect(adapter.startRun(makeStartRunInput({
|
|
342
|
+
outputSchemaRef: 'diagnostician-output-v1',
|
|
343
|
+
}))).rejects.toMatchObject({ category: 'output_invalid' });
|
|
344
|
+
});
|
|
345
|
+
it('throws PDRuntimeError("execution_failed") after retry exhaustion on network error', async () => {
|
|
346
|
+
await expectStartRunError('execution_failed', () => {
|
|
347
|
+
mockComplete.mockReset();
|
|
348
|
+
mockComplete.mockRejectedValue(new Error('ECONNREFUSED'));
|
|
349
|
+
}, { maxRetries: 1 });
|
|
350
|
+
});
|
|
351
|
+
it('throws PDRuntimeError("timeout") when complete resolves with stopReason:error + timeout message', async () => {
|
|
352
|
+
await expectStartRunError('timeout', () => {
|
|
353
|
+
mockComplete.mockReset();
|
|
354
|
+
mockComplete.mockResolvedValue(makeErrorResponse('Request timed out.'));
|
|
355
|
+
});
|
|
356
|
+
});
|
|
357
|
+
it('throws PDRuntimeError("execution_failed") when complete resolves with stopReason:error + 401 Unauthorized', async () => {
|
|
358
|
+
await expectStartRunError('execution_failed', () => {
|
|
359
|
+
mockComplete.mockReset();
|
|
360
|
+
mockComplete.mockResolvedValue(makeErrorResponse('401 Unauthorized'));
|
|
361
|
+
});
|
|
362
|
+
});
|
|
363
|
+
it('throws PDRuntimeError("timeout") when complete resolves with stopReason:aborted', async () => {
|
|
364
|
+
await expectStartRunError('timeout', () => {
|
|
365
|
+
mockComplete.mockReset();
|
|
366
|
+
mockComplete.mockResolvedValue(makeAbortedResponse());
|
|
367
|
+
});
|
|
368
|
+
});
|
|
369
|
+
it('retries resolved stopReason:error (execution_failed) before giving up', async () => {
|
|
370
|
+
// First call: resolves with error, second call: succeeds
|
|
371
|
+
mockComplete
|
|
372
|
+
.mockResolvedValueOnce(makeErrorResponse('503 Service Unavailable'))
|
|
373
|
+
.mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(VALID_DIAGNOSIS)));
|
|
374
|
+
const adapter = makeAdapter({ maxRetries: 2 });
|
|
375
|
+
const handle = await adapter.startRun(makeStartRunInput());
|
|
376
|
+
expect(mockComplete).toHaveBeenCalledTimes(2);
|
|
377
|
+
expect(handle.runId).toBeTruthy();
|
|
378
|
+
});
|
|
379
|
+
it('RunStatus.reason includes bounded errorMessage from resolved-error response', async () => {
|
|
380
|
+
mockComplete.mockReset();
|
|
381
|
+
mockComplete.mockResolvedValue(makeErrorResponse('401 Unauthorized: invalid API key'));
|
|
382
|
+
const adapter = makeAdapter({ maxRetries: 0 });
|
|
383
|
+
try {
|
|
384
|
+
await adapter.startRun(makeStartRunInput());
|
|
385
|
+
}
|
|
386
|
+
catch {
|
|
387
|
+
// startRun throws, but internally run state should have the reason
|
|
388
|
+
}
|
|
389
|
+
// Telemetry should include the error message
|
|
390
|
+
const failedEvent = findTelemetryEvent('runtime_invocation_failed');
|
|
391
|
+
expect(failedEvent).toBeDefined();
|
|
392
|
+
const payload = failedEvent?.payload;
|
|
393
|
+
expect(payload.errorCategory).toBe('execution_failed');
|
|
394
|
+
expect(typeof payload.errorMessage).toBe('string');
|
|
395
|
+
expect(payload.errorMessage.includes('401')).toBe(true);
|
|
396
|
+
});
|
|
397
|
+
});
|
|
398
|
+
// ── startRun() retry logic ──
|
|
399
|
+
describe('startRun() retry logic', () => {
|
|
400
|
+
it('retries transient failures up to maxRetries times', async () => {
|
|
401
|
+
// Fail twice, succeed on third
|
|
402
|
+
mockComplete
|
|
403
|
+
.mockRejectedValueOnce(new Error('ECONNREFUSED'))
|
|
404
|
+
.mockRejectedValueOnce(new Error('ETIMEDOUT'))
|
|
405
|
+
.mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(VALID_DIAGNOSIS)));
|
|
406
|
+
const adapter = makeAdapter({ maxRetries: 2 });
|
|
407
|
+
const handle = await adapter.startRun(makeStartRunInput());
|
|
408
|
+
expect(mockComplete).toHaveBeenCalledTimes(3);
|
|
409
|
+
expect(handle.runtimeKind).toBe('pi-ai');
|
|
410
|
+
});
|
|
411
|
+
it('succeeds on second attempt after first transient failure', async () => {
|
|
412
|
+
mockComplete
|
|
413
|
+
.mockRejectedValueOnce(new Error('socket hang up'))
|
|
414
|
+
.mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(VALID_DIAGNOSIS)));
|
|
415
|
+
const adapter = makeAdapter({ maxRetries: 2 });
|
|
416
|
+
const handle = await adapter.startRun(makeStartRunInput());
|
|
417
|
+
expect(mockComplete).toHaveBeenCalledTimes(2);
|
|
418
|
+
expect(handle.runId).toBeTruthy();
|
|
419
|
+
});
|
|
420
|
+
it('does not retry on PDRuntimeError (output_invalid)', async () => {
|
|
421
|
+
mockComplete.mockReset();
|
|
422
|
+
mockComplete
|
|
423
|
+
.mockResolvedValueOnce(makeAssistantMessage(JSON.stringify({ valid: true })))
|
|
424
|
+
.mockResolvedValueOnce(makeAssistantMessage(JSON.stringify({ valid: true })))
|
|
425
|
+
.mockResolvedValueOnce(makeAssistantMessage(JSON.stringify({ valid: true })))
|
|
426
|
+
.mockResolvedValueOnce(makeAssistantMessage(JSON.stringify({ valid: true })));
|
|
427
|
+
const adapter = makeAdapter({ maxRetries: 3 });
|
|
428
|
+
await expect(adapter.startRun(makeStartRunInput({
|
|
429
|
+
outputSchemaRef: 'diagnostician-output-v1',
|
|
430
|
+
}))).rejects.toThrow(PDRuntimeError);
|
|
431
|
+
// 1 original + 3 repair attempts = 4 calls (not infinite retries)
|
|
432
|
+
expect(mockComplete).toHaveBeenCalledTimes(4);
|
|
433
|
+
});
|
|
434
|
+
it('does not retry on PDRuntimeError (runtime_unavailable)', async () => {
|
|
435
|
+
delete process.env.TEST_API_KEY;
|
|
436
|
+
const adapter = makeAdapter({ maxRetries: 3 });
|
|
437
|
+
await expect(adapter.startRun(makeStartRunInput())).rejects.toMatchObject({
|
|
438
|
+
category: 'runtime_unavailable',
|
|
439
|
+
});
|
|
440
|
+
// complete should not be called at all — error happens before LLM call
|
|
441
|
+
expect(mockComplete).not.toHaveBeenCalled();
|
|
442
|
+
});
|
|
443
|
+
});
|
|
444
|
+
// ── pollRun() ──
|
|
445
|
+
describe('pollRun()', () => {
|
|
446
|
+
it('returns terminal status (succeeded) for completed run', async () => {
|
|
447
|
+
const adapter = makeAdapter();
|
|
448
|
+
const handle = await adapter.startRun(makeStartRunInput());
|
|
449
|
+
const status = await adapter.pollRun(handle.runId);
|
|
450
|
+
expect(status.runId).toBe(handle.runId);
|
|
451
|
+
expect(status.status).toBe('succeeded');
|
|
452
|
+
expect(status.startedAt).toBeTruthy();
|
|
453
|
+
expect(status.endedAt).toBeTruthy();
|
|
454
|
+
});
|
|
455
|
+
it('returns failed status with reason when startRun fails', async () => {
|
|
456
|
+
mockComplete.mockReset();
|
|
457
|
+
mockComplete.mockImplementation(async () => {
|
|
458
|
+
throw new DOMException('aborted', 'AbortError');
|
|
459
|
+
});
|
|
460
|
+
const adapter = makeAdapter();
|
|
461
|
+
try {
|
|
462
|
+
await adapter.startRun(makeStartRunInput());
|
|
463
|
+
}
|
|
464
|
+
catch (err) {
|
|
465
|
+
// Verify the error path doesn't crash and emits telemetry
|
|
466
|
+
expect(err).toBeInstanceOf(PDRuntimeError);
|
|
467
|
+
}
|
|
468
|
+
});
|
|
469
|
+
it('throws PDRuntimeError("input_invalid") for unknown runId', async () => {
|
|
470
|
+
const adapter = makeAdapter();
|
|
471
|
+
await expect(adapter.pollRun('nonexistent-run-id')).rejects.toThrow(PDRuntimeError);
|
|
472
|
+
await expect(adapter.pollRun('nonexistent-run-id')).rejects.toMatchObject({
|
|
473
|
+
category: 'input_invalid',
|
|
474
|
+
});
|
|
475
|
+
});
|
|
476
|
+
});
|
|
477
|
+
// ── fetchOutput() ──
|
|
478
|
+
describe('fetchOutput()', () => {
|
|
479
|
+
it('returns StructuredRunOutput with runId and payload after successful run', async () => {
|
|
480
|
+
const adapter = makeAdapter();
|
|
481
|
+
const handle = await adapter.startRun(makeStartRunInput());
|
|
482
|
+
const output = await adapter.fetchOutput(handle.runId);
|
|
483
|
+
expect(output).not.toBeNull();
|
|
484
|
+
expect(output?.runId).toBe(handle.runId);
|
|
485
|
+
expect(output?.payload).toMatchObject({
|
|
486
|
+
valid: true,
|
|
487
|
+
diagnosisId: 'diag-test-1',
|
|
488
|
+
});
|
|
489
|
+
});
|
|
490
|
+
it('returns null for unknown runId', async () => {
|
|
491
|
+
const adapter = makeAdapter();
|
|
492
|
+
const output = await adapter.fetchOutput('nonexistent-run-id');
|
|
493
|
+
expect(output).toBeNull();
|
|
494
|
+
});
|
|
495
|
+
});
|
|
496
|
+
// ── cancelRun() ──
|
|
497
|
+
describe('cancelRun()', () => {
|
|
498
|
+
it('resolves without error', async () => {
|
|
499
|
+
const adapter = makeAdapter();
|
|
500
|
+
await expect(adapter.cancelRun('any-run-id')).resolves.toBeUndefined();
|
|
501
|
+
});
|
|
502
|
+
});
|
|
503
|
+
// ── fetchArtifacts() ──
|
|
504
|
+
describe('fetchArtifacts()', () => {
|
|
505
|
+
it('returns empty array for a run that was started', async () => {
|
|
506
|
+
const adapter = makeAdapter();
|
|
507
|
+
const input = makeStartRunInput({ taskRef: { taskId: 'test-run-id' } });
|
|
508
|
+
const handle = await adapter.startRun(input);
|
|
509
|
+
const artifacts = await adapter.fetchArtifacts(handle.runId);
|
|
510
|
+
expect(artifacts).toEqual([]);
|
|
511
|
+
});
|
|
512
|
+
it('throws for an unknown runId', async () => {
|
|
513
|
+
const adapter = makeAdapter();
|
|
514
|
+
await expect(adapter.fetchArtifacts('unknown-run-id')).rejects.toThrow("Run 'unknown-run-id' not found");
|
|
515
|
+
});
|
|
516
|
+
});
|
|
517
|
+
// ── telemetry (AD-15) ──
|
|
518
|
+
describe('telemetry (AD-15)', () => {
|
|
519
|
+
it('emits runtime_invocation_started event on startRun', async () => {
|
|
520
|
+
const adapter = makeAdapter();
|
|
521
|
+
await adapter.startRun(makeStartRunInput());
|
|
522
|
+
const startedEvent = findTelemetryEvent('runtime_invocation_started');
|
|
523
|
+
expect(startedEvent).toBeDefined();
|
|
524
|
+
const payload = startedEvent?.payload;
|
|
525
|
+
expect(payload.runtimeKind).toBe('pi-ai');
|
|
526
|
+
expect(payload.provider).toBe('openrouter');
|
|
527
|
+
expect(payload.model).toBe('anthropic/claude-sonnet-4');
|
|
528
|
+
});
|
|
529
|
+
it('emits runtime_invocation_succeeded on successful completion', async () => {
|
|
530
|
+
const adapter = makeAdapter();
|
|
531
|
+
await adapter.startRun(makeStartRunInput());
|
|
532
|
+
const succeededEvent = findTelemetryEvent('runtime_invocation_succeeded');
|
|
533
|
+
expect(succeededEvent).toBeDefined();
|
|
534
|
+
const payload = succeededEvent?.payload;
|
|
535
|
+
expect(payload.runtimeKind).toBe('pi-ai');
|
|
536
|
+
});
|
|
537
|
+
it('emits runtime_invocation_failed on failure', async () => {
|
|
538
|
+
mockComplete.mockReset();
|
|
539
|
+
mockComplete.mockRejectedValue(new Error('network down'));
|
|
540
|
+
const adapter = makeAdapter({ maxRetries: 0 });
|
|
541
|
+
try {
|
|
542
|
+
await adapter.startRun(makeStartRunInput());
|
|
543
|
+
}
|
|
544
|
+
catch { /* expected */ }
|
|
545
|
+
const failedEvent = findTelemetryEvent('runtime_invocation_failed');
|
|
546
|
+
expect(failedEvent).toBeDefined();
|
|
547
|
+
const payload = failedEvent?.payload;
|
|
548
|
+
expect(payload.runtimeKind).toBe('pi-ai');
|
|
549
|
+
expect(payload.errorCategory).toBe('execution_failed');
|
|
550
|
+
});
|
|
551
|
+
it('emits runtime_invocation_started before LLM call (even if call fails)', async () => {
|
|
552
|
+
mockComplete.mockReset();
|
|
553
|
+
mockComplete.mockRejectedValue(new Error('fail'));
|
|
554
|
+
const adapter = makeAdapter({ maxRetries: 0 });
|
|
555
|
+
try {
|
|
556
|
+
await adapter.startRun(makeStartRunInput());
|
|
557
|
+
}
|
|
558
|
+
catch { /* expected */ }
|
|
559
|
+
const startedEvent = findTelemetryEvent('runtime_invocation_started');
|
|
560
|
+
expect(startedEvent).toBeDefined();
|
|
561
|
+
});
|
|
562
|
+
});
|
|
563
|
+
// ── Error category coverage ──
|
|
564
|
+
describe('error category coverage', () => {
|
|
565
|
+
it('all 5 PDRuntimeError categories are reachable', () => {
|
|
566
|
+
// This test documents which categories are tested where:
|
|
567
|
+
// - runtime_unavailable: apiKeyEnv missing test
|
|
568
|
+
// - timeout: AbortError test
|
|
569
|
+
// - output_invalid: JSON parse failure + schema mismatch tests
|
|
570
|
+
// - execution_failed: retry exhaustion test
|
|
571
|
+
// - input_invalid: pollRun with unknown runId test
|
|
572
|
+
const categories = ['runtime_unavailable', 'timeout', 'output_invalid', 'execution_failed', 'input_invalid'];
|
|
573
|
+
expect(categories).toHaveLength(5);
|
|
574
|
+
});
|
|
575
|
+
});
|
|
576
|
+
// ── Run state management ──
|
|
577
|
+
describe('run state management', () => {
|
|
578
|
+
it('stores failed run state on error', async () => {
|
|
579
|
+
mockComplete.mockReset();
|
|
580
|
+
mockComplete.mockImplementation(() => {
|
|
581
|
+
throw new DOMException('aborted', 'AbortError');
|
|
582
|
+
});
|
|
583
|
+
const adapter = makeAdapter();
|
|
584
|
+
// startRun will throw, but internally the run state should be stored
|
|
585
|
+
try {
|
|
586
|
+
await adapter.startRun(makeStartRunInput());
|
|
587
|
+
}
|
|
588
|
+
catch {
|
|
589
|
+
// We don't have the runId since startRun threw.
|
|
590
|
+
// This test verifies the error path doesn't crash.
|
|
591
|
+
}
|
|
592
|
+
// Verify the adapter didn't crash and telemetry was emitted
|
|
593
|
+
expect(mockEmitTelemetry).toHaveBeenCalled();
|
|
594
|
+
});
|
|
595
|
+
it('creates run state before LLM call', async () => {
|
|
596
|
+
// eslint-disable-next-line @typescript-eslint/init-declarations
|
|
597
|
+
let resolveComplete;
|
|
598
|
+
const blockedPromise = new Promise(resolve => { resolveComplete = resolve; });
|
|
599
|
+
mockComplete.mockReturnValueOnce(blockedPromise);
|
|
600
|
+
const adapter = makeAdapter();
|
|
601
|
+
// Start the run — it will block on complete()
|
|
602
|
+
const handlePromise = adapter.startRun(makeStartRunInput());
|
|
603
|
+
// Unblock the LLM call
|
|
604
|
+
if (resolveComplete) {
|
|
605
|
+
resolveComplete(makeAssistantMessage(JSON.stringify(VALID_DIAGNOSIS)));
|
|
606
|
+
}
|
|
607
|
+
const handle = await handlePromise;
|
|
608
|
+
// After completion, pollRun should return succeeded
|
|
609
|
+
const status = await adapter.pollRun(handle.runId);
|
|
610
|
+
expect(status.status).toBe('succeeded');
|
|
611
|
+
});
|
|
612
|
+
});
|
|
613
|
+
// ── startRun() output repair (PRI-71) ──
|
|
614
|
+
describe('startRun() output repair (PRI-71)', () => {
|
|
615
|
+
/** Invalid output with string confidence and wrong-case kind. */
|
|
616
|
+
const INVALID_DIAGNOSIS = {
|
|
617
|
+
valid: true,
|
|
618
|
+
diagnosisId: 'diag-repair-1',
|
|
619
|
+
taskId: 'task-repair-1',
|
|
620
|
+
summary: 'Test repair',
|
|
621
|
+
rootCause: 'Test root cause',
|
|
622
|
+
violatedPrinciples: [],
|
|
623
|
+
evidence: [],
|
|
624
|
+
recommendations: [{ kind: 'Rule', description: 'Fix casing' }],
|
|
625
|
+
confidence: '85%',
|
|
626
|
+
};
|
|
627
|
+
/** Make a startRunInput with diagnostician output schema ref. */
|
|
628
|
+
function makeDiagnosticianInput(overrides = {}) {
|
|
629
|
+
return makeStartRunInput({
|
|
630
|
+
outputSchemaRef: 'diagnostician-output-v1',
|
|
631
|
+
taskRef: { taskId: 'task-repair-1' },
|
|
632
|
+
...overrides,
|
|
633
|
+
});
|
|
634
|
+
}
|
|
635
|
+
it('repairs confidence "85%" to 0.85 via second LLM call', async () => {
|
|
636
|
+
mockComplete
|
|
637
|
+
.mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(INVALID_DIAGNOSIS)))
|
|
638
|
+
.mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(VALID_DIAGNOSIS)));
|
|
639
|
+
const adapter = makeAdapter();
|
|
640
|
+
const handle = await adapter.startRun(makeDiagnosticianInput());
|
|
641
|
+
expect(mockComplete).toHaveBeenCalledTimes(2);
|
|
642
|
+
const output = await adapter.fetchOutput(handle.runId);
|
|
643
|
+
expect(output?.payload).toMatchObject({ confidence: 0.9 });
|
|
644
|
+
});
|
|
645
|
+
it('repair fails — still throws output_invalid after repair attempt', async () => {
|
|
646
|
+
mockComplete
|
|
647
|
+
.mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(INVALID_DIAGNOSIS)))
|
|
648
|
+
.mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(INVALID_DIAGNOSIS)))
|
|
649
|
+
.mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(INVALID_DIAGNOSIS)))
|
|
650
|
+
.mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(INVALID_DIAGNOSIS)));
|
|
651
|
+
const adapter = makeAdapter();
|
|
652
|
+
await expect(adapter.startRun(makeDiagnosticianInput())).rejects.toMatchObject({
|
|
653
|
+
category: 'output_invalid',
|
|
654
|
+
});
|
|
655
|
+
// 1 original + 3 repair attempts = 4 calls
|
|
656
|
+
expect(mockComplete).toHaveBeenCalledTimes(4);
|
|
657
|
+
});
|
|
658
|
+
it('skips repair for unknown outputSchemaRef (not in registry)', async () => {
|
|
659
|
+
mockComplete.mockResolvedValueOnce(makeAssistantMessage(JSON.stringify({ valid: true, missing: 'fields' })));
|
|
660
|
+
const adapter = makeAdapter();
|
|
661
|
+
const handle = await adapter.startRun(makeStartRunInput({
|
|
662
|
+
outputSchemaRef: 'custom-unknown-v1',
|
|
663
|
+
}));
|
|
664
|
+
expect(mockComplete).toHaveBeenCalledTimes(1);
|
|
665
|
+
const output = await adapter.fetchOutput(handle.runId);
|
|
666
|
+
expect(output?.payload).toMatchObject({ valid: true, missing: 'fields' });
|
|
667
|
+
});
|
|
668
|
+
it('skips repair for non-JSON output (no schema errors to report)', async () => {
|
|
669
|
+
mockComplete.mockResolvedValueOnce(makeAssistantMessage('Not JSON at all'));
|
|
670
|
+
const adapter = makeAdapter();
|
|
671
|
+
await expect(adapter.startRun(makeDiagnosticianInput())).rejects.toMatchObject({
|
|
672
|
+
category: 'output_invalid',
|
|
673
|
+
});
|
|
674
|
+
expect(mockComplete).toHaveBeenCalledTimes(1);
|
|
675
|
+
});
|
|
676
|
+
it('emits output_extraction_failed telemetry when extractJsonObject returns null', async () => {
|
|
677
|
+
const proseOutput = 'I evaluated the plan and it looks good. The implementation is solid.';
|
|
678
|
+
mockComplete.mockResolvedValueOnce(makeAssistantMessage(proseOutput));
|
|
679
|
+
const adapter = makeAdapter();
|
|
680
|
+
try {
|
|
681
|
+
await adapter.startRun(makeDiagnosticianInput());
|
|
682
|
+
}
|
|
683
|
+
catch { /* expected */ }
|
|
684
|
+
const extractionEvent = findTelemetryEvent('output_extraction_failed');
|
|
685
|
+
expect(extractionEvent).toBeDefined();
|
|
686
|
+
const payload = extractionEvent?.payload;
|
|
687
|
+
expect(payload.outputSchemaRef).toBe('diagnostician-output-v1');
|
|
688
|
+
expect(payload.provider).toBe('openrouter');
|
|
689
|
+
expect(payload.model).toBe('anthropic/claude-sonnet-4');
|
|
690
|
+
expect(payload.rawOutputPreview).toBe(proseOutput);
|
|
691
|
+
});
|
|
692
|
+
it('emits output_repair_attempted telemetry on repair attempt', async () => {
|
|
693
|
+
mockComplete
|
|
694
|
+
.mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(INVALID_DIAGNOSIS)))
|
|
695
|
+
.mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(VALID_DIAGNOSIS)));
|
|
696
|
+
const adapter = makeAdapter();
|
|
697
|
+
await adapter.startRun(makeDiagnosticianInput());
|
|
698
|
+
const repairEvent = findTelemetryEvent('output_repair_attempted');
|
|
699
|
+
expect(repairEvent).toBeDefined();
|
|
700
|
+
const payload = repairEvent?.payload;
|
|
701
|
+
expect(payload.repaired).toBe(true);
|
|
702
|
+
expect(payload.attemptsUsed).toBe(1);
|
|
703
|
+
});
|
|
704
|
+
it('emits output_repair_attempted with repaired=false on failure', async () => {
|
|
705
|
+
mockComplete
|
|
706
|
+
.mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(INVALID_DIAGNOSIS)))
|
|
707
|
+
.mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(INVALID_DIAGNOSIS)))
|
|
708
|
+
.mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(INVALID_DIAGNOSIS)))
|
|
709
|
+
.mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(INVALID_DIAGNOSIS)));
|
|
710
|
+
const adapter = makeAdapter();
|
|
711
|
+
try {
|
|
712
|
+
await adapter.startRun(makeDiagnosticianInput());
|
|
713
|
+
}
|
|
714
|
+
catch { /* expected */ }
|
|
715
|
+
const repairEvent = findTelemetryEvent('output_repair_attempted');
|
|
716
|
+
expect(repairEvent).toBeDefined();
|
|
717
|
+
const payload = repairEvent?.payload;
|
|
718
|
+
expect(payload.repaired).toBe(false);
|
|
719
|
+
});
|
|
720
|
+
it('reuses same provider/model for repair call', async () => {
|
|
721
|
+
mockComplete
|
|
722
|
+
.mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(INVALID_DIAGNOSIS)))
|
|
723
|
+
.mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(VALID_DIAGNOSIS)));
|
|
724
|
+
const adapter = makeAdapter();
|
|
725
|
+
await adapter.startRun(makeDiagnosticianInput());
|
|
726
|
+
// Both calls should use same model
|
|
727
|
+
expect(mockComplete).toHaveBeenCalledTimes(2);
|
|
728
|
+
const [model1] = mockComplete.mock.calls[0];
|
|
729
|
+
const [model2] = mockComplete.mock.calls[1];
|
|
730
|
+
expect(model1).toEqual(model2);
|
|
731
|
+
});
|
|
732
|
+
it('repair call includes the repair prompt with schema errors', async () => {
|
|
733
|
+
mockComplete
|
|
734
|
+
.mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(INVALID_DIAGNOSIS)))
|
|
735
|
+
.mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(VALID_DIAGNOSIS)));
|
|
736
|
+
const adapter = makeAdapter();
|
|
737
|
+
await adapter.startRun(makeDiagnosticianInput());
|
|
738
|
+
// Second call's context should contain the repair prompt
|
|
739
|
+
const [, context] = mockComplete.mock.calls[1];
|
|
740
|
+
const repairMessage = context.messages[0]?.content ?? '';
|
|
741
|
+
expect(repairMessage).toContain('schema');
|
|
742
|
+
expect(repairMessage).toContain('confidence');
|
|
743
|
+
});
|
|
744
|
+
it('repair budget exhausted — default maxRepairAttempts=3, no infinite loop', async () => {
|
|
745
|
+
mockComplete
|
|
746
|
+
.mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(INVALID_DIAGNOSIS)))
|
|
747
|
+
.mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(INVALID_DIAGNOSIS)))
|
|
748
|
+
.mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(INVALID_DIAGNOSIS)))
|
|
749
|
+
.mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(INVALID_DIAGNOSIS)));
|
|
750
|
+
const adapter = makeAdapter();
|
|
751
|
+
await expect(adapter.startRun(makeDiagnosticianInput())).rejects.toMatchObject({
|
|
752
|
+
category: 'output_invalid',
|
|
753
|
+
});
|
|
754
|
+
// 1 original + 3 repair attempts = 4 calls total (not infinite)
|
|
755
|
+
expect(mockComplete).toHaveBeenCalledTimes(4);
|
|
756
|
+
});
|
|
757
|
+
it('repairs evaluator-output-v1 with prose-wrapped JSON', async () => {
|
|
758
|
+
const EVALUATOR_OUTPUT_INVALID = {
|
|
759
|
+
taskId: 'task-eval-repair-1',
|
|
760
|
+
sourceArtificerArtifactId: 'pi-art-artificer-repair-1',
|
|
761
|
+
evaluation: {
|
|
762
|
+
decision: 'approved',
|
|
763
|
+
summary: 'Good plan',
|
|
764
|
+
score: '0.85',
|
|
765
|
+
strengths: ['Clear'],
|
|
766
|
+
concerns: [],
|
|
767
|
+
requiredChanges: [],
|
|
768
|
+
},
|
|
769
|
+
sourceTrace: {
|
|
770
|
+
artificerArtifactId: 'pi-art-artificer-repair-1',
|
|
771
|
+
},
|
|
772
|
+
risks: [],
|
|
773
|
+
generatedAt: '2026-05-11T12:00:00.000Z',
|
|
774
|
+
};
|
|
775
|
+
const EVALUATOR_OUTPUT_VALID = {
|
|
776
|
+
taskId: 'task-eval-repair-1',
|
|
777
|
+
sourceArtificerArtifactId: 'pi-art-artificer-repair-1',
|
|
778
|
+
evaluation: {
|
|
779
|
+
decision: 'approved',
|
|
780
|
+
summary: 'Good plan',
|
|
781
|
+
score: 0.85,
|
|
782
|
+
strengths: ['Clear'],
|
|
783
|
+
concerns: [],
|
|
784
|
+
requiredChanges: [],
|
|
785
|
+
},
|
|
786
|
+
sourceTrace: {
|
|
787
|
+
artificerArtifactId: 'pi-art-artificer-repair-1',
|
|
788
|
+
},
|
|
789
|
+
risks: [],
|
|
790
|
+
generatedAt: '2026-05-11T12:00:00.000Z',
|
|
791
|
+
};
|
|
792
|
+
mockComplete
|
|
793
|
+
.mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(EVALUATOR_OUTPUT_INVALID)))
|
|
794
|
+
.mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(EVALUATOR_OUTPUT_VALID)));
|
|
795
|
+
const adapter = makeAdapter();
|
|
796
|
+
const handle = await adapter.startRun(makeStartRunInput({
|
|
797
|
+
outputSchemaRef: 'evaluator-output-v1',
|
|
798
|
+
taskRef: { taskId: 'task-eval-repair-1' },
|
|
799
|
+
}));
|
|
800
|
+
expect(mockComplete).toHaveBeenCalledTimes(2);
|
|
801
|
+
const output = await adapter.fetchOutput(handle.runId);
|
|
802
|
+
expect(output?.payload).toMatchObject({ evaluation: { score: 0.85 } });
|
|
803
|
+
});
|
|
804
|
+
});
|
|
805
|
+
// ── startRun() schema dispatch by outputSchemaRef ──
|
|
806
|
+
describe('startRun() schema dispatch by outputSchemaRef', () => {
|
|
807
|
+
const VALID_DREAMER_OUTPUT = {
|
|
808
|
+
valid: true,
|
|
809
|
+
taskId: 'task-dreamer-1',
|
|
810
|
+
candidates: [
|
|
811
|
+
{
|
|
812
|
+
candidateIndex: 0,
|
|
813
|
+
badDecision: 'Ignored error handling',
|
|
814
|
+
betterDecision: 'Add try/catch around API calls',
|
|
815
|
+
rationale: 'Prevents unhandled rejections',
|
|
816
|
+
confidence: 0.85,
|
|
817
|
+
riskLevel: 'low',
|
|
818
|
+
strategicPerspective: 'Defensive programming',
|
|
819
|
+
},
|
|
820
|
+
],
|
|
821
|
+
contextRefs: [],
|
|
822
|
+
generatedAt: '2025-01-01T00:00:00.000Z',
|
|
823
|
+
};
|
|
824
|
+
const VALID_PHILOSOPHER_OUTPUT = {
|
|
825
|
+
taskId: 'task-philosopher-1',
|
|
826
|
+
sourceDreamerArtifactId: 'pi-art-dreamer-1',
|
|
827
|
+
thesis: 'Error handling is essential for reliability',
|
|
828
|
+
principleCandidate: {
|
|
829
|
+
title: 'Always handle API errors',
|
|
830
|
+
rationale: 'Unhandled errors cause cascading failures',
|
|
831
|
+
scope: 'All external API calls',
|
|
832
|
+
confidence: 0.9,
|
|
833
|
+
},
|
|
834
|
+
risks: ['May add boilerplate'],
|
|
835
|
+
generatedAt: '2025-01-01T00:00:00.000Z',
|
|
836
|
+
};
|
|
837
|
+
it('validates dreamer-output-v1 with DreamerOutputV1Schema', async () => {
|
|
838
|
+
mockComplete.mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(VALID_DREAMER_OUTPUT)));
|
|
839
|
+
const adapter = makeAdapter();
|
|
840
|
+
const handle = await adapter.startRun(makeStartRunInput({
|
|
841
|
+
outputSchemaRef: 'dreamer-output-v1',
|
|
842
|
+
taskRef: { taskId: 'task-dreamer-1' },
|
|
843
|
+
}));
|
|
844
|
+
const output = await adapter.fetchOutput(handle.runId);
|
|
845
|
+
expect(output?.payload).toMatchObject({ valid: true });
|
|
846
|
+
});
|
|
847
|
+
it('rejects invalid dreamer output with output_invalid', async () => {
|
|
848
|
+
const invalidDreamerOutput = { valid: true, taskId: 'task-dreamer-1', candidates: 'not-array' };
|
|
849
|
+
mockComplete.mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(invalidDreamerOutput)));
|
|
850
|
+
const adapter = makeAdapter();
|
|
851
|
+
await expect(adapter.startRun(makeStartRunInput({
|
|
852
|
+
outputSchemaRef: 'dreamer-output-v1',
|
|
853
|
+
taskRef: { taskId: 'task-dreamer-1' },
|
|
854
|
+
}))).rejects.toMatchObject({ category: 'output_invalid' });
|
|
855
|
+
});
|
|
856
|
+
it('validates philosopher-output-v1 with PhilosopherOutputV1Schema', async () => {
|
|
857
|
+
mockComplete.mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(VALID_PHILOSOPHER_OUTPUT)));
|
|
858
|
+
const adapter = makeAdapter();
|
|
859
|
+
const handle = await adapter.startRun(makeStartRunInput({
|
|
860
|
+
outputSchemaRef: 'philosopher-output-v1',
|
|
861
|
+
taskRef: { taskId: 'task-philosopher-1' },
|
|
862
|
+
}));
|
|
863
|
+
const output = await adapter.fetchOutput(handle.runId);
|
|
864
|
+
expect(output?.payload).toMatchObject({ thesis: 'Error handling is essential for reliability' });
|
|
865
|
+
});
|
|
866
|
+
it('rejects invalid philosopher output with output_invalid', async () => {
|
|
867
|
+
const invalidPhilosopherOutput = { taskId: 'task-philosopher-1', principleCandidate: null };
|
|
868
|
+
mockComplete.mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(invalidPhilosopherOutput)));
|
|
869
|
+
const adapter = makeAdapter();
|
|
870
|
+
await expect(adapter.startRun(makeStartRunInput({
|
|
871
|
+
outputSchemaRef: 'philosopher-output-v1',
|
|
872
|
+
taskRef: { taskId: 'task-philosopher-1' },
|
|
873
|
+
}))).rejects.toMatchObject({ category: 'output_invalid' });
|
|
874
|
+
});
|
|
875
|
+
it('falls back to DiagnosticianOutputV1Schema for diagnostician-output-v1', async () => {
|
|
876
|
+
mockComplete.mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(VALID_DIAGNOSIS)));
|
|
877
|
+
const adapter = makeAdapter();
|
|
878
|
+
const handle = await adapter.startRun(makeStartRunInput({
|
|
879
|
+
outputSchemaRef: 'diagnostician-output-v1',
|
|
880
|
+
taskRef: { taskId: 'task-test-1' },
|
|
881
|
+
}));
|
|
882
|
+
const output = await adapter.fetchOutput(handle.runId);
|
|
883
|
+
expect(output?.payload).toMatchObject({ valid: true, diagnosisId: 'diag-test-1' });
|
|
884
|
+
});
|
|
885
|
+
it('unknown outputSchemaRef skips schema validation and succeeds', async () => {
|
|
886
|
+
const arbitraryOutput = { foo: 'bar', baz: 42 };
|
|
887
|
+
mockComplete.mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(arbitraryOutput)));
|
|
888
|
+
const adapter = makeAdapter();
|
|
889
|
+
const handle = await adapter.startRun(makeStartRunInput({
|
|
890
|
+
outputSchemaRef: 'custom-output-v1',
|
|
891
|
+
}));
|
|
892
|
+
const output = await adapter.fetchOutput(handle.runId);
|
|
893
|
+
expect(output?.payload).toMatchObject(arbitraryOutput);
|
|
894
|
+
});
|
|
895
|
+
it('no outputSchemaRef skips schema validation (backward compatible)', async () => {
|
|
896
|
+
const arbitraryOutput = { anything: 'goes' };
|
|
897
|
+
mockComplete.mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(arbitraryOutput)));
|
|
898
|
+
const adapter = makeAdapter();
|
|
899
|
+
const handle = await adapter.startRun(makeStartRunInput());
|
|
900
|
+
const output = await adapter.fetchOutput(handle.runId);
|
|
901
|
+
expect(output?.payload).toMatchObject(arbitraryOutput);
|
|
902
|
+
});
|
|
903
|
+
it('attempts repair for dreamer-output-v1 schema errors', async () => {
|
|
904
|
+
const invalidDreamerOutput = {
|
|
905
|
+
valid: true,
|
|
906
|
+
taskId: 'task-dreamer-1',
|
|
907
|
+
candidates: [{ candidateIndex: 0, badDecision: 'test', betterDecision: 'test', rationale: 'test', confidence: '85%', riskLevel: 'low', strategicPerspective: 'test' }],
|
|
908
|
+
contextRefs: [],
|
|
909
|
+
generatedAt: '2025-01-01T00:00:00.000Z',
|
|
910
|
+
};
|
|
911
|
+
mockComplete
|
|
912
|
+
.mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(invalidDreamerOutput)))
|
|
913
|
+
.mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(VALID_DREAMER_OUTPUT)));
|
|
914
|
+
const adapter = makeAdapter();
|
|
915
|
+
const handle = await adapter.startRun(makeStartRunInput({
|
|
916
|
+
outputSchemaRef: 'dreamer-output-v1',
|
|
917
|
+
taskRef: { taskId: 'task-dreamer-1' },
|
|
918
|
+
}));
|
|
919
|
+
expect(mockComplete).toHaveBeenCalledTimes(2);
|
|
920
|
+
const output = await adapter.fetchOutput(handle.runId);
|
|
921
|
+
expect(output?.payload).toMatchObject({ valid: true });
|
|
922
|
+
});
|
|
923
|
+
});
|
|
924
|
+
// ── PRI-200: Structured output repair loop with evidence pack ──
|
|
925
|
+
describe('PRI-200: structured output repair loop with evidence pack', () => {
|
|
926
|
+
const INVALID_DIAGNOSIS_SCHEMA = {
|
|
927
|
+
valid: true,
|
|
928
|
+
diagnosisId: 'diag-pri200-1',
|
|
929
|
+
taskId: 'task-pri200-1',
|
|
930
|
+
summary: 'Test PRI-200',
|
|
931
|
+
rootCause: 'Test root cause',
|
|
932
|
+
violatedPrinciples: [],
|
|
933
|
+
evidence: [],
|
|
934
|
+
recommendations: [{ kind: 'Rule', description: 'Fix casing' }],
|
|
935
|
+
confidence: '85%',
|
|
936
|
+
};
|
|
937
|
+
function makeDiagnosticianInput(overrides = {}) {
|
|
938
|
+
return makeStartRunInput({
|
|
939
|
+
outputSchemaRef: 'diagnostician-output-v1',
|
|
940
|
+
taskRef: { taskId: 'task-pri200-1' },
|
|
941
|
+
...overrides,
|
|
942
|
+
});
|
|
943
|
+
}
|
|
944
|
+
function resetMock() {
|
|
945
|
+
mockComplete.mockReset();
|
|
946
|
+
mockComplete.mockResolvedValue(makeAssistantMessage(JSON.stringify(VALID_DIAGNOSIS)));
|
|
947
|
+
}
|
|
948
|
+
it('1. valid JSON + valid schema → no repair triggered', async () => {
|
|
949
|
+
resetMock();
|
|
950
|
+
mockComplete.mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(VALID_DIAGNOSIS)));
|
|
951
|
+
const adapter = makeAdapter();
|
|
952
|
+
const handle = await adapter.startRun(makeDiagnosticianInput());
|
|
953
|
+
expect(mockComplete).toHaveBeenCalledTimes(1);
|
|
954
|
+
const output = await adapter.fetchOutput(handle.runId);
|
|
955
|
+
expect(output?.payload).toMatchObject({ confidence: 0.9 });
|
|
956
|
+
const repairEvent = findTelemetryEvent('output_repair_attempted');
|
|
957
|
+
expect(repairEvent).toBeUndefined();
|
|
958
|
+
const schemaInvalidEvent = findTelemetryEvent('output_schema_invalid');
|
|
959
|
+
expect(schemaInvalidEvent).toBeUndefined();
|
|
960
|
+
});
|
|
961
|
+
it('2. prose-wrapped JSON extraction succeeds → no repair triggered', async () => {
|
|
962
|
+
resetMock();
|
|
963
|
+
const proseWrapped = `Here is the analysis:\n${JSON.stringify(VALID_DIAGNOSIS)}\nDone.`;
|
|
964
|
+
mockComplete.mockResolvedValueOnce(makeAssistantMessage(proseWrapped));
|
|
965
|
+
const adapter = makeAdapter();
|
|
966
|
+
const handle = await adapter.startRun(makeDiagnosticianInput());
|
|
967
|
+
expect(mockComplete).toHaveBeenCalledTimes(1);
|
|
968
|
+
const output = await adapter.fetchOutput(handle.runId);
|
|
969
|
+
expect(output?.payload).toMatchObject({ diagnosisId: 'diag-test-1' });
|
|
970
|
+
});
|
|
971
|
+
it('3. extraction failed → output_extraction_failed telemetry + output_invalid', async () => {
|
|
972
|
+
resetMock();
|
|
973
|
+
mockComplete.mockResolvedValueOnce(makeAssistantMessage('No JSON here at all'));
|
|
974
|
+
const adapter = makeAdapter();
|
|
975
|
+
try {
|
|
976
|
+
await adapter.startRun(makeDiagnosticianInput());
|
|
977
|
+
}
|
|
978
|
+
catch { /* expected */ }
|
|
979
|
+
const extractionEvent = findTelemetryEvent('output_extraction_failed');
|
|
980
|
+
expect(extractionEvent).toBeDefined();
|
|
981
|
+
const payload = extractionEvent?.payload;
|
|
982
|
+
expect(payload.outputSchemaRef).toBe('diagnostician-output-v1');
|
|
983
|
+
expect(payload.provider).toBe('openrouter');
|
|
984
|
+
expect(payload.model).toBe('anthropic/claude-sonnet-4');
|
|
985
|
+
expect(typeof payload.rawOutputPreview).toBe('string');
|
|
986
|
+
});
|
|
987
|
+
it('4. schema invalid once, repair returns valid → success + repairAttempts[0].repaired=true', async () => {
|
|
988
|
+
resetMock();
|
|
989
|
+
mockComplete
|
|
990
|
+
.mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(INVALID_DIAGNOSIS_SCHEMA)))
|
|
991
|
+
.mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(VALID_DIAGNOSIS)));
|
|
992
|
+
const adapter = makeAdapter();
|
|
993
|
+
const handle = await adapter.startRun(makeDiagnosticianInput());
|
|
994
|
+
expect(mockComplete).toHaveBeenCalledTimes(2);
|
|
995
|
+
const output = await adapter.fetchOutput(handle.runId);
|
|
996
|
+
expect(output?.payload).toMatchObject({ confidence: 0.9 });
|
|
997
|
+
const repairEvent = findTelemetryEvent('output_repair_attempted');
|
|
998
|
+
expect(repairEvent).toBeDefined();
|
|
999
|
+
const repairPayload = repairEvent?.payload;
|
|
1000
|
+
expect(repairPayload.repaired).toBe(true);
|
|
1001
|
+
expect(repairPayload.attemptsUsed).toBe(1);
|
|
1002
|
+
});
|
|
1003
|
+
it('5. schema invalid, repair also invalid → output_repair_exhausted + output_invalid', async () => {
|
|
1004
|
+
resetMock();
|
|
1005
|
+
mockComplete.mockResolvedValue(makeAssistantMessage(JSON.stringify(INVALID_DIAGNOSIS_SCHEMA)));
|
|
1006
|
+
const adapter = makeAdapter();
|
|
1007
|
+
await expect(adapter.startRun(makeDiagnosticianInput())).rejects.toMatchObject({
|
|
1008
|
+
category: 'output_invalid',
|
|
1009
|
+
});
|
|
1010
|
+
const exhaustedEvent = findTelemetryEvent('output_repair_exhausted');
|
|
1011
|
+
expect(exhaustedEvent).toBeDefined();
|
|
1012
|
+
const exhaustedPayload = exhaustedEvent?.payload;
|
|
1013
|
+
expect(exhaustedPayload.outputSchemaRef).toBe('diagnostician-output-v1');
|
|
1014
|
+
expect(exhaustedPayload.provider).toBe('openrouter');
|
|
1015
|
+
expect(exhaustedPayload.model).toBe('anthropic/claude-sonnet-4');
|
|
1016
|
+
expect(typeof exhaustedPayload.rawOutputPreview).toBe('string');
|
|
1017
|
+
expect(Array.isArray(exhaustedPayload.validationErrors)).toBe(true);
|
|
1018
|
+
expect(Array.isArray(exhaustedPayload.repairAttempts)).toBe(true);
|
|
1019
|
+
expect(typeof exhaustedPayload.finalFailureReason).toBe('string');
|
|
1020
|
+
});
|
|
1021
|
+
it('6. repair loop never exceeds configured max attempts', async () => {
|
|
1022
|
+
resetMock();
|
|
1023
|
+
mockComplete.mockResolvedValue(makeAssistantMessage(JSON.stringify(INVALID_DIAGNOSIS_SCHEMA)));
|
|
1024
|
+
const adapter = makeAdapter();
|
|
1025
|
+
await expect(adapter.startRun(makeDiagnosticianInput())).rejects.toMatchObject({
|
|
1026
|
+
category: 'output_invalid',
|
|
1027
|
+
});
|
|
1028
|
+
// 1 original + 3 repair (default maxRepairAttempts=3) = 4 calls total
|
|
1029
|
+
expect(mockComplete).toHaveBeenCalledTimes(4);
|
|
1030
|
+
});
|
|
1031
|
+
it('7. repair prompt includes schemaRef and error paths', async () => {
|
|
1032
|
+
resetMock();
|
|
1033
|
+
mockComplete
|
|
1034
|
+
.mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(INVALID_DIAGNOSIS_SCHEMA)))
|
|
1035
|
+
.mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(VALID_DIAGNOSIS)));
|
|
1036
|
+
const adapter = makeAdapter();
|
|
1037
|
+
await adapter.startRun(makeDiagnosticianInput());
|
|
1038
|
+
const [, context] = mockComplete.mock.calls[1];
|
|
1039
|
+
const repairMessage = context.messages[0]?.content ?? '';
|
|
1040
|
+
expect(repairMessage).toContain('diagnostician-output-v1');
|
|
1041
|
+
expect(repairMessage).toContain('/confidence');
|
|
1042
|
+
});
|
|
1043
|
+
it('8. repair attempt must not override lineage fields silently', async () => {
|
|
1044
|
+
resetMock();
|
|
1045
|
+
const originalWithLineage = {
|
|
1046
|
+
...INVALID_DIAGNOSIS_SCHEMA,
|
|
1047
|
+
taskId: 'task-original-1',
|
|
1048
|
+
};
|
|
1049
|
+
const repairedWithChangedLineage = {
|
|
1050
|
+
...VALID_DIAGNOSIS,
|
|
1051
|
+
taskId: 'task-CHANGED-by-llm',
|
|
1052
|
+
};
|
|
1053
|
+
mockComplete
|
|
1054
|
+
.mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(originalWithLineage)))
|
|
1055
|
+
.mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(repairedWithChangedLineage)));
|
|
1056
|
+
const adapter = makeAdapter();
|
|
1057
|
+
const handle = await adapter.startRun(makeDiagnosticianInput({
|
|
1058
|
+
taskRef: { taskId: 'task-original-1' },
|
|
1059
|
+
}));
|
|
1060
|
+
const output = await adapter.fetchOutput(handle.runId);
|
|
1061
|
+
const payload = output?.payload;
|
|
1062
|
+
// taskId is a lineage field — it must be stripped from output (PRI-272).
|
|
1063
|
+
// Downstream consumers get taskId from RunnerContext/TaskRecord.
|
|
1064
|
+
expect(payload.taskId).toBeUndefined();
|
|
1065
|
+
});
|
|
1066
|
+
it('9. provider/model/rawOutputPreview are present in evidence pack', async () => {
|
|
1067
|
+
resetMock();
|
|
1068
|
+
mockComplete.mockResolvedValue(makeAssistantMessage(JSON.stringify(INVALID_DIAGNOSIS_SCHEMA)));
|
|
1069
|
+
const adapter = makeAdapter();
|
|
1070
|
+
try {
|
|
1071
|
+
await adapter.startRun(makeDiagnosticianInput());
|
|
1072
|
+
}
|
|
1073
|
+
catch { /* expected */ }
|
|
1074
|
+
const exhaustedEvent = findTelemetryEvent('output_repair_exhausted');
|
|
1075
|
+
expect(exhaustedEvent).toBeDefined();
|
|
1076
|
+
const payload = exhaustedEvent?.payload;
|
|
1077
|
+
expect(payload.provider).toBe('openrouter');
|
|
1078
|
+
expect(payload.model).toBe('anthropic/claude-sonnet-4');
|
|
1079
|
+
expect(typeof payload.rawOutputPreview).toBe('string');
|
|
1080
|
+
expect(payload.rawOutputPreview.length).toBeGreaterThan(0);
|
|
1081
|
+
});
|
|
1082
|
+
it('10. unknown schemaRef keeps existing backward-compatible behavior', async () => {
|
|
1083
|
+
resetMock();
|
|
1084
|
+
const arbitraryOutput = { foo: 'bar', baz: 42 };
|
|
1085
|
+
mockComplete.mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(arbitraryOutput)));
|
|
1086
|
+
const adapter = makeAdapter();
|
|
1087
|
+
const handle = await adapter.startRun(makeStartRunInput({
|
|
1088
|
+
outputSchemaRef: 'custom-unknown-v1',
|
|
1089
|
+
}));
|
|
1090
|
+
expect(mockComplete).toHaveBeenCalledTimes(1);
|
|
1091
|
+
const output = await adapter.fetchOutput(handle.runId);
|
|
1092
|
+
expect(output?.payload).toMatchObject(arbitraryOutput);
|
|
1093
|
+
});
|
|
1094
|
+
it('emits output_schema_invalid telemetry before repair attempt', async () => {
|
|
1095
|
+
resetMock();
|
|
1096
|
+
mockComplete
|
|
1097
|
+
.mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(INVALID_DIAGNOSIS_SCHEMA)))
|
|
1098
|
+
.mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(VALID_DIAGNOSIS)));
|
|
1099
|
+
const adapter = makeAdapter();
|
|
1100
|
+
await adapter.startRun(makeDiagnosticianInput());
|
|
1101
|
+
const schemaInvalidEvent = findTelemetryEvent('output_schema_invalid');
|
|
1102
|
+
expect(schemaInvalidEvent).toBeDefined();
|
|
1103
|
+
const payload = schemaInvalidEvent?.payload;
|
|
1104
|
+
expect(payload.outputSchemaRef).toBe('diagnostician-output-v1');
|
|
1105
|
+
expect(payload.provider).toBe('openrouter');
|
|
1106
|
+
expect(payload.model).toBe('anthropic/claude-sonnet-4');
|
|
1107
|
+
expect(typeof payload.rawOutputPreview).toBe('string');
|
|
1108
|
+
expect(Array.isArray(payload.validationErrors)).toBe(true);
|
|
1109
|
+
expect(payload.validationErrors.length).toBeGreaterThan(0);
|
|
1110
|
+
});
|
|
1111
|
+
it('evidence pack includes repairAttempts with schemaRef and attempt number', async () => {
|
|
1112
|
+
resetMock();
|
|
1113
|
+
mockComplete.mockResolvedValue(makeAssistantMessage(JSON.stringify(INVALID_DIAGNOSIS_SCHEMA)));
|
|
1114
|
+
const adapter = makeAdapter();
|
|
1115
|
+
try {
|
|
1116
|
+
await adapter.startRun(makeDiagnosticianInput());
|
|
1117
|
+
}
|
|
1118
|
+
catch { /* expected */ }
|
|
1119
|
+
const exhaustedEvent = findTelemetryEvent('output_repair_exhausted');
|
|
1120
|
+
expect(exhaustedEvent).toBeDefined();
|
|
1121
|
+
const payload = exhaustedEvent?.payload;
|
|
1122
|
+
const attempts = payload.repairAttempts;
|
|
1123
|
+
expect(attempts.length).toBeGreaterThan(0);
|
|
1124
|
+
expect(attempts[0]?.schemaRef).toBe('diagnostician-output-v1');
|
|
1125
|
+
expect(typeof attempts[0]?.attempt).toBe('number');
|
|
1126
|
+
expect(typeof attempts[0]?.repaired).toBe('boolean');
|
|
1127
|
+
});
|
|
1128
|
+
it('output_schema_invalid telemetry includes validation error paths', async () => {
|
|
1129
|
+
resetMock();
|
|
1130
|
+
mockComplete
|
|
1131
|
+
.mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(INVALID_DIAGNOSIS_SCHEMA)))
|
|
1132
|
+
.mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(VALID_DIAGNOSIS)));
|
|
1133
|
+
const adapter = makeAdapter();
|
|
1134
|
+
await adapter.startRun(makeDiagnosticianInput());
|
|
1135
|
+
const schemaInvalidEvent = findTelemetryEvent('output_schema_invalid');
|
|
1136
|
+
expect(schemaInvalidEvent).toBeDefined();
|
|
1137
|
+
const payload = schemaInvalidEvent?.payload;
|
|
1138
|
+
const errors = payload.validationErrors;
|
|
1139
|
+
expect(errors.length).toBeGreaterThan(0);
|
|
1140
|
+
const errorPaths = errors.map(e => e.path);
|
|
1141
|
+
expect(errorPaths.some(p => typeof p === 'string' && p.includes('confidence'))).toBe(true);
|
|
1142
|
+
});
|
|
1143
|
+
});
|
|
1144
|
+
// ── PRI-220: Provider Timeout and Transient Retry Policy ──
|
|
1145
|
+
describe('PRI-220: Provider Timeout and Transient Retry Policy', () => {
|
|
1146
|
+
it('1. provider timeout before client budget is provider_transient_timeout', async () => {
|
|
1147
|
+
// LLM call fails with timeout-like error, client signal is NOT aborted
|
|
1148
|
+
mockComplete.mockReset();
|
|
1149
|
+
mockComplete.mockRejectedValue(new Error('connection timeout'));
|
|
1150
|
+
const adapter = makeAdapter({ maxRetries: 0 });
|
|
1151
|
+
let caughtErr = undefined;
|
|
1152
|
+
try {
|
|
1153
|
+
await adapter.startRun(makeStartRunInput());
|
|
1154
|
+
}
|
|
1155
|
+
catch (err) {
|
|
1156
|
+
if (err instanceof PDRuntimeError)
|
|
1157
|
+
caughtErr = err;
|
|
1158
|
+
}
|
|
1159
|
+
expect(caughtErr).toBeDefined();
|
|
1160
|
+
expect(caughtErr?.category).toBe('timeout');
|
|
1161
|
+
expect(caughtErr?.details?.timeoutClassification).toBe('provider_transient_timeout');
|
|
1162
|
+
expect(caughtErr?.details?.effectiveTimeoutMs).toBe(60_000);
|
|
1163
|
+
expect(typeof caughtErr?.details?.elapsedMs).toBe('number');
|
|
1164
|
+
});
|
|
1165
|
+
it('2. client timeout budget exhausted when signal is aborted', async () => {
|
|
1166
|
+
// LLM call aborts, client signal IS aborted
|
|
1167
|
+
mockComplete.mockReset();
|
|
1168
|
+
mockComplete.mockImplementation(async (_model, _ctx, options) => {
|
|
1169
|
+
const signal = options.signal;
|
|
1170
|
+
const err = new DOMException('The operation was aborted', 'AbortError');
|
|
1171
|
+
Object.defineProperty(signal, 'aborted', { value: true, writable: true });
|
|
1172
|
+
throw err;
|
|
1173
|
+
});
|
|
1174
|
+
const adapter = makeAdapter({ maxRetries: 0 });
|
|
1175
|
+
let caughtErr = undefined;
|
|
1176
|
+
try {
|
|
1177
|
+
await adapter.startRun(makeStartRunInput());
|
|
1178
|
+
}
|
|
1179
|
+
catch (err) {
|
|
1180
|
+
if (err instanceof PDRuntimeError)
|
|
1181
|
+
caughtErr = err;
|
|
1182
|
+
}
|
|
1183
|
+
expect(caughtErr).toBeDefined();
|
|
1184
|
+
expect(caughtErr?.category).toBe('timeout');
|
|
1185
|
+
expect(caughtErr?.details?.timeoutClassification).toBe('client_timeout_budget_exhausted');
|
|
1186
|
+
});
|
|
1187
|
+
it('3. unrecognized generic non-timeout error is classified as not_applicable', async () => {
|
|
1188
|
+
mockComplete.mockReset();
|
|
1189
|
+
mockComplete.mockRejectedValue(new Error('Generic database connection failed'));
|
|
1190
|
+
const adapter = makeAdapter({ maxRetries: 0 });
|
|
1191
|
+
let caughtErr = undefined;
|
|
1192
|
+
try {
|
|
1193
|
+
await adapter.startRun(makeStartRunInput());
|
|
1194
|
+
}
|
|
1195
|
+
catch (err) {
|
|
1196
|
+
if (err instanceof PDRuntimeError)
|
|
1197
|
+
caughtErr = err;
|
|
1198
|
+
}
|
|
1199
|
+
expect(caughtErr).toBeDefined();
|
|
1200
|
+
expect(caughtErr?.category).toBe('execution_failed');
|
|
1201
|
+
expect(caughtErr?.details?.timeoutClassification).toBeUndefined();
|
|
1202
|
+
});
|
|
1203
|
+
it('5. provider_transient_timeout retries and then succeeds within max limits', async () => {
|
|
1204
|
+
mockComplete.mockReset();
|
|
1205
|
+
// First attempt: transient timeout, Second attempt: success
|
|
1206
|
+
mockComplete
|
|
1207
|
+
.mockRejectedValueOnce(new Error('socket timeout'))
|
|
1208
|
+
.mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(VALID_DIAGNOSIS)));
|
|
1209
|
+
const adapter = makeAdapter({ maxRetries: 2 });
|
|
1210
|
+
const handle = await adapter.startRun(makeStartRunInput());
|
|
1211
|
+
expect(mockComplete).toHaveBeenCalledTimes(2);
|
|
1212
|
+
expect(handle.runId).toBeDefined();
|
|
1213
|
+
// Check telemetry has retry attempt
|
|
1214
|
+
const retryEvent = findTelemetryEvent('runtime_invocation_failed');
|
|
1215
|
+
expect(retryEvent).toBeDefined();
|
|
1216
|
+
const payload = retryEvent?.payload;
|
|
1217
|
+
expect(payload?.isRetryAttempt).toBe(true);
|
|
1218
|
+
expect(payload?.retryAttempt).toBe(0);
|
|
1219
|
+
});
|
|
1220
|
+
it('6. provider_transient_timeout exhausted maxRetries and fails permanently', async () => {
|
|
1221
|
+
mockComplete.mockReset();
|
|
1222
|
+
mockComplete.mockRejectedValue(new Error('API read timeout'));
|
|
1223
|
+
const adapter = makeAdapter({ maxRetries: 1 });
|
|
1224
|
+
let caughtErr = undefined;
|
|
1225
|
+
try {
|
|
1226
|
+
await adapter.startRun(makeStartRunInput());
|
|
1227
|
+
}
|
|
1228
|
+
catch (err) {
|
|
1229
|
+
if (err instanceof PDRuntimeError)
|
|
1230
|
+
caughtErr = err;
|
|
1231
|
+
}
|
|
1232
|
+
expect(mockComplete).toHaveBeenCalledTimes(2); // attempt 0 and attempt 1
|
|
1233
|
+
expect(caughtErr).toBeDefined();
|
|
1234
|
+
expect(caughtErr?.category).toBe('timeout');
|
|
1235
|
+
expect(caughtErr?.details?.retryAttempt).toBe(1);
|
|
1236
|
+
});
|
|
1237
|
+
it('7. client_timeout_budget_exhausted is never retried', async () => {
|
|
1238
|
+
mockComplete.mockReset();
|
|
1239
|
+
mockComplete.mockImplementation(async (_model, _ctx, options) => {
|
|
1240
|
+
const signal = options.signal;
|
|
1241
|
+
Object.defineProperty(signal, 'aborted', { value: true, writable: true });
|
|
1242
|
+
throw new DOMException('The operation was aborted', 'AbortError');
|
|
1243
|
+
});
|
|
1244
|
+
const adapter = makeAdapter({ maxRetries: 2 });
|
|
1245
|
+
let caughtErr = undefined;
|
|
1246
|
+
try {
|
|
1247
|
+
await adapter.startRun(makeStartRunInput());
|
|
1248
|
+
}
|
|
1249
|
+
catch (err) {
|
|
1250
|
+
if (err instanceof PDRuntimeError)
|
|
1251
|
+
caughtErr = err;
|
|
1252
|
+
}
|
|
1253
|
+
expect(mockComplete).toHaveBeenCalledTimes(1); // Fails immediately, no retry
|
|
1254
|
+
expect(caughtErr).toBeDefined();
|
|
1255
|
+
expect(caughtErr?.category).toBe('timeout');
|
|
1256
|
+
expect(caughtErr?.details?.timeoutClassification).toBe('client_timeout_budget_exhausted');
|
|
1257
|
+
});
|
|
1258
|
+
it('10. circular objects, BigInt, and null-prototype objects in errors do not crash telemetry', async () => {
|
|
1259
|
+
mockComplete.mockReset();
|
|
1260
|
+
mockComplete.mockRejectedValueOnce(new Error('fail'));
|
|
1261
|
+
const nullProto = Object.create(null);
|
|
1262
|
+
nullProto.message = 'null prototype error';
|
|
1263
|
+
const circular = { message: 'circular error' };
|
|
1264
|
+
circular.self = circular;
|
|
1265
|
+
const bigIntErr = { message: 'bigint error', value: 9007199254740991n };
|
|
1266
|
+
const adapter = makeAdapter({ maxRetries: 0 });
|
|
1267
|
+
try {
|
|
1268
|
+
await adapter.startRun(makeStartRunInput({ inputPayload: nullProto }));
|
|
1269
|
+
}
|
|
1270
|
+
catch { /* expected */ }
|
|
1271
|
+
try {
|
|
1272
|
+
await adapter.startRun(makeStartRunInput({ inputPayload: circular }));
|
|
1273
|
+
}
|
|
1274
|
+
catch { /* expected */ }
|
|
1275
|
+
try {
|
|
1276
|
+
await adapter.startRun(makeStartRunInput({ inputPayload: bigIntErr }));
|
|
1277
|
+
}
|
|
1278
|
+
catch { /* expected */ }
|
|
1279
|
+
expect(true).toBe(true);
|
|
1280
|
+
});
|
|
1281
|
+
it('12. telemetry includes provider/model/elapsedMs/timeoutMs/timeoutSource/classification/attempt', async () => {
|
|
1282
|
+
mockComplete.mockReset();
|
|
1283
|
+
mockComplete.mockRejectedValue(new Error('request abort'));
|
|
1284
|
+
const adapter = makeAdapter({ maxRetries: 0 });
|
|
1285
|
+
try {
|
|
1286
|
+
await adapter.startRun(makeStartRunInput({ timeoutMs: 33_000 }));
|
|
1287
|
+
}
|
|
1288
|
+
catch { /* expected */ }
|
|
1289
|
+
const failedEvent = findTelemetryEvent('runtime_invocation_failed');
|
|
1290
|
+
expect(failedEvent).toBeDefined();
|
|
1291
|
+
const payload = failedEvent?.payload;
|
|
1292
|
+
expect(payload.provider).toBe('openrouter');
|
|
1293
|
+
expect(payload.model).toBe('anthropic/claude-sonnet-4');
|
|
1294
|
+
expect(typeof payload.elapsedMs).toBe('number');
|
|
1295
|
+
expect(payload.effectiveTimeoutMs).toBe(33_000);
|
|
1296
|
+
expect(payload.timeoutSource).toBe('runner_input');
|
|
1297
|
+
expect(payload.timeoutClassification).toBe('provider_transient_timeout');
|
|
1298
|
+
expect(payload.retryAttempt).toBe(0);
|
|
1299
|
+
});
|
|
1300
|
+
it('13. caps subsequent retry attempt timeoutMs to remaining overall budget', async () => {
|
|
1301
|
+
mockComplete.mockReset();
|
|
1302
|
+
mockComplete.mockImplementationOnce(async (_model, _ctx, _options) => {
|
|
1303
|
+
await new Promise(resolve => setTimeout(resolve, 40));
|
|
1304
|
+
throw new Error('transient timeout');
|
|
1305
|
+
});
|
|
1306
|
+
mockComplete.mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(VALID_DIAGNOSIS)));
|
|
1307
|
+
const adapter = makeAdapter({ maxRetries: 2 });
|
|
1308
|
+
await adapter.startRun(makeStartRunInput({ timeoutMs: 100 }));
|
|
1309
|
+
expect(mockComplete).toHaveBeenCalledTimes(2);
|
|
1310
|
+
const secondCallOpts = mockComplete.mock.calls[1]?.[2];
|
|
1311
|
+
expect(secondCallOpts).toBeDefined();
|
|
1312
|
+
const tc = secondCallOpts.timeoutMs;
|
|
1313
|
+
expect(typeof tc).toBe('number');
|
|
1314
|
+
expect(tc).toBeLessThanOrEqual(70);
|
|
1315
|
+
expect(tc).toBeGreaterThan(0);
|
|
1316
|
+
});
|
|
1317
|
+
it('14. fails fast with client_timeout_budget_exhausted when budget is exhausted', async () => {
|
|
1318
|
+
mockComplete.mockReset();
|
|
1319
|
+
mockComplete.mockImplementation(async () => {
|
|
1320
|
+
await new Promise(resolve => setTimeout(resolve, 50));
|
|
1321
|
+
throw new Error('transient timeout');
|
|
1322
|
+
});
|
|
1323
|
+
const adapter = makeAdapter({ maxRetries: 2 });
|
|
1324
|
+
let caughtErr = undefined;
|
|
1325
|
+
try {
|
|
1326
|
+
await adapter.startRun(makeStartRunInput({ timeoutMs: 30 }));
|
|
1327
|
+
}
|
|
1328
|
+
catch (err) {
|
|
1329
|
+
if (err instanceof PDRuntimeError)
|
|
1330
|
+
caughtErr = err;
|
|
1331
|
+
}
|
|
1332
|
+
expect(mockComplete).toHaveBeenCalledTimes(1);
|
|
1333
|
+
expect(caughtErr).toBeDefined();
|
|
1334
|
+
expect(caughtErr?.category).toBe('timeout');
|
|
1335
|
+
expect(caughtErr?.details?.timeoutClassification).toBe('client_timeout_budget_exhausted');
|
|
1336
|
+
});
|
|
1337
|
+
it('15. untrusted error classification ignores inherited properties and handles malformed fields safely', async () => {
|
|
1338
|
+
mockComplete.mockReset();
|
|
1339
|
+
const proto = {
|
|
1340
|
+
message: 'timeout - inherited but should be ignored if not own property',
|
|
1341
|
+
name: 'AbortError',
|
|
1342
|
+
};
|
|
1343
|
+
const malformedErr = Object.create(proto);
|
|
1344
|
+
malformedErr.message = 'ordinary own message';
|
|
1345
|
+
malformedErr.name = 'OrdinaryError';
|
|
1346
|
+
mockComplete.mockRejectedValueOnce(malformedErr);
|
|
1347
|
+
const adapter = makeAdapter({ maxRetries: 0 });
|
|
1348
|
+
let caughtErr = undefined;
|
|
1349
|
+
try {
|
|
1350
|
+
await adapter.startRun(makeStartRunInput());
|
|
1351
|
+
}
|
|
1352
|
+
catch (err) {
|
|
1353
|
+
if (err instanceof PDRuntimeError)
|
|
1354
|
+
caughtErr = err;
|
|
1355
|
+
}
|
|
1356
|
+
expect(caughtErr).toBeDefined();
|
|
1357
|
+
expect(caughtErr?.category).toBe('execution_failed');
|
|
1358
|
+
expect(caughtErr?.details?.timeoutClassification).toBeUndefined();
|
|
1359
|
+
});
|
|
1360
|
+
});
|
|
1361
|
+
});
|
|
1362
|
+
//# sourceMappingURL=pi-ai-runtime-adapter.test.js.map
|