@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,2990 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Architecture regression guard — verifies critical PRI-12/13/14/15/16/28
|
|
3
|
+
* module boundaries are present and exportable.
|
|
4
|
+
*
|
|
5
|
+
* Add entries here whenever a new service/read-model boundary is established.
|
|
6
|
+
*/
|
|
7
|
+
import { describe, it, expect } from 'vitest';
|
|
8
|
+
// ── Source-file existence ──────────────────────────────────────────────────
|
|
9
|
+
const REQUIRED_SOURCE_FILES = [
|
|
10
|
+
'pain-to-principle-service.ts',
|
|
11
|
+
'pain-chain-read-model.ts',
|
|
12
|
+
'pain-signal-bridge.ts',
|
|
13
|
+
'pain-signal-runtime-factory.ts',
|
|
14
|
+
'pain-signal-observability.ts',
|
|
15
|
+
'pruning-read-model.ts',
|
|
16
|
+
'pruning-review-log.ts',
|
|
17
|
+
// PRI-28
|
|
18
|
+
'operator-health-read-model.ts',
|
|
19
|
+
'candidate-audit.ts',
|
|
20
|
+
// PRI-42
|
|
21
|
+
'internalization/rule-host-contracts.ts',
|
|
22
|
+
'internalization/rule-host-helpers.ts',
|
|
23
|
+
'internalization/index.ts',
|
|
24
|
+
// PRI-43
|
|
25
|
+
'internalization/internalization-route.ts',
|
|
26
|
+
// PRI-44
|
|
27
|
+
'internalization/template-generator.ts',
|
|
28
|
+
'internalization/rule-code-validator.ts',
|
|
29
|
+
'internalization/compile-result.ts',
|
|
30
|
+
// PRI-45
|
|
31
|
+
'internalization/rule-host-evaluator.ts',
|
|
32
|
+
'internalization/rule-host-adapter.ts',
|
|
33
|
+
// PRI-51
|
|
34
|
+
'types/principle-enums.ts',
|
|
35
|
+
'types/principle-schema.ts',
|
|
36
|
+
'types/artifact-lineage.ts',
|
|
37
|
+
'types/replay-types.ts',
|
|
38
|
+
'types/index.ts',
|
|
39
|
+
'internalization/lifecycle-types.ts',
|
|
40
|
+
// PRI-52
|
|
41
|
+
'internalization/lifecycle-metrics.ts',
|
|
42
|
+
// PRI-53
|
|
43
|
+
'internalization/deprecated-readiness.ts',
|
|
44
|
+
// PRI-54
|
|
45
|
+
'internalization/routing-policy.ts',
|
|
46
|
+
// PRI-56
|
|
47
|
+
'internalization/lifecycle-datasource.ts',
|
|
48
|
+
'internalization/lifecycle-read-model.ts',
|
|
49
|
+
// PRI-61
|
|
50
|
+
'internalization/peer-runner-contracts.ts',
|
|
51
|
+
'internalization/internalization-job-graph.ts',
|
|
52
|
+
// PRI-62
|
|
53
|
+
'internalization/internalization-task-guards.ts',
|
|
54
|
+
'internalization/internalization-state-machine.ts',
|
|
55
|
+
// PRI-65
|
|
56
|
+
'internalization/pitask-metadata.ts',
|
|
57
|
+
// PRI-67
|
|
58
|
+
'internalization/dreamer-output.ts',
|
|
59
|
+
'internalization/dreamer-runner.ts',
|
|
60
|
+
// PRI-109
|
|
61
|
+
'internalization/scribe-output.ts',
|
|
62
|
+
'internalization/scribe-runner.ts',
|
|
63
|
+
// PRI-111
|
|
64
|
+
'internalization/artificer-output.ts',
|
|
65
|
+
'internalization/artificer-runner.ts',
|
|
66
|
+
// PRI-EVAL
|
|
67
|
+
'internalization/evaluator-output.ts',
|
|
68
|
+
'internalization/evaluator-runner.ts',
|
|
69
|
+
'internalization/evaluator-prompt-builder.ts',
|
|
70
|
+
// PRI-RR
|
|
71
|
+
'internalization/rollout-reviewer-output.ts',
|
|
72
|
+
'internalization/rollout-reviewer-runner.ts',
|
|
73
|
+
'internalization/rollout-reviewer-prompt-builder.ts',
|
|
74
|
+
// PRI-74 (follow-up to PRI-75 Phase 3)
|
|
75
|
+
'../prompt-builder/routing-guidance.ts',
|
|
76
|
+
// PRI-81 Phase A
|
|
77
|
+
'../prompt-builder/empathy-keyword-matching.ts',
|
|
78
|
+
'../prompt-builder/empathy-types.ts',
|
|
79
|
+
// PRI-81 Phase B
|
|
80
|
+
'../prompt-builder/focus-compression.ts',
|
|
81
|
+
// PRI-76
|
|
82
|
+
'gfi/gfi-types.ts',
|
|
83
|
+
'gfi/gfi-policy.ts',
|
|
84
|
+
'gfi/gfi-kernel.ts',
|
|
85
|
+
'gfi/index.ts',
|
|
86
|
+
// PRI-84
|
|
87
|
+
'internalization/pi-artifact.ts',
|
|
88
|
+
'internalization/pi-artifact-store.ts',
|
|
89
|
+
// PRI-115
|
|
90
|
+
'golden-trace-replay-validator.ts',
|
|
91
|
+
'golden-trace-replay-adapter.ts',
|
|
92
|
+
// PRI-172
|
|
93
|
+
'internalization/refiner-sandbox-wrapper.ts',
|
|
94
|
+
// PRI-173
|
|
95
|
+
'internalization/refiner-rulehost-gate.ts',
|
|
96
|
+
// Phase 2 migration: evolution types
|
|
97
|
+
'evolution/evolution-types.ts',
|
|
98
|
+
'evolution/index.ts',
|
|
99
|
+
// Phase 2 migration: correction types
|
|
100
|
+
'correction/correction-types.ts',
|
|
101
|
+
'correction/index.ts',
|
|
102
|
+
// Phase 2 migration: types directory
|
|
103
|
+
'types/queue-types.ts',
|
|
104
|
+
'types/hygiene-types.ts',
|
|
105
|
+
'types/runtime-summary-types.ts',
|
|
106
|
+
'types/event-types.ts',
|
|
107
|
+
'types/event-payload.ts',
|
|
108
|
+
'types/pain-signal.ts',
|
|
109
|
+
'types/pd-task-types.ts',
|
|
110
|
+
// Phase 2 migration: principle-tree data structures
|
|
111
|
+
'types/principle-dependency.ts',
|
|
112
|
+
'types/principle-value-metrics.ts',
|
|
113
|
+
'types/principle-lifecycle-event.ts',
|
|
114
|
+
'types/principle-tree-store.ts',
|
|
115
|
+
// PRI-140
|
|
116
|
+
'store/sqlite-connection.ts',
|
|
117
|
+
// PRI-139
|
|
118
|
+
'l1-hard-cap.ts',
|
|
119
|
+
// PRI-142
|
|
120
|
+
'internalization/intake-to-internalization-bridge.ts',
|
|
121
|
+
// PRI-144
|
|
122
|
+
'activation/activation-types.ts',
|
|
123
|
+
'activation/activation-dispatcher.ts',
|
|
124
|
+
'activation/low-risk-writers.ts',
|
|
125
|
+
'activation/index.ts',
|
|
126
|
+
// PRI-145
|
|
127
|
+
'activation/approval-queue.ts',
|
|
128
|
+
'activation/memory-approval-store.ts',
|
|
129
|
+
'activation/sqlite-approval-store.ts',
|
|
130
|
+
// PRI-189
|
|
131
|
+
'store/trajectory/source-trace-locator.ts',
|
|
132
|
+
'store/trajectory/sqlite-source-trace-locator.ts',
|
|
133
|
+
// PRI-190
|
|
134
|
+
'full-trace-contract.ts',
|
|
135
|
+
// PRI-191
|
|
136
|
+
'trace-refiner.ts',
|
|
137
|
+
// PRI-192
|
|
138
|
+
'trace-refiner-agent.ts',
|
|
139
|
+
// PRI-193
|
|
140
|
+
'golden-trace-candidate-builder.ts',
|
|
141
|
+
// PRI-149 Tier 2
|
|
142
|
+
'recovery-sweep-service.ts',
|
|
143
|
+
// PRI-146
|
|
144
|
+
'activation/writers/rule-host-writer.ts',
|
|
145
|
+
'activation/writers/index.ts',
|
|
146
|
+
// PRI-215
|
|
147
|
+
'synthetic-baseline.ts',
|
|
148
|
+
// PRI-239
|
|
149
|
+
'feature-flags/feature-flag-contract.ts',
|
|
150
|
+
'feature-flags/index.ts',
|
|
151
|
+
];
|
|
152
|
+
// ── PRI-212: Plugin core anti-growth guard ────────────────────────────────────
|
|
153
|
+
//
|
|
154
|
+
// Baseline: PRI-211 inventory (docs/reviews/plugin-core-inventory-2026-05.md)
|
|
155
|
+
// Prevents silent growth of packages/openclaw-plugin/src/core/ by requiring
|
|
156
|
+
// explicit classification for every new file.
|
|
157
|
+
//
|
|
158
|
+
// New pure domain logic → @principles/core
|
|
159
|
+
// New I/O adapters → must be classified as plugin-specific
|
|
160
|
+
// ERR-011 reference: never bypass architecture boundary facades
|
|
161
|
+
// ERR-012 reference: stale-main PR rollback must not delete baseline entries
|
|
162
|
+
//
|
|
163
|
+
// To add a new plugin I/O adapter legitimately, add its relative path
|
|
164
|
+
// (from packages/openclaw-plugin/src/core/) to the KNOWN_PLUGIN_CORE_FILES
|
|
165
|
+
// set below with a comment explaining why it is plugin-specific.
|
|
166
|
+
const KNOWN_PLUGIN_CORE_FILES = new Set([
|
|
167
|
+
// ── Pure Domain Logic Candidates — exist today but new pure logic belongs in @principles/core ──
|
|
168
|
+
'trajectory-types.ts',
|
|
169
|
+
'profile.ts',
|
|
170
|
+
'pain-signal.ts',
|
|
171
|
+
'pd-task-types.ts',
|
|
172
|
+
'evolution-types.ts',
|
|
173
|
+
'telemetry-event.ts',
|
|
174
|
+
'empathy-types.ts',
|
|
175
|
+
'correction-types.ts',
|
|
176
|
+
'principle-injection.ts',
|
|
177
|
+
'principle-compiler/template-generator.ts',
|
|
178
|
+
// ── Thin Adapter Candidates — plugin I/O boundary wrappers ──────────────
|
|
179
|
+
'local-worker-routing.ts',
|
|
180
|
+
'principle-tree-migration.ts',
|
|
181
|
+
'principle-internalization/principle-lifecycle-service.ts',
|
|
182
|
+
'principle-tree-ledger-adapter.ts',
|
|
183
|
+
'principle-compiler/ledger-registrar.ts',
|
|
184
|
+
'principle-compiler/code-validator.ts',
|
|
185
|
+
'principle-injector.ts',
|
|
186
|
+
'pd-task-service.ts',
|
|
187
|
+
'principle-internalization/lifecycle-read-model.ts',
|
|
188
|
+
'principle-internalization/filesystem-lifecycle-datasource.ts',
|
|
189
|
+
'config-service.ts',
|
|
190
|
+
'principle-compiler/index.ts',
|
|
191
|
+
'principle-internalization/lifecycle-refresh.ts',
|
|
192
|
+
// ── Do Not Move — intrinsically plugin-specific ─────────────────────────
|
|
193
|
+
'event-log.ts',
|
|
194
|
+
'schema/schema-definitions.ts',
|
|
195
|
+
'path-resolver.ts',
|
|
196
|
+
'init.ts',
|
|
197
|
+
'workspace-context.ts',
|
|
198
|
+
'reflection/reflection-context.ts',
|
|
199
|
+
'bootstrap-rules.ts',
|
|
200
|
+
'schema/migration-runner.ts',
|
|
201
|
+
'rule-host.ts',
|
|
202
|
+
'principle-training-state.ts',
|
|
203
|
+
'pain-diagnostic-gate.ts',
|
|
204
|
+
'hygiene/tracker.ts',
|
|
205
|
+
'schema/migrations/002-init-central.ts',
|
|
206
|
+
'workspace-dir-service.ts',
|
|
207
|
+
'paths.ts',
|
|
208
|
+
'schema/migrations/004-add-thinking-and-gfi.ts',
|
|
209
|
+
'evolution-hook.ts',
|
|
210
|
+
'storage-adapter.ts',
|
|
211
|
+
'schema/migrations/003-init-workflow.ts',
|
|
212
|
+
'workspace-dir-validation.ts',
|
|
213
|
+
'pain-signal-adapter.ts',
|
|
214
|
+
'rule-implementation-runtime.ts',
|
|
215
|
+
'detection-service.ts',
|
|
216
|
+
'schema/migrations/index.ts',
|
|
217
|
+
'dictionary-service.ts',
|
|
218
|
+
'schema/index.ts',
|
|
219
|
+
'schema/db-types.ts',
|
|
220
|
+
'rule-host-types.ts',
|
|
221
|
+
'rule-host-helpers.ts',
|
|
222
|
+
'schema/migrations/001-init-trajectory.ts',
|
|
223
|
+
// ── I/O Boundary ────────────────────────────────────────────────────────
|
|
224
|
+
'confirm-first-gate.ts',
|
|
225
|
+
'trajectory.ts',
|
|
226
|
+
'evolution-reducer.ts',
|
|
227
|
+
'promotion-gate.ts',
|
|
228
|
+
'model-training-registry.ts',
|
|
229
|
+
'focus-history.ts',
|
|
230
|
+
'model-deployment-registry.ts',
|
|
231
|
+
'training-program.ts',
|
|
232
|
+
'replay-engine.ts',
|
|
233
|
+
'external-training-contract.ts',
|
|
234
|
+
'merge-gate-audit.ts',
|
|
235
|
+
'shadow-observation-registry.ts',
|
|
236
|
+
'control-ui-db.ts',
|
|
237
|
+
'thinking-models.ts',
|
|
238
|
+
'pd-task-reconciler.ts',
|
|
239
|
+
'correction-cue-learner.ts',
|
|
240
|
+
'principle-compiler/compiler.ts',
|
|
241
|
+
'pain.ts',
|
|
242
|
+
'pain-context-extractor.ts',
|
|
243
|
+
'config.ts',
|
|
244
|
+
'code-implementation-storage.ts',
|
|
245
|
+
'observability.ts',
|
|
246
|
+
'file-storage-adapter.ts',
|
|
247
|
+
'workflow-funnel-loader.ts',
|
|
248
|
+
'dictionary.ts',
|
|
249
|
+
'thinking-os-parser.ts',
|
|
250
|
+
'system-logger.ts',
|
|
251
|
+
'detection-funnel.ts',
|
|
252
|
+
'risk-calculator.ts',
|
|
253
|
+
'migration.ts',
|
|
254
|
+
'file-store.ts',
|
|
255
|
+
'pd-task-store.ts',
|
|
256
|
+
'evolution-migration.ts',
|
|
257
|
+
'empathy-keyword-matcher.ts',
|
|
258
|
+
'pain-lifecycle.ts',
|
|
259
|
+
'session-tracker.ts',
|
|
260
|
+
'principle-tree-ledger.ts',
|
|
261
|
+
'evolution-logger.ts',
|
|
262
|
+
'evolution-engine.ts',
|
|
263
|
+
// ── Runtime V2 ──────────────────────────────────────────────────────────
|
|
264
|
+
'runtime-v2-prompt-activation-reader.ts',
|
|
265
|
+
// ── Test Files ──────────────────────────────────────────────────────────
|
|
266
|
+
'__tests__/focus-history.test.ts',
|
|
267
|
+
'principle-compiler/__tests__/compiler-replay-gate.test.ts',
|
|
268
|
+
]);
|
|
269
|
+
describe('PRI-212 plugin core anti-growth guard', () => {
|
|
270
|
+
const PLUGIN_CORE_RELPATH = '../../../../openclaw-plugin/src/core';
|
|
271
|
+
it('every plugin-core file is in the known baseline', async () => {
|
|
272
|
+
const { readdirSync, existsSync } = await import('node:fs');
|
|
273
|
+
const { resolve, relative, sep } = await import('node:path');
|
|
274
|
+
const pluginCoreDir = resolve(__dirname, PLUGIN_CORE_RELPATH);
|
|
275
|
+
expect(existsSync(pluginCoreDir)).toBe(true);
|
|
276
|
+
// Collect all .ts files recursively (relative to plugin-core root)
|
|
277
|
+
const allFiles = [];
|
|
278
|
+
function collectDir(dir) {
|
|
279
|
+
for (const entry of readdirSync(dir, { withFileTypes: true })) {
|
|
280
|
+
const fullPath = resolve(dir, entry.name);
|
|
281
|
+
if (entry.isDirectory()) {
|
|
282
|
+
collectDir(fullPath);
|
|
283
|
+
}
|
|
284
|
+
else if (entry.name.endsWith('.ts')) {
|
|
285
|
+
allFiles.push(relative(pluginCoreDir, fullPath).split(sep).join('/'));
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
collectDir(pluginCoreDir);
|
|
290
|
+
const unknownFiles = allFiles.filter((f) => !KNOWN_PLUGIN_CORE_FILES.has(f));
|
|
291
|
+
if (unknownFiles.length > 0) {
|
|
292
|
+
const msg = [
|
|
293
|
+
`Found ${unknownFiles.length} unclassified file(s) in packages/openclaw-plugin/src/core/:`,
|
|
294
|
+
...unknownFiles.map((f) => ` ${f}`),
|
|
295
|
+
'',
|
|
296
|
+
'Each new file in plugin core must be explicitly classified:',
|
|
297
|
+
' 1. New pure domain logic → packages/principles-core (zero I/O, testable with no mocks)',
|
|
298
|
+
' 2. New plugin I/O adapter → add to KNOWN_PLUGIN_CORE_FILES with classification comment',
|
|
299
|
+
' 3. See docs/reviews/plugin-core-inventory-2026-05.md for the PRI-211 baseline',
|
|
300
|
+
'ERR-011: never bypass architecture boundary facades',
|
|
301
|
+
'ERR-012: baseline entries must survive rebase — check diff for unintended deletions',
|
|
302
|
+
].join('\n');
|
|
303
|
+
expect.fail(msg);
|
|
304
|
+
}
|
|
305
|
+
});
|
|
306
|
+
it('known baseline count is self-consistent (109 files)', async () => {
|
|
307
|
+
// Sanity check: if the baseline grows, update this number.
|
|
308
|
+
// Prevents accidental baseline bloat from going unnoticed.
|
|
309
|
+
// See docs/reviews/plugin-core-inventory-2026-05.md §7
|
|
310
|
+
expect(KNOWN_PLUGIN_CORE_FILES.size).toBe(95);
|
|
311
|
+
});
|
|
312
|
+
});
|
|
313
|
+
const REQUIRED_TEST_FILES = [
|
|
314
|
+
'pain-to-principle-service.test.ts',
|
|
315
|
+
'pain-chain-read-model.test.ts',
|
|
316
|
+
'pruning-read-model.test.ts',
|
|
317
|
+
'pruning-review-log.test.ts',
|
|
318
|
+
// PRI-28
|
|
319
|
+
'operator-health-read-model.test.ts',
|
|
320
|
+
'candidate-audit.test.ts',
|
|
321
|
+
// PRI-56 (lifecycle-read-model.test.ts is at internalization/lifecycle-read-model.test.ts, not in __tests__/)
|
|
322
|
+
// Skipping — test file lives at ../internalization/ not __tests__/internalization/
|
|
323
|
+
// PRI-62
|
|
324
|
+
'internalization-state-machine.test.ts',
|
|
325
|
+
// PRI-65
|
|
326
|
+
'pitask-metadata.test.ts',
|
|
327
|
+
// PRI-67
|
|
328
|
+
'dreamer-runner.test.ts',
|
|
329
|
+
// PRI-109
|
|
330
|
+
'scribe-runner-vslice.test.ts',
|
|
331
|
+
// PRI-111
|
|
332
|
+
'artificer-runner-vslice.test.ts',
|
|
333
|
+
// PRI-EVAL
|
|
334
|
+
'evaluator-runner-vslice.test.ts',
|
|
335
|
+
// PRI-RR
|
|
336
|
+
'rollout-reviewer-runner-vslice.test.ts',
|
|
337
|
+
// PRI-74 (follow-up to PRI-75 Phase 3)
|
|
338
|
+
'../../prompt-builder/__tests__/routing-guidance.test.ts',
|
|
339
|
+
// PRI-81 Phase A
|
|
340
|
+
'../../prompt-builder/__tests__/empathy-keyword-matching.test.ts',
|
|
341
|
+
// PRI-81 Phase B
|
|
342
|
+
'../../prompt-builder/__tests__/focus-compression.test.ts',
|
|
343
|
+
// PRI-76
|
|
344
|
+
'../gfi/__tests__/gfi-kernel.test.ts',
|
|
345
|
+
// PRI-115
|
|
346
|
+
'golden-trace-replay-validator.test.ts',
|
|
347
|
+
// PRI-140
|
|
348
|
+
'../store/sqlite-connection-pragma.test.ts',
|
|
349
|
+
// PRI-141
|
|
350
|
+
'task-three-strikes.test.ts',
|
|
351
|
+
// PRI-139
|
|
352
|
+
'l1-hard-cap.test.ts',
|
|
353
|
+
// PRI-142
|
|
354
|
+
'intake-to-internalization-bridge.test.ts',
|
|
355
|
+
// PRI-144
|
|
356
|
+
'../activation/__tests__/activation-dispatcher.test.ts',
|
|
357
|
+
// PRI-145
|
|
358
|
+
'../activation/__tests__/approval-queue.test.ts',
|
|
359
|
+
'../activation/__tests__/sqlite-approval-store.test.ts',
|
|
360
|
+
// PRI-190
|
|
361
|
+
'full-trace-contract.test.ts',
|
|
362
|
+
// PRI-191
|
|
363
|
+
'trace-refiner.test.ts',
|
|
364
|
+
// PRI-192
|
|
365
|
+
'trace-refiner-agent.test.ts',
|
|
366
|
+
// PRI-193
|
|
367
|
+
'golden-trace-candidate-builder.test.ts',
|
|
368
|
+
// PRI-173
|
|
369
|
+
'../internalization/__tests__/refiner-rulehost-gate.test.ts',
|
|
370
|
+
// PRI-146
|
|
371
|
+
'../activation/writers/__tests__/rule-host-writer.test.ts',
|
|
372
|
+
// PRI-215
|
|
373
|
+
'synthetic-baseline.test.ts',
|
|
374
|
+
// PRI-239
|
|
375
|
+
'../feature-flags/__tests__/feature-flag-contract.test.ts',
|
|
376
|
+
];
|
|
377
|
+
const REQUIRED_DOC_FILES = [];
|
|
378
|
+
for (const file of REQUIRED_SOURCE_FILES) {
|
|
379
|
+
it(`source file ${file} is present`, async () => {
|
|
380
|
+
const { existsSync } = await import('node:fs');
|
|
381
|
+
const { resolve } = await import('node:path');
|
|
382
|
+
expect(existsSync(resolve(__dirname, '..', file))).toBe(true);
|
|
383
|
+
});
|
|
384
|
+
}
|
|
385
|
+
for (const file of REQUIRED_TEST_FILES) {
|
|
386
|
+
it(`test file __tests__/${file} is present`, async () => {
|
|
387
|
+
const { existsSync } = await import('node:fs');
|
|
388
|
+
const { resolve } = await import('node:path');
|
|
389
|
+
expect(existsSync(resolve(__dirname, file))).toBe(true);
|
|
390
|
+
});
|
|
391
|
+
}
|
|
392
|
+
for (const file of REQUIRED_DOC_FILES) {
|
|
393
|
+
it(`doc file ${file} is present`, async () => {
|
|
394
|
+
const { existsSync } = await import('node:fs');
|
|
395
|
+
const { resolve } = await import('node:path');
|
|
396
|
+
expect(existsSync(resolve(__dirname, file))).toBe(true);
|
|
397
|
+
});
|
|
398
|
+
}
|
|
399
|
+
// ── Public API exports ─────────────────────────────────────────────────────
|
|
400
|
+
describe('runtime-v2 public API (index.ts barrel)', () => {
|
|
401
|
+
const barrel = import('../index.js');
|
|
402
|
+
const REQUIRED_EXPORTS = [
|
|
403
|
+
// PRI-12
|
|
404
|
+
'PainToPrincipleService',
|
|
405
|
+
// PRI-14
|
|
406
|
+
'PainChainReadModel',
|
|
407
|
+
// M8
|
|
408
|
+
'PainSignalBridge',
|
|
409
|
+
'createPainSignalBridge',
|
|
410
|
+
'recordPainSignalObservability',
|
|
411
|
+
// PRI-15
|
|
412
|
+
'PruningReadModel',
|
|
413
|
+
// PRI-13 → factory
|
|
414
|
+
'resolveRuntimeConfig',
|
|
415
|
+
'validateRuntimeConfig',
|
|
416
|
+
// PRI-28
|
|
417
|
+
'OperatorHealthReadModel',
|
|
418
|
+
'auditCandidateLedgerConsistency',
|
|
419
|
+
// PRI-43
|
|
420
|
+
'decideInternalizationRoute',
|
|
421
|
+
// PRI-44
|
|
422
|
+
'generateFromTemplate',
|
|
423
|
+
'checkForbiddenPatterns',
|
|
424
|
+
// PRI-45
|
|
425
|
+
'mergeDecisions',
|
|
426
|
+
// PRI-149 Tier 2
|
|
427
|
+
'createRecoverySweepService',
|
|
428
|
+
// PRI-239
|
|
429
|
+
'validateFeatureFlagRaw',
|
|
430
|
+
'computeEffectiveFlags',
|
|
431
|
+
];
|
|
432
|
+
for (const name of REQUIRED_EXPORTS) {
|
|
433
|
+
it(`exports ${name}`, async () => {
|
|
434
|
+
const mod = (await barrel);
|
|
435
|
+
expect(mod).toHaveProperty(name);
|
|
436
|
+
expect(typeof mod[name]).toBe('function');
|
|
437
|
+
}, 15_000);
|
|
438
|
+
}
|
|
439
|
+
// PRI-171: TypeBox schema exports (objects, not functions)
|
|
440
|
+
const REQUIRED_SCHEMA_EXPORTS = [
|
|
441
|
+
'FullTracePayloadSchema',
|
|
442
|
+
'ToolCallEntrySchema',
|
|
443
|
+
'PainContextSchema',
|
|
444
|
+
// PRI-190
|
|
445
|
+
'FullTracePayloadV2Schema',
|
|
446
|
+
'TraceSourceRefSchema',
|
|
447
|
+
'TraceTimelineEntrySchema',
|
|
448
|
+
'TraceEventKindSchema',
|
|
449
|
+
'SourceRefKindSchema',
|
|
450
|
+
];
|
|
451
|
+
for (const name of REQUIRED_SCHEMA_EXPORTS) {
|
|
452
|
+
it(`exports schema ${name}`, async () => {
|
|
453
|
+
const mod = (await barrel);
|
|
454
|
+
expect(mod).toHaveProperty(name);
|
|
455
|
+
expect(typeof mod[name]).toBe('object');
|
|
456
|
+
}, 15_000);
|
|
457
|
+
}
|
|
458
|
+
});
|
|
459
|
+
// ── OpenClawPlugin pain hook integration ───────────────────────────────────
|
|
460
|
+
describe('openclaw-plugin pain hook integration', () => {
|
|
461
|
+
it('pain.ts uses PainToPrincipleService (not createPainSignalBridge)', async () => {
|
|
462
|
+
const { existsSync, readFileSync } = await import('node:fs');
|
|
463
|
+
const { resolve } = await import('node:path');
|
|
464
|
+
const painHookPath = resolve(__dirname, '../../../../openclaw-plugin/src/hooks/pain.ts');
|
|
465
|
+
expect(existsSync(painHookPath)).toBe(true);
|
|
466
|
+
const src = readFileSync(painHookPath, 'utf-8');
|
|
467
|
+
expect(src).toContain('PainToPrincipleService');
|
|
468
|
+
expect(src).not.toContain('createPainSignalBridge');
|
|
469
|
+
});
|
|
470
|
+
// PRI-29: emitPainDetectedEvent → PainToPrincipleService service contract
|
|
471
|
+
it('pain.ts emitPainDetectedEvent calls PainToPrincipleService.recordPain on pain_detected', async () => {
|
|
472
|
+
const { existsSync, readFileSync } = await import('node:fs');
|
|
473
|
+
const { resolve } = await import('node:path');
|
|
474
|
+
const painHookPath = resolve(__dirname, '../../../../openclaw-plugin/src/hooks/pain.ts');
|
|
475
|
+
expect(existsSync(painHookPath)).toBe(true);
|
|
476
|
+
const src = readFileSync(painHookPath, 'utf-8');
|
|
477
|
+
// Must call service.recordPain() inside emitPainDetectedEvent
|
|
478
|
+
expect(src).toMatch(/service\.recordPain\(/);
|
|
479
|
+
// Must log PAIN_SERVICE_FAILED for failure results
|
|
480
|
+
expect(src).toMatch(/PAIN_SERVICE_FAILED/);
|
|
481
|
+
// Must log PAIN_SERVICE_SKIPPED for skipped results
|
|
482
|
+
expect(src).toMatch(/PAIN_SERVICE_SKIPPED/);
|
|
483
|
+
// Must log PAIN_SERVICE_ERROR for exceptions
|
|
484
|
+
expect(src).toMatch(/PAIN_SERVICE_ERROR/);
|
|
485
|
+
// Must NOT use legacy createPainSignalBridge
|
|
486
|
+
expect(src).not.toMatch(/createPainSignalBridge/);
|
|
487
|
+
});
|
|
488
|
+
});
|
|
489
|
+
// ── PRI-42: Internalization boundary guards ──────────────────────────────────
|
|
490
|
+
describe('PRI-42 internalization boundary', () => {
|
|
491
|
+
const CONTRACT_TYPES = [
|
|
492
|
+
'RuleHostInput',
|
|
493
|
+
'RuleHostResult',
|
|
494
|
+
'RuleHostDecision',
|
|
495
|
+
'RuleHostMeta',
|
|
496
|
+
'LoadedImplementation',
|
|
497
|
+
];
|
|
498
|
+
it('core internalization has zero openclaw-plugin imports', async () => {
|
|
499
|
+
const { existsSync, readdirSync, readFileSync } = await import('node:fs');
|
|
500
|
+
const { resolve, join } = await import('node:path');
|
|
501
|
+
const intDir = resolve(__dirname, '..', 'internalization');
|
|
502
|
+
expect(existsSync(intDir)).toBe(true);
|
|
503
|
+
const files = readdirSync(intDir).filter((f) => f.endsWith('.ts') && !f.endsWith('.test.ts'));
|
|
504
|
+
for (const file of files) {
|
|
505
|
+
const src = readFileSync(join(intDir, file), 'utf-8');
|
|
506
|
+
expect(src).not.toContain('openclaw-plugin');
|
|
507
|
+
expect(src).not.toContain('../../../openclaw-plugin');
|
|
508
|
+
}
|
|
509
|
+
});
|
|
510
|
+
it('plugin does not re-define RuleHost contract types locally', async () => {
|
|
511
|
+
const { existsSync, readFileSync } = await import('node:fs');
|
|
512
|
+
const { resolve } = await import('node:path');
|
|
513
|
+
const typesPath = resolve(__dirname, '../../../../openclaw-plugin/src/core/rule-host-types.ts');
|
|
514
|
+
expect(existsSync(typesPath)).toBe(true);
|
|
515
|
+
const src = readFileSync(typesPath, 'utf-8');
|
|
516
|
+
// After PRI-42, rule-host-types.ts should re-export from core, not define interfaces
|
|
517
|
+
for (const typeName of CONTRACT_TYPES) {
|
|
518
|
+
expect(src).toContain(typeName);
|
|
519
|
+
expect(src).toContain("from '@principles/core/runtime-v2'");
|
|
520
|
+
}
|
|
521
|
+
});
|
|
522
|
+
it('plugin does not re-define RuleHostHelpers locally', async () => {
|
|
523
|
+
const { existsSync, readFileSync } = await import('node:fs');
|
|
524
|
+
const { resolve } = await import('node:path');
|
|
525
|
+
const helpersPath = resolve(__dirname, '../../../../openclaw-plugin/src/core/rule-host-helpers.ts');
|
|
526
|
+
expect(existsSync(helpersPath)).toBe(true);
|
|
527
|
+
const src = readFileSync(helpersPath, 'utf-8');
|
|
528
|
+
// After PRI-42, rule-host-helpers.ts should re-export from core, not define interface
|
|
529
|
+
expect(src).toContain('RuleHostHelpers');
|
|
530
|
+
expect(src).toContain('createRuleHostHelpers');
|
|
531
|
+
expect(src).toContain("from '@principles/core/runtime-v2'");
|
|
532
|
+
});
|
|
533
|
+
it('plugin rule-host.ts imports contracts from core barrel', async () => {
|
|
534
|
+
const { existsSync, readFileSync } = await import('node:fs');
|
|
535
|
+
const { resolve } = await import('node:path');
|
|
536
|
+
const ruleHostPath = resolve(__dirname, '../../../../openclaw-plugin/src/core/rule-host.ts');
|
|
537
|
+
expect(existsSync(ruleHostPath)).toBe(true);
|
|
538
|
+
const src = readFileSync(ruleHostPath, 'utf-8');
|
|
539
|
+
// Must import from @principles/core/runtime-v2, not local rule-host-types
|
|
540
|
+
expect(src).toContain('@principles/core/runtime-v2');
|
|
541
|
+
expect(src).not.toContain("from './rule-host-types.js'");
|
|
542
|
+
});
|
|
543
|
+
it('plugin gate.ts imports RuleHostInput from core barrel', async () => {
|
|
544
|
+
const { existsSync, readFileSync } = await import('node:fs');
|
|
545
|
+
const { resolve } = await import('node:path');
|
|
546
|
+
const gatePath = resolve(__dirname, '../../../../openclaw-plugin/src/hooks/gate.ts');
|
|
547
|
+
expect(existsSync(gatePath)).toBe(true);
|
|
548
|
+
const src = readFileSync(gatePath, 'utf-8');
|
|
549
|
+
expect(src).toContain('@principles/core/runtime-v2');
|
|
550
|
+
expect(src).not.toContain("from '../core/rule-host-types.js'");
|
|
551
|
+
});
|
|
552
|
+
it('plugin replay-engine.ts imports contracts from core barrel', async () => {
|
|
553
|
+
const { existsSync, readFileSync } = await import('node:fs');
|
|
554
|
+
const { resolve } = await import('node:path');
|
|
555
|
+
const replayPath = resolve(__dirname, '../../../../openclaw-plugin/src/core/replay-engine.ts');
|
|
556
|
+
expect(existsSync(replayPath)).toBe(true);
|
|
557
|
+
const src = readFileSync(replayPath, 'utf-8');
|
|
558
|
+
expect(src).toContain('@principles/core/runtime-v2');
|
|
559
|
+
expect(src).not.toContain("from './rule-host-types.js'");
|
|
560
|
+
expect(src).not.toContain("from './rule-host-helpers.js'");
|
|
561
|
+
});
|
|
562
|
+
});
|
|
563
|
+
// ── PRI-44: Principle-compiler core boundary ──────────────────────────────────
|
|
564
|
+
describe('PRI-44 principle-compiler core boundary', () => {
|
|
565
|
+
it('core template-generator.ts has zero infrastructure imports', async () => {
|
|
566
|
+
const { readFileSync } = await import('node:fs');
|
|
567
|
+
const { resolve } = await import('node:path');
|
|
568
|
+
const src = readFileSync(resolve(__dirname, '..', 'internalization', 'template-generator.ts'), 'utf-8');
|
|
569
|
+
expect(src).not.toContain('node:vm');
|
|
570
|
+
expect(src).not.toContain('node:fs');
|
|
571
|
+
expect(src).not.toContain('openclaw-plugin');
|
|
572
|
+
});
|
|
573
|
+
it('core rule-code-validator.ts has zero infrastructure imports', async () => {
|
|
574
|
+
const { readFileSync } = await import('node:fs');
|
|
575
|
+
const { resolve } = await import('node:path');
|
|
576
|
+
const src = readFileSync(resolve(__dirname, '..', 'internalization', 'rule-code-validator.ts'), 'utf-8');
|
|
577
|
+
expect(src).not.toContain('node:vm');
|
|
578
|
+
expect(src).not.toContain('node:fs');
|
|
579
|
+
expect(src).not.toContain('openclaw-plugin');
|
|
580
|
+
});
|
|
581
|
+
it('plugin template-generator.ts re-exports from core', async () => {
|
|
582
|
+
const { readFileSync } = await import('node:fs');
|
|
583
|
+
const { resolve } = await import('node:path');
|
|
584
|
+
const src = readFileSync(resolve(__dirname, '../../../../openclaw-plugin/src/core/principle-compiler/template-generator.ts'), 'utf-8');
|
|
585
|
+
expect(src).toContain('@principles/core/runtime-v2');
|
|
586
|
+
expect(src).toContain('generateFromTemplate');
|
|
587
|
+
});
|
|
588
|
+
it('plugin code-validator.ts imports checkForbiddenPatterns from core', async () => {
|
|
589
|
+
const { readFileSync } = await import('node:fs');
|
|
590
|
+
const { resolve } = await import('node:path');
|
|
591
|
+
const src = readFileSync(resolve(__dirname, '../../../../openclaw-plugin/src/core/principle-compiler/code-validator.ts'), 'utf-8');
|
|
592
|
+
expect(src).toContain('checkForbiddenPatterns');
|
|
593
|
+
expect(src).toContain('@principles/core/runtime-v2');
|
|
594
|
+
});
|
|
595
|
+
it('plugin compiler.ts imports CompileResult from core', async () => {
|
|
596
|
+
const { readFileSync } = await import('node:fs');
|
|
597
|
+
const { resolve } = await import('node:path');
|
|
598
|
+
const src = readFileSync(resolve(__dirname, '../../../../openclaw-plugin/src/core/principle-compiler/compiler.ts'), 'utf-8');
|
|
599
|
+
expect(src).toContain("import type { CompileResult } from '@principles/core/runtime-v2'");
|
|
600
|
+
});
|
|
601
|
+
});
|
|
602
|
+
// ── PRI-47: Store layer modularization Phase 3 ──────────────────────────────
|
|
603
|
+
describe('PRI-47 store modularization Phase 3', () => {
|
|
604
|
+
it('store/candidate/index.ts exists and re-exports CandidateStore + SqliteCandidateStore + MemoryCandidateStore', async () => {
|
|
605
|
+
const { existsSync, readFileSync } = await import('node:fs');
|
|
606
|
+
const { resolve } = await import('node:path');
|
|
607
|
+
const indexPath = resolve(__dirname, '..', 'store', 'candidate', 'index.ts');
|
|
608
|
+
expect(existsSync(indexPath)).toBe(true);
|
|
609
|
+
const src = readFileSync(indexPath, 'utf-8');
|
|
610
|
+
expect(src).toContain('CandidateStore');
|
|
611
|
+
expect(src).toContain('SqliteCandidateStore');
|
|
612
|
+
expect(src).toContain('MemoryCandidateStore');
|
|
613
|
+
});
|
|
614
|
+
it('store/artifact/index.ts exists and re-exports ArtifactStore + SqliteArtifactStore + MemoryArtifactStore', async () => {
|
|
615
|
+
const { existsSync, readFileSync } = await import('node:fs');
|
|
616
|
+
const { resolve } = await import('node:path');
|
|
617
|
+
const indexPath = resolve(__dirname, '..', 'store', 'artifact', 'index.ts');
|
|
618
|
+
expect(existsSync(indexPath)).toBe(true);
|
|
619
|
+
const src = readFileSync(indexPath, 'utf-8');
|
|
620
|
+
expect(src).toContain('ArtifactStore');
|
|
621
|
+
expect(src).toContain('SqliteArtifactStore');
|
|
622
|
+
expect(src).toContain('MemoryArtifactStore');
|
|
623
|
+
});
|
|
624
|
+
it('store/commit/index.ts re-exports CommitStore + SqliteCommitStore + MemoryCommitStore', async () => {
|
|
625
|
+
const { readFileSync } = await import('node:fs');
|
|
626
|
+
const { resolve } = await import('node:path');
|
|
627
|
+
const indexPath = resolve(__dirname, '..', 'store', 'commit', 'index.ts');
|
|
628
|
+
const src = readFileSync(indexPath, 'utf-8');
|
|
629
|
+
expect(src).toContain('CommitStore');
|
|
630
|
+
expect(src).toContain('SqliteCommitStore');
|
|
631
|
+
expect(src).toContain('MemoryCommitStore');
|
|
632
|
+
});
|
|
633
|
+
it('store/task/index.ts re-exports MemoryTaskStore', async () => {
|
|
634
|
+
const { readFileSync } = await import('node:fs');
|
|
635
|
+
const { resolve } = await import('node:path');
|
|
636
|
+
const indexPath = resolve(__dirname, '..', 'store', 'task', 'index.ts');
|
|
637
|
+
const src = readFileSync(indexPath, 'utf-8');
|
|
638
|
+
expect(src).toContain('MemoryTaskStore');
|
|
639
|
+
});
|
|
640
|
+
it('store/run/index.ts re-exports MemoryRunStore', async () => {
|
|
641
|
+
const { readFileSync } = await import('node:fs');
|
|
642
|
+
const { resolve } = await import('node:path');
|
|
643
|
+
const indexPath = resolve(__dirname, '..', 'store', 'run', 'index.ts');
|
|
644
|
+
const src = readFileSync(indexPath, 'utf-8');
|
|
645
|
+
expect(src).toContain('MemoryRunStore');
|
|
646
|
+
});
|
|
647
|
+
it('RuntimeStateManager has zero inline SQL (no db.prepare calls)', async () => {
|
|
648
|
+
const { readFileSync } = await import('node:fs');
|
|
649
|
+
const { resolve } = await import('node:path');
|
|
650
|
+
const src = readFileSync(resolve(__dirname, '..', 'store', 'runtime-state-manager.ts'), 'utf-8');
|
|
651
|
+
expect(src).not.toContain('db.prepare');
|
|
652
|
+
});
|
|
653
|
+
it('Memory*Store test double files exist', async () => {
|
|
654
|
+
const { existsSync } = await import('node:fs');
|
|
655
|
+
const { resolve } = await import('node:path');
|
|
656
|
+
const base = resolve(__dirname, '..', 'store');
|
|
657
|
+
expect(existsSync(resolve(base, 'task', 'memory-task-store.ts'))).toBe(true);
|
|
658
|
+
expect(existsSync(resolve(base, 'run', 'memory-run-store.ts'))).toBe(true);
|
|
659
|
+
expect(existsSync(resolve(base, 'commit', 'memory-commit-store.ts'))).toBe(true);
|
|
660
|
+
expect(existsSync(resolve(base, 'candidate', 'memory-candidate-store.ts'))).toBe(true);
|
|
661
|
+
expect(existsSync(resolve(base, 'artifact', 'memory-artifact-store.ts'))).toBe(true);
|
|
662
|
+
});
|
|
663
|
+
it('Phase 3 M5 types NOT defined inline in runtime-state-manager.ts', async () => {
|
|
664
|
+
const { readFileSync } = await import('node:fs');
|
|
665
|
+
const { resolve } = await import('node:path');
|
|
666
|
+
const src = readFileSync(resolve(__dirname, '..', 'store', 'runtime-state-manager.ts'), 'utf-8');
|
|
667
|
+
// CommitRecord, CandidateRecord, ArtifactRecord, ArtifactWithCandidates should be re-exported from submodules
|
|
668
|
+
expect(src).not.toMatch(/^export interface CommitRecord/m);
|
|
669
|
+
expect(src).not.toMatch(/^export interface CandidateRecord/m);
|
|
670
|
+
expect(src).not.toMatch(/^export interface ArtifactRecord/m);
|
|
671
|
+
expect(src).not.toMatch(/^export interface ArtifactWithCandidates/m);
|
|
672
|
+
});
|
|
673
|
+
});
|
|
674
|
+
describe('pd-cli command boundaries', () => {
|
|
675
|
+
it('pain-record.ts does not import createPainSignalBridge or recordPainSignalObservability', async () => {
|
|
676
|
+
const { existsSync, readFileSync } = await import('node:fs');
|
|
677
|
+
const { resolve } = await import('node:path');
|
|
678
|
+
const cmdPath = resolve(__dirname, '../../../../pd-cli/src/commands/pain-record.ts');
|
|
679
|
+
expect(existsSync(cmdPath)).toBe(true);
|
|
680
|
+
const src = readFileSync(cmdPath, 'utf-8');
|
|
681
|
+
expect(src).toContain('PainToPrincipleService');
|
|
682
|
+
expect(src).not.toContain('createPainSignalBridge');
|
|
683
|
+
expect(src).not.toContain('recordPainSignalObservability');
|
|
684
|
+
});
|
|
685
|
+
it('runtime-health-snapshot.ts uses OperatorHealthReadModel (public API)', async () => {
|
|
686
|
+
const { existsSync, readFileSync } = await import('node:fs');
|
|
687
|
+
const { resolve } = await import('node:path');
|
|
688
|
+
const cmdPath = resolve(__dirname, '../../../../pd-cli/src/commands/runtime-health-snapshot.ts');
|
|
689
|
+
expect(existsSync(cmdPath)).toBe(true);
|
|
690
|
+
const src = readFileSync(cmdPath, 'utf-8');
|
|
691
|
+
expect(src).toContain('OperatorHealthReadModel');
|
|
692
|
+
expect(src).not.toContain('auditCandidateLedgerConsistency');
|
|
693
|
+
expect(src).not.toContain('../candidate-audit');
|
|
694
|
+
});
|
|
695
|
+
it('trace.ts does not import RuntimeStateManager or loadLedger', async () => {
|
|
696
|
+
const { existsSync, readFileSync } = await import('node:fs');
|
|
697
|
+
const { resolve } = await import('node:path');
|
|
698
|
+
const cmdPath = resolve(__dirname, '../../../../pd-cli/src/commands/trace.ts');
|
|
699
|
+
expect(existsSync(cmdPath)).toBe(true);
|
|
700
|
+
const src = readFileSync(cmdPath, 'utf-8');
|
|
701
|
+
expect(src).not.toContain('RuntimeStateManager');
|
|
702
|
+
expect(src).not.toContain('loadLedger');
|
|
703
|
+
expect(src).toContain('PainChainReadModel');
|
|
704
|
+
});
|
|
705
|
+
it('health.ts does not import loadLedger', async () => {
|
|
706
|
+
const { existsSync, readFileSync } = await import('node:fs');
|
|
707
|
+
const { resolve } = await import('node:path');
|
|
708
|
+
const cmdPath = resolve(__dirname, '../../../../pd-cli/src/commands/health.ts');
|
|
709
|
+
expect(existsSync(cmdPath)).toBe(true);
|
|
710
|
+
const src = readFileSync(cmdPath, 'utf-8');
|
|
711
|
+
expect(src).not.toContain('loadLedger');
|
|
712
|
+
expect(src).not.toContain('RuntimeStateManager');
|
|
713
|
+
expect(src).toContain('PruningReadModel');
|
|
714
|
+
});
|
|
715
|
+
it('runtime-pruning.ts does not import loadLedger or saveLedger', async () => {
|
|
716
|
+
const { existsSync, readFileSync } = await import('node:fs');
|
|
717
|
+
const { resolve } = await import('node:path');
|
|
718
|
+
const cmdPath = resolve(__dirname, '../../../../pd-cli/src/commands/runtime-pruning.ts');
|
|
719
|
+
expect(existsSync(cmdPath)).toBe(true);
|
|
720
|
+
const src = readFileSync(cmdPath, 'utf-8');
|
|
721
|
+
expect(src).not.toContain('loadLedger');
|
|
722
|
+
expect(src).not.toContain('saveLedger');
|
|
723
|
+
expect(src).not.toContain('RuntimeStateManager');
|
|
724
|
+
expect(src).toContain('removeOrphanReferencesFromLedger');
|
|
725
|
+
});
|
|
726
|
+
it('runtime-internalization-queue.ts does not import RuntimeStateManager', async () => {
|
|
727
|
+
const { existsSync, readFileSync } = await import('node:fs');
|
|
728
|
+
const { resolve } = await import('node:path');
|
|
729
|
+
const cmdPath = resolve(__dirname, '../../../../pd-cli/src/commands/runtime-internalization-queue.ts');
|
|
730
|
+
expect(existsSync(cmdPath)).toBe(true);
|
|
731
|
+
const src = readFileSync(cmdPath, 'utf-8');
|
|
732
|
+
expect(src).not.toContain('RuntimeStateManager');
|
|
733
|
+
expect(src).not.toContain('loadLedger');
|
|
734
|
+
expect(src).toContain('createInternalizationQueueReadModel');
|
|
735
|
+
});
|
|
736
|
+
it('runtime-canary.ts does not import RuntimeStateManager', async () => {
|
|
737
|
+
const { existsSync, readFileSync } = await import('node:fs');
|
|
738
|
+
const { resolve } = await import('node:path');
|
|
739
|
+
const cmdPath = resolve(__dirname, '../../../../pd-cli/src/commands/runtime-canary.ts');
|
|
740
|
+
expect(existsSync(cmdPath)).toBe(true);
|
|
741
|
+
const src = readFileSync(cmdPath, 'utf-8');
|
|
742
|
+
expect(src).not.toContain('RuntimeStateManager');
|
|
743
|
+
expect(src).toContain('createInternalizationQueueReadModel');
|
|
744
|
+
});
|
|
745
|
+
it('runtime-diagnostics-export.ts does not import RuntimeStateManager', async () => {
|
|
746
|
+
const { existsSync, readFileSync } = await import('node:fs');
|
|
747
|
+
const { resolve } = await import('node:path');
|
|
748
|
+
const cmdPath = resolve(__dirname, '../../../../pd-cli/src/commands/runtime-diagnostics-export.ts');
|
|
749
|
+
expect(existsSync(cmdPath)).toBe(true);
|
|
750
|
+
const src = readFileSync(cmdPath, 'utf-8');
|
|
751
|
+
expect(src).not.toContain('RuntimeStateManager');
|
|
752
|
+
expect(src).toContain('createInternalizationQueueReadModel');
|
|
753
|
+
});
|
|
754
|
+
it('runtime-recovery.ts does not import RuntimeStateManager', async () => {
|
|
755
|
+
const { existsSync, readFileSync } = await import('node:fs');
|
|
756
|
+
const { resolve } = await import('node:path');
|
|
757
|
+
const cmdPath = resolve(__dirname, '../../../../pd-cli/src/commands/runtime-recovery.ts');
|
|
758
|
+
expect(existsSync(cmdPath)).toBe(true);
|
|
759
|
+
const src = readFileSync(cmdPath, 'utf-8');
|
|
760
|
+
expect(src).not.toContain('RuntimeStateManager');
|
|
761
|
+
expect(src).toContain('createRecoverySweepService');
|
|
762
|
+
});
|
|
763
|
+
});
|
|
764
|
+
// ── PRI-198: RuntimeStateHandle lifecycle facade ────────────────────────────
|
|
765
|
+
describe('PRI-198 RuntimeStateHandle lifecycle facade', () => {
|
|
766
|
+
it('runtime-state-handle.ts source file exists', async () => {
|
|
767
|
+
const { existsSync } = await import('node:fs');
|
|
768
|
+
const { resolve } = await import('node:path');
|
|
769
|
+
const filePath = resolve(__dirname, '..', 'runtime-state-handle.ts');
|
|
770
|
+
expect(existsSync(filePath)).toBe(true);
|
|
771
|
+
});
|
|
772
|
+
it('internalization-queue-read-model.ts does not import RuntimeStateManager directly', async () => {
|
|
773
|
+
const { readFileSync } = await import('node:fs');
|
|
774
|
+
const { resolve } = await import('node:path');
|
|
775
|
+
const src = readFileSync(resolve(__dirname, '..', 'internalization-queue-read-model.ts'), 'utf-8');
|
|
776
|
+
expect(src).not.toContain("from './store/runtime-state-manager.js'");
|
|
777
|
+
expect(src).toContain("from './runtime-state-handle.js'");
|
|
778
|
+
});
|
|
779
|
+
it('recovery-sweep-service.ts does not import RuntimeStateManager directly', async () => {
|
|
780
|
+
const { readFileSync } = await import('node:fs');
|
|
781
|
+
const { resolve } = await import('node:path');
|
|
782
|
+
const src = readFileSync(resolve(__dirname, '..', 'recovery-sweep-service.ts'), 'utf-8');
|
|
783
|
+
expect(src).not.toContain("from './store/runtime-state-manager.js'");
|
|
784
|
+
expect(src).toContain("from './runtime-state-handle.js'");
|
|
785
|
+
});
|
|
786
|
+
it('barrel exports createRuntimeStateHandle and RuntimeStateHandle', async () => {
|
|
787
|
+
const mod = (await import('../index.js'));
|
|
788
|
+
expect(mod).toHaveProperty('createRuntimeStateHandle');
|
|
789
|
+
});
|
|
790
|
+
});
|
|
791
|
+
// ── PRI-45: RuleHost adapter boundary ────────────────────────────────────────
|
|
792
|
+
describe('PRI-45 RuleHost adapter boundary', () => {
|
|
793
|
+
it('core rule-host-evaluator.ts has zero infrastructure imports', async () => {
|
|
794
|
+
const { readFileSync } = await import('node:fs');
|
|
795
|
+
const { resolve } = await import('node:path');
|
|
796
|
+
const src = readFileSync(resolve(__dirname, '..', 'internalization', 'rule-host-evaluator.ts'), 'utf-8');
|
|
797
|
+
expect(src).not.toContain('node:vm');
|
|
798
|
+
expect(src).not.toContain('node:fs');
|
|
799
|
+
expect(src).not.toContain('openclaw-plugin');
|
|
800
|
+
});
|
|
801
|
+
it('core rule-host-adapter.ts has zero infrastructure imports', async () => {
|
|
802
|
+
const { readFileSync } = await import('node:fs');
|
|
803
|
+
const { resolve } = await import('node:path');
|
|
804
|
+
const src = readFileSync(resolve(__dirname, '..', 'internalization', 'rule-host-adapter.ts'), 'utf-8');
|
|
805
|
+
expect(src).not.toContain('node:vm');
|
|
806
|
+
expect(src).not.toContain('node:fs');
|
|
807
|
+
expect(src).not.toContain('openclaw-plugin');
|
|
808
|
+
});
|
|
809
|
+
it('plugin rule-host.ts imports mergeDecisions from core barrel', async () => {
|
|
810
|
+
const { readFileSync } = await import('node:fs');
|
|
811
|
+
const { resolve } = await import('node:path');
|
|
812
|
+
const src = readFileSync(resolve(__dirname, '../../../../openclaw-plugin/src/core/rule-host.ts'), 'utf-8');
|
|
813
|
+
expect(src).toContain('mergeDecisions');
|
|
814
|
+
expect(src).toContain('@principles/core/runtime-v2');
|
|
815
|
+
});
|
|
816
|
+
it('plugin rule-host.ts evaluate method delegates to mergeDecisions', async () => {
|
|
817
|
+
const { readFileSync } = await import('node:fs');
|
|
818
|
+
const { resolve } = await import('node:path');
|
|
819
|
+
const src = readFileSync(resolve(__dirname, '../../../../openclaw-plugin/src/core/rule-host.ts'), 'utf-8');
|
|
820
|
+
expect(src).toMatch(/return mergeDecisions\(/);
|
|
821
|
+
});
|
|
822
|
+
});
|
|
823
|
+
// ── PRI-47: Store layer modularization Phase 1 ──────────────────────────────
|
|
824
|
+
describe('PRI-47 store modularization', () => {
|
|
825
|
+
it('store/task/index.ts exists and re-exports TaskStore + SqliteTaskStore', async () => {
|
|
826
|
+
const { existsSync, readFileSync } = await import('node:fs');
|
|
827
|
+
const { resolve } = await import('node:path');
|
|
828
|
+
const indexPath = resolve(__dirname, '..', 'store', 'task', 'index.ts');
|
|
829
|
+
expect(existsSync(indexPath)).toBe(true);
|
|
830
|
+
const src = readFileSync(indexPath, 'utf-8');
|
|
831
|
+
expect(src).toContain('TaskStore');
|
|
832
|
+
expect(src).toContain('SqliteTaskStore');
|
|
833
|
+
});
|
|
834
|
+
it('store/run/index.ts exists and re-exports RunStore + SqliteRunStore', async () => {
|
|
835
|
+
const { existsSync, readFileSync } = await import('node:fs');
|
|
836
|
+
const { resolve } = await import('node:path');
|
|
837
|
+
const indexPath = resolve(__dirname, '..', 'store', 'run', 'index.ts');
|
|
838
|
+
expect(existsSync(indexPath)).toBe(true);
|
|
839
|
+
const src = readFileSync(indexPath, 'utf-8');
|
|
840
|
+
expect(src).toContain('RunStore');
|
|
841
|
+
expect(src).toContain('SqliteRunStore');
|
|
842
|
+
});
|
|
843
|
+
it('store/commit/index.ts exists and re-exports DiagnosticianCommitter', async () => {
|
|
844
|
+
const { existsSync, readFileSync } = await import('node:fs');
|
|
845
|
+
const { resolve } = await import('node:path');
|
|
846
|
+
const indexPath = resolve(__dirname, '..', 'store', 'commit', 'index.ts');
|
|
847
|
+
expect(existsSync(indexPath)).toBe(true);
|
|
848
|
+
const src = readFileSync(indexPath, 'utf-8');
|
|
849
|
+
expect(src).toContain('DiagnosticianCommitter');
|
|
850
|
+
expect(src).toContain('CommitInput');
|
|
851
|
+
expect(src).toContain('CommitResult');
|
|
852
|
+
});
|
|
853
|
+
it('Phase 1 moved files are NOT in root store/ directory', async () => {
|
|
854
|
+
const { existsSync } = await import('node:fs');
|
|
855
|
+
const { resolve } = await import('node:path');
|
|
856
|
+
const storeDir = resolve(__dirname, '..', 'store');
|
|
857
|
+
// Phase 1: These files should have been moved to subdirectories
|
|
858
|
+
expect(existsSync(resolve(storeDir, 'task-store.ts'))).toBe(false);
|
|
859
|
+
expect(existsSync(resolve(storeDir, 'sqlite-task-store.ts'))).toBe(false);
|
|
860
|
+
expect(existsSync(resolve(storeDir, 'run-store.ts'))).toBe(false);
|
|
861
|
+
expect(existsSync(resolve(storeDir, 'sqlite-run-store.ts'))).toBe(false);
|
|
862
|
+
expect(existsSync(resolve(storeDir, 'diagnostician-committer.ts'))).toBe(false);
|
|
863
|
+
});
|
|
864
|
+
});
|
|
865
|
+
// ── PRI-47: Store layer modularization Phase 2 ──────────────────────────────
|
|
866
|
+
describe('PRI-47 store modularization Phase 2', () => {
|
|
867
|
+
it('store/context/index.ts exists and re-exports ContextAssembler + implementations', async () => {
|
|
868
|
+
const { existsSync, readFileSync } = await import('node:fs');
|
|
869
|
+
const { resolve } = await import('node:path');
|
|
870
|
+
const indexPath = resolve(__dirname, '..', 'store', 'context', 'index.ts');
|
|
871
|
+
expect(existsSync(indexPath)).toBe(true);
|
|
872
|
+
const src = readFileSync(indexPath, 'utf-8');
|
|
873
|
+
expect(src).toContain('ContextAssembler');
|
|
874
|
+
expect(src).toContain('SqliteContextAssembler');
|
|
875
|
+
expect(src).toContain('ResilientContextAssembler');
|
|
876
|
+
});
|
|
877
|
+
it('store/history/index.ts exists and re-exports HistoryQuery + implementations', async () => {
|
|
878
|
+
const { existsSync, readFileSync } = await import('node:fs');
|
|
879
|
+
const { resolve } = await import('node:path');
|
|
880
|
+
const indexPath = resolve(__dirname, '..', 'store', 'history', 'index.ts');
|
|
881
|
+
expect(existsSync(indexPath)).toBe(true);
|
|
882
|
+
const src = readFileSync(indexPath, 'utf-8');
|
|
883
|
+
expect(src).toContain('HistoryQuery');
|
|
884
|
+
expect(src).toContain('SqliteHistoryQuery');
|
|
885
|
+
expect(src).toContain('ResilientHistoryQuery');
|
|
886
|
+
});
|
|
887
|
+
it('store/trajectory/index.ts exists and re-exports TrajectoryLocator + implementation', async () => {
|
|
888
|
+
const { existsSync, readFileSync } = await import('node:fs');
|
|
889
|
+
const { resolve } = await import('node:path');
|
|
890
|
+
const indexPath = resolve(__dirname, '..', 'store', 'trajectory', 'index.ts');
|
|
891
|
+
expect(existsSync(indexPath)).toBe(true);
|
|
892
|
+
const src = readFileSync(indexPath, 'utf-8');
|
|
893
|
+
expect(src).toContain('TrajectoryLocator');
|
|
894
|
+
expect(src).toContain('SqliteTrajectoryLocator');
|
|
895
|
+
});
|
|
896
|
+
it('store/lifecycle/index.ts exists and re-exports lease/retry/recovery', async () => {
|
|
897
|
+
const { existsSync, readFileSync } = await import('node:fs');
|
|
898
|
+
const { resolve } = await import('node:path');
|
|
899
|
+
const indexPath = resolve(__dirname, '..', 'store', 'lifecycle', 'index.ts');
|
|
900
|
+
expect(existsSync(indexPath)).toBe(true);
|
|
901
|
+
const src = readFileSync(indexPath, 'utf-8');
|
|
902
|
+
expect(src).toContain('LeaseManager');
|
|
903
|
+
expect(src).toContain('DefaultLeaseManager');
|
|
904
|
+
expect(src).toContain('DefaultRetryPolicy');
|
|
905
|
+
expect(src).toContain('DefaultRecoverySweep');
|
|
906
|
+
});
|
|
907
|
+
it('Phase 2 moved files are NOT in root store/ directory', async () => {
|
|
908
|
+
const { existsSync } = await import('node:fs');
|
|
909
|
+
const { resolve } = await import('node:path');
|
|
910
|
+
const storeDir = resolve(__dirname, '..', 'store');
|
|
911
|
+
// Phase 2: context
|
|
912
|
+
expect(existsSync(resolve(storeDir, 'context-assembler.ts'))).toBe(false);
|
|
913
|
+
expect(existsSync(resolve(storeDir, 'sqlite-context-assembler.ts'))).toBe(false);
|
|
914
|
+
expect(existsSync(resolve(storeDir, 'resilient-context-assembler.ts'))).toBe(false);
|
|
915
|
+
// Phase 2: history
|
|
916
|
+
expect(existsSync(resolve(storeDir, 'history-query.ts'))).toBe(false);
|
|
917
|
+
expect(existsSync(resolve(storeDir, 'sqlite-history-query.ts'))).toBe(false);
|
|
918
|
+
expect(existsSync(resolve(storeDir, 'resilient-history-query.ts'))).toBe(false);
|
|
919
|
+
// Phase 2: trajectory
|
|
920
|
+
expect(existsSync(resolve(storeDir, 'trajectory-locator.ts'))).toBe(false);
|
|
921
|
+
expect(existsSync(resolve(storeDir, 'sqlite-trajectory-locator.ts'))).toBe(false);
|
|
922
|
+
// Phase 2: lifecycle
|
|
923
|
+
expect(existsSync(resolve(storeDir, 'lease-manager.ts'))).toBe(false);
|
|
924
|
+
expect(existsSync(resolve(storeDir, 'retry-policy.ts'))).toBe(false);
|
|
925
|
+
expect(existsSync(resolve(storeDir, 'recovery-sweep.ts'))).toBe(false);
|
|
926
|
+
});
|
|
927
|
+
it('barrel still exports all store symbols', async () => {
|
|
928
|
+
const mod = (await import('../index.js'));
|
|
929
|
+
const storeSymbols = [
|
|
930
|
+
'SqliteTaskStore', 'SqliteRunStore', 'SqliteConnection',
|
|
931
|
+
'SqliteTrajectoryLocator', 'SqliteHistoryQuery', 'SqliteContextAssembler',
|
|
932
|
+
'SqliteDiagnosticianCommitter',
|
|
933
|
+
'ResilientContextAssembler', 'ResilientHistoryQuery',
|
|
934
|
+
'DefaultLeaseManager', 'DefaultRetryPolicy', 'DefaultRecoverySweep',
|
|
935
|
+
'StoreEventEmitter', 'storeEmitter',
|
|
936
|
+
'RuntimeStateManager', 'EvolutionQueueItemMigrator',
|
|
937
|
+
'DEFAULT_HISTORY_PAGE_SIZE', 'MAX_HISTORY_PAGE_SIZE', 'DEFAULT_TIME_WINDOW_MS',
|
|
938
|
+
];
|
|
939
|
+
for (const sym of storeSymbols) {
|
|
940
|
+
expect(mod).toHaveProperty(sym);
|
|
941
|
+
}
|
|
942
|
+
});
|
|
943
|
+
it('barrel exports Memory*Store test doubles', async () => {
|
|
944
|
+
const mod = (await import('../index.js'));
|
|
945
|
+
const memoryStores = [
|
|
946
|
+
'MemoryTaskStore', 'MemoryRunStore', 'MemoryCommitStore',
|
|
947
|
+
'MemoryCandidateStore', 'MemoryArtifactStore',
|
|
948
|
+
];
|
|
949
|
+
for (const sym of memoryStores) {
|
|
950
|
+
expect(mod).toHaveProperty(sym);
|
|
951
|
+
}
|
|
952
|
+
});
|
|
953
|
+
});
|
|
954
|
+
// ── PRI-51: Lifecycle type extraction ────────────────────────────────────────
|
|
955
|
+
describe('PRI-51 lifecycle type extraction', () => {
|
|
956
|
+
const LIFECYCLE_TYPES = [
|
|
957
|
+
'LifecycleClassificationTotals',
|
|
958
|
+
'RuleReplayEvidence',
|
|
959
|
+
'RuleLiveEvidence',
|
|
960
|
+
'RuleLineageEvidence',
|
|
961
|
+
'ImplementationLifecycleEvidence',
|
|
962
|
+
'RuleLifecycleEvidence',
|
|
963
|
+
'PrincipleLifecycleEvidence',
|
|
964
|
+
'LifecycleReadModel',
|
|
965
|
+
];
|
|
966
|
+
const ENUM_TYPES = [
|
|
967
|
+
'PrinciplePriority',
|
|
968
|
+
'PrincipleEvaluability',
|
|
969
|
+
'RuleType',
|
|
970
|
+
'RuleStatus',
|
|
971
|
+
'ImplementationLifecycleState',
|
|
972
|
+
'ImplementationType',
|
|
973
|
+
'SampleClassification',
|
|
974
|
+
];
|
|
975
|
+
it('core exports all lifecycle types from barrel', async () => {
|
|
976
|
+
const { readFileSync } = await import('node:fs');
|
|
977
|
+
const { resolve } = await import('node:path');
|
|
978
|
+
const src = readFileSync(resolve(__dirname, '..', 'index.ts'), 'utf-8');
|
|
979
|
+
for (const name of LIFECYCLE_TYPES) {
|
|
980
|
+
expect(src).toContain(name);
|
|
981
|
+
}
|
|
982
|
+
});
|
|
983
|
+
it('core exports all enum types from barrel', async () => {
|
|
984
|
+
const { readFileSync } = await import('node:fs');
|
|
985
|
+
const { resolve } = await import('node:path');
|
|
986
|
+
const src = readFileSync(resolve(__dirname, '..', 'index.ts'), 'utf-8');
|
|
987
|
+
for (const name of ENUM_TYPES) {
|
|
988
|
+
expect(src).toContain(name);
|
|
989
|
+
}
|
|
990
|
+
});
|
|
991
|
+
it('lifecycle-types.ts has zero infrastructure imports', async () => {
|
|
992
|
+
const { readFileSync } = await import('node:fs');
|
|
993
|
+
const { resolve } = await import('node:path');
|
|
994
|
+
const src = readFileSync(resolve(__dirname, '..', 'internalization', 'lifecycle-types.ts'), 'utf-8');
|
|
995
|
+
expect(src).not.toContain('node:fs');
|
|
996
|
+
expect(src).not.toContain('node:path');
|
|
997
|
+
expect(src).not.toContain('openclaw-plugin');
|
|
998
|
+
});
|
|
999
|
+
it('plugin lifecycle-read-model.ts re-exports types from core', async () => {
|
|
1000
|
+
const { readFileSync } = await import('node:fs');
|
|
1001
|
+
const { resolve } = await import('node:path');
|
|
1002
|
+
const src = readFileSync(resolve(__dirname, '../../../../openclaw-plugin/src/core/principle-internalization/lifecycle-read-model.ts'), 'utf-8');
|
|
1003
|
+
expect(src).toContain('@principles/core/runtime-v2');
|
|
1004
|
+
expect(src).toContain('buildLifecycleReadModel');
|
|
1005
|
+
});
|
|
1006
|
+
it('plugin principle-tree-schema.ts re-exports enums from core', async () => {
|
|
1007
|
+
const { readFileSync } = await import('node:fs');
|
|
1008
|
+
const { resolve } = await import('node:path');
|
|
1009
|
+
const src = readFileSync(resolve(__dirname, '../../../../openclaw-plugin/src/types/principle-tree-schema.ts'), 'utf-8');
|
|
1010
|
+
expect(src).toContain("from '@principles/core/runtime-v2'");
|
|
1011
|
+
// Should no longer define these locally
|
|
1012
|
+
expect(src).not.toMatch(/^export type PrinciplePriority = /m);
|
|
1013
|
+
expect(src).not.toMatch(/^export type RuleType = /m);
|
|
1014
|
+
});
|
|
1015
|
+
it('plugin principle-tree-schema.ts re-exports Rule and Implementation from core (no local re-definition)', async () => {
|
|
1016
|
+
const { readFileSync } = await import('node:fs');
|
|
1017
|
+
const { resolve } = await import('node:path');
|
|
1018
|
+
const src = readFileSync(resolve(__dirname, '../../../../openclaw-plugin/src/types/principle-tree-schema.ts'), 'utf-8');
|
|
1019
|
+
expect(src).toContain("Rule");
|
|
1020
|
+
expect(src).toContain("Implementation");
|
|
1021
|
+
expect(src).not.toMatch(/^export interface Rule \{/m);
|
|
1022
|
+
expect(src).not.toMatch(/^export interface Implementation \{/m);
|
|
1023
|
+
});
|
|
1024
|
+
});
|
|
1025
|
+
// ── PRI-52: Lifecycle metrics extraction ──────────────────────────────────────
|
|
1026
|
+
describe('PRI-52 lifecycle metrics', () => {
|
|
1027
|
+
it('core exports all lifecycle metrics from barrel', async () => {
|
|
1028
|
+
const { readFileSync } = await import('node:fs');
|
|
1029
|
+
const { resolve } = await import('node:path');
|
|
1030
|
+
const src = readFileSync(resolve(__dirname, '..', 'index.ts'), 'utf-8');
|
|
1031
|
+
expect(src).toContain('RuleMetricResult');
|
|
1032
|
+
expect(src).toContain('PrincipleAdherenceResult');
|
|
1033
|
+
expect(src).toContain('computeRuleMetrics');
|
|
1034
|
+
expect(src).toContain('computePrincipleAdherence');
|
|
1035
|
+
});
|
|
1036
|
+
it('lifecycle-metrics.ts has zero infrastructure imports', async () => {
|
|
1037
|
+
const { readFileSync } = await import('node:fs');
|
|
1038
|
+
const { resolve } = await import('node:path');
|
|
1039
|
+
const src = readFileSync(resolve(__dirname, '..', 'internalization', 'lifecycle-metrics.ts'), 'utf-8');
|
|
1040
|
+
expect(src).not.toContain('node:fs');
|
|
1041
|
+
expect(src).not.toContain('node:path');
|
|
1042
|
+
expect(src).not.toContain('openclaw-plugin');
|
|
1043
|
+
});
|
|
1044
|
+
it('plugin principle-lifecycle-service.ts imports lifecycle metrics from core barrel', async () => {
|
|
1045
|
+
const { readFileSync } = await import('node:fs');
|
|
1046
|
+
const { resolve } = await import('node:path');
|
|
1047
|
+
const src = readFileSync(resolve(__dirname, '../../../../openclaw-plugin/src/core/principle-internalization/principle-lifecycle-service.ts'), 'utf-8');
|
|
1048
|
+
expect(src).toContain("from '@principles/core/runtime-v2'");
|
|
1049
|
+
expect(src).toContain('computeRuleMetrics');
|
|
1050
|
+
expect(src).toContain('computePrincipleAdherence');
|
|
1051
|
+
});
|
|
1052
|
+
});
|
|
1053
|
+
// ── PRI-53: Deprecated readiness extraction ──────────────────────────────────
|
|
1054
|
+
describe('PRI-53 deprecated readiness', () => {
|
|
1055
|
+
it('core exports all readiness types/functions from barrel', async () => {
|
|
1056
|
+
const { readFileSync } = await import('node:fs');
|
|
1057
|
+
const { resolve } = await import('node:path');
|
|
1058
|
+
const src = readFileSync(resolve(__dirname, '..', 'index.ts'), 'utf-8');
|
|
1059
|
+
expect(src).toContain('DeprecatedReadinessStatus');
|
|
1060
|
+
expect(src).toContain('DeprecatedReadinessAssessment');
|
|
1061
|
+
expect(src).toContain('assessDeprecatedReadiness');
|
|
1062
|
+
});
|
|
1063
|
+
it('deprecated-readiness.ts has zero infrastructure imports', async () => {
|
|
1064
|
+
const { readFileSync } = await import('node:fs');
|
|
1065
|
+
const { resolve } = await import('node:path');
|
|
1066
|
+
const src = readFileSync(resolve(__dirname, '..', 'internalization', 'deprecated-readiness.ts'), 'utf-8');
|
|
1067
|
+
expect(src).not.toContain('node:fs');
|
|
1068
|
+
expect(src).not.toContain('node:path');
|
|
1069
|
+
expect(src).not.toContain('openclaw-plugin');
|
|
1070
|
+
});
|
|
1071
|
+
it('plugin principle-lifecycle-service.ts imports deprecated readiness from core barrel', async () => {
|
|
1072
|
+
const { readFileSync } = await import('node:fs');
|
|
1073
|
+
const { resolve } = await import('node:path');
|
|
1074
|
+
const src = readFileSync(resolve(__dirname, '../../../../openclaw-plugin/src/core/principle-internalization/principle-lifecycle-service.ts'), 'utf-8');
|
|
1075
|
+
expect(src).toContain("from '@principles/core/runtime-v2'");
|
|
1076
|
+
expect(src).toContain('assessDeprecatedReadiness');
|
|
1077
|
+
expect(src).toContain('DeprecatedReadinessAssessment');
|
|
1078
|
+
});
|
|
1079
|
+
});
|
|
1080
|
+
// ── PRI-54: Routing policy extraction ──────────────────────────────────────────
|
|
1081
|
+
describe('PRI-54 routing policy', () => {
|
|
1082
|
+
it('core exports all routing policy types/functions from barrel', async () => {
|
|
1083
|
+
const { readFileSync } = await import('node:fs');
|
|
1084
|
+
const { resolve } = await import('node:path');
|
|
1085
|
+
const src = readFileSync(resolve(__dirname, '..', 'index.ts'), 'utf-8');
|
|
1086
|
+
expect(src).toContain('LifecycleRoute');
|
|
1087
|
+
expect(src).toContain('LifecycleRouteRecommendation');
|
|
1088
|
+
expect(src).toContain('LifecycleRouteEvidenceSummary');
|
|
1089
|
+
expect(src).toContain('recommendLifecycleRoute');
|
|
1090
|
+
});
|
|
1091
|
+
it('routing-policy.ts has zero infrastructure imports', async () => {
|
|
1092
|
+
const { readFileSync } = await import('node:fs');
|
|
1093
|
+
const { resolve } = await import('node:path');
|
|
1094
|
+
const src = readFileSync(resolve(__dirname, '..', 'internalization', 'routing-policy.ts'), 'utf-8');
|
|
1095
|
+
expect(src).not.toContain('node:fs');
|
|
1096
|
+
expect(src).not.toContain('node:path');
|
|
1097
|
+
expect(src).not.toContain('openclaw-plugin');
|
|
1098
|
+
});
|
|
1099
|
+
it('plugin principle-lifecycle-service.ts imports routing policy from core barrel', async () => {
|
|
1100
|
+
const { readFileSync } = await import('node:fs');
|
|
1101
|
+
const { resolve } = await import('node:path');
|
|
1102
|
+
const src = readFileSync(resolve(__dirname, '../../../../openclaw-plugin/src/core/principle-internalization/principle-lifecycle-service.ts'), 'utf-8');
|
|
1103
|
+
expect(src).toContain("from '@principles/core/runtime-v2'");
|
|
1104
|
+
expect(src).toContain('recommendLifecycleRoute');
|
|
1105
|
+
expect(src).toContain('LifecycleRouteRecommendation');
|
|
1106
|
+
});
|
|
1107
|
+
});
|
|
1108
|
+
// ── PRI-56: LifecycleDatasource adapter boundary ──────────────────────────────
|
|
1109
|
+
describe('PRI-56 LifecycleDatasource adapter boundary', () => {
|
|
1110
|
+
it('core exports LifecycleDatasource + buildLifecycleReadModel from barrel', async () => {
|
|
1111
|
+
const { readFileSync } = await import('node:fs');
|
|
1112
|
+
const { resolve } = await import('node:path');
|
|
1113
|
+
const src = readFileSync(resolve(__dirname, '..', 'index.ts'), 'utf-8');
|
|
1114
|
+
expect(src).toContain('LifecycleDatasource');
|
|
1115
|
+
expect(src).toContain('buildLifecycleReadModel');
|
|
1116
|
+
});
|
|
1117
|
+
it('lifecycle-datasource.ts has zero infrastructure imports', async () => {
|
|
1118
|
+
const { readFileSync } = await import('node:fs');
|
|
1119
|
+
const { resolve } = await import('node:path');
|
|
1120
|
+
const src = readFileSync(resolve(__dirname, '..', 'internalization', 'lifecycle-datasource.ts'), 'utf-8');
|
|
1121
|
+
expect(src).not.toContain('node:fs');
|
|
1122
|
+
expect(src).not.toContain('node:path');
|
|
1123
|
+
expect(src).not.toContain('openclaw-plugin');
|
|
1124
|
+
});
|
|
1125
|
+
it('lifecycle-read-model.ts has zero infrastructure imports', async () => {
|
|
1126
|
+
const { readFileSync } = await import('node:fs');
|
|
1127
|
+
const { resolve } = await import('node:path');
|
|
1128
|
+
const src = readFileSync(resolve(__dirname, '..', 'internalization', 'lifecycle-read-model.ts'), 'utf-8');
|
|
1129
|
+
expect(src).not.toContain('node:fs');
|
|
1130
|
+
expect(src).not.toContain('node:path');
|
|
1131
|
+
expect(src).not.toContain('openclaw-plugin');
|
|
1132
|
+
});
|
|
1133
|
+
it('plugin lifecycle-read-model.ts re-exports from core and provides FilesystemLifecycleDatasource', async () => {
|
|
1134
|
+
const { readFileSync } = await import('node:fs');
|
|
1135
|
+
const { resolve } = await import('node:path');
|
|
1136
|
+
const src = readFileSync(resolve(__dirname, '../../../../openclaw-plugin/src/core/principle-internalization/lifecycle-read-model.ts'), 'utf-8');
|
|
1137
|
+
expect(src).toContain("from '@principles/core/runtime-v2'");
|
|
1138
|
+
expect(src).toContain('buildLifecycleReadModel');
|
|
1139
|
+
expect(src).toContain('FilesystemLifecycleDatasource');
|
|
1140
|
+
});
|
|
1141
|
+
it('plugin principle-lifecycle-service.ts delegates buildReadModel via datasource', async () => {
|
|
1142
|
+
const { readFileSync } = await import('node:fs');
|
|
1143
|
+
const { resolve } = await import('node:path');
|
|
1144
|
+
const src = readFileSync(resolve(__dirname, '../../../../openclaw-plugin/src/core/principle-internalization/principle-lifecycle-service.ts'), 'utf-8');
|
|
1145
|
+
expect(src).toContain('FilesystemLifecycleDatasource');
|
|
1146
|
+
expect(src).toContain('buildLifecycleReadModel');
|
|
1147
|
+
});
|
|
1148
|
+
});
|
|
1149
|
+
// ── PRI-61: Internalization Peer Runner Contracts ─────────────────────────────
|
|
1150
|
+
describe('PRI-61 Internalization Peer Runner Contracts', () => {
|
|
1151
|
+
it('core barrel exports PITaskRecord and related types', async () => {
|
|
1152
|
+
const { readFileSync } = await import('node:fs');
|
|
1153
|
+
const { resolve } = await import('node:path');
|
|
1154
|
+
const src = readFileSync(resolve(__dirname, '..', 'index.ts'), 'utf-8');
|
|
1155
|
+
expect(src).toContain('PITaskRecord');
|
|
1156
|
+
expect(src).toContain('PeerRunnerKind');
|
|
1157
|
+
expect(src).toContain('InternalizationChannel');
|
|
1158
|
+
expect(src).toContain('PIArtifact');
|
|
1159
|
+
});
|
|
1160
|
+
it('core barrel exports job graph functions', async () => {
|
|
1161
|
+
const { readFileSync } = await import('node:fs');
|
|
1162
|
+
const { resolve } = await import('node:path');
|
|
1163
|
+
const src = readFileSync(resolve(__dirname, '..', 'index.ts'), 'utf-8');
|
|
1164
|
+
expect(src).toContain('validateEdge');
|
|
1165
|
+
expect(src).toContain('isAcyclic');
|
|
1166
|
+
expect(src).toContain('getAllowedSuccessors');
|
|
1167
|
+
expect(src).toContain('ALLOWED_EDGES');
|
|
1168
|
+
});
|
|
1169
|
+
it('peer-runner-contracts.ts has zero infrastructure imports', async () => {
|
|
1170
|
+
const { readFileSync } = await import('node:fs');
|
|
1171
|
+
const { resolve } = await import('node:path');
|
|
1172
|
+
const src = readFileSync(resolve(__dirname, '..', 'internalization', 'peer-runner-contracts.ts'), 'utf-8');
|
|
1173
|
+
expect(src).not.toContain('node:fs');
|
|
1174
|
+
expect(src).not.toContain('node:path');
|
|
1175
|
+
expect(src).not.toContain('openclaw-plugin');
|
|
1176
|
+
expect(src).not.toContain('node:cron');
|
|
1177
|
+
});
|
|
1178
|
+
it('internalization-job-graph.ts has zero infrastructure imports', async () => {
|
|
1179
|
+
const { readFileSync } = await import('node:fs');
|
|
1180
|
+
const { resolve } = await import('node:path');
|
|
1181
|
+
const src = readFileSync(resolve(__dirname, '..', 'internalization', 'internalization-job-graph.ts'), 'utf-8');
|
|
1182
|
+
expect(src).not.toContain('node:fs');
|
|
1183
|
+
expect(src).not.toContain('node:path');
|
|
1184
|
+
expect(src).not.toContain('openclaw-plugin');
|
|
1185
|
+
expect(src).not.toContain('node:cron');
|
|
1186
|
+
});
|
|
1187
|
+
it('TASK_MODEL_REUSE: PITaskRecord extends TaskRecord (type-level check)', async () => {
|
|
1188
|
+
// PITaskRecord is an interface (type-only export). Type-level check:
|
|
1189
|
+
// if PITaskRecord didn't extend TaskRecord, TypeScript would error in the
|
|
1190
|
+
// peer-runner-contracts.ts definition at compile time.
|
|
1191
|
+
// We verify the module exports the type by checking the source file.
|
|
1192
|
+
const { readFileSync } = await import('node:fs');
|
|
1193
|
+
const { resolve } = await import('node:path');
|
|
1194
|
+
const src = readFileSync(resolve(__dirname, '..', 'internalization', 'peer-runner-contracts.ts'), 'utf-8');
|
|
1195
|
+
// If PITaskRecord doesn't extend TaskRecord, this interface definition would fail
|
|
1196
|
+
expect(src).toContain('interface PITaskRecord extends TaskRecord');
|
|
1197
|
+
});
|
|
1198
|
+
it('PEER_NO_DIRECT_CHAINING: job graph defines edge validation only, no execution', async () => {
|
|
1199
|
+
const { validateEdge, ALLOWED_EDGES } = await import('../internalization/internalization-job-graph.js');
|
|
1200
|
+
// validateEdge is a pure function — no side effects, no execution
|
|
1201
|
+
expect(typeof validateEdge).toBe('function');
|
|
1202
|
+
expect(Array.isArray(ALLOWED_EDGES)).toBe(true);
|
|
1203
|
+
// Edge validation is read-only — no task creation or state mutation
|
|
1204
|
+
const result = validateEdge('dreamer', 'philosopher');
|
|
1205
|
+
expect(typeof result).toBe('boolean');
|
|
1206
|
+
});
|
|
1207
|
+
});
|
|
1208
|
+
// ── PRI-62: Internalization State Machine Guards ─────────────────────────────
|
|
1209
|
+
describe('PRI-62 Internalization State Machine Guards', () => {
|
|
1210
|
+
it('core barrel exports state machine guard functions', async () => {
|
|
1211
|
+
const { readFileSync } = await import('node:fs');
|
|
1212
|
+
const { resolve } = await import('node:path');
|
|
1213
|
+
const src = readFileSync(resolve(__dirname, '..', 'index.ts'), 'utf-8');
|
|
1214
|
+
expect(src).toContain('validateInternalizationTaskReady');
|
|
1215
|
+
expect(src).toContain('validateTaskTransition');
|
|
1216
|
+
expect(src).toContain('decideArtifactRejectionFeedback');
|
|
1217
|
+
expect(src).toContain('createNextTaskProposal');
|
|
1218
|
+
expect(src).toContain('validateInternalizationGraph');
|
|
1219
|
+
});
|
|
1220
|
+
it('core barrel exports guard utility functions', async () => {
|
|
1221
|
+
const { readFileSync } = await import('node:fs');
|
|
1222
|
+
const { resolve } = await import('node:path');
|
|
1223
|
+
const src = readFileSync(resolve(__dirname, '..', 'index.ts'), 'utf-8');
|
|
1224
|
+
expect(src).toContain('canAcquireLease');
|
|
1225
|
+
expect(src).toContain('areDependenciesMet');
|
|
1226
|
+
expect(src).toContain('canTransitionTo');
|
|
1227
|
+
expect(src).toContain('isResultRefImmutable');
|
|
1228
|
+
expect(src).toContain('canUpdateLastError');
|
|
1229
|
+
expect(src).toContain('isArtifactRejected');
|
|
1230
|
+
});
|
|
1231
|
+
it('internalization-task-guards.ts has zero infrastructure imports', async () => {
|
|
1232
|
+
const { readFileSync } = await import('node:fs');
|
|
1233
|
+
const { resolve } = await import('node:path');
|
|
1234
|
+
const src = readFileSync(resolve(__dirname, '..', 'internalization', 'internalization-task-guards.ts'), 'utf-8');
|
|
1235
|
+
expect(src).not.toContain('node:fs');
|
|
1236
|
+
expect(src).not.toContain('node:path');
|
|
1237
|
+
expect(src).not.toContain('openclaw-plugin');
|
|
1238
|
+
expect(src).not.toContain('node:cron');
|
|
1239
|
+
});
|
|
1240
|
+
it('internalization-state-machine.ts has zero infrastructure imports', async () => {
|
|
1241
|
+
const { readFileSync } = await import('node:fs');
|
|
1242
|
+
const { resolve } = await import('node:path');
|
|
1243
|
+
const src = readFileSync(resolve(__dirname, '..', 'internalization', 'internalization-state-machine.ts'), 'utf-8');
|
|
1244
|
+
expect(src).not.toContain('node:fs');
|
|
1245
|
+
expect(src).not.toContain('node:path');
|
|
1246
|
+
expect(src).not.toContain('openclaw-plugin');
|
|
1247
|
+
expect(src).not.toContain('node:cron');
|
|
1248
|
+
});
|
|
1249
|
+
it('TASK_MODEL_REUSE: guard functions work with PITaskRecord (type-level check)', async () => {
|
|
1250
|
+
// If PITaskRecord didn't properly extend TaskRecord, TypeScript would error
|
|
1251
|
+
// at compile time in peer-runner-contracts.ts and internalization-task-guards.ts
|
|
1252
|
+
const { readFileSync } = await import('node:fs');
|
|
1253
|
+
const { resolve } = await import('node:path');
|
|
1254
|
+
const src = readFileSync(resolve(__dirname, '..', 'internalization', 'internalization-task-guards.ts'), 'utf-8');
|
|
1255
|
+
expect(src).toContain('task: PITaskRecord');
|
|
1256
|
+
});
|
|
1257
|
+
it('PEER_NO_DIRECT_CHAINING: state machine returns proposals, not execute calls', async () => {
|
|
1258
|
+
const { createNextTaskProposal } = await import('../internalization/internalization-state-machine.js');
|
|
1259
|
+
// Pure function — returns an object, no side effects
|
|
1260
|
+
const { createMinimalPITaskRecord } = await import('../internalization/peer-runner-contracts.js');
|
|
1261
|
+
const task = createMinimalPITaskRecord('t1', 'dreamer', 'prompt');
|
|
1262
|
+
task.status = 'succeeded';
|
|
1263
|
+
task.outputArtifactRefs = [];
|
|
1264
|
+
const result = createNextTaskProposal(task, []);
|
|
1265
|
+
expect(result === null || typeof result === 'object').toBe(true);
|
|
1266
|
+
});
|
|
1267
|
+
});
|
|
1268
|
+
// ── PRI-63: Internalization Dumb Trigger Adapter ─────────────────────────────
|
|
1269
|
+
describe('PRI-63 Internalization Dumb Trigger Adapter', () => {
|
|
1270
|
+
const PRI63_REQUIRED_FILES = [
|
|
1271
|
+
'internalization-trigger-adapter.ts',
|
|
1272
|
+
];
|
|
1273
|
+
it('adapter source file exists in plugin service directory', async () => {
|
|
1274
|
+
const { existsSync } = await import('node:fs');
|
|
1275
|
+
const { resolve } = await import('node:path');
|
|
1276
|
+
const pluginRoot = resolve(__dirname, '..', '..', '..', '..', 'openclaw-plugin', 'src', 'service');
|
|
1277
|
+
for (const file of PRI63_REQUIRED_FILES) {
|
|
1278
|
+
expect(existsSync(resolve(pluginRoot, file))).toBe(true);
|
|
1279
|
+
}
|
|
1280
|
+
});
|
|
1281
|
+
it('adapter does not import nocturnal-trinity', async () => {
|
|
1282
|
+
const { readFileSync } = await import('node:fs');
|
|
1283
|
+
const { resolve } = await import('node:path');
|
|
1284
|
+
const src = readFileSync(resolve(__dirname, '..', '..', '..', '..', 'openclaw-plugin', 'src', 'service', 'internalization-trigger-adapter.ts'), 'utf-8');
|
|
1285
|
+
expect(src).not.toContain('nocturnal-trinity');
|
|
1286
|
+
});
|
|
1287
|
+
it('adapter does not import runTrinity or runTrinityAsync', async () => {
|
|
1288
|
+
const { readFileSync } = await import('node:fs');
|
|
1289
|
+
const { resolve } = await import('node:path');
|
|
1290
|
+
const src = readFileSync(resolve(__dirname, '..', '..', '..', '..', 'openclaw-plugin', 'src', 'service', 'internalization-trigger-adapter.ts'), 'utf-8');
|
|
1291
|
+
expect(src).not.toContain('runTrinity');
|
|
1292
|
+
expect(src).not.toContain('runTrinityAsync');
|
|
1293
|
+
});
|
|
1294
|
+
it('adapter does not import Dreamer/Philosopher/Scribe executors', async () => {
|
|
1295
|
+
const { readFileSync } = await import('node:fs');
|
|
1296
|
+
const { resolve } = await import('node:path');
|
|
1297
|
+
const src = readFileSync(resolve(__dirname, '..', '..', '..', '..', 'openclaw-plugin', 'src', 'service', 'internalization-trigger-adapter.ts'), 'utf-8');
|
|
1298
|
+
expect(src).not.toContain("from 'dreamer'");
|
|
1299
|
+
expect(src).not.toContain("from 'philosopher'");
|
|
1300
|
+
expect(src).not.toContain("from 'scribe'");
|
|
1301
|
+
});
|
|
1302
|
+
it('adapter does not use PDRuntimeAdapter', async () => {
|
|
1303
|
+
const { readFileSync } = await import('node:fs');
|
|
1304
|
+
const { resolve } = await import('node:path');
|
|
1305
|
+
const src = readFileSync(resolve(__dirname, '..', '..', '..', '..', 'openclaw-plugin', 'src', 'service', 'internalization-trigger-adapter.ts'), 'utf-8');
|
|
1306
|
+
expect(src).not.toContain('PDRuntimeAdapter');
|
|
1307
|
+
});
|
|
1308
|
+
it('adapter imports TaskRecord from @principles/core/runtime-v2', async () => {
|
|
1309
|
+
const { readFileSync } = await import('node:fs');
|
|
1310
|
+
const { resolve } = await import('node:path');
|
|
1311
|
+
const src = readFileSync(resolve(__dirname, '..', '..', '..', '..', 'openclaw-plugin', 'src', 'service', 'internalization-trigger-adapter.ts'), 'utf-8');
|
|
1312
|
+
expect(src).toContain('TaskRecord');
|
|
1313
|
+
expect(src).toContain('@principles/core/runtime-v2');
|
|
1314
|
+
});
|
|
1315
|
+
it('PLUGIN_NO_INLINE_EXECUTION: adapter does not call mutating store methods (read-only probe)', async () => {
|
|
1316
|
+
const { readFileSync } = await import('node:fs');
|
|
1317
|
+
const { resolve } = await import('node:path');
|
|
1318
|
+
const src = readFileSync(resolve(__dirname, '..', '..', '..', '..', 'openclaw-plugin', 'src', 'service', 'internalization-trigger-adapter.ts'), 'utf-8');
|
|
1319
|
+
// wake() should only read, not update/create/delete tasks
|
|
1320
|
+
expect(src).not.toContain('updateTask');
|
|
1321
|
+
expect(src).not.toContain('createTask');
|
|
1322
|
+
expect(src).not.toContain('deleteTask');
|
|
1323
|
+
expect(src).not.toContain('leaseTask');
|
|
1324
|
+
});
|
|
1325
|
+
it('PLUGIN_NO_INLINE_EXECUTION: adapter does not use setInterval/setTimeout for scheduling (core responsibility)', async () => {
|
|
1326
|
+
const { readFileSync } = await import('node:fs');
|
|
1327
|
+
const { resolve } = await import('node:path');
|
|
1328
|
+
const src = readFileSync(resolve(__dirname, '..', '..', '..', '..', 'openclaw-plugin', 'src', 'service', 'internalization-trigger-adapter.ts'), 'utf-8');
|
|
1329
|
+
// setInterval is used in start() to trigger wake() periodically — this is plugin responsibility
|
|
1330
|
+
// Core state machine should NOT use setInterval (CORE_NO_SCHEDULING)
|
|
1331
|
+
expect(src).not.toContain('node:cron');
|
|
1332
|
+
});
|
|
1333
|
+
});
|
|
1334
|
+
describe('PRI-68 InternalizationOrchestrator', () => {
|
|
1335
|
+
it('orchestrator source file exists in internalization directory', async () => {
|
|
1336
|
+
const { existsSync } = await import('node:fs');
|
|
1337
|
+
const { resolve } = await import('node:path');
|
|
1338
|
+
expect(existsSync(resolve(__dirname, '..', 'internalization', 'internalization-orchestrator.ts'))).toBe(true);
|
|
1339
|
+
});
|
|
1340
|
+
it('orchestrator test file exists', async () => {
|
|
1341
|
+
const { existsSync } = await import('node:fs');
|
|
1342
|
+
const { resolve } = await import('node:path');
|
|
1343
|
+
expect(existsSync(resolve(__dirname, '..', '__tests__', 'internalization-orchestrator.test.ts'))).toBe(true);
|
|
1344
|
+
});
|
|
1345
|
+
it('CORE_NO_SCHEDULING: orchestrator has zero infrastructure imports', async () => {
|
|
1346
|
+
const { readFileSync } = await import('node:fs');
|
|
1347
|
+
const { resolve } = await import('node:path');
|
|
1348
|
+
const src = readFileSync(resolve(__dirname, '..', 'internalization', 'internalization-orchestrator.ts'), 'utf-8');
|
|
1349
|
+
expect(src).not.toContain('openclaw-plugin');
|
|
1350
|
+
expect(src).not.toContain('node:cron');
|
|
1351
|
+
expect(src).not.toContain('setInterval');
|
|
1352
|
+
expect(src).not.toContain('setTimeout');
|
|
1353
|
+
expect(src).not.toContain('node:fs');
|
|
1354
|
+
expect(src).not.toContain('node:path');
|
|
1355
|
+
});
|
|
1356
|
+
it('CORE_NO_RUNTIME_ADAPTER: orchestrator does not import PDRuntimeAdapter or startRun', async () => {
|
|
1357
|
+
const { readFileSync } = await import('node:fs');
|
|
1358
|
+
const { resolve } = await import('node:path');
|
|
1359
|
+
const src = readFileSync(resolve(__dirname, '..', 'internalization', 'internalization-orchestrator.ts'), 'utf-8');
|
|
1360
|
+
expect(src).not.toContain('PDRuntimeAdapter');
|
|
1361
|
+
expect(src).not.toContain('startRun');
|
|
1362
|
+
expect(src).not.toContain('DiagnosticianRunner');
|
|
1363
|
+
});
|
|
1364
|
+
it('BARREL_EXPORTS: internalization/index.ts exports InternalizationOrchestrator and result types', async () => {
|
|
1365
|
+
const { readFileSync } = await import('node:fs');
|
|
1366
|
+
const { resolve } = await import('node:path');
|
|
1367
|
+
const src = readFileSync(resolve(__dirname, '..', 'index.ts'), 'utf-8');
|
|
1368
|
+
expect(src).toContain('InternalizationOrchestrator');
|
|
1369
|
+
expect(src).toContain('WakeOnceResult');
|
|
1370
|
+
expect(src).toContain('LeaseConflictResult');
|
|
1371
|
+
});
|
|
1372
|
+
});
|
|
1373
|
+
describe('PRI-67 DreamerRunner', () => {
|
|
1374
|
+
it('dreamer source files exist in internalization directory', async () => {
|
|
1375
|
+
const { existsSync } = await import('node:fs');
|
|
1376
|
+
const { resolve } = await import('node:path');
|
|
1377
|
+
expect(existsSync(resolve(__dirname, '..', 'internalization', 'dreamer-runner.ts'))).toBe(true);
|
|
1378
|
+
expect(existsSync(resolve(__dirname, '..', 'internalization', 'dreamer-output.ts'))).toBe(true);
|
|
1379
|
+
});
|
|
1380
|
+
it('dreamer test file exists', async () => {
|
|
1381
|
+
const { existsSync } = await import('node:fs');
|
|
1382
|
+
const { resolve } = await import('node:path');
|
|
1383
|
+
expect(existsSync(resolve(__dirname, '..', '__tests__', 'dreamer-runner.test.ts'))).toBe(true);
|
|
1384
|
+
});
|
|
1385
|
+
it('CORE_NO_FORBIDDEN_IMPORTS: dreamer-runner.ts has no openclaw-plugin, nocturnal-trinity, philosopher, scribe imports', async () => {
|
|
1386
|
+
const { readFileSync } = await import('node:fs');
|
|
1387
|
+
const { resolve } = await import('node:path');
|
|
1388
|
+
const src = readFileSync(resolve(__dirname, '..', 'internalization', 'dreamer-runner.ts'), 'utf-8');
|
|
1389
|
+
expect(src).not.toContain('openclaw-plugin');
|
|
1390
|
+
expect(src).not.toContain('nocturnal-trinity');
|
|
1391
|
+
expect(src).not.toContain('runTrinity');
|
|
1392
|
+
expect(src).not.toContain('philosopher');
|
|
1393
|
+
expect(src).not.toContain('scribe');
|
|
1394
|
+
expect(src).not.toContain('InternalizationOrchestrator');
|
|
1395
|
+
expect(src).not.toContain('createTask');
|
|
1396
|
+
expect(src).not.toContain('enqueueTask');
|
|
1397
|
+
});
|
|
1398
|
+
it('CORE_NO_SCHEDULING: dreamer-runner.ts has no node:fs, node:cron, or cron-style scheduling', async () => {
|
|
1399
|
+
const { readFileSync } = await import('node:fs');
|
|
1400
|
+
const { resolve } = await import('node:path');
|
|
1401
|
+
const src = readFileSync(resolve(__dirname, '..', 'internalization', 'dreamer-runner.ts'), 'utf-8');
|
|
1402
|
+
expect(src).not.toContain('node:fs');
|
|
1403
|
+
expect(src).not.toContain('node:cron');
|
|
1404
|
+
// setTimeout for sleep() in polling loop is allowed — no cron/interval scheduling
|
|
1405
|
+
});
|
|
1406
|
+
it('USES_RUNTIME_ADAPTER: dreamer-runner.ts imports and uses PDRuntimeAdapter', async () => {
|
|
1407
|
+
const { readFileSync } = await import('node:fs');
|
|
1408
|
+
const { resolve } = await import('node:path');
|
|
1409
|
+
const src = readFileSync(resolve(__dirname, '..', 'internalization', 'dreamer-runner.ts'), 'utf-8');
|
|
1410
|
+
expect(src).toContain('PDRuntimeAdapter');
|
|
1411
|
+
expect(src).toContain('startRun');
|
|
1412
|
+
});
|
|
1413
|
+
it('BARREL_EXPORTS: internalization/index.ts exports DreamerRunner and DreamerOutput', async () => {
|
|
1414
|
+
const { readFileSync } = await import('node:fs');
|
|
1415
|
+
const { resolve } = await import('node:path');
|
|
1416
|
+
const src = readFileSync(resolve(__dirname, '..', 'internalization', 'index.ts'), 'utf-8');
|
|
1417
|
+
expect(src).toContain('DreamerRunner');
|
|
1418
|
+
expect(src).toContain('DreamerOutput');
|
|
1419
|
+
expect(src).toContain('PassThroughDreamerValidator');
|
|
1420
|
+
expect(src).toContain('DefaultDreamerValidator');
|
|
1421
|
+
});
|
|
1422
|
+
});
|
|
1423
|
+
// ── PRI-87: DefaultDreamerValidator strict validation ───────────────────────────
|
|
1424
|
+
describe('PRI-87 DefaultDreamerValidator strict validation', () => {
|
|
1425
|
+
it('CORE_NO_FORBIDDEN_IMPORTS: dreamer-output.ts has no openclaw-plugin, nocturnal, fs, path, process imports', async () => {
|
|
1426
|
+
const { readFileSync } = await import('node:fs');
|
|
1427
|
+
const { resolve } = await import('node:path');
|
|
1428
|
+
const src = readFileSync(resolve(__dirname, '..', 'internalization', 'dreamer-output.ts'), 'utf-8');
|
|
1429
|
+
expect(src).not.toContain('openclaw-plugin');
|
|
1430
|
+
expect(src).not.toContain('nocturnal');
|
|
1431
|
+
expect(src).not.toContain('node:fs');
|
|
1432
|
+
expect(src).not.toContain('node:path');
|
|
1433
|
+
expect(src).not.toContain('node:process');
|
|
1434
|
+
});
|
|
1435
|
+
it('PRODUCTION_USES_STRICT_VALIDATOR: run-once CLI uses DefaultDreamerValidator, not PassThroughDreamerValidator', async () => {
|
|
1436
|
+
const { readFileSync } = await import('node:fs');
|
|
1437
|
+
const { resolve } = await import('node:path');
|
|
1438
|
+
const src = readFileSync(resolve(__dirname, '..', '..', '..', '..', 'pd-cli', 'src', 'commands', 'runtime-internalization-run-once.ts'), 'utf-8');
|
|
1439
|
+
expect(src).toContain('DefaultDreamerValidator');
|
|
1440
|
+
expect(src).not.toContain('new PassThroughDreamerValidator()');
|
|
1441
|
+
});
|
|
1442
|
+
it('BARREL_EXPORTS: DefaultDreamerValidator is exported from internalization/index.ts', async () => {
|
|
1443
|
+
const { readFileSync } = await import('node:fs');
|
|
1444
|
+
const { resolve } = await import('node:path');
|
|
1445
|
+
const src = readFileSync(resolve(__dirname, '..', 'internalization', 'index.ts'), 'utf-8');
|
|
1446
|
+
expect(src).toContain('DefaultDreamerValidator');
|
|
1447
|
+
});
|
|
1448
|
+
it('validator test file exists', async () => {
|
|
1449
|
+
const { existsSync } = await import('node:fs');
|
|
1450
|
+
const { resolve } = await import('node:path');
|
|
1451
|
+
expect(existsSync(resolve(__dirname, '..', '__tests__', 'dreamer-output-validator.test.ts'))).toBe(true);
|
|
1452
|
+
});
|
|
1453
|
+
});
|
|
1454
|
+
// ── PRI-75/PRI-74/PRI-81: Prompt-builder core boundary ─────────────────────────────────
|
|
1455
|
+
describe('PRI-75/PRI-74/PRI-81 prompt-builder core boundary', () => {
|
|
1456
|
+
const files = [
|
|
1457
|
+
'prompt-builder/index.ts',
|
|
1458
|
+
'prompt-builder/attitude-directive.ts',
|
|
1459
|
+
'prompt-builder/correction-cue.ts',
|
|
1460
|
+
'prompt-builder/message-extraction.ts',
|
|
1461
|
+
'prompt-builder/minimal-trigger.ts',
|
|
1462
|
+
'prompt-builder/size-guard.ts',
|
|
1463
|
+
'prompt-builder/types.ts',
|
|
1464
|
+
'prompt-builder/principle-selection.ts',
|
|
1465
|
+
// PRI-74
|
|
1466
|
+
'prompt-builder/routing-guidance.ts',
|
|
1467
|
+
// PRI-81 Phase A
|
|
1468
|
+
'prompt-builder/empathy-keyword-matching.ts',
|
|
1469
|
+
'prompt-builder/empathy-types.ts',
|
|
1470
|
+
// PRI-81 Phase B
|
|
1471
|
+
'prompt-builder/focus-compression.ts',
|
|
1472
|
+
];
|
|
1473
|
+
for (const file of files) {
|
|
1474
|
+
it(`${file} has zero infrastructure imports`, async () => {
|
|
1475
|
+
const { readFileSync } = await import('node:fs');
|
|
1476
|
+
const { resolve } = await import('node:path');
|
|
1477
|
+
const src = readFileSync(resolve(__dirname, '../..', file), 'utf-8');
|
|
1478
|
+
expect(src).not.toContain('node:fs');
|
|
1479
|
+
expect(src).not.toContain('node:path');
|
|
1480
|
+
expect(src).not.toContain('node:process');
|
|
1481
|
+
expect(src).not.toContain('openclaw-plugin');
|
|
1482
|
+
});
|
|
1483
|
+
}
|
|
1484
|
+
it('prompt-builder/index.ts exports all functions', async () => {
|
|
1485
|
+
const { readFileSync } = await import('node:fs');
|
|
1486
|
+
const { resolve } = await import('node:path');
|
|
1487
|
+
const src = readFileSync(resolve(__dirname, '../..', 'prompt-builder/index.ts'), 'utf-8');
|
|
1488
|
+
// Phase 1
|
|
1489
|
+
expect(src).toContain('buildAttitudeDirective');
|
|
1490
|
+
expect(src).toContain('detectCorrectionCue');
|
|
1491
|
+
expect(src).toContain('extractMessageContent');
|
|
1492
|
+
expect(src).toContain('isMinimalTrigger');
|
|
1493
|
+
expect(src).toContain('truncateInjectionToBudget');
|
|
1494
|
+
// Phase 2
|
|
1495
|
+
expect(src).toContain('formatPrinciple');
|
|
1496
|
+
expect(src).toContain('selectPrinciplesForInjection');
|
|
1497
|
+
expect(src).toContain('DEFAULT_PRINCIPLE_BUDGET');
|
|
1498
|
+
// PRI-74 routing guidance
|
|
1499
|
+
expect(src).toContain('classifyTaskKind');
|
|
1500
|
+
expect(src).toContain('buildReason');
|
|
1501
|
+
expect(src).toContain('buildBlockers');
|
|
1502
|
+
expect(src).toContain('computeCombinedText');
|
|
1503
|
+
expect(src).toContain('containsKeyword');
|
|
1504
|
+
// PRI-81 Phase A: empathy keyword matching
|
|
1505
|
+
expect(src).toContain('matchEmpathyKeywords');
|
|
1506
|
+
expect(src).toContain('createDefaultKeywordStore');
|
|
1507
|
+
expect(src).toContain('applyKeywordUpdates');
|
|
1508
|
+
expect(src).toContain('shouldTriggerOptimization');
|
|
1509
|
+
expect(src).toContain('getKeywordStoreSummary');
|
|
1510
|
+
expect(src).toContain('EMPATHY_SEED_KEYWORDS');
|
|
1511
|
+
expect(src).toContain('DEFAULT_EMPATHY_KEYWORD_CONFIG');
|
|
1512
|
+
expect(src).toContain('scoreToSeverity');
|
|
1513
|
+
expect(src).toContain('severityToPenalty');
|
|
1514
|
+
expect(src).toContain('normalizeSeverity');
|
|
1515
|
+
// PRI-81 Phase B: focus compression
|
|
1516
|
+
expect(src).toContain('extractVersion');
|
|
1517
|
+
expect(src).toContain('extractDate');
|
|
1518
|
+
expect(src).toContain('extractSummary');
|
|
1519
|
+
expect(src).toContain('parseWorkingMemorySection');
|
|
1520
|
+
expect(src).toContain('workingMemoryToInjection');
|
|
1521
|
+
expect(src).toContain('extractMilestones');
|
|
1522
|
+
expect(src).toContain('validateCurrentFocus');
|
|
1523
|
+
expect(src).toContain('mergeWorkingMemory');
|
|
1524
|
+
expect(src).toContain('compressFocusContent');
|
|
1525
|
+
expect(src).toContain('DEFAULT_FOCUS_COMPRESSION_OPTIONS');
|
|
1526
|
+
});
|
|
1527
|
+
it('principle-selection.ts does not import EvolutionReducer or WorkspaceContext', async () => {
|
|
1528
|
+
const { readFileSync } = await import('node:fs');
|
|
1529
|
+
const { resolve } = await import('node:path');
|
|
1530
|
+
const src = readFileSync(resolve(__dirname, '../..', 'prompt-builder/principle-selection.ts'), 'utf-8');
|
|
1531
|
+
expect(src).not.toContain('EvolutionReducer');
|
|
1532
|
+
expect(src).not.toContain('WorkspaceContext');
|
|
1533
|
+
});
|
|
1534
|
+
it('plugin principle-injection.ts is a thin re-export of core', async () => {
|
|
1535
|
+
const { readFileSync } = await import('node:fs');
|
|
1536
|
+
const { resolve } = await import('node:path');
|
|
1537
|
+
const src = readFileSync(resolve(__dirname, '../../../../openclaw-plugin/src/core/principle-injection.ts'), 'utf-8');
|
|
1538
|
+
// Must re-export from core
|
|
1539
|
+
expect(src).toContain('@principles/core/prompt-builder');
|
|
1540
|
+
// Must NOT contain inline selectPrinciplesForInjection implementation
|
|
1541
|
+
expect(src).not.toMatch(/function selectPrinciplesForInjection/i);
|
|
1542
|
+
// Must NOT contain priority sorting logic
|
|
1543
|
+
expect(src).not.toMatch(/PRIORITY_ORDER/i);
|
|
1544
|
+
});
|
|
1545
|
+
it('plugin prompt.ts imports from @principles/core/prompt-builder', async () => {
|
|
1546
|
+
const { readFileSync } = await import('node:fs');
|
|
1547
|
+
const { resolve } = await import('node:path');
|
|
1548
|
+
const src = readFileSync(resolve(__dirname, '../../../../openclaw-plugin/src/hooks/prompt.ts'), 'utf-8');
|
|
1549
|
+
expect(src).toContain('@principles/core/prompt-builder');
|
|
1550
|
+
});
|
|
1551
|
+
it('plugin prompt.ts uses core truncateInjectionToBudget, not inline priority stripping', async () => {
|
|
1552
|
+
const { readFileSync } = await import('node:fs');
|
|
1553
|
+
const { resolve } = await import('node:path');
|
|
1554
|
+
const src = readFileSync(resolve(__dirname, '../../../../openclaw-plugin/src/hooks/prompt.ts'), 'utf-8');
|
|
1555
|
+
// Must call the core function
|
|
1556
|
+
expect(src).toMatch(/truncateInjectionToBudget\s*\(/);
|
|
1557
|
+
// Must NOT have inline priority stripping comment markers (old step comments)
|
|
1558
|
+
expect(src).not.toMatch(/\/\/ Step \d+.*strip (project_context|thinking_os|evolution_principles|reflection_log)/i);
|
|
1559
|
+
// Must NOT have inline regex-based fallback context block (the strip-by-regex pattern)
|
|
1560
|
+
expect(src).not.toMatch(/<reflection_log>\[\\s\\S\]\*?<\/reflection_log>/);
|
|
1561
|
+
// Must NOT have the old multi-line fallback block with attitudeDirective interpolation
|
|
1562
|
+
expect(src).not.toMatch(/## 【CONTEXT SECTIONS】\n\n\[WARNING: Context sections stripped/);
|
|
1563
|
+
});
|
|
1564
|
+
it('plugin empathy-keyword-matcher.ts is a thin adapter (re-exports from core)', async () => {
|
|
1565
|
+
const { readFileSync } = await import('node:fs');
|
|
1566
|
+
const { resolve } = await import('node:path');
|
|
1567
|
+
const src = readFileSync(resolve(__dirname, '../../../../openclaw-plugin/src/core/empathy-keyword-matcher.ts'), 'utf-8');
|
|
1568
|
+
expect(src).toContain('@principles/core/prompt-builder');
|
|
1569
|
+
expect(src).not.toMatch(/function matchEmpathyKeywords\s*\(/);
|
|
1570
|
+
expect(src).not.toMatch(/function createDefaultKeywordStore\s*\(/);
|
|
1571
|
+
expect(src).not.toMatch(/function applyKeywordUpdates\s*\(/);
|
|
1572
|
+
expect(src).not.toMatch(/function shouldTriggerOptimization\s*\(/);
|
|
1573
|
+
expect(src).not.toMatch(/function getKeywordStoreSummary\s*\(/);
|
|
1574
|
+
});
|
|
1575
|
+
it('plugin empathy-types.ts is a thin re-export (no inline definitions)', async () => {
|
|
1576
|
+
const { readFileSync } = await import('node:fs');
|
|
1577
|
+
const { resolve } = await import('node:path');
|
|
1578
|
+
const src = readFileSync(resolve(__dirname, '../../../../openclaw-plugin/src/core/empathy-types.ts'), 'utf-8');
|
|
1579
|
+
expect(src).toContain('@principles/core/prompt-builder');
|
|
1580
|
+
expect(src).not.toMatch(/interface EmpathyKeywordStore/);
|
|
1581
|
+
expect(src).not.toMatch(/const EMPATHY_SEED_KEYWORDS/);
|
|
1582
|
+
expect(src).not.toMatch(/function scoreToSeverity/);
|
|
1583
|
+
});
|
|
1584
|
+
it('plugin focus-history.ts delegates pure functions to core', async () => {
|
|
1585
|
+
const { readFileSync } = await import('node:fs');
|
|
1586
|
+
const { resolve } = await import('node:path');
|
|
1587
|
+
const src = readFileSync(resolve(__dirname, '../../../../openclaw-plugin/src/core/focus-history.ts'), 'utf-8');
|
|
1588
|
+
expect(src).toContain('@principles/core/prompt-builder');
|
|
1589
|
+
expect(src).not.toMatch(/function extractSummary\s*\(/);
|
|
1590
|
+
expect(src).not.toMatch(/function parseWorkingMemorySection\s*\(/);
|
|
1591
|
+
expect(src).not.toMatch(/function workingMemoryToInjection\s*\(/);
|
|
1592
|
+
expect(src).not.toMatch(/function extractMilestones\s*\(/);
|
|
1593
|
+
expect(src).not.toMatch(/function validateCurrentFocus\s*\(/);
|
|
1594
|
+
expect(src).not.toMatch(/function mergeWorkingMemory\s*\(/);
|
|
1595
|
+
});
|
|
1596
|
+
});
|
|
1597
|
+
// ── PRI-74: Routing guidance thin-adapter boundary ───────────────────────────
|
|
1598
|
+
describe('PRI-74 routing guidance thin-adapter boundary', () => {
|
|
1599
|
+
it('prompt-builder/routing-guidance.ts has zero infrastructure imports', async () => {
|
|
1600
|
+
const { readFileSync } = await import('node:fs');
|
|
1601
|
+
const { resolve } = await import('node:path');
|
|
1602
|
+
const src = readFileSync(resolve(__dirname, '../..', 'prompt-builder/routing-guidance.ts'), 'utf-8');
|
|
1603
|
+
expect(src).not.toContain('node:fs');
|
|
1604
|
+
expect(src).not.toContain('node:path');
|
|
1605
|
+
expect(src).not.toContain('node:process');
|
|
1606
|
+
expect(src).not.toContain('openclaw-plugin');
|
|
1607
|
+
});
|
|
1608
|
+
it('plugin local-worker-routing.ts imports classifyTaskKind/buildReason/buildBlockers from core', async () => {
|
|
1609
|
+
const { readFileSync } = await import('node:fs');
|
|
1610
|
+
const { resolve } = await import('node:path');
|
|
1611
|
+
const src = readFileSync(resolve(__dirname, '../../../../openclaw-plugin/src/core/local-worker-routing.ts'), 'utf-8');
|
|
1612
|
+
expect(src).toContain('@principles/core/prompt-builder');
|
|
1613
|
+
expect(src).toContain('classifyTaskKind');
|
|
1614
|
+
expect(src).toContain('buildReason');
|
|
1615
|
+
expect(src).toContain('buildBlockers');
|
|
1616
|
+
});
|
|
1617
|
+
it('plugin local-worker-routing.ts does NOT have inline keyword arrays or classifyTaskKind implementation', async () => {
|
|
1618
|
+
const { readFileSync } = await import('node:fs');
|
|
1619
|
+
const { resolve } = await import('node:path');
|
|
1620
|
+
const src = readFileSync(resolve(__dirname, '../../../../openclaw-plugin/src/core/local-worker-routing.ts'), 'utf-8');
|
|
1621
|
+
// Must NOT re-define the keyword constants locally
|
|
1622
|
+
expect(src).not.toMatch(/READER_KEYWORDS\s*=/);
|
|
1623
|
+
expect(src).not.toMatch(/EDITOR_KEYWORDS\s*=/);
|
|
1624
|
+
expect(src).not.toMatch(/HIGH_ENTROPY_KEYWORDS\s*=/);
|
|
1625
|
+
// Must NOT have inline classifyTaskKind function body
|
|
1626
|
+
expect(src).not.toMatch(/export\s+function\s+classifyTaskKind/);
|
|
1627
|
+
// Must delegate to coreClassifyTaskKind
|
|
1628
|
+
expect(src).toContain('coreClassifyTaskKind');
|
|
1629
|
+
expect(src).toContain('coreBuildReason');
|
|
1630
|
+
expect(src).toContain('coreBuildBlockers');
|
|
1631
|
+
});
|
|
1632
|
+
});
|
|
1633
|
+
// ── PRI-76: GFI core kernel boundary ───────────────────────────────────────
|
|
1634
|
+
describe('PRI-76 GFI core kernel boundary', () => {
|
|
1635
|
+
const gfiFiles = [
|
|
1636
|
+
'gfi/gfi-types.ts',
|
|
1637
|
+
'gfi/gfi-policy.ts',
|
|
1638
|
+
'gfi/gfi-kernel.ts',
|
|
1639
|
+
'gfi/gfi-read-model.ts',
|
|
1640
|
+
'gfi/index.ts',
|
|
1641
|
+
];
|
|
1642
|
+
for (const file of gfiFiles) {
|
|
1643
|
+
it(`${file} has zero infrastructure imports`, async () => {
|
|
1644
|
+
const { readFileSync } = await import('node:fs');
|
|
1645
|
+
const { resolve } = await import('node:path');
|
|
1646
|
+
const src = readFileSync(resolve(__dirname, '..', file), 'utf-8');
|
|
1647
|
+
expect(src).not.toContain('node:fs');
|
|
1648
|
+
expect(src).not.toContain('node:path');
|
|
1649
|
+
expect(src).not.toContain('node:process');
|
|
1650
|
+
expect(src).not.toContain('openclaw-plugin');
|
|
1651
|
+
expect(src).not.toContain('node:crypto');
|
|
1652
|
+
expect(src).not.toContain('node:async_hooks');
|
|
1653
|
+
});
|
|
1654
|
+
}
|
|
1655
|
+
// PRI-82: gfi-kernel.ts must not call Date.now() — nowMs is injected by caller
|
|
1656
|
+
it('gfi-kernel.ts does not call Date.now()', async () => {
|
|
1657
|
+
const { readFileSync } = await import('node:fs');
|
|
1658
|
+
const { resolve } = await import('node:path');
|
|
1659
|
+
const src = readFileSync(resolve(__dirname, '..', 'gfi/gfi-kernel.ts'), 'utf-8');
|
|
1660
|
+
expect(src).not.toContain('Date.now()');
|
|
1661
|
+
});
|
|
1662
|
+
it('gfi/index.ts exports all public symbols', async () => {
|
|
1663
|
+
const { readFileSync } = await import('node:fs');
|
|
1664
|
+
const { resolve } = await import('node:path');
|
|
1665
|
+
const src = readFileSync(resolve(__dirname, '..', 'gfi/index.ts'), 'utf-8');
|
|
1666
|
+
expect(src).toContain('applyFriction');
|
|
1667
|
+
expect(src).toContain('applyDecay');
|
|
1668
|
+
expect(src).toContain('applyRelief');
|
|
1669
|
+
expect(src).toContain('classifyGfiStage');
|
|
1670
|
+
expect(src).toContain('createGfiSnapshot');
|
|
1671
|
+
expect(src).toContain('DEFAULT_GFI_POLICY');
|
|
1672
|
+
expect(src).toContain('GfiState');
|
|
1673
|
+
expect(src).toContain('GfiEvent');
|
|
1674
|
+
expect(src).toContain('GfiPolicy');
|
|
1675
|
+
expect(src).toContain('GfiStage');
|
|
1676
|
+
expect(src).toContain('GfiSource');
|
|
1677
|
+
expect(src).toContain('GfiSnapshot');
|
|
1678
|
+
expect(src).toContain('buildGfiWorkspaceSnapshot');
|
|
1679
|
+
expect(src).toContain('GfiReadModelInput');
|
|
1680
|
+
expect(src).toContain('GfiWorkspaceSnapshot');
|
|
1681
|
+
});
|
|
1682
|
+
});
|
|
1683
|
+
// ── PRI-78: GFI observability boundary ──────────────────────────────────────
|
|
1684
|
+
describe('PRI-78 GFI observability boundary', () => {
|
|
1685
|
+
it('gfi-read-model.ts has zero infrastructure imports', async () => {
|
|
1686
|
+
const { readFileSync } = await import('node:fs');
|
|
1687
|
+
const { resolve } = await import('node:path');
|
|
1688
|
+
const src = readFileSync(resolve(__dirname, '..', 'gfi/gfi-read-model.ts'), 'utf-8');
|
|
1689
|
+
expect(src).not.toContain('node:fs');
|
|
1690
|
+
expect(src).not.toContain('node:path');
|
|
1691
|
+
expect(src).not.toContain('node:process');
|
|
1692
|
+
expect(src).not.toContain('openclaw-plugin');
|
|
1693
|
+
});
|
|
1694
|
+
it('pd-cli runtime-gfi-snapshot.ts imports from @principles/core/runtime-v2', async () => {
|
|
1695
|
+
const { readFileSync } = await import('node:fs');
|
|
1696
|
+
const { resolve } = await import('node:path');
|
|
1697
|
+
const src = readFileSync(resolve(__dirname, '../../../../pd-cli/src/commands/runtime-gfi-snapshot.ts'), 'utf-8');
|
|
1698
|
+
expect(src).toContain("from '@principles/core/runtime-v2'");
|
|
1699
|
+
});
|
|
1700
|
+
});
|
|
1701
|
+
// ── PRI-111: ArtificerRunner boundary guards ──────────────────────────────────
|
|
1702
|
+
describe('PRI-111 ArtificerRunner boundary', () => {
|
|
1703
|
+
it('artificer source files exist in internalization directory', async () => {
|
|
1704
|
+
const { existsSync } = await import('node:fs');
|
|
1705
|
+
const { resolve } = await import('node:path');
|
|
1706
|
+
expect(existsSync(resolve(__dirname, '..', 'internalization', 'artificer-runner.ts'))).toBe(true);
|
|
1707
|
+
expect(existsSync(resolve(__dirname, '..', 'internalization', 'artificer-output.ts'))).toBe(true);
|
|
1708
|
+
});
|
|
1709
|
+
it('artificer test file exists', async () => {
|
|
1710
|
+
const { existsSync } = await import('node:fs');
|
|
1711
|
+
const { resolve } = await import('node:path');
|
|
1712
|
+
expect(existsSync(resolve(__dirname, 'artificer-runner-vslice.test.ts'))).toBe(true);
|
|
1713
|
+
});
|
|
1714
|
+
it('CORE_NO_FORBIDDEN_IMPORTS: artificer-runner.ts has no openclaw-plugin, evaluator, nocturnal-trinity imports', async () => {
|
|
1715
|
+
const { readFileSync } = await import('node:fs');
|
|
1716
|
+
const { resolve } = await import('node:path');
|
|
1717
|
+
const src = readFileSync(resolve(__dirname, '..', 'internalization', 'artificer-runner.ts'), 'utf-8');
|
|
1718
|
+
expect(src).not.toContain('openclaw-plugin');
|
|
1719
|
+
expect(src).not.toContain('EvaluatorRunner');
|
|
1720
|
+
expect(src).not.toContain('nocturnal-trinity');
|
|
1721
|
+
expect(src).not.toContain('InternalizationOrchestrator');
|
|
1722
|
+
expect(src).not.toContain('createTask');
|
|
1723
|
+
expect(src).not.toContain('enqueueTask');
|
|
1724
|
+
});
|
|
1725
|
+
it('CORE_NO_FORBIDDEN_IMPORTS: artificer-output.ts has no openclaw-plugin, fs, path imports', async () => {
|
|
1726
|
+
const { readFileSync } = await import('node:fs');
|
|
1727
|
+
const { resolve } = await import('node:path');
|
|
1728
|
+
const src = readFileSync(resolve(__dirname, '..', 'internalization', 'artificer-output.ts'), 'utf-8');
|
|
1729
|
+
expect(src).not.toContain('openclaw-plugin');
|
|
1730
|
+
expect(src).not.toContain('node:fs');
|
|
1731
|
+
expect(src).not.toContain('node:path');
|
|
1732
|
+
});
|
|
1733
|
+
it('CORE_NO_SCHEDULING: artificer-runner.ts has no node:fs, node:cron, or cron-style scheduling', async () => {
|
|
1734
|
+
const { readFileSync } = await import('node:fs');
|
|
1735
|
+
const { resolve } = await import('node:path');
|
|
1736
|
+
const src = readFileSync(resolve(__dirname, '..', 'internalization', 'artificer-runner.ts'), 'utf-8');
|
|
1737
|
+
expect(src).not.toContain('node:fs');
|
|
1738
|
+
expect(src).not.toContain('node:cron');
|
|
1739
|
+
});
|
|
1740
|
+
it('BARREL_EXPORTS: internalization/index.ts exports ArtificerRunner and ArtificerOutput', async () => {
|
|
1741
|
+
const { readFileSync } = await import('node:fs');
|
|
1742
|
+
const { resolve } = await import('node:path');
|
|
1743
|
+
const src = readFileSync(resolve(__dirname, '..', 'internalization', 'index.ts'), 'utf-8');
|
|
1744
|
+
expect(src).toContain('ArtificerRunner');
|
|
1745
|
+
expect(src).toContain('ArtificerOutput');
|
|
1746
|
+
expect(src).toContain('DefaultArtificerValidator');
|
|
1747
|
+
});
|
|
1748
|
+
it('SCHEMA_REGISTRY: pi-ai-runtime-adapter.ts registers artificer-output-v1 schema', async () => {
|
|
1749
|
+
const { readFileSync } = await import('node:fs');
|
|
1750
|
+
const { resolve } = await import('node:path');
|
|
1751
|
+
const src = readFileSync(resolve(__dirname, '..', 'adapter', 'pi-ai-runtime-adapter.ts'), 'utf-8');
|
|
1752
|
+
expect(src).toContain('artificer-output-v1');
|
|
1753
|
+
expect(src).toContain('ArtificerOutputV1Schema');
|
|
1754
|
+
});
|
|
1755
|
+
});
|
|
1756
|
+
// ── PRI-EVAL: EvaluatorRunner boundary guards ──────────────────────────────────
|
|
1757
|
+
describe('PRI-EVAL EvaluatorRunner boundary', () => {
|
|
1758
|
+
it('evaluator source files exist in internalization directory', async () => {
|
|
1759
|
+
const { existsSync } = await import('node:fs');
|
|
1760
|
+
const { resolve } = await import('node:path');
|
|
1761
|
+
expect(existsSync(resolve(__dirname, '..', 'internalization', 'evaluator-runner.ts'))).toBe(true);
|
|
1762
|
+
expect(existsSync(resolve(__dirname, '..', 'internalization', 'evaluator-output.ts'))).toBe(true);
|
|
1763
|
+
expect(existsSync(resolve(__dirname, '..', 'internalization', 'evaluator-prompt-builder.ts'))).toBe(true);
|
|
1764
|
+
});
|
|
1765
|
+
it('evaluator test file exists', async () => {
|
|
1766
|
+
const { existsSync } = await import('node:fs');
|
|
1767
|
+
const { resolve } = await import('node:path');
|
|
1768
|
+
expect(existsSync(resolve(__dirname, 'evaluator-runner-vslice.test.ts'))).toBe(true);
|
|
1769
|
+
});
|
|
1770
|
+
it('CORE_NO_FORBIDDEN_IMPORTS: evaluator-output.ts has no openclaw-plugin, fs, path imports', async () => {
|
|
1771
|
+
const { readFileSync } = await import('node:fs');
|
|
1772
|
+
const { resolve } = await import('node:path');
|
|
1773
|
+
const src = readFileSync(resolve(__dirname, '..', 'internalization', 'evaluator-output.ts'), 'utf-8');
|
|
1774
|
+
expect(src).not.toContain('openclaw-plugin');
|
|
1775
|
+
expect(src).not.toContain('node:fs');
|
|
1776
|
+
expect(src).not.toContain('node:path');
|
|
1777
|
+
});
|
|
1778
|
+
it('CORE_NO_FORBIDDEN_IMPORTS: evaluator-runner.ts has no openclaw-plugin, RolloutReviewerRunner, nocturnal-trinity imports', async () => {
|
|
1779
|
+
const { readFileSync } = await import('node:fs');
|
|
1780
|
+
const { resolve } = await import('node:path');
|
|
1781
|
+
const src = readFileSync(resolve(__dirname, '..', 'internalization', 'evaluator-runner.ts'), 'utf-8');
|
|
1782
|
+
expect(src).not.toContain('openclaw-plugin');
|
|
1783
|
+
expect(src).not.toContain('RolloutReviewerRunner');
|
|
1784
|
+
expect(src).not.toContain('nocturnal-trinity');
|
|
1785
|
+
expect(src).not.toContain('InternalizationOrchestrator');
|
|
1786
|
+
expect(src).not.toContain('createTask');
|
|
1787
|
+
expect(src).not.toContain('enqueueTask');
|
|
1788
|
+
});
|
|
1789
|
+
it('CORE_NO_SCHEDULING: evaluator-runner.ts has no node:fs, node:cron imports', async () => {
|
|
1790
|
+
const { readFileSync } = await import('node:fs');
|
|
1791
|
+
const { resolve } = await import('node:path');
|
|
1792
|
+
const src = readFileSync(resolve(__dirname, '..', 'internalization', 'evaluator-runner.ts'), 'utf-8');
|
|
1793
|
+
expect(src).not.toContain('node:fs');
|
|
1794
|
+
expect(src).not.toContain('node:cron');
|
|
1795
|
+
});
|
|
1796
|
+
it('BARREL_EXPORTS: internalization/index.ts exports EvaluatorRunner and EvaluatorOutput', async () => {
|
|
1797
|
+
const { readFileSync } = await import('node:fs');
|
|
1798
|
+
const { resolve } = await import('node:path');
|
|
1799
|
+
const src = readFileSync(resolve(__dirname, '..', 'internalization', 'index.ts'), 'utf-8');
|
|
1800
|
+
expect(src).toContain('EvaluatorRunner');
|
|
1801
|
+
expect(src).toContain('EvaluatorOutput');
|
|
1802
|
+
expect(src).toContain('DefaultEvaluatorValidator');
|
|
1803
|
+
});
|
|
1804
|
+
it('SCHEMA_REGISTRY: pi-ai-runtime-adapter.ts registers evaluator-output-v1 schema', async () => {
|
|
1805
|
+
const { readFileSync } = await import('node:fs');
|
|
1806
|
+
const { resolve } = await import('node:path');
|
|
1807
|
+
const src = readFileSync(resolve(__dirname, '..', 'adapter', 'pi-ai-runtime-adapter.ts'), 'utf-8');
|
|
1808
|
+
expect(src).toContain('evaluator-output-v1');
|
|
1809
|
+
expect(src).toContain('EvaluatorOutputV1Schema');
|
|
1810
|
+
});
|
|
1811
|
+
});
|
|
1812
|
+
// ── PRI-RR: RolloutReviewerRunner boundary guards ──────────────────────────────
|
|
1813
|
+
describe('PRI-RR RolloutReviewerRunner boundary', () => {
|
|
1814
|
+
it('rollout_reviewer source files exist in internalization directory', async () => {
|
|
1815
|
+
const { existsSync } = await import('node:fs');
|
|
1816
|
+
const { resolve } = await import('node:path');
|
|
1817
|
+
expect(existsSync(resolve(__dirname, '..', 'internalization', 'rollout-reviewer-runner.ts'))).toBe(true);
|
|
1818
|
+
expect(existsSync(resolve(__dirname, '..', 'internalization', 'rollout-reviewer-output.ts'))).toBe(true);
|
|
1819
|
+
expect(existsSync(resolve(__dirname, '..', 'internalization', 'rollout-reviewer-prompt-builder.ts'))).toBe(true);
|
|
1820
|
+
});
|
|
1821
|
+
it('rollout_reviewer test file exists', async () => {
|
|
1822
|
+
const { existsSync } = await import('node:fs');
|
|
1823
|
+
const { resolve } = await import('node:path');
|
|
1824
|
+
expect(existsSync(resolve(__dirname, 'rollout-reviewer-runner-vslice.test.ts'))).toBe(true);
|
|
1825
|
+
});
|
|
1826
|
+
it('CORE_NO_FORBIDDEN_IMPORTS: rollout-reviewer-output.ts has no openclaw-plugin, fs, path imports', async () => {
|
|
1827
|
+
const { readFileSync } = await import('node:fs');
|
|
1828
|
+
const { resolve } = await import('node:path');
|
|
1829
|
+
const src = readFileSync(resolve(__dirname, '..', 'internalization', 'rollout-reviewer-output.ts'), 'utf-8');
|
|
1830
|
+
expect(src).not.toContain('openclaw-plugin');
|
|
1831
|
+
expect(src).not.toContain('node:fs');
|
|
1832
|
+
expect(src).not.toContain('node:path');
|
|
1833
|
+
});
|
|
1834
|
+
it('CORE_NO_FORBIDDEN_IMPORTS: rollout-reviewer-runner.ts has no openclaw-plugin, TrainerRunner, nocturnal-trinity imports', async () => {
|
|
1835
|
+
const { readFileSync } = await import('node:fs');
|
|
1836
|
+
const { resolve } = await import('node:path');
|
|
1837
|
+
const src = readFileSync(resolve(__dirname, '..', 'internalization', 'rollout-reviewer-runner.ts'), 'utf-8');
|
|
1838
|
+
expect(src).not.toContain('openclaw-plugin');
|
|
1839
|
+
expect(src).not.toContain('TrainerRunner');
|
|
1840
|
+
expect(src).not.toContain('nocturnal-trinity');
|
|
1841
|
+
expect(src).not.toContain('InternalizationOrchestrator');
|
|
1842
|
+
expect(src).not.toContain('createTask');
|
|
1843
|
+
expect(src).not.toContain('enqueueTask');
|
|
1844
|
+
});
|
|
1845
|
+
it('CORE_NO_SCHEDULING: rollout-reviewer-runner.ts has no node:fs, node:cron imports', async () => {
|
|
1846
|
+
const { readFileSync } = await import('node:fs');
|
|
1847
|
+
const { resolve } = await import('node:path');
|
|
1848
|
+
const src = readFileSync(resolve(__dirname, '..', 'internalization', 'rollout-reviewer-runner.ts'), 'utf-8');
|
|
1849
|
+
expect(src).not.toContain('node:fs');
|
|
1850
|
+
expect(src).not.toContain('node:cron');
|
|
1851
|
+
});
|
|
1852
|
+
it('BARREL_EXPORTS: internalization/index.ts exports RolloutReviewerRunner and RolloutReviewerOutput', async () => {
|
|
1853
|
+
const { readFileSync } = await import('node:fs');
|
|
1854
|
+
const { resolve } = await import('node:path');
|
|
1855
|
+
const src = readFileSync(resolve(__dirname, '..', 'internalization', 'index.ts'), 'utf-8');
|
|
1856
|
+
expect(src).toContain('RolloutReviewerRunner');
|
|
1857
|
+
expect(src).toContain('RolloutReviewerOutput');
|
|
1858
|
+
expect(src).toContain('DefaultRolloutReviewerValidator');
|
|
1859
|
+
});
|
|
1860
|
+
it('SCHEMA_REGISTRY: pi-ai-runtime-adapter.ts registers rollout-reviewer-output-v1 schema', async () => {
|
|
1861
|
+
const { readFileSync } = await import('node:fs');
|
|
1862
|
+
const { resolve } = await import('node:path');
|
|
1863
|
+
const src = readFileSync(resolve(__dirname, '..', 'adapter', 'pi-ai-runtime-adapter.ts'), 'utf-8');
|
|
1864
|
+
expect(src).toContain('rollout-reviewer-output-v1');
|
|
1865
|
+
expect(src).toContain('RolloutReviewerOutputV1Schema');
|
|
1866
|
+
});
|
|
1867
|
+
});
|
|
1868
|
+
// ── PRI-116: TrainerRunner boundary guards ──────────────────────────────────
|
|
1869
|
+
describe('PRI-116 TrainerRunner boundary', () => {
|
|
1870
|
+
it('trainer source files exist in internalization directory', async () => {
|
|
1871
|
+
const { existsSync } = await import('node:fs');
|
|
1872
|
+
const { resolve } = await import('node:path');
|
|
1873
|
+
expect(existsSync(resolve(__dirname, '..', 'internalization', 'trainer-runner.ts'))).toBe(true);
|
|
1874
|
+
expect(existsSync(resolve(__dirname, '..', 'internalization', 'trainer-output.ts'))).toBe(true);
|
|
1875
|
+
expect(existsSync(resolve(__dirname, '..', 'internalization', 'trainer-prompt-builder.ts'))).toBe(true);
|
|
1876
|
+
});
|
|
1877
|
+
it('trainer test file exists', async () => {
|
|
1878
|
+
const { existsSync } = await import('node:fs');
|
|
1879
|
+
const { resolve } = await import('node:path');
|
|
1880
|
+
expect(existsSync(resolve(__dirname, 'trainer-runner-vslice.test.ts'))).toBe(true);
|
|
1881
|
+
});
|
|
1882
|
+
it('CORE_NO_FORBIDDEN_IMPORTS: trainer-output.ts has no openclaw-plugin, fs, path imports', async () => {
|
|
1883
|
+
const { readFileSync } = await import('node:fs');
|
|
1884
|
+
const { resolve } = await import('node:path');
|
|
1885
|
+
const src = readFileSync(resolve(__dirname, '..', 'internalization', 'trainer-output.ts'), 'utf-8');
|
|
1886
|
+
expect(src).not.toContain('openclaw-plugin');
|
|
1887
|
+
expect(src).not.toContain('node:fs');
|
|
1888
|
+
expect(src).not.toContain('node:path');
|
|
1889
|
+
});
|
|
1890
|
+
it('CORE_NO_FORBIDDEN_IMPORTS: trainer-runner.ts has no openclaw-plugin, RolloutReviewerRunner, nocturnal-trinity imports', async () => {
|
|
1891
|
+
const { readFileSync } = await import('node:fs');
|
|
1892
|
+
const { resolve } = await import('node:path');
|
|
1893
|
+
const src = readFileSync(resolve(__dirname, '..', 'internalization', 'trainer-runner.ts'), 'utf-8');
|
|
1894
|
+
expect(src).not.toContain('openclaw-plugin');
|
|
1895
|
+
expect(src).not.toContain('RolloutReviewerRunner');
|
|
1896
|
+
expect(src).not.toContain('nocturnal-trinity');
|
|
1897
|
+
expect(src).not.toContain('InternalizationOrchestrator');
|
|
1898
|
+
expect(src).not.toContain('createTask');
|
|
1899
|
+
expect(src).not.toContain('enqueueTask');
|
|
1900
|
+
});
|
|
1901
|
+
it('CORE_NO_SCHEDULING: trainer-runner.ts has no node:fs, node:cron imports', async () => {
|
|
1902
|
+
const { readFileSync } = await import('node:fs');
|
|
1903
|
+
const { resolve } = await import('node:path');
|
|
1904
|
+
const src = readFileSync(resolve(__dirname, '..', 'internalization', 'trainer-runner.ts'), 'utf-8');
|
|
1905
|
+
expect(src).not.toContain('node:fs');
|
|
1906
|
+
expect(src).not.toContain('node:cron');
|
|
1907
|
+
});
|
|
1908
|
+
it('BARREL_EXPORTS: internalization/index.ts exports TrainerRunner and TrainerOutput', async () => {
|
|
1909
|
+
const { readFileSync } = await import('node:fs');
|
|
1910
|
+
const { resolve } = await import('node:path');
|
|
1911
|
+
const src = readFileSync(resolve(__dirname, '..', 'internalization', 'index.ts'), 'utf-8');
|
|
1912
|
+
expect(src).toContain('TrainerRunner');
|
|
1913
|
+
expect(src).toContain('TrainerOutput');
|
|
1914
|
+
expect(src).toContain('DefaultTrainerValidator');
|
|
1915
|
+
});
|
|
1916
|
+
it('BARREL_EXPORTS: runtime-v2/index.ts exports TrainerRunner and TrainerOutput', async () => {
|
|
1917
|
+
const { readFileSync } = await import('node:fs');
|
|
1918
|
+
const { resolve } = await import('node:path');
|
|
1919
|
+
const src = readFileSync(resolve(__dirname, '..', 'index.ts'), 'utf-8');
|
|
1920
|
+
expect(src).toContain('TrainerRunner');
|
|
1921
|
+
expect(src).toContain('TrainerOutput');
|
|
1922
|
+
expect(src).toContain('DefaultTrainerValidator');
|
|
1923
|
+
});
|
|
1924
|
+
it('SCHEMA_REGISTRY: pi-ai-runtime-adapter.ts registers trainer-output-v1 schema', async () => {
|
|
1925
|
+
const { readFileSync } = await import('node:fs');
|
|
1926
|
+
const { resolve } = await import('node:path');
|
|
1927
|
+
const src = readFileSync(resolve(__dirname, '..', 'adapter', 'pi-ai-runtime-adapter.ts'), 'utf-8');
|
|
1928
|
+
expect(src).toContain('trainer-output-v1');
|
|
1929
|
+
expect(src).toContain('TrainerOutputV1Schema');
|
|
1930
|
+
});
|
|
1931
|
+
});
|
|
1932
|
+
describe('PRI-114: correction-proposal boundary', () => {
|
|
1933
|
+
it('CORE_PURE: correction-proposal.ts has zero infrastructure imports', async () => {
|
|
1934
|
+
const { readFileSync } = await import('node:fs');
|
|
1935
|
+
const { resolve } = await import('node:path');
|
|
1936
|
+
const src = readFileSync(resolve(__dirname, '..', 'internalization', 'correction-proposal.ts'), 'utf-8');
|
|
1937
|
+
expect(src).not.toContain('node:vm');
|
|
1938
|
+
expect(src).not.toContain('node:fs');
|
|
1939
|
+
expect(src).not.toContain('openclaw-plugin');
|
|
1940
|
+
expect(src).not.toContain('require(');
|
|
1941
|
+
});
|
|
1942
|
+
it('CONTRACT_IMPORT: rule-host-contracts.ts imports CorrectionProposal from same directory', async () => {
|
|
1943
|
+
const { readFileSync } = await import('node:fs');
|
|
1944
|
+
const { resolve } = await import('node:path');
|
|
1945
|
+
const src = readFileSync(resolve(__dirname, '..', 'internalization', 'rule-host-contracts.ts'), 'utf-8');
|
|
1946
|
+
expect(src).toContain("from './correction-proposal.js'");
|
|
1947
|
+
});
|
|
1948
|
+
it('EVALUATOR_IMPORT: rule-host-evaluator.ts imports validateCorrectionProposal from same directory', async () => {
|
|
1949
|
+
const { readFileSync } = await import('node:fs');
|
|
1950
|
+
const { resolve } = await import('node:path');
|
|
1951
|
+
const src = readFileSync(resolve(__dirname, '..', 'internalization', 'rule-host-evaluator.ts'), 'utf-8');
|
|
1952
|
+
expect(src).toContain("from './correction-proposal.js'");
|
|
1953
|
+
expect(src).toContain('validateCorrectionProposal');
|
|
1954
|
+
});
|
|
1955
|
+
it('BARREL_EXPORTS: runtime-v2/index.ts exports CorrectionProposal and validators', async () => {
|
|
1956
|
+
const { readFileSync } = await import('node:fs');
|
|
1957
|
+
const { resolve } = await import('node:path');
|
|
1958
|
+
const src = readFileSync(resolve(__dirname, '..', 'index.ts'), 'utf-8');
|
|
1959
|
+
expect(src).toContain('CorrectionProposal');
|
|
1960
|
+
expect(src).toContain('validateProposedParams');
|
|
1961
|
+
expect(src).toContain('validateCorrectionProposal');
|
|
1962
|
+
expect(src).toContain("from './internalization/correction-proposal.js'");
|
|
1963
|
+
});
|
|
1964
|
+
});
|
|
1965
|
+
// ── PRI-172: Refiner Sandbox Wrapper boundary ────────────────────────────
|
|
1966
|
+
describe('PRI-172: refiner-sandbox-wrapper boundary', () => {
|
|
1967
|
+
it('CORE_PURE: refiner-sandbox-wrapper.ts has zero infrastructure imports', async () => {
|
|
1968
|
+
const { readFileSync } = await import('node:fs');
|
|
1969
|
+
const { resolve } = await import('node:path');
|
|
1970
|
+
const src = readFileSync(resolve(__dirname, '..', 'internalization', 'refiner-sandbox-wrapper.ts'), 'utf-8');
|
|
1971
|
+
const importLines = src.split('\n').filter((line) => line.trim().startsWith('import'));
|
|
1972
|
+
const vmImports = importLines.filter((line) => line.includes('node:vm'));
|
|
1973
|
+
expect(vmImports).toEqual([]);
|
|
1974
|
+
const fsImports = importLines.filter((line) => line.includes('node:fs'));
|
|
1975
|
+
expect(fsImports).toEqual([]);
|
|
1976
|
+
expect(src).not.toContain('openclaw-plugin');
|
|
1977
|
+
expect(src).not.toContain('eval(');
|
|
1978
|
+
expect(src).not.toContain('new Function');
|
|
1979
|
+
});
|
|
1980
|
+
it('BARREL_EXPORTS: runtime-v2/index.ts exports RefinerSandboxResult and evaluateInRefinerSandbox', async () => {
|
|
1981
|
+
const { readFileSync } = await import('node:fs');
|
|
1982
|
+
const { resolve } = await import('node:path');
|
|
1983
|
+
const src = readFileSync(resolve(__dirname, '..', 'index.ts'), 'utf-8');
|
|
1984
|
+
expect(src).toContain('evaluateInRefinerSandbox');
|
|
1985
|
+
expect(src).toContain('RefinerSandboxResult');
|
|
1986
|
+
expect(src).toContain('RefinerSandboxFailedCase');
|
|
1987
|
+
expect(src).toContain("from './internalization/refiner-sandbox-wrapper.js'");
|
|
1988
|
+
});
|
|
1989
|
+
it('REUSES_REPLAY: refiner-sandbox-wrapper.ts imports ReplayEvaluateFn from replay validator', async () => {
|
|
1990
|
+
const { readFileSync } = await import('node:fs');
|
|
1991
|
+
const { resolve } = await import('node:path');
|
|
1992
|
+
const src = readFileSync(resolve(__dirname, '..', 'internalization', 'refiner-sandbox-wrapper.ts'), 'utf-8');
|
|
1993
|
+
expect(src).toContain("from '../golden-trace-replay-validator.js'");
|
|
1994
|
+
expect(src).toContain('ReplayEvaluateFn');
|
|
1995
|
+
});
|
|
1996
|
+
it('REUSES_FORBIDDEN: refiner-sandbox-wrapper.ts imports checkForbiddenPatterns from rule-code-validator', async () => {
|
|
1997
|
+
const { readFileSync } = await import('node:fs');
|
|
1998
|
+
const { resolve } = await import('node:path');
|
|
1999
|
+
const src = readFileSync(resolve(__dirname, '..', 'internalization', 'refiner-sandbox-wrapper.ts'), 'utf-8');
|
|
2000
|
+
expect(src).toContain("from './rule-code-validator.js'");
|
|
2001
|
+
expect(src).toContain('checkForbiddenPatterns');
|
|
2002
|
+
});
|
|
2003
|
+
});
|
|
2004
|
+
// ── PRI-173: Refiner RuleHost Gate boundary ────────────────────────────
|
|
2005
|
+
describe('PRI-173: refiner-rulehost-gate boundary', () => {
|
|
2006
|
+
it('CORE_PURE: refiner-rulehost-gate.ts has zero infrastructure imports', async () => {
|
|
2007
|
+
const { readFileSync } = await import('node:fs');
|
|
2008
|
+
const { resolve } = await import('node:path');
|
|
2009
|
+
const src = readFileSync(resolve(__dirname, '..', 'internalization', 'refiner-rulehost-gate.ts'), 'utf-8');
|
|
2010
|
+
expect(src).not.toContain('node:vm');
|
|
2011
|
+
expect(src).not.toContain('node:fs');
|
|
2012
|
+
expect(src).not.toContain('node:path');
|
|
2013
|
+
expect(src).not.toContain('node:process');
|
|
2014
|
+
expect(src).not.toContain('openclaw-plugin');
|
|
2015
|
+
expect(src).not.toContain('eval(');
|
|
2016
|
+
expect(src).not.toContain('new Function');
|
|
2017
|
+
});
|
|
2018
|
+
it('BARREL_EXPORTS: runtime-v2/index.ts exports evaluateRefinerRuleHostGate and types', async () => {
|
|
2019
|
+
const { readFileSync } = await import('node:fs');
|
|
2020
|
+
const { resolve } = await import('node:path');
|
|
2021
|
+
const src = readFileSync(resolve(__dirname, '..', 'index.ts'), 'utf-8');
|
|
2022
|
+
expect(src).toContain('evaluateRefinerRuleHostGate');
|
|
2023
|
+
expect(src).toContain('RefinerRuleHostGateDecision');
|
|
2024
|
+
expect(src).toContain('RefinerRuleHostGateInput');
|
|
2025
|
+
expect(src).toContain('RefinerRuleHostGateResult');
|
|
2026
|
+
expect(src).toContain("from './internalization/refiner-rulehost-gate.js'");
|
|
2027
|
+
});
|
|
2028
|
+
it('USES_SANDBOX: refiner-rulehost-gate.ts imports RefinerSandboxResult from refiner-sandbox-wrapper', async () => {
|
|
2029
|
+
const { readFileSync } = await import('node:fs');
|
|
2030
|
+
const { resolve } = await import('node:path');
|
|
2031
|
+
const src = readFileSync(resolve(__dirname, '..', 'internalization', 'refiner-rulehost-gate.ts'), 'utf-8');
|
|
2032
|
+
expect(src).toContain("from './refiner-sandbox-wrapper.js'");
|
|
2033
|
+
expect(src).toContain('RefinerSandboxResult');
|
|
2034
|
+
});
|
|
2035
|
+
});
|
|
2036
|
+
describe('PRI-146: RuleHostWriter shadow activation boundary', () => {
|
|
2037
|
+
it('CORE_PURE: rule-host-writer.ts has zero infrastructure imports', async () => {
|
|
2038
|
+
const { readFileSync } = await import('node:fs');
|
|
2039
|
+
const { resolve } = await import('node:path');
|
|
2040
|
+
const src = readFileSync(resolve(__dirname, '..', 'activation', 'writers', 'rule-host-writer.ts'), 'utf-8');
|
|
2041
|
+
expect(src).not.toContain('node:vm');
|
|
2042
|
+
expect(src).not.toContain('node:fs');
|
|
2043
|
+
expect(src).not.toContain('node:path');
|
|
2044
|
+
expect(src).not.toContain('node:process');
|
|
2045
|
+
expect(src).not.toContain('openclaw-plugin');
|
|
2046
|
+
expect(src).not.toContain('eval(');
|
|
2047
|
+
expect(src).not.toContain('new Function');
|
|
2048
|
+
});
|
|
2049
|
+
it('SHADOW_ONLY: rule-host-writer.ts does not implement live mode', async () => {
|
|
2050
|
+
const { readFileSync } = await import('node:fs');
|
|
2051
|
+
const { resolve } = await import('node:path');
|
|
2052
|
+
const src = readFileSync(resolve(__dirname, '..', 'activation', 'writers', 'rule-host-writer.ts'), 'utf-8');
|
|
2053
|
+
expect(src).not.toContain('code_tool_hook_live_activate');
|
|
2054
|
+
expect(src).toContain('code_tool_hook_shadow_activate');
|
|
2055
|
+
expect(src).toContain('accepted_shadow');
|
|
2056
|
+
});
|
|
2057
|
+
it('USES_GATE: rule-host-writer.ts imports evaluateRefinerRuleHostGate', async () => {
|
|
2058
|
+
const { readFileSync } = await import('node:fs');
|
|
2059
|
+
const { resolve } = await import('node:path');
|
|
2060
|
+
const src = readFileSync(resolve(__dirname, '..', 'activation', 'writers', 'rule-host-writer.ts'), 'utf-8');
|
|
2061
|
+
expect(src).toContain('evaluateRefinerRuleHostGate');
|
|
2062
|
+
expect(src).toContain("from '../../internalization/refiner-rulehost-gate.js'");
|
|
2063
|
+
});
|
|
2064
|
+
it('IMPLEMENTS_CHANNEL_WRITER: rule-host-writer.ts implements ChannelWriter interface', async () => {
|
|
2065
|
+
const { readFileSync } = await import('node:fs');
|
|
2066
|
+
const { resolve } = await import('node:path');
|
|
2067
|
+
const src = readFileSync(resolve(__dirname, '..', 'activation', 'writers', 'rule-host-writer.ts'), 'utf-8');
|
|
2068
|
+
expect(src).toContain('implements ChannelWriter');
|
|
2069
|
+
expect(src).toContain("channel = 'code_tool_hook'");
|
|
2070
|
+
});
|
|
2071
|
+
it('BARREL_EXPORTS: activation/index.ts exports RuleHostWriter', async () => {
|
|
2072
|
+
const { readFileSync } = await import('node:fs');
|
|
2073
|
+
const { resolve } = await import('node:path');
|
|
2074
|
+
const src = readFileSync(resolve(__dirname, '..', 'activation', 'index.ts'), 'utf-8');
|
|
2075
|
+
expect(src).toContain('RuleHostWriter');
|
|
2076
|
+
expect(src).toContain("from './writers/rule-host-writer.js'");
|
|
2077
|
+
});
|
|
2078
|
+
it('CHANNEL_MAP: code_tool_hook is in HIGH_RISK_CHANNEL_MAP', async () => {
|
|
2079
|
+
const { readFileSync } = await import('node:fs');
|
|
2080
|
+
const { resolve } = await import('node:path');
|
|
2081
|
+
const src = readFileSync(resolve(__dirname, '..', 'activation', 'activation-types.ts'), 'utf-8');
|
|
2082
|
+
expect(src).toContain("code_tool_hook: 'high'");
|
|
2083
|
+
});
|
|
2084
|
+
});
|
|
2085
|
+
// ── PRI-117: Nocturnal god-class freeze — no Runtime V2 → Nocturnal reverse imports ─
|
|
2086
|
+
describe('PRI-117 Nocturnal god-class freeze', () => {
|
|
2087
|
+
const NOCTURNAL_GOD_CLASSES = [
|
|
2088
|
+
'nocturnal-trinity',
|
|
2089
|
+
'nocturnal-service',
|
|
2090
|
+
'../core/nocturnal-trinity.js',
|
|
2091
|
+
'../service/nocturnal-service.js',
|
|
2092
|
+
'../../core/nocturnal-trinity.js',
|
|
2093
|
+
'../../service/nocturnal-service.js',
|
|
2094
|
+
];
|
|
2095
|
+
it('RUNTIME_V2_NO_NOCTURNAL_TRINITY_IMPORT: runtime-v2 must not import nocturnal-trinity', async () => {
|
|
2096
|
+
const { readdirSync, readFileSync } = await import('node:fs');
|
|
2097
|
+
const { resolve, join } = await import('node:path');
|
|
2098
|
+
const runtimeDir = resolve(__dirname, '..');
|
|
2099
|
+
const allFiles = [];
|
|
2100
|
+
function collectTsFiles(dir) {
|
|
2101
|
+
if (dir.includes('node_modules'))
|
|
2102
|
+
return;
|
|
2103
|
+
try {
|
|
2104
|
+
const entries = readdirSync(dir, { withFileTypes: true });
|
|
2105
|
+
for (const entry of entries) {
|
|
2106
|
+
const fullPath = join(dir, entry.name);
|
|
2107
|
+
if (entry.isDirectory()) {
|
|
2108
|
+
collectTsFiles(fullPath);
|
|
2109
|
+
}
|
|
2110
|
+
else if (entry.name.endsWith('.ts') && !entry.name.endsWith('.test.ts')) {
|
|
2111
|
+
allFiles.push(fullPath);
|
|
2112
|
+
}
|
|
2113
|
+
}
|
|
2114
|
+
}
|
|
2115
|
+
catch {
|
|
2116
|
+
// Skip inaccessible directories
|
|
2117
|
+
}
|
|
2118
|
+
}
|
|
2119
|
+
collectTsFiles(runtimeDir);
|
|
2120
|
+
for (const file of allFiles) {
|
|
2121
|
+
const src = readFileSync(file, 'utf-8');
|
|
2122
|
+
for (const badImport of NOCTURNAL_GOD_CLASSES) {
|
|
2123
|
+
expect(src).not.toContain(badImport);
|
|
2124
|
+
}
|
|
2125
|
+
}
|
|
2126
|
+
});
|
|
2127
|
+
it('OPENCLAW_TRINITY_RUNTIME_ADAPTER_IS_LEGACY: OpenClawTrinityRuntimeAdapter must not be referenced in runtime-v2', async () => {
|
|
2128
|
+
const { readdirSync, readFileSync } = await import('node:fs');
|
|
2129
|
+
const { resolve, join } = await import('node:path');
|
|
2130
|
+
const runtimeDir = resolve(__dirname, '..');
|
|
2131
|
+
const allFiles = [];
|
|
2132
|
+
function collectTsFiles(dir) {
|
|
2133
|
+
if (dir.includes('node_modules'))
|
|
2134
|
+
return;
|
|
2135
|
+
try {
|
|
2136
|
+
const entries = readdirSync(dir, { withFileTypes: true });
|
|
2137
|
+
for (const entry of entries) {
|
|
2138
|
+
const fullPath = join(dir, entry.name);
|
|
2139
|
+
if (entry.isDirectory()) {
|
|
2140
|
+
collectTsFiles(fullPath);
|
|
2141
|
+
}
|
|
2142
|
+
else if (entry.name.endsWith('.ts') && !entry.name.endsWith('.test.ts')) {
|
|
2143
|
+
allFiles.push(fullPath);
|
|
2144
|
+
}
|
|
2145
|
+
}
|
|
2146
|
+
}
|
|
2147
|
+
catch {
|
|
2148
|
+
// Skip inaccessible directories
|
|
2149
|
+
}
|
|
2150
|
+
}
|
|
2151
|
+
collectTsFiles(runtimeDir);
|
|
2152
|
+
for (const file of allFiles) {
|
|
2153
|
+
const src = readFileSync(file, 'utf-8');
|
|
2154
|
+
expect(src).not.toContain('OpenClawTrinityRuntimeAdapter');
|
|
2155
|
+
expect(src).not.toContain('TrinityRuntimeAdapter');
|
|
2156
|
+
expect(src).not.toContain('runTrinity');
|
|
2157
|
+
expect(src).not.toContain('runTrinityAsync');
|
|
2158
|
+
}
|
|
2159
|
+
});
|
|
2160
|
+
it('NOCTURNAL_TRINITY_STUBS_ARE_TEST_ONLY: invokeStub* functions must not appear in non-test runtime-v2 files', async () => {
|
|
2161
|
+
const { readdirSync, readFileSync } = await import('node:fs');
|
|
2162
|
+
const { resolve, join } = await import('node:path');
|
|
2163
|
+
const runtimeDir = resolve(__dirname, '..');
|
|
2164
|
+
const allFiles = [];
|
|
2165
|
+
function collectTsFiles(dir) {
|
|
2166
|
+
if (dir.includes('node_modules'))
|
|
2167
|
+
return;
|
|
2168
|
+
try {
|
|
2169
|
+
const entries = readdirSync(dir, { withFileTypes: true });
|
|
2170
|
+
for (const entry of entries) {
|
|
2171
|
+
const fullPath = join(dir, entry.name);
|
|
2172
|
+
if (entry.isDirectory()) {
|
|
2173
|
+
collectTsFiles(fullPath);
|
|
2174
|
+
}
|
|
2175
|
+
else if (entry.name.endsWith('.ts') && !entry.name.endsWith('.test.ts')) {
|
|
2176
|
+
allFiles.push(fullPath);
|
|
2177
|
+
}
|
|
2178
|
+
}
|
|
2179
|
+
}
|
|
2180
|
+
catch {
|
|
2181
|
+
// Skip inaccessible directories
|
|
2182
|
+
}
|
|
2183
|
+
}
|
|
2184
|
+
collectTsFiles(runtimeDir);
|
|
2185
|
+
for (const file of allFiles) {
|
|
2186
|
+
const src = readFileSync(file, 'utf-8');
|
|
2187
|
+
expect(src).not.toContain('invokeStubDreamer');
|
|
2188
|
+
expect(src).not.toContain('invokeStubPhilosopher');
|
|
2189
|
+
expect(src).not.toContain('invokeStubScribe');
|
|
2190
|
+
}
|
|
2191
|
+
});
|
|
2192
|
+
it('RUNTIME_V2_USES_PEER_RUNNERS: DreamerRunner/PhilosopherRunner/ScribeRunner are the canonical entry points', async () => {
|
|
2193
|
+
const { readFileSync } = await import('node:fs');
|
|
2194
|
+
const { resolve } = await import('node:path');
|
|
2195
|
+
const src = readFileSync(resolve(__dirname, '..', 'index.ts'), 'utf-8');
|
|
2196
|
+
expect(src).toContain('DreamerRunner');
|
|
2197
|
+
expect(src).toContain('PhilosopherRunner');
|
|
2198
|
+
expect(src).toContain('ScribeRunner');
|
|
2199
|
+
expect(src).toContain('ArtificerRunner');
|
|
2200
|
+
});
|
|
2201
|
+
});
|
|
2202
|
+
// ── Phase 2 Migration: Evolution Types ────────────────────────────────────────
|
|
2203
|
+
describe('Phase 2.1 evolution types migration', () => {
|
|
2204
|
+
const CORE_FILES = [
|
|
2205
|
+
'evolution/evolution-types.ts',
|
|
2206
|
+
'evolution/index.ts',
|
|
2207
|
+
];
|
|
2208
|
+
for (const file of CORE_FILES) {
|
|
2209
|
+
it(`core ${file} has zero infrastructure imports`, async () => {
|
|
2210
|
+
const { readFileSync } = await import('node:fs');
|
|
2211
|
+
const { resolve } = await import('node:path');
|
|
2212
|
+
const src = readFileSync(resolve(__dirname, '..', file), 'utf-8');
|
|
2213
|
+
expect(src).not.toContain('node:fs');
|
|
2214
|
+
expect(src).not.toContain('node:path');
|
|
2215
|
+
expect(src).not.toContain('openclaw-plugin');
|
|
2216
|
+
});
|
|
2217
|
+
}
|
|
2218
|
+
it('core barrel exports EvolutionTier, TIER_DEFINITIONS, getTierDefinition, getTierByPoints', async () => {
|
|
2219
|
+
const { readFileSync } = await import('node:fs');
|
|
2220
|
+
const { resolve } = await import('node:path');
|
|
2221
|
+
const src = readFileSync(resolve(__dirname, '..', 'index.ts'), 'utf-8');
|
|
2222
|
+
expect(src).toContain('EvolutionTier');
|
|
2223
|
+
expect(src).toContain('TIER_DEFINITIONS');
|
|
2224
|
+
expect(src).toContain('getTierDefinition');
|
|
2225
|
+
expect(src).toContain('getTierByPoints');
|
|
2226
|
+
expect(src).toContain("from './evolution/evolution-types.js'");
|
|
2227
|
+
});
|
|
2228
|
+
it('core barrel exports EvolutionPrinciple, EvolutionPrincipleStatus, EvolutionPainDetectedData', async () => {
|
|
2229
|
+
const { readFileSync } = await import('node:fs');
|
|
2230
|
+
const { resolve } = await import('node:path');
|
|
2231
|
+
const src = readFileSync(resolve(__dirname, '..', 'index.ts'), 'utf-8');
|
|
2232
|
+
expect(src).toContain('EvolutionPrinciple');
|
|
2233
|
+
expect(src).toContain('EvolutionPrincipleStatus');
|
|
2234
|
+
expect(src).toContain('EvolutionPainDetectedData');
|
|
2235
|
+
});
|
|
2236
|
+
it('plugin evolution-types.ts re-exports from core with backward-compatible aliases', async () => {
|
|
2237
|
+
const { readFileSync } = await import('node:fs');
|
|
2238
|
+
const { resolve } = await import('node:path');
|
|
2239
|
+
const src = readFileSync(resolve(__dirname, '../../../../openclaw-plugin/src/core/evolution-types.ts'), 'utf-8');
|
|
2240
|
+
expect(src).toContain("from '@principles/core/runtime-v2'");
|
|
2241
|
+
expect(src).toContain('EvolutionTier');
|
|
2242
|
+
expect(src).toContain('EvolutionPrinciple');
|
|
2243
|
+
expect(src).toContain('type Principle = EvolutionPrinciple');
|
|
2244
|
+
expect(src).toContain('type PrincipleStatus = EvolutionPrincipleStatus');
|
|
2245
|
+
expect(src).toContain('type PainDetectedData = EvolutionPainDetectedData');
|
|
2246
|
+
});
|
|
2247
|
+
it('plugin evolution-types.ts does NOT define EvolutionTier or TIER_DEFINITIONS locally', async () => {
|
|
2248
|
+
const { readFileSync } = await import('node:fs');
|
|
2249
|
+
const { resolve } = await import('node:path');
|
|
2250
|
+
const src = readFileSync(resolve(__dirname, '../../../../openclaw-plugin/src/core/evolution-types.ts'), 'utf-8');
|
|
2251
|
+
expect(src).not.toMatch(/^export enum EvolutionTier/m);
|
|
2252
|
+
expect(src).not.toMatch(/^export const TIER_DEFINITIONS/m);
|
|
2253
|
+
});
|
|
2254
|
+
});
|
|
2255
|
+
// ── Phase 2 Migration: Correction Types ───────────────────────────────────────
|
|
2256
|
+
describe('Phase 2.2 correction types migration', () => {
|
|
2257
|
+
const CORE_FILES = [
|
|
2258
|
+
'correction/correction-types.ts',
|
|
2259
|
+
'correction/index.ts',
|
|
2260
|
+
];
|
|
2261
|
+
for (const file of CORE_FILES) {
|
|
2262
|
+
it(`core ${file} has zero infrastructure imports`, async () => {
|
|
2263
|
+
const { readFileSync } = await import('node:fs');
|
|
2264
|
+
const { resolve } = await import('node:path');
|
|
2265
|
+
const src = readFileSync(resolve(__dirname, '..', file), 'utf-8');
|
|
2266
|
+
expect(src).not.toContain('node:fs');
|
|
2267
|
+
expect(src).not.toContain('node:path');
|
|
2268
|
+
expect(src).not.toContain('openclaw-plugin');
|
|
2269
|
+
});
|
|
2270
|
+
}
|
|
2271
|
+
it('core barrel exports CorrectionKeyword, CorrectionKeywordStore, MAX_CORRECTION_KEYWORDS', async () => {
|
|
2272
|
+
const { readFileSync } = await import('node:fs');
|
|
2273
|
+
const { resolve } = await import('node:path');
|
|
2274
|
+
const src = readFileSync(resolve(__dirname, '..', 'index.ts'), 'utf-8');
|
|
2275
|
+
expect(src).toContain('CorrectionKeyword');
|
|
2276
|
+
expect(src).toContain('CorrectionKeywordStore');
|
|
2277
|
+
expect(src).toContain('MAX_CORRECTION_KEYWORDS');
|
|
2278
|
+
expect(src).toContain("from './correction/correction-types.js'");
|
|
2279
|
+
});
|
|
2280
|
+
it('plugin correction-types.ts re-exports from core', async () => {
|
|
2281
|
+
const { readFileSync } = await import('node:fs');
|
|
2282
|
+
const { resolve } = await import('node:path');
|
|
2283
|
+
const src = readFileSync(resolve(__dirname, '../../../../openclaw-plugin/src/core/correction-types.ts'), 'utf-8');
|
|
2284
|
+
expect(src).toContain("from '@principles/core/runtime-v2'");
|
|
2285
|
+
expect(src).toContain('CorrectionKeyword');
|
|
2286
|
+
expect(src).toContain('MAX_CORRECTION_KEYWORDS');
|
|
2287
|
+
});
|
|
2288
|
+
it('plugin correction-types.ts does NOT define CorrectionKeyword interface locally', async () => {
|
|
2289
|
+
const { readFileSync } = await import('node:fs');
|
|
2290
|
+
const { resolve } = await import('node:path');
|
|
2291
|
+
const src = readFileSync(resolve(__dirname, '../../../../openclaw-plugin/src/core/correction-types.ts'), 'utf-8');
|
|
2292
|
+
expect(src).not.toMatch(/^export interface CorrectionKeyword/m);
|
|
2293
|
+
});
|
|
2294
|
+
});
|
|
2295
|
+
// ── Phase 2 Migration: Types Directory (queue, hygiene, runtime-summary, events) ──
|
|
2296
|
+
describe('Phase 2.4 types directory migration', () => {
|
|
2297
|
+
const CORE_TYPE_FILES = [
|
|
2298
|
+
'types/queue-types.ts',
|
|
2299
|
+
'types/hygiene-types.ts',
|
|
2300
|
+
'types/runtime-summary-types.ts',
|
|
2301
|
+
'types/event-types.ts',
|
|
2302
|
+
'types/event-payload.ts',
|
|
2303
|
+
];
|
|
2304
|
+
for (const file of CORE_TYPE_FILES) {
|
|
2305
|
+
it(`core ${file} has zero infrastructure imports`, async () => {
|
|
2306
|
+
const { readFileSync } = await import('node:fs');
|
|
2307
|
+
const { resolve } = await import('node:path');
|
|
2308
|
+
const src = readFileSync(resolve(__dirname, '..', file), 'utf-8');
|
|
2309
|
+
expect(src).not.toContain('node:fs');
|
|
2310
|
+
expect(src).not.toContain('node:path');
|
|
2311
|
+
expect(src).not.toContain('openclaw-plugin');
|
|
2312
|
+
});
|
|
2313
|
+
}
|
|
2314
|
+
it('core barrel exports QueueItemId, WorkflowId, SessionKey brand types', async () => {
|
|
2315
|
+
const { readFileSync } = await import('node:fs');
|
|
2316
|
+
const { resolve } = await import('node:path');
|
|
2317
|
+
const src = readFileSync(resolve(__dirname, '..', 'index.ts'), 'utf-8');
|
|
2318
|
+
expect(src).toContain('QueueItemId');
|
|
2319
|
+
expect(src).toContain('WorkflowId');
|
|
2320
|
+
expect(src).toContain('SessionKey');
|
|
2321
|
+
expect(src).toContain("from './types/queue-types.js'");
|
|
2322
|
+
});
|
|
2323
|
+
it('core barrel exports HygieneStats, createEmptyHygieneStats', async () => {
|
|
2324
|
+
const { readFileSync } = await import('node:fs');
|
|
2325
|
+
const { resolve } = await import('node:path');
|
|
2326
|
+
const src = readFileSync(resolve(__dirname, '..', 'index.ts'), 'utf-8');
|
|
2327
|
+
expect(src).toContain('HygieneStats');
|
|
2328
|
+
expect(src).toContain('createEmptyHygieneStats');
|
|
2329
|
+
expect(src).toContain("from './types/hygiene-types.js'");
|
|
2330
|
+
});
|
|
2331
|
+
it('core barrel exports RuntimeTruth, TrendMetrics', async () => {
|
|
2332
|
+
const { readFileSync } = await import('node:fs');
|
|
2333
|
+
const { resolve } = await import('node:path');
|
|
2334
|
+
const src = readFileSync(resolve(__dirname, '..', 'index.ts'), 'utf-8');
|
|
2335
|
+
expect(src).toContain('RuntimeTruth');
|
|
2336
|
+
expect(src).toContain('TrendMetrics');
|
|
2337
|
+
expect(src).toContain("from './types/runtime-summary-types.js'");
|
|
2338
|
+
});
|
|
2339
|
+
it('core barrel exports EventType, EventLogEntry, EventEvolutionStats', async () => {
|
|
2340
|
+
const { readFileSync } = await import('node:fs');
|
|
2341
|
+
const { resolve } = await import('node:path');
|
|
2342
|
+
const src = readFileSync(resolve(__dirname, '..', 'index.ts'), 'utf-8');
|
|
2343
|
+
expect(src).toContain('EventType');
|
|
2344
|
+
expect(src).toContain('EventLogEntry');
|
|
2345
|
+
expect(src).toContain('EventEvolutionStats');
|
|
2346
|
+
expect(src).toContain("from './types/event-types.js'");
|
|
2347
|
+
});
|
|
2348
|
+
it('core barrel exports DiscriminatedEventLogEntry, isToolCallEventEntry', async () => {
|
|
2349
|
+
const { readFileSync } = await import('node:fs');
|
|
2350
|
+
const { resolve } = await import('node:path');
|
|
2351
|
+
const src = readFileSync(resolve(__dirname, '..', 'index.ts'), 'utf-8');
|
|
2352
|
+
expect(src).toContain('DiscriminatedEventLogEntry');
|
|
2353
|
+
expect(src).toContain('isToolCallEventEntry');
|
|
2354
|
+
expect(src).toContain("from './types/event-payload.js'");
|
|
2355
|
+
});
|
|
2356
|
+
it('plugin types/queue.ts re-exports from core', async () => {
|
|
2357
|
+
const { readFileSync } = await import('node:fs');
|
|
2358
|
+
const { resolve } = await import('node:path');
|
|
2359
|
+
const src = readFileSync(resolve(__dirname, '../../../../openclaw-plugin/src/types/queue.ts'), 'utf-8');
|
|
2360
|
+
expect(src).toContain("@principles/core/runtime-v2");
|
|
2361
|
+
});
|
|
2362
|
+
it('plugin types/hygiene-types.ts re-exports from core', async () => {
|
|
2363
|
+
const { readFileSync } = await import('node:fs');
|
|
2364
|
+
const { resolve } = await import('node:path');
|
|
2365
|
+
const src = readFileSync(resolve(__dirname, '../../../../openclaw-plugin/src/types/hygiene-types.ts'), 'utf-8');
|
|
2366
|
+
expect(src).toContain("@principles/core/runtime-v2");
|
|
2367
|
+
});
|
|
2368
|
+
it('plugin types/runtime-summary.ts re-exports from core', async () => {
|
|
2369
|
+
const { readFileSync } = await import('node:fs');
|
|
2370
|
+
const { resolve } = await import('node:path');
|
|
2371
|
+
const src = readFileSync(resolve(__dirname, '../../../../openclaw-plugin/src/types/runtime-summary.ts'), 'utf-8');
|
|
2372
|
+
expect(src).toContain("@principles/core/runtime-v2");
|
|
2373
|
+
});
|
|
2374
|
+
it('plugin types/event-types.ts re-exports from core', async () => {
|
|
2375
|
+
const { readFileSync } = await import('node:fs');
|
|
2376
|
+
const { resolve } = await import('node:path');
|
|
2377
|
+
const src = readFileSync(resolve(__dirname, '../../../../openclaw-plugin/src/types/event-types.ts'), 'utf-8');
|
|
2378
|
+
expect(src).toContain("@principles/core/runtime-v2");
|
|
2379
|
+
});
|
|
2380
|
+
it('plugin types/event-payload.ts re-exports from core', async () => {
|
|
2381
|
+
const { readFileSync } = await import('node:fs');
|
|
2382
|
+
const { resolve } = await import('node:path');
|
|
2383
|
+
const src = readFileSync(resolve(__dirname, '../../../../openclaw-plugin/src/types/event-payload.ts'), 'utf-8');
|
|
2384
|
+
expect(src).toContain("@principles/core/runtime-v2");
|
|
2385
|
+
});
|
|
2386
|
+
});
|
|
2387
|
+
// ── Phase 2 Migration: Principle-Tree Data Structures ─────────────────────────
|
|
2388
|
+
describe('Phase 2.6 principle-tree data structures migration', () => {
|
|
2389
|
+
const CORE_TYPE_FILES = [
|
|
2390
|
+
'types/principle-dependency.ts',
|
|
2391
|
+
'types/principle-value-metrics.ts',
|
|
2392
|
+
'types/principle-lifecycle-event.ts',
|
|
2393
|
+
'types/principle-tree-store.ts',
|
|
2394
|
+
];
|
|
2395
|
+
for (const file of CORE_TYPE_FILES) {
|
|
2396
|
+
it(`core ${file} has zero infrastructure imports`, async () => {
|
|
2397
|
+
const { readFileSync } = await import('node:fs');
|
|
2398
|
+
const { resolve } = await import('node:path');
|
|
2399
|
+
const src = readFileSync(resolve(__dirname, '..', file), 'utf-8');
|
|
2400
|
+
expect(src).not.toContain('node:fs');
|
|
2401
|
+
expect(src).not.toContain('node:path');
|
|
2402
|
+
expect(src).not.toContain('openclaw-plugin');
|
|
2403
|
+
});
|
|
2404
|
+
}
|
|
2405
|
+
it('core barrel exports PrincipleDependency, PrincipleValueMetrics, PrincipleLifecycleEvent, PrincipleTreeStore', async () => {
|
|
2406
|
+
const { readFileSync } = await import('node:fs');
|
|
2407
|
+
const { resolve } = await import('node:path');
|
|
2408
|
+
const src = readFileSync(resolve(__dirname, '..', 'index.ts'), 'utf-8');
|
|
2409
|
+
expect(src).toContain('PrincipleDependency');
|
|
2410
|
+
expect(src).toContain('PrincipleValueMetrics');
|
|
2411
|
+
expect(src).toContain('PrincipleLifecycleEvent');
|
|
2412
|
+
expect(src).toContain('PrincipleTreeStore');
|
|
2413
|
+
});
|
|
2414
|
+
it('plugin principle-tree-schema.ts re-exports PrincipleDependency, PrincipleValueMetrics, PrincipleLifecycleEvent, PrincipleTreeStore from core', async () => {
|
|
2415
|
+
const { readFileSync } = await import('node:fs');
|
|
2416
|
+
const { resolve } = await import('node:path');
|
|
2417
|
+
const src = readFileSync(resolve(__dirname, '../../../../openclaw-plugin/src/types/principle-tree-schema.ts'), 'utf-8');
|
|
2418
|
+
expect(src).toContain("from '@principles/core/runtime-v2'");
|
|
2419
|
+
expect(src).toContain('PrincipleDependency');
|
|
2420
|
+
expect(src).toContain('PrincipleValueMetrics');
|
|
2421
|
+
expect(src).toContain('PrincipleLifecycleEvent');
|
|
2422
|
+
expect(src).toContain('PrincipleTreeStore');
|
|
2423
|
+
});
|
|
2424
|
+
it('plugin principle-tree-schema.ts does NOT define PrincipleDependency or PrincipleTreeStore locally', async () => {
|
|
2425
|
+
const { readFileSync } = await import('node:fs');
|
|
2426
|
+
const { resolve } = await import('node:path');
|
|
2427
|
+
const src = readFileSync(resolve(__dirname, '../../../../openclaw-plugin/src/types/principle-tree-schema.ts'), 'utf-8');
|
|
2428
|
+
expect(src).not.toMatch(/^export interface PrincipleDependency/m);
|
|
2429
|
+
expect(src).not.toMatch(/^export interface PrincipleTreeStore/m);
|
|
2430
|
+
});
|
|
2431
|
+
});
|
|
2432
|
+
// ── PRI-141: Task Three Strikes Out Mechanism ──────────────────────────────────
|
|
2433
|
+
describe('PRI-141 Task Three Strikes Out Mechanism', () => {
|
|
2434
|
+
it('core barrel exports isUnresolvable, recordRejection, DEFAULT_UNRESOLVABLE_THRESHOLD', async () => {
|
|
2435
|
+
const { readFileSync } = await import('node:fs');
|
|
2436
|
+
const { resolve } = await import('node:path');
|
|
2437
|
+
const src = readFileSync(resolve(__dirname, '..', 'index.ts'), 'utf-8');
|
|
2438
|
+
expect(src).toContain('isUnresolvable');
|
|
2439
|
+
expect(src).toContain('recordRejection');
|
|
2440
|
+
expect(src).toContain('DEFAULT_UNRESOLVABLE_THRESHOLD');
|
|
2441
|
+
});
|
|
2442
|
+
it('core barrel exports UnresolvableSample type', async () => {
|
|
2443
|
+
const { readFileSync } = await import('node:fs');
|
|
2444
|
+
const { resolve } = await import('node:path');
|
|
2445
|
+
const src = readFileSync(resolve(__dirname, '..', 'index.ts'), 'utf-8');
|
|
2446
|
+
expect(src).toContain('UnresolvableSample');
|
|
2447
|
+
});
|
|
2448
|
+
it('internalization-task-guards.ts has zero infrastructure imports', async () => {
|
|
2449
|
+
const { readFileSync } = await import('node:fs');
|
|
2450
|
+
const { resolve } = await import('node:path');
|
|
2451
|
+
const src = readFileSync(resolve(__dirname, '..', 'internalization', 'internalization-task-guards.ts'), 'utf-8');
|
|
2452
|
+
expect(src).not.toContain('node:fs');
|
|
2453
|
+
expect(src).not.toContain('node:path');
|
|
2454
|
+
expect(src).not.toContain('openclaw-plugin');
|
|
2455
|
+
expect(src).not.toContain('node:cron');
|
|
2456
|
+
});
|
|
2457
|
+
it('PITaskRecord includes rejectionCount field', async () => {
|
|
2458
|
+
const { readFileSync } = await import('node:fs');
|
|
2459
|
+
const { resolve } = await import('node:path');
|
|
2460
|
+
const src = readFileSync(resolve(__dirname, '..', 'internalization', 'peer-runner-contracts.ts'), 'utf-8');
|
|
2461
|
+
expect(src).toContain('rejectionCount');
|
|
2462
|
+
});
|
|
2463
|
+
it('PITaskMetadata includes rejectionCount field', async () => {
|
|
2464
|
+
const { readFileSync } = await import('node:fs');
|
|
2465
|
+
const { resolve } = await import('node:path');
|
|
2466
|
+
const src = readFileSync(resolve(__dirname, '..', 'internalization', 'pitask-metadata.ts'), 'utf-8');
|
|
2467
|
+
expect(src).toContain('rejectionCount');
|
|
2468
|
+
});
|
|
2469
|
+
});
|
|
2470
|
+
// ── PRI-139: L1 Hard Cap & LRU Eviction ──────────────────────────────────────
|
|
2471
|
+
describe('PRI-139 L1 Hard Cap & LRU Eviction', () => {
|
|
2472
|
+
it('core barrel exports enforceL1HardCap, validateL1CapConfig, DEFAULT_L1_HARD_CAP, MAX_L1_HARD_CAP', async () => {
|
|
2473
|
+
const { readFileSync } = await import('node:fs');
|
|
2474
|
+
const { resolve } = await import('node:path');
|
|
2475
|
+
const src = readFileSync(resolve(__dirname, '..', 'index.ts'), 'utf-8');
|
|
2476
|
+
expect(src).toContain('enforceL1HardCap');
|
|
2477
|
+
expect(src).toContain('validateL1CapConfig');
|
|
2478
|
+
expect(src).toContain('DEFAULT_L1_HARD_CAP');
|
|
2479
|
+
expect(src).toContain('MAX_L1_HARD_CAP');
|
|
2480
|
+
});
|
|
2481
|
+
it('core barrel exports L1CapConfig, L1EvictionCandidate, L1EvictionResult types', async () => {
|
|
2482
|
+
const { readFileSync } = await import('node:fs');
|
|
2483
|
+
const { resolve } = await import('node:path');
|
|
2484
|
+
const src = readFileSync(resolve(__dirname, '..', 'index.ts'), 'utf-8');
|
|
2485
|
+
expect(src).toContain('L1CapConfig');
|
|
2486
|
+
expect(src).toContain('L1EvictionCandidate');
|
|
2487
|
+
expect(src).toContain('L1EvictionResult');
|
|
2488
|
+
});
|
|
2489
|
+
it('l1-hard-cap.ts has zero infrastructure imports', async () => {
|
|
2490
|
+
const { readFileSync } = await import('node:fs');
|
|
2491
|
+
const { resolve } = await import('node:path');
|
|
2492
|
+
const src = readFileSync(resolve(__dirname, '..', 'l1-hard-cap.ts'), 'utf-8');
|
|
2493
|
+
expect(src).not.toContain('node:fs');
|
|
2494
|
+
expect(src).not.toContain('node:path');
|
|
2495
|
+
expect(src).not.toContain('openclaw-plugin');
|
|
2496
|
+
});
|
|
2497
|
+
it('LedgerPrinciple includes lastTriggeredAt field', async () => {
|
|
2498
|
+
const { readFileSync } = await import('node:fs');
|
|
2499
|
+
const { resolve } = await import('node:path');
|
|
2500
|
+
const src = readFileSync(resolve(__dirname, '..', '..', 'principle-tree-ledger.ts'), 'utf-8');
|
|
2501
|
+
expect(src).toContain('lastTriggeredAt');
|
|
2502
|
+
});
|
|
2503
|
+
it('PruningHealthSummary includes activeL1Count and l1Cap fields', async () => {
|
|
2504
|
+
const { readFileSync } = await import('node:fs');
|
|
2505
|
+
const { resolve } = await import('node:path');
|
|
2506
|
+
const src = readFileSync(resolve(__dirname, '..', 'pruning-read-model.ts'), 'utf-8');
|
|
2507
|
+
expect(src).toContain('activeL1Count');
|
|
2508
|
+
expect(src).toContain('l1Cap');
|
|
2509
|
+
});
|
|
2510
|
+
});
|
|
2511
|
+
// ── PRI-142: IntakeToInternalizationBridge ──────────────────────────────────────
|
|
2512
|
+
describe('PRI-142 IntakeToInternalizationBridge', () => {
|
|
2513
|
+
it('core barrel exports computeBridgeDecision, buildDreamerTaskSeed, seedIntakeTask, ROUTE_CHANNEL_MAP', async () => {
|
|
2514
|
+
const { readFileSync } = await import('node:fs');
|
|
2515
|
+
const { resolve } = await import('node:path');
|
|
2516
|
+
const src = readFileSync(resolve(__dirname, '..', 'index.ts'), 'utf-8');
|
|
2517
|
+
expect(src).toContain('computeBridgeDecision');
|
|
2518
|
+
expect(src).toContain('buildDreamerTaskSeed');
|
|
2519
|
+
expect(src).toContain('seedIntakeTask');
|
|
2520
|
+
expect(src).toContain('ROUTE_CHANNEL_MAP');
|
|
2521
|
+
});
|
|
2522
|
+
it('core barrel exports IntakeToInternalizationBridgeInput, BridgeDecision, BridgeTaskSeed, BridgeTaskStore types', async () => {
|
|
2523
|
+
const { readFileSync } = await import('node:fs');
|
|
2524
|
+
const { resolve } = await import('node:path');
|
|
2525
|
+
const src = readFileSync(resolve(__dirname, '..', 'index.ts'), 'utf-8');
|
|
2526
|
+
expect(src).toContain('IntakeToInternalizationBridgeInput');
|
|
2527
|
+
expect(src).toContain('BridgeDecision');
|
|
2528
|
+
expect(src).toContain('BridgeTaskSeed');
|
|
2529
|
+
expect(src).toContain('BridgeTaskStore');
|
|
2530
|
+
});
|
|
2531
|
+
it('intake-to-internalization-bridge.ts has zero infrastructure imports', async () => {
|
|
2532
|
+
const { readFileSync } = await import('node:fs');
|
|
2533
|
+
const { resolve } = await import('node:path');
|
|
2534
|
+
const src = readFileSync(resolve(__dirname, '..', 'internalization', 'intake-to-internalization-bridge.ts'), 'utf-8');
|
|
2535
|
+
expect(src).not.toContain('node:fs');
|
|
2536
|
+
expect(src).not.toContain('node:path');
|
|
2537
|
+
expect(src).not.toContain('node:process');
|
|
2538
|
+
expect(src).not.toContain('openclaw-plugin');
|
|
2539
|
+
});
|
|
2540
|
+
it('internalization/index.ts exports bridge symbols', async () => {
|
|
2541
|
+
const { readFileSync } = await import('node:fs');
|
|
2542
|
+
const { resolve } = await import('node:path');
|
|
2543
|
+
const src = readFileSync(resolve(__dirname, '..', 'internalization', 'index.ts'), 'utf-8');
|
|
2544
|
+
expect(src).toContain('computeBridgeDecision');
|
|
2545
|
+
expect(src).toContain('buildDreamerTaskSeed');
|
|
2546
|
+
expect(src).toContain('seedIntakeTask');
|
|
2547
|
+
expect(src).toContain('ROUTE_CHANNEL_MAP');
|
|
2548
|
+
expect(src).toContain('IntakeToInternalizationBridgeInput');
|
|
2549
|
+
expect(src).toContain('BridgeDecision');
|
|
2550
|
+
expect(src).toContain('BridgeTaskSeed');
|
|
2551
|
+
expect(src).toContain('BridgeTaskStore');
|
|
2552
|
+
});
|
|
2553
|
+
});
|
|
2554
|
+
// ── PRI-144: ActivationDispatcher & Low-risk Writers ──────────────────────────
|
|
2555
|
+
describe('PRI-144 ActivationDispatcher & Low-risk Writers', () => {
|
|
2556
|
+
it('core barrel exports ActivationDispatcher, PromptWriter, DeferArchiveWriter, LOW_RISK_CHANNELS, makeIdempotencyKey, isLowRiskChannel, getChannelRiskLevel', async () => {
|
|
2557
|
+
const { readFileSync } = await import('node:fs');
|
|
2558
|
+
const { resolve } = await import('node:path');
|
|
2559
|
+
const src = readFileSync(resolve(__dirname, '..', 'index.ts'), 'utf-8');
|
|
2560
|
+
expect(src).toContain('ActivationDispatcher');
|
|
2561
|
+
expect(src).toContain('PromptWriter');
|
|
2562
|
+
expect(src).toContain('DeferArchiveWriter');
|
|
2563
|
+
expect(src).toContain('LOW_RISK_CHANNELS');
|
|
2564
|
+
expect(src).toContain('makeIdempotencyKey');
|
|
2565
|
+
expect(src).toContain('isLowRiskChannel');
|
|
2566
|
+
expect(src).toContain('getChannelRiskLevel');
|
|
2567
|
+
});
|
|
2568
|
+
it('core barrel exports ActivationDecision, DispatchInput, PIArtifactSnapshot, ChannelWriter types', async () => {
|
|
2569
|
+
const { readFileSync } = await import('node:fs');
|
|
2570
|
+
const { resolve } = await import('node:path');
|
|
2571
|
+
const src = readFileSync(resolve(__dirname, '..', 'index.ts'), 'utf-8');
|
|
2572
|
+
expect(src).toContain('ActivationDecision');
|
|
2573
|
+
expect(src).toContain('DispatchInput');
|
|
2574
|
+
expect(src).toContain('PIArtifactSnapshot');
|
|
2575
|
+
expect(src).toContain('ChannelWriter');
|
|
2576
|
+
});
|
|
2577
|
+
it('activation core files have zero infrastructure imports', async () => {
|
|
2578
|
+
const { readFileSync } = await import('node:fs');
|
|
2579
|
+
const { resolve } = await import('node:path');
|
|
2580
|
+
const files = [
|
|
2581
|
+
resolve(__dirname, '..', 'activation', 'activation-types.ts'),
|
|
2582
|
+
resolve(__dirname, '..', 'activation', 'activation-dispatcher.ts'),
|
|
2583
|
+
resolve(__dirname, '..', 'activation', 'low-risk-writers.ts'),
|
|
2584
|
+
resolve(__dirname, '..', 'activation', 'index.ts'),
|
|
2585
|
+
resolve(__dirname, '..', 'activation', 'approval-queue.ts'),
|
|
2586
|
+
resolve(__dirname, '..', 'activation', 'memory-approval-store.ts'),
|
|
2587
|
+
resolve(__dirname, '..', 'activation', 'sqlite-approval-store.ts'),
|
|
2588
|
+
];
|
|
2589
|
+
for (const file of files) {
|
|
2590
|
+
const src = readFileSync(file, 'utf-8');
|
|
2591
|
+
expect(src).not.toContain('node:fs');
|
|
2592
|
+
expect(src).not.toContain('node:path');
|
|
2593
|
+
expect(src).not.toContain('node:process');
|
|
2594
|
+
expect(src).not.toContain('openclaw-plugin');
|
|
2595
|
+
}
|
|
2596
|
+
});
|
|
2597
|
+
it('activation/index.ts exports all public symbols', async () => {
|
|
2598
|
+
const { readFileSync } = await import('node:fs');
|
|
2599
|
+
const { resolve } = await import('node:path');
|
|
2600
|
+
const src = readFileSync(resolve(__dirname, '..', 'activation', 'index.ts'), 'utf-8');
|
|
2601
|
+
expect(src).toContain('ActivationDispatcher');
|
|
2602
|
+
expect(src).toContain('PromptWriter');
|
|
2603
|
+
expect(src).toContain('DeferArchiveWriter');
|
|
2604
|
+
expect(src).toContain('LOW_RISK_CHANNELS');
|
|
2605
|
+
expect(src).toContain('makeIdempotencyKey');
|
|
2606
|
+
expect(src).toContain('isLowRiskChannel');
|
|
2607
|
+
expect(src).toContain('getChannelRiskLevel');
|
|
2608
|
+
expect(src).toContain('MemoryActivationStateStore');
|
|
2609
|
+
expect(src).toContain('MemoryArtifactReadModel');
|
|
2610
|
+
expect(src).toContain('ApprovalQueue');
|
|
2611
|
+
expect(src).toContain('decideAutoPromotion');
|
|
2612
|
+
expect(src).toContain('MemoryApprovalQueueStore');
|
|
2613
|
+
expect(src).toContain('SqliteApprovalQueueStore');
|
|
2614
|
+
expect(src).toContain('ApprovalQueueStore');
|
|
2615
|
+
expect(src).toContain('AUTO_PROMOTION_CONFIDENCE_THRESHOLD');
|
|
2616
|
+
expect(src).toContain('AUTO_PROMOTABLE_CHANNELS');
|
|
2617
|
+
});
|
|
2618
|
+
});
|
|
2619
|
+
// ── PRI-189: SourceTraceLocator contract boundary ──────────────────────────────
|
|
2620
|
+
describe('PRI-189 SourceTraceLocator contract boundary', () => {
|
|
2621
|
+
it('source-trace-locator.ts has zero infrastructure imports', async () => {
|
|
2622
|
+
const { readFileSync } = await import('node:fs');
|
|
2623
|
+
const { resolve } = await import('node:path');
|
|
2624
|
+
const src = readFileSync(resolve(__dirname, '..', 'store', 'trajectory', 'source-trace-locator.ts'), 'utf-8');
|
|
2625
|
+
expect(src).not.toContain('node:fs');
|
|
2626
|
+
expect(src).not.toContain('node:path');
|
|
2627
|
+
expect(src).not.toContain('node:process');
|
|
2628
|
+
expect(src).not.toContain('openclaw-plugin');
|
|
2629
|
+
});
|
|
2630
|
+
it('sqlite-source-trace-locator.ts has zero infrastructure imports', async () => {
|
|
2631
|
+
const { readFileSync } = await import('node:fs');
|
|
2632
|
+
const { resolve } = await import('node:path');
|
|
2633
|
+
const src = readFileSync(resolve(__dirname, '..', 'store', 'trajectory', 'sqlite-source-trace-locator.ts'), 'utf-8');
|
|
2634
|
+
expect(src).not.toContain('node:fs');
|
|
2635
|
+
expect(src).not.toContain('node:path');
|
|
2636
|
+
expect(src).not.toContain('node:process');
|
|
2637
|
+
expect(src).not.toContain('openclaw-plugin');
|
|
2638
|
+
});
|
|
2639
|
+
it('core barrel exports SourceTraceLocator and SqliteSourceTraceLocator', async () => {
|
|
2640
|
+
const { readFileSync } = await import('node:fs');
|
|
2641
|
+
const { resolve } = await import('node:path');
|
|
2642
|
+
const src = readFileSync(resolve(__dirname, '..', 'index.ts'), 'utf-8');
|
|
2643
|
+
expect(src).toContain('SourceTraceLocator');
|
|
2644
|
+
expect(src).toContain('SqliteSourceTraceLocator');
|
|
2645
|
+
expect(src).toContain('SourceTraceLocateDecision');
|
|
2646
|
+
expect(src).toContain('SourceTraceCandidate');
|
|
2647
|
+
});
|
|
2648
|
+
it('store/trajectory/index.ts re-exports SourceTraceLocator + SqliteSourceTraceLocator', async () => {
|
|
2649
|
+
const { existsSync, readFileSync } = await import('node:fs');
|
|
2650
|
+
const { resolve } = await import('node:path');
|
|
2651
|
+
const indexPath = resolve(__dirname, '..', 'store', 'trajectory', 'index.ts');
|
|
2652
|
+
expect(existsSync(indexPath)).toBe(true);
|
|
2653
|
+
const src = readFileSync(indexPath, 'utf-8');
|
|
2654
|
+
expect(src).toContain('SourceTraceLocator');
|
|
2655
|
+
expect(src).toContain('SqliteSourceTraceLocator');
|
|
2656
|
+
});
|
|
2657
|
+
});
|
|
2658
|
+
describe('PRI-190 FullTrace quality contract boundary', () => {
|
|
2659
|
+
it('full-trace-contract.ts has zero infrastructure imports', async () => {
|
|
2660
|
+
const { readFileSync } = await import('node:fs');
|
|
2661
|
+
const { resolve } = await import('node:path');
|
|
2662
|
+
const src = readFileSync(resolve(__dirname, '..', 'full-trace-contract.ts'), 'utf-8');
|
|
2663
|
+
expect(src).not.toContain('node:fs');
|
|
2664
|
+
expect(src).not.toContain('node:path');
|
|
2665
|
+
expect(src).not.toContain('node:process');
|
|
2666
|
+
expect(src).not.toContain('openclaw-plugin');
|
|
2667
|
+
});
|
|
2668
|
+
it('core barrel exports FullTracePayloadV2Schema and contract functions', async () => {
|
|
2669
|
+
const { readFileSync } = await import('node:fs');
|
|
2670
|
+
const { resolve } = await import('node:path');
|
|
2671
|
+
const src = readFileSync(resolve(__dirname, '..', 'index.ts'), 'utf-8');
|
|
2672
|
+
expect(src).toContain('FullTracePayloadV2Schema');
|
|
2673
|
+
expect(src).toContain('TraceSourceRefSchema');
|
|
2674
|
+
expect(src).toContain('TraceTimelineEntrySchema');
|
|
2675
|
+
expect(src).toContain('validateFullTracePayload');
|
|
2676
|
+
expect(src).toContain('sanitizeFullTracePayload');
|
|
2677
|
+
expect(src).toContain('buildFullTraceTimeline');
|
|
2678
|
+
expect(src).toContain('buildSourceRefs');
|
|
2679
|
+
});
|
|
2680
|
+
it('context-payload.ts re-exports full-trace-contract types', async () => {
|
|
2681
|
+
const { readFileSync } = await import('node:fs');
|
|
2682
|
+
const { resolve } = await import('node:path');
|
|
2683
|
+
const src = readFileSync(resolve(__dirname, '..', 'context-payload.ts'), 'utf-8');
|
|
2684
|
+
expect(src).toContain('full-trace-contract');
|
|
2685
|
+
expect(src).toContain('FullTracePayloadV2Schema');
|
|
2686
|
+
expect(src).toContain('validateFullTracePayload');
|
|
2687
|
+
expect(src).toContain('sanitizeFullTracePayload');
|
|
2688
|
+
});
|
|
2689
|
+
it('DiagnosticianContextPayloadSchema accepts FullTracePayloadV2', async () => {
|
|
2690
|
+
const { readFileSync } = await import('node:fs');
|
|
2691
|
+
const { resolve } = await import('node:path');
|
|
2692
|
+
const src = readFileSync(resolve(__dirname, '..', 'context-payload.ts'), 'utf-8');
|
|
2693
|
+
expect(src).toContain('FullTracePayloadV2Schema');
|
|
2694
|
+
});
|
|
2695
|
+
});
|
|
2696
|
+
describe('PRI-191 TraceRefiner read model boundary', () => {
|
|
2697
|
+
it('trace-refiner.ts has zero infrastructure imports', async () => {
|
|
2698
|
+
const { readFileSync } = await import('node:fs');
|
|
2699
|
+
const { resolve } = await import('node:path');
|
|
2700
|
+
const src = readFileSync(resolve(__dirname, '..', 'trace-refiner.ts'), 'utf-8');
|
|
2701
|
+
expect(src).not.toContain('node:fs');
|
|
2702
|
+
expect(src).not.toContain('node:path');
|
|
2703
|
+
expect(src).not.toContain('node:process');
|
|
2704
|
+
expect(src).not.toContain('openclaw-plugin');
|
|
2705
|
+
});
|
|
2706
|
+
it('trace-refiner.ts has no LLM or network imports', async () => {
|
|
2707
|
+
const { readFileSync } = await import('node:fs');
|
|
2708
|
+
const { resolve } = await import('node:path');
|
|
2709
|
+
const src = readFileSync(resolve(__dirname, '..', 'trace-refiner.ts'), 'utf-8');
|
|
2710
|
+
expect(src).not.toContain('node:http');
|
|
2711
|
+
expect(src).not.toContain('node:https');
|
|
2712
|
+
expect(src).not.toContain('node:net');
|
|
2713
|
+
expect(src).not.toContain('fetch(');
|
|
2714
|
+
expect(src).not.toContain('openai');
|
|
2715
|
+
expect(src).not.toContain('anthropic');
|
|
2716
|
+
});
|
|
2717
|
+
it('core barrel exports refineFullTrace and RefinedTracePayload', async () => {
|
|
2718
|
+
const { readFileSync } = await import('node:fs');
|
|
2719
|
+
const { resolve } = await import('node:path');
|
|
2720
|
+
const src = readFileSync(resolve(__dirname, '..', 'index.ts'), 'utf-8');
|
|
2721
|
+
expect(src).toContain('refineFullTrace');
|
|
2722
|
+
expect(src).toContain('RefinedTracePayload');
|
|
2723
|
+
expect(src).toContain('RefinedTraceEvent');
|
|
2724
|
+
expect(src).toContain('TraceRefinerOptions');
|
|
2725
|
+
expect(src).toContain('REFINED_EVENT_KINDS');
|
|
2726
|
+
expect(src).toContain('SEVERITY_LEVELS');
|
|
2727
|
+
});
|
|
2728
|
+
it('trace-refiner.ts imports only from full-trace-contract', async () => {
|
|
2729
|
+
const { readFileSync } = await import('node:fs');
|
|
2730
|
+
const { resolve } = await import('node:path');
|
|
2731
|
+
const src = readFileSync(resolve(__dirname, '..', 'trace-refiner.ts'), 'utf-8');
|
|
2732
|
+
const importLines = src.split('\n').filter((line) => line.trim().startsWith('import'));
|
|
2733
|
+
for (const line of importLines) {
|
|
2734
|
+
expect(line).toContain('full-trace-contract');
|
|
2735
|
+
}
|
|
2736
|
+
});
|
|
2737
|
+
});
|
|
2738
|
+
describe('PRI-192 TraceRefinerAgent shadow contract boundary', () => {
|
|
2739
|
+
it('trace-refiner-agent.ts has zero infrastructure imports', async () => {
|
|
2740
|
+
const { readFileSync } = await import('node:fs');
|
|
2741
|
+
const { resolve } = await import('node:path');
|
|
2742
|
+
const src = readFileSync(resolve(__dirname, '..', 'trace-refiner-agent.ts'), 'utf-8');
|
|
2743
|
+
expect(src).not.toContain('node:fs');
|
|
2744
|
+
expect(src).not.toContain('node:path');
|
|
2745
|
+
expect(src).not.toContain('node:process');
|
|
2746
|
+
expect(src).not.toContain('openclaw-plugin');
|
|
2747
|
+
});
|
|
2748
|
+
it('trace-refiner-agent.ts has no LLM or network imports', async () => {
|
|
2749
|
+
const { readFileSync } = await import('node:fs');
|
|
2750
|
+
const { resolve } = await import('node:path');
|
|
2751
|
+
const src = readFileSync(resolve(__dirname, '..', 'trace-refiner-agent.ts'), 'utf-8');
|
|
2752
|
+
expect(src).not.toContain('node:http');
|
|
2753
|
+
expect(src).not.toContain('node:https');
|
|
2754
|
+
expect(src).not.toContain('node:net');
|
|
2755
|
+
expect(src).not.toContain('fetch(');
|
|
2756
|
+
expect(src).not.toContain('openai');
|
|
2757
|
+
expect(src).not.toContain('anthropic');
|
|
2758
|
+
});
|
|
2759
|
+
it('core barrel exports TraceRefinerAgent types and functions', async () => {
|
|
2760
|
+
const { readFileSync } = await import('node:fs');
|
|
2761
|
+
const { resolve } = await import('node:path');
|
|
2762
|
+
const src = readFileSync(resolve(__dirname, '..', 'index.ts'), 'utf-8');
|
|
2763
|
+
expect(src).toContain('createTraceRefinerAgentInput');
|
|
2764
|
+
expect(src).toContain('validateTraceRefinerAgentOutput');
|
|
2765
|
+
expect(src).toContain('applyTraceRefinerAgentShadowResult');
|
|
2766
|
+
expect(src).toContain('TraceRefinerAgentInput');
|
|
2767
|
+
expect(src).toContain('TraceRefinerAgentOutput');
|
|
2768
|
+
expect(src).toContain('TraceRefinerAgentObjective');
|
|
2769
|
+
expect(src).toContain('TraceRefinerAgentMode');
|
|
2770
|
+
expect(src).toContain('TraceRefinerEvidenceClaim');
|
|
2771
|
+
expect(src).toContain('TraceRefinerRejectedEvidence');
|
|
2772
|
+
expect(src).toContain('TraceRefinerAgentStatus');
|
|
2773
|
+
});
|
|
2774
|
+
it('trace-refiner-agent.ts imports only from full-trace-contract and trace-refiner', async () => {
|
|
2775
|
+
const { readFileSync } = await import('node:fs');
|
|
2776
|
+
const { resolve } = await import('node:path');
|
|
2777
|
+
const src = readFileSync(resolve(__dirname, '..', 'trace-refiner-agent.ts'), 'utf-8');
|
|
2778
|
+
const importLines = src.split('\n').filter((line) => line.trim().startsWith('import'));
|
|
2779
|
+
const allowedModules = ["'./full-trace-contract", "'./trace-refiner"];
|
|
2780
|
+
for (const line of importLines) {
|
|
2781
|
+
expect(allowedModules.some((mod) => line.includes(mod))).toBe(true);
|
|
2782
|
+
}
|
|
2783
|
+
});
|
|
2784
|
+
});
|
|
2785
|
+
// ── PRI-215: Synthetic baseline architecture boundary ──────────────────────
|
|
2786
|
+
//
|
|
2787
|
+
// After PRI-206, the architecture is:
|
|
2788
|
+
// Core: packages/principles-core/src/runtime-v2/synthetic-baseline.ts
|
|
2789
|
+
// (pure contract/helper code — zero I/O)
|
|
2790
|
+
// I/O Runner: packages/pd-cli/src/services/synthetic-baseline-runner.ts
|
|
2791
|
+
// CLI Command: packages/pd-cli/src/commands/runtime-synthetic-baseline.ts
|
|
2792
|
+
//
|
|
2793
|
+
// These guards prevent future PRs from moving I/O back into core.
|
|
2794
|
+
// ERR-011 reference: core must not import runtime orchestration classes
|
|
2795
|
+
// ERR-012 reference: guard against stale-main rollback of baseline
|
|
2796
|
+
// ERR-002 reference: not applicable — no degrade path in these tests
|
|
2797
|
+
const FORBIDDEN_NODE_IO_MODULES = new Set([
|
|
2798
|
+
'fs',
|
|
2799
|
+
'fs/promises',
|
|
2800
|
+
'path',
|
|
2801
|
+
'os',
|
|
2802
|
+
'child_process',
|
|
2803
|
+
'process',
|
|
2804
|
+
'better-sqlite3',
|
|
2805
|
+
'node:fs',
|
|
2806
|
+
'node:path',
|
|
2807
|
+
'node:os',
|
|
2808
|
+
'node:child_process',
|
|
2809
|
+
'node:process',
|
|
2810
|
+
]);
|
|
2811
|
+
const FORBIDDEN_RUNTIME_ORCHESTRATION_CLASSES = new Set([
|
|
2812
|
+
'RuntimeStateManager',
|
|
2813
|
+
'SqliteContextAssembler',
|
|
2814
|
+
'SqliteHistoryQuery',
|
|
2815
|
+
'SqliteDiagnosticianCommitter',
|
|
2816
|
+
'PainSignalBridge',
|
|
2817
|
+
'DiagnosticianRunner',
|
|
2818
|
+
'TestDoubleRuntimeAdapter',
|
|
2819
|
+
'OperatorHealthReadModel',
|
|
2820
|
+
'createInternalizationQueueReadModel',
|
|
2821
|
+
'PrincipleTreeLedgerAdapter',
|
|
2822
|
+
'CandidateIntakeService',
|
|
2823
|
+
]);
|
|
2824
|
+
describe('PRI-215 synthetic baseline architecture boundary', () => {
|
|
2825
|
+
function extractImportModulePaths(src) {
|
|
2826
|
+
const paths = [];
|
|
2827
|
+
for (const m of src.matchAll(/import\s+[\s\S]*?from\s+['"]([^'"]+)['"]/g)) {
|
|
2828
|
+
if (m[1] != null)
|
|
2829
|
+
paths.push(m[1]);
|
|
2830
|
+
}
|
|
2831
|
+
for (const m of src.matchAll(/import\s+['"]([^'"]+)['"]/g)) {
|
|
2832
|
+
if (m[1] != null && !paths.includes(m[1]))
|
|
2833
|
+
paths.push(m[1]);
|
|
2834
|
+
}
|
|
2835
|
+
return paths;
|
|
2836
|
+
}
|
|
2837
|
+
function extractImportIdentifiers(src) {
|
|
2838
|
+
const ids = [];
|
|
2839
|
+
for (const block of src.matchAll(/import\s+([\s\S]*?)\s+from\s+['"][^'"]+['"]/g)) {
|
|
2840
|
+
if (block[1] == null)
|
|
2841
|
+
continue;
|
|
2842
|
+
const clause = block[1].trim();
|
|
2843
|
+
const defaultMatch = /^(\w+)/.exec(clause);
|
|
2844
|
+
if (defaultMatch?.[1])
|
|
2845
|
+
ids.push(defaultMatch[1]);
|
|
2846
|
+
const namedMatch = /\{([\s\S]*)\}/.exec(clause);
|
|
2847
|
+
if (namedMatch?.[1]) {
|
|
2848
|
+
namedMatch[1].split(',').forEach((part) => {
|
|
2849
|
+
const trimmed = part.trim();
|
|
2850
|
+
if (!trimmed)
|
|
2851
|
+
return;
|
|
2852
|
+
const asParts = trimmed.split(/\s+as\s+/);
|
|
2853
|
+
if (asParts[0])
|
|
2854
|
+
ids.push(asParts[0].trim());
|
|
2855
|
+
if (asParts.length > 1) {
|
|
2856
|
+
const alias = asParts[asParts.length - 1];
|
|
2857
|
+
if (alias)
|
|
2858
|
+
ids.push(alias.trim());
|
|
2859
|
+
}
|
|
2860
|
+
});
|
|
2861
|
+
}
|
|
2862
|
+
}
|
|
2863
|
+
return ids;
|
|
2864
|
+
}
|
|
2865
|
+
// ── Core boundary: no Node I/O imports ──────────────────────────────────
|
|
2866
|
+
it('CORE_NO_NODE_IO: synthetic-baseline.ts does not import Node I/O modules', async () => {
|
|
2867
|
+
const { readFileSync } = await import('node:fs');
|
|
2868
|
+
const { resolve } = await import('node:path');
|
|
2869
|
+
const src = readFileSync(resolve(__dirname, '..', 'synthetic-baseline.ts'), 'utf-8');
|
|
2870
|
+
const importModulePaths = extractImportModulePaths(src);
|
|
2871
|
+
for (const mod of FORBIDDEN_NODE_IO_MODULES) {
|
|
2872
|
+
const found = importModulePaths.filter((p) => p === mod || p.startsWith(mod + '/'));
|
|
2873
|
+
expect(found).toEqual([]);
|
|
2874
|
+
}
|
|
2875
|
+
});
|
|
2876
|
+
// ── Core boundary: no runtime orchestration imports ─────────────────────
|
|
2877
|
+
it('CORE_NO_RUNTIME_CLASSES: synthetic-baseline.ts does not import runtime orchestration classes', async () => {
|
|
2878
|
+
const { readFileSync } = await import('node:fs');
|
|
2879
|
+
const { resolve } = await import('node:path');
|
|
2880
|
+
const src = readFileSync(resolve(__dirname, '..', 'synthetic-baseline.ts'), 'utf-8');
|
|
2881
|
+
const importIdentifiers = extractImportIdentifiers(src);
|
|
2882
|
+
for (const cls of FORBIDDEN_RUNTIME_ORCHESTRATION_CLASSES) {
|
|
2883
|
+
expect(importIdentifiers).not.toContain(cls);
|
|
2884
|
+
}
|
|
2885
|
+
});
|
|
2886
|
+
// ── Import parsing: side-effect import detection ────────────────────────
|
|
2887
|
+
it('IMPORT_PARSING_SIDE_EFFECT: extractImportModulePaths catches side-effect imports like import "node:fs"', () => {
|
|
2888
|
+
const src = `import 'node:fs';\nimport { foo } from 'bar';\n`;
|
|
2889
|
+
const paths = extractImportModulePaths(src);
|
|
2890
|
+
expect(paths).toContain('node:fs');
|
|
2891
|
+
expect(paths).toContain('bar');
|
|
2892
|
+
});
|
|
2893
|
+
// ── Import parsing: multiline import detection ──────────────────────────
|
|
2894
|
+
it('IMPORT_PARSING_MULTILINE: extractImportModulePaths catches multiline imports from forbidden modules', () => {
|
|
2895
|
+
const src = `import {\n RuntimeStateManager,\n SqliteContextAssembler\n} from './runtime';\n`;
|
|
2896
|
+
const paths = extractImportModulePaths(src);
|
|
2897
|
+
expect(paths).toContain('./runtime');
|
|
2898
|
+
});
|
|
2899
|
+
// ── Import parsing: aliased named import detection ──────────────────────
|
|
2900
|
+
it('IMPORT_PARSING_ALIAS: extractImportIdentifiers catches both original and alias for "as" imports', () => {
|
|
2901
|
+
const src = `import { RuntimeStateManager as RSM, PainSignalBridge } from './runtime';\n`;
|
|
2902
|
+
const ids = extractImportIdentifiers(src);
|
|
2903
|
+
expect(ids).toContain('RuntimeStateManager');
|
|
2904
|
+
expect(ids).toContain('RSM');
|
|
2905
|
+
expect(ids).toContain('PainSignalBridge');
|
|
2906
|
+
});
|
|
2907
|
+
// ── I/O Runner location ─────────────────────────────────────────────────
|
|
2908
|
+
it('IO_RUNNER_OUTSIDE_CORE: I/O runner exists at pd-cli/src/services/synthetic-baseline-runner.ts', async () => {
|
|
2909
|
+
const { existsSync } = await import('node:fs');
|
|
2910
|
+
const { resolve } = await import('node:path');
|
|
2911
|
+
const runnerPath = resolve(__dirname, '../../../../pd-cli/src/services/synthetic-baseline-runner.ts');
|
|
2912
|
+
expect(existsSync(runnerPath)).toBe(true);
|
|
2913
|
+
});
|
|
2914
|
+
// ── CLI Command location ────────────────────────────────────────────────
|
|
2915
|
+
it('CLI_COMMAND_OUTSIDE_CORE: CLI command exists at pd-cli/src/commands/runtime-synthetic-baseline.ts', async () => {
|
|
2916
|
+
const { existsSync } = await import('node:fs');
|
|
2917
|
+
const { resolve } = await import('node:path');
|
|
2918
|
+
const cmdPath = resolve(__dirname, '../../../../pd-cli/src/commands/runtime-synthetic-baseline.ts');
|
|
2919
|
+
expect(existsSync(cmdPath)).toBe(true);
|
|
2920
|
+
});
|
|
2921
|
+
// ── Frozen legacy untouched ────────────────────────────────────────────
|
|
2922
|
+
it('FROZEN_LEGACY_UNTOUCHED: ADR-0005 frozen files are not imported by synthetic-baseline.ts', async () => {
|
|
2923
|
+
const { readFileSync } = await import('node:fs');
|
|
2924
|
+
const { resolve } = await import('node:path');
|
|
2925
|
+
const src = readFileSync(resolve(__dirname, '..', 'synthetic-baseline.ts'), 'utf-8');
|
|
2926
|
+
expect(src).not.toContain('nocturnal-trinity');
|
|
2927
|
+
expect(src).not.toContain('nocturnal-arbiter');
|
|
2928
|
+
expect(src).not.toContain('nocturnal-service');
|
|
2929
|
+
});
|
|
2930
|
+
});
|
|
2931
|
+
describe('PRI-225: No unsafe type assertions on untrusted metadata arrays', () => {
|
|
2932
|
+
it('INTEGRITY_READ_MODEL_NO_AS_STRING_ARRAY: internalization-chain-integrity-read-model.ts must not use `as string[]` on untrusted data', async () => {
|
|
2933
|
+
const { readFileSync } = await import('node:fs');
|
|
2934
|
+
const { resolve } = await import('node:path');
|
|
2935
|
+
const src = readFileSync(resolve(__dirname, '..', 'internalization-chain-integrity-read-model.ts'), 'utf-8');
|
|
2936
|
+
expect(src).not.toContain('as string[]');
|
|
2937
|
+
});
|
|
2938
|
+
});
|
|
2939
|
+
// ── PRI-239: Feature flag registry architecture boundary ──────────────────
|
|
2940
|
+
//
|
|
2941
|
+
// Core: packages/principles-core/src/runtime-v2/feature-flags/feature-flag-contract.ts
|
|
2942
|
+
// I/O Loader: packages/pd-cli/src/services/feature-flag-loader.ts
|
|
2943
|
+
// CLI Command: packages/pd-cli/src/commands/runtime-features.ts
|
|
2944
|
+
// Consumption: packages/pd-cli/src/commands/runtime-canary.ts (GFI check)
|
|
2945
|
+
describe('PRI-239: Feature flag registry architecture boundary', () => {
|
|
2946
|
+
it('CORE_NO_NODE_IO: feature-flag-contract.ts does not import Node I/O modules', async () => {
|
|
2947
|
+
const { readFileSync } = await import('node:fs');
|
|
2948
|
+
const { resolve } = await import('node:path');
|
|
2949
|
+
const src = readFileSync(resolve(__dirname, '..', 'feature-flags', 'feature-flag-contract.ts'), 'utf-8');
|
|
2950
|
+
expect(src).not.toMatch(/from\s+['"]node:fs['"]/);
|
|
2951
|
+
expect(src).not.toMatch(/from\s+['"]node:path['"]/);
|
|
2952
|
+
expect(src).not.toMatch(/from\s+['"]fs['"]/);
|
|
2953
|
+
expect(src).not.toMatch(/from\s+['"]path['"]/);
|
|
2954
|
+
expect(src).not.toMatch(/from\s+['"]js-yaml['"]/);
|
|
2955
|
+
});
|
|
2956
|
+
it('CORE_NO_RUNTIME_CLASSES: feature-flag-contract.ts does not import runtime orchestration classes', async () => {
|
|
2957
|
+
const { readFileSync } = await import('node:fs');
|
|
2958
|
+
const { resolve } = await import('node:path');
|
|
2959
|
+
const src = readFileSync(resolve(__dirname, '..', 'feature-flags', 'feature-flag-contract.ts'), 'utf-8');
|
|
2960
|
+
expect(src).not.toContain('RuntimeStateManager');
|
|
2961
|
+
expect(src).not.toContain('InternalizationOrchestrator');
|
|
2962
|
+
expect(src).not.toContain('SqliteConnection');
|
|
2963
|
+
});
|
|
2964
|
+
it('IO_LOADER_OUTSIDE_CORE: I/O loader exists at pd-cli/src/services/feature-flag-loader.ts', async () => {
|
|
2965
|
+
const { existsSync } = await import('node:fs');
|
|
2966
|
+
const { resolve } = await import('node:path');
|
|
2967
|
+
expect(existsSync(resolve(__dirname, '../../../../pd-cli/src/services/feature-flag-loader.ts'))).toBe(true);
|
|
2968
|
+
});
|
|
2969
|
+
it('CLI_COMMAND_OUTSIDE_CORE: CLI command exists at pd-cli/src/commands/runtime-features.ts', async () => {
|
|
2970
|
+
const { existsSync } = await import('node:fs');
|
|
2971
|
+
const { resolve } = await import('node:path');
|
|
2972
|
+
expect(existsSync(resolve(__dirname, '../../../../pd-cli/src/commands/runtime-features.ts'))).toBe(true);
|
|
2973
|
+
});
|
|
2974
|
+
it('FROZEN_LEGACY_UNTOUCHED: ADR-0005 frozen files are not imported by feature-flag-contract.ts', async () => {
|
|
2975
|
+
const { readFileSync } = await import('node:fs');
|
|
2976
|
+
const { resolve } = await import('node:path');
|
|
2977
|
+
const src = readFileSync(resolve(__dirname, '..', 'feature-flags', 'feature-flag-contract.ts'), 'utf-8');
|
|
2978
|
+
expect(src).not.toContain('nocturnal-trinity');
|
|
2979
|
+
expect(src).not.toContain('nocturnal-arbiter');
|
|
2980
|
+
expect(src).not.toContain('nocturnal-service');
|
|
2981
|
+
});
|
|
2982
|
+
it('CONSUMPTION_WIRED: runtime-canary.ts imports feature flag loader', async () => {
|
|
2983
|
+
const { readFileSync } = await import('node:fs');
|
|
2984
|
+
const { resolve } = await import('node:path');
|
|
2985
|
+
const src = readFileSync(resolve(__dirname, '../../../../pd-cli/src/commands/runtime-canary.ts'), 'utf-8');
|
|
2986
|
+
expect(src).toContain('feature-flag-loader');
|
|
2987
|
+
expect(src).toContain('loadEffectiveFeatureFlags');
|
|
2988
|
+
});
|
|
2989
|
+
});
|
|
2990
|
+
//# sourceMappingURL=architecture-regression.test.js.map
|