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
|
@@ -15,6 +15,11 @@
|
|
|
15
15
|
* - All summaries go through sanitizeString from evidence-sanitizer
|
|
16
16
|
* - Degraded paths include structured reason + nextAction (ERR-002)
|
|
17
17
|
*
|
|
18
|
+
* P1-2 exception: `getAssistantTurn()` returns ONE referenced assistant turn
|
|
19
|
+
* verbatim, on purpose — the Owner must be able to compare the recorded
|
|
20
|
+
* correction against exactly what the agent said. It is bounded to the turn id
|
|
21
|
+
* recorded in correction evidence and pinned to that turn's session.
|
|
22
|
+
*
|
|
18
23
|
* ERR checklist:
|
|
19
24
|
* - ERR-001/005: All DB rows treated as unknown, runtime validation with typeof guards
|
|
20
25
|
* - ERR-002: Degraded paths include reason + nextAction, never silent fallback
|
|
@@ -23,10 +28,46 @@
|
|
|
23
28
|
* - ERR-013: Use Object.hasOwn() for untrusted object keys
|
|
24
29
|
*/
|
|
25
30
|
import { SqliteConnection, sanitizeString, assembleEvidenceChain, } from '@principles/core/runtime';
|
|
31
|
+
import { openTrajectoryDbReadonly } from '@principles/core/trajectory-store';
|
|
32
|
+
import { resolveStateDbPath, resolveTrajectoryDbPath } from '@principles/core/runtime/storage-paths';
|
|
26
33
|
import * as fs from 'node:fs';
|
|
27
34
|
import * as path from 'node:path';
|
|
28
35
|
import Database from 'better-sqlite3';
|
|
29
36
|
import { errorMessage } from '../utils/response.js';
|
|
37
|
+
/**
|
|
38
|
+
* P1-2: restore the assistant turn text for verbatim display.
|
|
39
|
+
*
|
|
40
|
+
* Order of preference: inline `raw_text` → overflow blob (`blob_ref`) →
|
|
41
|
+
* `sanitized_text` (kept for retention cases where raw text was purged). The
|
|
42
|
+
* blob path is treated as untrusted: it must resolve inside `<state>/blobs`,
|
|
43
|
+
* otherwise it is ignored (rc-1 / rc-2).
|
|
44
|
+
*/
|
|
45
|
+
function readVerbatimTurnText(row, stateDir) {
|
|
46
|
+
const inlineRaw = typeof row.raw_text === 'string' ? row.raw_text : '';
|
|
47
|
+
if (inlineRaw !== '')
|
|
48
|
+
return { text: inlineRaw, source: 'raw' };
|
|
49
|
+
const blobRef = typeof row.blob_ref === 'string' ? row.blob_ref : '';
|
|
50
|
+
if (blobRef !== '') {
|
|
51
|
+
const blobsDir = path.resolve(stateDir, 'blobs');
|
|
52
|
+
const blobPath = path.resolve(blobsDir, blobRef);
|
|
53
|
+
const relativeToBlobs = path.relative(blobsDir, blobPath);
|
|
54
|
+
const escapes = relativeToBlobs === '' || relativeToBlobs.startsWith('..') || path.isAbsolute(relativeToBlobs);
|
|
55
|
+
if (!escapes && fs.existsSync(blobPath)) {
|
|
56
|
+
try {
|
|
57
|
+
const blobText = fs.readFileSync(blobPath, 'utf8');
|
|
58
|
+
if (blobText !== '')
|
|
59
|
+
return { text: blobText, source: 'raw' };
|
|
60
|
+
}
|
|
61
|
+
catch {
|
|
62
|
+
// Unreadable blob: fall through to the sanitized copy below.
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
const sanitized = typeof row.sanitized_text === 'string' ? row.sanitized_text : '';
|
|
67
|
+
if (sanitized !== '')
|
|
68
|
+
return { text: sanitized, source: 'sanitized' };
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
30
71
|
// ── Helpers ────────────────────────────────────────────────────────────────────
|
|
31
72
|
function isRecord(value) {
|
|
32
73
|
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
@@ -136,7 +177,7 @@ export class EvidenceChainConsoleModel {
|
|
|
136
177
|
const degradedReasons = [];
|
|
137
178
|
const degradedNextActions = [];
|
|
138
179
|
// ── 1. Read pain_events from trajectory.db ────────────────────────────
|
|
139
|
-
const trajectoryDbPath =
|
|
180
|
+
const trajectoryDbPath = resolveTrajectoryDbPath(this.workspaceDir);
|
|
140
181
|
let painEvents = [];
|
|
141
182
|
let trajectoryDbAvailable = false;
|
|
142
183
|
if (fs.existsSync(trajectoryDbPath)) {
|
|
@@ -190,7 +231,7 @@ export class EvidenceChainConsoleModel {
|
|
|
190
231
|
degradedNextActions.push('PD has not recorded any pain signals in this workspace yet.');
|
|
191
232
|
}
|
|
192
233
|
// ── 2. Read tasks & candidates from state.db ──────────────────────
|
|
193
|
-
const stateDbPath =
|
|
234
|
+
const stateDbPath = resolveStateDbPath(this.workspaceDir);
|
|
194
235
|
let tasks = [];
|
|
195
236
|
let dreamerTasks = [];
|
|
196
237
|
let candidates = [];
|
|
@@ -340,6 +381,84 @@ export class EvidenceChainConsoleModel {
|
|
|
340
381
|
}
|
|
341
382
|
return response;
|
|
342
383
|
}
|
|
384
|
+
/**
|
|
385
|
+
* P1-2: read the raw assistant turn referenced by correction evidence.
|
|
386
|
+
* Verbatim by contract — no sanitization, no markdown rendering.
|
|
387
|
+
*
|
|
388
|
+
* Uses the registered trajectory-store seam (`openTrajectoryDbReadonly`) so
|
|
389
|
+
* the read-only + path-contract rules have a single owner. The overflow blob
|
|
390
|
+
* directory is derived from the trajectory database location, never
|
|
391
|
+
* hardcoded, and a blob reference is confined to that directory before it is
|
|
392
|
+
* read.
|
|
393
|
+
*/
|
|
394
|
+
async getAssistantTurn(turnId, expectedSessionId) {
|
|
395
|
+
if (!Number.isInteger(turnId) || turnId <= 0) {
|
|
396
|
+
return {
|
|
397
|
+
ok: false,
|
|
398
|
+
reason: 'Assistant turn id must be a positive integer',
|
|
399
|
+
nextAction: 'Reload the page and expand the original output again.',
|
|
400
|
+
};
|
|
401
|
+
}
|
|
402
|
+
const trajectoryDbPath = resolveTrajectoryDbPath(this.workspaceDir);
|
|
403
|
+
if (!fs.existsSync(trajectoryDbPath)) {
|
|
404
|
+
return {
|
|
405
|
+
ok: false,
|
|
406
|
+
reason: 'Trajectory database not found for this workspace',
|
|
407
|
+
nextAction: 'PD has not recorded any turns in this workspace yet.',
|
|
408
|
+
};
|
|
409
|
+
}
|
|
410
|
+
let db = null;
|
|
411
|
+
try {
|
|
412
|
+
db = openTrajectoryDbReadonly(this.workspaceDir);
|
|
413
|
+
// Untrusted DB row: narrow with a guard instead of an `as` cast (rc-2).
|
|
414
|
+
const row = db.prepare('SELECT id, session_id, raw_text, sanitized_text, blob_ref, created_at FROM assistant_turns WHERE id = ?').get(turnId);
|
|
415
|
+
if (!isRecord(row)) {
|
|
416
|
+
return {
|
|
417
|
+
ok: false,
|
|
418
|
+
reason: `Assistant turn ${turnId} was not found`,
|
|
419
|
+
nextAction: 'The trajectory database may have been rotated; the correction text is still shown above.',
|
|
420
|
+
};
|
|
421
|
+
}
|
|
422
|
+
const sessionId = typeof row.session_id === 'string' ? row.session_id : '';
|
|
423
|
+
if (expectedSessionId && sessionId !== expectedSessionId) {
|
|
424
|
+
// Safety: never expose a turn from a different session than the one the
|
|
425
|
+
// correction evidence recorded.
|
|
426
|
+
return {
|
|
427
|
+
ok: false,
|
|
428
|
+
reason: 'Assistant turn does not belong to the recorded session',
|
|
429
|
+
nextAction: 'The evidence link is inconsistent; treat the original output as unavailable.',
|
|
430
|
+
};
|
|
431
|
+
}
|
|
432
|
+
const restored = readVerbatimTurnText(row, path.dirname(trajectoryDbPath));
|
|
433
|
+
if (restored === null) {
|
|
434
|
+
return {
|
|
435
|
+
ok: false,
|
|
436
|
+
reason: 'Assistant turn has no recorded output',
|
|
437
|
+
nextAction: 'The turn exists but its text was not persisted.',
|
|
438
|
+
};
|
|
439
|
+
}
|
|
440
|
+
return {
|
|
441
|
+
ok: true,
|
|
442
|
+
turn: {
|
|
443
|
+
id: turnId,
|
|
444
|
+
sessionId,
|
|
445
|
+
text: restored.text,
|
|
446
|
+
textSource: restored.source,
|
|
447
|
+
createdAt: typeof row.created_at === 'string' ? row.created_at : '',
|
|
448
|
+
},
|
|
449
|
+
};
|
|
450
|
+
}
|
|
451
|
+
catch (err) {
|
|
452
|
+
return {
|
|
453
|
+
ok: false,
|
|
454
|
+
reason: `Failed to read assistant turn: ${errorMessage(err)}`,
|
|
455
|
+
nextAction: 'Check trajectory database integrity in the workspace .state directory.',
|
|
456
|
+
};
|
|
457
|
+
}
|
|
458
|
+
finally {
|
|
459
|
+
db?.close();
|
|
460
|
+
}
|
|
461
|
+
}
|
|
343
462
|
// eslint-disable-next-line @typescript-eslint/class-methods-use-this -- lifecycle interface; connections are request-scoped
|
|
344
463
|
dispose() {
|
|
345
464
|
// Connections are opened and closed per-request; no persistent state.
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { SqliteConnection, SqliteApprovalQueueStore, SqlitePIArtifactStore, ApprovalQueue, } from '@principles/core/runtime';
|
|
2
|
+
import { resolveStateDbPath, resolveTrajectoryDbPath } from '@principles/core/runtime/storage-paths';
|
|
2
3
|
import * as fs from 'node:fs';
|
|
3
4
|
import * as path from 'node:path';
|
|
4
5
|
import { errorMessage } from '../utils/response.js';
|
|
@@ -51,7 +52,7 @@ export class GovernanceConsoleModel {
|
|
|
51
52
|
this.workspaceDir = workspaceDir;
|
|
52
53
|
}
|
|
53
54
|
async getGovernanceQueue() {
|
|
54
|
-
const stateDbPath =
|
|
55
|
+
const stateDbPath = resolveStateDbPath(this.workspaceDir);
|
|
55
56
|
if (!fs.existsSync(stateDbPath)) {
|
|
56
57
|
// Security audit run-1 (gate-failopen-allow-on-state-corruption): the
|
|
57
58
|
// governed agent can delete state.db, and the gate then fails open —
|
|
@@ -293,7 +294,7 @@ export class GovernanceConsoleModel {
|
|
|
293
294
|
}
|
|
294
295
|
// PRI-380: Query trajectory.db for behavior evidence count
|
|
295
296
|
let evidenceInProgressCount = 0;
|
|
296
|
-
const trajectoryDbPath =
|
|
297
|
+
const trajectoryDbPath = resolveTrajectoryDbPath(this.workspaceDir);
|
|
297
298
|
if (fs.existsSync(trajectoryDbPath)) {
|
|
298
299
|
try {
|
|
299
300
|
const Database = (await import('better-sqlite3')).default;
|
|
@@ -16,6 +16,7 @@ import * as path from 'node:path';
|
|
|
16
16
|
import { createHash } from 'node:crypto';
|
|
17
17
|
import { RUNTIME_CONTRACT_SCHEMA_VERSION } from '@principles/core/runtime';
|
|
18
18
|
import { deriveGovernanceExperienceSnapshot, deriveOwnerGovernanceView, } from '@principles/core/runtime';
|
|
19
|
+
import { resolveStateDbPath } from '@principles/core/runtime/storage-paths';
|
|
19
20
|
import { GovernanceProjectionCollector, isRecord, readOwnString, } from './GovernanceProjectionCollector.js';
|
|
20
21
|
import { loadPdConfig } from '../config/pd-config-store.js';
|
|
21
22
|
const EMPTY_TABLES = { artifactRows: [], taskRows: [], approvalRows: [], activationRows: [] };
|
|
@@ -59,7 +60,7 @@ export class GovernanceExperienceCollector {
|
|
|
59
60
|
});
|
|
60
61
|
}
|
|
61
62
|
// ── state.db: existence check + one batched table read ───────────────────
|
|
62
|
-
const dbPath =
|
|
63
|
+
const dbPath = resolveStateDbPath(this.workspaceDir);
|
|
63
64
|
let tables = EMPTY_TABLES;
|
|
64
65
|
let stateDbAvailable = true;
|
|
65
66
|
let stateDbReasonCode;
|
|
@@ -3,6 +3,7 @@ import * as path from 'node:path';
|
|
|
3
3
|
import { RUNTIME_CONTRACT_SCHEMA_VERSION } from '@principles/core/runtime';
|
|
4
4
|
import { Value } from '@sinclair/typebox/value';
|
|
5
5
|
import { GovernanceFactsSchema, SqliteConnection, isPDErrorCategory, parsePITaskMetadata, PD_TASK_STATUSES, PRINCIPLE_STATUSES, isPDTaskStatus, } from '@principles/core/runtime';
|
|
6
|
+
import { resolveStateDbPath } from '@principles/core/runtime/storage-paths';
|
|
6
7
|
export const GOVERNANCE_TASK_KINDS = new Set([
|
|
7
8
|
'dreamer', 'philosopher', 'scribe', 'artificer', 'evaluator', 'rollout_reviewer',
|
|
8
9
|
]);
|
|
@@ -55,7 +56,7 @@ export class GovernanceProjectionCollector {
|
|
|
55
56
|
}
|
|
56
57
|
const collectionIssues = [];
|
|
57
58
|
const principle = this.readPrinciple(principleId, collectionIssues);
|
|
58
|
-
const dbPath =
|
|
59
|
+
const dbPath = resolveStateDbPath(this.workspaceDir);
|
|
59
60
|
if (!fs.existsSync(dbPath)) {
|
|
60
61
|
return GovernanceProjectionCollector.factsForUnavailableSource({ principleId, asOf, principle, collectionIssues });
|
|
61
62
|
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/** The per-host row shape mirrors health-ingestion.ts structurally (review surface, not a projection). */
|
|
2
|
+
export interface IngestionHostRow {
|
|
3
|
+
status: 'monitored' | 'not_wired';
|
|
4
|
+
[field: string]: unknown;
|
|
5
|
+
}
|
|
6
|
+
export interface IngestionHealthSnapshot {
|
|
7
|
+
/** 'ok' = the CLI authority produced a real report (verbatim section passthrough). */
|
|
8
|
+
status: 'ok';
|
|
9
|
+
generatedAt: string;
|
|
10
|
+
workspace: string;
|
|
11
|
+
ingestion: {
|
|
12
|
+
codex: IngestionHostRow;
|
|
13
|
+
workbuddy: IngestionHostRow;
|
|
14
|
+
openclaw: IngestionHostRow;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export type IngestionHealthResult = {
|
|
18
|
+
status: 'ok';
|
|
19
|
+
snapshot: IngestionHealthSnapshot;
|
|
20
|
+
} | {
|
|
21
|
+
status: 'unknown';
|
|
22
|
+
reason: string;
|
|
23
|
+
nextAction: string;
|
|
24
|
+
productClaim: 'degraded';
|
|
25
|
+
};
|
|
26
|
+
export declare class IngestionHealthModel {
|
|
27
|
+
private readonly workspaceDir;
|
|
28
|
+
private readonly cliEntryOverride;
|
|
29
|
+
private readonly execTimeoutMs;
|
|
30
|
+
constructor(workspaceDir: string, cliEntryOverride?: string, options?: {
|
|
31
|
+
execTimeoutMs?: number;
|
|
32
|
+
});
|
|
33
|
+
collect(): Promise<IngestionHealthResult>;
|
|
34
|
+
}
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* IngestionHealthModel — Console adapter for the unified three-host
|
|
3
|
+
* conversation-ingestion health section (PRI-1171 ticket ⑦; SPEC v0.2 §6,
|
|
4
|
+
* tech design §9).
|
|
5
|
+
*
|
|
6
|
+
* The readiness/state computation has ONE authority: the production CLI
|
|
7
|
+
* `pd health --json` (packages/pd-cli/src/commands/health-ingestion.ts).
|
|
8
|
+
* This model executes that command in a fresh subprocess against the
|
|
9
|
+
* workspace and returns its `.ingestion` section VERBATIM — the Console
|
|
10
|
+
* MUST NOT copy the per-host judgment, or CLI and Console could disagree
|
|
11
|
+
* about the same facts (P4: one source of truth). Same discipline as the
|
|
12
|
+
* CodexGovernanceHealthModel (PRI-625 Slice D / PRI-1013).
|
|
13
|
+
*
|
|
14
|
+
* Failure is explicit (rc-9): when the CLI cannot run or its output is not a
|
|
15
|
+
* report, the model returns `status: 'unknown'` with a structured reason and
|
|
16
|
+
* the manual-run nextAction — "unable to determine" is never rendered as
|
|
17
|
+
* healthy. A non-zero exit is NOT by itself a collection failure: the main
|
|
18
|
+
* `pd health` report can exit 1 for OTHER degraded sections (ledger
|
|
19
|
+
* consistency, MCP) while still printing the full JSON report first, so a
|
|
20
|
+
* parseable report on any non-killed exit is accepted (killed/signal/spawn
|
|
21
|
+
* errors are failures — their stdout is partial or stale, never a report).
|
|
22
|
+
*
|
|
23
|
+
* Read-only status, NOT trajectory browsing (SPEC G6 red line): this surface
|
|
24
|
+
* carries flags/consent metadata/water marks/lag counters and bounded
|
|
25
|
+
* session identities — never observation bodies or transcript content.
|
|
26
|
+
*/
|
|
27
|
+
import { execFile } from 'node:child_process';
|
|
28
|
+
import { promisify } from 'node:util';
|
|
29
|
+
import { resolvePdCliEntry } from './CodexGovernanceHealthModel.js';
|
|
30
|
+
import { errorMessage } from '../utils/response.js';
|
|
31
|
+
const execFileAsync = promisify(execFile);
|
|
32
|
+
const MANUAL_RUN_ACTION = 'Run `pd health --workspace <dir> --json` manually to see the structured ingestion section.';
|
|
33
|
+
function degradedCollection(reason, detail) {
|
|
34
|
+
return {
|
|
35
|
+
status: 'unknown',
|
|
36
|
+
reason,
|
|
37
|
+
nextAction: detail.length > 0 ? `${MANUAL_RUN_ACTION} (${detail})` : MANUAL_RUN_ACTION,
|
|
38
|
+
productClaim: 'degraded',
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
function isDegradedBlock(value) {
|
|
42
|
+
if (typeof value !== 'object' || value === null || Array.isArray(value))
|
|
43
|
+
return false;
|
|
44
|
+
return typeof Reflect.get(value, 'reason') === 'string'
|
|
45
|
+
&& typeof Reflect.get(value, 'nextAction') === 'string';
|
|
46
|
+
}
|
|
47
|
+
/** Minimal shapes the CLIENT validator requires — reject here so a malformed
|
|
48
|
+
* row degrades to the explicit unknown block, not a client-side "unable to
|
|
49
|
+
* connect" (the client validator rejects the whole response on one bad row).
|
|
50
|
+
* This is a guard, NOT a second copy of the full client validation. */
|
|
51
|
+
function isCheckpointSessionPart(value) {
|
|
52
|
+
if (typeof value !== 'object' || value === null || Array.isArray(value))
|
|
53
|
+
return false;
|
|
54
|
+
if (!Object.hasOwn(value, 'lagBytes') || !Object.hasOwn(value, 'lastDegradationReason'))
|
|
55
|
+
return false;
|
|
56
|
+
const lag = Reflect.get(value, 'lagBytes');
|
|
57
|
+
const degradation = Reflect.get(value, 'lastDegradationReason');
|
|
58
|
+
return typeof Reflect.get(value, 'rolloutIdentity') === 'string'
|
|
59
|
+
&& typeof Reflect.get(value, 'byteOffset') === 'number'
|
|
60
|
+
&& typeof Reflect.get(value, 'incompleteTail') === 'boolean'
|
|
61
|
+
&& typeof Reflect.get(value, 'updatedAt') === 'string'
|
|
62
|
+
&& (lag === null || typeof lag === 'number')
|
|
63
|
+
&& (degradation === null || typeof degradation === 'string');
|
|
64
|
+
}
|
|
65
|
+
function isCheckpointsPart(value) {
|
|
66
|
+
if (typeof value !== 'object' || value === null || Array.isArray(value))
|
|
67
|
+
return false;
|
|
68
|
+
if (!Object.hasOwn(value, 'total'))
|
|
69
|
+
return isDegradedBlock(value);
|
|
70
|
+
// The client validator requires these fields and rejects the WHOLE response
|
|
71
|
+
// when one is missing. Guard them here too: a `checkpoints` block lacking
|
|
72
|
+
// lastSuccessAt (or with a malformed session element) must degrade to the
|
|
73
|
+
// structured unknown block, not reach the page as "unable to connect"
|
|
74
|
+
// (PR #2563 re-review 4546270187).
|
|
75
|
+
for (const key of ['lastSuccessAt', 'checkpointOffset', 'lagBytes', 'lastDegradation', 'sessions']) {
|
|
76
|
+
if (!Object.hasOwn(value, key))
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
79
|
+
const nullableString = (v) => v === null || typeof v === 'string';
|
|
80
|
+
const nullableNumber = (v) => v === null || typeof v === 'number';
|
|
81
|
+
if (!nullableString(Reflect.get(value, 'lastSuccessAt'))
|
|
82
|
+
|| !nullableNumber(Reflect.get(value, 'checkpointOffset'))
|
|
83
|
+
|| !nullableNumber(Reflect.get(value, 'lagBytes')))
|
|
84
|
+
return false;
|
|
85
|
+
const lastDegradation = Reflect.get(value, 'lastDegradation');
|
|
86
|
+
if (lastDegradation !== null) {
|
|
87
|
+
if (typeof lastDegradation !== 'object' || Array.isArray(lastDegradation))
|
|
88
|
+
return false;
|
|
89
|
+
if (typeof Reflect.get(lastDegradation, 'reason') !== 'string'
|
|
90
|
+
|| typeof Reflect.get(lastDegradation, 'updatedAt') !== 'string'
|
|
91
|
+
|| !Object.hasOwn(lastDegradation, 'ordinal'))
|
|
92
|
+
return false;
|
|
93
|
+
}
|
|
94
|
+
const sessions = Reflect.get(value, 'sessions');
|
|
95
|
+
if (!Array.isArray(sessions))
|
|
96
|
+
return false;
|
|
97
|
+
return typeof Reflect.get(value, 'total') === 'number'
|
|
98
|
+
&& typeof Reflect.get(value, 'incompleteTailCount') === 'number'
|
|
99
|
+
&& typeof Reflect.get(value, 'lagUndetectable') === 'boolean'
|
|
100
|
+
&& typeof Reflect.get(value, 'truncated') === 'boolean'
|
|
101
|
+
&& sessions.every(isCheckpointSessionPart);
|
|
102
|
+
}
|
|
103
|
+
function isLiveOnlyPart(value) {
|
|
104
|
+
if (typeof value !== 'object' || value === null || Array.isArray(value))
|
|
105
|
+
return false;
|
|
106
|
+
if (!Object.hasOwn(value, 'sessions'))
|
|
107
|
+
return isDegradedBlock(value);
|
|
108
|
+
const sessions = Reflect.get(value, 'sessions');
|
|
109
|
+
if (!Array.isArray(sessions))
|
|
110
|
+
return false;
|
|
111
|
+
if (typeof Reflect.get(value, 'truncated') !== 'boolean')
|
|
112
|
+
return false;
|
|
113
|
+
return sessions.every((session) => {
|
|
114
|
+
if (typeof session !== 'object' || session === null || Array.isArray(session))
|
|
115
|
+
return false;
|
|
116
|
+
return typeof Reflect.get(session, 'rolloutIdentity') === 'string'
|
|
117
|
+
&& typeof Reflect.get(session, 'lastObservedAt') === 'string'
|
|
118
|
+
&& typeof Reflect.get(session, 'observationCount') === 'number';
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
function isHostRow(value) {
|
|
122
|
+
if (typeof value !== 'object' || value === null || Array.isArray(value))
|
|
123
|
+
return false;
|
|
124
|
+
const status = Reflect.get(value, 'status');
|
|
125
|
+
if (status === 'not_wired')
|
|
126
|
+
return isDegradedBlock(value);
|
|
127
|
+
if (status !== 'monitored')
|
|
128
|
+
return false;
|
|
129
|
+
// Field presence alone is not enough: `{ status:'monitored', hostFlag:{} }`
|
|
130
|
+
// used to pass here and then fail the client validator, rendering the page
|
|
131
|
+
// as "unreachable" instead of a structured collection failure (PR #2563
|
|
132
|
+
// review, CodeRabbit finding 4545201393).
|
|
133
|
+
for (const field of ['hostFlag', 'ingestionFlag']) {
|
|
134
|
+
const flag = Reflect.get(value, field);
|
|
135
|
+
if (typeof flag !== 'object' || flag === null || Array.isArray(flag))
|
|
136
|
+
return false;
|
|
137
|
+
const state = Reflect.get(flag, 'state');
|
|
138
|
+
if (state !== 'ENABLED' && state !== 'DISABLED' && state !== 'UNKNOWN')
|
|
139
|
+
return false;
|
|
140
|
+
if (typeof Reflect.get(flag, 'source') !== 'string')
|
|
141
|
+
return false;
|
|
142
|
+
}
|
|
143
|
+
const consent = Reflect.get(value, 'consent');
|
|
144
|
+
if (typeof consent !== 'object' || consent === null || Array.isArray(consent)
|
|
145
|
+
|| typeof Reflect.get(consent, 'state') !== 'string')
|
|
146
|
+
return false;
|
|
147
|
+
return isCheckpointsPart(Reflect.get(value, 'checkpoints'))
|
|
148
|
+
&& isLiveOnlyPart(Reflect.get(value, 'liveOnly'));
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* rc-1..rc-4: stdout from a subprocess is untrusted runtime data even when
|
|
152
|
+
* the subprocess is our own CLI, so the section-bearing fields are checked
|
|
153
|
+
* before the passthrough cast. This distinguishes a real report from a
|
|
154
|
+
* usage/rejection JSON or truncated output; the cast stays a verbatim
|
|
155
|
+
* passthrough of the CLI's documented contract (runtime-contract-exempt per
|
|
156
|
+
* the CodexGovernanceHealthModel precedent) because it sits behind the guards.
|
|
157
|
+
*/
|
|
158
|
+
function parseIngestionReport(text) {
|
|
159
|
+
if (text.trim().length === 0)
|
|
160
|
+
return undefined;
|
|
161
|
+
let parsed;
|
|
162
|
+
try {
|
|
163
|
+
parsed = JSON.parse(text);
|
|
164
|
+
}
|
|
165
|
+
catch {
|
|
166
|
+
return undefined;
|
|
167
|
+
}
|
|
168
|
+
if (typeof parsed !== 'object' || parsed === null || Array.isArray(parsed))
|
|
169
|
+
return undefined;
|
|
170
|
+
const generatedAt = Reflect.get(parsed, 'generatedAt');
|
|
171
|
+
const workspace = Reflect.get(parsed, 'workspace');
|
|
172
|
+
if (typeof generatedAt !== 'string' || typeof workspace !== 'string')
|
|
173
|
+
return undefined;
|
|
174
|
+
const ingestion = Reflect.get(parsed, 'ingestion');
|
|
175
|
+
if (typeof ingestion !== 'object' || ingestion === null || Array.isArray(ingestion))
|
|
176
|
+
return undefined;
|
|
177
|
+
const section = ingestion;
|
|
178
|
+
const codex = Reflect.get(section, 'codex');
|
|
179
|
+
const workbuddy = Reflect.get(section, 'workbuddy');
|
|
180
|
+
const openclaw = Reflect.get(section, 'openclaw');
|
|
181
|
+
// isHostRow is a type predicate — the validated values flow through with no cast.
|
|
182
|
+
if (!isHostRow(codex) || !isHostRow(workbuddy) || !isHostRow(openclaw))
|
|
183
|
+
return undefined;
|
|
184
|
+
return {
|
|
185
|
+
status: 'ok',
|
|
186
|
+
generatedAt,
|
|
187
|
+
workspace,
|
|
188
|
+
ingestion: { codex, workbuddy, openclaw },
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
/** rc-1/rc-2: the failure shape from fs/exec is unknown — read fields only if present. */
|
|
192
|
+
function stdoutFromExecError(error) {
|
|
193
|
+
if (typeof error !== 'object' || error === null || !Object.hasOwn(error, 'stdout'))
|
|
194
|
+
return '';
|
|
195
|
+
const { stdout } = error;
|
|
196
|
+
return typeof stdout === 'string' ? stdout : '';
|
|
197
|
+
}
|
|
198
|
+
function execFailureKind(error) {
|
|
199
|
+
if (typeof error !== 'object' || error === null)
|
|
200
|
+
return undefined;
|
|
201
|
+
const rec = error;
|
|
202
|
+
if (rec.killed === true)
|
|
203
|
+
return 'killed';
|
|
204
|
+
if (typeof rec.signal === 'string' && rec.signal.length > 0)
|
|
205
|
+
return `signal ${rec.signal}`;
|
|
206
|
+
if (typeof rec.code === 'string')
|
|
207
|
+
return rec.code;
|
|
208
|
+
return undefined;
|
|
209
|
+
}
|
|
210
|
+
export class IngestionHealthModel {
|
|
211
|
+
workspaceDir;
|
|
212
|
+
cliEntryOverride;
|
|
213
|
+
execTimeoutMs;
|
|
214
|
+
constructor(workspaceDir, cliEntryOverride, options) {
|
|
215
|
+
this.workspaceDir = workspaceDir;
|
|
216
|
+
this.cliEntryOverride = cliEntryOverride ?? null;
|
|
217
|
+
// Production default; the option exists only so a regression test can
|
|
218
|
+
// trigger a REAL timeout kill without waiting 30s (PRI-1013 discipline).
|
|
219
|
+
this.execTimeoutMs = options?.execTimeoutMs ?? 30_000;
|
|
220
|
+
}
|
|
221
|
+
async collect() {
|
|
222
|
+
const resolution = this.cliEntryOverride !== null
|
|
223
|
+
? { ok: true, entry: this.cliEntryOverride }
|
|
224
|
+
: resolvePdCliEntry();
|
|
225
|
+
if (!resolution.ok) {
|
|
226
|
+
return degradedCollection(resolution.reason, resolution.nextAction);
|
|
227
|
+
}
|
|
228
|
+
let stdout;
|
|
229
|
+
try {
|
|
230
|
+
const result = await execFileAsync(process.execPath, [resolution.entry, 'health', '--workspace', this.workspaceDir, '--json'], { encoding: 'utf8', timeout: this.execTimeoutMs, windowsHide: true });
|
|
231
|
+
({ stdout } = result);
|
|
232
|
+
}
|
|
233
|
+
catch (error) {
|
|
234
|
+
// A parseable report on ANY non-killed exit is accepted: the main health
|
|
235
|
+
// report may exit 1 for OTHER degraded sections (ledger/MCP) after
|
|
236
|
+
// printing the full JSON. killed/signal/spawn failures never render.
|
|
237
|
+
const failureKind = execFailureKind(error);
|
|
238
|
+
if (failureKind !== undefined) {
|
|
239
|
+
return degradedCollection('health_collection_failed', `${errorMessage(error).slice(0, 160)} [${failureKind}]`);
|
|
240
|
+
}
|
|
241
|
+
const report = parseIngestionReport(stdoutFromExecError(error));
|
|
242
|
+
if (report !== undefined)
|
|
243
|
+
return { status: 'ok', snapshot: report };
|
|
244
|
+
return degradedCollection('health_collection_failed', errorMessage(error).slice(0, 160));
|
|
245
|
+
}
|
|
246
|
+
const snapshot = parseIngestionReport(stdout);
|
|
247
|
+
if (snapshot === undefined) {
|
|
248
|
+
// degradedCollection already prefixes MANUAL_RUN_ACTION — pass an empty
|
|
249
|
+
// detail, otherwise the same sentence is emitted twice (PR #2563 review).
|
|
250
|
+
return degradedCollection('health_report_unparseable', '');
|
|
251
|
+
}
|
|
252
|
+
return { status: 'ok', snapshot };
|
|
253
|
+
}
|
|
254
|
+
}
|
|
@@ -19,10 +19,10 @@
|
|
|
19
19
|
* - EP-09: model is a thin I/O adapter over the pure store contract
|
|
20
20
|
*/
|
|
21
21
|
import * as fs from 'node:fs';
|
|
22
|
-
import * as path from 'node:path';
|
|
23
22
|
import { SqliteConnection, SqliteIntentDecisionStore, } from '@principles/core/runtime';
|
|
23
|
+
import { resolveStateDbPath } from '@principles/core/runtime/storage-paths';
|
|
24
24
|
function stateDbExists(workspaceDir) {
|
|
25
|
-
return fs.existsSync(
|
|
25
|
+
return fs.existsSync(resolveStateDbPath(workspaceDir));
|
|
26
26
|
}
|
|
27
27
|
function isMissingTableError(err) {
|
|
28
28
|
if (!(err instanceof Error))
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import * as fs from 'node:fs';
|
|
2
2
|
import * as path from 'node:path';
|
|
3
3
|
import { INTENT_MAX_BYTES, getIntentFilename, createIntentTemplate, parseIntentDocSections, computeIntentContentHash, validateIntentDocSections, SqliteConnection, SqliteIntentDocVersionStore, } from '@principles/core/runtime';
|
|
4
|
+
import { resolveStateDbPath } from '@principles/core/runtime/storage-paths';
|
|
4
5
|
import { errorMessage } from '../utils/response.js';
|
|
5
6
|
const INTENT_DIR = '.principles';
|
|
6
7
|
function stateDbExists(workspaceDir) {
|
|
7
|
-
return fs.existsSync(
|
|
8
|
+
return fs.existsSync(resolveStateDbPath(workspaceDir));
|
|
8
9
|
}
|
|
9
10
|
/**
|
|
10
11
|
* Size-check and read an intent document through ONE open handle.
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
* 本模型只负责 workspace I/O 与条目包装(标题/摘要等展示字段)。
|
|
11
11
|
*/
|
|
12
12
|
import * as fs from 'node:fs';
|
|
13
|
-
import * as path from 'node:path';
|
|
14
13
|
import { SqliteConnection, SqlitePIArtifactStore, SqliteApprovalQueueStore, collectOwnerDecisionFacts, deriveOwnerDecisionCapability, buildOwnerDecisionReview, } from '@principles/core/runtime';
|
|
14
|
+
import { resolveStateDbPath } from '@principles/core/runtime/storage-paths';
|
|
15
15
|
import { ActivationsConsoleModel } from './ActivationsConsoleModel.js';
|
|
16
16
|
import { createArtifactPrincipleResolutionDeps, resolveArtifactPrincipleId, } from './artifact-principle-resolver.js';
|
|
17
17
|
/** 每条 issue 保留的样本上限,防止异常放大响应体。 */
|
|
@@ -195,7 +195,7 @@ export class OwnerDecisionConsoleModel {
|
|
|
195
195
|
* N = items.length — 不是 candidate 数、不是 NHR 总数、不是 failed 数。
|
|
196
196
|
*/
|
|
197
197
|
async listOwnerDecisionItems(routeContext) {
|
|
198
|
-
const stateDbPath =
|
|
198
|
+
const stateDbPath = resolveStateDbPath(this.workspaceDir);
|
|
199
199
|
if (!fs.existsSync(stateDbPath)) {
|
|
200
200
|
return { items: [], total: 0, generatedAt: new Date().toISOString(), readIssues: [] };
|
|
201
201
|
}
|
|
@@ -345,7 +345,7 @@ export class OwnerDecisionConsoleModel {
|
|
|
345
345
|
* (decision-capable → 前往治理焦点;technical → Recover)。
|
|
346
346
|
*/
|
|
347
347
|
async ownerDecisionRequiredTaskIds() {
|
|
348
|
-
const stateDbPath =
|
|
348
|
+
const stateDbPath = resolveStateDbPath(this.workspaceDir);
|
|
349
349
|
if (!fs.existsSync(stateDbPath))
|
|
350
350
|
return new Set();
|
|
351
351
|
const conn = new SqliteConnection({ workspaceDir: this.workspaceDir, readonly: true });
|
|
@@ -18,11 +18,11 @@
|
|
|
18
18
|
/* eslint-disable @typescript-eslint/no-use-before-define -- helpers declared after the class, matching codebase convention */
|
|
19
19
|
/* eslint-disable @typescript-eslint/class-methods-use-this -- lifecycle-style methods; kept on the model for cohesion */
|
|
20
20
|
import * as fs from 'node:fs';
|
|
21
|
-
import * as path from 'node:path';
|
|
22
21
|
import { RUNTIME_CONTRACT_SCHEMA_VERSION } from '@principles/core/runtime';
|
|
23
22
|
import { GovernanceProjectionCollector, isRecord, readOwnString, } from './GovernanceProjectionCollector.js';
|
|
24
23
|
import { deriveOwnerDecisionView, } from '@principles/core/runtime';
|
|
25
24
|
import { SqliteConnection } from '@principles/core/runtime';
|
|
25
|
+
import { resolveStateDbPath } from '@principles/core/runtime/storage-paths';
|
|
26
26
|
const ISO_NOW = () => new Date().toISOString();
|
|
27
27
|
export class OwnerDecisionViewModel {
|
|
28
28
|
workspaceDir;
|
|
@@ -492,7 +492,7 @@ export class OwnerDecisionViewModel {
|
|
|
492
492
|
}
|
|
493
493
|
// ── batch snapshot (shared reads; one DB open per request) ────────────────
|
|
494
494
|
readBatchSnapshot() {
|
|
495
|
-
const dbPath =
|
|
495
|
+
const dbPath = resolveStateDbPath(this.workspaceDir);
|
|
496
496
|
const dbAvailable = fs.existsSync(dbPath);
|
|
497
497
|
const candidates = new Map();
|
|
498
498
|
const genericArtifacts = new Map();
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
* - ERR-014/016/017: Previews bounded, no raw JSON.stringify on unknown values
|
|
18
18
|
*/
|
|
19
19
|
import { SqliteConnection } from '@principles/core/runtime';
|
|
20
|
+
import { resolveStateDbPath } from '@principles/core/runtime/storage-paths';
|
|
20
21
|
import * as fs from 'node:fs';
|
|
21
22
|
import * as path from 'node:path';
|
|
22
23
|
import { errorMessage } from '../utils/response.js';
|
|
@@ -127,7 +128,7 @@ export class PrincipleTrajectoryModel {
|
|
|
127
128
|
};
|
|
128
129
|
}
|
|
129
130
|
// 2. Open state.db
|
|
130
|
-
const stateDbPath =
|
|
131
|
+
const stateDbPath = resolveStateDbPath(this.workspaceDir);
|
|
131
132
|
let stateDbAvailable = false;
|
|
132
133
|
let db = null;
|
|
133
134
|
let conn = null;
|
|
@@ -19,9 +19,9 @@
|
|
|
19
19
|
* rc-1: SQL rows are typed unknown and narrowed with typeof per column.
|
|
20
20
|
*/
|
|
21
21
|
import * as fs from 'node:fs';
|
|
22
|
-
import * as path from 'node:path';
|
|
23
22
|
import { SqliteConnection, RECEIPT_RETENTION_POLICY_DAYS } from '@principles/core/runtime';
|
|
24
23
|
import { SqliteInterventionEvidenceStore } from '@principles/core/runtime';
|
|
24
|
+
import { resolveStateDbPath } from '@principles/core/runtime/storage-paths';
|
|
25
25
|
import { computeFlagsFromLoadResult, loadPdConfig } from '../config/pd-config-store.js';
|
|
26
26
|
import { errorMessage } from '../utils/response.js';
|
|
27
27
|
const KINDS = new Set(['rule_blocked', 'auto_correct_applied', 'self_reported', 'prompt_injected']);
|
|
@@ -381,7 +381,7 @@ export class ReceiptsConsoleModel {
|
|
|
381
381
|
* observable behavior is unchanged).
|
|
382
382
|
*/
|
|
383
383
|
precheck() {
|
|
384
|
-
const stateDbPath =
|
|
384
|
+
const stateDbPath = resolveStateDbPath(this.workspaceDir);
|
|
385
385
|
if (!fs.existsSync(stateDbPath)) {
|
|
386
386
|
return {
|
|
387
387
|
status: 'degraded',
|
|
@@ -2,6 +2,7 @@ import path from 'node:path';
|
|
|
2
2
|
import { existsSync } from 'node:fs';
|
|
3
3
|
import Database from 'better-sqlite3';
|
|
4
4
|
import { createRuntimeStateHandle, PrincipleTreeLedgerAdapter, reviseRuleBindingOnce, resolveRuleBindingRevisionTarget, reviseRuleSourceOnce, previewRuleSourceCorrection, hydratePITaskRecord, candidateIdFromDreamerSeed, } from '@principles/core/runtime';
|
|
5
|
+
import { resolveStateDbPath, resolveTrajectoryDbPath } from '@principles/core/runtime/storage-paths';
|
|
5
6
|
import { readLedgerFileState } from '@principles/core/principle-tree-ledger';
|
|
6
7
|
import { ActivationsConsoleModel } from './ActivationsConsoleModel.js';
|
|
7
8
|
function record(value) {
|
|
@@ -144,7 +145,7 @@ export class RuleCandidateBindingConsoleModel {
|
|
|
144
145
|
const distinct = [...new Set(painIds.filter(id => id !== ''))];
|
|
145
146
|
if (distinct.length === 0)
|
|
146
147
|
return { sources: result, degraded: null };
|
|
147
|
-
const dbPath =
|
|
148
|
+
const dbPath = resolveTrajectoryDbPath(this.workspaceDir);
|
|
148
149
|
if (!existsSync(dbPath))
|
|
149
150
|
return { sources: result, degraded: null };
|
|
150
151
|
let db = null;
|
|
@@ -225,7 +226,7 @@ export class RuleCandidateBindingConsoleModel {
|
|
|
225
226
|
async list() {
|
|
226
227
|
// A fresh workspace with no state.db simply has no binding queue yet;
|
|
227
228
|
// any other storage problem still surfaces as an error (503 at the route).
|
|
228
|
-
if (!existsSync(
|
|
229
|
+
if (!existsSync(resolveStateDbPath(this.workspaceDir))) {
|
|
229
230
|
return { items: [], summary: { painGroups: 0, candidates: 0, bound: 0, unlinked: 0, blocked: 0 }, truncated: false };
|
|
230
231
|
}
|
|
231
232
|
const handle = await createRuntimeStateHandle({ workspaceDir: this.workspaceDir, readonly: true, bootstrapIfMissing: false });
|