create-principles-disciple 1.150.3 → 1.150.6
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/_release/product-identity.json +1 -1
- package/codex-adapter/dist/ingestion/admission.js +2 -0
- package/codex-adapter/dist/ingestion/ingestion.js +25 -4
- package/codex-adapter/dist/ingestion/transcript-decoder.d.ts +5 -3
- package/codex-adapter/dist/ingestion/transcript-decoder.js +61 -5
- package/codex-adapter/dist/pd-hook.d.ts +7 -5
- package/codex-adapter/dist/pd-hook.js +18 -7
- package/codex-adapter/dist/tool-semantics.js +5 -1
- package/codex-adapter/dist/worker/workspace-worker.js +4 -2
- package/codex-adapter/package.json +1 -1
- package/console/dist/lib/utils.js +16 -1
- package/console/dist/server/index.js +14 -2
- package/console/dist/server/models/ActivationsConsoleModel.js +3 -2
- package/console/dist/server/models/ApprovalsConsoleModel.js +2 -1
- package/console/dist/server/models/ApprovalsGroupedConsoleModel.js +2 -1
- package/console/dist/server/models/EvidenceChainConsoleModel.d.ts +46 -0
- package/console/dist/server/models/EvidenceChainConsoleModel.js +121 -2
- package/console/dist/server/models/GovernanceConsoleModel.js +3 -2
- package/console/dist/server/models/GovernanceExperienceCollector.js +2 -1
- package/console/dist/server/models/GovernanceProjectionCollector.js +2 -1
- package/console/dist/server/models/IngestionHealthModel.d.ts +34 -0
- package/console/dist/server/models/IngestionHealthModel.js +254 -0
- package/console/dist/server/models/IntentDecisionModel.js +2 -2
- package/console/dist/server/models/IntentPageModel.js +2 -1
- package/console/dist/server/models/OwnerDecisionConsoleModel.js +3 -3
- package/console/dist/server/models/OwnerDecisionViewModel.js +2 -2
- package/console/dist/server/models/PrincipleTrajectoryModel.js +2 -1
- package/console/dist/server/models/ReceiptsConsoleModel.js +2 -2
- package/console/dist/server/models/RuleCandidateBindingConsoleModel.js +3 -2
- package/console/dist/server/routes/diagnostician.js +2 -1
- package/console/dist/server/routes/evidence-chain.d.ts +4 -0
- package/console/dist/server/routes/evidence-chain.js +22 -0
- package/console/dist/server/routes/failed-tasks.js +78 -2
- package/console/dist/server/routes/health.d.ts +8 -0
- package/console/dist/server/routes/health.js +72 -0
- package/console/dist/server/routes/owner-identity.d.ts +6 -0
- package/console/dist/server/routes/owner-identity.js +7 -3
- package/console/dist/server/routes/principles.js +3 -3
- package/console/dist/web/assets/app.css +150 -46
- package/console/dist/web/assets/app.js +37 -32
- package/console/package.json +2 -0
- package/core/dist/runtime/activation/adaptive-selection-output.d.ts +0 -21
- package/core/dist/runtime/activation/adaptive-selection-output.d.ts.map +1 -1
- package/core/dist/runtime/activation/adaptive-selection-output.js.map +1 -1
- package/core/dist/runtime/activation/index.d.ts +2 -6
- package/core/dist/runtime/activation/index.d.ts.map +1 -1
- package/core/dist/runtime/activation/index.js.map +1 -1
- package/core/dist/runtime/activation/production-gate-deps.d.ts +2 -1
- package/core/dist/runtime/activation/production-gate-deps.d.ts.map +1 -1
- package/core/dist/runtime/activation/prompt-activation-reader-contract.d.ts +2 -1
- package/core/dist/runtime/activation/prompt-activation-reader-contract.d.ts.map +1 -1
- package/core/dist/runtime/activation/writers/index.d.ts +0 -1
- package/core/dist/runtime/activation/writers/index.d.ts.map +1 -1
- package/core/dist/runtime/activation/writers/rule-host-writer.d.ts.map +1 -1
- package/core/dist/runtime/activation/writers/rule-host-writer.js +15 -6
- package/core/dist/runtime/activation/writers/rule-host-writer.js.map +1 -1
- package/core/dist/runtime/activation-compatibility-read-model.d.ts +3 -2
- package/core/dist/runtime/activation-compatibility-read-model.d.ts.map +1 -1
- package/core/dist/runtime/activation-compatibility-read-model.js +2 -1
- package/core/dist/runtime/activation-compatibility-read-model.js.map +1 -1
- package/core/dist/runtime/adapter/context-budget.d.ts +3 -14
- package/core/dist/runtime/adapter/context-budget.d.ts.map +1 -1
- package/core/dist/runtime/adapter/context-budget.js +2 -2
- package/core/dist/runtime/adapter/context-budget.js.map +1 -1
- package/core/dist/runtime/adapter/index.d.ts +1 -2
- package/core/dist/runtime/adapter/index.d.ts.map +1 -1
- package/core/dist/runtime/adapter/index.js +1 -1
- package/core/dist/runtime/adapter/index.js.map +1 -1
- package/core/dist/runtime/adapter/output-repair-contract.d.ts +18 -1
- package/core/dist/runtime/adapter/output-repair-contract.d.ts.map +1 -1
- package/core/dist/runtime/adapter/output-repair-contract.js +94 -0
- package/core/dist/runtime/adapter/output-repair-contract.js.map +1 -1
- package/core/dist/runtime/adapter/pi-ai-runtime-adapter.d.ts +2 -3
- package/core/dist/runtime/adapter/pi-ai-runtime-adapter.d.ts.map +1 -1
- package/core/dist/runtime/adapter/pi-ai-runtime-adapter.js +111 -21
- package/core/dist/runtime/adapter/pi-ai-runtime-adapter.js.map +1 -1
- package/core/dist/runtime/adapter/principle-tree-ledger-adapter.d.ts +1 -1
- package/core/dist/runtime/adapter/principle-tree-ledger-adapter.d.ts.map +1 -1
- package/core/dist/runtime/adapter/schema-prompt-adapter.d.ts +0 -1
- package/core/dist/runtime/adapter/schema-prompt-adapter.d.ts.map +1 -1
- package/core/dist/runtime/adapter/schema-prompt-adapter.js +43 -1
- package/core/dist/runtime/adapter/schema-prompt-adapter.js.map +1 -1
- package/core/dist/runtime/bridge-result-shaper.d.ts +1 -1
- package/core/dist/runtime/bridge-result-shaper.d.ts.map +1 -1
- package/core/dist/runtime/candidate-audit.d.ts.map +1 -1
- package/core/dist/runtime/candidate-audit.js +2 -1
- package/core/dist/runtime/candidate-audit.js.map +1 -1
- package/core/dist/runtime/candidate-intake-service.d.ts +2 -1
- package/core/dist/runtime/candidate-intake-service.d.ts.map +1 -1
- package/core/dist/runtime/cli/diagnose.d.ts +4 -3
- package/core/dist/runtime/cli/diagnose.d.ts.map +1 -1
- package/core/dist/runtime/config/index.d.ts +2 -2
- package/core/dist/runtime/config/index.d.ts.map +1 -1
- package/core/dist/runtime/config/index.js +3 -3
- package/core/dist/runtime/config/index.js.map +1 -1
- package/core/dist/runtime/config/pd-config-defaults.d.ts +0 -2
- package/core/dist/runtime/config/pd-config-defaults.d.ts.map +1 -1
- package/core/dist/runtime/config/pd-config-defaults.js +2 -2
- package/core/dist/runtime/config/pd-config-defaults.js.map +1 -1
- package/core/dist/runtime/config/pd-config-effective.d.ts.map +1 -1
- package/core/dist/runtime/config/pd-config-effective.js +2 -0
- package/core/dist/runtime/config/pd-config-effective.js.map +1 -1
- package/core/dist/runtime/config/pd-config-types.d.ts +54 -0
- package/core/dist/runtime/config/pd-config-types.d.ts.map +1 -1
- package/core/dist/runtime/config/pd-config-types.js.map +1 -1
- package/core/dist/runtime/config/pd-config-validate.d.ts.map +1 -1
- package/core/dist/runtime/config/pd-config-validate.js +143 -0
- package/core/dist/runtime/config/pd-config-validate.js.map +1 -1
- package/core/dist/runtime/config/pd-profile-constants.d.ts +1 -7
- package/core/dist/runtime/config/pd-profile-constants.d.ts.map +1 -1
- package/core/dist/runtime/config/pd-profile-constants.js +5 -6
- package/core/dist/runtime/config/pd-profile-constants.js.map +1 -1
- package/core/dist/runtime/config/pd-validate-profile.d.ts +3 -2
- package/core/dist/runtime/config/pd-validate-profile.d.ts.map +1 -1
- package/core/dist/runtime/context-payload.d.ts +0 -7
- package/core/dist/runtime/context-payload.d.ts.map +1 -1
- package/core/dist/runtime/context-payload.js +1 -1
- package/core/dist/runtime/context-payload.js.map +1 -1
- package/core/dist/runtime/core-principles/index.d.ts +1 -1
- package/core/dist/runtime/core-principles/index.d.ts.map +1 -1
- package/core/dist/runtime/correction/correction-types.d.ts +0 -10
- package/core/dist/runtime/correction/correction-types.d.ts.map +1 -1
- package/core/dist/runtime/correction/correction-types.js.map +1 -1
- package/core/dist/runtime/diagnostician/diag-distiller-output.d.ts +0 -3
- package/core/dist/runtime/diagnostician/diag-distiller-output.d.ts.map +1 -1
- package/core/dist/runtime/diagnostician/diag-distiller-output.js +1 -1
- package/core/dist/runtime/diagnostician/diag-distiller-output.js.map +1 -1
- package/core/dist/runtime/diagnostician/diag-rootcause-output.d.ts +3 -11
- package/core/dist/runtime/diagnostician/diag-rootcause-output.d.ts.map +1 -1
- package/core/dist/runtime/diagnostician/diag-rootcause-output.js +3 -3
- package/core/dist/runtime/diagnostician/diag-rootcause-output.js.map +1 -1
- package/core/dist/runtime/diagnostician/distiller-prompt-builder.d.ts +5 -4
- package/core/dist/runtime/diagnostician/distiller-prompt-builder.d.ts.map +1 -1
- package/core/dist/runtime/diagnostician/evidence-ref-binding.d.ts +2 -1
- package/core/dist/runtime/diagnostician/evidence-ref-binding.d.ts.map +1 -1
- package/core/dist/runtime/diagnostician/rootcause-prompt-builder.d.ts +2 -1
- package/core/dist/runtime/diagnostician/rootcause-prompt-builder.d.ts.map +1 -1
- package/core/dist/runtime/diagnostician/router-prompt-builder.d.ts +22 -3
- package/core/dist/runtime/diagnostician/router-prompt-builder.d.ts.map +1 -1
- package/core/dist/runtime/diagnostician/router-prompt-builder.js +11 -1
- package/core/dist/runtime/diagnostician/router-prompt-builder.js.map +1 -1
- package/core/dist/runtime/diagnostician-association-shadow.d.ts +2 -2
- package/core/dist/runtime/diagnostician-association-shadow.d.ts.map +1 -1
- package/core/dist/runtime/diagnostician-association-validation.d.ts +3 -2
- package/core/dist/runtime/diagnostician-association-validation.d.ts.map +1 -1
- package/core/dist/runtime/diagnostician-output.d.ts +32 -5
- package/core/dist/runtime/diagnostician-output.d.ts.map +1 -1
- package/core/dist/runtime/diagnostician-output.js +47 -4
- package/core/dist/runtime/diagnostician-output.js.map +1 -1
- package/core/dist/runtime/diagnostician-prompt-builder.d.ts +2 -1
- package/core/dist/runtime/diagnostician-prompt-builder.d.ts.map +1 -1
- package/core/dist/runtime/error-categories.d.ts.map +1 -1
- package/core/dist/runtime/error-categories.js +10 -1
- package/core/dist/runtime/error-categories.js.map +1 -1
- package/core/dist/runtime/evidence-sanitizer.d.ts +8 -1
- package/core/dist/runtime/evidence-sanitizer.d.ts.map +1 -1
- package/core/dist/runtime/evidence-sanitizer.js +10 -3
- package/core/dist/runtime/evidence-sanitizer.js.map +1 -1
- package/core/dist/runtime/evolution/evolution-types.d.ts +0 -26
- package/core/dist/runtime/evolution/evolution-types.d.ts.map +1 -1
- package/core/dist/runtime/evolution/evolution-types.js.map +1 -1
- package/core/dist/runtime/feature-flags/feature-flag-contract.d.ts.map +1 -1
- package/core/dist/runtime/feature-flags/feature-flag-contract.js +8 -0
- package/core/dist/runtime/feature-flags/feature-flag-contract.js.map +1 -1
- package/core/dist/runtime/feature-flags/feature-flag-lifecycle.d.ts.map +1 -1
- package/core/dist/runtime/feature-flags/feature-flag-lifecycle.js +24 -0
- package/core/dist/runtime/feature-flags/feature-flag-lifecycle.js.map +1 -1
- package/core/dist/runtime/feature-flags/index.d.ts +0 -1
- package/core/dist/runtime/feature-flags/index.d.ts.map +1 -1
- package/core/dist/runtime/feature-flags/index.js.map +1 -1
- package/core/dist/runtime/golden-trace.d.ts +9 -1
- package/core/dist/runtime/golden-trace.d.ts.map +1 -1
- package/core/dist/runtime/golden-trace.js +7 -0
- package/core/dist/runtime/golden-trace.js.map +1 -1
- package/core/dist/runtime/governance-projection-contract.d.ts +0 -6
- package/core/dist/runtime/governance-projection-contract.d.ts.map +1 -1
- package/core/dist/runtime/governance-projection-contract.js +3 -3
- package/core/dist/runtime/governance-projection-contract.js.map +1 -1
- package/core/dist/runtime/index.d.ts +2 -0
- package/core/dist/runtime/index.d.ts.map +1 -1
- package/core/dist/runtime/index.js +2 -0
- package/core/dist/runtime/index.js.map +1 -1
- package/core/dist/runtime/internalization/artifact-summary.d.ts +5 -4
- package/core/dist/runtime/internalization/artifact-summary.d.ts.map +1 -1
- package/core/dist/runtime/internalization/artifact-summary.js +1 -1
- package/core/dist/runtime/internalization/artifact-summary.js.map +1 -1
- package/core/dist/runtime/internalization/artificer-intent-preflight.d.ts +1 -1
- package/core/dist/runtime/internalization/artificer-intent-preflight.d.ts.map +1 -1
- package/core/dist/runtime/internalization/artificer-output.d.ts +0 -2
- package/core/dist/runtime/internalization/artificer-output.d.ts.map +1 -1
- package/core/dist/runtime/internalization/artificer-output.js +17 -0
- package/core/dist/runtime/internalization/artificer-output.js.map +1 -1
- package/core/dist/runtime/internalization/artificer-prompt-builder.d.ts +14 -3
- package/core/dist/runtime/internalization/artificer-prompt-builder.d.ts.map +1 -1
- package/core/dist/runtime/internalization/artificer-prompt-builder.js +13 -1
- package/core/dist/runtime/internalization/artificer-prompt-builder.js.map +1 -1
- package/core/dist/runtime/internalization/artificer-run-correlation.d.ts +3 -2
- package/core/dist/runtime/internalization/artificer-run-correlation.d.ts.map +1 -1
- package/core/dist/runtime/internalization/consumer-evidence-preflight.d.ts +2 -1
- package/core/dist/runtime/internalization/consumer-evidence-preflight.d.ts.map +1 -1
- package/core/dist/runtime/internalization/diag-distiller-runner.d.ts +1 -1
- package/core/dist/runtime/internalization/diag-distiller-runner.d.ts.map +1 -1
- package/core/dist/runtime/internalization/diag-rootcause-runner.d.ts +1 -1
- package/core/dist/runtime/internalization/diag-rootcause-runner.d.ts.map +1 -1
- package/core/dist/runtime/internalization/diag-router-runner.d.ts +11 -1
- package/core/dist/runtime/internalization/diag-router-runner.d.ts.map +1 -1
- package/core/dist/runtime/internalization/diag-router-runner.js +105 -1
- package/core/dist/runtime/internalization/diag-router-runner.js.map +1 -1
- package/core/dist/runtime/internalization/dreamer-output.d.ts +0 -9
- package/core/dist/runtime/internalization/dreamer-output.d.ts.map +1 -1
- package/core/dist/runtime/internalization/dreamer-output.js +1 -1
- package/core/dist/runtime/internalization/dreamer-output.js.map +1 -1
- package/core/dist/runtime/internalization/dreamer-prompt-builder.d.ts +3 -2
- package/core/dist/runtime/internalization/dreamer-prompt-builder.d.ts.map +1 -1
- package/core/dist/runtime/internalization/dreamer-runner.d.ts +1 -1
- package/core/dist/runtime/internalization/dreamer-runner.d.ts.map +1 -1
- package/core/dist/runtime/internalization/evaluator-output.d.ts +7 -17
- package/core/dist/runtime/internalization/evaluator-output.d.ts.map +1 -1
- package/core/dist/runtime/internalization/evaluator-output.js +2 -2
- package/core/dist/runtime/internalization/evaluator-output.js.map +1 -1
- package/core/dist/runtime/internalization/evaluator-prompt-builder.d.ts +3 -9
- package/core/dist/runtime/internalization/evaluator-prompt-builder.d.ts.map +1 -1
- package/core/dist/runtime/internalization/evaluator-prompt-builder.js +1 -1
- package/core/dist/runtime/internalization/evaluator-prompt-builder.js.map +1 -1
- package/core/dist/runtime/internalization/formation-context.d.ts +4 -6
- package/core/dist/runtime/internalization/formation-context.d.ts.map +1 -1
- package/core/dist/runtime/internalization/formation-context.js +3 -3
- package/core/dist/runtime/internalization/formation-context.js.map +1 -1
- package/core/dist/runtime/internalization/index.d.ts +2 -4
- package/core/dist/runtime/internalization/index.d.ts.map +1 -1
- package/core/dist/runtime/internalization/index.js +8 -1
- package/core/dist/runtime/internalization/index.js.map +1 -1
- package/core/dist/runtime/internalization/intake-to-internalization-bridge.d.ts +2 -1
- package/core/dist/runtime/internalization/intake-to-internalization-bridge.d.ts.map +1 -1
- package/core/dist/runtime/internalization/intent-contract.d.ts +2 -1
- package/core/dist/runtime/internalization/intent-contract.d.ts.map +1 -1
- package/core/dist/runtime/internalization/internalization-job-graph.d.ts +1 -1
- package/core/dist/runtime/internalization/internalization-job-graph.d.ts.map +1 -1
- package/core/dist/runtime/internalization/internalization-route.d.ts +2 -1
- package/core/dist/runtime/internalization/internalization-route.d.ts.map +1 -1
- package/core/dist/runtime/internalization/owner-decision-review.d.ts +3 -2
- package/core/dist/runtime/internalization/owner-decision-review.d.ts.map +1 -1
- package/core/dist/runtime/internalization/owner-resolution-service.d.ts +2 -1
- package/core/dist/runtime/internalization/owner-resolution-service.d.ts.map +1 -1
- package/core/dist/runtime/internalization/owner-retry.d.ts +2 -1
- package/core/dist/runtime/internalization/owner-retry.d.ts.map +1 -1
- package/core/dist/runtime/internalization/owner-review.d.ts +2 -21
- package/core/dist/runtime/internalization/owner-review.d.ts.map +1 -1
- package/core/dist/runtime/internalization/owner-review.js +2 -2
- package/core/dist/runtime/internalization/owner-review.js.map +1 -1
- package/core/dist/runtime/internalization/peer-runner-contracts.d.ts +2 -5
- package/core/dist/runtime/internalization/peer-runner-contracts.d.ts.map +1 -1
- package/core/dist/runtime/internalization/peer-runner-contracts.js +1 -1
- package/core/dist/runtime/internalization/peer-runner-contracts.js.map +1 -1
- package/core/dist/runtime/internalization/philosopher-output.d.ts +0 -8
- package/core/dist/runtime/internalization/philosopher-output.d.ts.map +1 -1
- package/core/dist/runtime/internalization/philosopher-output.js +1 -1
- package/core/dist/runtime/internalization/philosopher-output.js.map +1 -1
- package/core/dist/runtime/internalization/philosopher-prompt-builder.d.ts +3 -2
- package/core/dist/runtime/internalization/philosopher-prompt-builder.d.ts.map +1 -1
- package/core/dist/runtime/internalization/pitask-metadata.d.ts +1 -1
- package/core/dist/runtime/internalization/pitask-metadata.d.ts.map +1 -1
- package/core/dist/runtime/internalization/repair-replay-resolver.d.ts +4 -3
- package/core/dist/runtime/internalization/repair-replay-resolver.d.ts.map +1 -1
- package/core/dist/runtime/internalization/rollout-reviewer-output.d.ts +2 -3
- package/core/dist/runtime/internalization/rollout-reviewer-output.d.ts.map +1 -1
- package/core/dist/runtime/internalization/rollout-reviewer-output.js.map +1 -1
- package/core/dist/runtime/internalization/rollout-reviewer-prompt-builder.d.ts +0 -1
- package/core/dist/runtime/internalization/rollout-reviewer-prompt-builder.d.ts.map +1 -1
- package/core/dist/runtime/internalization/rollout-reviewer-prompt-builder.js +1 -1
- package/core/dist/runtime/internalization/rollout-reviewer-prompt-builder.js.map +1 -1
- package/core/dist/runtime/internalization/router-context-reconstruction.d.ts +3 -3
- package/core/dist/runtime/internalization/router-context-reconstruction.d.ts.map +1 -1
- package/core/dist/runtime/internalization/rule-activation-contract.d.ts +3 -2
- package/core/dist/runtime/internalization/rule-activation-contract.d.ts.map +1 -1
- package/core/dist/runtime/internalization/rule-host-input-builder.d.ts +16 -0
- package/core/dist/runtime/internalization/rule-host-input-builder.d.ts.map +1 -1
- package/core/dist/runtime/internalization/rule-host-input-builder.js +18 -0
- package/core/dist/runtime/internalization/rule-host-input-builder.js.map +1 -1
- package/core/dist/runtime/internalization/rule-reliability-validation.d.ts +13 -18
- package/core/dist/runtime/internalization/rule-reliability-validation.d.ts.map +1 -1
- package/core/dist/runtime/internalization/rule-reliability-validation.js +43 -1
- package/core/dist/runtime/internalization/rule-reliability-validation.js.map +1 -1
- package/core/dist/runtime/internalization/scribe-output.d.ts +2 -15
- package/core/dist/runtime/internalization/scribe-output.d.ts.map +1 -1
- package/core/dist/runtime/internalization/scribe-output.js +2 -2
- package/core/dist/runtime/internalization/scribe-output.js.map +1 -1
- package/core/dist/runtime/internalization/scribe-prompt-builder.d.ts +3 -3
- package/core/dist/runtime/internalization/scribe-prompt-builder.d.ts.map +1 -1
- package/core/dist/runtime/internalization/scribe-prompt-builder.js +0 -1
- package/core/dist/runtime/internalization/scribe-prompt-builder.js.map +1 -1
- package/core/dist/runtime/internalization/split-diagnostician-runner.d.ts +25 -1
- package/core/dist/runtime/internalization/split-diagnostician-runner.d.ts.map +1 -1
- package/core/dist/runtime/internalization/split-diagnostician-runner.js +122 -5
- package/core/dist/runtime/internalization/split-diagnostician-runner.js.map +1 -1
- package/core/dist/runtime/internalization/textual-basis-anchor.d.ts +3 -6
- package/core/dist/runtime/internalization/textual-basis-anchor.d.ts.map +1 -1
- package/core/dist/runtime/internalization/textual-basis-anchor.js +2 -2
- package/core/dist/runtime/internalization/textual-basis-anchor.js.map +1 -1
- package/core/dist/runtime/internalization/tool-semantic-registry.d.ts +26 -0
- package/core/dist/runtime/internalization/tool-semantic-registry.d.ts.map +1 -1
- package/core/dist/runtime/internalization/tool-semantic-registry.js +55 -5
- package/core/dist/runtime/internalization/tool-semantic-registry.js.map +1 -1
- package/core/dist/runtime/internalization-chain-integrity-read-model.d.ts.map +1 -1
- package/core/dist/runtime/internalization-chain-integrity-read-model.js +2 -2
- package/core/dist/runtime/internalization-chain-integrity-read-model.js.map +1 -1
- package/core/dist/runtime/internalization-integrity-remediation.d.ts.map +1 -1
- package/core/dist/runtime/internalization-integrity-remediation.js +2 -2
- package/core/dist/runtime/internalization-integrity-remediation.js.map +1 -1
- package/core/dist/runtime/language-directive.d.ts +2 -1
- package/core/dist/runtime/language-directive.d.ts.map +1 -1
- package/core/dist/runtime/operator-health-read-model.d.ts.map +1 -1
- package/core/dist/runtime/operator-health-read-model.js +2 -2
- package/core/dist/runtime/operator-health-read-model.js.map +1 -1
- package/core/dist/runtime/owner-decision/owner-decision-view-contract.d.ts +3 -29
- package/core/dist/runtime/owner-decision/owner-decision-view-contract.d.ts.map +1 -1
- package/core/dist/runtime/owner-decision/owner-decision-view-contract.js +4 -5
- package/core/dist/runtime/owner-decision/owner-decision-view-contract.js.map +1 -1
- package/core/dist/runtime/owner-decision/owner-decision-view.d.ts +0 -49
- package/core/dist/runtime/owner-decision/owner-decision-view.d.ts.map +1 -1
- package/core/dist/runtime/owner-decision/owner-decision-view.js +5 -5
- package/core/dist/runtime/owner-decision/owner-decision-view.js.map +1 -1
- package/core/dist/runtime/owner-decision/semantic-selector.d.ts +3 -2
- package/core/dist/runtime/owner-decision/semantic-selector.d.ts.map +1 -1
- package/core/dist/runtime/owner-identity.d.ts +12 -1
- package/core/dist/runtime/owner-identity.d.ts.map +1 -1
- package/core/dist/runtime/owner-identity.js +19 -1
- package/core/dist/runtime/owner-identity.js.map +1 -1
- package/core/dist/runtime/pain-ingress-payload.d.ts +0 -39
- package/core/dist/runtime/pain-ingress-payload.d.ts.map +1 -1
- package/core/dist/runtime/pain-ingress-payload.js +4 -4
- package/core/dist/runtime/pain-ingress-payload.js.map +1 -1
- package/core/dist/runtime/pain-ingress.d.ts +1 -1
- package/core/dist/runtime/pain-ingress.d.ts.map +1 -1
- package/core/dist/runtime/pain-ingress.js.map +1 -1
- package/core/dist/runtime/pain-recall-read-model.d.ts.map +1 -1
- package/core/dist/runtime/pain-recall-read-model.js +4 -3
- package/core/dist/runtime/pain-recall-read-model.js.map +1 -1
- package/core/dist/runtime/pain-signal-bridge.d.ts +0 -2
- package/core/dist/runtime/pain-signal-bridge.d.ts.map +1 -1
- package/core/dist/runtime/pain-signal-bridge.js +1 -1
- package/core/dist/runtime/pain-signal-bridge.js.map +1 -1
- package/core/dist/runtime/pain-signal-runtime-factory.d.ts +3 -3
- package/core/dist/runtime/pain-signal-runtime-factory.d.ts.map +1 -1
- package/core/dist/runtime/pain-signal-runtime-factory.js +1 -1
- package/core/dist/runtime/pain-signal-runtime-factory.js.map +1 -1
- package/core/dist/runtime/principle-reuse/reuse-proposal.d.ts +3 -2
- package/core/dist/runtime/principle-reuse/reuse-proposal.d.ts.map +1 -1
- package/core/dist/runtime/principle-reuse/reuse-retrieval.d.ts +0 -10
- package/core/dist/runtime/principle-reuse/reuse-retrieval.d.ts.map +1 -1
- package/core/dist/runtime/principle-reuse/reuse-retrieval.js +1 -1
- package/core/dist/runtime/principle-reuse/reuse-retrieval.js.map +1 -1
- package/core/dist/runtime/principle-reuse/reuse-shortlist.d.ts +1 -8
- package/core/dist/runtime/principle-reuse/reuse-shortlist.d.ts.map +1 -1
- package/core/dist/runtime/principle-reuse/reuse-shortlist.js +1 -1
- package/core/dist/runtime/principle-reuse/reuse-shortlist.js.map +1 -1
- package/core/dist/runtime/product-telemetry/snapshot-contract.d.ts +3 -2
- package/core/dist/runtime/product-telemetry/snapshot-contract.d.ts.map +1 -1
- package/core/dist/runtime/pruning-read-model.d.ts.map +1 -1
- package/core/dist/runtime/pruning-read-model.js +3 -2
- package/core/dist/runtime/pruning-read-model.js.map +1 -1
- package/core/dist/runtime/risk/risk-calculator-policy.d.ts +12 -2
- package/core/dist/runtime/risk/risk-calculator-policy.d.ts.map +1 -1
- package/core/dist/runtime/risk/risk-calculator-policy.js +33 -22
- package/core/dist/runtime/risk/risk-calculator-policy.js.map +1 -1
- package/core/dist/runtime/runner/base-peer-runner.d.ts +32 -0
- package/core/dist/runtime/runner/base-peer-runner.d.ts.map +1 -1
- package/core/dist/runtime/runner/base-peer-runner.js +168 -16
- package/core/dist/runtime/runner/base-peer-runner.js.map +1 -1
- package/core/dist/runtime/runner/default-validator.d.ts +0 -1
- package/core/dist/runtime/runner/default-validator.d.ts.map +1 -1
- package/core/dist/runtime/runner/default-validator.js +11 -3
- package/core/dist/runtime/runner/default-validator.js.map +1 -1
- package/core/dist/runtime/runner/peer-runner-types.d.ts +11 -0
- package/core/dist/runtime/runner/peer-runner-types.d.ts.map +1 -1
- package/core/dist/runtime/schema-conformance-read-model.js +2 -2
- package/core/dist/runtime/schema-conformance-read-model.js.map +1 -1
- package/core/dist/runtime/storage-paths.d.ts +15 -0
- package/core/dist/runtime/storage-paths.d.ts.map +1 -0
- package/core/dist/runtime/storage-paths.js +15 -0
- package/core/dist/runtime/storage-paths.js.map +1 -0
- package/core/dist/runtime/store/artifact/index.d.ts +1 -1
- package/core/dist/runtime/store/artifact/index.d.ts.map +1 -1
- package/core/dist/runtime/store/candidate/admission-document.d.ts +4 -3
- package/core/dist/runtime/store/candidate/admission-document.d.ts.map +1 -1
- package/core/dist/runtime/store/commit/index.d.ts +0 -1
- package/core/dist/runtime/store/commit/index.d.ts.map +1 -1
- package/core/dist/runtime/store/commit/index.js.map +1 -1
- package/core/dist/runtime/store/design-gate/sqlite-design-gate-store.d.ts +4 -3
- package/core/dist/runtime/store/design-gate/sqlite-design-gate-store.d.ts.map +1 -1
- package/core/dist/runtime/store/lifecycle/lease-manager.d.ts +2 -1
- package/core/dist/runtime/store/lifecycle/lease-manager.d.ts.map +1 -1
- package/core/dist/runtime/store/runtime-state-manager.d.ts +1 -2
- package/core/dist/runtime/store/runtime-state-manager.d.ts.map +1 -1
- package/core/dist/runtime/store/runtime-state-manager.js.map +1 -1
- package/core/dist/runtime/store/sqlite-connection.d.ts +2 -6
- package/core/dist/runtime/store/sqlite-connection.d.ts.map +1 -1
- package/core/dist/runtime/store/sqlite-connection.js +4 -12
- package/core/dist/runtime/store/sqlite-connection.js.map +1 -1
- package/core/dist/runtime/store/storage-paths.d.ts +17 -0
- package/core/dist/runtime/store/storage-paths.d.ts.map +1 -0
- package/core/dist/runtime/store/storage-paths.js +52 -0
- package/core/dist/runtime/store/storage-paths.js.map +1 -0
- package/core/dist/runtime/store/task/sqlite-family-reopen.d.ts +2 -1
- package/core/dist/runtime/store/task/sqlite-family-reopen.d.ts.map +1 -1
- package/core/dist/runtime/store/task/sqlite-task-store.d.ts +2 -1
- package/core/dist/runtime/store/task/sqlite-task-store.d.ts.map +1 -1
- package/core/dist/runtime/story-a-demo.d.ts.map +1 -1
- package/core/dist/runtime/story-a-demo.js +4 -1
- package/core/dist/runtime/story-a-demo.js.map +1 -1
- package/core/dist/runtime/tools/agent-tool-contract.d.ts +1 -2
- package/core/dist/runtime/tools/agent-tool-contract.d.ts.map +1 -1
- package/core/dist/runtime/tools/agent-tool-contract.js +0 -2
- package/core/dist/runtime/tools/agent-tool-contract.js.map +1 -1
- package/core/dist/runtime/tools/artificer-l2-tool-contract.d.ts +0 -2
- package/core/dist/runtime/tools/artificer-l2-tool-contract.d.ts.map +1 -1
- package/core/dist/runtime/tools/artificer-l2-tool-contract.js +0 -2
- package/core/dist/runtime/tools/artificer-l2-tool-contract.js.map +1 -1
- package/core/dist/runtime/trajectory-retention.d.ts +257 -0
- package/core/dist/runtime/trajectory-retention.d.ts.map +1 -0
- package/core/dist/runtime/trajectory-retention.js +598 -0
- package/core/dist/runtime/trajectory-retention.js.map +1 -0
- package/core/dist/runtime/types/event-payload.d.ts +0 -2
- package/core/dist/runtime/types/event-payload.d.ts.map +1 -1
- package/core/dist/runtime/types/event-payload.js.map +1 -1
- package/core/dist/runtime/types/evidence-chain-contract.d.ts +66 -2
- package/core/dist/runtime/types/evidence-chain-contract.d.ts.map +1 -1
- package/core/dist/runtime/types/evidence-chain-contract.js +69 -4
- package/core/dist/runtime/types/evidence-chain-contract.js.map +1 -1
- package/core/dist/runtime/types/hygiene-types.d.ts +0 -6
- package/core/dist/runtime/types/hygiene-types.d.ts.map +1 -1
- package/core/dist/runtime/types/hygiene-types.js.map +1 -1
- package/core/dist/runtime/types/index.d.ts +1 -1
- package/core/dist/runtime/types/index.d.ts.map +1 -1
- package/core/dist/runtime/types/index.js.map +1 -1
- package/core/dist/runtime/types/intervention-evidence-contract.d.ts +5 -5
- package/core/dist/runtime/types/intervention-evidence-contract.d.ts.map +1 -1
- package/core/dist/runtime/types/intervention-evidence-contract.js +0 -2
- package/core/dist/runtime/types/intervention-evidence-contract.js.map +1 -1
- package/core/dist/runtime/types/principle-dependency.d.ts +0 -2
- package/core/dist/runtime/types/principle-dependency.d.ts.map +1 -1
- package/core/dist/runtime/types/principle-dependency.js.map +1 -1
- package/core/dist/runtime/types/principle-lifecycle-event.d.ts +0 -2
- package/core/dist/runtime/types/principle-lifecycle-event.d.ts.map +1 -1
- package/core/dist/runtime/types/principle-lifecycle-event.js.map +1 -1
- package/core/dist/runtime/types/principle-schema.d.ts +0 -26
- package/core/dist/runtime/types/principle-schema.d.ts.map +1 -1
- package/core/dist/runtime/types/principle-schema.js +2 -2
- package/core/dist/runtime/types/principle-schema.js.map +1 -1
- package/core/dist/runtime/types/principle-tree-store.d.ts +0 -2
- package/core/dist/runtime/types/principle-tree-store.d.ts.map +1 -1
- package/core/dist/runtime/types/principle-tree-store.js.map +1 -1
- package/core/dist/runtime/types/principle-value-metrics.d.ts +0 -2
- package/core/dist/runtime/types/principle-value-metrics.d.ts.map +1 -1
- package/core/dist/runtime/types/principle-value-metrics.js.map +1 -1
- package/core/dist/runtime/types/rule-candidate-binding.d.ts +2 -1
- package/core/dist/runtime/types/rule-candidate-binding.d.ts.map +1 -1
- package/core/dist/telemetry-event.d.ts +2 -2
- package/core/dist/telemetry-event.d.ts.map +1 -1
- package/core/dist/telemetry-event.js +11 -0
- package/core/dist/telemetry-event.js.map +1 -1
- package/core/dist/trajectory-store.d.ts +9 -9
- package/core/dist/trajectory-store.d.ts.map +1 -1
- package/core/dist/trajectory-store.js +9 -12
- package/core/dist/trajectory-store.js.map +1 -1
- package/core/package.json +5 -1
- package/dist/installers/codex-host-installer.d.ts +9 -0
- package/dist/installers/codex-host-installer.d.ts.map +1 -1
- package/dist/installers/codex-host-installer.js +127 -6
- package/dist/installers/codex-host-installer.js.map +1 -1
- package/dist/installers/mcp-binding-shape-mirror.d.ts +27 -0
- package/dist/installers/mcp-binding-shape-mirror.d.ts.map +1 -0
- package/dist/installers/mcp-binding-shape-mirror.js +105 -0
- package/dist/installers/mcp-binding-shape-mirror.js.map +1 -0
- package/dist/skill-catalog.d.ts +35 -0
- package/dist/skill-catalog.d.ts.map +1 -0
- package/dist/skill-catalog.js +85 -0
- package/dist/skill-catalog.js.map +1 -0
- package/dist/skill-delivery-parity.d.ts +22 -0
- package/dist/skill-delivery-parity.d.ts.map +1 -0
- package/dist/skill-delivery-parity.js +31 -0
- package/dist/skill-delivery-parity.js.map +1 -0
- package/dist/update/product-identity.d.ts.map +1 -1
- package/dist/update/product-identity.js +5 -1
- package/dist/update/product-identity.js.map +1 -1
- package/host-runtime/dist/active-principle-prompt.d.ts +13 -0
- package/host-runtime/dist/active-principle-prompt.js +87 -10
- package/host-runtime/dist/adaptive-decision-protocol.d.ts +129 -0
- package/host-runtime/dist/adaptive-decision-protocol.js +176 -0
- package/host-runtime/dist/adaptive-priority-provider.d.ts +38 -13
- package/host-runtime/dist/adaptive-priority-provider.js +70 -66
- package/host-runtime/dist/adaptive-selection.d.ts +71 -64
- package/host-runtime/dist/adaptive-selection.js +220 -329
- package/host-runtime/dist/adaptive-skip-decision.d.ts +26 -14
- package/host-runtime/dist/adaptive-skip-decision.js +33 -29
- package/host-runtime/dist/codex-disclosure.d.ts +12 -7
- package/host-runtime/dist/codex-disclosure.js +12 -7
- package/host-runtime/dist/codex-rule-context-provider.js +4 -1
- package/host-runtime/dist/conversation-ingestion/pipeline.d.ts +8 -0
- package/host-runtime/dist/conversation-ingestion/pipeline.js +6 -1
- package/host-runtime/dist/conversation-ingestion/text-policy.d.ts +3 -4
- package/host-runtime/dist/conversation-ingestion/text-policy.js +3 -4
- package/host-runtime/dist/governance-observation-store.d.ts +73 -1
- package/host-runtime/dist/governance-observation-store.js +251 -14
- package/host-runtime/dist/governance-signal-admission.d.ts +19 -3
- package/host-runtime/dist/governance-signal-admission.js +12 -4
- package/host-runtime/dist/host-tool-declaration.d.ts +18 -2
- package/host-runtime/dist/host-tool-declaration.js +67 -11
- package/host-runtime/dist/host-tool-semantic-resolver.d.ts +7 -0
- package/host-runtime/dist/host-tool-semantic-resolver.js +22 -2
- package/host-runtime/dist/index.d.ts +3 -0
- package/host-runtime/dist/index.js +17 -0
- package/host-runtime/dist/production-rulehost-gate.d.ts +36 -1
- package/host-runtime/dist/production-rulehost-gate.js +106 -4
- package/host-runtime/dist/trajectory-retention.d.ts +147 -0
- package/host-runtime/dist/trajectory-retention.js +907 -0
- package/host-runtime/package.json +1 -1
- package/install-layout/dist/index.d.ts +9 -2
- package/install-layout/dist/index.js +26 -9
- package/install-layout/dist/mcp-binding-contract.d.ts +91 -0
- package/install-layout/dist/mcp-binding-contract.js +230 -0
- package/install-layout/package.json +1 -1
- package/package.json +4 -4
- package/pd-cli/dist/commands/build-trajectory-evidence.d.ts.map +1 -1
- package/pd-cli/dist/commands/build-trajectory-evidence.js +17 -11
- package/pd-cli/dist/commands/build-trajectory-evidence.js.map +1 -1
- package/pd-cli/dist/commands/codex-reconcile.d.ts +7 -0
- package/pd-cli/dist/commands/codex-reconcile.d.ts.map +1 -1
- package/pd-cli/dist/commands/codex-reconcile.js +11 -2
- package/pd-cli/dist/commands/codex-reconcile.js.map +1 -1
- package/pd-cli/dist/commands/codex-worker.d.ts.map +1 -1
- package/pd-cli/dist/commands/codex-worker.js +35 -0
- package/pd-cli/dist/commands/codex-worker.js.map +1 -1
- package/pd-cli/dist/commands/command-helpers.d.ts +1 -1
- package/pd-cli/dist/commands/command-helpers.js +1 -1
- package/pd-cli/dist/commands/diagnose.js +1 -1
- package/pd-cli/dist/commands/diagnose.js.map +1 -1
- package/pd-cli/dist/commands/errors-list.d.ts +1 -1
- package/pd-cli/dist/commands/errors-list.js +1 -1
- package/pd-cli/dist/commands/health-ingestion.d.ts +96 -0
- package/pd-cli/dist/commands/health-ingestion.d.ts.map +1 -0
- package/pd-cli/dist/commands/health-ingestion.js +473 -0
- package/pd-cli/dist/commands/health-ingestion.js.map +1 -0
- package/pd-cli/dist/commands/health-mcp.d.ts +23 -1
- package/pd-cli/dist/commands/health-mcp.d.ts.map +1 -1
- package/pd-cli/dist/commands/health-mcp.js +81 -22
- package/pd-cli/dist/commands/health-mcp.js.map +1 -1
- package/pd-cli/dist/commands/health.d.ts +1 -1
- package/pd-cli/dist/commands/health.d.ts.map +1 -1
- package/pd-cli/dist/commands/health.js +22 -5
- package/pd-cli/dist/commands/health.js.map +1 -1
- package/pd-cli/dist/commands/principles-stats.d.ts +1 -1
- package/pd-cli/dist/commands/principles-stats.js +1 -1
- package/pd-cli/dist/commands/trajectory-retention.d.ts +23 -0
- package/pd-cli/dist/commands/trajectory-retention.d.ts.map +1 -0
- package/pd-cli/dist/commands/trajectory-retention.js +159 -0
- package/pd-cli/dist/commands/trajectory-retention.js.map +1 -0
- package/pd-cli/dist/commands/workbuddy-setup.d.ts +69 -0
- package/pd-cli/dist/commands/workbuddy-setup.d.ts.map +1 -0
- package/pd-cli/dist/commands/workbuddy-setup.js +379 -0
- package/pd-cli/dist/commands/workbuddy-setup.js.map +1 -0
- package/pd-cli/dist/commands/workbuddy-worker.d.ts.map +1 -1
- package/pd-cli/dist/commands/workbuddy-worker.js +42 -6
- package/pd-cli/dist/commands/workbuddy-worker.js.map +1 -1
- package/pd-cli/dist/index.d.ts +1 -7
- package/pd-cli/dist/index.d.ts.map +1 -1
- package/pd-cli/dist/index.js +15 -1201
- package/pd-cli/dist/index.js.map +1 -1
- package/pd-cli/dist/program.d.ts +17 -0
- package/pd-cli/dist/program.d.ts.map +1 -0
- package/pd-cli/dist/program.js +1263 -0
- package/pd-cli/dist/program.js.map +1 -0
- package/pd-cli/dist/services/delivery-surfaces.d.ts.map +1 -1
- package/pd-cli/dist/services/delivery-surfaces.js +7 -5
- package/pd-cli/dist/services/delivery-surfaces.js.map +1 -1
- package/pd-cli/dist/services/demo-story-a-runner.js +1 -1
- package/pd-cli/dist/services/demo-story-a-runner.js.map +1 -1
- package/pd-cli/dist/services/version-report.d.ts.map +1 -1
- package/pd-cli/dist/services/version-report.js +35 -5
- package/pd-cli/dist/services/version-report.js.map +1 -1
- package/pd-cli/package.json +1 -1
- package/pd-mcp-server/dist/version.d.ts +1 -1
- package/pd-mcp-server/dist/version.js +1 -1
- package/pd-mcp-server/package.json +3 -1
- package/plugin/dist/bundle.js +529 -468
- package/plugin/dist/constants/tools.d.ts +8 -1
- package/plugin/dist/core/experiment-workspace-guard.d.ts +25 -0
- package/plugin/dist/core/trajectory-retention-trigger.d.ts +13 -0
- package/plugin/dist/core/trajectory.d.ts +14 -0
- package/plugin/dist/hooks/gate-block-helper.d.ts +17 -0
- package/plugin/dist/hooks/gate.d.ts +6 -1
- package/plugin/dist/host-runtime/openclaw-host-runtime.d.ts +1 -0
- package/plugin/dist/index.d.ts +5 -0
- package/plugin/dist/openclaw.plugin.json +1 -1
- package/plugin/dist/rulehost-evidence.js +29 -23
- package/plugin/dist/templates/langs/en/skills/pd-cli-operator/SKILL.md +16 -5
- package/plugin/dist/templates/langs/en/skills/pd-control/SKILL.md +7 -6
- package/plugin/dist/templates/langs/en/skills/pd-pain-signal/SKILL.md +141 -28
- package/plugin/dist/templates/langs/en/skills/pd-review/SKILL.md +15 -1
- package/plugin/dist/templates/langs/zh/skills/pd-cli-operator/SKILL.md +16 -5
- package/plugin/dist/templates/langs/zh/skills/pd-control/SKILL.md +7 -6
- package/plugin/dist/templates/langs/zh/skills/pd-pain-signal/SKILL.md +142 -29
- package/plugin/dist/templates/langs/zh/skills/pd-review/SKILL.md +15 -1
- package/plugin/openclaw.plugin.json +1 -1
- package/plugin/package.json +1 -1
- package/plugin/templates/langs/en/skills/pd-cli-operator/SKILL.md +16 -5
- package/plugin/templates/langs/en/skills/pd-control/SKILL.md +7 -6
- package/plugin/templates/langs/en/skills/pd-pain-signal/SKILL.md +141 -28
- package/plugin/templates/langs/en/skills/pd-review/SKILL.md +15 -1
- package/plugin/templates/langs/zh/skills/pd-cli-operator/SKILL.md +16 -5
- package/plugin/templates/langs/zh/skills/pd-control/SKILL.md +7 -6
- package/plugin/templates/langs/zh/skills/pd-pain-signal/SKILL.md +142 -29
- package/plugin/templates/langs/zh/skills/pd-review/SKILL.md +15 -1
- package/release-manager/dist/installers/codex-host-installer.js +127 -6
- package/release-manager/dist/installers/mcp-binding-shape-mirror.js +105 -0
- package/release-manager/dist/update/product-identity.js +5 -1
- package/release-manager/package.json +1 -1
- package/workbuddy-adapter/dist/codec/input-decoder.d.ts +10 -0
- package/workbuddy-adapter/dist/codec/input-decoder.js +62 -5
- package/workbuddy-adapter/dist/host-adapter.js +1 -0
- package/workbuddy-adapter/dist/index.d.ts +1 -0
- package/workbuddy-adapter/dist/index.js +1 -0
- package/workbuddy-adapter/dist/ingestion/catch-up.d.ts +36 -0
- package/workbuddy-adapter/dist/ingestion/catch-up.js +166 -0
- package/workbuddy-adapter/dist/ingestion/encode-cwd.d.ts +6 -0
- package/workbuddy-adapter/dist/ingestion/encode-cwd.js +39 -0
- package/workbuddy-adapter/dist/ingestion/index.d.ts +13 -0
- package/workbuddy-adapter/dist/ingestion/index.js +13 -0
- package/workbuddy-adapter/dist/ingestion/ingestion.d.ts +46 -0
- package/workbuddy-adapter/dist/ingestion/ingestion.js +135 -0
- package/workbuddy-adapter/dist/ingestion/transcript-decoder.d.ts +70 -0
- package/workbuddy-adapter/dist/ingestion/transcript-decoder.js +554 -0
- package/workbuddy-adapter/dist/ingestion/transcript-path.d.ts +39 -0
- package/workbuddy-adapter/dist/ingestion/transcript-path.js +117 -0
- package/workbuddy-adapter/dist/ingestion/transcript-source.d.ts +15 -0
- package/workbuddy-adapter/dist/ingestion/transcript-source.js +152 -0
- package/workbuddy-adapter/dist/pd-hook.d.ts +8 -0
- package/workbuddy-adapter/dist/pd-hook.js +59 -2
- package/workbuddy-adapter/dist/worker/workspace-worker.d.ts +9 -0
- package/workbuddy-adapter/dist/worker/workspace-worker.js +46 -17
- package/workbuddy-adapter/package.json +1 -1
- package/workbuddy-adapter/plugin/hooks/hooks.json +11 -0
- package/workbuddy-adapter/plugin/skills/pd-cli-operator/SKILL.md +57 -19
- package/workbuddy-adapter/plugin/skills/pd-control/SKILL.md +21 -9
- package/workbuddy-adapter/plugin/skills/pd-pain-signal/SKILL.md +72 -61
- package/workbuddy-adapter/plugin/skills/pd-review/SKILL.md +27 -12
|
@@ -96,4 +96,98 @@ export function formatValidationErrorEntry(path, message, value) {
|
|
|
96
96
|
actualPreview,
|
|
97
97
|
};
|
|
98
98
|
}
|
|
99
|
+
function isPlainRecord(value) {
|
|
100
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
101
|
+
}
|
|
102
|
+
function splitJsonPointer(path) {
|
|
103
|
+
return path.split('/').filter((segment) => segment.length > 0);
|
|
104
|
+
}
|
|
105
|
+
/** Walk the schema to the node addressed by a TypeBox error path. */
|
|
106
|
+
function schemaNodeAtPath(schema, segments) {
|
|
107
|
+
let node = schema;
|
|
108
|
+
for (const segment of segments) {
|
|
109
|
+
if (!isPlainRecord(node))
|
|
110
|
+
return null;
|
|
111
|
+
const properties = isPlainRecord(node.properties) ? node.properties : null;
|
|
112
|
+
if (properties !== null && Object.hasOwn(properties, segment)) {
|
|
113
|
+
node = properties[segment];
|
|
114
|
+
continue;
|
|
115
|
+
}
|
|
116
|
+
// Array index (or any item) → item schema.
|
|
117
|
+
if (Object.hasOwn(node, 'items')) {
|
|
118
|
+
node = node.items;
|
|
119
|
+
continue;
|
|
120
|
+
}
|
|
121
|
+
return null;
|
|
122
|
+
}
|
|
123
|
+
return isPlainRecord(node) ? node : null;
|
|
124
|
+
}
|
|
125
|
+
function valueAtPath(value, segments) {
|
|
126
|
+
let node = value;
|
|
127
|
+
for (const segment of segments) {
|
|
128
|
+
if (Array.isArray(node)) {
|
|
129
|
+
const index = Number(segment);
|
|
130
|
+
if (!Number.isInteger(index))
|
|
131
|
+
return undefined;
|
|
132
|
+
node = node[index];
|
|
133
|
+
continue;
|
|
134
|
+
}
|
|
135
|
+
if (!isPlainRecord(node) || !Object.hasOwn(node, segment))
|
|
136
|
+
return undefined;
|
|
137
|
+
node = node[segment];
|
|
138
|
+
}
|
|
139
|
+
return node;
|
|
140
|
+
}
|
|
141
|
+
function unionKindLiterals(variant) {
|
|
142
|
+
const properties = isPlainRecord(variant.properties) ? variant.properties : null;
|
|
143
|
+
const kind = properties && Object.hasOwn(properties, 'kind') ? properties.kind : null;
|
|
144
|
+
if (!isPlainRecord(kind))
|
|
145
|
+
return [];
|
|
146
|
+
if (typeof kind.const === 'string')
|
|
147
|
+
return [kind.const];
|
|
148
|
+
const alternatives = Array.isArray(kind.anyOf) ? kind.anyOf : [];
|
|
149
|
+
return alternatives
|
|
150
|
+
.filter(isPlainRecord)
|
|
151
|
+
.map((entry) => entry.const)
|
|
152
|
+
.filter((entry) => typeof entry === 'string');
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* P1-3: TypeBox reports a failed discriminated union as a single
|
|
156
|
+
* `Expected union value` at the union's path. That message names no field, so
|
|
157
|
+
* it flowed into the repair prompt as noise — exactly the class of low-signal
|
|
158
|
+
* feedback that made a schema-invalid output repeat until the budget was gone.
|
|
159
|
+
*
|
|
160
|
+
* When the failing value carries a `kind`, resolve the variant selected by that
|
|
161
|
+
* kind and name its missing required fields. Every other failure is returned
|
|
162
|
+
* unchanged (this is a formatter, never a second validator).
|
|
163
|
+
*/
|
|
164
|
+
export function explainUnionValidationFailure(input) {
|
|
165
|
+
const { schema, rootValue, path, message } = input;
|
|
166
|
+
if (message !== 'Expected union value')
|
|
167
|
+
return message;
|
|
168
|
+
const segments = splitJsonPointer(path);
|
|
169
|
+
const node = schemaNodeAtPath(schema, segments);
|
|
170
|
+
if (node === null || !Array.isArray(node.anyOf))
|
|
171
|
+
return message;
|
|
172
|
+
const failingValue = valueAtPath(rootValue, segments);
|
|
173
|
+
if (!isPlainRecord(failingValue) || !Object.hasOwn(failingValue, 'kind'))
|
|
174
|
+
return message;
|
|
175
|
+
const { kind } = failingValue;
|
|
176
|
+
if (typeof kind !== 'string')
|
|
177
|
+
return message;
|
|
178
|
+
const variants = node.anyOf.filter(isPlainRecord);
|
|
179
|
+
const selectedVariant = variants.find((variant) => unionKindLiterals(variant).includes(kind));
|
|
180
|
+
if (selectedVariant === undefined) {
|
|
181
|
+
const allKinds = variants.flatMap(unionKindLiterals);
|
|
182
|
+
return `${message}: kind "${kind}" is not one of ${allKinds.map((entry) => `"${entry}"`).join(' | ')}`;
|
|
183
|
+
}
|
|
184
|
+
const properties = isPlainRecord(selectedVariant.properties) ? selectedVariant.properties : {};
|
|
185
|
+
const required = Array.isArray(selectedVariant.required)
|
|
186
|
+
? selectedVariant.required.filter((entry) => typeof entry === 'string')
|
|
187
|
+
: Object.keys(properties);
|
|
188
|
+
const missing = required.filter((key) => !Object.hasOwn(failingValue, key));
|
|
189
|
+
if (missing.length === 0)
|
|
190
|
+
return message;
|
|
191
|
+
return `${message}: kind "${kind}" requires ${missing.join(', ')}`;
|
|
192
|
+
}
|
|
99
193
|
//# sourceMappingURL=output-repair-contract.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"output-repair-contract.js","sourceRoot":"","sources":["../../../src/runtime/adapter/output-repair-contract.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AA+CH,mEAAmE;AACnE,0EAA0E;AAC1E,wEAAwE;AACxE,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAG,CAAC;AAEzC,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC;AAErC,MAAM,UAAU,0BAA0B,CAAC,GAAuB,EAAE,UAAkB;IACpF,IAAI,GAAG,KAAK,SAAS;QAAE,OAAO,UAAU,CAAC;IACzC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC;Q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CAAC,KAAK,CAAC;YACf,CAAC,CAAC,oBAAoB,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IACvC,OAAO;QACL,IAAI;QACJ,QAAQ,EAAE,OAAO;QACjB,aAAa;KACd,CAAC;AACJ,CAAC"}
|
|
1
|
+
{"version":3,"file":"output-repair-contract.js","sourceRoot":"","sources":["../../../src/runtime/adapter/output-repair-contract.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AA+CH,mEAAmE;AACnE,0EAA0E;AAC1E,wEAAwE;AACxE,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAG,CAAC;AAEzC,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC;AAErC,MAAM,UAAU,0BAA0B,CAAC,GAAuB,EAAE,UAAkB;IACpF,IAAI,GAAG,KAAK,SAAS;QAAE,OAAO,UAAU,CAAC;IACzC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC;QAAE,OAAO,UAAU,CAAC;IAC7C,IAAI,GAAG,GAAG,CAAC;QAAE,OAAO,CAAC,CAAC;IACtB,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAChC,IAAI,OAAO,GAAG,mBAAmB;QAAE,OAAO,mBAAmB,CAAC;IAC9D,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,IAAY,EAAE,MAAM,GAAG,GAAG;IACxD,IAAI,CAAC,IAAI;QAAE,OAAO,EAAE,CAAC;IACrB,IAAI,IAAI,CAAC,MAAM,IAAI,MAAM;QAAE,OAAO,IAAI,CAAC;IACvC,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,CAAC;IACzC,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,QAAQ,CAAC,GAAG,KAAK,CAAC;AACzC,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAC,KAAc,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AAC;QACxF,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAC5B,MAAM,OAAO,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,YAAY,EAAE,GAAG,CAAC,CAAC,CAAC;IAC5E,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,OAAO,CAAC;IACzC,OAAO,GAAG,OAAO,WAAW,IAAI,cAAc,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;AACrE,CAAC"}
|
|
@@ -2,9 +2,7 @@ import type { FetchFunction } from '@earendil-works/pi-ai';
|
|
|
2
2
|
import type { StoreEventEmitter } from '../store/event-emitter.js';
|
|
3
3
|
import type { PDRuntimeAdapter, RuntimeKind, RuntimeCapabilities, RuntimeHealth, RunHandle, RunStatus, StartRunInput, StructuredRunOutput, RuntimeArtifactRef } from '../runtime-protocol.js';
|
|
4
4
|
/** Output path strategy for structured output (PRI-271 B3). */
|
|
5
|
-
|
|
6
|
-
/** Result of a specific output path attempt (PRI-271 B3). */
|
|
7
|
-
export type OutputPathLabel = 'tool_call' | 'json_object_mode' | 'free_form_with_repair';
|
|
5
|
+
type OutputPathStrategy = 'tool_call_first' | 'json_mode_first' | 'free_form_only';
|
|
8
6
|
/**
|
|
9
7
|
* Configuration for PiAiRuntimeAdapter.
|
|
10
8
|
*
|
|
@@ -201,4 +199,5 @@ export declare class PiAiRuntimeAdapter implements PDRuntimeAdapter {
|
|
|
201
199
|
private downshiftMaxTokensBudget;
|
|
202
200
|
private emitAttemptTelemetry;
|
|
203
201
|
}
|
|
202
|
+
export {};
|
|
204
203
|
//# sourceMappingURL=pi-ai-runtime-adapter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pi-ai-runtime-adapter.d.ts","sourceRoot":"","sources":["../../../src/runtime/adapter/pi-ai-runtime-adapter.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAAgF,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAMzI,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAYnE,OAAO,KAAK,EACV,gBAAgB,EAChB,WAAW,EACX,mBAAmB,EACnB,aAAa,EACb,SAAS,EACT,SAAS,EACT,aAAa,EACb,mBAAmB,EACnB,kBAAkB,EACnB,MAAM,wBAAwB,CAAC;AAEhC,+DAA+D;AAC/D,
|
|
1
|
+
{"version":3,"file":"pi-ai-runtime-adapter.d.ts","sourceRoot":"","sources":["../../../src/runtime/adapter/pi-ai-runtime-adapter.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAAgF,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAMzI,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAYnE,OAAO,KAAK,EACV,gBAAgB,EAChB,WAAW,EACX,mBAAmB,EACnB,aAAa,EACb,SAAS,EACT,SAAS,EACT,aAAa,EACb,mBAAmB,EACnB,kBAAkB,EACnB,MAAM,wBAAwB,CAAC;AAEhC,+DAA+D;AAC/D,KAAK,kBAAkB,GAAG,iBAAiB,GAAG,iBAAiB,GAAG,gBAAgB,CAAC;AAmHnF;;;;;GAKG;AACH,MAAM,WAAW,wBAAwB;IACvC,0FAA0F;IAC1F,QAAQ,EAAE,MAAM,CAAC;IACjB,oDAAoD;IACpD,KAAK,EAAE,MAAM,CAAC;IACd,+DAA+D;IAC/D,SAAS,EAAE,MAAM,CAAC;IAClB,qEAAqE;IACrE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,4EAA4E;IAC5E,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,wFAAwF;IACxF,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,8DAA8D;IAC9D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,mFAAmF;IACnF,YAAY,CAAC,EAAE,iBAAiB,CAAC;IACjC,+IA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AAO,CAAC,SAAS,CAAC,CAa/C;IAEK,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAkB5C;IAEK,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC,CAMpE;IAEK,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAQjE;IAMD;;;;;;;;;;OAUG;YAEW,eAAe;IAwF7B;;;;;OAKG;YAEW,eAAe;IAiF7B;;;;;OAKG;IACH,OAAO,CAAC,uBAAuB;IA0B/B;;;;;;;;;OASG;YAEW,aAAa;IAwD3B;;;;;;;;;;;;OAYG;YACW,iBAAiB;IA0W/B;;;;OAIG;IACH,OAAO,CAAC,wBAAwB;IAiChC,OAAO,CAAC,oBAAoB;CA2D7B"}
|
|
@@ -27,9 +27,9 @@ import { PDRuntimeError } from '../error-categories.js';
|
|
|
27
27
|
import { extractJsonObject, extractJsonObjectForSchema, extractJsonObjects, selectBestJsonObject } from './json-extractor.js';
|
|
28
28
|
import { resolveOutputSchema } from './output-schema-registry.js';
|
|
29
29
|
import { storeEmitter } from '../store/event-emitter.js';
|
|
30
|
-
import { attemptStructuredOutputRepair, deriveSchemaSummary } from './structured-output-repair.js';
|
|
30
|
+
import { attemptStructuredOutputRepair, DEFAULT_REPAIR_CONFIG, deriveSchemaSummary } from './structured-output-repair.js';
|
|
31
31
|
import { typeboxToOpenAIJsonSchema, sanitizeSchemaName } from './schema-json-converter.js';
|
|
32
|
-
import { formatValidationErrorEntry, safeStringifyPreview, stripLineageFields } from './output-repair-contract.js';
|
|
32
|
+
import { formatValidationErrorEntry, explainUnionValidationFailure, safeStringifyPreview, stripLineageFields } from './output-repair-contract.js';
|
|
33
33
|
import { buildSchemaToolDefinition } from './tools/diagnostician-tool.js';
|
|
34
34
|
import { DefaultSchemaPromptAdapter } from './schema-prompt-adapter.js';
|
|
35
35
|
import { mergeSystemPromptLayers } from '../system-prompt-merge.js';
|
|
@@ -75,6 +75,25 @@ const REPAIR_TIMEOUT_MS_CEILING = 60_000;
|
|
|
75
75
|
* already-obtained schema error instead of turning it into a timeout.
|
|
76
76
|
*/
|
|
77
77
|
const MIN_REPAIR_BUDGET_MS = 1_000;
|
|
78
|
+
/**
|
|
79
|
+
* S6: one request budget per logical run. A run may attempt at most this many
|
|
80
|
+
* provider requests in total, across the three output paths, the PRI-1011
|
|
81
|
+
* downshift retries and the schema repair loop. pi-ai's own transport retries
|
|
82
|
+
* (S2) happen inside a single PD request and are deliberately not counted —
|
|
83
|
+
* they are not requests PD decided to send.
|
|
84
|
+
*
|
|
85
|
+
* The budget lives in startRun's local scope: no adapter config key, no new
|
|
86
|
+
* public interface. Reverting the change restores the previous unbounded
|
|
87
|
+
* worst case.
|
|
88
|
+
*/
|
|
89
|
+
const RUN_REQUEST_BUDGET = 3;
|
|
90
|
+
/** S6: claim one request from the run budget, or report exhaustion. */
|
|
91
|
+
function consumeRunRequest(budget) {
|
|
92
|
+
if (budget.requestsLeft <= 0)
|
|
93
|
+
return false;
|
|
94
|
+
budget.requestsLeft -= 1;
|
|
95
|
+
return true;
|
|
96
|
+
}
|
|
78
97
|
/**
|
|
79
98
|
* S2: cap on the wait pi-ai may take between its own transport retries.
|
|
80
99
|
* pi-ai defaults to 60s per wait; 30s keeps the worst-case wait no worse than
|
|
@@ -608,6 +627,8 @@ export class PiAiRuntimeAdapter {
|
|
|
608
627
|
status: 'failed', // default until succeeded
|
|
609
628
|
};
|
|
610
629
|
this.runs.set(runId, runState);
|
|
630
|
+
// S6: every provider request this run sends draws from one local budget.
|
|
631
|
+
const requestBudget = { requestsLeft: RUN_REQUEST_BUDGET };
|
|
611
632
|
// AbortSignal.timeout for clean timeout control
|
|
612
633
|
// Priority: input.timeoutMs (runner) > config.timeoutMs (workflows.yaml) > 300_000 (default)
|
|
613
634
|
const effectiveTimeoutMs = input.timeoutMs ?? this.config.timeoutMs ?? 300_000;
|
|
@@ -733,7 +754,7 @@ export class PiAiRuntimeAdapter {
|
|
|
733
754
|
}
|
|
734
755
|
// ── Path 1: Tool calling (PRI-271 B2) ──
|
|
735
756
|
if (strategy === 'tool_call_first' && schema && schemaRef) {
|
|
736
|
-
const toolResult = await this.tryToolCallPath({ model, baseContext: context, schemaRef, schema, signal, apiKey, effectiveTimeoutMs, input, runId });
|
|
757
|
+
const toolResult = await this.tryToolCallPath({ model, baseContext: context, schemaRef, schema, signal, apiKey, effectiveTimeoutMs, input, runId, requestBudget });
|
|
737
758
|
if (toolResult.success && toolResult.output !== undefined) {
|
|
738
759
|
validatedOutput = toolResult.output;
|
|
739
760
|
responseUsage = toolResult.usage ?? null;
|
|
@@ -745,7 +766,7 @@ export class PiAiRuntimeAdapter {
|
|
|
745
766
|
}
|
|
746
767
|
// ── Path 2: JSON mode (PRI-271 B1) ──
|
|
747
768
|
if (!validatedOutput && (strategy === 'tool_call_first' || strategy === 'json_mode_first') && schema && schemaRef) {
|
|
748
|
-
const jsonResult = await this.tryJsonModePath({ model, baseContext: context, schemaRef, schema, signal, apiKey, effectiveTimeoutMs, input, runId });
|
|
769
|
+
const jsonResult = await this.tryJsonModePath({ model, baseContext: context, schemaRef, schema, signal, apiKey, effectiveTimeoutMs, input, runId, requestBudget });
|
|
749
770
|
if (jsonResult.success && jsonResult.output !== undefined) {
|
|
750
771
|
validatedOutput = jsonResult.output;
|
|
751
772
|
responseUsage = jsonResult.usage ?? null;
|
|
@@ -757,7 +778,7 @@ export class PiAiRuntimeAdapter {
|
|
|
757
778
|
}
|
|
758
779
|
// ── Path 3: Free-form + repair (current behavior, enhanced) ──
|
|
759
780
|
if (!validatedOutput) {
|
|
760
|
-
const response = await this.completeWithRetry(model, context, { signal, apiKey, effectiveTimeoutMs, timeoutSource, input, runId });
|
|
781
|
+
const response = await this.completeWithRetry(model, context, { signal, apiKey, effectiveTimeoutMs, timeoutSource, input, runId, requestBudget });
|
|
761
782
|
const text = extractAssistantTextOrThrow(response, signal);
|
|
762
783
|
// PRI-707: preserve what the provider actually told us about how the
|
|
763
784
|
// response ended. Before this, finish metadata (stopReason/usage) was
|
|
@@ -822,7 +843,10 @@ export class PiAiRuntimeAdapter {
|
|
|
822
843
|
.map(e => ({ path: e.path, message: e.message, value: e.value }));
|
|
823
844
|
const validationErrorEntries = schemaErrors
|
|
824
845
|
.slice(0, 10)
|
|
825
|
-
.map(e => formatValidationErrorEntry(e.path,
|
|
846
|
+
.map(e => formatValidationErrorEntry(e.path,
|
|
847
|
+
// P1-3: name the missing per-kind field instead of the opaque
|
|
848
|
+
// "Expected union value" (that text fed the repair prompt).
|
|
849
|
+
explainUnionValidationFailure({ schema, rootValue: parsedOutput, path: e.path, message: e.message }), e.value));
|
|
826
850
|
const rawOutputPreview = safeStringifyPreview(parsedOutput);
|
|
827
851
|
this.eventEmitter.emitTelemetry({
|
|
828
852
|
eventType: 'output_schema_invalid',
|
|
@@ -849,8 +873,24 @@ export class PiAiRuntimeAdapter {
|
|
|
849
873
|
// the schema error we already have. attemptsUsed=0 in the telemetry
|
|
850
874
|
// below is the observable record of the skip.
|
|
851
875
|
const repairBudgetExhausted = runDeadlineAt - Date.now() < MIN_REPAIR_BUDGET_MS;
|
|
876
|
+
// S6: repair attempts are provider requests too, so they draw from the
|
|
877
|
+
// same run budget. When the three output paths already spent it, the
|
|
878
|
+
// schema error we have is returned instead of starting a repair loop
|
|
879
|
+
// that cannot send anything.
|
|
880
|
+
const configuredRepairAttempts = this.config.maxRepairAttempts ?? DEFAULT_REPAIR_CONFIG.maxRepairAttempts;
|
|
881
|
+
const repairAttemptsAllowed = Math.min(configuredRepairAttempts, Math.max(0, requestBudget.requestsLeft));
|
|
882
|
+
// S1: time-budget skip is decided before the loop (a repair that
|
|
883
|
+
// cannot finish inside the deadline is not started at all).
|
|
884
|
+
const repairTimeBudgetSkipEvidence = repairBudgetExhausted
|
|
885
|
+
? { repairSkipped: true, repairSkipReason: 'budget_exhausted', remainingBudgetMs: Math.max(0, runDeadlineAt - Date.now()) }
|
|
886
|
+
: {};
|
|
852
887
|
const repairResult = await attemptStructuredOutputRepair(parsedOutput, schemaErrors, {
|
|
853
|
-
llmCaller: (prompt) =>
|
|
888
|
+
llmCaller: (prompt) => {
|
|
889
|
+
// S6: maxRepairAttempts is already capped by the remaining run
|
|
890
|
+
// budget, so every repair attempt is guaranteed one request.
|
|
891
|
+
consumeRunRequest(requestBudget);
|
|
892
|
+
return this.repairLLMCall(model, prompt, { signal, apiKey, systemPrompt, input, runDeadlineAt });
|
|
893
|
+
},
|
|
854
894
|
schemaCheck: (value) => Value.Check(schema, value),
|
|
855
895
|
schemaErrors: (value) => [...Value.Errors(schema, value)].map(e => ({ path: e.path, message: e.message, value: e.value })),
|
|
856
896
|
}, {
|
|
@@ -859,7 +899,7 @@ export class PiAiRuntimeAdapter {
|
|
|
859
899
|
schemaSummary,
|
|
860
900
|
schemaJson,
|
|
861
901
|
requiredKeys,
|
|
862
|
-
maxRepairAttempts: repairBudgetExhausted ? 0 :
|
|
902
|
+
maxRepairAttempts: repairBudgetExhausted ? 0 : repairAttemptsAllowed,
|
|
863
903
|
// PRI-707: when finish metadata proves the output was cut by the
|
|
864
904
|
// token limit, the repair LLM must know — repairing a truncated
|
|
865
905
|
// fragment like a schema misunderstanding produced blind fixes.
|
|
@@ -867,6 +907,29 @@ export class PiAiRuntimeAdapter {
|
|
|
867
907
|
? `The previous output was cut off by the token limit (finish_reason=length${finishOutputTokens !== undefined ? `, ${finishOutputTokens} output tokens` : ''}). It is incomplete, not misunderstood. Do NOT invent missing content beyond the schema; produce the SHORTEST complete JSON object that satisfies the schema.`
|
|
868
908
|
: undefined,
|
|
869
909
|
});
|
|
910
|
+
// S6: the run budget can run out *during* the repair loop, not only
|
|
911
|
+
// before it. The loop can start at most `repairAttemptsAllowed`
|
|
912
|
+
// attempts, so every configured attempt above that cap had no request
|
|
913
|
+
// left. Report them by count — otherwise a partially truncated repair
|
|
914
|
+
// (configured 3, budget 3, 1 path spent → only 2 repair attempts) looks
|
|
915
|
+
// identical to a loop that simply used everything it was given.
|
|
916
|
+
// A successful repair ended the loop deliberately and skipped nothing.
|
|
917
|
+
const repairAttemptsSkippedByRequestBudget = !repairBudgetExhausted && !repairResult.repaired
|
|
918
|
+
? Math.max(0, configuredRepairAttempts - repairAttemptsAllowed)
|
|
919
|
+
: 0;
|
|
920
|
+
const repairRequestBudgetSkipEvidence = repairAttemptsSkippedByRequestBudget > 0
|
|
921
|
+
? {
|
|
922
|
+
// `repairSkipped` keeps its S1 meaning: the loop never ran.
|
|
923
|
+
...(repairAttemptsAllowed === 0 ? { repairSkipped: true } : {}),
|
|
924
|
+
repairSkipReason: 'request_budget_exhausted',
|
|
925
|
+
repairAttemptsConfigured: configuredRepairAttempts,
|
|
926
|
+
repairAttemptsSkippedByRequestBudget,
|
|
927
|
+
}
|
|
928
|
+
: {};
|
|
929
|
+
const repairSkipEvidence = {
|
|
930
|
+
...repairTimeBudgetSkipEvidence,
|
|
931
|
+
...repairRequestBudgetSkipEvidence,
|
|
932
|
+
};
|
|
870
933
|
this.eventEmitter.emitTelemetry({
|
|
871
934
|
eventType: 'output_repair_attempted',
|
|
872
935
|
traceId: input.taskRef?.taskId ?? runId,
|
|
@@ -882,15 +945,10 @@ export class PiAiRuntimeAdapter {
|
|
|
882
945
|
repairSummary: repairResult.repairSummary,
|
|
883
946
|
repairAttempts: repairResult.repairAttempts,
|
|
884
947
|
outputPath: 'free_form_with_repair',
|
|
885
|
-
// S1: never truncate silently — when repair was skipped
|
|
886
|
-
// the
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
repairSkipped: true,
|
|
890
|
-
repairSkipReason: 'budget_exhausted',
|
|
891
|
-
remainingBudgetMs: Math.max(0, runDeadlineAt - Date.now()),
|
|
892
|
-
}
|
|
893
|
-
: {}),
|
|
948
|
+
// S1/S6: never truncate silently — when repair was skipped
|
|
949
|
+
// because the time budget or the run's request budget was spent,
|
|
950
|
+
// say which one in the event.
|
|
951
|
+
...repairSkipEvidence,
|
|
894
952
|
},
|
|
895
953
|
});
|
|
896
954
|
// S1: an abort during repair must surface as the real stop reason
|
|
@@ -946,9 +1004,7 @@ export class PiAiRuntimeAdapter {
|
|
|
946
1004
|
validationErrors: validationErrorEntries,
|
|
947
1005
|
repairAttempts: evidencePack.repairAttempts,
|
|
948
1006
|
finalFailureReason: evidencePack.finalFailureReason,
|
|
949
|
-
...
|
|
950
|
-
? { repairSkipped: true, repairSkipReason: 'budget_exhausted' }
|
|
951
|
-
: {}),
|
|
1007
|
+
...repairSkipEvidence,
|
|
952
1008
|
// PRI-707: keep the terminal repair-exhausted event able to
|
|
953
1009
|
// distinguish a token-limit cut from an ordinary schema
|
|
954
1010
|
// failure — mirror the evidencePack finish metadata (PR #1574
|
|
@@ -1199,6 +1255,12 @@ export class PiAiRuntimeAdapter {
|
|
|
1199
1255
|
...params.baseContext,
|
|
1200
1256
|
tools: [buildSchemaToolDefinition(params.schemaRef, params.schema, new DefaultSchemaPromptAdapter())],
|
|
1201
1257
|
};
|
|
1258
|
+
// S6: spend from the run's shared budget. The tool path is always the
|
|
1259
|
+
// first of the three budgeted output paths, so with the budget set to
|
|
1260
|
+
// the path count it cannot find itself exhausted; the checks that can
|
|
1261
|
+
// actually fire live in completeWithRetry's downshift loop and in the
|
|
1262
|
+
// repair loop.
|
|
1263
|
+
consumeRunRequest(params.requestBudget);
|
|
1202
1264
|
const completeOptions = {
|
|
1203
1265
|
signal: params.signal,
|
|
1204
1266
|
apiKey: params.apiKey,
|
|
@@ -1257,6 +1319,11 @@ export class PiAiRuntimeAdapter {
|
|
|
1257
1319
|
*/
|
|
1258
1320
|
async tryJsonModePath(params) {
|
|
1259
1321
|
try {
|
|
1322
|
+
// S6: spend from the run's shared budget. The JSON path is at most the
|
|
1323
|
+
// second of the three budgeted output paths, so it cannot find itself
|
|
1324
|
+
// exhausted; the checks that can fire live in completeWithRetry's
|
|
1325
|
+
// downshift loop and in the repair loop.
|
|
1326
|
+
consumeRunRequest(params.requestBudget);
|
|
1260
1327
|
const completeOptions = {
|
|
1261
1328
|
signal: params.signal,
|
|
1262
1329
|
apiKey: params.apiKey,
|
|
@@ -1410,7 +1477,7 @@ export class PiAiRuntimeAdapter {
|
|
|
1410
1477
|
* budget, so the ladder terminates by construction.
|
|
1411
1478
|
*/
|
|
1412
1479
|
async completeWithRetry(model, context, options) {
|
|
1413
|
-
const { effectiveTimeoutMs = this.config.timeoutMs ?? 300_000, timeoutSource = 'default', input, runId = crypto.randomUUID(), } = options;
|
|
1480
|
+
const { effectiveTimeoutMs = this.config.timeoutMs ?? 300_000, timeoutSource = 'default', input, runId = crypto.randomUUID(), requestBudget, } = options;
|
|
1414
1481
|
// S2: the retry budget handed to pi-ai. It is recorded on every failure so
|
|
1415
1482
|
// the final reason is auditable ("who retried, how many times").
|
|
1416
1483
|
const transportMaxRetries = this.config.maxRetries ?? 2;
|
|
@@ -1426,6 +1493,9 @@ export class PiAiRuntimeAdapter {
|
|
|
1426
1493
|
// Number of requests PD itself sent for this logical call. Transport
|
|
1427
1494
|
// retries inside pi-ai are invisible here by design (they are pi-ai's).
|
|
1428
1495
|
let attemptsSent = 0;
|
|
1496
|
+
// S6: evidence from the previous attempt, carried into the error raised
|
|
1497
|
+
// when the run's shared budget cannot fund another attempt.
|
|
1498
|
+
let lastFailureEvidence;
|
|
1429
1499
|
while (true) {
|
|
1430
1500
|
attemptsSent += 1;
|
|
1431
1501
|
const attempt = attemptsSent - 1;
|
|
@@ -1468,6 +1538,24 @@ export class PiAiRuntimeAdapter {
|
|
|
1468
1538
|
if (this.config.reasoning !== undefined && this.config.reasoning !== false) {
|
|
1469
1539
|
completeOptions.reasoning = this.config.reasoning;
|
|
1470
1540
|
}
|
|
1541
|
+
// S6: no attempt may exceed the run's shared request budget. This also
|
|
1542
|
+
// bounds the PRI-1011 downshift ladder, which is the only reason this
|
|
1543
|
+
// loop can iterate after S2 moved transport retries into pi-ai.
|
|
1544
|
+
if (!consumeRunRequest(requestBudget)) {
|
|
1545
|
+
const requestsSent = RUN_REQUEST_BUDGET - requestBudget.requestsLeft;
|
|
1546
|
+
throw new PDRuntimeError('execution_failed', `LLM request budget exhausted after ${requestsSent}/${RUN_REQUEST_BUDGET} requests for this run`, {
|
|
1547
|
+
finalFailureReason: 'request_budget_exhausted',
|
|
1548
|
+
requestBudget: RUN_REQUEST_BUDGET,
|
|
1549
|
+
requestsSent,
|
|
1550
|
+
retryAttempt: attempt,
|
|
1551
|
+
transportMaxRetries,
|
|
1552
|
+
retryOwnership: 'pi-ai',
|
|
1553
|
+
...(lastFailureEvidence !== undefined
|
|
1554
|
+
? { providerEvidence: lastFailureEvidence }
|
|
1555
|
+
: {}),
|
|
1556
|
+
nextAction: 'The run already spent its request budget on other output paths; inspect the earlier output_path_fallback events before increasing it.',
|
|
1557
|
+
});
|
|
1558
|
+
}
|
|
1471
1559
|
const response = await completeSimple(model, context, completeOptions);
|
|
1472
1560
|
// If provider resolved with an error response, classify and decide.
|
|
1473
1561
|
// S2: no transport retry happens here — pi-ai already retried every
|
|
@@ -1555,6 +1643,7 @@ export class PiAiRuntimeAdapter {
|
|
|
1555
1643
|
});
|
|
1556
1644
|
}
|
|
1557
1645
|
maxTokensBudget = next;
|
|
1646
|
+
lastFailureEvidence = safeStringifyPreview(rawMessage, 300);
|
|
1558
1647
|
continue;
|
|
1559
1648
|
}
|
|
1560
1649
|
}
|
|
@@ -1661,6 +1750,7 @@ export class PiAiRuntimeAdapter {
|
|
|
1661
1750
|
});
|
|
1662
1751
|
}
|
|
1663
1752
|
maxTokensBudget = next;
|
|
1753
|
+
lastFailureEvidence = safeStringifyPreview(errMsg, 300);
|
|
1664
1754
|
continue;
|
|
1665
1755
|
}
|
|
1666
1756
|
}
|