create-principles-disciple 1.154.5 → 1.155.2
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 +11 -0
- package/console/dist/server/models/EvidenceChainConsoleModel.js +31 -0
- package/console/dist/server/routes/health.d.ts +1 -0
- package/console/dist/server/routes/health.js +12 -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 +39 -39
- package/console/package.json +1 -1
- package/core/dist/runtime/adapter/pi-ai-http-transport.d.ts.map +1 -1
- package/core/dist/runtime/adapter/pi-ai-http-transport.js.map +1 -1
- 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 +2 -2
- 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 +7 -6
- 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/console.d.ts.map +1 -1
- package/pd-cli/dist/commands/console.js +9 -0
- package/pd-cli/dist/commands/console.js.map +1 -1
- 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/health-console.d.ts +1 -1
- package/pd-cli/dist/commands/health-console.d.ts.map +1 -1
- package/pd-cli/dist/commands/health-console.js +15 -1
- package/pd-cli/dist/commands/health-console.js.map +1 -1
- package/pd-cli/dist/commands/health.d.ts.map +1 -1
- package/pd-cli/dist/commands/health.js +7 -1
- package/pd-cli/dist/commands/health.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/console-launcher.d.ts +93 -1
- package/pd-cli/dist/services/console-launcher.d.ts.map +1 -1
- package/pd-cli/dist/services/console-launcher.js +375 -10
- package/pd-cli/dist/services/console-launcher.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 +662 -637
- package/plugin/dist/openclaw-worker.d.ts +92 -0
- package/plugin/dist/openclaw-worker.js +2446 -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 +5 -4
- 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
|
@@ -35,9 +35,11 @@ import fs from 'node:fs';
|
|
|
35
35
|
import path from 'node:path';
|
|
36
36
|
import { randomUUID } from 'node:crypto';
|
|
37
37
|
import Database from 'better-sqlite3';
|
|
38
|
-
import { collectSync, computeFeatureFlagsFromConfig, CORRECTION_SEED_KEYWORDS, PainToPrincipleService, PrincipleTreeLedgerAdapter, RuntimeStateManager, createDiagnosticianTaskId, sanitizeString, boundCorrectionEvidenceText, MAX_EVIDENCE_VALUE_CHARS, evaluateStage2ConfidenceGate, evaluatePainIngress, migrateLegacyGfiSchema, STAGE2_MAX_ATTEMPTS, PENDING_CANDIDATE_TTL_MS, } from '@principles/core/runtime';
|
|
38
|
+
import { collectSync, computeFeatureFlagsFromConfig, CORRECTION_SEED_KEYWORDS, PainToPrincipleService, PrincipleTreeLedgerAdapter, RuntimeStateManager, createDiagnosticianTaskId, sanitizeString, boundCorrectionEvidenceText, fingerprintStatement, isOwnerManualCorrectionEvidence, MAX_EVIDENCE_VALUE_CHARS, evaluateStage2ConfidenceGate, evaluatePainIngress, migrateLegacyGfiSchema, STAGE2_MAX_ATTEMPTS, PENDING_CANDIDATE_TTL_MS, } from '@principles/core/runtime';
|
|
39
39
|
import { deriveProductionCorrectionPainIdentity, hasProductionPainSchema, } from './production-pain-evidence.js';
|
|
40
40
|
import { promoteGovernanceEvidence, ensureGovernanceSchema } from './governance-observation-store.js';
|
|
41
|
+
import { readSourceMaterialAuthorization } from './source-material-authorization.js';
|
|
42
|
+
import { readConversationIngestionConsent } from './conversation-ingestion/consent.js';
|
|
41
43
|
import { loadPdConfigForPlugin } from './pd-config.js';
|
|
42
44
|
import { isAutomaticPainSubmissionAuthorized } from './auto-pain-authorization.js';
|
|
43
45
|
import { createHostIntentDocReader } from './intent-doc-reader.js';
|
|
@@ -428,9 +430,15 @@ function tryConsumeRateLimit({ db, rootSessionId, ruleVersion, now }) {
|
|
|
428
430
|
/** ONE reason builder for inline admission and the pending→admitted transition. */
|
|
429
431
|
function correctionReason(candidate, matchedTerms) {
|
|
430
432
|
if (candidate.explicitOwnerStatement === true) {
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
433
|
+
if (candidate.explicitChannel === 'codex_explicit_agent') {
|
|
434
|
+
// PRI-1283 round 3: only a transcript-verified agent submission may
|
|
435
|
+
// carry the owner-explicit reason marker; an unverified one is
|
|
436
|
+
// Agent-derived and must NOT match `isOwnerExplicitStatementReason`.
|
|
437
|
+
return candidate.ownerVerbatimConfirmed === true
|
|
438
|
+
? 'Codex explicit owner statement (agent-assisted, owner confirmed)'
|
|
439
|
+
: 'Codex agent-reported pain statement (owner confirmation unverified)';
|
|
440
|
+
}
|
|
441
|
+
return `${candidate.hostKind === 'workbuddy' ? 'WorkBuddy' : 'Codex'} explicit owner statement (PD记录痛苦 prefix)`;
|
|
434
442
|
}
|
|
435
443
|
return matchedTerms.length > 0
|
|
436
444
|
? `User correction detected: ${matchedTerms.join(', ')}`
|
|
@@ -500,7 +508,21 @@ function buildTaskSubmissionPayload(candidate, workspaceDir, details) {
|
|
|
500
508
|
...(candidate.explicitOwnerStatement === true
|
|
501
509
|
? { correctionEvidence: candidate.hostKind === 'workbuddy'
|
|
502
510
|
? { text: boundCorrectionEvidenceText({ text: candidate.text, classification: 'owner_statement', channel: 'workbuddy_explicit_prefix' }, workspaceDir).text, classification: 'owner_statement', channel: 'workbuddy_explicit_prefix' }
|
|
503
|
-
:
|
|
511
|
+
: candidate.explicitChannel === 'codex_explicit_agent'
|
|
512
|
+
? (candidate.ownerVerbatimConfirmed === true
|
|
513
|
+
? (() => {
|
|
514
|
+
// PRI-1283 round 3: the bound confirmation fingerprint covers
|
|
515
|
+
// the PERSISTED (sanitized) text — the final submitted content.
|
|
516
|
+
const text = sanitizeString(candidate.text, workspaceDir);
|
|
517
|
+
return {
|
|
518
|
+
text,
|
|
519
|
+
classification: 'owner_statement',
|
|
520
|
+
channel: 'codex_explicit_agent',
|
|
521
|
+
ownerConfirmation: { kind: 'owner_verbatim_turn_match', statementFingerprint: fingerprintStatement(text) },
|
|
522
|
+
};
|
|
523
|
+
})()
|
|
524
|
+
: { text: sanitizeString(candidate.text, workspaceDir), channel: 'codex_explicit_agent' })
|
|
525
|
+
: { text: sanitizeString(candidate.text, workspaceDir), classification: 'owner_statement', channel: 'codex_explicit_prefix' } }
|
|
504
526
|
: {}),
|
|
505
527
|
};
|
|
506
528
|
return payload;
|
|
@@ -729,6 +751,29 @@ function buildOwnerCorrectionIngressReport(facts) {
|
|
|
729
751
|
evidence: bundle,
|
|
730
752
|
};
|
|
731
753
|
}
|
|
754
|
+
function buildAgentAssistedCorrectionIngressReport(facts) {
|
|
755
|
+
const [first, ...rest] = facts.evidence;
|
|
756
|
+
const bundle = first === undefined
|
|
757
|
+
? { status: 'unavailable', reason: 'trajectory_unavailable' }
|
|
758
|
+
: { status: 'available', entries: [first, ...rest] };
|
|
759
|
+
return {
|
|
760
|
+
identity: { kind: 'manual_pain_id', painId: facts.painId },
|
|
761
|
+
painType: 'user_frustration',
|
|
762
|
+
source: 'user_correction',
|
|
763
|
+
reason: facts.reason,
|
|
764
|
+
score: GOVERNANCE_STRONG_PAIN_SCORE,
|
|
765
|
+
origin: { kind: 'agent_assisted', channel: 'codex_explicit_agent' },
|
|
766
|
+
correlation: {
|
|
767
|
+
status: 'bound',
|
|
768
|
+
hostKind: 'codex',
|
|
769
|
+
rootSessionId: facts.rootSessionId,
|
|
770
|
+
rolloutIdentity: facts.rolloutIdentity,
|
|
771
|
+
logicalObservationKey: facts.logicalObservationKey,
|
|
772
|
+
hostTurnId: facts.hostTurnId,
|
|
773
|
+
},
|
|
774
|
+
evidence: bundle,
|
|
775
|
+
};
|
|
776
|
+
}
|
|
732
777
|
function ownerExplicitChannel(candidate) {
|
|
733
778
|
if (candidate.explicitChannel !== undefined)
|
|
734
779
|
return candidate.explicitChannel;
|
|
@@ -840,50 +885,46 @@ function admitCorrection({ db, candidate, workspaceDir, now, nowIso, keywordStor
|
|
|
840
885
|
text: candidate.text,
|
|
841
886
|
});
|
|
842
887
|
const ingressReasonValue = correctionReason(candidate, detection?.output.matchedTerms ?? []);
|
|
843
|
-
const
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
888
|
+
const ingressEvidence = correctionIngressEvidence({
|
|
889
|
+
db,
|
|
890
|
+
hostKind: candidate.hostKind,
|
|
891
|
+
logicalObservationKey: candidate.logicalObservationKey,
|
|
892
|
+
rolloutIdentity: candidate.rolloutIdentity,
|
|
893
|
+
rootSessionId: candidate.rootSessionId,
|
|
894
|
+
hostTurnId: candidate.hostTurnId,
|
|
895
|
+
text: candidate.text,
|
|
896
|
+
workspaceDir,
|
|
897
|
+
});
|
|
898
|
+
const correctionFacts = {
|
|
899
|
+
hostKind: candidate.hostKind,
|
|
900
|
+
logicalObservationKey: candidate.logicalObservationKey,
|
|
901
|
+
rolloutIdentity: candidate.rolloutIdentity,
|
|
902
|
+
rootSessionId: candidate.rootSessionId,
|
|
903
|
+
hostTurnId: candidate.hostTurnId,
|
|
904
|
+
painId,
|
|
905
|
+
reason: ingressReasonValue,
|
|
906
|
+
evidence: ingressEvidence,
|
|
907
|
+
};
|
|
908
|
+
const agentAssistedExplicit = isExplicit
|
|
909
|
+
&& candidate.hostKind === 'codex'
|
|
910
|
+
&& candidate.explicitChannel === 'codex_explicit_agent'
|
|
911
|
+
&& candidate.ownerVerbatimConfirmed !== true;
|
|
912
|
+
const ingressDecision = agentAssistedExplicit
|
|
913
|
+
? evaluatePainIngress(buildAgentAssistedCorrectionIngressReport({
|
|
914
|
+
logicalObservationKey: correctionFacts.logicalObservationKey,
|
|
915
|
+
rolloutIdentity: correctionFacts.rolloutIdentity,
|
|
916
|
+
rootSessionId: correctionFacts.rootSessionId,
|
|
917
|
+
hostTurnId: correctionFacts.hostTurnId,
|
|
918
|
+
painId: correctionFacts.painId,
|
|
919
|
+
reason: correctionFacts.reason,
|
|
920
|
+
evidence: correctionFacts.evidence,
|
|
867
921
|
}))
|
|
868
|
-
:
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
painId,
|
|
875
|
-
reason: ingressReasonValue,
|
|
876
|
-
evidence: correctionIngressEvidence({
|
|
877
|
-
db,
|
|
878
|
-
hostKind: candidate.hostKind,
|
|
879
|
-
logicalObservationKey: candidate.logicalObservationKey,
|
|
880
|
-
rolloutIdentity: candidate.rolloutIdentity,
|
|
881
|
-
rootSessionId: candidate.rootSessionId,
|
|
882
|
-
hostTurnId: candidate.hostTurnId,
|
|
883
|
-
text: candidate.text,
|
|
884
|
-
workspaceDir,
|
|
885
|
-
}),
|
|
886
|
-
}));
|
|
922
|
+
: isExplicit
|
|
923
|
+
? evaluatePainIngress(buildOwnerCorrectionIngressReport({
|
|
924
|
+
...correctionFacts,
|
|
925
|
+
channel: ownerExplicitChannel(candidate),
|
|
926
|
+
}))
|
|
927
|
+
: evaluatePainIngress(buildCorrectionIngressReport(correctionFacts));
|
|
887
928
|
const ingressReason = ingressDecision.action === 'refuse' || ingressDecision.action === 'observation_only'
|
|
888
929
|
? ingressDecision.reasonCode
|
|
889
930
|
: null;
|
|
@@ -1130,6 +1171,17 @@ function parsePendingRow(row) {
|
|
|
1130
1171
|
* text. Rows whose claim is younger than PENDING_REVIEW_CLAIM_TTL_MS are
|
|
1131
1172
|
* skipped (another worker is reviewing them); TTL-expired rows become
|
|
1132
1173
|
* `abandoned(ttl_expired)` here, before any LLM work.
|
|
1174
|
+
*
|
|
1175
|
+
* PRI-1283 review round 2 (directive A4): every claim re-reads the LATEST
|
|
1176
|
+
* conversation-ingestion consent for the row's host. A host whose consent is
|
|
1177
|
+
* no longer granted never yields a claimable candidate — the pending row is
|
|
1178
|
+
* terminated as `abandoned('source_revoked')` right here (CAS on the exact
|
|
1179
|
+
* payload text; the D6 terminal field set drops trigger.text /
|
|
1180
|
+
* trigger.matchedTerms / hostTurnId / task_payload), so the revoked excerpt
|
|
1181
|
+
* can neither be claimed nor keep living in the payload. Revocation is the
|
|
1182
|
+
* linearization point: claims after it see the terminal row, and an
|
|
1183
|
+
* in-flight claim is fenced by `recordPendingCorrectionReview` /
|
|
1184
|
+
* `settlePendingCorrection` (both CAS on `decision='pending_llm_review'`).
|
|
1133
1185
|
*/
|
|
1134
1186
|
export function claimPendingCorrectionCandidates(input) {
|
|
1135
1187
|
const opened = openAdmissionStore(input.workspaceDir, input.databaseFactory);
|
|
@@ -1141,6 +1193,7 @@ export function claimPendingCorrectionCandidates(input) {
|
|
|
1141
1193
|
const limit = Math.min(Math.max(input.limit ?? 2, 1), 8);
|
|
1142
1194
|
const candidates = [];
|
|
1143
1195
|
let expired = 0;
|
|
1196
|
+
let revoked = 0;
|
|
1144
1197
|
try {
|
|
1145
1198
|
const rows = db.prepare(`SELECT * FROM governance_signal_admissions
|
|
1146
1199
|
WHERE decision = 'pending_llm_review' ORDER BY id LIMIT ?`).all(limit * 3);
|
|
@@ -1163,6 +1216,31 @@ export function claimPendingCorrectionCandidates(input) {
|
|
|
1163
1216
|
expired += 1;
|
|
1164
1217
|
continue;
|
|
1165
1218
|
}
|
|
1219
|
+
// Directive A4: latest-consent re-validation at claim time. The row's
|
|
1220
|
+
// own host attribution (host_kind column) is the authority — never the
|
|
1221
|
+
// caller's assumption. The three ledger states mirror the R3 sweep
|
|
1222
|
+
// EXACTLY (one authorization judgment, directive B2):
|
|
1223
|
+
// - a RECORDED non-granted decision (revoked/pending/failed) is a
|
|
1224
|
+
// revocation: the pending row is TERMINATED here (CAS on the exact
|
|
1225
|
+
// payload) instead of yielding a candidate whose text would flow
|
|
1226
|
+
// into a model call;
|
|
1227
|
+
// - a MISSING record is NOT a revocation (the sweep skips it too) —
|
|
1228
|
+
// the lifecycle proceeds; pending rows on ledger-less workspaces
|
|
1229
|
+
// are historical admission-chain output, not revoked material;
|
|
1230
|
+
// - an UNREADABLE ledger fails closed: no claim, no termination.
|
|
1231
|
+
const consentRead = readConversationIngestionConsent(path.resolve(input.workspaceDir), parsed.hostKind === 'workbuddy' ? 'workbuddy' : 'codex');
|
|
1232
|
+
if (!consentRead.ok) {
|
|
1233
|
+
return { ok: false, reason: `pending_claim_consent_unreadable:${consentRead.reason}`, nextAction: `${consentRead.nextAction} — pending rows stay durable and unclaimed until the ledger is readable.` };
|
|
1234
|
+
}
|
|
1235
|
+
if (consentRead.record !== null && consentRead.record.decision !== 'granted') {
|
|
1236
|
+
const { changes } = db.prepare(`UPDATE governance_signal_admissions
|
|
1237
|
+
SET decision = 'abandoned', reason = 'source_revoked', task_payload_json = ?, updated_at = ?
|
|
1238
|
+
WHERE logical_observation_key = ? AND decision = 'pending_llm_review' AND task_payload_json = ?`)
|
|
1239
|
+
.run(pendingTerminalPayload({ decision: 'abandoned', reason: 'source_revoked', attempts: parsed.payload.review.attempts, confidence: null, nowIso }), nowIso, key, parsed.payloadText);
|
|
1240
|
+
if (changes === 1)
|
|
1241
|
+
revoked += 1;
|
|
1242
|
+
continue;
|
|
1243
|
+
}
|
|
1166
1244
|
const ageMs = Date.parse(parsed.createdAt);
|
|
1167
1245
|
if (!Number.isFinite(ageMs) || now.getTime() - ageMs >= PENDING_CANDIDATE_TTL_MS) {
|
|
1168
1246
|
db.prepare(`UPDATE governance_signal_admissions
|
|
@@ -1205,7 +1283,7 @@ export function claimPendingCorrectionCandidates(input) {
|
|
|
1205
1283
|
createdAt: parsed.createdAt,
|
|
1206
1284
|
});
|
|
1207
1285
|
}
|
|
1208
|
-
return { ok: true, candidates, expired };
|
|
1286
|
+
return { ok: true, candidates, expired, revoked };
|
|
1209
1287
|
}
|
|
1210
1288
|
catch (error) {
|
|
1211
1289
|
const detail = error instanceof Error ? error.message.slice(0, 200) : String(error).slice(0, 200);
|
|
@@ -1215,6 +1293,52 @@ export function claimPendingCorrectionCandidates(input) {
|
|
|
1215
1293
|
close();
|
|
1216
1294
|
}
|
|
1217
1295
|
}
|
|
1296
|
+
/**
|
|
1297
|
+
* PRI-1283 review round 2 (directive A5): the LAST authorization gate before
|
|
1298
|
+
* `classifier(candidate.text, …)` starts a model request. Verifies, in one
|
|
1299
|
+
* fresh read, that (a) the row is STILL `pending_llm_review`, (b) this
|
|
1300
|
+
* worker's fencing token still owns the claim, and (c) the row's host still
|
|
1301
|
+
* has granted consent. This is the revocation linearization boundary for NEW
|
|
1302
|
+
* model requests: after a revocation completes (ledger decision or sweep
|
|
1303
|
+
* termination), no fresh classifier call may start on the old source's text.
|
|
1304
|
+
* A request already in flight cannot be recalled — its RESULT is fenced
|
|
1305
|
+
* instead by `recordPendingCorrectionReview` (decision + claimToken CAS).
|
|
1306
|
+
*/
|
|
1307
|
+
export function verifyPendingClaimForClassification(input) {
|
|
1308
|
+
const opened = openAdmissionStore(input.workspaceDir, input.databaseFactory);
|
|
1309
|
+
if (!('db' in opened))
|
|
1310
|
+
return opened;
|
|
1311
|
+
const { db, close } = opened;
|
|
1312
|
+
try {
|
|
1313
|
+
const row = pendingReviewMarkerRow(db, input.logicalObservationKey);
|
|
1314
|
+
if (row === null || rowField(row, 'decision') !== 'pending_llm_review') {
|
|
1315
|
+
return { ok: true, allowed: false, reason: 'not_pending' };
|
|
1316
|
+
}
|
|
1317
|
+
const parsed = parsePendingRow(row);
|
|
1318
|
+
if (parsed === null)
|
|
1319
|
+
return { ok: true, allowed: false, reason: 'payload_invalid' };
|
|
1320
|
+
const currentClaimToken = parsed.payload.review.claimToken;
|
|
1321
|
+
if (currentClaimToken === undefined || currentClaimToken !== input.claimToken) {
|
|
1322
|
+
return { ok: true, allowed: false, reason: 'claim_not_owned' };
|
|
1323
|
+
}
|
|
1324
|
+
// Same three-state ledger semantics as the claim path and the R3 sweep
|
|
1325
|
+
// (one authorization judgment): a RECORDED non-granted decision blocks
|
|
1326
|
+
// the model request; a MISSING record is not a revocation (the claim
|
|
1327
|
+
// path let it through, and so must the pre-classifier gate); an
|
|
1328
|
+
// UNREADABLE ledger fails closed.
|
|
1329
|
+
const consentRead = readConversationIngestionConsent(path.resolve(input.workspaceDir), parsed.hostKind === 'workbuddy' ? 'workbuddy' : 'codex');
|
|
1330
|
+
if (!consentRead.ok) {
|
|
1331
|
+
return { ok: false, reason: `pending_claim_consent_unreadable:${consentRead.reason}`, nextAction: consentRead.nextAction };
|
|
1332
|
+
}
|
|
1333
|
+
if (consentRead.record !== null && consentRead.record.decision !== 'granted') {
|
|
1334
|
+
return { ok: true, allowed: false, reason: consentRead.record.decision === 'revoked' ? 'source_revoked' : 'consent_not_granted' };
|
|
1335
|
+
}
|
|
1336
|
+
return { ok: true, allowed: true };
|
|
1337
|
+
}
|
|
1338
|
+
finally {
|
|
1339
|
+
close();
|
|
1340
|
+
}
|
|
1341
|
+
}
|
|
1218
1342
|
/**
|
|
1219
1343
|
* Release THIS worker's claim when no classification started (budget exhausted
|
|
1220
1344
|
* or classifier unavailable), so the next cycle can re-claim immediately.
|
|
@@ -1670,16 +1794,38 @@ function isGovernanceTaskPayload(value) {
|
|
|
1670
1794
|
// such submissions (the statement itself satisfies the empty-input-evidence
|
|
1671
1795
|
// admission condition).
|
|
1672
1796
|
const correctionEvidence = own(value, 'correctionEvidence');
|
|
1797
|
+
const correctionChannel = isRecord(correctionEvidence) ? own(correctionEvidence, 'channel') : undefined;
|
|
1798
|
+
const correctionText = isRecord(correctionEvidence) ? own(correctionEvidence, 'text') : undefined;
|
|
1673
1799
|
const hasOwnerStatement = isRecord(correctionEvidence)
|
|
1674
1800
|
&& own(correctionEvidence, 'classification') === 'owner_statement'
|
|
1675
|
-
&&
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
&&
|
|
1679
|
-
|
|
1801
|
+
&& typeof correctionText === 'string' && correctionText.length > 0
|
|
1802
|
+
&& (
|
|
1803
|
+
// Direct Owner channels: the channel itself is the credible record.
|
|
1804
|
+
(correctionChannel === 'codex_explicit_prefix' && hostKind === 'codex')
|
|
1805
|
+
|| (correctionChannel === 'workbuddy_explicit_prefix' && hostKind === 'workbuddy')
|
|
1806
|
+
// Agent-assisted: owner_manual ONLY with a bound Owner confirmation
|
|
1807
|
+
// record — kind + fingerprint re-verified against the persisted text
|
|
1808
|
+
// (PRI-1283 round 3; a bare payload claim is never sufficient).
|
|
1809
|
+
|| (correctionChannel === 'codex_explicit_agent' && hostKind === 'codex'
|
|
1810
|
+
&& isOwnerManualCorrectionEvidence(correctionEvidence)));
|
|
1811
|
+
// Agent-derived covers BOTH the current shape (no classification) and the
|
|
1812
|
+
// legacy pre-round-3 shape (`classification:'owner_statement'` written
|
|
1813
|
+
// without a bound confirmation). Those rows are Agent-derived under the
|
|
1814
|
+
// ruling — still valid payloads for task recovery — while a row that
|
|
1815
|
+
// CARRIES an ownerConfirmation the shared judgment cannot verify is a
|
|
1816
|
+
// forged-claim shape and stays rejected.
|
|
1817
|
+
const isAgentDerivedStatement = isRecord(correctionEvidence)
|
|
1818
|
+
&& correctionChannel === 'codex_explicit_agent' && hostKind === 'codex'
|
|
1819
|
+
&& typeof correctionText === 'string' && correctionText.length > 0
|
|
1820
|
+
&& own(correctionEvidence, 'ownerConfirmation') === undefined
|
|
1821
|
+
&& !isOwnerManualCorrectionEvidence(correctionEvidence);
|
|
1822
|
+
if (correctionEvidence !== undefined && !hasOwnerStatement && !isAgentDerivedStatement)
|
|
1680
1823
|
return false;
|
|
1681
1824
|
const evidence = own(value, 'evidence');
|
|
1682
|
-
|
|
1825
|
+
// An explicit submission — owner-confirmed OR agent-derived (CR-02) — is a
|
|
1826
|
+
// first-class input basis, so the evidence array may legitimately be empty
|
|
1827
|
+
// (e.g. conversation-ingestion off → no persisted observation to bind).
|
|
1828
|
+
if (!Array.isArray(evidence) || (evidence.length === 0 && !hasOwnerStatement && !isAgentDerivedStatement) || evidence.length > 8)
|
|
1683
1829
|
return false;
|
|
1684
1830
|
for (const entry of evidence) {
|
|
1685
1831
|
if (!isRecord(entry))
|
|
@@ -1699,6 +1845,22 @@ function isGovernanceTaskPayload(value) {
|
|
|
1699
1845
|
}
|
|
1700
1846
|
return true;
|
|
1701
1847
|
}
|
|
1848
|
+
/**
|
|
1849
|
+
* PRI-1283 round 5 (review): the correction evidence a recovery re-persists
|
|
1850
|
+
* must carry the SAME classification judgment the validator applied — never
|
|
1851
|
+
* the marker's stale label. A legacy pre-round-3 agent-relayed row may still
|
|
1852
|
+
* claim `classification:'owner_statement'` without a bound confirmation; the
|
|
1853
|
+
* shared ruling treats it as Agent-derived, and the current writer shape
|
|
1854
|
+
* carries no classification for agent-derived text. Persisting the stale
|
|
1855
|
+
* claim would let Recall re-serve a false `owner_statement` classification.
|
|
1856
|
+
*/
|
|
1857
|
+
function recoveryCorrectionEvidence(persisted, sessionId) {
|
|
1858
|
+
const next = { ...persisted, sessionId };
|
|
1859
|
+
if (!isOwnerManualCorrectionEvidence(next)) {
|
|
1860
|
+
delete next.classification;
|
|
1861
|
+
}
|
|
1862
|
+
return next;
|
|
1863
|
+
}
|
|
1702
1864
|
/**
|
|
1703
1865
|
* Ensure exactly one pending Diagnostician task exists for an admitted
|
|
1704
1866
|
* canonical pain (SPEC §13). Idempotent across hook retries, reconciliation,
|
|
@@ -1740,6 +1902,61 @@ export async function ensureGovernanceDiagnosticianTask(input) {
|
|
|
1740
1902
|
if (!isGovernanceTaskPayload(payloadParsed)) {
|
|
1741
1903
|
return { ok: false, reason: 'admission_task_payload_invalid', nextAction: 're-admit the signal or run reconciliation after repairing the workspace state' };
|
|
1742
1904
|
}
|
|
1905
|
+
const hasExistingTaskLink = typeof existingTaskId === 'string' && existingTaskId.length > 0;
|
|
1906
|
+
const markerHostKind = payloadParsed.hostKind;
|
|
1907
|
+
const { correctionEvidence } = payloadParsed;
|
|
1908
|
+
const ownerManual = isOwnerManualCorrectionEvidence(correctionEvidence);
|
|
1909
|
+
const agentAssistedExplicit = isRecord(correctionEvidence)
|
|
1910
|
+
&& correctionEvidence.channel === 'codex_explicit_agent'
|
|
1911
|
+
&& !ownerManual;
|
|
1912
|
+
const sourceAuthorization = markerHostKind === 'codex' || markerHostKind === 'workbuddy'
|
|
1913
|
+
? readSourceMaterialAuthorization({ workspaceDir, hostKind: markerHostKind })
|
|
1914
|
+
: undefined;
|
|
1915
|
+
// Every blocked authorization state (including a missing ledger) forbids
|
|
1916
|
+
// historical observation reads. A missing ledger is not a revocation, so
|
|
1917
|
+
// it is handled by the ingress evidence gate below rather than the sweep
|
|
1918
|
+
// remediation branch.
|
|
1919
|
+
const sourceMaterialReadable = sourceAuthorization === undefined
|
|
1920
|
+
|| sourceAuthorization.status !== 'blocked';
|
|
1921
|
+
// A linked task remains idempotently reportable after revocation, but the
|
|
1922
|
+
// marker must not trigger a historical observation read on that path.
|
|
1923
|
+
if (hasExistingTaskLink && !sourceMaterialReadable) {
|
|
1924
|
+
return { ok: true, taskId: existingTaskId, created: false, duplicate: true, linkRepaired: false };
|
|
1925
|
+
}
|
|
1926
|
+
// After revocation, repair a crash-after-create task link without reading
|
|
1927
|
+
// the historical observation. An agent-assisted explicit statement is
|
|
1928
|
+
// still Agent-derived: even a missing ledger cannot authorize re-persisting
|
|
1929
|
+
// it into a NEW task. A direct Owner channel remains independently allowed.
|
|
1930
|
+
if (!ownerManual && sourceAuthorization?.status === 'blocked'
|
|
1931
|
+
&& (sourceAuthorization.reason !== 'consent_missing' || agentAssistedExplicit)) {
|
|
1932
|
+
const taskId = createDiagnosticianTaskId(input.canonicalPainId);
|
|
1933
|
+
const stateManager = new RuntimeStateManager({ workspaceDir });
|
|
1934
|
+
try {
|
|
1935
|
+
await stateManager.initialize();
|
|
1936
|
+
const existing = await stateManager.getTask(taskId);
|
|
1937
|
+
if (existing !== null) {
|
|
1938
|
+
db.prepare('UPDATE governance_signal_admissions SET diagnostician_task_id = ?, updated_at = ? WHERE logical_observation_key = ?')
|
|
1939
|
+
.run(taskId, new Date().toISOString(), input.logicalObservationKey);
|
|
1940
|
+
return { ok: true, taskId, created: false, duplicate: true, linkRepaired: true };
|
|
1941
|
+
}
|
|
1942
|
+
}
|
|
1943
|
+
finally {
|
|
1944
|
+
await stateManager.close().catch(() => undefined);
|
|
1945
|
+
}
|
|
1946
|
+
return {
|
|
1947
|
+
ok: false,
|
|
1948
|
+
reason: sourceAuthorization.reason === 'consent_missing'
|
|
1949
|
+
? 'pain_ingress_agent_assisted_consent_required'
|
|
1950
|
+
: 'source_authorization_revoked',
|
|
1951
|
+
nextAction: sourceAuthorization.reason === 'consent_missing'
|
|
1952
|
+
? 'The Codex agent-assisted wording is Agent-derived; record a Codex conversation-ingestion consent grant before creating a diagnostic task, or use the direct Owner explicit prefix for Owner-authored words.'
|
|
1953
|
+
: sourceAuthorization.reason === 'consent_unreadable'
|
|
1954
|
+
? 'repair the consent ledger first (<workspace>/.state/conversation-ingestion-consent.json is unreadable); the sweep refuses to run until the authority is readable'
|
|
1955
|
+
: sourceAuthorization.reason === 'consent_revoked'
|
|
1956
|
+
? `purge persisted copies first: pd consent sweep-revoked --workspace "${workspaceDir}" --apply (host: ${markerHostKind})`
|
|
1957
|
+
: `resolve the pending or failed conversation-ingestion consent decision for ${markerHostKind} in "${workspaceDir}" before retrying; a revocation sweep is only appropriate after the ledger records a revocation`,
|
|
1958
|
+
};
|
|
1959
|
+
}
|
|
1743
1960
|
// SPEC v0.3.1 §1.2: provenance is DERIVED from the marker's ingress facts,
|
|
1744
1961
|
// never hardcoded. The marker is host-context-bound by construction, and
|
|
1745
1962
|
// its payload carries the evidence entries that make this a `submit`.
|
|
@@ -1748,7 +1965,6 @@ export async function ensureGovernanceDiagnosticianTask(input) {
|
|
|
1748
1965
|
const hostTurnId = payloadParsed.hostKind === 'codex'
|
|
1749
1966
|
? (markerKey.split('|')[2] ?? markerKey)
|
|
1750
1967
|
: (markerKey.lastIndexOf('|') > 0 ? markerKey.slice(0, markerKey.lastIndexOf('|')) : markerKey);
|
|
1751
|
-
const markerHostKind = payloadParsed.hostKind;
|
|
1752
1968
|
// P1 review round 3: never trust the payload's evidence list — re-derive it
|
|
1753
1969
|
// from trajectory.db with the full lineage tuple. A marker that references a
|
|
1754
1970
|
// non-existent observation (or a WorkBuddy automatic correction) evaluates
|
|
@@ -1758,16 +1974,18 @@ export async function ensureGovernanceDiagnosticianTask(input) {
|
|
|
1758
1974
|
// run for it. Only corrections are gated on a real observation.
|
|
1759
1975
|
const isCorrectionPayload = payloadParsed.painType !== 'tool_failure';
|
|
1760
1976
|
const ingressEvidence = isCorrectionPayload && (markerHostKind === 'codex' || markerHostKind === 'workbuddy')
|
|
1761
|
-
?
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1977
|
+
? (sourceMaterialReadable
|
|
1978
|
+
? correctionIngressEvidence({
|
|
1979
|
+
db,
|
|
1980
|
+
hostKind: markerHostKind,
|
|
1981
|
+
logicalObservationKey: markerKey,
|
|
1982
|
+
rolloutIdentity: typeof rolloutIdentity === 'string' ? rolloutIdentity : '',
|
|
1983
|
+
rootSessionId: payloadParsed.sessionId,
|
|
1984
|
+
hostTurnId,
|
|
1985
|
+
text: payloadParsed.reason,
|
|
1986
|
+
workspaceDir,
|
|
1987
|
+
})
|
|
1988
|
+
: [])
|
|
1771
1989
|
: payloadParsed.evidence.map((entry) => ({
|
|
1772
1990
|
kind: 'behavior_trace',
|
|
1773
1991
|
sourceRef: entry.sourceRef,
|
|
@@ -1780,31 +1998,32 @@ export async function ensureGovernanceDiagnosticianTask(input) {
|
|
|
1780
1998
|
// source. An explicit Owner statement is owner_manual (manual_pain_id,
|
|
1781
1999
|
// correctionEvidence channel); everything else is the automatic hook.
|
|
1782
2000
|
const ownerChannel = payloadParsed.correctionEvidence?.channel;
|
|
1783
|
-
const
|
|
2001
|
+
const ingressFacts = {
|
|
2002
|
+
hostKind: markerHostKind,
|
|
2003
|
+
logicalObservationKey: markerKey,
|
|
2004
|
+
rolloutIdentity: typeof rolloutIdentity === 'string' ? rolloutIdentity : '',
|
|
2005
|
+
rootSessionId: payloadParsed.sessionId,
|
|
2006
|
+
hostTurnId,
|
|
2007
|
+
painId: input.canonicalPainId,
|
|
2008
|
+
reason: payloadParsed.reason,
|
|
2009
|
+
evidence: ingressEvidence,
|
|
2010
|
+
};
|
|
2011
|
+
const ingressDecision = ownerManual && ownerChannel !== undefined
|
|
1784
2012
|
? evaluatePainIngress(buildOwnerCorrectionIngressReport({
|
|
1785
|
-
|
|
2013
|
+
...ingressFacts,
|
|
1786
2014
|
channel: ownerChannel,
|
|
1787
|
-
logicalObservationKey: markerKey,
|
|
1788
|
-
rolloutIdentity: typeof rolloutIdentity === 'string' ? rolloutIdentity : '',
|
|
1789
|
-
rootSessionId: payloadParsed.sessionId,
|
|
1790
|
-
hostTurnId,
|
|
1791
|
-
painId: input.canonicalPainId,
|
|
1792
|
-
reason: payloadParsed.reason,
|
|
1793
|
-
// CR-02: never fabricate transcript evidence for an Owner statement;
|
|
1794
|
-
// an empty list is the honest basis and bound explicit reports
|
|
1795
|
-
// legitimately degrade.
|
|
1796
|
-
evidence: ingressEvidence,
|
|
1797
2015
|
}))
|
|
1798
|
-
:
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
2016
|
+
: agentAssistedExplicit && markerHostKind === 'codex'
|
|
2017
|
+
? evaluatePainIngress(buildAgentAssistedCorrectionIngressReport({
|
|
2018
|
+
logicalObservationKey: ingressFacts.logicalObservationKey,
|
|
2019
|
+
rolloutIdentity: ingressFacts.rolloutIdentity,
|
|
2020
|
+
rootSessionId: ingressFacts.rootSessionId,
|
|
2021
|
+
hostTurnId: ingressFacts.hostTurnId,
|
|
2022
|
+
painId: ingressFacts.painId,
|
|
2023
|
+
reason: ingressFacts.reason,
|
|
2024
|
+
evidence: ingressFacts.evidence,
|
|
2025
|
+
}))
|
|
2026
|
+
: evaluatePainIngress(buildCorrectionIngressReport(ingressFacts));
|
|
1808
2027
|
if (ingressDecision.action === 'refuse' || ingressDecision.action === 'observation_only') {
|
|
1809
2028
|
// Fail closed: an inconsistent/evidence-less admitted marker must not
|
|
1810
2029
|
// silently become a task (and must never be relabelled automatic_hook).
|
|
@@ -1824,9 +2043,9 @@ export async function ensureGovernanceDiagnosticianTask(input) {
|
|
|
1824
2043
|
// the historical provenance rather than inventing an ingress report.
|
|
1825
2044
|
provenance = 'host_context_bound';
|
|
1826
2045
|
}
|
|
1827
|
-
//
|
|
1828
|
-
//
|
|
1829
|
-
//
|
|
2046
|
+
// Preserve the existing fail-closed validation for linked tasks while
|
|
2047
|
+
// consent is readable. The revoked path above returns without transcript
|
|
2048
|
+
// access because the already-linked task is durable.
|
|
1830
2049
|
if (typeof existingTaskId === 'string' && existingTaskId.length > 0) {
|
|
1831
2050
|
return {
|
|
1832
2051
|
ok: true,
|
|
@@ -1860,6 +2079,35 @@ export async function ensureGovernanceDiagnosticianTask(input) {
|
|
|
1860
2079
|
await stateManager.initialize();
|
|
1861
2080
|
let existing = await stateManager.getTask(taskId);
|
|
1862
2081
|
if (existing === null) {
|
|
2082
|
+
// PRI-1283 round 4 (SEC finding): after the host's ingestion consent
|
|
2083
|
+
// left granted, recovering this marker must not re-persist governed
|
|
2084
|
+
// conversation material into a NEW diagnostic task — the copy would
|
|
2085
|
+
// outlive the pending sweep. An owner-manual statement is exempt (an
|
|
2086
|
+
// explicit submission is not conversation ingestion). The check runs
|
|
2087
|
+
// only on the create path: a task already persisted before the
|
|
2088
|
+
// crash still gets its link repaired above/below.
|
|
2089
|
+
if ((markerHostKind === 'codex' || markerHostKind === 'workbuddy')
|
|
2090
|
+
&& !ownerManual) {
|
|
2091
|
+
// A MISSING ledger is not a revocation (the sweep treats it the
|
|
2092
|
+
// same); refuse only on a recorded non-granted decision or an
|
|
2093
|
+
// unreadable one.
|
|
2094
|
+
const authz = readSourceMaterialAuthorization({ workspaceDir, hostKind: markerHostKind });
|
|
2095
|
+
if (authz.status === 'blocked'
|
|
2096
|
+
&& authz.reason !== 'consent_missing') {
|
|
2097
|
+
return {
|
|
2098
|
+
ok: false,
|
|
2099
|
+
reason: 'source_authorization_revoked',
|
|
2100
|
+
// An unreadable ledger cannot be swept (the sweep refuses to
|
|
2101
|
+
// purge against an unreadable authority) — point at the ledger
|
|
2102
|
+
// repair FIRST instead of a command that cannot run.
|
|
2103
|
+
nextAction: authz.reason === 'consent_unreadable'
|
|
2104
|
+
? `repair the consent ledger first (<workspace>/.state/conversation-ingestion-consent.json is unreadable); the sweep refuses to run until the authority is readable`
|
|
2105
|
+
: authz.reason === 'consent_revoked'
|
|
2106
|
+
? `purge persisted copies first: pd consent sweep-revoked --workspace "${workspaceDir}" --apply (host: ${markerHostKind})`
|
|
2107
|
+
: `resolve the pending or failed conversation-ingestion consent decision for ${markerHostKind} in "${workspaceDir}" before retrying; a revocation sweep is only appropriate after the ledger records a revocation`,
|
|
2108
|
+
};
|
|
2109
|
+
}
|
|
2110
|
+
}
|
|
1863
2111
|
const stateDir = path.join(workspaceDir, '.state');
|
|
1864
2112
|
const config = loadPdConfigForPlugin(workspaceDir);
|
|
1865
2113
|
if (!config.ok) {
|
|
@@ -1899,7 +2147,9 @@ export async function ensureGovernanceDiagnosticianTask(input) {
|
|
|
1899
2147
|
// CR-02: replay the explicit Owner statement verbatim (classified,
|
|
1900
2148
|
// channel-disclosed) so re-created tasks keep the same input basis.
|
|
1901
2149
|
...(payloadParsed.correctionEvidence !== undefined
|
|
1902
|
-
? {
|
|
2150
|
+
? {
|
|
2151
|
+
correctionEvidence: recoveryCorrectionEvidence(payloadParsed.correctionEvidence, payloadParsed.sessionId),
|
|
2152
|
+
}
|
|
1903
2153
|
: {}),
|
|
1904
2154
|
recordObservability: true,
|
|
1905
2155
|
});
|
|
@@ -1986,9 +2236,15 @@ export async function ensureGovernanceContinuation(input) {
|
|
|
1986
2236
|
// continuation cannot begin diagnosis before the eligible evidence window
|
|
1987
2237
|
// has been promoted. A promotion failure is retained as a degradation,
|
|
1988
2238
|
// but never prevents the task from being durably ensured.
|
|
1989
|
-
|
|
2239
|
+
// PRI-1283 R2: the caller-supplied flag is necessary but NOT sufficient —
|
|
2240
|
+
// the consent LEDGER is re-read here so a revocation recorded against a
|
|
2241
|
+
// still-enabled flag cannot keep promoting old observations (the flag is
|
|
2242
|
+
// runtime authority for ingestion; the ledger is the governance record).
|
|
2243
|
+
const codexFlagConsent = typeof input.codexConversationIngestionEnabled === 'boolean'
|
|
1990
2244
|
? input.codexConversationIngestionEnabled
|
|
1991
2245
|
: input.conversationIngestionEnabled === true;
|
|
2246
|
+
const codexLedgerConsent = readSourceMaterialAuthorization({ workspaceDir, hostKind: 'codex' });
|
|
2247
|
+
const codexConsent = codexFlagConsent && codexLedgerConsent.status === 'authorized';
|
|
1992
2248
|
const promoted = codexConsent
|
|
1993
2249
|
? promoteAdmittedGovernanceEvidence({
|
|
1994
2250
|
workspaceDir,
|
|
@@ -2028,9 +2284,14 @@ export async function reconcileGovernanceContinuation(input) {
|
|
|
2028
2284
|
const workspaceDir = path.resolve(input.workspaceDir);
|
|
2029
2285
|
// Accept the pre-rename field too: an older caller paired with this runtime
|
|
2030
2286
|
// must not silently lose Codex evidence promotion (P2 review).
|
|
2031
|
-
|
|
2287
|
+
// PRI-1283 R2: the flag input is ANDed with a LIVE consent-ledger read —
|
|
2288
|
+
// reconciliation must stop promoting observations the moment the ledger
|
|
2289
|
+
// records a revocation, even if the runtime flag lags behind.
|
|
2290
|
+
const codexFlagConsent = typeof input.codexConversationIngestionEnabled === 'boolean'
|
|
2032
2291
|
? input.codexConversationIngestionEnabled
|
|
2033
2292
|
: input.conversationIngestionEnabled === true;
|
|
2293
|
+
const codexLedgerConsent = readSourceMaterialAuthorization({ workspaceDir, hostKind: 'codex' });
|
|
2294
|
+
const codexConsent = codexFlagConsent && codexLedgerConsent.status === 'authorized';
|
|
2034
2295
|
const opened = openAdmissionStore(input.workspaceDir, input.databaseFactory);
|
|
2035
2296
|
if (!('db' in opened)) {
|
|
2036
2297
|
return { ok: false, reason: opened.reason, nextAction: opened.nextAction, tasksEnsured: 0, linksRepaired: 0, pendingTails: 0, completedTails: 0, staleTails: 0, degradations: [opened.reason] };
|