@principles/core 1.284.16 → 1.284.18
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/runtime-v2/__tests__/adversarial-loop.test.js +8 -1
- package/dist/runtime-v2/__tests__/adversarial-loop.test.js.map +1 -1
- package/dist/runtime-v2/__tests__/artificer-runner-vslice.test.js +101 -14
- package/dist/runtime-v2/__tests__/artificer-runner-vslice.test.js.map +1 -1
- package/dist/runtime-v2/__tests__/evidence-sanitizer.test.js +113 -1
- package/dist/runtime-v2/__tests__/evidence-sanitizer.test.js.map +1 -1
- package/dist/runtime-v2/__tests__/pain-to-principle-service.test.js +0 -1
- package/dist/runtime-v2/__tests__/pain-to-principle-service.test.js.map +1 -1
- package/dist/runtime-v2/__tests__/scribe-runner-vslice.test.js +211 -0
- package/dist/runtime-v2/__tests__/scribe-runner-vslice.test.js.map +1 -1
- package/dist/runtime-v2/activation/writers/rule-host-writer.d.ts.map +1 -1
- package/dist/runtime-v2/activation/writers/rule-host-writer.js +15 -1
- package/dist/runtime-v2/activation/writers/rule-host-writer.js.map +1 -1
- package/dist/runtime-v2/adapter/__tests__/openclaw-cli-runtime-adapter-message-file.test.js +23 -1
- package/dist/runtime-v2/adapter/__tests__/openclaw-cli-runtime-adapter-message-file.test.js.map +1 -1
- package/dist/runtime-v2/adapter/__tests__/principle-tree-ledger-adapter.test.js +25 -0
- package/dist/runtime-v2/adapter/__tests__/principle-tree-ledger-adapter.test.js.map +1 -1
- package/dist/runtime-v2/adapter/__tests__/schema-prompt-adapter-semantic.test.js +18 -4
- package/dist/runtime-v2/adapter/__tests__/schema-prompt-adapter-semantic.test.js.map +1 -1
- package/dist/runtime-v2/adapter/openclaw-cli-runtime-adapter.d.ts.map +1 -1
- package/dist/runtime-v2/adapter/openclaw-cli-runtime-adapter.js +38 -7
- package/dist/runtime-v2/adapter/openclaw-cli-runtime-adapter.js.map +1 -1
- package/dist/runtime-v2/adapter/output-schema-registry.d.ts.map +1 -1
- package/dist/runtime-v2/adapter/output-schema-registry.js +0 -2
- package/dist/runtime-v2/adapter/output-schema-registry.js.map +1 -1
- package/dist/runtime-v2/adapter/principle-tree-ledger-adapter.d.ts +16 -0
- package/dist/runtime-v2/adapter/principle-tree-ledger-adapter.d.ts.map +1 -1
- package/dist/runtime-v2/adapter/principle-tree-ledger-adapter.js +22 -0
- package/dist/runtime-v2/adapter/principle-tree-ledger-adapter.js.map +1 -1
- package/dist/runtime-v2/adversarial-loop.d.ts.map +1 -1
- package/dist/runtime-v2/adversarial-loop.js +14 -1
- package/dist/runtime-v2/adversarial-loop.js.map +1 -1
- package/dist/runtime-v2/agent-spec.d.ts +0 -1
- package/dist/runtime-v2/agent-spec.d.ts.map +1 -1
- package/dist/runtime-v2/agent-spec.js +3 -1
- package/dist/runtime-v2/agent-spec.js.map +1 -1
- package/dist/runtime-v2/config/__tests__/internal-agent-names.test.js +3 -1
- package/dist/runtime-v2/config/__tests__/internal-agent-names.test.js.map +1 -1
- package/dist/runtime-v2/config/__tests__/pd-config-agent-binding.test.js +0 -7
- package/dist/runtime-v2/config/__tests__/pd-config-agent-binding.test.js.map +1 -1
- package/dist/runtime-v2/config/__tests__/pd-config-context-injection.test.js +0 -1
- package/dist/runtime-v2/config/__tests__/pd-config-context-injection.test.js.map +1 -1
- package/dist/runtime-v2/config/__tests__/pd-config-contract.test.js +0 -1
- package/dist/runtime-v2/config/__tests__/pd-config-contract.test.js.map +1 -1
- package/dist/runtime-v2/config/__tests__/pd-config-principles.test.js +0 -1
- package/dist/runtime-v2/config/__tests__/pd-config-principles.test.js.map +1 -1
- package/dist/runtime-v2/config/__tests__/pd-config-reasoning.test.js +0 -1
- package/dist/runtime-v2/config/__tests__/pd-config-reasoning.test.js.map +1 -1
- package/dist/runtime-v2/config/__tests__/pd-config-redaction-deep.test.js +0 -1
- package/dist/runtime-v2/config/__tests__/pd-config-redaction-deep.test.js.map +1 -1
- package/dist/runtime-v2/config/__tests__/pd-config-validation-edge-cases.test.js +61 -1
- package/dist/runtime-v2/config/__tests__/pd-config-validation-edge-cases.test.js.map +1 -1
- package/dist/runtime-v2/config/pd-config-defaults.d.ts.map +1 -1
- package/dist/runtime-v2/config/pd-config-defaults.js +0 -1
- package/dist/runtime-v2/config/pd-config-defaults.js.map +1 -1
- package/dist/runtime-v2/config/pd-config-types.d.ts +1 -1
- package/dist/runtime-v2/config/pd-config-types.d.ts.map +1 -1
- package/dist/runtime-v2/config/pd-config-types.js +0 -1
- package/dist/runtime-v2/config/pd-config-types.js.map +1 -1
- package/dist/runtime-v2/config/pd-config-validate.d.ts.map +1 -1
- package/dist/runtime-v2/config/pd-config-validate.js +20 -1
- package/dist/runtime-v2/config/pd-config-validate.js.map +1 -1
- package/dist/runtime-v2/evidence-sanitizer.d.ts +17 -2
- package/dist/runtime-v2/evidence-sanitizer.d.ts.map +1 -1
- package/dist/runtime-v2/evidence-sanitizer.js +80 -11
- package/dist/runtime-v2/evidence-sanitizer.js.map +1 -1
- package/dist/runtime-v2/feature-flags/__tests__/feature-flag-contract.test.js +3 -3
- package/dist/runtime-v2/feature-flags/__tests__/feature-flag-contract.test.js.map +1 -1
- package/dist/runtime-v2/feature-flags/feature-flag-contract.d.ts.map +1 -1
- package/dist/runtime-v2/feature-flags/feature-flag-contract.js +11 -40
- package/dist/runtime-v2/feature-flags/feature-flag-contract.js.map +1 -1
- package/dist/runtime-v2/feature-flags/feature-flag-lifecycle.d.ts.map +1 -1
- package/dist/runtime-v2/feature-flags/feature-flag-lifecycle.js +6 -40
- package/dist/runtime-v2/feature-flags/feature-flag-lifecycle.js.map +1 -1
- package/dist/runtime-v2/index.d.ts +9 -6
- package/dist/runtime-v2/index.d.ts.map +1 -1
- package/dist/runtime-v2/index.js +12 -5
- package/dist/runtime-v2/index.js.map +1 -1
- package/dist/runtime-v2/internalization/__tests__/artificer-prompt-builder-v2.test.js +49 -0
- package/dist/runtime-v2/internalization/__tests__/artificer-prompt-builder-v2.test.js.map +1 -1
- package/dist/runtime-v2/internalization/__tests__/artificer-prompt-builder.test.js +64 -29
- package/dist/runtime-v2/internalization/__tests__/artificer-prompt-builder.test.js.map +1 -1
- package/dist/runtime-v2/internalization/__tests__/diag-chain-e2e.test.js +0 -1
- package/dist/runtime-v2/internalization/__tests__/diag-chain-e2e.test.js.map +1 -1
- package/dist/runtime-v2/internalization/__tests__/diag-router-runner.test.js +2 -2
- package/dist/runtime-v2/internalization/__tests__/diag-router-runner.test.js.map +1 -1
- package/dist/runtime-v2/internalization/__tests__/evaluator-artificer-repair-replay.test.js +2 -13
- package/dist/runtime-v2/internalization/__tests__/evaluator-artificer-repair-replay.test.js.map +1 -1
- package/dist/runtime-v2/internalization/__tests__/evaluator-chinese-feedback-contract.test.js +1 -5
- package/dist/runtime-v2/internalization/__tests__/evaluator-chinese-feedback-contract.test.js.map +1 -1
- package/dist/runtime-v2/internalization/__tests__/evaluator-gate-authority.test.js +5 -13
- package/dist/runtime-v2/internalization/__tests__/evaluator-gate-authority.test.js.map +1 -1
- package/dist/runtime-v2/internalization/__tests__/evaluator-out-of-scope-governance.test.js +1 -5
- package/dist/runtime-v2/internalization/__tests__/evaluator-out-of-scope-governance.test.js.map +1 -1
- package/dist/runtime-v2/internalization/__tests__/external-review-p0-regressions.test.js +1 -1
- package/dist/runtime-v2/internalization/__tests__/external-review-p0-regressions.test.js.map +1 -1
- package/dist/runtime-v2/internalization/__tests__/formation-context.test.d.ts +2 -0
- package/dist/runtime-v2/internalization/__tests__/formation-context.test.d.ts.map +1 -0
- package/dist/runtime-v2/internalization/__tests__/formation-context.test.js +428 -0
- package/dist/runtime-v2/internalization/__tests__/formation-context.test.js.map +1 -0
- package/dist/runtime-v2/internalization/__tests__/scribe-prompt-builder.test.js +97 -0
- package/dist/runtime-v2/internalization/__tests__/scribe-prompt-builder.test.js.map +1 -1
- package/dist/runtime-v2/internalization/__tests__/split-diagnostician-runner-retry.test.js +61 -0
- package/dist/runtime-v2/internalization/__tests__/split-diagnostician-runner-retry.test.js.map +1 -1
- package/dist/runtime-v2/internalization/artifact-summary.d.ts +11 -0
- package/dist/runtime-v2/internalization/artifact-summary.d.ts.map +1 -1
- package/dist/runtime-v2/internalization/artifact-summary.js.map +1 -1
- package/dist/runtime-v2/internalization/artificer-prompt-builder.d.ts +67 -15
- package/dist/runtime-v2/internalization/artificer-prompt-builder.d.ts.map +1 -1
- package/dist/runtime-v2/internalization/artificer-prompt-builder.js +119 -4
- package/dist/runtime-v2/internalization/artificer-prompt-builder.js.map +1 -1
- package/dist/runtime-v2/internalization/artificer-runner.d.ts +12 -0
- package/dist/runtime-v2/internalization/artificer-runner.d.ts.map +1 -1
- package/dist/runtime-v2/internalization/artificer-runner.js +102 -158
- package/dist/runtime-v2/internalization/artificer-runner.js.map +1 -1
- package/dist/runtime-v2/internalization/diag-distiller-runner.d.ts +1 -1
- package/dist/runtime-v2/internalization/diag-distiller-runner.d.ts.map +1 -1
- package/dist/runtime-v2/internalization/diag-distiller-runner.js +2 -19
- package/dist/runtime-v2/internalization/diag-distiller-runner.js.map +1 -1
- package/dist/runtime-v2/internalization/diag-rootcause-runner.d.ts.map +1 -1
- package/dist/runtime-v2/internalization/diag-rootcause-runner.js +1 -5
- package/dist/runtime-v2/internalization/diag-rootcause-runner.js.map +1 -1
- package/dist/runtime-v2/internalization/diag-router-runner.d.ts +1 -1
- package/dist/runtime-v2/internalization/diag-router-runner.d.ts.map +1 -1
- package/dist/runtime-v2/internalization/diag-router-runner.js +9 -32
- package/dist/runtime-v2/internalization/diag-router-runner.js.map +1 -1
- package/dist/runtime-v2/internalization/dreamer-runner.d.ts +1 -9
- package/dist/runtime-v2/internalization/dreamer-runner.d.ts.map +1 -1
- package/dist/runtime-v2/internalization/dreamer-runner.js +4 -35
- package/dist/runtime-v2/internalization/dreamer-runner.js.map +1 -1
- package/dist/runtime-v2/internalization/evaluator-runner.d.ts +3 -54
- package/dist/runtime-v2/internalization/evaluator-runner.d.ts.map +1 -1
- package/dist/runtime-v2/internalization/evaluator-runner.js +37 -230
- package/dist/runtime-v2/internalization/evaluator-runner.js.map +1 -1
- package/dist/runtime-v2/internalization/formation-context.d.ts +208 -0
- package/dist/runtime-v2/internalization/formation-context.d.ts.map +1 -0
- package/dist/runtime-v2/internalization/formation-context.js +621 -0
- package/dist/runtime-v2/internalization/formation-context.js.map +1 -0
- package/dist/runtime-v2/internalization/index.d.ts +0 -2
- package/dist/runtime-v2/internalization/index.d.ts.map +1 -1
- package/dist/runtime-v2/internalization/index.js +0 -2
- package/dist/runtime-v2/internalization/index.js.map +1 -1
- package/dist/runtime-v2/internalization/philosopher-runner.d.ts.map +1 -1
- package/dist/runtime-v2/internalization/philosopher-runner.js +1 -25
- package/dist/runtime-v2/internalization/philosopher-runner.js.map +1 -1
- package/dist/runtime-v2/internalization/refiner-sandbox-wrapper.d.ts.map +1 -1
- package/dist/runtime-v2/internalization/refiner-sandbox-wrapper.js +25 -1
- package/dist/runtime-v2/internalization/refiner-sandbox-wrapper.js.map +1 -1
- package/dist/runtime-v2/internalization/scribe-prompt-builder.d.ts +53 -1
- package/dist/runtime-v2/internalization/scribe-prompt-builder.d.ts.map +1 -1
- package/dist/runtime-v2/internalization/scribe-prompt-builder.js +65 -3
- package/dist/runtime-v2/internalization/scribe-prompt-builder.js.map +1 -1
- package/dist/runtime-v2/internalization/scribe-runner.d.ts +17 -0
- package/dist/runtime-v2/internalization/scribe-runner.d.ts.map +1 -1
- package/dist/runtime-v2/internalization/scribe-runner.js +58 -40
- package/dist/runtime-v2/internalization/scribe-runner.js.map +1 -1
- package/dist/runtime-v2/internalization/split-diagnostician-runner.d.ts.map +1 -1
- package/dist/runtime-v2/internalization/split-diagnostician-runner.js +13 -2
- package/dist/runtime-v2/internalization/split-diagnostician-runner.js.map +1 -1
- package/dist/runtime-v2/internalization/v2-adversarial-cases.d.ts.map +1 -1
- package/dist/runtime-v2/internalization/v2-adversarial-cases.js +25 -2
- package/dist/runtime-v2/internalization/v2-adversarial-cases.js.map +1 -1
- package/dist/runtime-v2/observer/__tests__/agent-scheduler.test.js +31 -21
- package/dist/runtime-v2/observer/__tests__/agent-scheduler.test.js.map +1 -1
- package/dist/runtime-v2/observer/agent-scheduler.d.ts +0 -5
- package/dist/runtime-v2/observer/agent-scheduler.d.ts.map +1 -1
- package/dist/runtime-v2/owner-decision/__tests__/owner-decision-view.test.d.ts +2 -0
- package/dist/runtime-v2/owner-decision/__tests__/owner-decision-view.test.d.ts.map +1 -0
- package/dist/runtime-v2/owner-decision/__tests__/owner-decision-view.test.js +559 -0
- package/dist/runtime-v2/owner-decision/__tests__/owner-decision-view.test.js.map +1 -0
- package/dist/runtime-v2/owner-decision/owner-decision-view-contract.d.ts +7868 -0
- package/dist/runtime-v2/owner-decision/owner-decision-view-contract.d.ts.map +1 -0
- package/dist/runtime-v2/owner-decision/owner-decision-view-contract.js +367 -0
- package/dist/runtime-v2/owner-decision/owner-decision-view-contract.js.map +1 -0
- package/dist/runtime-v2/owner-decision/owner-decision-view.d.ts +415 -0
- package/dist/runtime-v2/owner-decision/owner-decision-view.d.ts.map +1 -0
- package/dist/runtime-v2/owner-decision/owner-decision-view.js +856 -0
- package/dist/runtime-v2/owner-decision/owner-decision-view.js.map +1 -0
- package/dist/runtime-v2/owner-decision/semantic-selector.d.ts +72 -0
- package/dist/runtime-v2/owner-decision/semantic-selector.d.ts.map +1 -0
- package/dist/runtime-v2/owner-decision/semantic-selector.js +176 -0
- package/dist/runtime-v2/owner-decision/semantic-selector.js.map +1 -0
- package/dist/runtime-v2/runner/base-peer-runner.d.ts +0 -125
- package/dist/runtime-v2/runner/base-peer-runner.d.ts.map +1 -1
- package/dist/runtime-v2/runner/base-peer-runner.js +0 -323
- package/dist/runtime-v2/runner/base-peer-runner.js.map +1 -1
- package/dist/runtime-v2/runner/peer-runner-types.d.ts +0 -12
- package/dist/runtime-v2/runner/peer-runner-types.d.ts.map +1 -1
- package/dist/runtime-v2/signal-collector/types.d.ts +0 -12
- package/dist/runtime-v2/signal-collector/types.d.ts.map +1 -1
- package/dist/runtime-v2/signal-collector/types.js.map +1 -1
- package/dist/runtime-v2/tools/artificer-l2-tool-contract.d.ts.map +1 -1
- package/dist/runtime-v2/tools/artificer-l2-tool-contract.js +10 -0
- package/dist/runtime-v2/tools/artificer-l2-tool-contract.js.map +1 -1
- package/dist/runtime-v2/types/event-types.d.ts +9 -0
- package/dist/runtime-v2/types/event-types.d.ts.map +1 -1
- package/dist/runtime-v2/types/event-types.js +12 -0
- package/dist/runtime-v2/types/event-types.js.map +1 -1
- package/dist/telemetry-event.d.ts +2 -2
- package/dist/telemetry-event.d.ts.map +1 -1
- package/dist/telemetry-event.js +7 -84
- package/dist/telemetry-event.js.map +1 -1
- package/package.json +1 -1
- package/dist/runtime-v2/feature-flags/__tests__/artifact-summary-redundancy-flag.test.d.ts +0 -15
- package/dist/runtime-v2/feature-flags/__tests__/artifact-summary-redundancy-flag.test.d.ts.map +0 -1
- package/dist/runtime-v2/feature-flags/__tests__/artifact-summary-redundancy-flag.test.js +0 -90
- package/dist/runtime-v2/feature-flags/__tests__/artifact-summary-redundancy-flag.test.js.map +0 -1
- package/dist/runtime-v2/feature-flags/__tests__/context-manifest-budget-flag.test.d.ts +0 -12
- package/dist/runtime-v2/feature-flags/__tests__/context-manifest-budget-flag.test.d.ts.map +0 -1
- package/dist/runtime-v2/feature-flags/__tests__/context-manifest-budget-flag.test.js +0 -117
- package/dist/runtime-v2/feature-flags/__tests__/context-manifest-budget-flag.test.js.map +0 -1
- package/dist/runtime-v2/feature-flags/__tests__/progressive-evaluator-flag.test.d.ts +0 -8
- package/dist/runtime-v2/feature-flags/__tests__/progressive-evaluator-flag.test.d.ts.map +0 -1
- package/dist/runtime-v2/feature-flags/__tests__/progressive-evaluator-flag.test.js +0 -56
- package/dist/runtime-v2/feature-flags/__tests__/progressive-evaluator-flag.test.js.map +0 -1
- package/dist/runtime-v2/internalization/__tests__/candidate-lineage.pri717.test.d.ts +0 -26
- package/dist/runtime-v2/internalization/__tests__/candidate-lineage.pri717.test.d.ts.map +0 -1
- package/dist/runtime-v2/internalization/__tests__/candidate-lineage.pri717.test.js +0 -420
- package/dist/runtime-v2/internalization/__tests__/candidate-lineage.pri717.test.js.map +0 -1
- package/dist/runtime-v2/internalization/__tests__/candidate-lineage.property.test.d.ts +0 -15
- package/dist/runtime-v2/internalization/__tests__/candidate-lineage.property.test.d.ts.map +0 -1
- package/dist/runtime-v2/internalization/__tests__/candidate-lineage.property.test.js +0 -306
- package/dist/runtime-v2/internalization/__tests__/candidate-lineage.property.test.js.map +0 -1
- package/dist/runtime-v2/internalization/__tests__/context-manifest.property.test.d.ts +0 -12
- package/dist/runtime-v2/internalization/__tests__/context-manifest.property.test.d.ts.map +0 -1
- package/dist/runtime-v2/internalization/__tests__/context-manifest.property.test.js +0 -176
- package/dist/runtime-v2/internalization/__tests__/context-manifest.property.test.js.map +0 -1
- package/dist/runtime-v2/internalization/__tests__/context-resolution.test.d.ts +0 -2
- package/dist/runtime-v2/internalization/__tests__/context-resolution.test.d.ts.map +0 -1
- package/dist/runtime-v2/internalization/__tests__/context-resolution.test.js +0 -377
- package/dist/runtime-v2/internalization/__tests__/context-resolution.test.js.map +0 -1
- package/dist/runtime-v2/internalization/__tests__/progressive-disclosure-scope-regression.test.d.ts +0 -22
- package/dist/runtime-v2/internalization/__tests__/progressive-disclosure-scope-regression.test.d.ts.map +0 -1
- package/dist/runtime-v2/internalization/__tests__/progressive-disclosure-scope-regression.test.js +0 -92
- package/dist/runtime-v2/internalization/__tests__/progressive-disclosure-scope-regression.test.js.map +0 -1
- package/dist/runtime-v2/internalization/__tests__/progressive-disclosure-spike.test.d.ts +0 -2
- package/dist/runtime-v2/internalization/__tests__/progressive-disclosure-spike.test.d.ts.map +0 -1
- package/dist/runtime-v2/internalization/__tests__/progressive-disclosure-spike.test.js +0 -1039
- package/dist/runtime-v2/internalization/__tests__/progressive-disclosure-spike.test.js.map +0 -1
- package/dist/runtime-v2/internalization/__tests__/progressive-evaluator-stage-isolation.property.test.d.ts +0 -13
- package/dist/runtime-v2/internalization/__tests__/progressive-evaluator-stage-isolation.property.test.d.ts.map +0 -1
- package/dist/runtime-v2/internalization/__tests__/progressive-evaluator-stage-isolation.property.test.js +0 -257
- package/dist/runtime-v2/internalization/__tests__/progressive-evaluator-stage-isolation.property.test.js.map +0 -1
- package/dist/runtime-v2/internalization/__tests__/progressive-evaluator.property.test.d.ts +0 -11
- package/dist/runtime-v2/internalization/__tests__/progressive-evaluator.property.test.d.ts.map +0 -1
- package/dist/runtime-v2/internalization/__tests__/progressive-evaluator.property.test.js +0 -154
- package/dist/runtime-v2/internalization/__tests__/progressive-evaluator.property.test.js.map +0 -1
- package/dist/runtime-v2/internalization/__tests__/prompt-budget-manager.property.test.d.ts +0 -12
- package/dist/runtime-v2/internalization/__tests__/prompt-budget-manager.property.test.d.ts.map +0 -1
- package/dist/runtime-v2/internalization/__tests__/prompt-budget-manager.property.test.js +0 -254
- package/dist/runtime-v2/internalization/__tests__/prompt-budget-manager.property.test.js.map +0 -1
- package/dist/runtime-v2/internalization/__tests__/resolve-injection.property.test.d.ts +0 -15
- package/dist/runtime-v2/internalization/__tests__/resolve-injection.property.test.d.ts.map +0 -1
- package/dist/runtime-v2/internalization/__tests__/resolve-injection.property.test.js +0 -150
- package/dist/runtime-v2/internalization/__tests__/resolve-injection.property.test.js.map +0 -1
- package/dist/runtime-v2/internalization/__tests__/shared-information-plane-runner.test.d.ts +0 -2
- package/dist/runtime-v2/internalization/__tests__/shared-information-plane-runner.test.d.ts.map +0 -1
- package/dist/runtime-v2/internalization/__tests__/shared-information-plane-runner.test.js +0 -773
- package/dist/runtime-v2/internalization/__tests__/shared-information-plane-runner.test.js.map +0 -1
- package/dist/runtime-v2/internalization/__tests__/summary-chain-flow.property.test.d.ts +0 -22
- package/dist/runtime-v2/internalization/__tests__/summary-chain-flow.property.test.d.ts.map +0 -1
- package/dist/runtime-v2/internalization/__tests__/summary-chain-flow.property.test.js +0 -280
- package/dist/runtime-v2/internalization/__tests__/summary-chain-flow.property.test.js.map +0 -1
- package/dist/runtime-v2/internalization/__tests__/summary-envelope-writer.property.test.d.ts +0 -25
- package/dist/runtime-v2/internalization/__tests__/summary-envelope-writer.property.test.d.ts.map +0 -1
- package/dist/runtime-v2/internalization/__tests__/summary-envelope-writer.property.test.js +0 -413
- package/dist/runtime-v2/internalization/__tests__/summary-envelope-writer.property.test.js.map +0 -1
- package/dist/runtime-v2/internalization/attach-summary-envelope.d.ts +0 -60
- package/dist/runtime-v2/internalization/attach-summary-envelope.d.ts.map +0 -1
- package/dist/runtime-v2/internalization/attach-summary-envelope.js +0 -126
- package/dist/runtime-v2/internalization/attach-summary-envelope.js.map +0 -1
- package/dist/runtime-v2/internalization/candidate-lineage.d.ts +0 -185
- package/dist/runtime-v2/internalization/candidate-lineage.d.ts.map +0 -1
- package/dist/runtime-v2/internalization/candidate-lineage.js +0 -357
- package/dist/runtime-v2/internalization/candidate-lineage.js.map +0 -1
- package/dist/runtime-v2/internalization/context-manifest.d.ts +0 -117
- package/dist/runtime-v2/internalization/context-manifest.d.ts.map +0 -1
- package/dist/runtime-v2/internalization/context-manifest.js +0 -156
- package/dist/runtime-v2/internalization/context-manifest.js.map +0 -1
- package/dist/runtime-v2/internalization/context-manifests.d.ts +0 -148
- package/dist/runtime-v2/internalization/context-manifests.d.ts.map +0 -1
- package/dist/runtime-v2/internalization/context-manifests.js +0 -323
- package/dist/runtime-v2/internalization/context-manifests.js.map +0 -1
- package/dist/runtime-v2/internalization/context-resolution.d.ts +0 -189
- package/dist/runtime-v2/internalization/context-resolution.d.ts.map +0 -1
- package/dist/runtime-v2/internalization/context-resolution.js +0 -317
- package/dist/runtime-v2/internalization/context-resolution.js.map +0 -1
- package/dist/runtime-v2/internalization/progressive-evaluator.d.ts +0 -115
- package/dist/runtime-v2/internalization/progressive-evaluator.d.ts.map +0 -1
- package/dist/runtime-v2/internalization/progressive-evaluator.js +0 -248
- package/dist/runtime-v2/internalization/progressive-evaluator.js.map +0 -1
- package/dist/runtime-v2/internalization/prompt-budget-manager.d.ts +0 -90
- package/dist/runtime-v2/internalization/prompt-budget-manager.d.ts.map +0 -1
- package/dist/runtime-v2/internalization/prompt-budget-manager.js +0 -149
- package/dist/runtime-v2/internalization/prompt-budget-manager.js.map +0 -1
- package/dist/runtime-v2/internalization/resolve-injection.d.ts +0 -62
- package/dist/runtime-v2/internalization/resolve-injection.d.ts.map +0 -1
- package/dist/runtime-v2/internalization/resolve-injection.js +0 -78
- package/dist/runtime-v2/internalization/resolve-injection.js.map +0 -1
- package/dist/runtime-v2/internalization/summary-field-reader.d.ts +0 -38
- package/dist/runtime-v2/internalization/summary-field-reader.d.ts.map +0 -1
- package/dist/runtime-v2/internalization/summary-field-reader.js +0 -108
- package/dist/runtime-v2/internalization/summary-field-reader.js.map +0 -1
- package/dist/runtime-v2/observer/__tests__/empathy-observer.real-e2e.test.d.ts +0 -2
- package/dist/runtime-v2/observer/__tests__/empathy-observer.real-e2e.test.d.ts.map +0 -1
- package/dist/runtime-v2/observer/__tests__/empathy-observer.real-e2e.test.js +0 -74
- package/dist/runtime-v2/observer/__tests__/empathy-observer.real-e2e.test.js.map +0 -1
- package/dist/runtime-v2/observer/__tests__/empathy-observer.test.d.ts +0 -2
- package/dist/runtime-v2/observer/__tests__/empathy-observer.test.d.ts.map +0 -1
- package/dist/runtime-v2/observer/__tests__/empathy-observer.test.js +0 -85
- package/dist/runtime-v2/observer/__tests__/empathy-observer.test.js.map +0 -1
- package/dist/runtime-v2/observer/empathy-observer.d.ts +0 -41
- package/dist/runtime-v2/observer/empathy-observer.d.ts.map +0 -1
- package/dist/runtime-v2/observer/empathy-observer.js +0 -104
- package/dist/runtime-v2/observer/empathy-observer.js.map +0 -1
|
@@ -31,8 +31,8 @@ OUTPUT FORMAT (pure JSON, no markdown):
|
|
|
31
31
|
"risks": ["<risk 1>", "<risk 2>"],
|
|
32
32
|
"implementationCode": "function evaluate(input, helpers) { if (input.action.canonicalKind === 'write' && typeof input.action.normalizedPath === 'string' && input.action.normalizedPath.startsWith('/system/')) { return { decision: 'block', matched: true, reason: 'write to system path' }; } return { decision: 'allow', matched: false, reason: 'no risk pattern' }; }",
|
|
33
33
|
"goldenTraceCases": [
|
|
34
|
-
{"caseId":"negative-1","kind":"negative","toolName":"write","params":{"path":"/system/file"},"expectedDecision":"block","ruleContext":"
|
|
35
|
-
{"caseId":"positive-1","kind":"positive","toolName":"write","params":{"path":"/workspace/file"},"expectedDecision":"allow","ruleContext":"
|
|
34
|
+
{"caseId":"negative-1","kind":"negative","toolName":"write","params":{"path":"/system/file"},"expectedDecision":"block","ruleContext":{"version":2,"history":{"status":"available","truncated":false,"calls":[]},"facts":{"priorReadOfTarget":"unknown","readCount":0,"writeCount":0,"uniqueWritePathCount":0,"sameActionBlockCount":null}}},
|
|
35
|
+
{"caseId":"positive-1","kind":"positive","toolName":"write","params":{"path":"/workspace/file"},"expectedDecision":"allow","ruleContext":{"version":2,"history":{"status":"available","truncated":false,"calls":[]},"facts":{"priorReadOfTarget":"unknown","readCount":0,"writeCount":0,"uniqueWritePathCount":0,"sameActionBlockCount":null}}}
|
|
36
36
|
],
|
|
37
37
|
"affectedTools": ["write"],
|
|
38
38
|
"generatedAt": "<ISO-8601 timestamp>"
|
|
@@ -64,6 +64,7 @@ CONSTRAINTS:
|
|
|
64
64
|
- NEVER call string methods on paramsSummary itself — paramsSummary.includes(...), paramsSummary.startsWith(...), paramsSummary.match(...) are always bugs and will crash with "is not a function"
|
|
65
65
|
- To inspect a parameter, access its specific key (e.g. paramsSummary.path) and guard its type at runtime (typeof paramsSummary.path === 'string') before using it as a string
|
|
66
66
|
- For path logic prefer input.action.normalizedPath (a normalized string) over reading raw params strings
|
|
67
|
+
- ADVERSARIAL GUARD CONTRACT: when your rule declares requiresContextVersion: 2, action-level safety still dominates the context — if helpers.isRiskPath() is true the decision MUST be block regardless of input.context; writes to well-known sensitive system locations (/etc/**, system configuration outside the governed workspace) must block even when context reports priorReadOfTarget === 'yes' (a context-provided read outside the workspace is untrusted signal, never authorization)
|
|
67
68
|
- implementationCode MUST be deterministic and self-contained: no imports, require, eval, Function, I/O, network, timers, Date.now, or randomness
|
|
68
69
|
- goldenTraceCases MUST contain 2-10 cases with at least one positive allow case and one negative block case
|
|
69
70
|
- goldenTraceCases expectedDecision MUST be only "allow" or "block" — do NOT emit "propose_correction", "requireApproval", or "auto_correct" (seed-user MVP only supports allow/block; all other action types are rejected by the schema validator)
|
|
@@ -110,6 +111,27 @@ PRIOR OUTPUT-CONTRACT REJECTIONS (when \`priorValidatorErrors\` is present):
|
|
|
110
111
|
// The v2 contract below is the only generation contract; a missing
|
|
111
112
|
// BehaviorExamplePack fails generation loud rather than degrading to an
|
|
112
113
|
// action-only rule.
|
|
114
|
+
/**
|
|
115
|
+
* PRI-839: appended ONLY when `dreamerContext` is present, so a pre-PRI-508 /
|
|
116
|
+
* degraded prompt is unchanged (the same conditional shape
|
|
117
|
+
* `hostSemanticContext` already uses).
|
|
118
|
+
*
|
|
119
|
+
* This block exists so the model can answer the three questions the single
|
|
120
|
+
* `candidates[0]` projection made unanswerable: which alternative paths the
|
|
121
|
+
* Dreamer explored, why one is the primary one, and what risks the others
|
|
122
|
+
* carry. It is deliberately explicit that `priorityRank` is a reading aid and
|
|
123
|
+
* NOT an authority — the critique + principle draft own the intent, and the
|
|
124
|
+
* block must not become a licence to widen the rule's scope.
|
|
125
|
+
*/
|
|
126
|
+
export const DREAMER_CANDIDATE_SET_INSTRUCTION = `
|
|
127
|
+
|
|
128
|
+
DREAMER CANDIDATE SET (PRI-839, when \`dreamerContext\` is present):
|
|
129
|
+
- \`dreamerContext.candidates\` is a BOUNDED, priority-ranked set of the Dreamer's proposals for this formation — not only the first one.
|
|
130
|
+
- \`priorityRank\` 1 is the Dreamer's highest-confidence, lowest-risk proposal by its own authored signals (\`candidateIndex\` is the order the Dreamer wrote them in). This ranking is a READING AID, not an authority: the scribe principle draft and the philosopher critique decide the intent.
|
|
131
|
+
- \`dreamerContext.differenceSummary\` states factually how the proposals differ.
|
|
132
|
+
- Use the alternatives to bound the rule correctly: a proposal's concrete failure mode and concrete better-decision are EVIDENCE for which concrete patterns your evaluate() must cover.
|
|
133
|
+
- Do NOT widen the rule beyond the intent the scribeArtifact formalised, and do NOT merge mutually exclusive proposals into one matcher.
|
|
134
|
+
- \`dreamerContext.omittedCandidateCount\` > 0 means further proposals existed but were dropped to stay within budget — note that in \`risks\` instead of guessing at them.`;
|
|
113
135
|
const V2_CONTEXT_INSTRUCTION = `
|
|
114
136
|
CONTEXT MODE: v2 (Owner-labelled evidence is present)
|
|
115
137
|
- Treat behaviorExamplePack labels as authoritative: sourceNegativeCase MUST remain block and every positiveCounterexample MUST remain allow.
|
|
@@ -150,7 +172,94 @@ CONTEXT MODE: v2 (Owner-labelled evidence is present)
|
|
|
150
172
|
* the CONTEXT MODE block documents the runtime context capabilities
|
|
151
173
|
* (history/facts, default-on assembly, host unavailable declarations).
|
|
152
174
|
*/
|
|
153
|
-
|
|
175
|
+
/**
|
|
176
|
+
* PRI-817: bumped v6 → v7. The OUTPUT FORMAT example previously omitted the
|
|
177
|
+
* three v2-mandatory obligations (requiresContextVersion, evidenceRefs,
|
|
178
|
+
* case-level ruleContext) and misreferenced the CONTEXT MODE block as
|
|
179
|
+
* "above" — an LLM imitating the example verbatim was guaranteed rejected.
|
|
180
|
+
* The example now carries all three obligations with a validator-legal
|
|
181
|
+
* ruleContext object literal, the position reference is corrected, and a
|
|
182
|
+
* NOTE line marks them as REQUIRED.
|
|
183
|
+
*/
|
|
184
|
+
/**
|
|
185
|
+
* PRI-839: bumped v7 → v8. The prompt INPUT shape changed — `dreamerContext`
|
|
186
|
+
* went from a single 5-dim candidate object (`candidates[0]`) to a bounded,
|
|
187
|
+
* priority-ranked candidate SET plus a difference summary — and the system
|
|
188
|
+
* prompt gained the conditional DREAMER_CANDIDATE_SET_INSTRUCTION block.
|
|
189
|
+
* The OUTPUT schema is unchanged, so only the `.prompt.vN` segment moves.
|
|
190
|
+
*/
|
|
191
|
+
export const ARTIFICER_PROMPT_CONTRACT_VERSION = 'artificer-output-v2.prompt.v8';
|
|
192
|
+
// ── EP002-R4: bounded pack projection at the prompt boundary ─────────────────
|
|
193
|
+
//
|
|
194
|
+
// The persisted BehaviorExamplePack keeps full-fidelity raw tool-call payloads
|
|
195
|
+
// (entire file contents, edit diffs). Real workspaces produce real-sized
|
|
196
|
+
// calls, and a single example routinely exceeds the whole 50k prompt budget
|
|
197
|
+
// (live workspace: pack 115,198 chars vs cap 50,000), making v2 generation
|
|
198
|
+
// structurally unreachable there. Bound each example's payload HERE, at the
|
|
199
|
+
// LLM trust boundary (rc-8), never in the pack itself: the model sees bounded
|
|
200
|
+
// previews with an explicit truncation marker, the persisted evidence stays
|
|
201
|
+
// complete, and validateBehaviorExamplePack still runs on the original pack.
|
|
202
|
+
const MAX_PROMPT_PARAM_STRING_CHARS = 2_500;
|
|
203
|
+
const PROMPT_PARAM_TRUNCATION_MARKER = '…[truncated-for-prompt]';
|
|
204
|
+
// Live-workspace measurement: one case's ruleContext.history carried 100 raw
|
|
205
|
+
// calls (45,380 chars) — the aggregate, not any single string, blows the 50k
|
|
206
|
+
// prompt budget. The prompt projection keeps only the window immediately
|
|
207
|
+
// preceding the labeled call; the persisted pack keeps the full history and
|
|
208
|
+
// the runtime gate reconstructs its own context at evaluation time.
|
|
209
|
+
const MAX_PROMPT_HISTORY_CALLS = 12;
|
|
210
|
+
function boundPromptParamString(value) {
|
|
211
|
+
return value.length <= MAX_PROMPT_PARAM_STRING_CHARS
|
|
212
|
+
? value
|
|
213
|
+
: value.slice(0, MAX_PROMPT_PARAM_STRING_CHARS) + PROMPT_PARAM_TRUNCATION_MARKER;
|
|
214
|
+
}
|
|
215
|
+
function boundPromptParams(params) {
|
|
216
|
+
const bounded = {};
|
|
217
|
+
for (const key of Object.keys(params)) {
|
|
218
|
+
const value = params[key];
|
|
219
|
+
bounded[key] = typeof value === 'string'
|
|
220
|
+
? boundPromptParamString(value)
|
|
221
|
+
: value;
|
|
222
|
+
}
|
|
223
|
+
return bounded;
|
|
224
|
+
}
|
|
225
|
+
function boundCaseForPrompt(value) {
|
|
226
|
+
const boundedContext = value.ruleContext !== undefined
|
|
227
|
+
? {
|
|
228
|
+
...value.ruleContext,
|
|
229
|
+
history: {
|
|
230
|
+
...value.ruleContext.history,
|
|
231
|
+
truncated: value.ruleContext.history.truncated
|
|
232
|
+
|| value.ruleContext.history.calls.length > MAX_PROMPT_HISTORY_CALLS,
|
|
233
|
+
calls: value.ruleContext.history.calls
|
|
234
|
+
.slice(-MAX_PROMPT_HISTORY_CALLS)
|
|
235
|
+
.map((call) => ({ ...call, paramsSummary: boundPromptParams(call.paramsSummary) })),
|
|
236
|
+
},
|
|
237
|
+
}
|
|
238
|
+
: undefined;
|
|
239
|
+
return {
|
|
240
|
+
...value,
|
|
241
|
+
params: boundPromptParams(value.params),
|
|
242
|
+
...(value.expectedProposedParams !== undefined
|
|
243
|
+
? { expectedProposedParams: boundPromptParams(value.expectedProposedParams) }
|
|
244
|
+
: {}),
|
|
245
|
+
...(boundedContext !== undefined ? { ruleContext: boundedContext } : {}),
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* EP002-R4: the SINGLE bounded projection shared by the prompt AND the v2
|
|
250
|
+
* echo-contract validation. The model can only copy what it saw, so the
|
|
251
|
+
* "Owner-labelled example was rewritten" check MUST compare against the same
|
|
252
|
+
* bounded cases the prompt presented — comparing against the raw pack would
|
|
253
|
+
* reject every honest echo on real-sized workspaces. Idempotent: an
|
|
254
|
+
* already-bounded pack passes through unchanged.
|
|
255
|
+
*/
|
|
256
|
+
export function boundPackForPrompt(pack) {
|
|
257
|
+
return {
|
|
258
|
+
...pack,
|
|
259
|
+
sourceNegativeCase: boundCaseForPrompt(pack.sourceNegativeCase),
|
|
260
|
+
positiveCounterexamples: pack.positiveCounterexamples.map(boundCaseForPrompt),
|
|
261
|
+
};
|
|
262
|
+
}
|
|
154
263
|
/**
|
|
155
264
|
* PRI-741: render the host semantic projection as a prompt block. Mirrors the
|
|
156
265
|
* evaluator's TOOL CATALOG AUTHORITY pattern: the list is authoritative for
|
|
@@ -200,6 +309,9 @@ export class ArtificerPromptBuilder {
|
|
|
200
309
|
}
|
|
201
310
|
const artificerInstruction = ARTIFICER_PROTOCOL_INSTRUCTION
|
|
202
311
|
+ V2_CONTEXT_INSTRUCTION
|
|
312
|
+
// PRI-839: candidate-set guidance (absent = no block, prompt unchanged
|
|
313
|
+
// for formations without resolvable dreamer proposals).
|
|
314
|
+
+ (input.dreamerContext !== undefined ? DREAMER_CANDIDATE_SET_INSTRUCTION : '')
|
|
203
315
|
// PRI-741: host semantic projection (absent = no block, prompt
|
|
204
316
|
// unchanged for workspaces without a host declaration).
|
|
205
317
|
+ (input.hostSemanticContext !== undefined ? buildHostSemanticContextBlock(input.hostSemanticContext) : '')
|
|
@@ -207,7 +319,10 @@ export class ArtificerPromptBuilder {
|
|
|
207
319
|
// (empty string when outputLanguage is undefined).
|
|
208
320
|
+ buildLanguageDirective(input.outputLanguage, 'implementation');
|
|
209
321
|
const promptInput = {
|
|
210
|
-
|
|
322
|
+
// EP002-R4: bounded projection — the pack's raw payloads can exceed the
|
|
323
|
+
// 50k prompt cap on real workspaces; the LLM gets bounded previews while
|
|
324
|
+
// the persisted pack (and everything downstream of it) keeps full fidelity.
|
|
325
|
+
behaviorExamplePack: boundPackForPrompt(input.behaviorExamplePack),
|
|
211
326
|
taskId: input.taskId,
|
|
212
327
|
contextHash: input.contextHash,
|
|
213
328
|
sourceScribeArtifactId: input.sourceScribeArtifactId,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"artificer-prompt-builder.js","sourceRoot":"","sources":["../../../src/runtime-v2/internalization/artificer-prompt-builder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"artificer-prompt-builder.js","sourceRoot":"","sources":["../../../src/runtime-v2/internalization/artificer-prompt-builder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAC;AAQzE,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AA8JlE,MAAM,CAAC,MAAM,8BAA8B,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwG7C,CAAC;AAEF,0EAA0E;AAC1E,2EAA2E;AAC3E,mEAAmE;AACnE,wEAAwE;AACxE,oBAAoB;AAEpB;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,iCAAiC,GAAG;;;;;;;;4KAQ2H,CAAC;AAE7K,MAAM,sBAAsB,GAAG;;;;;;;;;;CAU9B,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH;;;;;;;;GAQG;AACH;;;;;;GAMG;AACH;;;;;;;;GAQG;AACH;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,iCAAiC,GAAG,+BAA+B,CAAC;AAEjF,gFAAgF;AAChF,EAAE;AACF,+EAA+E;AAC/E,yEAAyE;AACzE,4EAA4E;AAC5E,2EAA2E;AAC3E,4EAA4E;AAC5E,8EAA8E;AAC9E,4EAA4E;AAC5E,6EAA6E;AAE7E,MAAM,6BAA6B,GAAG,KAAK,CAAC;AAC5C,MAAM,8BAA8B,GAAG,yBAAyB,CAAC;AACjE,6EAA6E;AAC7E,6EAA6E;AAC7E,yEAAyE;AACzE,4EAA4E;AAC5E,oEAAoE;AACpE,MAAM,wBAAwB,GAAG,EAAE,CAAC;AAEpC,SAAS,sBAAsB,CAAC,KAAa;IAC3C,OAAO,KAAK,CAAC,MAAM,IAAI,6BA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AC,mBAAmB,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,mBAAmB,EAAE,KAAK,CAAC,mBAAmB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SACvG,CAAC;QAEF,MAAM,OAAO,GAAG,oBAAoB,CAAC,WAAW,CAAC,CAAC;QAElD,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,oBAAoB,EAAE,CAAC;IACtE,CAAC;CACF"}
|
|
@@ -202,6 +202,18 @@ export declare class ArtificerRunner extends BasePeerRunner<ArtificerContext, Ar
|
|
|
202
202
|
private isArtificerOutputRetryEnabled;
|
|
203
203
|
buildContext(taskId: string): Promise<ArtificerContext>;
|
|
204
204
|
invokeRuntime(taskId: string, context: ArtificerContext): Promise<RunHandle>;
|
|
205
|
+
/**
|
|
206
|
+
* EP002-R4: restore Owner-labelled goldenTraceCases from the authoritative
|
|
207
|
+
* (bounded) pack BEFORE validation. The v2 contract requires the artifact to
|
|
208
|
+
* carry the Owner-labelled evidence verbatim — but demanding that the MODEL
|
|
209
|
+
* transcribe multi-KB history windows byte-perfectly rejected honest echoes
|
|
210
|
+
* on real-sized packs (live evidence: 2/2 L2 submissions succeeded, both
|
|
211
|
+
* rejected as "was rewritten"). Mechanical restoration is strictly STRONGER
|
|
212
|
+
* against fabrication: the model cannot rewrite what the code overwrites.
|
|
213
|
+
* The model's own additional cases (different caseIds) pass through
|
|
214
|
+
* untouched and still face full validation.
|
|
215
|
+
*/
|
|
216
|
+
protected fetchAndParseOutput(runId: string, taskId: string): Promise<unknown>;
|
|
205
217
|
validateOutput(output: unknown, taskId: string, context: ArtificerContext): Promise<PeerRunnerValidationResult>;
|
|
206
218
|
succeedTask(taskId: string, runId: string, output: ArtificerRuleOutput, task: TaskRecord, contextHash: string, context: ArtificerContext): Promise<PeerRunnerResult<ArtificerRuleOutput>>;
|
|
207
219
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"artificer-runner.d.ts","sourceRoot":"","sources":["../../../src/runtime-v2/internalization/artificer-runner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,EAAE,mBAAmB,EAAE,kBAAkB,
|
|
1
|
+
{"version":3,"file":"artificer-runner.d.ts","sourceRoot":"","sources":["../../../src/runtime-v2/internalization/artificer-runner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,EAAE,mBAAmB,EAAE,kBAAkB,EAAwB,MAAM,uBAAuB,CAAC;AAC3G,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAkB,KAAK,eAAe,EAAqB,MAAM,wBAAwB,CAAC;AAEjG,OAAO,EAAuB,KAAK,aAAa,EAAE,KAAK,mBAAmB,EAAmD,MAAM,sBAAsB,CAAC;AAE1J,OAAO,EAA8C,KAAK,uBAAuB,EAAE,KAAK,4BAA4B,EAAE,MAAM,+BAA+B,CAAC;AAK5J,YAAY,EAAE,4BAA4B,EAAE,CAAC;AAG7C,OAAO,EAEL,KAAK,mBAAmB,EACzB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,KAAK,EACV,iBAAiB,EACjB,cAAc,EACd,gBAAgB,EAChB,0BAA0B,EAC3B,MAAM,gCAAgC,CAAC;AACxC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAItE,uFAAuF;AACvF,UAAU,gBAAgB;IACxB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CA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E,CAAC"}
|
|
@@ -2,35 +2,11 @@ import { PDRuntimeError, isPDErrorCategory } from '../error-categories.js';
|
|
|
2
2
|
import { computeFeatureFlagsFromConfig, isFeatureEnabled } from '../config/pd-config-feature-flags.js';
|
|
3
3
|
import { hydratePITaskRecord, parseLastValidatorErrors, isFreshForNextAttempt } from './pitask-metadata.js';
|
|
4
4
|
import { extractIntentContract } from './intent-contract.js';
|
|
5
|
-
import { ArtificerPromptBuilder } from './artificer-prompt-builder.js';
|
|
6
|
-
import {
|
|
5
|
+
import { ArtificerPromptBuilder, boundPackForPrompt } from './artificer-prompt-builder.js';
|
|
6
|
+
import { projectDreamerProposals, summarizeCandidateDifferences } from './formation-context.js';
|
|
7
7
|
import { reconcileLineageEcho } from './peer-runner-contracts.js';
|
|
8
8
|
import { resolveRepairReplayContext, } from './repair-replay-resolver.js';
|
|
9
9
|
import { BasePeerRunner } from '../runner/base-peer-runner.js';
|
|
10
|
-
/**
|
|
11
|
-
* Layer 0 (design §6.1): artificer's edge predecessor is `scribe`, whose
|
|
12
|
-
* artifact `buildContext` already loaded. Reusing that string keeps the writer
|
|
13
|
-
* path at zero extra store reads (F3). Returns null when no scribe artifact
|
|
14
|
-
* was resolved (buildContext's `empty-context` short-circuit, or a missing
|
|
15
|
-
* sourceTrace) — the writer then emits `artifact_summary_predecessor_absent`
|
|
16
|
-
* and writes only the self `summary` (rc-9).
|
|
17
|
-
*/
|
|
18
|
-
function toScribePredecessor(context) {
|
|
19
|
-
if (!context.scribeArtifact || !context.sourceScribeArtifactId)
|
|
20
|
-
return null;
|
|
21
|
-
let contentJson;
|
|
22
|
-
try {
|
|
23
|
-
contentJson = JSON.parse(context.scribeArtifact);
|
|
24
|
-
}
|
|
25
|
-
catch {
|
|
26
|
-
contentJson = context.scribeArtifact;
|
|
27
|
-
}
|
|
28
|
-
return {
|
|
29
|
-
artifactId: context.sourceScribeArtifactId,
|
|
30
|
-
runnerKind: 'scribe',
|
|
31
|
-
contentJson,
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
10
|
const DEFAULT_ARTIFICER_RUNNER_OPTIONS = {
|
|
35
11
|
pollIntervalMs: 5_000,
|
|
36
12
|
timeoutMs: 300_000,
|
|
@@ -52,8 +28,22 @@ function isRecord(value) {
|
|
|
52
28
|
}
|
|
53
29
|
// ── PRI-508: Dreamer context extraction ─────────────────────────────────────
|
|
54
30
|
/**
|
|
55
|
-
* Resolve the dreamer candidate
|
|
56
|
-
*
|
|
31
|
+
* Resolve the dreamer candidate context from the dreamer artifact referenced
|
|
32
|
+
* by `scribe.sourceTrace.dreamerArtifactId`.
|
|
33
|
+
*
|
|
34
|
+
* PRI-839: this previously projected `candidates[0]` and silently discarded the
|
|
35
|
+
* rest (PRI-835 §DC-3). Production has 31 of 33 dreamer artifacts carrying ≥2
|
|
36
|
+
* candidates, so the upstream exploration cost was paid and then thrown away.
|
|
37
|
+
* The projection is now a BOUNDED, priority-ranked SET — the shape validation,
|
|
38
|
+
* per-field clamping and deterministic ranking live in
|
|
39
|
+
* `formation-context.ts` (`projectDreamerProposals`), which the Scribe's
|
|
40
|
+
* formation context also uses, so there is ONE definition of a projected
|
|
41
|
+
* dreamer proposal rather than two divergent ones.
|
|
42
|
+
*
|
|
43
|
+
* The bounding idiom is not new to this file: `boundPackForPrompt`
|
|
44
|
+
* (artificer-prompt-builder.ts, EP002-R4) already bounds the BehaviorExamplePack
|
|
45
|
+
* at the same prompt boundary for the same reason — the persisted evidence
|
|
46
|
+
* keeps full fidelity while the LLM receives a bounded preview.
|
|
57
47
|
*
|
|
58
48
|
* Trust boundary (rc-1, rc-2): scribe contentJson and dreamer contentJson are
|
|
59
49
|
* untrusted. All field access uses Object.hasOwn (rc-5) and typeof / Array.isArray
|
|
@@ -67,6 +57,9 @@ function isRecord(value) {
|
|
|
67
57
|
* `dreamer_artifact_missing` / `dreamer_context_invalid` event so the gap is
|
|
68
58
|
* observable. Returns undefined (best-effort, non-blocking) so the artificer
|
|
69
59
|
* can still proceed with the scribe principle alone.
|
|
60
|
+
*
|
|
61
|
+
* The event vocabulary below is deliberately UNCHANGED from pre-PRI-839 so the
|
|
62
|
+
* existing observability contract still holds.
|
|
70
63
|
*/
|
|
71
64
|
async function resolveDreamerContext(params) {
|
|
72
65
|
const { scribeContentJson, taskId, emitEvent } = params;
|
|
@@ -123,57 +116,44 @@ async function resolveDreamerContext(params) {
|
|
|
123
116
|
emitEvent('dreamer_context_invalid', taskId, { dreamerArtifactId, reason: 'content_not_record' });
|
|
124
117
|
return undefined;
|
|
125
118
|
}
|
|
126
|
-
//
|
|
127
|
-
|
|
128
|
-
if (
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
if (!isRecord(firstCandidate)) {
|
|
143
|
-
emitEvent('dreamer_context_invalid', taskId, { dreamerArtifactId, reason: 'candidate0_not_record' });
|
|
144
|
-
return undefined;
|
|
145
|
-
}
|
|
146
|
-
// Validate the 5-dim fields. badDecision/betterDecision/rationale are required strings.
|
|
147
|
-
// riskLevel/strategicPerspective are optional but must be string when present.
|
|
148
|
-
const requiredString = (key) => {
|
|
149
|
-
if (!Object.hasOwn(firstCandidate, key))
|
|
150
|
-
return undefined;
|
|
151
|
-
const value = firstCandidate[key];
|
|
152
|
-
return typeof value === 'string' && value.trim() !== '' ? value : undefined;
|
|
153
|
-
};
|
|
154
|
-
const badDecision = requiredString('badDecision');
|
|
155
|
-
const betterDecision = requiredString('betterDecision');
|
|
156
|
-
const rationale = requiredString('rationale');
|
|
157
|
-
if (badDecision === undefined || betterDecision === undefined || rationale === undefined) {
|
|
119
|
+
// PRI-839: one bounded projection shared with the scribe's formation context.
|
|
120
|
+
const projection = projectDreamerProposals(dreamerParsed);
|
|
121
|
+
if (projection.candidates.length === 0) {
|
|
122
|
+
// No usable proposal. Preserve the pre-PRI-839 reason vocabulary so the
|
|
123
|
+
// observability contract is unchanged even though the check is now set-wide.
|
|
124
|
+
const candidatesField = dreamerParsed.candidates;
|
|
125
|
+
let reason = 'missing_required_5dim_fields';
|
|
126
|
+
if (!Array.isArray(candidatesField)) {
|
|
127
|
+
reason = 'candidates_not_array';
|
|
128
|
+
}
|
|
129
|
+
else if (candidatesField.length === 0) {
|
|
130
|
+
reason = 'candidates_empty';
|
|
131
|
+
}
|
|
132
|
+
else if (!isRecord(candidatesField[0])) {
|
|
133
|
+
reason = 'candidate0_not_record';
|
|
134
|
+
}
|
|
158
135
|
emitEvent('dreamer_context_invalid', taskId, {
|
|
159
136
|
dreamerArtifactId,
|
|
160
|
-
reason
|
|
161
|
-
|
|
162
|
-
hasBetterDecision: betterDecision !== undefined,
|
|
163
|
-
hasRationale: rationale !== undefined,
|
|
137
|
+
reason,
|
|
138
|
+
truncationNotes: projection.truncationNotes,
|
|
164
139
|
});
|
|
165
140
|
return undefined;
|
|
166
141
|
}
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
142
|
+
if (projection.truncationNotes.length > 0) {
|
|
143
|
+
// rc-9: a partially usable set still carries an explicit trace of what was
|
|
144
|
+
// dropped, so a quality regression can be traced back to the bound.
|
|
145
|
+
emitEvent('dreamer_context_partial', taskId, {
|
|
146
|
+
dreamerArtifactId,
|
|
147
|
+
candidateCount: projection.candidates.length,
|
|
148
|
+
omittedCandidateCount: projection.omittedCandidateCount,
|
|
149
|
+
truncationNotes: projection.truncationNotes,
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
return {
|
|
153
|
+
candidates: projection.candidates,
|
|
154
|
+
differenceSummary: summarizeCandidateDifferences(projection.candidates),
|
|
155
|
+
omittedCandidateCount: projection.omittedCandidateCount,
|
|
175
156
|
};
|
|
176
|
-
return dreamerContext;
|
|
177
157
|
}
|
|
178
158
|
// ── PRI-509: Evaluator repair feedback formatting ───────────────────────────
|
|
179
159
|
/**
|
|
@@ -213,50 +193,6 @@ function formatReplayEvidenceBlock(context) {
|
|
|
213
193
|
}
|
|
214
194
|
return lines.join('\n');
|
|
215
195
|
}
|
|
216
|
-
/**
|
|
217
|
-
* PR B: expose the RepairPayload and the PR-A replay evidence as RELATED
|
|
218
|
-
* context sources (design §33). They are causal references — NOT ancestry — so
|
|
219
|
-
* nothing here reaches into `lineageArtifactIds`.
|
|
220
|
-
*
|
|
221
|
-
* The replay values come straight from the already-bounded
|
|
222
|
-
* `RepairReplayContext`: the information plane therefore inherits PR A's ≤16
|
|
223
|
-
* selection (`MAX_REPLAY_FAILURES_IN_REPAIR`) and never re-expands the durable
|
|
224
|
-
* `failedCases` array (design §43).
|
|
225
|
-
*/
|
|
226
|
-
function buildRepairRelatedSources(context) {
|
|
227
|
-
const sources = [];
|
|
228
|
-
const { replayContext, repairPayload } = context;
|
|
229
|
-
if (repairPayload !== undefined) {
|
|
230
|
-
sources.push({
|
|
231
|
-
namespace: 'repair',
|
|
232
|
-
summary: {
|
|
233
|
-
requiredChanges: repairPayload.requiredChanges,
|
|
234
|
-
concerns: repairPayload.concerns,
|
|
235
|
-
},
|
|
236
|
-
});
|
|
237
|
-
}
|
|
238
|
-
if (replayContext !== undefined) {
|
|
239
|
-
const failureTypes = new Set();
|
|
240
|
-
for (const failure of [...replayContext.systemFailures, ...replayContext.traceFailures]) {
|
|
241
|
-
failureTypes.add(failure.errorType);
|
|
242
|
-
}
|
|
243
|
-
sources.push({
|
|
244
|
-
namespace: 'replay',
|
|
245
|
-
summary: {
|
|
246
|
-
passed: replayContext.passed,
|
|
247
|
-
failedCaseCount: replayContext.failedCaseCount,
|
|
248
|
-
// Deterministic: sorted, so the same context always renders identically.
|
|
249
|
-
failureTypes: [...failureTypes].sort(),
|
|
250
|
-
},
|
|
251
|
-
raw: {
|
|
252
|
-
traceFailures: replayContext.traceFailures,
|
|
253
|
-
systemFailures: replayContext.systemFailures,
|
|
254
|
-
globalViolations: replayContext.globalViolations,
|
|
255
|
-
},
|
|
256
|
-
});
|
|
257
|
-
}
|
|
258
|
-
return sources;
|
|
259
|
-
}
|
|
260
196
|
/**
|
|
261
197
|
* Format a validated RepairPayload into a repairFeedback string for the
|
|
262
198
|
* artificer prompt. The format is PoC-validated (Campaign 1 R2):
|
|
@@ -615,48 +551,16 @@ export class ArtificerRunner extends BasePeerRunner {
|
|
|
615
551
|
catch {
|
|
616
552
|
scribeArtifactInput = context.scribeArtifact;
|
|
617
553
|
}
|
|
618
|
-
// PRI-703 Phase 1
|
|
619
|
-
|
|
620
|
-
// 为扁平 summary 字段(intentOwner 等),根级 intentContract 对象不再
|
|
621
|
-
// 存在,收窄后提取恒为 null(context_manifest_budget 开启即丢契约)。
|
|
554
|
+
// PRI-703 Phase 1:intent contract 从完整 scribe 工件提取
|
|
555
|
+
//(manifest 收窄路径已随 PRI-819 R-06 退役,工件不再被替换)。
|
|
622
556
|
const fullScribeArtifact = scribeArtifactInput;
|
|
623
|
-
//
|
|
624
|
-
//
|
|
625
|
-
//
|
|
626
|
-
//
|
|
627
|
-
// allocated fields; fallback/disabled → legacy full scribeArtifact (F13).
|
|
628
|
-
const scribePred = toScribePredecessor(context);
|
|
629
|
-
let replayViaManifest = false;
|
|
630
|
-
if (scribePred !== null) {
|
|
631
|
-
const isRepair = context.replayContext !== undefined;
|
|
632
|
-
const manifest = isRepair ? ARTIFICER_REPAIR_MANIFEST : ARTIFICER_MANIFEST;
|
|
633
|
-
const relatedSources = isRepair ? buildRepairRelatedSources(context) : undefined;
|
|
634
|
-
// Required-evidence gate (design §35/§43): on a repair round the replay
|
|
635
|
-
// evidence MUST reach the prompt. If the manifest budget cannot carry it,
|
|
636
|
-
// resolution falls back and the bounded PR-A string channel is used
|
|
637
|
-
// instead of injecting a thinner prompt. Normal artificer tier2 stays
|
|
638
|
-
// optional — `dreamerContext` (PRI-508, F2) is its safety net.
|
|
639
|
-
const resolved = await this.resolveContextInjectionAsync({
|
|
640
|
-
taskId,
|
|
641
|
-
manifest,
|
|
642
|
-
predecessorContentJson: scribePred.contentJson,
|
|
643
|
-
startArtifactId: context.sourceScribeArtifactId ?? undefined,
|
|
644
|
-
...(relatedSources !== undefined ? { relatedSources } : {}),
|
|
645
|
-
requiredPaths: isRepair ? [...ARTIFICER_REPAIR_MANIFEST.tier2] : [],
|
|
646
|
-
});
|
|
647
|
-
if (resolved.mode === 'focused') {
|
|
648
|
-
scribeArtifactInput = resolved.fields;
|
|
649
|
-
replayViaManifest = isRepair;
|
|
650
|
-
}
|
|
651
|
-
}
|
|
652
|
-
// PR B (design §26): pick the replay-evidence channel. When the manifest
|
|
653
|
-
// carried it, the base string keeps concerns + required changes only; when
|
|
654
|
-
// the flag is off (or the budget could not carry the evidence) the PR-A
|
|
655
|
-
// bounded evidence block is appended — exactly the pre-PR-B behavior, so
|
|
656
|
-
// the replay evidence never depends on a quiet flag being on.
|
|
557
|
+
// PR B (design §26): the replay-evidence channel. The manifest channel was
|
|
558
|
+
// retired with PRI-819 R-06 (context_manifest_budget gone); the PR-A
|
|
559
|
+
// bounded evidence block is the unconditional channel, so the replay
|
|
560
|
+
// evidence never depended on a quiet flag being on.
|
|
657
561
|
let { repairFeedback } = context;
|
|
658
562
|
const { replayContext, repairPayload } = context;
|
|
659
|
-
if (replayContext !== undefined && repairPayload !== undefined
|
|
563
|
+
if (replayContext !== undefined && repairPayload !== undefined) {
|
|
660
564
|
repairFeedback = formatRepairFeedback(repairPayload, formatReplayEvidenceBlock(replayContext));
|
|
661
565
|
}
|
|
662
566
|
// PRI-703 Phase 1: extract from the FULL scribe artifact (captured before
|
|
@@ -720,9 +624,49 @@ ${context.revisionFeedback}
|
|
|
720
624
|
systemPrompt,
|
|
721
625
|
});
|
|
722
626
|
}
|
|
627
|
+
/**
|
|
628
|
+
* EP002-R4: restore Owner-labelled goldenTraceCases from the authoritative
|
|
629
|
+
* (bounded) pack BEFORE validation. The v2 contract requires the artifact to
|
|
630
|
+
* carry the Owner-labelled evidence verbatim — but demanding that the MODEL
|
|
631
|
+
* transcribe multi-KB history windows byte-perfectly rejected honest echoes
|
|
632
|
+
* on real-sized packs (live evidence: 2/2 L2 submissions succeeded, both
|
|
633
|
+
* rejected as "was rewritten"). Mechanical restoration is strictly STRONGER
|
|
634
|
+
* against fabrication: the model cannot rewrite what the code overwrites.
|
|
635
|
+
* The model's own additional cases (different caseIds) pass through
|
|
636
|
+
* untouched and still face full validation.
|
|
637
|
+
*/
|
|
638
|
+
async fetchAndParseOutput(runId, taskId) {
|
|
639
|
+
const output = await super.fetchAndParseOutput(runId, taskId);
|
|
640
|
+
if (this.behaviorExamplePack === undefined
|
|
641
|
+
|| output === null || typeof output !== 'object' || Array.isArray(output)) {
|
|
642
|
+
return output;
|
|
643
|
+
}
|
|
644
|
+
const record = output;
|
|
645
|
+
if (!Array.isArray(record.goldenTraceCases))
|
|
646
|
+
return output;
|
|
647
|
+
const bounded = boundPackForPrompt(this.behaviorExamplePack);
|
|
648
|
+
const authoritative = new Map();
|
|
649
|
+
for (const ownerCase of [bounded.sourceNegativeCase, ...bounded.positiveCounterexamples]) {
|
|
650
|
+
authoritative.set(ownerCase.caseId, ownerCase);
|
|
651
|
+
}
|
|
652
|
+
record.goldenTraceCases = record.goldenTraceCases.map((entry) => {
|
|
653
|
+
if (entry !== null && typeof entry === 'object' && !Array.isArray(entry)) {
|
|
654
|
+
const { caseId } = entry;
|
|
655
|
+
const restored = typeof caseId === 'string' ? authoritative.get(caseId) : undefined;
|
|
656
|
+
if (restored !== undefined)
|
|
657
|
+
return restored;
|
|
658
|
+
}
|
|
659
|
+
return entry;
|
|
660
|
+
});
|
|
661
|
+
return record;
|
|
662
|
+
}
|
|
723
663
|
async validateOutput(output, taskId, context) {
|
|
724
664
|
const result = await this.validator.validate(output, taskId, context.sourceScribeArtifactId ?? undefined);
|
|
725
|
-
|
|
665
|
+
// EP002-R4: the echo contract must compare against the SAME bounded
|
|
666
|
+
// projection the prompt presented (the model can only copy what it
|
|
667
|
+
// saw); validating against the raw pack would reject every honest
|
|
668
|
+
// echo on real-sized workspaces.
|
|
669
|
+
const modeErrors = validateV2OutputContract(output, this.behaviorExamplePack !== undefined ? boundPackForPrompt(this.behaviorExamplePack) : undefined);
|
|
726
670
|
// Trust-boundary: validator returns `string | undefined` for errorCategory.
|
|
727
671
|
// Must not `as`-cast; validate at runtime (ERR-001, ERR-005).
|
|
728
672
|
const rawCategory = result.errorCategory;
|
|
@@ -804,7 +748,7 @@ ${context.revisionFeedback}
|
|
|
804
748
|
// scribe. The dreamer 5-dim context still flows through the separate
|
|
805
749
|
// PRI-508 `resolveDreamerContext` path (F2) — it does NOT enter
|
|
806
750
|
// `predecessorSummary` (which holds exactly one edge predecessor).
|
|
807
|
-
contentJson:
|
|
751
|
+
contentJson: JSON.stringify(output),
|
|
808
752
|
createdAt: now,
|
|
809
753
|
updatedAt: now,
|
|
810
754
|
});
|