create-principles-disciple 1.154.5 → 1.155.1
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 +2 -2
- package/codex-adapter/dist/codec/input-decoder.d.ts +17 -0
- package/codex-adapter/dist/codec/input-decoder.js +39 -0
- package/codex-adapter/dist/ingestion/explicit-owner-statement.js +125 -1
- package/codex-adapter/dist/ingestion/pain-receipt-fallback.d.ts +46 -0
- package/codex-adapter/dist/ingestion/pain-receipt-fallback.js +193 -0
- package/codex-adapter/dist/ingestion/turn-context.d.ts +10 -15
- package/codex-adapter/dist/ingestion/turn-context.js +35 -9
- package/codex-adapter/dist/pd-hook.js +57 -1
- package/codex-adapter/dist/worker/workspace-worker.d.ts +15 -0
- package/codex-adapter/dist/worker/workspace-worker.js +91 -12
- package/codex-adapter/package.json +1 -1
- package/console/dist/server/index.js +10 -0
- package/console/dist/server/models/EvidenceChainConsoleModel.js +31 -0
- package/console/dist/server/routes/service-host.d.ts +19 -0
- package/console/dist/server/routes/service-host.js +129 -0
- package/console/dist/web/assets/app.js +37 -37
- package/core/dist/runtime/context-payload.d.ts +48 -0
- package/core/dist/runtime/context-payload.d.ts.map +1 -1
- package/core/dist/runtime/context-payload.js +12 -0
- package/core/dist/runtime/context-payload.js.map +1 -1
- package/core/dist/runtime/diagnostician/rootcause-prompt-builder.d.ts.map +1 -1
- package/core/dist/runtime/diagnostician/rootcause-prompt-builder.js +18 -0
- package/core/dist/runtime/diagnostician/rootcause-prompt-builder.js.map +1 -1
- package/core/dist/runtime/diagnostician-candidate.d.ts.map +1 -1
- package/core/dist/runtime/diagnostician-candidate.js +18 -2
- package/core/dist/runtime/diagnostician-candidate.js.map +1 -1
- package/core/dist/runtime/evidence-guards.d.ts +7 -3
- package/core/dist/runtime/evidence-guards.d.ts.map +1 -1
- package/core/dist/runtime/evidence-guards.js +9 -7
- package/core/dist/runtime/evidence-guards.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 +14 -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 +8 -0
- package/core/dist/runtime/feature-flags/feature-flag-lifecycle.js.map +1 -1
- package/core/dist/runtime/host-submission-context.d.ts +83 -0
- package/core/dist/runtime/host-submission-context.d.ts.map +1 -0
- package/core/dist/runtime/host-submission-context.js +183 -0
- package/core/dist/runtime/host-submission-context.js.map +1 -0
- package/core/dist/runtime/index.d.ts +9 -2
- package/core/dist/runtime/index.d.ts.map +1 -1
- package/core/dist/runtime/index.js +29 -2
- package/core/dist/runtime/index.js.map +1 -1
- package/core/dist/runtime/intent/intent-doc.d.ts.map +1 -1
- package/core/dist/runtime/intent/intent-doc.js +29 -5
- package/core/dist/runtime/intent/intent-doc.js.map +1 -1
- package/core/dist/runtime/internalization/diag-distiller-runner.d.ts +9 -0
- package/core/dist/runtime/internalization/diag-distiller-runner.d.ts.map +1 -1
- package/core/dist/runtime/internalization/diag-distiller-runner.js +13 -0
- package/core/dist/runtime/internalization/diag-distiller-runner.js.map +1 -1
- package/core/dist/runtime/internalization/diag-rootcause-runner.d.ts +11 -0
- package/core/dist/runtime/internalization/diag-rootcause-runner.d.ts.map +1 -1
- package/core/dist/runtime/internalization/diag-rootcause-runner.js +10 -0
- package/core/dist/runtime/internalization/diag-rootcause-runner.js.map +1 -1
- package/core/dist/runtime/internalization/diag-router-runner.d.ts +9 -0
- package/core/dist/runtime/internalization/diag-router-runner.d.ts.map +1 -1
- package/core/dist/runtime/internalization/diag-router-runner.js +13 -0
- package/core/dist/runtime/internalization/diag-router-runner.js.map +1 -1
- package/core/dist/runtime/internalization/index.d.ts +1 -1
- package/core/dist/runtime/internalization/index.d.ts.map +1 -1
- package/core/dist/runtime/internalization/index.js +1 -1
- package/core/dist/runtime/internalization/index.js.map +1 -1
- package/core/dist/runtime/internalization/intake-to-internalization-bridge.d.ts +19 -0
- package/core/dist/runtime/internalization/intake-to-internalization-bridge.d.ts.map +1 -1
- package/core/dist/runtime/internalization/intake-to-internalization-bridge.js +24 -0
- package/core/dist/runtime/internalization/intake-to-internalization-bridge.js.map +1 -1
- package/core/dist/runtime/internalization/internalization-orchestrator.d.ts +8 -0
- package/core/dist/runtime/internalization/internalization-orchestrator.d.ts.map +1 -1
- package/core/dist/runtime/internalization/internalization-orchestrator.js +36 -4
- package/core/dist/runtime/internalization/internalization-orchestrator.js.map +1 -1
- package/core/dist/runtime/internalization/source-authorization-boundary.d.ts +39 -0
- package/core/dist/runtime/internalization/source-authorization-boundary.d.ts.map +1 -0
- package/core/dist/runtime/internalization/source-authorization-boundary.js +57 -0
- package/core/dist/runtime/internalization/source-authorization-boundary.js.map +1 -0
- package/core/dist/runtime/internalization/split-diagnostician-runner.d.ts.map +1 -1
- package/core/dist/runtime/internalization/split-diagnostician-runner.js +72 -5
- package/core/dist/runtime/internalization/split-diagnostician-runner.js.map +1 -1
- package/core/dist/runtime/pain-admission-disposition.d.ts +60 -0
- package/core/dist/runtime/pain-admission-disposition.d.ts.map +1 -0
- package/core/dist/runtime/pain-admission-disposition.js +37 -0
- package/core/dist/runtime/pain-admission-disposition.js.map +1 -0
- package/core/dist/runtime/pain-ingress-payload.d.ts +36 -2
- package/core/dist/runtime/pain-ingress-payload.d.ts.map +1 -1
- package/core/dist/runtime/pain-ingress-payload.js +63 -6
- package/core/dist/runtime/pain-ingress-payload.js.map +1 -1
- package/core/dist/runtime/pain-ingress.d.ts.map +1 -1
- package/core/dist/runtime/pain-ingress.js +28 -0
- package/core/dist/runtime/pain-ingress.js.map +1 -1
- package/core/dist/runtime/pain-recall-read-model.d.ts +13 -1
- package/core/dist/runtime/pain-recall-read-model.d.ts.map +1 -1
- package/core/dist/runtime/pain-recall-read-model.js +50 -7
- package/core/dist/runtime/pain-recall-read-model.js.map +1 -1
- package/core/dist/runtime/pain-receipt-recovery.d.ts +147 -0
- package/core/dist/runtime/pain-receipt-recovery.d.ts.map +1 -0
- package/core/dist/runtime/pain-receipt-recovery.js +475 -0
- package/core/dist/runtime/pain-receipt-recovery.js.map +1 -0
- package/core/dist/runtime/pain-signal-bridge.d.ts +13 -1
- package/core/dist/runtime/pain-signal-bridge.d.ts.map +1 -1
- package/core/dist/runtime/pain-signal-bridge.js +174 -0
- package/core/dist/runtime/pain-signal-bridge.js.map +1 -1
- package/core/dist/runtime/pain-signal-runtime-factory.d.ts +9 -0
- package/core/dist/runtime/pain-signal-runtime-factory.d.ts.map +1 -1
- package/core/dist/runtime/pain-signal-runtime-factory.js +8 -3
- package/core/dist/runtime/pain-signal-runtime-factory.js.map +1 -1
- package/core/dist/runtime/pain-submit-capability.d.ts +11 -0
- package/core/dist/runtime/pain-submit-capability.d.ts.map +1 -1
- package/core/dist/runtime/pain-submit-capability.js +77 -3
- package/core/dist/runtime/pain-submit-capability.js.map +1 -1
- package/core/dist/runtime/pain-target-evidence-reconcile.d.ts +55 -0
- package/core/dist/runtime/pain-target-evidence-reconcile.d.ts.map +1 -0
- package/core/dist/runtime/pain-target-evidence-reconcile.js +164 -0
- package/core/dist/runtime/pain-target-evidence-reconcile.js.map +1 -0
- package/core/dist/runtime/pain-to-principle-service.d.ts +8 -0
- package/core/dist/runtime/pain-to-principle-service.d.ts.map +1 -1
- package/core/dist/runtime/pain-to-principle-service.js +1 -0
- package/core/dist/runtime/pain-to-principle-service.js.map +1 -1
- package/core/dist/runtime/source-material-authorization.d.ts +166 -0
- package/core/dist/runtime/source-material-authorization.d.ts.map +1 -0
- package/core/dist/runtime/source-material-authorization.js +250 -0
- package/core/dist/runtime/source-material-authorization.js.map +1 -0
- package/core/dist/runtime/store/context/index.d.ts +1 -0
- package/core/dist/runtime/store/context/index.d.ts.map +1 -1
- package/core/dist/runtime/store/context/index.js +1 -0
- package/core/dist/runtime/store/context/index.js.map +1 -1
- package/core/dist/runtime/store/context/promoted-evidence-reader.d.ts +8 -0
- package/core/dist/runtime/store/context/promoted-evidence-reader.d.ts.map +1 -1
- package/core/dist/runtime/store/context/promoted-evidence-reader.js +15 -1
- package/core/dist/runtime/store/context/promoted-evidence-reader.js.map +1 -1
- package/core/dist/runtime/store/context/sqlite-context-assembler.d.ts +22 -0
- package/core/dist/runtime/store/context/sqlite-context-assembler.d.ts.map +1 -1
- package/core/dist/runtime/store/context/sqlite-context-assembler.js +153 -3
- package/core/dist/runtime/store/context/sqlite-context-assembler.js.map +1 -1
- package/core/dist/runtime/store/context/trajectory-turn-reader.d.ts +13 -0
- package/core/dist/runtime/store/context/trajectory-turn-reader.d.ts.map +1 -1
- package/core/dist/runtime/store/lifecycle/lease-manager.d.ts +15 -0
- package/core/dist/runtime/store/lifecycle/lease-manager.d.ts.map +1 -1
- package/core/dist/runtime/store/lifecycle/lease-manager.js +16 -1
- package/core/dist/runtime/store/lifecycle/lease-manager.js.map +1 -1
- package/core/dist/runtime/store/runtime-state-manager.d.ts +2 -0
- 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/task/memory-task-store.d.ts +1 -0
- package/core/dist/runtime/store/task/memory-task-store.d.ts.map +1 -1
- package/core/dist/runtime/store/task/memory-task-store.js +37 -0
- package/core/dist/runtime/store/task/memory-task-store.js.map +1 -1
- package/core/dist/runtime/store/task/sqlite-task-store.d.ts +10 -0
- package/core/dist/runtime/store/task/sqlite-task-store.d.ts.map +1 -1
- package/core/dist/runtime/store/task/sqlite-task-store.js +20 -0
- package/core/dist/runtime/store/task/sqlite-task-store.js.map +1 -1
- package/core/dist/runtime/store/task/task-store.d.ts +16 -0
- package/core/dist/runtime/store/task/task-store.d.ts.map +1 -1
- package/core/dist/runtime/task-status.d.ts +13 -0
- package/core/dist/runtime/task-status.d.ts.map +1 -1
- package/core/dist/runtime/task-status.js +9 -0
- package/core/dist/runtime/task-status.js.map +1 -1
- package/core/dist/runtime/types/evidence-chain-contract.d.ts +10 -0
- package/core/dist/runtime/types/evidence-chain-contract.d.ts.map +1 -1
- package/core/dist/runtime/types/evidence-chain-contract.js +7 -0
- package/core/dist/runtime/types/evidence-chain-contract.js.map +1 -1
- package/core/package.json +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -1
- package/dist/installer.d.ts.map +1 -1
- package/dist/installer.js +77 -30
- package/dist/installer.js.map +1 -1
- package/dist/installers/mcp-registration-conflict.d.ts +8 -0
- package/dist/installers/mcp-registration-conflict.d.ts.map +1 -1
- package/dist/installers/mcp-registration-conflict.js +34 -1
- package/dist/installers/mcp-registration-conflict.js.map +1 -1
- package/dist/installers/workbuddy-host-installer.d.ts +45 -13
- package/dist/installers/workbuddy-host-installer.d.ts.map +1 -1
- package/dist/installers/workbuddy-host-installer.js +284 -21
- package/dist/installers/workbuddy-host-installer.js.map +1 -1
- package/dist/prompts.d.ts +11 -0
- package/dist/prompts.d.ts.map +1 -1
- package/dist/prompts.js +4 -0
- package/dist/prompts.js.map +1 -1
- package/dist/service-host-bridge.d.ts +67 -0
- package/dist/service-host-bridge.d.ts.map +1 -0
- package/dist/service-host-bridge.js +292 -0
- package/dist/service-host-bridge.js.map +1 -0
- package/dist/uninstaller.d.ts.map +1 -1
- package/dist/uninstaller.js +26 -0
- package/dist/uninstaller.js.map +1 -1
- package/dist/update/install-layout.d.ts +0 -12
- package/dist/update/install-layout.d.ts.map +1 -1
- package/dist/update/install-layout.js +42 -15
- package/dist/update/install-layout.js.map +1 -1
- package/host-runtime/dist/diagnostician-auto-run.js +4 -1
- package/host-runtime/dist/governance-observation-store.d.ts +7 -0
- package/host-runtime/dist/governance-observation-store.js +15 -4
- package/host-runtime/dist/governance-signal-admission.d.ts +49 -0
- package/host-runtime/dist/governance-signal-admission.js +355 -94
- package/host-runtime/dist/governance-trajectory-turn-reader.d.ts +20 -4
- package/host-runtime/dist/governance-trajectory-turn-reader.js +77 -5
- package/host-runtime/dist/index.d.ts +2 -0
- package/host-runtime/dist/index.js +5 -0
- package/host-runtime/dist/internalization-consumer-cycle.js +4 -1
- package/host-runtime/dist/pd-config.d.ts +10 -0
- package/host-runtime/dist/pd-config.js +37 -0
- package/host-runtime/dist/signal-stage2-cycle.js +28 -1
- package/host-runtime/dist/source-material-authorization.d.ts +53 -0
- package/host-runtime/dist/source-material-authorization.js +67 -0
- package/host-runtime/dist/source-revocation-sweep.d.ts +172 -0
- package/host-runtime/dist/source-revocation-sweep.js +928 -0
- package/host-runtime/package.json +5 -1
- package/install-layout/dist/background-execution-transition.d.ts +258 -0
- package/install-layout/dist/background-execution-transition.js +836 -0
- package/install-layout/dist/index.d.ts +8 -0
- package/install-layout/dist/index.js +8 -0
- package/install-layout/package.json +6 -2
- package/package.json +4 -4
- package/pd-cli/dist/commands/candidate.d.ts.map +1 -1
- package/pd-cli/dist/commands/candidate.js +16 -5
- package/pd-cli/dist/commands/candidate.js.map +1 -1
- package/pd-cli/dist/commands/codex-setup.d.ts.map +1 -1
- package/pd-cli/dist/commands/codex-setup.js +17 -1
- package/pd-cli/dist/commands/codex-setup.js.map +1 -1
- package/pd-cli/dist/commands/codex-worker.d.ts.map +1 -1
- package/pd-cli/dist/commands/codex-worker.js +8 -4
- package/pd-cli/dist/commands/codex-worker.js.map +1 -1
- package/pd-cli/dist/commands/consent-sweep-revoked.d.ts +20 -0
- package/pd-cli/dist/commands/consent-sweep-revoked.d.ts.map +1 -0
- package/pd-cli/dist/commands/consent-sweep-revoked.js +85 -0
- package/pd-cli/dist/commands/consent-sweep-revoked.js.map +1 -0
- package/pd-cli/dist/commands/context.d.ts.map +1 -1
- package/pd-cli/dist/commands/context.js +9 -1
- package/pd-cli/dist/commands/context.js.map +1 -1
- package/pd-cli/dist/commands/diagnose.d.ts.map +1 -1
- package/pd-cli/dist/commands/diagnose.js +12 -6
- package/pd-cli/dist/commands/diagnose.js.map +1 -1
- package/pd-cli/dist/commands/openclaw-worker.d.ts +11 -0
- package/pd-cli/dist/commands/openclaw-worker.d.ts.map +1 -0
- package/pd-cli/dist/commands/openclaw-worker.js +199 -0
- package/pd-cli/dist/commands/openclaw-worker.js.map +1 -0
- package/pd-cli/dist/commands/pain-explicit.d.ts.map +1 -1
- package/pd-cli/dist/commands/pain-explicit.js +1 -0
- package/pd-cli/dist/commands/pain-explicit.js.map +1 -1
- package/pd-cli/dist/commands/pain-recall.d.ts +2 -2
- package/pd-cli/dist/commands/pain-recall.d.ts.map +1 -1
- package/pd-cli/dist/commands/pain-recall.js +7 -1
- package/pd-cli/dist/commands/pain-recall.js.map +1 -1
- package/pd-cli/dist/commands/pain-retry.d.ts.map +1 -1
- package/pd-cli/dist/commands/pain-retry.js +12 -6
- package/pd-cli/dist/commands/pain-retry.js.map +1 -1
- package/pd-cli/dist/commands/runtime-internalization-enqueue-successors.d.ts.map +1 -1
- package/pd-cli/dist/commands/runtime-internalization-enqueue-successors.js +2 -1
- package/pd-cli/dist/commands/runtime-internalization-enqueue-successors.js.map +1 -1
- package/pd-cli/dist/commands/runtime-internalization-run-once.d.ts +1 -0
- package/pd-cli/dist/commands/runtime-internalization-run-once.d.ts.map +1 -1
- package/pd-cli/dist/commands/runtime-internalization-run-once.js +32 -8
- package/pd-cli/dist/commands/runtime-internalization-run-once.js.map +1 -1
- package/pd-cli/dist/commands/runtime-internalization-wake-once.d.ts.map +1 -1
- package/pd-cli/dist/commands/runtime-internalization-wake-once.js +2 -1
- package/pd-cli/dist/commands/runtime-internalization-wake-once.js.map +1 -1
- package/pd-cli/dist/commands/service-handover.d.ts +12 -0
- package/pd-cli/dist/commands/service-handover.d.ts.map +1 -0
- package/pd-cli/dist/commands/service-handover.js +117 -0
- package/pd-cli/dist/commands/service-handover.js.map +1 -0
- package/pd-cli/dist/commands/service-lifecycle.d.ts +31 -0
- package/pd-cli/dist/commands/service-lifecycle.d.ts.map +1 -0
- package/pd-cli/dist/commands/service-lifecycle.js +207 -0
- package/pd-cli/dist/commands/service-lifecycle.js.map +1 -0
- package/pd-cli/dist/commands/service-run-once.d.ts +96 -0
- package/pd-cli/dist/commands/service-run-once.d.ts.map +1 -1
- package/pd-cli/dist/commands/service-run-once.js +432 -13
- package/pd-cli/dist/commands/service-run-once.js.map +1 -1
- package/pd-cli/dist/commands/workbuddy-setup.d.ts.map +1 -1
- package/pd-cli/dist/commands/workbuddy-setup.js +22 -2
- package/pd-cli/dist/commands/workbuddy-setup.js.map +1 -1
- package/pd-cli/dist/program.d.ts.map +1 -1
- package/pd-cli/dist/program.js +167 -9
- package/pd-cli/dist/program.js.map +1 -1
- package/pd-cli/dist/services/admission-write-gate.d.ts +3 -1
- package/pd-cli/dist/services/admission-write-gate.d.ts.map +1 -1
- package/pd-cli/dist/services/admission-write-gate.js +1 -0
- package/pd-cli/dist/services/admission-write-gate.js.map +1 -1
- package/pd-cli/dist/services/service-host/coordinator-common.d.ts +49 -0
- package/pd-cli/dist/services/service-host/coordinator-common.d.ts.map +1 -0
- package/pd-cli/dist/services/service-host/coordinator-common.js +158 -0
- package/pd-cli/dist/services/service-host/coordinator-common.js.map +1 -0
- package/pd-cli/dist/services/service-host/handover-claims.d.ts +14 -0
- package/pd-cli/dist/services/service-host/handover-claims.d.ts.map +1 -0
- package/pd-cli/dist/services/service-host/handover-claims.js +50 -0
- package/pd-cli/dist/services/service-host/handover-claims.js.map +1 -0
- package/pd-cli/dist/services/service-host/index.d.ts +19 -3
- package/pd-cli/dist/services/service-host/index.d.ts.map +1 -1
- package/pd-cli/dist/services/service-host/index.js +21 -3
- package/pd-cli/dist/services/service-host/index.js.map +1 -1
- package/pd-cli/dist/services/service-host/install-identity.d.ts +23 -3
- package/pd-cli/dist/services/service-host/install-identity.d.ts.map +1 -1
- package/pd-cli/dist/services/service-host/install-identity.js +15 -5
- package/pd-cli/dist/services/service-host/install-identity.js.map +1 -1
- package/pd-cli/dist/services/service-host/locking/service-run-lock.d.ts +130 -9
- package/pd-cli/dist/services/service-host/locking/service-run-lock.d.ts.map +1 -1
- package/pd-cli/dist/services/service-host/locking/service-run-lock.js +99 -19
- package/pd-cli/dist/services/service-host/locking/service-run-lock.js.map +1 -1
- package/pd-cli/dist/services/service-host/managed-run.d.ts +75 -0
- package/pd-cli/dist/services/service-host/managed-run.d.ts.map +1 -0
- package/pd-cli/dist/services/service-host/managed-run.js +550 -0
- package/pd-cli/dist/services/service-host/managed-run.js.map +1 -0
- package/pd-cli/dist/services/service-host/progress-evidence.d.ts +38 -0
- package/pd-cli/dist/services/service-host/progress-evidence.d.ts.map +1 -0
- package/pd-cli/dist/services/service-host/progress-evidence.js +155 -0
- package/pd-cli/dist/services/service-host/progress-evidence.js.map +1 -0
- package/pd-cli/dist/services/service-host/run-once.d.ts.map +1 -1
- package/pd-cli/dist/services/service-host/run-once.js +4 -136
- package/pd-cli/dist/services/service-host/run-once.js.map +1 -1
- package/pd-cli/dist/services/service-host/scheduler/contract.d.ts +184 -0
- package/pd-cli/dist/services/service-host/scheduler/contract.d.ts.map +1 -0
- package/pd-cli/dist/services/service-host/scheduler/contract.js +86 -0
- package/pd-cli/dist/services/service-host/scheduler/contract.js.map +1 -0
- package/pd-cli/dist/services/service-host/scheduler/index.d.ts +76 -0
- package/pd-cli/dist/services/service-host/scheduler/index.d.ts.map +1 -0
- package/pd-cli/dist/services/service-host/scheduler/index.js +128 -0
- package/pd-cli/dist/services/service-host/scheduler/index.js.map +1 -0
- package/pd-cli/dist/services/service-host/scheduler/linux.d.ts +27 -0
- package/pd-cli/dist/services/service-host/scheduler/linux.d.ts.map +1 -0
- package/pd-cli/dist/services/service-host/scheduler/linux.js +1010 -0
- package/pd-cli/dist/services/service-host/scheduler/linux.js.map +1 -0
- package/pd-cli/dist/services/service-host/scheduler/macos.d.ts +13 -0
- package/pd-cli/dist/services/service-host/scheduler/macos.d.ts.map +1 -0
- package/pd-cli/dist/services/service-host/scheduler/macos.js +819 -0
- package/pd-cli/dist/services/service-host/scheduler/macos.js.map +1 -0
- package/pd-cli/dist/services/service-host/scheduler/runtime-io.d.ts +13 -0
- package/pd-cli/dist/services/service-host/scheduler/runtime-io.d.ts.map +1 -0
- package/pd-cli/dist/services/service-host/scheduler/runtime-io.js +141 -0
- package/pd-cli/dist/services/service-host/scheduler/runtime-io.js.map +1 -0
- package/pd-cli/dist/services/service-host/scheduler/service-status.d.ts +99 -0
- package/pd-cli/dist/services/service-host/scheduler/service-status.d.ts.map +1 -0
- package/pd-cli/dist/services/service-host/scheduler/service-status.js +202 -0
- package/pd-cli/dist/services/service-host/scheduler/service-status.js.map +1 -0
- package/pd-cli/dist/services/service-host/scheduler/windows.d.ts +40 -0
- package/pd-cli/dist/services/service-host/scheduler/windows.d.ts.map +1 -0
- package/pd-cli/dist/services/service-host/scheduler/windows.js +688 -0
- package/pd-cli/dist/services/service-host/scheduler/windows.js.map +1 -0
- package/pd-cli/dist/services/service-host/shadow-progress-store.d.ts +43 -0
- package/pd-cli/dist/services/service-host/shadow-progress-store.d.ts.map +1 -0
- package/pd-cli/dist/services/service-host/shadow-progress-store.js +156 -0
- package/pd-cli/dist/services/service-host/shadow-progress-store.js.map +1 -0
- package/pd-cli/dist/services/service-host/shadow-run.d.ts +87 -0
- package/pd-cli/dist/services/service-host/shadow-run.d.ts.map +1 -0
- package/pd-cli/dist/services/service-host/shadow-run.js +549 -0
- package/pd-cli/dist/services/service-host/shadow-run.js.map +1 -0
- package/pd-cli/dist/services/service-host/status/service-run-status.d.ts +114 -4
- package/pd-cli/dist/services/service-host/status/service-run-status.d.ts.map +1 -1
- package/pd-cli/dist/services/service-host/status/service-run-status.js +37 -0
- package/pd-cli/dist/services/service-host/status/service-run-status.js.map +1 -1
- package/pd-cli/dist/services/service-host/worker-adapter-codex.d.ts +2 -0
- package/pd-cli/dist/services/service-host/worker-adapter-codex.d.ts.map +1 -0
- package/pd-cli/dist/services/service-host/worker-adapter-codex.js +76 -0
- package/pd-cli/dist/services/service-host/worker-adapter-codex.js.map +1 -0
- package/pd-cli/dist/services/service-host/worker-adapter-openclaw.d.ts +2 -0
- package/pd-cli/dist/services/service-host/worker-adapter-openclaw.d.ts.map +1 -0
- package/pd-cli/dist/services/service-host/worker-adapter-openclaw.js +49 -0
- package/pd-cli/dist/services/service-host/worker-adapter-openclaw.js.map +1 -0
- package/pd-cli/dist/services/service-host/worker-adapter-workbuddy.d.ts +2 -0
- package/pd-cli/dist/services/service-host/worker-adapter-workbuddy.d.ts.map +1 -0
- package/pd-cli/dist/services/service-host/worker-adapter-workbuddy.js +36 -0
- package/pd-cli/dist/services/service-host/worker-adapter-workbuddy.js.map +1 -0
- package/pd-cli/dist/services/service-host/worker-adapter.d.ts +187 -0
- package/pd-cli/dist/services/service-host/worker-adapter.d.ts.map +1 -0
- package/pd-cli/dist/services/service-host/worker-adapter.js +609 -0
- package/pd-cli/dist/services/service-host/worker-adapter.js.map +1 -0
- package/pd-cli/dist/services/service-host/worker-env.d.ts +84 -0
- package/pd-cli/dist/services/service-host/worker-env.d.ts.map +1 -0
- package/pd-cli/dist/services/service-host/worker-env.js +195 -0
- package/pd-cli/dist/services/service-host/worker-env.js.map +1 -0
- package/pd-cli/dist/services/service-host/worker-process.d.ts +75 -0
- package/pd-cli/dist/services/service-host/worker-process.d.ts.map +1 -0
- package/pd-cli/dist/services/service-host/worker-process.js +225 -0
- package/pd-cli/dist/services/service-host/worker-process.js.map +1 -0
- package/pd-cli/dist/services/service-host/workspace-dispatch.d.ts +61 -0
- package/pd-cli/dist/services/service-host/workspace-dispatch.d.ts.map +1 -0
- package/pd-cli/dist/services/service-host/workspace-dispatch.js +105 -0
- package/pd-cli/dist/services/service-host/workspace-dispatch.js.map +1 -0
- package/pd-cli/dist/services/service-host/workspace-handover.d.ts +190 -0
- package/pd-cli/dist/services/service-host/workspace-handover.d.ts.map +1 -0
- package/pd-cli/dist/services/service-host/workspace-handover.js +1393 -0
- package/pd-cli/dist/services/service-host/workspace-handover.js.map +1 -0
- package/pd-cli/package.json +6 -5
- package/pd-mcp-server/dist/submit-assembly.js +159 -42
- 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 +1 -1
- package/plugin/dist/bundle.js +586 -568
- package/plugin/dist/openclaw-worker.d.ts +92 -0
- package/plugin/dist/openclaw-worker.js +2439 -0
- package/plugin/dist/openclaw.plugin.json +1 -1
- package/plugin/dist/service/gateway-consumer-lease.d.ts +142 -0
- package/plugin/dist/service/gateway-quiesce-ack.d.ts +40 -0
- package/plugin/dist/service/internalization-auto-consumer-service.d.ts +68 -1
- package/plugin/openclaw.plugin.json +1 -1
- package/plugin/package.json +5 -1
- package/release-manager/dist/installer.js +77 -30
- package/release-manager/dist/installers/mcp-registration-conflict.js +34 -1
- package/release-manager/dist/installers/workbuddy-host-installer.js +284 -21
- package/release-manager/dist/service-host-bridge.js +292 -0
- package/release-manager/dist/update/install-layout.js +42 -15
- package/release-manager/package.json +2 -2
- package/workbuddy-adapter/dist/index.d.ts +1 -1
- package/workbuddy-adapter/dist/index.js +1 -1
- package/workbuddy-adapter/dist/worker/workspace-worker.d.ts +7 -0
- package/workbuddy-adapter/dist/worker/workspace-worker.js +179 -10
- package/workbuddy-adapter/package.json +1 -1
- package/workbuddy-adapter/plugin/.codebuddy-plugin/plugin.json +2 -2
|
@@ -17,14 +17,30 @@
|
|
|
17
17
|
* session resolves;
|
|
18
18
|
* - expired/quarantined rows are excluded naturally: retention NULLed their
|
|
19
19
|
* text at write time (PRI-1179), so nothing new is re-derived here.
|
|
20
|
+
*
|
|
21
|
+
* PRI-1283 R2: every list call resolves the LATEST conversation-ingestion
|
|
22
|
+
* consent per governance host and excludes unauthorized hosts AT THE QUERY
|
|
23
|
+
* BOUNDARY — a revoked host's turns are never read into the window. When no
|
|
24
|
+
* port is wired the reader denies all governance hosts (fail-closed): serving
|
|
25
|
+
* consent-gated conversation text without an authorization check is the exact
|
|
26
|
+
* R2 gap. Fail-open-to-[] still applies to STORE failures only.
|
|
20
27
|
*/
|
|
21
28
|
import type { TrajectoryTurnReader } from '@principles/core/runtime';
|
|
29
|
+
import { type SourceMaterialAuthorizationPort } from '@principles/core/runtime';
|
|
30
|
+
export interface GovernanceTrajectoryTurnReaderArgs {
|
|
31
|
+
readonly workspaceDir: string;
|
|
32
|
+
/**
|
|
33
|
+
* PRI-1283 R2: latest-consent gate, consulted PER list call. Composition
|
|
34
|
+
* roots inject `createConsentLedgerSourceMaterialAuthorization(workspaceDir)`.
|
|
35
|
+
*/
|
|
36
|
+
readonly sourceMaterialAuthorization?: SourceMaterialAuthorizationPort;
|
|
37
|
+
}
|
|
22
38
|
/**
|
|
23
39
|
* Build the governance-observation-backed turn reader for a workspace. The
|
|
24
40
|
* returned object is cheap to construct per invocation; each list call opens
|
|
25
41
|
* the store read (no cached handle across worker cycles, so a replaced
|
|
26
|
-
* database mid-run can never serve stale turns)
|
|
42
|
+
* database mid-run can never serve stale turns) and re-resolves the consent
|
|
43
|
+
* state (no cached authorization, so a mid-run revocation takes effect on the
|
|
44
|
+
* next call).
|
|
27
45
|
*/
|
|
28
|
-
export declare function createGovernanceTrajectoryTurnReader(args:
|
|
29
|
-
readonly workspaceDir: string;
|
|
30
|
-
}): TrajectoryTurnReader;
|
|
46
|
+
export declare function createGovernanceTrajectoryTurnReader(args: GovernanceTrajectoryTurnReaderArgs): TrajectoryTurnReader;
|
|
@@ -1,13 +1,19 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { denyAllSourceMaterialAuthorization, } from '@principles/core/runtime';
|
|
2
|
+
import { listGovernanceObservations, listGovernanceTurnTexts } from './governance-observation-store.js';
|
|
2
3
|
/** Bound on turns per list call — the assembler bounds the window again. */
|
|
3
4
|
const MAX_TURNS_PER_SESSION = 200;
|
|
4
|
-
|
|
5
|
+
/** The governance-observation hosts whose turns this reader can serve. */
|
|
6
|
+
const GOVERNANCE_TURN_HOSTS = ['codex', 'workbuddy'];
|
|
7
|
+
function readTurnRows(workspaceDir, kind, query) {
|
|
8
|
+
const { sessionId, port } = query;
|
|
5
9
|
if (sessionId.trim().length === 0)
|
|
6
10
|
return [];
|
|
11
|
+
const authorizedHostKinds = GOVERNANCE_TURN_HOSTS.filter((host) => port.isHostSourceMaterialAuthorized(host).authorized);
|
|
7
12
|
const result = listGovernanceTurnTexts({
|
|
8
13
|
workspaceDir,
|
|
9
14
|
kind,
|
|
10
15
|
sessionId,
|
|
16
|
+
authorizedHostKinds,
|
|
11
17
|
limit: MAX_TURNS_PER_SESSION,
|
|
12
18
|
});
|
|
13
19
|
// Unreadable store: the empty result surfaces as an assembler ambiguity
|
|
@@ -18,12 +24,15 @@ function readTurnRows(workspaceDir, kind, sessionId) {
|
|
|
18
24
|
* Build the governance-observation-backed turn reader for a workspace. The
|
|
19
25
|
* returned object is cheap to construct per invocation; each list call opens
|
|
20
26
|
* the store read (no cached handle across worker cycles, so a replaced
|
|
21
|
-
* database mid-run can never serve stale turns)
|
|
27
|
+
* database mid-run can never serve stale turns) and re-resolves the consent
|
|
28
|
+
* state (no cached authorization, so a mid-run revocation takes effect on the
|
|
29
|
+
* next call).
|
|
22
30
|
*/
|
|
23
31
|
export function createGovernanceTrajectoryTurnReader(args) {
|
|
32
|
+
const port = args.sourceMaterialAuthorization ?? denyAllSourceMaterialAuthorization;
|
|
24
33
|
return {
|
|
25
34
|
listUserTurnsForSession(sessionId) {
|
|
26
|
-
return readTurnRows(args.workspaceDir, 'user_turn', sessionId).map((row, index) => ({
|
|
35
|
+
return readTurnRows(args.workspaceDir, 'user_turn', { sessionId, port }).map((row, index) => ({
|
|
27
36
|
id: row.id,
|
|
28
37
|
turnIndex: row.sourceOrdinal >= 0 ? row.sourceOrdinal : index,
|
|
29
38
|
rawExcerpt: row.visibleText,
|
|
@@ -33,7 +42,7 @@ export function createGovernanceTrajectoryTurnReader(args) {
|
|
|
33
42
|
}));
|
|
34
43
|
},
|
|
35
44
|
listAssistantTurns(sessionId) {
|
|
36
|
-
return readTurnRows(args.workspaceDir, 'assistant_turn', sessionId).map((row) => ({
|
|
45
|
+
return readTurnRows(args.workspaceDir, 'assistant_turn', { sessionId, port }).map((row) => ({
|
|
37
46
|
id: row.id,
|
|
38
47
|
sessionId,
|
|
39
48
|
runId: '',
|
|
@@ -43,5 +52,68 @@ export function createGovernanceTrajectoryTurnReader(args) {
|
|
|
43
52
|
createdAt: row.observedAt,
|
|
44
53
|
}));
|
|
45
54
|
},
|
|
55
|
+
/**
|
|
56
|
+
* PRI-1274 (B1 / P1-3): exact (host, session, host turn id) read over the
|
|
57
|
+
* same authorized governance store. `hostKind` keeps another host's
|
|
58
|
+
* identically-named session+turn out of the window (the cross-host
|
|
59
|
+
* isolation class PRI-1247 closes); retained-text filtering mirrors the
|
|
60
|
+
* session-level reads (expired/quarantined rows carry NULL text).
|
|
61
|
+
* Unreadable store ⇒ empty result — the assembler turns that into an
|
|
62
|
+
* ambiguity note, never a session-wide substitution.
|
|
63
|
+
*/
|
|
64
|
+
listTurnTextsForHostTurnId(sessionId, hostTurnId, hostKind) {
|
|
65
|
+
if (sessionId.trim().length === 0 || hostTurnId.trim().length === 0) {
|
|
66
|
+
return { userTurns: [], assistantTurns: [] };
|
|
67
|
+
}
|
|
68
|
+
// Exact-turn reads are a separate entry point from the session-level
|
|
69
|
+
// list methods above. Require an explicit supported host and consult
|
|
70
|
+
// the latest consent decision on EVERY call before opening the store.
|
|
71
|
+
// An omitted/unsupported host must never become an unscoped read.
|
|
72
|
+
const authorizedHostKind = GOVERNANCE_TURN_HOSTS.find((candidate) => candidate === hostKind);
|
|
73
|
+
if (authorizedHostKind === undefined
|
|
74
|
+
|| !port.isHostSourceMaterialAuthorized(authorizedHostKind).authorized) {
|
|
75
|
+
return { userTurns: [], assistantTurns: [] };
|
|
76
|
+
}
|
|
77
|
+
const result = listGovernanceObservations({
|
|
78
|
+
workspaceDir: args.workspaceDir,
|
|
79
|
+
rolloutIdentity: sessionId,
|
|
80
|
+
hostKind: authorizedHostKind,
|
|
81
|
+
hostTurnId,
|
|
82
|
+
limit: 64,
|
|
83
|
+
});
|
|
84
|
+
if (!result.ok)
|
|
85
|
+
return { userTurns: [], assistantTurns: [] };
|
|
86
|
+
const retainedText = (row) => (row.retentionClass === 'operational' || row.retentionClass === 'promoted')
|
|
87
|
+
&& typeof row.visibleText === 'string'
|
|
88
|
+
&& row.visibleText.trim() !== ''
|
|
89
|
+
? row.visibleText
|
|
90
|
+
: null;
|
|
91
|
+
const userRows = result.observations.filter((row) => row.kind === 'user_turn');
|
|
92
|
+
return {
|
|
93
|
+
userTurns: userRows.flatMap((row, index) => {
|
|
94
|
+
const text = retainedText(row);
|
|
95
|
+
return text === null ? [] : [{
|
|
96
|
+
id: row.id,
|
|
97
|
+
turnIndex: row.sourceOrdinal !== null && row.sourceOrdinal >= 0 ? row.sourceOrdinal : index,
|
|
98
|
+
rawExcerpt: text,
|
|
99
|
+
correctionDetected: false,
|
|
100
|
+
correctionCue: null,
|
|
101
|
+
createdAt: row.observedAt,
|
|
102
|
+
}];
|
|
103
|
+
}),
|
|
104
|
+
assistantTurns: result.observations.filter((row) => row.kind === 'assistant_turn').flatMap((row) => {
|
|
105
|
+
const text = retainedText(row);
|
|
106
|
+
return text === null ? [] : [{
|
|
107
|
+
id: row.id,
|
|
108
|
+
sessionId,
|
|
109
|
+
runId: '',
|
|
110
|
+
provider: '',
|
|
111
|
+
model: '',
|
|
112
|
+
sanitizedText: text,
|
|
113
|
+
createdAt: row.observedAt,
|
|
114
|
+
}];
|
|
115
|
+
}),
|
|
116
|
+
};
|
|
117
|
+
},
|
|
46
118
|
};
|
|
47
119
|
}
|
|
@@ -22,6 +22,8 @@ export * from './governance-observation-store.js';
|
|
|
22
22
|
export * from './governance-trajectory-turn-reader.js';
|
|
23
23
|
export * from './trajectory-retention.js';
|
|
24
24
|
export * from './conversation-ingestion/index.js';
|
|
25
|
+
export * from './source-material-authorization.js';
|
|
26
|
+
export * from './source-revocation-sweep.js';
|
|
25
27
|
export * from './governance-signal-admission.js';
|
|
26
28
|
export * from './signal-classifier.js';
|
|
27
29
|
export * from './adaptive-selection.js';
|
|
@@ -45,6 +45,11 @@ export * from './trajectory-retention.js';
|
|
|
45
45
|
// packages; a new host implements TranscriptSourceAdapter with zero changes
|
|
46
46
|
// here.
|
|
47
47
|
export * from './conversation-ingestion/index.js';
|
|
48
|
+
// PRI-1283 R2: consent-ledger-backed source-material authorization port
|
|
49
|
+
// implementation (the product adapter for the core port).
|
|
50
|
+
export * from './source-material-authorization.js';
|
|
51
|
+
// PRI-1283 R3: consent-revocation sweep over persisted source-material excerpts.
|
|
52
|
+
export * from './source-revocation-sweep.js';
|
|
48
53
|
export * from './governance-signal-admission.js';
|
|
49
54
|
export * from './signal-classifier.js';
|
|
50
55
|
export * from './adaptive-selection.js';
|
|
@@ -28,6 +28,7 @@ import { loadLedger } from '@principles/core/principle-tree-ledger';
|
|
|
28
28
|
import { loadPdConfigForPlugin, loadFeatureFlagFromConfig } from './pd-config.js';
|
|
29
29
|
import { createEvaluatorRepairDeps, createRolloutGovernanceDeps } from './internalization-consumer-governance.js';
|
|
30
30
|
import { WorkspaceTelemetryEmitter } from './workspace-telemetry-emitter.js';
|
|
31
|
+
import { createConsentLedgerSourceMaterialAuthorization } from './source-material-authorization.js';
|
|
31
32
|
export const INTERNALIZATION_AUTO_CONSUMER_FLAG_ID = 'internalization_auto_consumer';
|
|
32
33
|
function formatRunOnceCommand(workspaceDir) {
|
|
33
34
|
return `pd runtime internalization run-once --workspace "${workspaceDir}" --runner dreamer --runtime config --json`;
|
|
@@ -277,7 +278,9 @@ async function executeConsumerCycle(workspaceDir, ports, signals) {
|
|
|
277
278
|
// 是 reconciliation 存在的理由; 若 orchestrator 为 null, finally 的
|
|
278
279
|
// bounded budget 不会执行, orphan 永远无法恢复。
|
|
279
280
|
const { runtimeKind } = runtimeConfigResult;
|
|
280
|
-
orchestrator = new InternalizationOrchestrator(
|
|
281
|
+
orchestrator = new InternalizationOrchestrator(
|
|
282
|
+
// PRI-1283 R2: admission re-verification reads the latest consent.
|
|
283
|
+
{ stateManager, sourceMaterialAuthorization: createConsentLedgerSourceMaterialAuthorization(workspaceDir) }, { owner, runtimeKind, dryRun: true });
|
|
281
284
|
const readModel = new InternalizationQueueReadModel(stateManager);
|
|
282
285
|
readModel.setPolicy({
|
|
283
286
|
enabledChannels: new Set(['prompt', 'code_tool_hook', 'defer_archive']),
|
|
@@ -34,3 +34,13 @@ export declare function loadFeatureFlagFromConfig(workspaceDir: string, flagId:
|
|
|
34
34
|
enabled: boolean;
|
|
35
35
|
source: string;
|
|
36
36
|
};
|
|
37
|
+
/**
|
|
38
|
+
* Env-var NAMES the workspace's runtime profiles reference for credentials
|
|
39
|
+
* (`runtimeProfiles.*.apiKeyEnv`). One collector for every consumer that
|
|
40
|
+
* must know which env names are credential-bearing (the Service Host worker
|
|
41
|
+
* environment allowlist, PRI-1280 Phase 2; the OpenClaw worker readiness
|
|
42
|
+
* credential check, PRI-1282 Phase 4). Names only — values never pass
|
|
43
|
+
* through here. Unreadable/malformed config yields [] and the caller's own
|
|
44
|
+
* degraded path reports the config problem (never a guess).
|
|
45
|
+
*/
|
|
46
|
+
export declare function collectWorkspaceCredentialEnvNames(effective: unknown): readonly string[];
|
|
@@ -96,3 +96,40 @@ export function loadFeatureFlagFromConfig(workspaceDir, flagId, logger) {
|
|
|
96
96
|
}
|
|
97
97
|
return { enabled: flag?.enabled ?? false, source: result.source };
|
|
98
98
|
}
|
|
99
|
+
/**
|
|
100
|
+
* Env-var NAMES the workspace's runtime profiles reference for credentials
|
|
101
|
+
* (`runtimeProfiles.*.apiKeyEnv`). One collector for every consumer that
|
|
102
|
+
* must know which env names are credential-bearing (the Service Host worker
|
|
103
|
+
* environment allowlist, PRI-1280 Phase 2; the OpenClaw worker readiness
|
|
104
|
+
* credential check, PRI-1282 Phase 4). Names only — values never pass
|
|
105
|
+
* through here. Unreadable/malformed config yields [] and the caller's own
|
|
106
|
+
* degraded path reports the config problem (never a guess).
|
|
107
|
+
*/
|
|
108
|
+
export function collectWorkspaceCredentialEnvNames(effective) {
|
|
109
|
+
if (typeof effective !== 'object' || effective === null || Array.isArray(effective))
|
|
110
|
+
return [];
|
|
111
|
+
const record = effective;
|
|
112
|
+
const candidates = [
|
|
113
|
+
record.config,
|
|
114
|
+
record.runtimeProfiles !== undefined ? { runtimeProfiles: record.runtimeProfiles } : undefined,
|
|
115
|
+
];
|
|
116
|
+
const names = new Set();
|
|
117
|
+
for (const candidate of candidates) {
|
|
118
|
+
if (typeof candidate !== 'object' || candidate === null || Array.isArray(candidate))
|
|
119
|
+
continue;
|
|
120
|
+
const profiles = candidate.runtimeProfiles;
|
|
121
|
+
if (typeof profiles !== 'object' || profiles === null || Array.isArray(profiles))
|
|
122
|
+
continue;
|
|
123
|
+
for (const profile of Object.values(profiles)) {
|
|
124
|
+
if (typeof profile !== 'object' || profile === null || Array.isArray(profile))
|
|
125
|
+
continue;
|
|
126
|
+
const apiKeyEnv = profile.apiKeyEnv;
|
|
127
|
+
if (typeof apiKeyEnv !== 'string' || apiKeyEnv.length === 0 || apiKeyEnv.length > 64)
|
|
128
|
+
continue;
|
|
129
|
+
if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(apiKeyEnv))
|
|
130
|
+
continue;
|
|
131
|
+
names.add(apiKeyEnv);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
return [...names];
|
|
135
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { claimPendingCorrectionCandidates, recordPendingCorrectionReview, releasePendingCorrectionClaim, settlePendingCorrection, } from './governance-signal-admission.js';
|
|
1
|
+
import { claimPendingCorrectionCandidates, recordPendingCorrectionReview, releasePendingCorrectionClaim, settlePendingCorrection, verifyPendingClaimForClassification, } from './governance-signal-admission.js';
|
|
2
2
|
const DEFAULT_MAX_CANDIDATES = 2;
|
|
3
3
|
const DEFAULT_AGGREGATE_BUDGET_MS = 60_000;
|
|
4
4
|
const DEFAULT_CLASSIFICATION_TIMEOUT_MS = 60_000;
|
|
@@ -102,6 +102,33 @@ export async function runStage2CorrectionCycle(input) {
|
|
|
102
102
|
skipped += 1;
|
|
103
103
|
continue;
|
|
104
104
|
}
|
|
105
|
+
// PRI-1283 review round 2 (directive A5): the LAST authorization gate
|
|
106
|
+
// before the model request starts. Re-verifies claim ownership AND the
|
|
107
|
+
// row's live consent in one fresh read — after a revocation completes,
|
|
108
|
+
// no new classifier request may be started on the revoked source's
|
|
109
|
+
// text. The result of a request already in flight is fenced by
|
|
110
|
+
// recordPendingCorrectionReview (decision + claimToken CAS).
|
|
111
|
+
if (candidate.claimToken !== null) {
|
|
112
|
+
const verified = verifyPendingClaimForClassification({
|
|
113
|
+
workspaceDir: input.workspaceDir,
|
|
114
|
+
logicalObservationKey: candidate.logicalObservationKey,
|
|
115
|
+
claimToken: candidate.claimToken,
|
|
116
|
+
});
|
|
117
|
+
if (!verified.ok) {
|
|
118
|
+
degradations.push(`${candidate.logicalObservationKey}:claim_verify_failed:${verified.reason}`);
|
|
119
|
+
releaseClaim(candidate);
|
|
120
|
+
skipped += 1;
|
|
121
|
+
continue;
|
|
122
|
+
}
|
|
123
|
+
if (!verified.allowed) {
|
|
124
|
+
// Never start the model call; release so the next cycle's claim
|
|
125
|
+
// path terminates the row (A4) instead of re-claiming it.
|
|
126
|
+
releaseClaim(candidate);
|
|
127
|
+
degradations.push(`${candidate.logicalObservationKey}:classification_blocked:${verified.reason}`);
|
|
128
|
+
skipped += 1;
|
|
129
|
+
continue;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
105
132
|
// AbortSignal.timeout (pi-ai-runtime-adapter startRun) rejects
|
|
106
133
|
// fractional delays with ERR_OUT_OF_RANGE, and `remaining` is a
|
|
107
134
|
// performance.now() float — under the default 60s budget it is
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Consent-ledger-backed source-material authorization — PRI-1283 R2.
|
|
3
|
+
*
|
|
4
|
+
* THE implementation of `@principles/core`'s `SourceMaterialAuthorizationPort`
|
|
5
|
+
* for the real product. It answers ONE question, per call, against the
|
|
6
|
+
* conversation-ingestion consent ledger v3 (the single authority,
|
|
7
|
+
* conversation-ingestion/consent.ts):
|
|
8
|
+
*
|
|
9
|
+
* "is host H's conversation material readable RIGHT NOW?"
|
|
10
|
+
*
|
|
11
|
+
* Decision table (uniform, fail-closed):
|
|
12
|
+
*
|
|
13
|
+
* ledger read | decision | authorization
|
|
14
|
+
* ------------------|--------------|------------------------------------
|
|
15
|
+
* granted | — | authorized
|
|
16
|
+
* revoked | — | blocked (consent_revoked)
|
|
17
|
+
* pending / failed | — | blocked (consent_not_granted)
|
|
18
|
+
* no record | — | blocked (consent_missing) — no
|
|
19
|
+
* | | authority says this material may be
|
|
20
|
+
* | | read; legitimate ingestion never ran
|
|
21
|
+
* | | without a granted record (SPEC §8.2)
|
|
22
|
+
* unreadable file | — | blocked (consent_unreadable) — a
|
|
23
|
+
* | | malformed ledger fails loud, never
|
|
24
|
+
* | | "never asked" (consent.ts posture)
|
|
25
|
+
*
|
|
26
|
+
* Every call re-reads the ledger — there is deliberately NO cache: a
|
|
27
|
+
* revocation recorded between two reads must take effect on the next read
|
|
28
|
+
* (R2: "缓存命中时撤回 → 不得返回旧缓存内容"). Reading one small JSON file
|
|
29
|
+
* per check is the price of correctness; consumers gate once per assembly /
|
|
30
|
+
* model call, not per row.
|
|
31
|
+
*/
|
|
32
|
+
import type { SourceAuthorizationState, SourceMaterialAuthorizationPort, SourceMaterialHostKind, SourceMaterialDenialReason } from '@principles/core/runtime';
|
|
33
|
+
export type { SourceAuthorizationState, SourceMaterialAuthorizationPort, SourceMaterialHostKind };
|
|
34
|
+
export interface ReadSourceMaterialAuthorizationInput {
|
|
35
|
+
readonly workspaceDir: string;
|
|
36
|
+
readonly hostKind: SourceMaterialHostKind;
|
|
37
|
+
}
|
|
38
|
+
export type SourceMaterialAuthorizationResult = {
|
|
39
|
+
readonly status: 'authorized';
|
|
40
|
+
} | {
|
|
41
|
+
readonly status: 'blocked';
|
|
42
|
+
readonly reason: SourceMaterialDenialReason;
|
|
43
|
+
readonly detail?: string;
|
|
44
|
+
};
|
|
45
|
+
/** Full-result read for health surfaces, tests and the sweep. */
|
|
46
|
+
export declare function readSourceMaterialAuthorization(input: ReadSourceMaterialAuthorizationInput): SourceMaterialAuthorizationResult;
|
|
47
|
+
/**
|
|
48
|
+
* Build the port bound to one workspace. Cheap to construct; every call
|
|
49
|
+
* performs a live ledger read. Inject at composition roots (CLI commands,
|
|
50
|
+
* workers, console models, MCP assembly) wherever governance-sourced material
|
|
51
|
+
* is consumed.
|
|
52
|
+
*/
|
|
53
|
+
export declare function createConsentLedgerSourceMaterialAuthorization(workspaceDir: string): SourceMaterialAuthorizationPort;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Consent-ledger-backed source-material authorization — PRI-1283 R2.
|
|
3
|
+
*
|
|
4
|
+
* THE implementation of `@principles/core`'s `SourceMaterialAuthorizationPort`
|
|
5
|
+
* for the real product. It answers ONE question, per call, against the
|
|
6
|
+
* conversation-ingestion consent ledger v3 (the single authority,
|
|
7
|
+
* conversation-ingestion/consent.ts):
|
|
8
|
+
*
|
|
9
|
+
* "is host H's conversation material readable RIGHT NOW?"
|
|
10
|
+
*
|
|
11
|
+
* Decision table (uniform, fail-closed):
|
|
12
|
+
*
|
|
13
|
+
* ledger read | decision | authorization
|
|
14
|
+
* ------------------|--------------|------------------------------------
|
|
15
|
+
* granted | — | authorized
|
|
16
|
+
* revoked | — | blocked (consent_revoked)
|
|
17
|
+
* pending / failed | — | blocked (consent_not_granted)
|
|
18
|
+
* no record | — | blocked (consent_missing) — no
|
|
19
|
+
* | | authority says this material may be
|
|
20
|
+
* | | read; legitimate ingestion never ran
|
|
21
|
+
* | | without a granted record (SPEC §8.2)
|
|
22
|
+
* unreadable file | — | blocked (consent_unreadable) — a
|
|
23
|
+
* | | malformed ledger fails loud, never
|
|
24
|
+
* | | "never asked" (consent.ts posture)
|
|
25
|
+
*
|
|
26
|
+
* Every call re-reads the ledger — there is deliberately NO cache: a
|
|
27
|
+
* revocation recorded between two reads must take effect on the next read
|
|
28
|
+
* (R2: "缓存命中时撤回 → 不得返回旧缓存内容"). Reading one small JSON file
|
|
29
|
+
* per check is the price of correctness; consumers gate once per assembly /
|
|
30
|
+
* model call, not per row.
|
|
31
|
+
*/
|
|
32
|
+
import { readConversationIngestionConsent } from './conversation-ingestion/consent.js';
|
|
33
|
+
/** Full-result read for health surfaces, tests and the sweep. */
|
|
34
|
+
export function readSourceMaterialAuthorization(input) {
|
|
35
|
+
const { workspaceDir, hostKind } = input;
|
|
36
|
+
const read = readConversationIngestionConsent(workspaceDir, hostKind);
|
|
37
|
+
if (!read.ok) {
|
|
38
|
+
return { status: 'blocked', reason: 'consent_unreadable', detail: `${read.reason}; ${read.nextAction}` };
|
|
39
|
+
}
|
|
40
|
+
const { record } = read;
|
|
41
|
+
if (record === null) {
|
|
42
|
+
return { status: 'blocked', reason: 'consent_missing', detail: `no conversation-ingestion consent record for host '${hostKind}' in this workspace` };
|
|
43
|
+
}
|
|
44
|
+
if (record.decision === 'granted') {
|
|
45
|
+
return { status: 'authorized' };
|
|
46
|
+
}
|
|
47
|
+
if (record.decision === 'revoked') {
|
|
48
|
+
return { status: 'blocked', reason: 'consent_revoked', detail: `consent revoked at ${record.decidedAt}` };
|
|
49
|
+
}
|
|
50
|
+
return { status: 'blocked', reason: 'consent_not_granted', detail: `consent decision '${record.decision}' (decidedAt ${record.decidedAt})` };
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Build the port bound to one workspace. Cheap to construct; every call
|
|
54
|
+
* performs a live ledger read. Inject at composition roots (CLI commands,
|
|
55
|
+
* workers, console models, MCP assembly) wherever governance-sourced material
|
|
56
|
+
* is consumed.
|
|
57
|
+
*/
|
|
58
|
+
export function createConsentLedgerSourceMaterialAuthorization(workspaceDir) {
|
|
59
|
+
return {
|
|
60
|
+
isHostSourceMaterialAuthorized(hostKind) {
|
|
61
|
+
const result = readSourceMaterialAuthorization({ workspaceDir, hostKind });
|
|
62
|
+
if (result.status === 'authorized')
|
|
63
|
+
return { authorized: true };
|
|
64
|
+
return { authorized: false, reason: result.reason, ...(result.detail !== undefined ? { detail: result.detail } : {}) };
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
}
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Source revocation sweep — PRI-1283 R3 (SPEC-PD-FEEDBACK-RESILIENCE-001
|
|
3
|
+
* TECH §2.2 "数据清退"), review round 2 (directives A2/A3/B/C/E).
|
|
4
|
+
*
|
|
5
|
+
* When a workspace host's conversation-ingestion consent leaves `granted`,
|
|
6
|
+
* the material already persisted FROM that host's conversations must be
|
|
7
|
+
* purged or made unreadable — UI hiding is not cleanup, and stopping new
|
|
8
|
+
* ingestion is not enough (TECH §2.2.1 R3).
|
|
9
|
+
*
|
|
10
|
+
* What this sweep does, per host whose ledger record exists with a
|
|
11
|
+
* non-granted decision (a MISSING or UNREADABLE ledger is not a revocation —
|
|
12
|
+
* nothing is purged, while the R2 read gates keep blocking consumption):
|
|
13
|
+
*
|
|
14
|
+
* trajectory.db (one connection; each step its own small transaction):
|
|
15
|
+
* 1. governance_observations (host rows, operational+promoted):
|
|
16
|
+
* visible_text / sanitized_tool_facts_json → NULL,
|
|
17
|
+
* retention_class → 'expired', expired_at → revocation time.
|
|
18
|
+
* Reuses the store's own expiry shape; the store's no-regain guard
|
|
19
|
+
* then prevents a later replay from re-bodying these rows — this is
|
|
20
|
+
* what makes RE-GRANTING not resurrect old excerpts.
|
|
21
|
+
* 2. governance_signal_admissions (host markers), classified per marker
|
|
22
|
+
* (directive B):
|
|
23
|
+
* - OWNER-EXPLICIT (correctionEvidence.classification
|
|
24
|
+
* 'owner_statement' / explicit channel / explicit reason marker)
|
|
25
|
+
* → PRESERVED (an explicit Owner submission is an Owner act, not
|
|
26
|
+
* conversation ingestion);
|
|
27
|
+
* - pending_llm_review rows → TERMINATED as abandoned
|
|
28
|
+
* ('source_revoked') with the D6 minimal terminal payload — the
|
|
29
|
+
* nested trigger.text / trigger.matchedTerms / hostTurnId /
|
|
30
|
+
* task_payload copies are dropped and the row becomes
|
|
31
|
+
* unclaimable (directive A3; the claim path re-verifies consent
|
|
32
|
+
* too — A4);
|
|
33
|
+
* - other automatic markers → task_payload_json redacted AND the
|
|
34
|
+
* independent `reason` COLUMN redacted (it quotes detected terms;
|
|
35
|
+
* directive C4);
|
|
36
|
+
* - unparseable payloads → redacted wholesale (fail-closed; the
|
|
37
|
+
* count is reported as unattributable).
|
|
38
|
+
* 3. pain_events of the host's AUTOMATIC admitted pains:
|
|
39
|
+
* text / reason → NULL (row, ids, timestamps survive — the Pain's
|
|
40
|
+
* business identity is NOT deleted). Owner-explicit statement pains
|
|
41
|
+
* are excluded from the purge set (their canonical ids come from the
|
|
42
|
+
* preserved markers).
|
|
43
|
+
*
|
|
44
|
+
* state.db (RuntimeStateManager when applying — task rows go through its
|
|
45
|
+
* CAS authority; a plain readonly connection for dry runs):
|
|
46
|
+
* 4. tasks.diagnostic_json: evidence entries of the revoked source are
|
|
47
|
+
* REMOVED; painIngress.evidenceClass is kept truthful
|
|
48
|
+
* (available.entryCount = remaining, or unavailable/source_revoked
|
|
49
|
+
* when empty); governed correctionEvidence is removed — an
|
|
50
|
+
* OWNER-EXPLICIT channel is kept (directive B); a non-sensitive
|
|
51
|
+
* `sourceRevocation` audit block records the verdict metadata only.
|
|
52
|
+
* Written via updateTaskIfDiagnosticJsonUnchanged (bounded CAS retry).
|
|
53
|
+
* 5. pain_diagnoses.evidence_json: revoked entries removed (row CAS).
|
|
54
|
+
* 6. artifacts (diagnostician_output).content_json: revoked evidence
|
|
55
|
+
* entries removed (row CAS). Model-authored root cause text survives.
|
|
56
|
+
* 7. runs.output_payload: the bare DiagnosticianOutputV2 (or the router
|
|
57
|
+
* envelope) embeds the same evidence[] notes — revoked entries are
|
|
58
|
+
* removed (row CAS; directive C2).
|
|
59
|
+
* 8. pi_artifacts.content_json: revoked evidence entries removed from
|
|
60
|
+
* every artifact kind that carries an evidence array (row CAS;
|
|
61
|
+
* directive C3).
|
|
62
|
+
*
|
|
63
|
+
* Checked, no excerpt fields (reported, never rewritten):
|
|
64
|
+
* - principle_candidates (model-generated description/title),
|
|
65
|
+
* - the principle ledger (reuseEvidence/derivedFromPainIds are ID
|
|
66
|
+
* metadata; principle text is model-authored),
|
|
67
|
+
* - governance_pending_promotion_tails / transcript_checkpoints
|
|
68
|
+
* (progress metadata, no text).
|
|
69
|
+
*
|
|
70
|
+
* Guarantees (SPEC §2.2.1 minimum cleanup contract + directive E):
|
|
71
|
+
* - idempotent: every step converges; a rerun reports zeros;
|
|
72
|
+
* - truly read-only dry run (directive E2): readonly connections
|
|
73
|
+
* (`fileMustExist`, `PRAGMA query_only=ON`), NO RuntimeStateManager
|
|
74
|
+
* initialization, no schema/migration/WAL writes, no database creation,
|
|
75
|
+
* no audit line;
|
|
76
|
+
* - per-table independence (directive E4): a missing table records
|
|
77
|
+
* `not_applicable` for that table ONLY; every other table still sweeps;
|
|
78
|
+
* - counted from writes (directive E5): every purged count comes from an
|
|
79
|
+
* actual successful CAS/UPDATE; a CAS race is a reported failure, never
|
|
80
|
+
* a success; an audit write failure is reported, never swallowed;
|
|
81
|
+
* - visible: an append-only `.state/source-revocation-sweep.jsonl` audit
|
|
82
|
+
* line records counts/verdicts/timestamps per host-run — never excerpt
|
|
83
|
+
* text;
|
|
84
|
+
* - retryable: per-item failures are recorded in the report and the run
|
|
85
|
+
* finishes the remaining items (outcome 'partial'); rerunning is safe;
|
|
86
|
+
* - bounded: busy_timeout + small transactions, per the trajectory
|
|
87
|
+
* retention runner's concurrency posture.
|
|
88
|
+
*/
|
|
89
|
+
export declare const SOURCE_REVOCATION_SWEEP_AUDIT_FILENAME = "source-revocation-sweep.jsonl";
|
|
90
|
+
export type SweepHostKind = 'codex' | 'workbuddy' | 'openclaw';
|
|
91
|
+
export interface SourceRevocationSweepCounts {
|
|
92
|
+
/** governance_observations rows whose text/tool facts were NULLed. */
|
|
93
|
+
governanceObservations: number;
|
|
94
|
+
/** automatic admitted markers whose task_payload_json was redacted. */
|
|
95
|
+
admissionPayloads: number;
|
|
96
|
+
/** automatic admitted markers whose independent reason COLUMN was redacted. */
|
|
97
|
+
admissionReasons: number;
|
|
98
|
+
/** pending_llm_review rows terminated as abandoned('source_revoked'). */
|
|
99
|
+
pendingReviewsTerminated: number;
|
|
100
|
+
/** owner-explicit markers deliberately PRESERVED (directive B). */
|
|
101
|
+
preservedOwnerStatements: number;
|
|
102
|
+
/** markers whose payload could not be parsed — redacted wholesale. */
|
|
103
|
+
unattributableMarkers: number;
|
|
104
|
+
/** pain_events rows whose text/reason were NULLed. */
|
|
105
|
+
painEventTexts: number;
|
|
106
|
+
/** tasks whose diagnostic_json lost evidence entries. */
|
|
107
|
+
tasks: number;
|
|
108
|
+
/** evidence entries removed from task diagnostic_json. */
|
|
109
|
+
taskEvidenceEntries: number;
|
|
110
|
+
/** governed correctionEvidence blocks removed from tasks. */
|
|
111
|
+
taskCorrectionEvidence: number;
|
|
112
|
+
/** pain_diagnoses rows whose evidence_json was rewritten. */
|
|
113
|
+
painDiagnoses: number;
|
|
114
|
+
/** evidence entries removed from pain_diagnoses rows. */
|
|
115
|
+
painDiagnosesEvidenceEntries: number;
|
|
116
|
+
/** diagnostician_output artifacts whose content_json was rewritten. */
|
|
117
|
+
artifacts: number;
|
|
118
|
+
/** evidence entries removed from artifacts. */
|
|
119
|
+
artifactEvidenceEntries: number;
|
|
120
|
+
/** runs whose output_payload was rewritten (directive C2). */
|
|
121
|
+
runs: number;
|
|
122
|
+
/** evidence entries removed from runs.output_payload. */
|
|
123
|
+
runEvidenceEntries: number;
|
|
124
|
+
/** pi_artifacts rows whose content_json was rewritten (directive C3). */
|
|
125
|
+
piArtifacts: number;
|
|
126
|
+
/** evidence entries removed from pi_artifacts. */
|
|
127
|
+
piArtifactEvidenceEntries: number;
|
|
128
|
+
}
|
|
129
|
+
export interface SourceRevocationSweepHostReport {
|
|
130
|
+
readonly hostKind: SweepHostKind;
|
|
131
|
+
readonly consentDecision: 'revoked' | 'pending' | 'failed';
|
|
132
|
+
readonly decidedAt: string | null;
|
|
133
|
+
readonly swept: boolean;
|
|
134
|
+
readonly purged: SourceRevocationSweepCounts;
|
|
135
|
+
/** Tables absent in this workspace — reported per table (directive E4). */
|
|
136
|
+
readonly notApplicable: readonly string[];
|
|
137
|
+
/** Non-sensitive per-item failure notes (bounded). */
|
|
138
|
+
readonly failures: readonly string[];
|
|
139
|
+
}
|
|
140
|
+
export type SourceRevocationSweepReport = {
|
|
141
|
+
readonly outcome: 'completed' | 'partial';
|
|
142
|
+
readonly workspaceDir: string;
|
|
143
|
+
readonly ranAt: string;
|
|
144
|
+
readonly apply: boolean;
|
|
145
|
+
readonly hosts: readonly SourceRevocationSweepHostReport[];
|
|
146
|
+
/**
|
|
147
|
+
* `null` on completed; a stable reason on partial so an operator (or
|
|
148
|
+
* `--json` consumer) does not have to mine per-host failures for the
|
|
149
|
+
* headline. PRI-1283 review: the report promised a top-level cause and
|
|
150
|
+
* recovery step, matching the failed/skipped variant below.
|
|
151
|
+
*/
|
|
152
|
+
readonly reason: string | null;
|
|
153
|
+
readonly nextAction?: string;
|
|
154
|
+
} | {
|
|
155
|
+
readonly outcome: 'skipped' | 'failed';
|
|
156
|
+
readonly workspaceDir: string;
|
|
157
|
+
readonly ranAt: string;
|
|
158
|
+
readonly apply: boolean;
|
|
159
|
+
readonly hosts: readonly SourceRevocationSweepHostReport[];
|
|
160
|
+
readonly reason: string;
|
|
161
|
+
readonly nextAction?: string;
|
|
162
|
+
/** Locations verified to carry NO excerpt fields (reported for the audit). */
|
|
163
|
+
readonly checkedOnly?: readonly string[];
|
|
164
|
+
};
|
|
165
|
+
export interface RunSourceRevocationSweepOptions {
|
|
166
|
+
readonly workspaceDir: string;
|
|
167
|
+
/** Dry run (default): counts what WOULD be purged, writes nothing. */
|
|
168
|
+
readonly apply: boolean;
|
|
169
|
+
/** Injectable clock (tests). */
|
|
170
|
+
readonly now?: () => Date;
|
|
171
|
+
}
|
|
172
|
+
export declare function runSourceRevocationSweep(options: RunSourceRevocationSweepOptions): Promise<SourceRevocationSweepReport>;
|