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
|
@@ -22,8 +22,12 @@
|
|
|
22
22
|
* - generation_id → context.turnId (present on all observed events, stable
|
|
23
23
|
* within one turn); call_id (= tool_use_id) → context.toolCallId; both
|
|
24
24
|
* OPTIONAL per the frozen contract — undefined stays undefined;
|
|
25
|
-
* - transcript_path is validated for TYPE only and never opened
|
|
26
|
-
*
|
|
25
|
+
* - transcript_path is validated for TYPE only and never opened HERE; reading
|
|
26
|
+
* it is the `ingestion/` TranscriptSourceAdapter's job, reached ONLY through
|
|
27
|
+
* the shared pipeline's flag + consent gates (PRI-1171 P2 ticket ④ supplies
|
|
28
|
+
* the decoder, ticket ⑤ wires the hooks/worker, ticket ⑥ adds flag + consent).
|
|
29
|
+
* This codec must not open the transcript itself — the privacy boundary is
|
|
30
|
+
* the gated ingestion entry, not this type validation;
|
|
27
31
|
* - permission_mode is type-validated and retained WITHOUT granting any extra
|
|
28
32
|
* authority — bypassPermissions never bypasses the governance gate;
|
|
29
33
|
* - PostToolUseFailure (thrown tool errors) maps onto the SAME after_tool_call
|
|
@@ -45,12 +49,15 @@ export const WORKBUDDY_EVENT_POST_TOOL_USE = 'PostToolUse';
|
|
|
45
49
|
export const WORKBUDDY_EVENT_POST_TOOL_USE_FAILURE = 'PostToolUseFailure';
|
|
46
50
|
export const WORKBUDDY_EVENT_USER_PROMPT_SUBMIT = 'UserPromptSubmit';
|
|
47
51
|
export const WORKBUDDY_EVENT_SESSION_START = 'SessionStart';
|
|
52
|
+
/** PRI-1171 P2 ticket ⑤: turn-complete trigger for conversation ingestion. */
|
|
53
|
+
export const WORKBUDDY_EVENT_STOP = 'Stop';
|
|
48
54
|
const EVENT_KINDS = new Map([
|
|
49
55
|
[WORKBUDDY_EVENT_PRE_TOOL_USE, 'before_tool_call'],
|
|
50
56
|
[WORKBUDDY_EVENT_POST_TOOL_USE, 'after_tool_call'],
|
|
51
57
|
[WORKBUDDY_EVENT_POST_TOOL_USE_FAILURE, 'after_tool_call'],
|
|
52
58
|
[WORKBUDDY_EVENT_USER_PROMPT_SUBMIT, 'before_prompt_build'],
|
|
53
59
|
[WORKBUDDY_EVENT_SESSION_START, 'session_start'],
|
|
60
|
+
[WORKBUDDY_EVENT_STOP, 'turn_complete'],
|
|
54
61
|
]);
|
|
55
62
|
export class WorkBuddyDecoderError extends Error {
|
|
56
63
|
reason;
|
|
@@ -85,6 +92,30 @@ function requiredNullableString(value, key) {
|
|
|
85
92
|
}
|
|
86
93
|
return candidate;
|
|
87
94
|
}
|
|
95
|
+
/**
|
|
96
|
+
* Transcript-path presence for Stop — TWO documented spellings, no capture.
|
|
97
|
+
*
|
|
98
|
+
* The official WorkBuddy hooks reference (§"Stop & SubagentStop Input") shows
|
|
99
|
+
* `transcript_path`; the capability-matrix Table A cited by
|
|
100
|
+
* ingestion/transcript-path.ts names `agent_transcript_path`. Neither Stop
|
|
101
|
+
* payload has been captured from a real host run (NOT_RUN), so requiring
|
|
102
|
+
* either spelling ALONE would fail-closed on the other and drop the whole
|
|
103
|
+
* turn (the ingestion orchestrator already accepts both hints). The union is
|
|
104
|
+
* therefore the only contract this codec can honestly enforce: at least one
|
|
105
|
+
* key must be PRESENT, and every present key must be string|null. Absence of
|
|
106
|
+
* both still fails loud (rc-3).
|
|
107
|
+
*/
|
|
108
|
+
function requireStopTranscriptPath(value) {
|
|
109
|
+
const hasTranscriptPath = Object.hasOwn(value, 'transcript_path');
|
|
110
|
+
const hasAgentTranscriptPath = Object.hasOwn(value, 'agent_transcript_path');
|
|
111
|
+
if (!hasTranscriptPath && !hasAgentTranscriptPath) {
|
|
112
|
+
throw new WorkBuddyDecoderError('missing required field "transcript_path"', 'A WorkBuddy Stop payload must carry transcript_path or agent_transcript_path (both spellings are documented; the union is accepted until a real Stop payload is captured).');
|
|
113
|
+
}
|
|
114
|
+
if (hasTranscriptPath)
|
|
115
|
+
requiredNullableString(value, 'transcript_path');
|
|
116
|
+
if (hasAgentTranscriptPath)
|
|
117
|
+
requiredNullableString(value, 'agent_transcript_path');
|
|
118
|
+
}
|
|
88
119
|
function requiredRecord(value, key) {
|
|
89
120
|
if (!Object.hasOwn(value, key))
|
|
90
121
|
throw new WorkBuddyDecoderError(`missing required field "${key}"`, `Use the exact ${HOST_CONTRACT_BASELINE} ${key} field.`);
|
|
@@ -179,16 +210,27 @@ export function normalizeWorkbuddyToolResponse(toolResponse, eventForDiagnostics
|
|
|
179
210
|
}
|
|
180
211
|
return { result: toolResponse, error: explicitError };
|
|
181
212
|
}
|
|
213
|
+
/**
|
|
214
|
+
* Decode one raw WorkBuddy stdin payload into the host-neutral HostEvent.
|
|
215
|
+
*
|
|
216
|
+
* Validates the event name against the frozen capability matrix, requires the
|
|
217
|
+
* fields that event really carries (Stop: transcript path variants), and
|
|
218
|
+
* throws {@link WorkBuddyDecoderError} with a reason + nextAction on any
|
|
219
|
+
* contract violation. Absent optional identity is never fabricated (rc-6).
|
|
220
|
+
*/
|
|
182
221
|
export function decodeWorkbuddyInput(raw) {
|
|
183
222
|
if (!isRecord(raw))
|
|
184
223
|
throw new WorkBuddyDecoderError('stdin payload is not a JSON object', 'Run this executable only as a WorkBuddy command hook.');
|
|
185
224
|
const eventName = requiredString(raw, 'hook_event_name');
|
|
186
225
|
const kind = EVENT_KINDS.get(eventName);
|
|
187
226
|
if (!kind) {
|
|
188
|
-
throw new WorkBuddyDecoderError(`unknown hook_event_name "${eventName}"`, 'Configure only PreToolUse, PostToolUse, PostToolUseFailure, UserPromptSubmit, or
|
|
227
|
+
throw new WorkBuddyDecoderError(`unknown hook_event_name "${eventName}"`, 'Configure only PreToolUse, PostToolUse, PostToolUseFailure, UserPromptSubmit, SessionStart, or Stop.');
|
|
189
228
|
}
|
|
190
229
|
const sessionId = requiredString(raw, 'session_id');
|
|
191
|
-
|
|
230
|
+
if (eventName === WORKBUDDY_EVENT_STOP)
|
|
231
|
+
requireStopTranscriptPath(raw);
|
|
232
|
+
else
|
|
233
|
+
requiredNullableString(raw, 'transcript_path');
|
|
192
234
|
// ID mapping (frozen contract §ids): generation_id → turnId on every event
|
|
193
235
|
// where the host provides it; call_id (= tool_use_id) → toolCallId. Neither
|
|
194
236
|
// is ever fabricated when missing (rc-6).
|
|
@@ -210,7 +252,22 @@ export function decodeWorkbuddyInput(raw) {
|
|
|
210
252
|
const baseWithContext = modelContext !== undefined ? { ...base, modelContext } : base;
|
|
211
253
|
let context;
|
|
212
254
|
let rawPayload = raw;
|
|
213
|
-
if (kind === '
|
|
255
|
+
if (kind === 'turn_complete') {
|
|
256
|
+
// WorkBuddy Stop carries NO cwd and NO tool tuple (official hooks
|
|
257
|
+
// reference §Stop). The ingestion orchestrator locates the transcript
|
|
258
|
+
// from the payload's transcript_path / agent_transcript_path hints; a
|
|
259
|
+
// fabricated cwd here would silently point at the wrong project.
|
|
260
|
+
// rawPayload stays the ORIGINAL payload so those hints survive.
|
|
261
|
+
const stopActive = own(raw, 'stop_hook_active');
|
|
262
|
+
if (stopActive !== undefined && typeof stopActive !== 'boolean') {
|
|
263
|
+
throw new WorkBuddyDecoderError('invalid field "stop_hook_active"', 'The WorkBuddy Stop hook must supply stop_hook_active as a boolean.');
|
|
264
|
+
}
|
|
265
|
+
validateOptionalStringType(raw, 'permission_mode');
|
|
266
|
+
// agent_transcript_path is type-validated by requireStopTranscriptPath,
|
|
267
|
+
// which (unlike validateOptionalStringType) also accepts an explicit null.
|
|
268
|
+
context = { ...baseWithContext, workspaceDir: '' };
|
|
269
|
+
}
|
|
270
|
+
else if (kind === 'session_start') {
|
|
214
271
|
// SessionStart has NO cwd (probe P00): source/permission_mode/client/version
|
|
215
272
|
// are the frozen required set. workspaceDir stays empty here — the process
|
|
216
273
|
// entry replaces it with the resolved governance workspace before dispatch.
|
|
@@ -14,3 +14,4 @@ export { WORKBUDDY_TOOL_SEMANTICS, WORKBUDDY_TOOL_SEMANTIC_MAPPINGS, } from './t
|
|
|
14
14
|
export { recordWorkbuddyPromptDeliveryEvidence, recordWorkbuddyDenyEvidence, workbuddyCapabilityDeclarations, WORKBUDDY_EVIDENCE_ADAPTER_VERSION, } from './workbuddy-evidence-recorder.js';
|
|
15
15
|
export { processWorkbuddyHookInvocation, annotateContextWarnings, type WorkBuddyPdHookResult, } from './pd-hook.js';
|
|
16
16
|
export { runWorkbuddyWorkspaceWorkerCycle, type WorkbuddyWorkerCycleResult, type WorkbuddyWorkerCycleOptions, type WorkbuddyWorkerCycleStepReport, type WorkbuddyWorkerMode, } from './worker/workspace-worker.js';
|
|
17
|
+
export { encodeWorkbuddyCwd, deriveWorkbuddyTranscriptPath, validateWorkbuddyTranscriptPath, workbuddyProjectsRoot, decodeWorkbuddyTranscriptWindow, createWorkbuddyTranscriptSource, WORKBUDDY_SINGLE_SESSION_ALERT_BYTES, type WorkbuddyTranscriptFileIdentity, type WorkbuddyTranscriptPathValidation, type DecodedWorkbuddyDelta, type DecodeWorkbuddyWindowInput, type WorkbuddyTranscriptSourceContext, ingestWorkbuddyConversation, workbuddyIngestionHints, catchUpWorkbuddyIngestion, locateWorkbuddyTranscriptBySessionIdentity, type WorkbuddyIngestionOptions, type WorkbuddyIngestionOutcome, type WorkbuddyCatchUpOptions, type WorkbuddyCatchUpResult, } from './ingestion/index.js';
|
|
@@ -14,3 +14,4 @@ export { WORKBUDDY_TOOL_SEMANTICS, WORKBUDDY_TOOL_SEMANTIC_MAPPINGS, } from './t
|
|
|
14
14
|
export { recordWorkbuddyPromptDeliveryEvidence, recordWorkbuddyDenyEvidence, workbuddyCapabilityDeclarations, WORKBUDDY_EVIDENCE_ADAPTER_VERSION, } from './workbuddy-evidence-recorder.js';
|
|
15
15
|
export { processWorkbuddyHookInvocation, annotateContextWarnings, } from './pd-hook.js';
|
|
16
16
|
export { runWorkbuddyWorkspaceWorkerCycle, } from './worker/workspace-worker.js';
|
|
17
|
+
export { encodeWorkbuddyCwd, deriveWorkbuddyTranscriptPath, validateWorkbuddyTranscriptPath, workbuddyProjectsRoot, decodeWorkbuddyTranscriptWindow, createWorkbuddyTranscriptSource, WORKBUDDY_SINGLE_SESSION_ALERT_BYTES, ingestWorkbuddyConversation, workbuddyIngestionHints, catchUpWorkbuddyIngestion, locateWorkbuddyTranscriptBySessionIdentity, } from './ingestion/index.js';
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export interface WorkbuddyCatchUpOptions {
|
|
2
|
+
readonly workspaceDir: string;
|
|
3
|
+
/** Resolved BEFORE any I/O: host.workbuddy AND workbuddy_conversation_ingestion. */
|
|
4
|
+
readonly ingestionEnabled: boolean;
|
|
5
|
+
readonly now?: Date;
|
|
6
|
+
readonly home?: string;
|
|
7
|
+
readonly maxRollouts?: number;
|
|
8
|
+
}
|
|
9
|
+
export interface WorkbuddyCatchUpResult {
|
|
10
|
+
readonly status: 'ok' | 'skipped' | 'degraded';
|
|
11
|
+
readonly reason?: string;
|
|
12
|
+
readonly nextAction?: string;
|
|
13
|
+
readonly examined: number;
|
|
14
|
+
readonly ingested: number;
|
|
15
|
+
readonly warnings: readonly string[];
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Find the ONE transcript file whose name equals an already checkpointed
|
|
19
|
+
* session identity inside the projects root. Returns null for a non-contract
|
|
20
|
+
* identity, an unreadable root, or zero/multiple matches — never a guess.
|
|
21
|
+
*
|
|
22
|
+
* Exported since PRI-1171 ticket ⑦: the `pd health` ingestion section stats
|
|
23
|
+
* the SAME located file (size only, never content) for byte-lag — one
|
|
24
|
+
* locator for both the writer (catch-up) and the reader (health), not a
|
|
25
|
+
* second implementation of the same purpose.
|
|
26
|
+
*/
|
|
27
|
+
export declare function locateWorkbuddyTranscriptBySessionIdentity(projectsRoot: string, rolloutIdentity: string): string | null;
|
|
28
|
+
/**
|
|
29
|
+
* Re-enter the gated ingestion pipeline for every durable WorkBuddy
|
|
30
|
+
* checkpoint, at most `maxRollouts` sessions per cycle.
|
|
31
|
+
*
|
|
32
|
+
* Flag-off and unreadable checkpoints return before any transcript scan.
|
|
33
|
+
* Per-session locate/validate/ingest failures become bounded warnings and the
|
|
34
|
+
* cycle reports `degraded`; a revoked consent is an intentional skip.
|
|
35
|
+
*/
|
|
36
|
+
export declare function catchUpWorkbuddyIngestion(options: WorkbuddyCatchUpOptions): WorkbuddyCatchUpResult;
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WorkBuddy transcript catch-up (PRI-1171 P2, ticket ⑤).
|
|
3
|
+
*
|
|
4
|
+
* The Stop hook is the primary ingestion trigger, but a hook can time out or
|
|
5
|
+
* a single 1 MiB bounded window can leave lag behind. The worker calls this
|
|
6
|
+
* once per cycle: it walks the DURABLE workbuddy checkpoints (the exact set of
|
|
7
|
+
* sessions the authenticated hook already delivered), locates each transcript
|
|
8
|
+
* by its exact session id, and re-enters the SAME gated pipeline through
|
|
9
|
+
* `ingestWorkbuddyConversation` (so consent is re-read and revocation takes
|
|
10
|
+
* effect immediately).
|
|
11
|
+
*
|
|
12
|
+
* "No session discovery" means it never INVENTS an identity: it does not pick
|
|
13
|
+
* a "latest" or "most interesting" session. It does enumerate the projects
|
|
14
|
+
* directory (`readdirSync`) to find the one file whose name equals an already
|
|
15
|
+
* checkpointed session id, because the host stores each project in a separate
|
|
16
|
+
* directory and the checkpoint does not record which one.
|
|
17
|
+
*
|
|
18
|
+
* Locating is deterministic, not a "latest file" guess: only
|
|
19
|
+
* `<projectsRoot>/<any-project>/<sessionId>.jsonl` with EXACTLY one match is
|
|
20
|
+
* accepted, and `validateWorkbuddyTranscriptPath` re-applies containment,
|
|
21
|
+
* main-session shape and regular-file checks before any read. No schema
|
|
22
|
+
* change, no second source of truth — checkpoints stay the authority.
|
|
23
|
+
*/
|
|
24
|
+
import fs from 'node:fs';
|
|
25
|
+
import os from 'node:os';
|
|
26
|
+
import path from 'node:path';
|
|
27
|
+
import { deferGovernanceCheckpoint, listGovernanceCheckpoints, readConversationIngestionConsent } from '@principles/host-runtime';
|
|
28
|
+
import { ingestWorkbuddyConversation } from './ingestion.js';
|
|
29
|
+
import { validateWorkbuddyTranscriptPath, workbuddyProjectsRoot } from './transcript-path.js';
|
|
30
|
+
const DEFAULT_MAX_ROLLOUTS = 8;
|
|
31
|
+
/** Mirrors the locator's main-session file-name contract; refuse odd identities. */
|
|
32
|
+
const SESSION_ID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
|
|
33
|
+
/**
|
|
34
|
+
* Find the ONE transcript file whose name equals an already checkpointed
|
|
35
|
+
* session identity inside the projects root. Returns null for a non-contract
|
|
36
|
+
* identity, an unreadable root, or zero/multiple matches — never a guess.
|
|
37
|
+
*
|
|
38
|
+
* Exported since PRI-1171 ticket ⑦: the `pd health` ingestion section stats
|
|
39
|
+
* the SAME located file (size only, never content) for byte-lag — one
|
|
40
|
+
* locator for both the writer (catch-up) and the reader (health), not a
|
|
41
|
+
* second implementation of the same purpose.
|
|
42
|
+
*/
|
|
43
|
+
export function locateWorkbuddyTranscriptBySessionIdentity(projectsRoot, rolloutIdentity) {
|
|
44
|
+
if (!SESSION_ID_PATTERN.test(rolloutIdentity))
|
|
45
|
+
return null;
|
|
46
|
+
let entries;
|
|
47
|
+
try {
|
|
48
|
+
entries = fs.readdirSync(projectsRoot, { withFileTypes: true });
|
|
49
|
+
}
|
|
50
|
+
catch {
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
const fileName = `${rolloutIdentity}.jsonl`;
|
|
54
|
+
const matches = [];
|
|
55
|
+
for (const entry of entries) {
|
|
56
|
+
if (!entry.isDirectory())
|
|
57
|
+
continue;
|
|
58
|
+
const candidate = path.join(projectsRoot, entry.name, fileName);
|
|
59
|
+
try {
|
|
60
|
+
if (fs.statSync(candidate).isFile())
|
|
61
|
+
matches.push(candidate);
|
|
62
|
+
}
|
|
63
|
+
catch {
|
|
64
|
+
// This project does not carry that session — keep looking, never guess.
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return matches.length === 1 ? (matches[0] ?? null) : null;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Re-enter the gated ingestion pipeline for every durable WorkBuddy
|
|
71
|
+
* checkpoint, at most `maxRollouts` sessions per cycle.
|
|
72
|
+
*
|
|
73
|
+
* Flag-off and unreadable checkpoints return before any transcript scan.
|
|
74
|
+
* Per-session locate/validate/ingest failures become bounded warnings and the
|
|
75
|
+
* cycle reports `degraded`; a revoked consent is an intentional skip.
|
|
76
|
+
*/
|
|
77
|
+
export function catchUpWorkbuddyIngestion(options) {
|
|
78
|
+
// Flag gate FIRST — before checkpoint listing or any filesystem scan.
|
|
79
|
+
if (!options.ingestionEnabled) {
|
|
80
|
+
return {
|
|
81
|
+
status: 'skipped',
|
|
82
|
+
reason: 'feature_disabled',
|
|
83
|
+
nextAction: 'Enable workbuddy_conversation_ingestion (and host.workbuddy) plus a granted consent record to start transcript catch-up.',
|
|
84
|
+
examined: 0, ingested: 0, warnings: [],
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
// Consent gate BEFORE any transcript I/O (P2 review): a revoked or absent
|
|
88
|
+
// consent must not locate transcripts, stat them, or defer checkpoints. The
|
|
89
|
+
// flag alone is not authority to touch the host's files.
|
|
90
|
+
const consent = readConversationIngestionConsent(options.workspaceDir, 'workbuddy');
|
|
91
|
+
if (!consent.ok) {
|
|
92
|
+
return {
|
|
93
|
+
status: 'degraded', reason: `consent_unreadable:${consent.reason}`, nextAction: consent.nextAction,
|
|
94
|
+
examined: 0, ingested: 0, warnings: [],
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
const consentDecision = consent.record?.decision ?? 'not_present';
|
|
98
|
+
if (consentDecision !== 'granted') {
|
|
99
|
+
return {
|
|
100
|
+
status: 'skipped', reason: `consent_not_granted:${consentDecision}`,
|
|
101
|
+
nextAction: 'Record consent with `pd workbuddy setup --accept` to start transcript catch-up. Nothing was read.',
|
|
102
|
+
examined: 0, ingested: 0, warnings: [],
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
const listed = listGovernanceCheckpoints({ workspaceDir: options.workspaceDir, hostKind: 'workbuddy' });
|
|
106
|
+
if (!listed.ok) {
|
|
107
|
+
return {
|
|
108
|
+
status: 'degraded', reason: listed.reason, nextAction: listed.nextAction,
|
|
109
|
+
examined: 0, ingested: 0, warnings: [],
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
const projectsRoot = workbuddyProjectsRoot(options.home ?? os.homedir());
|
|
113
|
+
const limit = Math.max(1, Math.min(options.maxRollouts ?? DEFAULT_MAX_ROLLOUTS, 32));
|
|
114
|
+
const checkpoints = listed.checkpoints.slice(0, limit);
|
|
115
|
+
let ingested = 0;
|
|
116
|
+
const warnings = [];
|
|
117
|
+
const nowIso = (options.now ?? new Date()).toISOString();
|
|
118
|
+
// A failed session must not hold the oldest-first prefix forever (P2 review):
|
|
119
|
+
// bump ONLY its retry position so the next cycle can reach the rollouts
|
|
120
|
+
// behind it. Byte offset/ordinal stay untouched, so the work is still
|
|
121
|
+
// pending and retryable.
|
|
122
|
+
const defer = (rolloutIdentity, reason) => {
|
|
123
|
+
// A failed defer leaves the checkpoint at the head of the queue; report it
|
|
124
|
+
// instead of silently promising a retry-slot rotation (P2 review).
|
|
125
|
+
const deferred = deferGovernanceCheckpoint({ workspaceDir: options.workspaceDir, hostKind: 'workbuddy', rolloutIdentity, reason, now: nowIso });
|
|
126
|
+
if (!deferred.ok)
|
|
127
|
+
warnings.push(`checkpoint_defer_failed:${rolloutIdentity}:${deferred.reason}`);
|
|
128
|
+
};
|
|
129
|
+
for (const checkpoint of checkpoints) {
|
|
130
|
+
const located = locateWorkbuddyTranscriptBySessionIdentity(projectsRoot, checkpoint.rolloutIdentity);
|
|
131
|
+
if (located === null) {
|
|
132
|
+
warnings.push(`transcript_unavailable:${checkpoint.rolloutIdentity}`);
|
|
133
|
+
defer(checkpoint.rolloutIdentity, 'transcript_unavailable');
|
|
134
|
+
continue;
|
|
135
|
+
}
|
|
136
|
+
const validated = validateWorkbuddyTranscriptPath(located, projectsRoot);
|
|
137
|
+
if (!validated.ok) {
|
|
138
|
+
warnings.push(`${validated.reason}:${checkpoint.rolloutIdentity}`);
|
|
139
|
+
defer(checkpoint.rolloutIdentity, validated.reason);
|
|
140
|
+
continue;
|
|
141
|
+
}
|
|
142
|
+
const outcome = ingestWorkbuddyConversation({
|
|
143
|
+
workspaceDir: options.workspaceDir,
|
|
144
|
+
rawPayload: { transcript_path: validated.canonicalPath },
|
|
145
|
+
sessionId: checkpoint.rolloutIdentity,
|
|
146
|
+
ingestionEnabled: true,
|
|
147
|
+
...(options.now !== undefined ? { now: options.now } : {}),
|
|
148
|
+
...(options.home !== undefined ? { home: options.home } : {}),
|
|
149
|
+
});
|
|
150
|
+
if (outcome.status === 'ingested')
|
|
151
|
+
ingested += outcome.inserted;
|
|
152
|
+
else if (outcome.status === 'degraded') {
|
|
153
|
+
warnings.push(`${outcome.reason}:${checkpoint.rolloutIdentity}`);
|
|
154
|
+
defer(checkpoint.rolloutIdentity, outcome.reason);
|
|
155
|
+
}
|
|
156
|
+
// 'skipped' = consent revoked/absent: intentional, never a warning.
|
|
157
|
+
}
|
|
158
|
+
if (warnings.length > 0) {
|
|
159
|
+
return {
|
|
160
|
+
status: 'degraded', reason: 'catch_up_degraded',
|
|
161
|
+
nextAction: 'Inspect the WorkBuddy transcript store and the governance trajectory checkpoints; the worker retries on the next cycle.',
|
|
162
|
+
examined: checkpoints.length, ingested, warnings,
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
return { status: 'ok', examined: checkpoints.length, ingested, warnings };
|
|
166
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Encode a host cwd into the single project-directory segment WorkBuddy uses:
|
|
3
|
+
* lowercase the drive letter, collapse each run of `:`/`\`/`/` into one `-`,
|
|
4
|
+
* and keep every other character byte-for-byte (fixtures in encode-cwd.test.ts).
|
|
5
|
+
*/
|
|
6
|
+
export declare function encodeWorkbuddyCwd(cwd: string): string;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WorkBuddy project-directory cwd encoding (PRI-1171 P2; SPEC v0.2 §4.4,
|
|
3
|
+
* tech design §5.1).
|
|
4
|
+
*
|
|
5
|
+
* WorkBuddy stores every session transcript under
|
|
6
|
+
* `<home>/.workbuddy/projects/<encoded-cwd>/<sessionId>.jsonl`. The encoding
|
|
7
|
+
* rule is locked to FORENSIC SAMPLES from this machine's real directory
|
|
8
|
+
* names × the `cwd` fields inside their records (docs/plans/
|
|
9
|
+
* 2026-08-28-workbuddy-session-transcript-access.md §2, re-verified
|
|
10
|
+
* 2026-11-11), not to a prose transcription:
|
|
11
|
+
*
|
|
12
|
+
* `d:\Code\principles` → `d-Code-principles`
|
|
13
|
+
* `d:\Code\principles-private\aze` → `d-Code-principles-private-aze`
|
|
14
|
+
* `c:\Users\Administrator\Desktop\车险` → `c-Users-Administrator-Desktop-车险`
|
|
15
|
+
* `c:\Users\Administrator\WorkBuddy\2026-09-01…` → `c-Users-Administrator-WorkBuddy-2026-09-01…`
|
|
16
|
+
*
|
|
17
|
+
* Verified properties: the drive letter lowercases; every RUN of `:`, `\`
|
|
18
|
+
* and `/` collapses to a SINGLE `-` (the `d:\` prefix therefore yields one
|
|
19
|
+
* dash, never two); everything else — dashes, dots, underscores, CJK — is
|
|
20
|
+
* preserved byte-for-byte. No collision-suffix or escaping mechanism was
|
|
21
|
+
* observed on disk. The engine-side rule itself is not documented by the
|
|
22
|
+
* host; the fixtures table in tests/ingestion/encode-cwd.test.ts freezes
|
|
23
|
+
* these pairs against regression.
|
|
24
|
+
*/
|
|
25
|
+
const SEPARATOR_RUN = /[\\/:]+/g;
|
|
26
|
+
/**
|
|
27
|
+
* Encode a host cwd into the single project-directory segment WorkBuddy uses:
|
|
28
|
+
* lowercase the drive letter, collapse each run of `:`/`\`/`/` into one `-`,
|
|
29
|
+
* and keep every other character byte-for-byte (fixtures in encode-cwd.test.ts).
|
|
30
|
+
*/
|
|
31
|
+
export function encodeWorkbuddyCwd(cwd) {
|
|
32
|
+
if (cwd.length === 0)
|
|
33
|
+
return '';
|
|
34
|
+
// Drive-letter prefix: lowercase it before separator collapsing so `D:\x`
|
|
35
|
+
// and `d:\x` encode identically (records carry the lowercase form, hook
|
|
36
|
+
// payloads may carry either).
|
|
37
|
+
const drivePrefixed = /^[A-Za-z]:/.test(cwd) ? cwd.charAt(0).toLowerCase() + cwd.slice(1) : cwd;
|
|
38
|
+
return drivePrefixed.replace(SEPARATOR_RUN, '-');
|
|
39
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WorkBuddy conversation-ingestion surface (PRI-1171 P2).
|
|
3
|
+
*
|
|
4
|
+
* The per-host thin half of the unified seam: cwd encoding, deterministic
|
|
5
|
+
* transcript location/validation, the flat-record decoder, and the
|
|
6
|
+
* TranscriptSourceAdapter the shared host-runtime pipeline drives.
|
|
7
|
+
*/
|
|
8
|
+
export { encodeWorkbuddyCwd } from './encode-cwd.js';
|
|
9
|
+
export { deriveWorkbuddyTranscriptPath, validateWorkbuddyTranscriptPath, workbuddyProjectsRoot, type WorkbuddyTranscriptFileIdentity, type WorkbuddyTranscriptPathValidation, } from './transcript-path.js';
|
|
10
|
+
export { decodeWorkbuddyTranscriptWindow, type DecodedWorkbuddyDelta, type DecodeWorkbuddyWindowInput, } from './transcript-decoder.js';
|
|
11
|
+
export { createWorkbuddyTranscriptSource, WORKBUDDY_SINGLE_SESSION_ALERT_BYTES, type WorkbuddyTranscriptSourceContext, } from './transcript-source.js';
|
|
12
|
+
export { ingestWorkbuddyConversation, workbuddyIngestionHints, type WorkbuddyIngestionOptions, type WorkbuddyIngestionOutcome, } from './ingestion.js';
|
|
13
|
+
export { catchUpWorkbuddyIngestion, locateWorkbuddyTranscriptBySessionIdentity, type WorkbuddyCatchUpOptions, type WorkbuddyCatchUpResult, } from './catch-up.js';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WorkBuddy conversation-ingestion surface (PRI-1171 P2).
|
|
3
|
+
*
|
|
4
|
+
* The per-host thin half of the unified seam: cwd encoding, deterministic
|
|
5
|
+
* transcript location/validation, the flat-record decoder, and the
|
|
6
|
+
* TranscriptSourceAdapter the shared host-runtime pipeline drives.
|
|
7
|
+
*/
|
|
8
|
+
export { encodeWorkbuddyCwd } from './encode-cwd.js';
|
|
9
|
+
export { deriveWorkbuddyTranscriptPath, validateWorkbuddyTranscriptPath, workbuddyProjectsRoot, } from './transcript-path.js';
|
|
10
|
+
export { decodeWorkbuddyTranscriptWindow, } from './transcript-decoder.js';
|
|
11
|
+
export { createWorkbuddyTranscriptSource, WORKBUDDY_SINGLE_SESSION_ALERT_BYTES, } from './transcript-source.js';
|
|
12
|
+
export { ingestWorkbuddyConversation, workbuddyIngestionHints, } from './ingestion.js';
|
|
13
|
+
export { catchUpWorkbuddyIngestion, locateWorkbuddyTranscriptBySessionIdentity, } from './catch-up.js';
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { type HookHints, type TranscriptPort } from '@principles/host-runtime';
|
|
2
|
+
export interface WorkbuddyIngestionOptions {
|
|
3
|
+
/** Governance workspace (OD-07) — the v3 ledger and trajectory.db live here. */
|
|
4
|
+
readonly workspaceDir: string;
|
|
5
|
+
/** Original, undecoded hook payload: the hint source. */
|
|
6
|
+
readonly rawPayload: unknown;
|
|
7
|
+
readonly sessionId: string;
|
|
8
|
+
/** Host cwd when the payload carries one; Stop does not. */
|
|
9
|
+
readonly cwd?: string;
|
|
10
|
+
/** Resolved BEFORE any I/O by the caller (both flags). */
|
|
11
|
+
readonly ingestionEnabled: boolean;
|
|
12
|
+
readonly now?: Date;
|
|
13
|
+
readonly port?: TranscriptPort;
|
|
14
|
+
readonly home?: string;
|
|
15
|
+
}
|
|
16
|
+
export type WorkbuddyIngestionOutcome = {
|
|
17
|
+
status: 'ingested';
|
|
18
|
+
inserted: number;
|
|
19
|
+
warnings: readonly string[];
|
|
20
|
+
} | {
|
|
21
|
+
status: 'skipped';
|
|
22
|
+
reason: string;
|
|
23
|
+
nextAction: string;
|
|
24
|
+
} | {
|
|
25
|
+
status: 'degraded';
|
|
26
|
+
reason: string;
|
|
27
|
+
nextAction: string;
|
|
28
|
+
warnings: readonly string[];
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Bridge the WorkBuddy snake_case hook payload to the host-neutral
|
|
32
|
+
* `HookHints` contract. Both Stop variants are mapped because the capability
|
|
33
|
+
* matrix names `agent_transcript_path` while the official hooks reference
|
|
34
|
+
* names `transcript_path`; the source adapter already prefers whichever is
|
|
35
|
+
* non-empty. Null / empty hints are dropped (InstructionsLoaded carries "").
|
|
36
|
+
*/
|
|
37
|
+
export declare function workbuddyIngestionHints(rawPayload: unknown): HookHints;
|
|
38
|
+
/**
|
|
39
|
+
* Run the gated WorkBuddy ingestion pipeline for one hook invocation.
|
|
40
|
+
*
|
|
41
|
+
* Order is the privacy invariant: resolved flag → real consent ledger →
|
|
42
|
+
* transcript read. A flag-off or non-granted state returns before the port is
|
|
43
|
+
* ever touched, and a Stop re-entry is skipped to avoid a recursive read loop.
|
|
44
|
+
* Unexpected failures degrade with a bounded reason instead of throwing.
|
|
45
|
+
*/
|
|
46
|
+
export declare function ingestWorkbuddyConversation(options: WorkbuddyIngestionOptions): WorkbuddyIngestionOutcome;
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WorkBuddy conversation-ingestion orchestrator (PRI-1171 P2, ticket ⑤).
|
|
3
|
+
*
|
|
4
|
+
* Connects the EXISTING pieces — the unified host-runtime pipeline, the
|
|
5
|
+
* WorkBuddy TranscriptSourceAdapter from ticket ④, the v3 consent ledger and
|
|
6
|
+
* the workspace feature flags — without introducing a new subsystem. The hook
|
|
7
|
+
* calls `ingestWorkbuddyConversation` on `turn_complete`; the worker calls the
|
|
8
|
+
* catch-up sibling. Both go through this same gate ordering.
|
|
9
|
+
*
|
|
10
|
+
* Gate order is a hard privacy invariant (SPEC §8.2 / §10):
|
|
11
|
+
* 1. resolved flags (host.workbuddy AND workbuddy_conversation_ingestion);
|
|
12
|
+
* 2. the REAL v3 consent record for hostKind='workbuddy';
|
|
13
|
+
* 3. only then any transcript filesystem read (pipeline's port).
|
|
14
|
+
* Steps 1 and 2 perform ZERO transcript port calls. Unlike the Codex path
|
|
15
|
+
* (which still hard-codes `consent: 'granted'` from its setup-flow invariant),
|
|
16
|
+
* this host reads the ledger at runtime, so revoking consent takes effect
|
|
17
|
+
* immediately.
|
|
18
|
+
*/
|
|
19
|
+
import os from 'node:os';
|
|
20
|
+
import { readConversationIngestionConsent, runConversationIngestion, } from '@principles/host-runtime';
|
|
21
|
+
import { createWorkbuddyTranscriptSource } from './transcript-source.js';
|
|
22
|
+
/** Runtime-contract guard (rc-1): a non-null, non-array object is the only trusted payload shape. */
|
|
23
|
+
function isRecord(value) {
|
|
24
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
25
|
+
}
|
|
26
|
+
/** Read an OWN property only (rc-5): inherited names must never look like payload fields. */
|
|
27
|
+
function own(value, key) {
|
|
28
|
+
return Object.hasOwn(value, key) ? Object.getOwnPropertyDescriptor(value, key)?.value : undefined;
|
|
29
|
+
}
|
|
30
|
+
/** Accept a non-blank string only; empty/whitespace values are treated as absent. */
|
|
31
|
+
function nonEmptyString(value) {
|
|
32
|
+
return typeof value === 'string' && value.trim().length > 0 ? value : null;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Bridge the WorkBuddy snake_case hook payload to the host-neutral
|
|
36
|
+
* `HookHints` contract. Both Stop variants are mapped because the capability
|
|
37
|
+
* matrix names `agent_transcript_path` while the official hooks reference
|
|
38
|
+
* names `transcript_path`; the source adapter already prefers whichever is
|
|
39
|
+
* non-empty. Null / empty hints are dropped (InstructionsLoaded carries "").
|
|
40
|
+
*/
|
|
41
|
+
export function workbuddyIngestionHints(rawPayload) {
|
|
42
|
+
if (!isRecord(rawPayload))
|
|
43
|
+
return {};
|
|
44
|
+
const transcriptPath = nonEmptyString(own(rawPayload, 'transcript_path'));
|
|
45
|
+
const agentTranscriptPath = nonEmptyString(own(rawPayload, 'agent_transcript_path'));
|
|
46
|
+
const generationId = nonEmptyString(own(rawPayload, 'generation_id'));
|
|
47
|
+
return {
|
|
48
|
+
...(transcriptPath !== null ? { transcriptPath } : {}),
|
|
49
|
+
...(agentTranscriptPath !== null ? { agentTranscriptPath } : {}),
|
|
50
|
+
...(generationId !== null ? { generationId } : {}),
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Run the gated WorkBuddy ingestion pipeline for one hook invocation.
|
|
55
|
+
*
|
|
56
|
+
* Order is the privacy invariant: resolved flag → real consent ledger →
|
|
57
|
+
* transcript read. A flag-off or non-granted state returns before the port is
|
|
58
|
+
* ever touched, and a Stop re-entry is skipped to avoid a recursive read loop.
|
|
59
|
+
* Unexpected failures degrade with a bounded reason instead of throwing.
|
|
60
|
+
*/
|
|
61
|
+
export function ingestWorkbuddyConversation(options) {
|
|
62
|
+
// 1. Flag gate FIRST — before the consent read and before any port call.
|
|
63
|
+
// A flag-off host behaves exactly as before this capability existed.
|
|
64
|
+
if (!options.ingestionEnabled) {
|
|
65
|
+
return {
|
|
66
|
+
status: 'skipped',
|
|
67
|
+
reason: 'ingestion_disabled',
|
|
68
|
+
nextAction: 'Enable workbuddy_conversation_ingestion (and host.workbuddy) in the governance workspace .pd/config.yaml, then record consent with `pd workbuddy setup --accept`.',
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
// 2. Real v3 consent ledger — never a hard-coded grant.
|
|
72
|
+
const consent = readConversationIngestionConsent(options.workspaceDir, 'workbuddy');
|
|
73
|
+
if (!consent.ok) {
|
|
74
|
+
return {
|
|
75
|
+
status: 'degraded',
|
|
76
|
+
reason: `consent_unreadable:${consent.reason}`,
|
|
77
|
+
nextAction: consent.nextAction,
|
|
78
|
+
warnings: [],
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
const decision = consent.record?.decision ?? 'not_present';
|
|
82
|
+
if (decision !== 'granted') {
|
|
83
|
+
return {
|
|
84
|
+
status: 'skipped',
|
|
85
|
+
reason: `consent_not_granted:${decision}`,
|
|
86
|
+
nextAction: 'Record a granted WorkBuddy ingestion decision with `pd workbuddy setup --accept` before any transcript is read.',
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
// 3. Never ingest from a recursively-triggered Stop hook.
|
|
90
|
+
if (isRecord(options.rawPayload) && own(options.rawPayload, 'stop_hook_active') === true) {
|
|
91
|
+
return {
|
|
92
|
+
status: 'skipped',
|
|
93
|
+
reason: 'stop_hook_recursion',
|
|
94
|
+
nextAction: 'The host re-entered the Stop hook; ingestion is skipped to avoid a recursive read loop.',
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
const now = options.now ?? new Date();
|
|
98
|
+
const session = {
|
|
99
|
+
sessionId: options.sessionId,
|
|
100
|
+
...(options.cwd !== undefined ? { cwd: options.cwd } : {}),
|
|
101
|
+
};
|
|
102
|
+
try {
|
|
103
|
+
const outcome = runConversationIngestion({
|
|
104
|
+
workspaceDir: options.workspaceDir,
|
|
105
|
+
source: createWorkbuddyTranscriptSource({ now }),
|
|
106
|
+
session,
|
|
107
|
+
hints: workbuddyIngestionHints(options.rawPayload),
|
|
108
|
+
env: { home: options.home ?? os.homedir() },
|
|
109
|
+
// The pipeline re-checks both gates; passing the real decision keeps a
|
|
110
|
+
// single source of truth and makes the port-spy invariant observable.
|
|
111
|
+
flags: { ingestionEnabled: true },
|
|
112
|
+
consent: { decision },
|
|
113
|
+
now,
|
|
114
|
+
...(options.port !== undefined ? { port: options.port } : {}),
|
|
115
|
+
});
|
|
116
|
+
if (outcome.status === 'degraded') {
|
|
117
|
+
return {
|
|
118
|
+
status: 'degraded',
|
|
119
|
+
reason: outcome.reason,
|
|
120
|
+
nextAction: outcome.nextAction,
|
|
121
|
+
warnings: outcome.warnings,
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
return { status: 'ingested', inserted: outcome.inserted, warnings: outcome.warnings };
|
|
125
|
+
}
|
|
126
|
+
catch (error) {
|
|
127
|
+
const detail = error instanceof Error ? error.message.slice(0, 200) : String(error).slice(0, 200);
|
|
128
|
+
return {
|
|
129
|
+
status: 'degraded',
|
|
130
|
+
reason: `workbuddy_ingestion_unexpected:${detail}`,
|
|
131
|
+
nextAction: 'Inspect the WorkBuddy transcript and the governance workspace state; the checkpoint was not advanced past failed work.',
|
|
132
|
+
warnings: [],
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
}
|