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
|
@@ -11,3 +11,20 @@ export declare class CodexDecoderError extends Error {
|
|
|
11
11
|
constructor(reason: string, nextAction: string);
|
|
12
12
|
}
|
|
13
13
|
export declare function decodeCodexInput(raw: unknown): HostEvent;
|
|
14
|
+
/** The MCP server ids whose `pd_submit_pain` the receipt fallback serves:
|
|
15
|
+
* the configured id (`pd-recall`) and its identifier-sanitized spelling. */
|
|
16
|
+
export declare const PAIN_SUBMIT_MCP_SERVER_IDS: ReadonlySet<string>;
|
|
17
|
+
export interface ParsedMcpToolName {
|
|
18
|
+
readonly serverId: string;
|
|
19
|
+
readonly toolId: string;
|
|
20
|
+
}
|
|
21
|
+
/** Decompose a Codex MCP tool name into (serverId, toolId); null when the
|
|
22
|
+
* name is not a namespaced MCP tool name. No substring semantics. */
|
|
23
|
+
export declare function parseCodexMcpToolName(toolName: string): ParsedMcpToolName | null;
|
|
24
|
+
/**
|
|
25
|
+
* Exact gate for the PostToolUse receipt fallback: the tool must be
|
|
26
|
+
* `pd_submit_pain` served by the PD MCP server (`pd-recall`). Every other
|
|
27
|
+
* tool — including an identically-named tool on a DIFFERENT MCP server —
|
|
28
|
+
* fails (equality on both parsed segments, never a substring match).
|
|
29
|
+
*/
|
|
30
|
+
export declare function isPainSubmitPostToolUseToolName(toolName: string): boolean;
|
|
@@ -111,3 +111,42 @@ export function decodeCodexInput(raw) {
|
|
|
111
111
|
const source = `codex:${eventName.replace(/([a-z0-9])([A-Z])/g, '$1_$2').toLowerCase()}`;
|
|
112
112
|
return { kind, context, rawPayload, source };
|
|
113
113
|
}
|
|
114
|
+
// ── PRI-1274 (B1 / P1-1): MCP tool-name namespace on PostToolUse ─────────────
|
|
115
|
+
//
|
|
116
|
+
// Codex reports MCP tool calls under the server-namespaced form
|
|
117
|
+
// `mcp__<serverId>__<toolId>`. Evidence for the installed codex-cli 0.171.0:
|
|
118
|
+
// the binary's own format template `mcp__{}__{}`, its server-name charset
|
|
119
|
+
// check `^[a-zA-Z0-9_-]+$` with a reserved `mcp__` namespace, and its
|
|
120
|
+
// desktop-context string "MCP tools keep standard MCP identifiers such as
|
|
121
|
+
// `mcp__server__tool`". Runtime capture (Gate 2, 2026-10-31): the server
|
|
122
|
+
// configured as `pd-recall` (plugins/principles-disciple/.mcp.json) surfaced
|
|
123
|
+
// as `mcp__pd_recall__pd_recall_principle_pains` — non-identifier characters
|
|
124
|
+
// in the server id are sanitized to `_`, so BOTH spellings must be accepted.
|
|
125
|
+
//
|
|
126
|
+
// Parsing splits at the FIRST `__` after the `mcp__` prefix: a server id
|
|
127
|
+
// containing `__` would mis-parse, but such a name can never equal the
|
|
128
|
+
// accepted ids below, so foreign servers stay isolated regardless.
|
|
129
|
+
/** The MCP server ids whose `pd_submit_pain` the receipt fallback serves:
|
|
130
|
+
* the configured id (`pd-recall`) and its identifier-sanitized spelling. */
|
|
131
|
+
export const PAIN_SUBMIT_MCP_SERVER_IDS = new Set(['pd-recall', 'pd_recall']);
|
|
132
|
+
/** Decompose a Codex MCP tool name into (serverId, toolId); null when the
|
|
133
|
+
* name is not a namespaced MCP tool name. No substring semantics. */
|
|
134
|
+
export function parseCodexMcpToolName(toolName) {
|
|
135
|
+
if (!toolName.startsWith('mcp__'))
|
|
136
|
+
return null;
|
|
137
|
+
const rest = toolName.slice('mcp__'.length);
|
|
138
|
+
const separator = rest.indexOf('__');
|
|
139
|
+
if (separator <= 0 || separator + 2 >= rest.length)
|
|
140
|
+
return null;
|
|
141
|
+
return { serverId: rest.slice(0, separator), toolId: rest.slice(separator + 2) };
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Exact gate for the PostToolUse receipt fallback: the tool must be
|
|
145
|
+
* `pd_submit_pain` served by the PD MCP server (`pd-recall`). Every other
|
|
146
|
+
* tool — including an identically-named tool on a DIFFERENT MCP server —
|
|
147
|
+
* fails (equality on both parsed segments, never a substring match).
|
|
148
|
+
*/
|
|
149
|
+
export function isPainSubmitPostToolUseToolName(toolName) {
|
|
150
|
+
const parsed = parseCodexMcpToolName(toolName);
|
|
151
|
+
return parsed !== null && PAIN_SUBMIT_MCP_SERVER_IDS.has(parsed.serverId) && parsed.toolId === 'pd_submit_pain';
|
|
152
|
+
}
|
|
@@ -19,10 +19,119 @@
|
|
|
19
19
|
* - No LLM runs here: admission + durable enqueue only, well inside the
|
|
20
20
|
* 5s hook budget; the receipt carries painId/taskId.
|
|
21
21
|
*/
|
|
22
|
-
import
|
|
22
|
+
import fs from 'node:fs';
|
|
23
|
+
import { admitGovernanceSignals, ensureGovernanceDiagnosticianTask, promoteAdmittedGovernanceEvidence, readSourceMaterialAuthorization, } from '@principles/host-runtime';
|
|
23
24
|
import { resolveCodexHome } from './codex-home.js';
|
|
24
25
|
import { validateCodexTranscriptPath } from './transcript-path.js';
|
|
25
26
|
import { extractFields } from './ingestion-fields.js';
|
|
27
|
+
function isRecord(value) {
|
|
28
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
29
|
+
}
|
|
30
|
+
function own(value, key) {
|
|
31
|
+
return Object.hasOwn(value, key) ? Object.getOwnPropertyDescriptor(value, key)?.value : undefined;
|
|
32
|
+
}
|
|
33
|
+
/** Bounded tail read: the current turn's user record sits at the end. */
|
|
34
|
+
const VERBATIM_VERIFY_MAX_BYTES = 4 * 1024 * 1024;
|
|
35
|
+
/**
|
|
36
|
+
* PRI-1283 round 3 (owner_manual ruling): the trusted Owner interaction
|
|
37
|
+
* record for the agent-assisted (`pd pain explicit`) channel. The submitted
|
|
38
|
+
* statement is confirmed ONLY when it appears VERBATIM inside the CURRENT
|
|
39
|
+
* turn's genuine user message in the host-validated transcript — i.e. the
|
|
40
|
+
* Owner typed exactly those words, so the final submitted content is what
|
|
41
|
+
* the Owner wrote, not an agent's paraphrase, summary or invention.
|
|
42
|
+
*
|
|
43
|
+
* Reads the same two user-turn record shapes the governance decoder
|
|
44
|
+
* projects (response_item user.text / event_msg UserMessage item_completed)
|
|
45
|
+
* so the confirmation is anchored on the SAME host-written substrate —
|
|
46
|
+
* never on anything the agent claimed. Transcript CONTENT is only read here
|
|
47
|
+
* under the conversation-ingestion consent (callers pass the flag); the
|
|
48
|
+
* check fails closed (no confirmation) on any read/parse problem.
|
|
49
|
+
*/
|
|
50
|
+
function verifyOwnerVerbatimTurnMatch(args) {
|
|
51
|
+
const needle = args.statementText;
|
|
52
|
+
if (needle.length === 0)
|
|
53
|
+
return false;
|
|
54
|
+
let fd = null;
|
|
55
|
+
try {
|
|
56
|
+
fd = fs.openSync(args.validated.canonicalPath, 'r');
|
|
57
|
+
const stat = fs.fstatSync(fd);
|
|
58
|
+
// Post-open revalidation: same physical file the path validator proved.
|
|
59
|
+
if (stat.dev !== args.validated.identity.dev || stat.ino !== args.validated.identity.ino)
|
|
60
|
+
return false;
|
|
61
|
+
const start = Math.max(0, stat.size - VERBATIM_VERIFY_MAX_BYTES);
|
|
62
|
+
const length = Math.min(VERBATIM_VERIFY_MAX_BYTES, stat.size);
|
|
63
|
+
const buffer = Buffer.alloc(length);
|
|
64
|
+
const read = fs.readSync(fd, buffer, 0, length, start);
|
|
65
|
+
const text = buffer.subarray(0, read).toString('utf8');
|
|
66
|
+
const lines = text.split('\n');
|
|
67
|
+
for (const line of lines) {
|
|
68
|
+
const trimmed = line.trim();
|
|
69
|
+
if (trimmed.length === 0)
|
|
70
|
+
continue;
|
|
71
|
+
let record;
|
|
72
|
+
try {
|
|
73
|
+
record = JSON.parse(trimmed);
|
|
74
|
+
}
|
|
75
|
+
catch {
|
|
76
|
+
continue;
|
|
77
|
+
}
|
|
78
|
+
if (!isRecord(record))
|
|
79
|
+
continue;
|
|
80
|
+
const payload = own(record, 'payload');
|
|
81
|
+
if (!isRecord(payload))
|
|
82
|
+
continue;
|
|
83
|
+
const recordType = own(record, 'type');
|
|
84
|
+
if (recordType === 'response_item' && own(payload, 'type') === 'message' && own(payload, 'role') === 'user') {
|
|
85
|
+
const passthrough = own(payload, 'internal_chat_message_metadata_passthrough');
|
|
86
|
+
if (!isRecord(passthrough) || own(passthrough, 'turn_id') !== args.turnId)
|
|
87
|
+
continue;
|
|
88
|
+
const kinds = own(passthrough, 'content_item_kinds');
|
|
89
|
+
if (!Array.isArray(kinds) || kinds[0] !== 'user.text')
|
|
90
|
+
continue;
|
|
91
|
+
const content = own(payload, 'content');
|
|
92
|
+
if (!Array.isArray(content))
|
|
93
|
+
continue;
|
|
94
|
+
const parts = [];
|
|
95
|
+
for (const item of content) {
|
|
96
|
+
if (isRecord(item) && own(item, 'type') === 'input_text' && typeof own(item, 'text') === 'string')
|
|
97
|
+
parts.push(own(item, 'text'));
|
|
98
|
+
}
|
|
99
|
+
if (parts.join('').includes(needle))
|
|
100
|
+
return true;
|
|
101
|
+
continue;
|
|
102
|
+
}
|
|
103
|
+
if (recordType === 'event_msg' && own(payload, 'type') === 'item_completed' && own(payload, 'turn_id') === args.turnId) {
|
|
104
|
+
const item = own(payload, 'item');
|
|
105
|
+
if (!isRecord(item) || own(item, 'type') !== 'UserMessage')
|
|
106
|
+
continue;
|
|
107
|
+
const content = own(item, 'content');
|
|
108
|
+
if (!Array.isArray(content))
|
|
109
|
+
continue;
|
|
110
|
+
const parts = [];
|
|
111
|
+
for (const entry of content) {
|
|
112
|
+
if (isRecord(entry) && (own(entry, 'type') === 'text' || own(entry, 'type') === 'Text') && typeof own(entry, 'text') === 'string')
|
|
113
|
+
parts.push(own(entry, 'text'));
|
|
114
|
+
}
|
|
115
|
+
if (parts.join('').includes(needle))
|
|
116
|
+
return true;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
return false;
|
|
120
|
+
}
|
|
121
|
+
catch {
|
|
122
|
+
return false;
|
|
123
|
+
}
|
|
124
|
+
finally {
|
|
125
|
+
if (fd !== null) {
|
|
126
|
+
try {
|
|
127
|
+
fs.closeSync(fd);
|
|
128
|
+
}
|
|
129
|
+
catch {
|
|
130
|
+
// best-effort close
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
26
135
|
export { OWNER_STATEMENT_PREFIX as CODEX_OWNER_STATEMENT_PREFIX, MAX_OWNER_STATEMENT_CHARS, parseOwnerStatementPrefix } from '@principles/host-runtime';
|
|
27
136
|
/**
|
|
28
137
|
* Persist one explicit Owner statement. The consent-gated conversation
|
|
@@ -69,6 +178,21 @@ export async function recordExplicitOwnerStatement(args) {
|
|
|
69
178
|
observedAt: new Date().toISOString(),
|
|
70
179
|
explicitOwnerStatement: true,
|
|
71
180
|
...(args.explicitChannel !== undefined ? { explicitChannel: args.explicitChannel } : {}),
|
|
181
|
+
// PRI-1283 round 3 (owner_manual ruling): an agent-assisted statement is
|
|
182
|
+
// owner_manual ONLY when the submitted text matches the Owner's own words
|
|
183
|
+
// in the current turn's transcript record. The check reads transcript
|
|
184
|
+
// CONTENT, so it runs only under the conversation-ingestion consent;
|
|
185
|
+
// when consent is off (or the match fails) the statement persists as
|
|
186
|
+
// Agent-derived — classified down, never rejected outright.
|
|
187
|
+
...(args.explicitChannel === 'codex_explicit_agent' && args.conversationIngestionEnabled
|
|
188
|
+
// Transcript content is consent-governed material: the feature flag
|
|
189
|
+
// alone is not the authority — the consent ledger must still grant
|
|
190
|
+
// codex ingestion before any confirmation reads transcript content
|
|
191
|
+
// (a revoked-but-still-flagged workspace must not mint exemptions).
|
|
192
|
+
&& readSourceMaterialAuthorization({ workspaceDir: args.workspaceDir, hostKind: 'codex' }).status === 'authorized'
|
|
193
|
+
&& verifyOwnerVerbatimTurnMatch({ validated, turnId: fields.turnId, statementText: args.statementText })
|
|
194
|
+
? { ownerVerbatimConfirmed: true }
|
|
195
|
+
: {}),
|
|
72
196
|
};
|
|
73
197
|
const admitted = admitGovernanceSignals({ workspaceDir: args.workspaceDir, candidates: [candidate] });
|
|
74
198
|
if (!admitted.ok) {
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { type PainReceiptRecoveryOutcome } from '@principles/core/runtime';
|
|
2
|
+
/** The MCP tool id this fallback processes (the server gate lives in the
|
|
3
|
+
* codec parser — exact match on both namespace segments, never a pattern). */
|
|
4
|
+
export declare const PAIN_SUBMIT_TOOL_NAME: 'pd_submit_pain';
|
|
5
|
+
export type PainReceiptFallbackResult = {
|
|
6
|
+
readonly status: 'not_applicable';
|
|
7
|
+
} | {
|
|
8
|
+
readonly status: 'attempted';
|
|
9
|
+
readonly outcome: PainReceiptRecoveryOutcome;
|
|
10
|
+
};
|
|
11
|
+
export interface PainReceiptFallbackInput {
|
|
12
|
+
readonly workspaceDir: string;
|
|
13
|
+
/** Raw host event `tool_name` — gated by the codec MCP namespace parser
|
|
14
|
+
* before anything else happens (P1-1). */
|
|
15
|
+
readonly toolName: string;
|
|
16
|
+
/** Raw `tool_response` from the PostToolUse payload. */
|
|
17
|
+
readonly toolResponse: unknown;
|
|
18
|
+
/** Host-authoritative identity from the event itself. */
|
|
19
|
+
readonly identity: {
|
|
20
|
+
readonly sessionId: string;
|
|
21
|
+
readonly turnId?: string;
|
|
22
|
+
readonly toolCallId: string;
|
|
23
|
+
};
|
|
24
|
+
/** Caller-resolved `host_identity_minimal_metadata` flag verdict. */
|
|
25
|
+
readonly minimalMetadataGranted: boolean;
|
|
26
|
+
readonly now?: () => Date;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* P1-3: does the authorized governance store already hold readable text for
|
|
30
|
+
* the EXACT (session, turn)? Shared by the receipt fallback (disposition
|
|
31
|
+
* choice) and the workspace worker's waiting-task reconcile (the flip) —
|
|
32
|
+
* the diagnosis itself re-reads the turn through the same store.
|
|
33
|
+
* Unreadable ⇒ missing.
|
|
34
|
+
*/
|
|
35
|
+
export declare function codexTargetTurnTextAvailable(workspaceDir: string, sessionId: string, turnId: string): boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Attempt the receipt fallback for one PostToolUse event. Never throws —
|
|
38
|
+
* every failure is a structured result the hook surfaces as one bounded
|
|
39
|
+
* diagnostic (rc-9); the hook result itself is unaffected (fail-open belt).
|
|
40
|
+
*/
|
|
41
|
+
export declare function attemptPainReceiptFallback(input: PainReceiptFallbackInput): Promise<PainReceiptFallbackResult>;
|
|
42
|
+
/**
|
|
43
|
+
* One bounded stderr diagnostic line for the hook (ids and codes only —
|
|
44
|
+
* never receipt content, prompts or tool input/output).
|
|
45
|
+
*/
|
|
46
|
+
export declare function painReceiptFallbackDiagnostic(result: PainReceiptFallbackResult): string | null;
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PRI-1274 (B1) — Codex PostToolUse structured-receipt fallback.
|
|
3
|
+
*
|
|
4
|
+
* When a `pd_submit_pain` MCP request carried no trusted host `_meta`, the
|
|
5
|
+
* original Pain/Task was legally persisted unbound. Codex's formal
|
|
6
|
+
* PostToolUse completion event then carries PD's own structured receipt in
|
|
7
|
+
* `tool_response` — the MCP envelope is a SINGLE text content block with the
|
|
8
|
+
* JSON in `content[0].text` (never `structuredContent`; the adapter owns
|
|
9
|
+
* this host envelope shape and must not extrapolate it to other hosts).
|
|
10
|
+
* Together with the event's own host-authoritative identity
|
|
11
|
+
* (`session_id` / `turn_id` / `tool_use_id` — never model parameters), this
|
|
12
|
+
* module restores the SAME original task's submission identity through the
|
|
13
|
+
* Core CAS recovery.
|
|
14
|
+
*
|
|
15
|
+
* P1-1 (review round 2): Codex reports MCP tools under the server
|
|
16
|
+
* namespace — the gate is an exact parse of `mcp__<server>__<tool>` against
|
|
17
|
+
* the PD server (`pd-recall`, sanitized `pd_recall`) + `pd_submit_pain`
|
|
18
|
+
* (see codec/input-decoder.ts for the format evidence). A bare
|
|
19
|
+
* `pd_submit_pain` or an identically-named tool on another MCP server never
|
|
20
|
+
* enters this path.
|
|
21
|
+
*
|
|
22
|
+
* Authorization: the Workspace-level `host_identity_minimal_metadata` quiet
|
|
23
|
+
* flag — deliberately INDEPENDENT of `codex_conversation_ingestion` (full
|
|
24
|
+
* conversation ingestion may stay off; this path reads no transcript and
|
|
25
|
+
* persists ids only).
|
|
26
|
+
*
|
|
27
|
+
* No recovery is EVER attempted from free text, ordinary EventLog
|
|
28
|
+
* `tool_call` rows, or look-alike strings (SPEC TD §1.3).
|
|
29
|
+
*/
|
|
30
|
+
import * as path from 'node:path';
|
|
31
|
+
import { listGovernanceObservations } from '@principles/host-runtime';
|
|
32
|
+
import { isSentinelSessionId } from '@principles/core/runtime';
|
|
33
|
+
import { recoverTaskIdentityFromReceipt, validatePainSubmitReceipt, } from '@principles/core/runtime';
|
|
34
|
+
import { isPainSubmitPostToolUseToolName } from '../codec/input-decoder.js';
|
|
35
|
+
/** The MCP tool id this fallback processes (the server gate lives in the
|
|
36
|
+
* codec parser — exact match on both namespace segments, never a pattern). */
|
|
37
|
+
export const PAIN_SUBMIT_TOOL_NAME = 'pd_submit_pain';
|
|
38
|
+
/** MCP CallToolResult content block shape (single text block contract).
|
|
39
|
+
* P2 review round: more than one content block is AMBIGUOUS — two text
|
|
40
|
+
* blocks could each carry a different task's receipt, so the whole envelope
|
|
41
|
+
* is rejected instead of quietly trusting the first block. */
|
|
42
|
+
function extractReceiptText(toolResponse) {
|
|
43
|
+
if (typeof toolResponse !== 'object' || toolResponse === null || Array.isArray(toolResponse)) {
|
|
44
|
+
return { ok: false, reasonCode: 'receipt_envelope_not_an_object' };
|
|
45
|
+
}
|
|
46
|
+
if (!Object.hasOwn(toolResponse, 'content')) {
|
|
47
|
+
return { ok: false, reasonCode: 'receipt_envelope_content_missing' };
|
|
48
|
+
}
|
|
49
|
+
const { content } = toolResponse;
|
|
50
|
+
if (!Array.isArray(content) || content.length === 0) {
|
|
51
|
+
return { ok: false, reasonCode: 'receipt_envelope_content_missing' };
|
|
52
|
+
}
|
|
53
|
+
if (content.length > 1) {
|
|
54
|
+
return { ok: false, reasonCode: 'receipt_envelope_ambiguous_content' };
|
|
55
|
+
}
|
|
56
|
+
const [first] = content;
|
|
57
|
+
if (typeof first !== 'object' || first === null || Array.isArray(first)) {
|
|
58
|
+
return { ok: false, reasonCode: 'receipt_envelope_block_invalid' };
|
|
59
|
+
}
|
|
60
|
+
if (!Object.hasOwn(first, 'type') || !Object.hasOwn(first, 'text')) {
|
|
61
|
+
return { ok: false, reasonCode: 'receipt_envelope_not_text_block' };
|
|
62
|
+
}
|
|
63
|
+
const { type, text } = first;
|
|
64
|
+
if (type !== 'text' || typeof text !== 'string') {
|
|
65
|
+
return { ok: false, reasonCode: 'receipt_envelope_not_text_block' };
|
|
66
|
+
}
|
|
67
|
+
return { ok: true, text };
|
|
68
|
+
}
|
|
69
|
+
/** Normalize host ids at the adapter boundary, matching the trusted `_meta`
|
|
70
|
+
* reader. `null` means malformed; `undefined` means absent (or an empty
|
|
71
|
+
* optional id). Only the normalized value may cross into Core. */
|
|
72
|
+
function normalizeEventId(value, opts) {
|
|
73
|
+
if (value === undefined)
|
|
74
|
+
return undefined;
|
|
75
|
+
if (typeof value !== 'string')
|
|
76
|
+
return null;
|
|
77
|
+
const id = value.trim();
|
|
78
|
+
if (opts.allowEmpty && id.length === 0)
|
|
79
|
+
return undefined;
|
|
80
|
+
return id.length > 0 && id.length <= 200 && !isSentinelSessionId(id) ? id : null;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* P1-3: does the authorized governance store already hold readable text for
|
|
84
|
+
* the EXACT (session, turn)? Shared by the receipt fallback (disposition
|
|
85
|
+
* choice) and the workspace worker's waiting-task reconcile (the flip) —
|
|
86
|
+
* the diagnosis itself re-reads the turn through the same store.
|
|
87
|
+
* Unreadable ⇒ missing.
|
|
88
|
+
*/
|
|
89
|
+
export function codexTargetTurnTextAvailable(workspaceDir, sessionId, turnId) {
|
|
90
|
+
try {
|
|
91
|
+
const result = listGovernanceObservations({
|
|
92
|
+
workspaceDir,
|
|
93
|
+
hostKind: 'codex',
|
|
94
|
+
rolloutIdentity: sessionId,
|
|
95
|
+
hostTurnId: turnId,
|
|
96
|
+
limit: 8,
|
|
97
|
+
});
|
|
98
|
+
if (!result.ok)
|
|
99
|
+
return false;
|
|
100
|
+
return result.observations.some((row) => (row.kind === 'user_turn' || row.kind === 'assistant_turn')
|
|
101
|
+
&& (row.retentionClass === 'operational' || row.retentionClass === 'promoted')
|
|
102
|
+
&& typeof row.visibleText === 'string'
|
|
103
|
+
&& row.visibleText.trim() !== '');
|
|
104
|
+
}
|
|
105
|
+
catch {
|
|
106
|
+
return false;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Attempt the receipt fallback for one PostToolUse event. Never throws —
|
|
111
|
+
* every failure is a structured result the hook surfaces as one bounded
|
|
112
|
+
* diagnostic (rc-9); the hook result itself is unaffected (fail-open belt).
|
|
113
|
+
*/
|
|
114
|
+
export async function attemptPainReceiptFallback(input) {
|
|
115
|
+
// P1-1: exact namespace gate first — only the PD MCP server's
|
|
116
|
+
// `pd_submit_pain` completion may enter the recovery path.
|
|
117
|
+
if (!isPainSubmitPostToolUseToolName(input.toolName)) {
|
|
118
|
+
return { status: 'not_applicable' };
|
|
119
|
+
}
|
|
120
|
+
// P2: validate AND normalize at the host boundary. Validating a trimmed
|
|
121
|
+
// copy while forwarding the raw value would create a second identity
|
|
122
|
+
// spelling in Core/SQLite (and make exact target-turn joins miss).
|
|
123
|
+
const sessionId = normalizeEventId(input.identity.sessionId, { allowEmpty: false });
|
|
124
|
+
const toolCallId = normalizeEventId(input.identity.toolCallId, { allowEmpty: false });
|
|
125
|
+
const turnId = normalizeEventId(input.identity.turnId, { allowEmpty: true });
|
|
126
|
+
if (sessionId === null || toolCallId === null || turnId === null) {
|
|
127
|
+
return { status: 'attempted', outcome: { status: 'rejected', reasonCode: 'event_identity_invalid' } };
|
|
128
|
+
}
|
|
129
|
+
if (sessionId === undefined || toolCallId === undefined) {
|
|
130
|
+
return { status: 'attempted', outcome: { status: 'rejected', reasonCode: 'event_identity_missing' } };
|
|
131
|
+
}
|
|
132
|
+
const envelope = extractReceiptText(input.toolResponse);
|
|
133
|
+
if (!envelope.ok) {
|
|
134
|
+
return { status: 'attempted', outcome: { status: 'rejected', reasonCode: envelope.reasonCode } };
|
|
135
|
+
}
|
|
136
|
+
let parsed;
|
|
137
|
+
try {
|
|
138
|
+
parsed = JSON.parse(envelope.text);
|
|
139
|
+
}
|
|
140
|
+
catch {
|
|
141
|
+
// Degraded transport forms (plain-text statement) and foreign payloads
|
|
142
|
+
// are not receipts — no recovery from free text.
|
|
143
|
+
return { status: 'attempted', outcome: { status: 'rejected', reasonCode: 'receipt_text_not_json' } };
|
|
144
|
+
}
|
|
145
|
+
// P2: normalize the workspace spellings BEFORE validation — the same
|
|
146
|
+
// directory written differently (`/w/p` vs `/w/p/.`) is the same
|
|
147
|
+
// workspace; a genuinely different directory is still rejected by the
|
|
148
|
+
// validated exact comparison. Platform path knowledge stays in the
|
|
149
|
+
// adapter (Core stays path-free).
|
|
150
|
+
const normalizedWorkspace = path.resolve(input.workspaceDir);
|
|
151
|
+
if (typeof parsed === 'object' && parsed !== null && !Array.isArray(parsed)) {
|
|
152
|
+
const parsedRecord = parsed;
|
|
153
|
+
const rawDir = Object.hasOwn(parsedRecord, 'workspaceDir') ? parsedRecord.workspaceDir : undefined;
|
|
154
|
+
if (typeof rawDir === 'string' && rawDir.length > 0) {
|
|
155
|
+
parsed = { ...parsedRecord, workspaceDir: path.resolve(rawDir) };
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
const validated = validatePainSubmitReceipt(parsed, { workspaceDir: normalizedWorkspace });
|
|
159
|
+
if (!validated.ok) {
|
|
160
|
+
return { status: 'attempted', outcome: { status: 'rejected', reasonCode: validated.reasonCode } };
|
|
161
|
+
}
|
|
162
|
+
const outcome = await recoverTaskIdentityFromReceipt({
|
|
163
|
+
workspaceDir: normalizedWorkspace,
|
|
164
|
+
hostKind: 'codex',
|
|
165
|
+
receipt: validated.receipt,
|
|
166
|
+
identity: {
|
|
167
|
+
sessionId,
|
|
168
|
+
...(turnId === undefined ? {} : { submissionTurnId: turnId }),
|
|
169
|
+
toolCallId,
|
|
170
|
+
},
|
|
171
|
+
authorization: { minimalMetadataGranted: input.minimalMetadataGranted },
|
|
172
|
+
targetTurnTextAvailable: (hostSessionId, targetTurnId) => codexTargetTurnTextAvailable(normalizedWorkspace, hostSessionId, targetTurnId),
|
|
173
|
+
...(input.now !== undefined ? { now: input.now } : {}),
|
|
174
|
+
});
|
|
175
|
+
return { status: 'attempted', outcome };
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* One bounded stderr diagnostic line for the hook (ids and codes only —
|
|
179
|
+
* never receipt content, prompts or tool input/output).
|
|
180
|
+
*/
|
|
181
|
+
export function painReceiptFallbackDiagnostic(result) {
|
|
182
|
+
if (result.status === 'not_applicable')
|
|
183
|
+
return null;
|
|
184
|
+
const { outcome } = result;
|
|
185
|
+
switch (outcome.status) {
|
|
186
|
+
case 'recovered':
|
|
187
|
+
return `pain_receipt_recovered:taskId=${outcome.taskId}:state=${outcome.disposition.state}`;
|
|
188
|
+
case 'already_bound':
|
|
189
|
+
return `pain_receipt_idempotent:taskId=${outcome.taskId}`;
|
|
190
|
+
case 'rejected':
|
|
191
|
+
return `pain_receipt_rejected:${outcome.reasonCode}${outcome.detail !== undefined ? `:detail=${Array.from(outcome.detail).slice(0, 80).join('')}` : ''}${outcome.taskId !== undefined ? `:taskId=${outcome.taskId}` : ''}`;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type RecordOwnerStatementResult } from './explicit-owner-statement.js';
|
|
2
2
|
export declare const TURN_CONTEXT_FILENAME_PREFIX = "pd_current_turn_context_";
|
|
3
|
-
export declare const TURN_CONTEXT_SCHEMA_VERSION =
|
|
3
|
+
export declare const TURN_CONTEXT_SCHEMA_VERSION = 2;
|
|
4
4
|
/**
|
|
5
5
|
* Staleness bound for the turn context. Stop/SessionStart withdraw the file,
|
|
6
6
|
* but any early exit on those paths (decode/config failure, host.codex flag
|
|
@@ -10,7 +10,7 @@ export declare const TURN_CONTEXT_SCHEMA_VERSION = 1;
|
|
|
10
10
|
* legitimate in-turn registration latency.
|
|
11
11
|
*/
|
|
12
12
|
export declare const TURN_CONTEXT_MAX_AGE_MS: number;
|
|
13
|
-
/** Host-written identity of the CURRENT Codex turn
|
|
13
|
+
/** Host-written identity of the CURRENT Codex turn: ids, paths and one closed-set intent marker. */
|
|
14
14
|
export interface CodexTurnContext {
|
|
15
15
|
readonly schemaVersion: number;
|
|
16
16
|
readonly writtenAt: string;
|
|
@@ -19,6 +19,8 @@ export interface CodexTurnContext {
|
|
|
19
19
|
readonly transcriptPath: string;
|
|
20
20
|
readonly codexHome: string;
|
|
21
21
|
readonly workspaceDir: string;
|
|
22
|
+
/** Host-derived from a direct current-turn Owner request; never caller-supplied. */
|
|
23
|
+
readonly ownerIntent: 'explicit_pain_registration' | null;
|
|
22
24
|
}
|
|
23
25
|
interface CodexCallerEnvironment {
|
|
24
26
|
CODEX_HOME?: string | undefined;
|
|
@@ -43,14 +45,6 @@ export declare function clearCurrentTurnContext(args: {
|
|
|
43
45
|
sessionId: string;
|
|
44
46
|
turnId?: string;
|
|
45
47
|
}): TurnContextClearResult;
|
|
46
|
-
/**
|
|
47
|
-
* Publish (or withdraw) the current turn context. Called from the
|
|
48
|
-
* UserPromptSubmit branch of the hook. A payload without complete lineage
|
|
49
|
-
* (session/turn/transcript) clears any previous file instead of leaving a
|
|
50
|
-
* stale turn bindable — the invariant is "file exists ⟺ the current turn
|
|
51
|
-
* carries full lineage". Fail-open: a write failure degrades the
|
|
52
|
-
* agent-assisted entry only (the prefix entry never needed this file).
|
|
53
|
-
*/
|
|
54
48
|
export declare function writeCurrentTurnContext(args: {
|
|
55
49
|
rawPayload: unknown;
|
|
56
50
|
workspaceDir: string;
|
|
@@ -58,15 +52,16 @@ export declare function writeCurrentTurnContext(args: {
|
|
|
58
52
|
}): TurnContextWriteResult;
|
|
59
53
|
export type RegisterCurrentTurnResult = RecordOwnerStatementResult | {
|
|
60
54
|
status: 'rejected';
|
|
61
|
-
reason: 'turn_context_missing' | 'turn_context_invalid' | 'turn_context_stale' | 'turn_context_workspace_mismatch' | 'turn_context_session_mismatch' | 'caller_session_missing' | 'caller_session_conflict' | 'conversation_ingestion_config_invalid';
|
|
55
|
+
reason: 'turn_context_missing' | 'turn_context_invalid' | 'turn_context_stale' | 'turn_context_workspace_mismatch' | 'turn_context_session_mismatch' | 'caller_session_missing' | 'caller_session_conflict' | 'conversation_ingestion_config_invalid' | 'owner_intent_missing';
|
|
62
56
|
nextAction: string;
|
|
63
57
|
};
|
|
64
58
|
/**
|
|
65
59
|
* Register one explicit Owner statement through the LIVE turn context — the
|
|
66
|
-
* agent-assisted counterpart of the prefix entry. The
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
60
|
+
* agent-assisted counterpart of the prefix entry. The current Owner turn
|
|
61
|
+
* must explicitly request this registration. Supplied wording is Agent-derived
|
|
62
|
+
* unless a consent-authorized transcript match verifies it as Owner-verbatim.
|
|
63
|
+
* The intent marker authorizes this submission, not authorship. Lineage comes
|
|
64
|
+
* only from the host-written context file.
|
|
70
65
|
*/
|
|
71
66
|
export declare function registerCurrentTurnOwnerStatement(args: {
|
|
72
67
|
workspaceDir: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Live-turn context bridge for agent-assisted explicit Owner pain
|
|
3
|
-
* registration
|
|
3
|
+
* registration gated by a host-derived current-turn Owner-intent marker.
|
|
4
4
|
*
|
|
5
5
|
* The hook writes the CURRENT turn's host-verified identity — session id,
|
|
6
6
|
* turn id, transcript path, CODEX_HOME, workspace — to a file partitioned by
|
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
* the transcript path (existence + CODEX_HOME containment + rollout identity)
|
|
16
16
|
* at registration time. A cleared or stale context fails closed.
|
|
17
17
|
*
|
|
18
|
-
* Privacy: each file carries identifiers and
|
|
19
|
-
* never transcript content
|
|
20
|
-
* conversation-ingestion flag does not gate context publication.
|
|
18
|
+
* Privacy: each file carries identifiers, paths and a closed-set intent marker only.
|
|
19
|
+
* It never persists prompt text or transcript content; session ids are hashed in filenames.
|
|
20
|
+
* The conversation-ingestion flag does not gate context publication.
|
|
21
21
|
*/
|
|
22
22
|
import fs from 'node:fs';
|
|
23
23
|
import { createHash, randomUUID } from 'node:crypto';
|
|
@@ -28,7 +28,7 @@ import { resolveCodexHome } from './codex-home.js';
|
|
|
28
28
|
import { extractFields, isRecord } from './ingestion-fields.js';
|
|
29
29
|
import { recordExplicitOwnerStatement, MAX_OWNER_STATEMENT_CHARS } from './explicit-owner-statement.js';
|
|
30
30
|
export const TURN_CONTEXT_FILENAME_PREFIX = 'pd_current_turn_context_';
|
|
31
|
-
export const TURN_CONTEXT_SCHEMA_VERSION =
|
|
31
|
+
export const TURN_CONTEXT_SCHEMA_VERSION = 2;
|
|
32
32
|
/**
|
|
33
33
|
* Staleness bound for the turn context. Stop/SessionStart withdraw the file,
|
|
34
34
|
* but any early exit on those paths (decode/config failure, host.codex flag
|
|
@@ -128,6 +128,13 @@ const CLEAR_FAILURE_NEXT_ACTION = 'The previous turn context could not be withdr
|
|
|
128
128
|
* carries full lineage". Fail-open: a write failure degrades the
|
|
129
129
|
* agent-assisted entry only (the prefix entry never needed this file).
|
|
130
130
|
*/
|
|
131
|
+
const OWNER_PAIN_REQUEST_PREFIXES = ['PD代录痛苦:', 'PD代录痛苦:', 'PD记录痛苦:', 'PD记录痛苦:'];
|
|
132
|
+
function resolveOwnerPainIntent(rawPayload) {
|
|
133
|
+
if (!isRecord(rawPayload) || typeof rawPayload.prompt !== 'string')
|
|
134
|
+
return null;
|
|
135
|
+
const prompt = rawPayload.prompt.trimStart();
|
|
136
|
+
return OWNER_PAIN_REQUEST_PREFIXES.some((prefix) => prompt.startsWith(prefix) && prompt.slice(prefix.length).trim().length > 0) ? 'explicit_pain_registration' : null;
|
|
137
|
+
}
|
|
131
138
|
export function writeCurrentTurnContext(args) {
|
|
132
139
|
const fields = extractFields(args.rawPayload);
|
|
133
140
|
if (fields === null || fields.sessionId.length === 0) {
|
|
@@ -158,6 +165,7 @@ export function writeCurrentTurnContext(args) {
|
|
|
158
165
|
transcriptPath: fields.transcriptPath,
|
|
159
166
|
codexHome: home.home,
|
|
160
167
|
workspaceDir: args.workspaceDir,
|
|
168
|
+
ownerIntent: resolveOwnerPainIntent(args.rawPayload),
|
|
161
169
|
};
|
|
162
170
|
const target = turnContextPath(args.workspaceDir, fields.sessionId);
|
|
163
171
|
const temp = `${target}.tmp-${process.pid}`;
|
|
@@ -185,6 +193,11 @@ function requireStringField(record, key) {
|
|
|
185
193
|
const value = Object.hasOwn(record, key) ? record[key] : undefined;
|
|
186
194
|
return typeof value === 'string' && value.length > 0 ? value : null;
|
|
187
195
|
}
|
|
196
|
+
/**
|
|
197
|
+
* A tool invocation is not proof that the Owner requested it. The UserPromptSubmit
|
|
198
|
+
* hook records only this closed-set marker from the current Owner message. It
|
|
199
|
+
* deliberately stores no prompt text and does not inspect historical turns.
|
|
200
|
+
*/
|
|
188
201
|
function readTurnContext(workspaceDir, sessionId) {
|
|
189
202
|
let raw;
|
|
190
203
|
try {
|
|
@@ -208,6 +221,10 @@ function readTurnContext(workspaceDir, sessionId) {
|
|
|
208
221
|
const transcriptPath = requireStringField(parsed, 'transcriptPath');
|
|
209
222
|
const codexHome = requireStringField(parsed, 'codexHome');
|
|
210
223
|
const contextWorkspaceDir = requireStringField(parsed, 'workspaceDir');
|
|
224
|
+
const { ownerIntent } = parsed;
|
|
225
|
+
if (!Object.hasOwn(parsed, 'ownerIntent') || (ownerIntent !== null && ownerIntent !== 'explicit_pain_registration')) {
|
|
226
|
+
return { error: 'turn_context_invalid' };
|
|
227
|
+
}
|
|
211
228
|
if (writtenAt === null || contextSessionId === null || turnId === null || transcriptPath === null || codexHome === null || contextWorkspaceDir === null) {
|
|
212
229
|
return { error: 'turn_context_invalid' };
|
|
213
230
|
}
|
|
@@ -224,14 +241,16 @@ function readTurnContext(workspaceDir, sessionId) {
|
|
|
224
241
|
transcriptPath,
|
|
225
242
|
codexHome,
|
|
226
243
|
workspaceDir: contextWorkspaceDir,
|
|
244
|
+
ownerIntent,
|
|
227
245
|
};
|
|
228
246
|
}
|
|
229
247
|
/**
|
|
230
248
|
* Register one explicit Owner statement through the LIVE turn context — the
|
|
231
|
-
* agent-assisted counterpart of the prefix entry. The
|
|
232
|
-
*
|
|
233
|
-
*
|
|
234
|
-
*
|
|
249
|
+
* agent-assisted counterpart of the prefix entry. The current Owner turn
|
|
250
|
+
* must explicitly request this registration. Supplied wording is Agent-derived
|
|
251
|
+
* unless a consent-authorized transcript match verifies it as Owner-verbatim.
|
|
252
|
+
* The intent marker authorizes this submission, not authorship. Lineage comes
|
|
253
|
+
* only from the host-written context file.
|
|
235
254
|
*/
|
|
236
255
|
export async function registerCurrentTurnOwnerStatement(args) {
|
|
237
256
|
const caller = resolveCallerSessionId(process.env);
|
|
@@ -271,6 +290,13 @@ export async function registerCurrentTurnOwnerStatement(args) {
|
|
|
271
290
|
nextAction: 'The turn context does not belong to this host-bound Codex session; nothing was recorded. Retry from the session that supplied the Owner statement.',
|
|
272
291
|
};
|
|
273
292
|
}
|
|
293
|
+
if (context.ownerIntent !== 'explicit_pain_registration') {
|
|
294
|
+
return {
|
|
295
|
+
status: 'rejected',
|
|
296
|
+
reason: 'owner_intent_missing',
|
|
297
|
+
nextAction: 'An agent/tool invocation is not Owner approval. The current Owner message must begin with PD代录痛苦:<request> (or PD记录痛苦:<Owner words> for direct submission). Start a new Owner turn with that explicit prefix; no history was read and nothing was recorded.',
|
|
298
|
+
};
|
|
299
|
+
}
|
|
274
300
|
const statement = args.statementText.trim();
|
|
275
301
|
if (statement.length === 0) {
|
|
276
302
|
return { status: 'rejected', reason: 'statement_empty', nextAction: 'The Owner statement is empty; nothing was recorded. Pass the Owner verbatim words (1–500 characters).' };
|