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.
Files changed (428) hide show
  1. package/_release/product-identity.json +2 -2
  2. package/codex-adapter/dist/codec/input-decoder.d.ts +17 -0
  3. package/codex-adapter/dist/codec/input-decoder.js +39 -0
  4. package/codex-adapter/dist/ingestion/explicit-owner-statement.js +125 -1
  5. package/codex-adapter/dist/ingestion/pain-receipt-fallback.d.ts +46 -0
  6. package/codex-adapter/dist/ingestion/pain-receipt-fallback.js +193 -0
  7. package/codex-adapter/dist/ingestion/turn-context.d.ts +10 -15
  8. package/codex-adapter/dist/ingestion/turn-context.js +35 -9
  9. package/codex-adapter/dist/pd-hook.js +57 -1
  10. package/codex-adapter/dist/worker/workspace-worker.d.ts +15 -0
  11. package/codex-adapter/dist/worker/workspace-worker.js +91 -12
  12. package/codex-adapter/package.json +1 -1
  13. package/console/dist/server/index.js +11 -0
  14. package/console/dist/server/models/EvidenceChainConsoleModel.js +31 -0
  15. package/console/dist/server/routes/health.d.ts +1 -0
  16. package/console/dist/server/routes/health.js +12 -0
  17. package/console/dist/server/routes/service-host.d.ts +19 -0
  18. package/console/dist/server/routes/service-host.js +129 -0
  19. package/console/dist/web/assets/app.js +39 -39
  20. package/console/package.json +1 -1
  21. package/core/dist/runtime/adapter/pi-ai-http-transport.d.ts.map +1 -1
  22. package/core/dist/runtime/adapter/pi-ai-http-transport.js.map +1 -1
  23. package/core/dist/runtime/context-payload.d.ts +48 -0
  24. package/core/dist/runtime/context-payload.d.ts.map +1 -1
  25. package/core/dist/runtime/context-payload.js +12 -0
  26. package/core/dist/runtime/context-payload.js.map +1 -1
  27. package/core/dist/runtime/diagnostician/rootcause-prompt-builder.d.ts.map +1 -1
  28. package/core/dist/runtime/diagnostician/rootcause-prompt-builder.js +18 -0
  29. package/core/dist/runtime/diagnostician/rootcause-prompt-builder.js.map +1 -1
  30. package/core/dist/runtime/diagnostician-candidate.d.ts.map +1 -1
  31. package/core/dist/runtime/diagnostician-candidate.js +18 -2
  32. package/core/dist/runtime/diagnostician-candidate.js.map +1 -1
  33. package/core/dist/runtime/evidence-guards.d.ts +7 -3
  34. package/core/dist/runtime/evidence-guards.d.ts.map +1 -1
  35. package/core/dist/runtime/evidence-guards.js +9 -7
  36. package/core/dist/runtime/evidence-guards.js.map +1 -1
  37. package/core/dist/runtime/feature-flags/feature-flag-contract.d.ts.map +1 -1
  38. package/core/dist/runtime/feature-flags/feature-flag-contract.js +14 -0
  39. package/core/dist/runtime/feature-flags/feature-flag-contract.js.map +1 -1
  40. package/core/dist/runtime/feature-flags/feature-flag-lifecycle.d.ts.map +1 -1
  41. package/core/dist/runtime/feature-flags/feature-flag-lifecycle.js +8 -0
  42. package/core/dist/runtime/feature-flags/feature-flag-lifecycle.js.map +1 -1
  43. package/core/dist/runtime/host-submission-context.d.ts +83 -0
  44. package/core/dist/runtime/host-submission-context.d.ts.map +1 -0
  45. package/core/dist/runtime/host-submission-context.js +183 -0
  46. package/core/dist/runtime/host-submission-context.js.map +1 -0
  47. package/core/dist/runtime/index.d.ts +9 -2
  48. package/core/dist/runtime/index.d.ts.map +1 -1
  49. package/core/dist/runtime/index.js +29 -2
  50. package/core/dist/runtime/index.js.map +1 -1
  51. package/core/dist/runtime/intent/intent-doc.d.ts.map +1 -1
  52. package/core/dist/runtime/intent/intent-doc.js +29 -5
  53. package/core/dist/runtime/intent/intent-doc.js.map +1 -1
  54. package/core/dist/runtime/internalization/diag-distiller-runner.d.ts +9 -0
  55. package/core/dist/runtime/internalization/diag-distiller-runner.d.ts.map +1 -1
  56. package/core/dist/runtime/internalization/diag-distiller-runner.js +13 -0
  57. package/core/dist/runtime/internalization/diag-distiller-runner.js.map +1 -1
  58. package/core/dist/runtime/internalization/diag-rootcause-runner.d.ts +11 -0
  59. package/core/dist/runtime/internalization/diag-rootcause-runner.d.ts.map +1 -1
  60. package/core/dist/runtime/internalization/diag-rootcause-runner.js +10 -0
  61. package/core/dist/runtime/internalization/diag-rootcause-runner.js.map +1 -1
  62. package/core/dist/runtime/internalization/diag-router-runner.d.ts +9 -0
  63. package/core/dist/runtime/internalization/diag-router-runner.d.ts.map +1 -1
  64. package/core/dist/runtime/internalization/diag-router-runner.js +13 -0
  65. package/core/dist/runtime/internalization/diag-router-runner.js.map +1 -1
  66. package/core/dist/runtime/internalization/index.d.ts +1 -1
  67. package/core/dist/runtime/internalization/index.d.ts.map +1 -1
  68. package/core/dist/runtime/internalization/index.js +1 -1
  69. package/core/dist/runtime/internalization/index.js.map +1 -1
  70. package/core/dist/runtime/internalization/intake-to-internalization-bridge.d.ts +19 -0
  71. package/core/dist/runtime/internalization/intake-to-internalization-bridge.d.ts.map +1 -1
  72. package/core/dist/runtime/internalization/intake-to-internalization-bridge.js +24 -0
  73. package/core/dist/runtime/internalization/intake-to-internalization-bridge.js.map +1 -1
  74. package/core/dist/runtime/internalization/internalization-orchestrator.d.ts +8 -0
  75. package/core/dist/runtime/internalization/internalization-orchestrator.d.ts.map +1 -1
  76. package/core/dist/runtime/internalization/internalization-orchestrator.js +36 -4
  77. package/core/dist/runtime/internalization/internalization-orchestrator.js.map +1 -1
  78. package/core/dist/runtime/internalization/source-authorization-boundary.d.ts +39 -0
  79. package/core/dist/runtime/internalization/source-authorization-boundary.d.ts.map +1 -0
  80. package/core/dist/runtime/internalization/source-authorization-boundary.js +57 -0
  81. package/core/dist/runtime/internalization/source-authorization-boundary.js.map +1 -0
  82. package/core/dist/runtime/internalization/split-diagnostician-runner.d.ts.map +1 -1
  83. package/core/dist/runtime/internalization/split-diagnostician-runner.js +72 -5
  84. package/core/dist/runtime/internalization/split-diagnostician-runner.js.map +1 -1
  85. package/core/dist/runtime/pain-admission-disposition.d.ts +60 -0
  86. package/core/dist/runtime/pain-admission-disposition.d.ts.map +1 -0
  87. package/core/dist/runtime/pain-admission-disposition.js +37 -0
  88. package/core/dist/runtime/pain-admission-disposition.js.map +1 -0
  89. package/core/dist/runtime/pain-ingress-payload.d.ts +36 -2
  90. package/core/dist/runtime/pain-ingress-payload.d.ts.map +1 -1
  91. package/core/dist/runtime/pain-ingress-payload.js +63 -6
  92. package/core/dist/runtime/pain-ingress-payload.js.map +1 -1
  93. package/core/dist/runtime/pain-ingress.d.ts.map +1 -1
  94. package/core/dist/runtime/pain-ingress.js +28 -0
  95. package/core/dist/runtime/pain-ingress.js.map +1 -1
  96. package/core/dist/runtime/pain-recall-read-model.d.ts +13 -1
  97. package/core/dist/runtime/pain-recall-read-model.d.ts.map +1 -1
  98. package/core/dist/runtime/pain-recall-read-model.js +50 -7
  99. package/core/dist/runtime/pain-recall-read-model.js.map +1 -1
  100. package/core/dist/runtime/pain-receipt-recovery.d.ts +147 -0
  101. package/core/dist/runtime/pain-receipt-recovery.d.ts.map +1 -0
  102. package/core/dist/runtime/pain-receipt-recovery.js +475 -0
  103. package/core/dist/runtime/pain-receipt-recovery.js.map +1 -0
  104. package/core/dist/runtime/pain-signal-bridge.d.ts +13 -1
  105. package/core/dist/runtime/pain-signal-bridge.d.ts.map +1 -1
  106. package/core/dist/runtime/pain-signal-bridge.js +174 -0
  107. package/core/dist/runtime/pain-signal-bridge.js.map +1 -1
  108. package/core/dist/runtime/pain-signal-runtime-factory.d.ts +9 -0
  109. package/core/dist/runtime/pain-signal-runtime-factory.d.ts.map +1 -1
  110. package/core/dist/runtime/pain-signal-runtime-factory.js +8 -3
  111. package/core/dist/runtime/pain-signal-runtime-factory.js.map +1 -1
  112. package/core/dist/runtime/pain-submit-capability.d.ts +11 -0
  113. package/core/dist/runtime/pain-submit-capability.d.ts.map +1 -1
  114. package/core/dist/runtime/pain-submit-capability.js +77 -3
  115. package/core/dist/runtime/pain-submit-capability.js.map +1 -1
  116. package/core/dist/runtime/pain-target-evidence-reconcile.d.ts +55 -0
  117. package/core/dist/runtime/pain-target-evidence-reconcile.d.ts.map +1 -0
  118. package/core/dist/runtime/pain-target-evidence-reconcile.js +164 -0
  119. package/core/dist/runtime/pain-target-evidence-reconcile.js.map +1 -0
  120. package/core/dist/runtime/pain-to-principle-service.d.ts +8 -0
  121. package/core/dist/runtime/pain-to-principle-service.d.ts.map +1 -1
  122. package/core/dist/runtime/pain-to-principle-service.js +1 -0
  123. package/core/dist/runtime/pain-to-principle-service.js.map +1 -1
  124. package/core/dist/runtime/source-material-authorization.d.ts +166 -0
  125. package/core/dist/runtime/source-material-authorization.d.ts.map +1 -0
  126. package/core/dist/runtime/source-material-authorization.js +250 -0
  127. package/core/dist/runtime/source-material-authorization.js.map +1 -0
  128. package/core/dist/runtime/store/context/index.d.ts +1 -0
  129. package/core/dist/runtime/store/context/index.d.ts.map +1 -1
  130. package/core/dist/runtime/store/context/index.js +1 -0
  131. package/core/dist/runtime/store/context/index.js.map +1 -1
  132. package/core/dist/runtime/store/context/promoted-evidence-reader.d.ts +8 -0
  133. package/core/dist/runtime/store/context/promoted-evidence-reader.d.ts.map +1 -1
  134. package/core/dist/runtime/store/context/promoted-evidence-reader.js +15 -1
  135. package/core/dist/runtime/store/context/promoted-evidence-reader.js.map +1 -1
  136. package/core/dist/runtime/store/context/sqlite-context-assembler.d.ts +22 -0
  137. package/core/dist/runtime/store/context/sqlite-context-assembler.d.ts.map +1 -1
  138. package/core/dist/runtime/store/context/sqlite-context-assembler.js +153 -3
  139. package/core/dist/runtime/store/context/sqlite-context-assembler.js.map +1 -1
  140. package/core/dist/runtime/store/context/trajectory-turn-reader.d.ts +13 -0
  141. package/core/dist/runtime/store/context/trajectory-turn-reader.d.ts.map +1 -1
  142. package/core/dist/runtime/store/lifecycle/lease-manager.d.ts +15 -0
  143. package/core/dist/runtime/store/lifecycle/lease-manager.d.ts.map +1 -1
  144. package/core/dist/runtime/store/lifecycle/lease-manager.js +16 -1
  145. package/core/dist/runtime/store/lifecycle/lease-manager.js.map +1 -1
  146. package/core/dist/runtime/store/runtime-state-manager.d.ts +2 -0
  147. package/core/dist/runtime/store/runtime-state-manager.d.ts.map +1 -1
  148. package/core/dist/runtime/store/runtime-state-manager.js.map +1 -1
  149. package/core/dist/runtime/store/task/memory-task-store.d.ts +1 -0
  150. package/core/dist/runtime/store/task/memory-task-store.d.ts.map +1 -1
  151. package/core/dist/runtime/store/task/memory-task-store.js +37 -0
  152. package/core/dist/runtime/store/task/memory-task-store.js.map +1 -1
  153. package/core/dist/runtime/store/task/sqlite-task-store.d.ts +10 -0
  154. package/core/dist/runtime/store/task/sqlite-task-store.d.ts.map +1 -1
  155. package/core/dist/runtime/store/task/sqlite-task-store.js +20 -0
  156. package/core/dist/runtime/store/task/sqlite-task-store.js.map +1 -1
  157. package/core/dist/runtime/store/task/task-store.d.ts +16 -0
  158. package/core/dist/runtime/store/task/task-store.d.ts.map +1 -1
  159. package/core/dist/runtime/task-status.d.ts +13 -0
  160. package/core/dist/runtime/task-status.d.ts.map +1 -1
  161. package/core/dist/runtime/task-status.js +9 -0
  162. package/core/dist/runtime/task-status.js.map +1 -1
  163. package/core/dist/runtime/types/evidence-chain-contract.d.ts +10 -0
  164. package/core/dist/runtime/types/evidence-chain-contract.d.ts.map +1 -1
  165. package/core/dist/runtime/types/evidence-chain-contract.js +7 -0
  166. package/core/dist/runtime/types/evidence-chain-contract.js.map +1 -1
  167. package/core/package.json +2 -2
  168. package/dist/index.d.ts.map +1 -1
  169. package/dist/index.js +11 -0
  170. package/dist/index.js.map +1 -1
  171. package/dist/installer.d.ts.map +1 -1
  172. package/dist/installer.js +77 -30
  173. package/dist/installer.js.map +1 -1
  174. package/dist/installers/mcp-registration-conflict.d.ts +8 -0
  175. package/dist/installers/mcp-registration-conflict.d.ts.map +1 -1
  176. package/dist/installers/mcp-registration-conflict.js +34 -1
  177. package/dist/installers/mcp-registration-conflict.js.map +1 -1
  178. package/dist/installers/workbuddy-host-installer.d.ts +45 -13
  179. package/dist/installers/workbuddy-host-installer.d.ts.map +1 -1
  180. package/dist/installers/workbuddy-host-installer.js +284 -21
  181. package/dist/installers/workbuddy-host-installer.js.map +1 -1
  182. package/dist/prompts.d.ts +11 -0
  183. package/dist/prompts.d.ts.map +1 -1
  184. package/dist/prompts.js +4 -0
  185. package/dist/prompts.js.map +1 -1
  186. package/dist/service-host-bridge.d.ts +67 -0
  187. package/dist/service-host-bridge.d.ts.map +1 -0
  188. package/dist/service-host-bridge.js +292 -0
  189. package/dist/service-host-bridge.js.map +1 -0
  190. package/dist/uninstaller.d.ts.map +1 -1
  191. package/dist/uninstaller.js +26 -0
  192. package/dist/uninstaller.js.map +1 -1
  193. package/dist/update/install-layout.d.ts +0 -12
  194. package/dist/update/install-layout.d.ts.map +1 -1
  195. package/dist/update/install-layout.js +42 -15
  196. package/dist/update/install-layout.js.map +1 -1
  197. package/host-runtime/dist/diagnostician-auto-run.js +4 -1
  198. package/host-runtime/dist/governance-observation-store.d.ts +7 -0
  199. package/host-runtime/dist/governance-observation-store.js +15 -4
  200. package/host-runtime/dist/governance-signal-admission.d.ts +49 -0
  201. package/host-runtime/dist/governance-signal-admission.js +355 -94
  202. package/host-runtime/dist/governance-trajectory-turn-reader.d.ts +20 -4
  203. package/host-runtime/dist/governance-trajectory-turn-reader.js +77 -5
  204. package/host-runtime/dist/index.d.ts +2 -0
  205. package/host-runtime/dist/index.js +5 -0
  206. package/host-runtime/dist/internalization-consumer-cycle.js +4 -1
  207. package/host-runtime/dist/pd-config.d.ts +10 -0
  208. package/host-runtime/dist/pd-config.js +37 -0
  209. package/host-runtime/dist/signal-stage2-cycle.js +28 -1
  210. package/host-runtime/dist/source-material-authorization.d.ts +53 -0
  211. package/host-runtime/dist/source-material-authorization.js +67 -0
  212. package/host-runtime/dist/source-revocation-sweep.d.ts +172 -0
  213. package/host-runtime/dist/source-revocation-sweep.js +928 -0
  214. package/host-runtime/package.json +5 -1
  215. package/install-layout/dist/background-execution-transition.d.ts +258 -0
  216. package/install-layout/dist/background-execution-transition.js +836 -0
  217. package/install-layout/dist/index.d.ts +8 -0
  218. package/install-layout/dist/index.js +8 -0
  219. package/install-layout/package.json +6 -2
  220. package/package.json +7 -6
  221. package/pd-cli/dist/commands/candidate.d.ts.map +1 -1
  222. package/pd-cli/dist/commands/candidate.js +16 -5
  223. package/pd-cli/dist/commands/candidate.js.map +1 -1
  224. package/pd-cli/dist/commands/codex-setup.d.ts.map +1 -1
  225. package/pd-cli/dist/commands/codex-setup.js +17 -1
  226. package/pd-cli/dist/commands/codex-setup.js.map +1 -1
  227. package/pd-cli/dist/commands/codex-worker.d.ts.map +1 -1
  228. package/pd-cli/dist/commands/codex-worker.js +8 -4
  229. package/pd-cli/dist/commands/codex-worker.js.map +1 -1
  230. package/pd-cli/dist/commands/consent-sweep-revoked.d.ts +20 -0
  231. package/pd-cli/dist/commands/consent-sweep-revoked.d.ts.map +1 -0
  232. package/pd-cli/dist/commands/consent-sweep-revoked.js +85 -0
  233. package/pd-cli/dist/commands/consent-sweep-revoked.js.map +1 -0
  234. package/pd-cli/dist/commands/console.d.ts.map +1 -1
  235. package/pd-cli/dist/commands/console.js +9 -0
  236. package/pd-cli/dist/commands/console.js.map +1 -1
  237. package/pd-cli/dist/commands/context.d.ts.map +1 -1
  238. package/pd-cli/dist/commands/context.js +9 -1
  239. package/pd-cli/dist/commands/context.js.map +1 -1
  240. package/pd-cli/dist/commands/diagnose.d.ts.map +1 -1
  241. package/pd-cli/dist/commands/diagnose.js +12 -6
  242. package/pd-cli/dist/commands/diagnose.js.map +1 -1
  243. package/pd-cli/dist/commands/health-console.d.ts +1 -1
  244. package/pd-cli/dist/commands/health-console.d.ts.map +1 -1
  245. package/pd-cli/dist/commands/health-console.js +15 -1
  246. package/pd-cli/dist/commands/health-console.js.map +1 -1
  247. package/pd-cli/dist/commands/health.d.ts.map +1 -1
  248. package/pd-cli/dist/commands/health.js +7 -1
  249. package/pd-cli/dist/commands/health.js.map +1 -1
  250. package/pd-cli/dist/commands/openclaw-worker.d.ts +11 -0
  251. package/pd-cli/dist/commands/openclaw-worker.d.ts.map +1 -0
  252. package/pd-cli/dist/commands/openclaw-worker.js +199 -0
  253. package/pd-cli/dist/commands/openclaw-worker.js.map +1 -0
  254. package/pd-cli/dist/commands/pain-explicit.d.ts.map +1 -1
  255. package/pd-cli/dist/commands/pain-explicit.js +1 -0
  256. package/pd-cli/dist/commands/pain-explicit.js.map +1 -1
  257. package/pd-cli/dist/commands/pain-recall.d.ts +2 -2
  258. package/pd-cli/dist/commands/pain-recall.d.ts.map +1 -1
  259. package/pd-cli/dist/commands/pain-recall.js +7 -1
  260. package/pd-cli/dist/commands/pain-recall.js.map +1 -1
  261. package/pd-cli/dist/commands/pain-retry.d.ts.map +1 -1
  262. package/pd-cli/dist/commands/pain-retry.js +12 -6
  263. package/pd-cli/dist/commands/pain-retry.js.map +1 -1
  264. package/pd-cli/dist/commands/runtime-internalization-enqueue-successors.d.ts.map +1 -1
  265. package/pd-cli/dist/commands/runtime-internalization-enqueue-successors.js +2 -1
  266. package/pd-cli/dist/commands/runtime-internalization-enqueue-successors.js.map +1 -1
  267. package/pd-cli/dist/commands/runtime-internalization-run-once.d.ts +1 -0
  268. package/pd-cli/dist/commands/runtime-internalization-run-once.d.ts.map +1 -1
  269. package/pd-cli/dist/commands/runtime-internalization-run-once.js +32 -8
  270. package/pd-cli/dist/commands/runtime-internalization-run-once.js.map +1 -1
  271. package/pd-cli/dist/commands/runtime-internalization-wake-once.d.ts.map +1 -1
  272. package/pd-cli/dist/commands/runtime-internalization-wake-once.js +2 -1
  273. package/pd-cli/dist/commands/runtime-internalization-wake-once.js.map +1 -1
  274. package/pd-cli/dist/commands/service-handover.d.ts +12 -0
  275. package/pd-cli/dist/commands/service-handover.d.ts.map +1 -0
  276. package/pd-cli/dist/commands/service-handover.js +117 -0
  277. package/pd-cli/dist/commands/service-handover.js.map +1 -0
  278. package/pd-cli/dist/commands/service-lifecycle.d.ts +31 -0
  279. package/pd-cli/dist/commands/service-lifecycle.d.ts.map +1 -0
  280. package/pd-cli/dist/commands/service-lifecycle.js +207 -0
  281. package/pd-cli/dist/commands/service-lifecycle.js.map +1 -0
  282. package/pd-cli/dist/commands/service-run-once.d.ts +96 -0
  283. package/pd-cli/dist/commands/service-run-once.d.ts.map +1 -1
  284. package/pd-cli/dist/commands/service-run-once.js +432 -13
  285. package/pd-cli/dist/commands/service-run-once.js.map +1 -1
  286. package/pd-cli/dist/commands/workbuddy-setup.d.ts.map +1 -1
  287. package/pd-cli/dist/commands/workbuddy-setup.js +22 -2
  288. package/pd-cli/dist/commands/workbuddy-setup.js.map +1 -1
  289. package/pd-cli/dist/program.d.ts.map +1 -1
  290. package/pd-cli/dist/program.js +167 -9
  291. package/pd-cli/dist/program.js.map +1 -1
  292. package/pd-cli/dist/services/admission-write-gate.d.ts +3 -1
  293. package/pd-cli/dist/services/admission-write-gate.d.ts.map +1 -1
  294. package/pd-cli/dist/services/admission-write-gate.js +1 -0
  295. package/pd-cli/dist/services/admission-write-gate.js.map +1 -1
  296. package/pd-cli/dist/services/console-launcher.d.ts +93 -1
  297. package/pd-cli/dist/services/console-launcher.d.ts.map +1 -1
  298. package/pd-cli/dist/services/console-launcher.js +375 -10
  299. package/pd-cli/dist/services/console-launcher.js.map +1 -1
  300. package/pd-cli/dist/services/service-host/coordinator-common.d.ts +49 -0
  301. package/pd-cli/dist/services/service-host/coordinator-common.d.ts.map +1 -0
  302. package/pd-cli/dist/services/service-host/coordinator-common.js +158 -0
  303. package/pd-cli/dist/services/service-host/coordinator-common.js.map +1 -0
  304. package/pd-cli/dist/services/service-host/handover-claims.d.ts +14 -0
  305. package/pd-cli/dist/services/service-host/handover-claims.d.ts.map +1 -0
  306. package/pd-cli/dist/services/service-host/handover-claims.js +50 -0
  307. package/pd-cli/dist/services/service-host/handover-claims.js.map +1 -0
  308. package/pd-cli/dist/services/service-host/index.d.ts +19 -3
  309. package/pd-cli/dist/services/service-host/index.d.ts.map +1 -1
  310. package/pd-cli/dist/services/service-host/index.js +21 -3
  311. package/pd-cli/dist/services/service-host/index.js.map +1 -1
  312. package/pd-cli/dist/services/service-host/install-identity.d.ts +23 -3
  313. package/pd-cli/dist/services/service-host/install-identity.d.ts.map +1 -1
  314. package/pd-cli/dist/services/service-host/install-identity.js +15 -5
  315. package/pd-cli/dist/services/service-host/install-identity.js.map +1 -1
  316. package/pd-cli/dist/services/service-host/locking/service-run-lock.d.ts +130 -9
  317. package/pd-cli/dist/services/service-host/locking/service-run-lock.d.ts.map +1 -1
  318. package/pd-cli/dist/services/service-host/locking/service-run-lock.js +99 -19
  319. package/pd-cli/dist/services/service-host/locking/service-run-lock.js.map +1 -1
  320. package/pd-cli/dist/services/service-host/managed-run.d.ts +75 -0
  321. package/pd-cli/dist/services/service-host/managed-run.d.ts.map +1 -0
  322. package/pd-cli/dist/services/service-host/managed-run.js +550 -0
  323. package/pd-cli/dist/services/service-host/managed-run.js.map +1 -0
  324. package/pd-cli/dist/services/service-host/progress-evidence.d.ts +38 -0
  325. package/pd-cli/dist/services/service-host/progress-evidence.d.ts.map +1 -0
  326. package/pd-cli/dist/services/service-host/progress-evidence.js +155 -0
  327. package/pd-cli/dist/services/service-host/progress-evidence.js.map +1 -0
  328. package/pd-cli/dist/services/service-host/run-once.d.ts.map +1 -1
  329. package/pd-cli/dist/services/service-host/run-once.js +4 -136
  330. package/pd-cli/dist/services/service-host/run-once.js.map +1 -1
  331. package/pd-cli/dist/services/service-host/scheduler/contract.d.ts +184 -0
  332. package/pd-cli/dist/services/service-host/scheduler/contract.d.ts.map +1 -0
  333. package/pd-cli/dist/services/service-host/scheduler/contract.js +86 -0
  334. package/pd-cli/dist/services/service-host/scheduler/contract.js.map +1 -0
  335. package/pd-cli/dist/services/service-host/scheduler/index.d.ts +76 -0
  336. package/pd-cli/dist/services/service-host/scheduler/index.d.ts.map +1 -0
  337. package/pd-cli/dist/services/service-host/scheduler/index.js +128 -0
  338. package/pd-cli/dist/services/service-host/scheduler/index.js.map +1 -0
  339. package/pd-cli/dist/services/service-host/scheduler/linux.d.ts +27 -0
  340. package/pd-cli/dist/services/service-host/scheduler/linux.d.ts.map +1 -0
  341. package/pd-cli/dist/services/service-host/scheduler/linux.js +1010 -0
  342. package/pd-cli/dist/services/service-host/scheduler/linux.js.map +1 -0
  343. package/pd-cli/dist/services/service-host/scheduler/macos.d.ts +13 -0
  344. package/pd-cli/dist/services/service-host/scheduler/macos.d.ts.map +1 -0
  345. package/pd-cli/dist/services/service-host/scheduler/macos.js +819 -0
  346. package/pd-cli/dist/services/service-host/scheduler/macos.js.map +1 -0
  347. package/pd-cli/dist/services/service-host/scheduler/runtime-io.d.ts +13 -0
  348. package/pd-cli/dist/services/service-host/scheduler/runtime-io.d.ts.map +1 -0
  349. package/pd-cli/dist/services/service-host/scheduler/runtime-io.js +141 -0
  350. package/pd-cli/dist/services/service-host/scheduler/runtime-io.js.map +1 -0
  351. package/pd-cli/dist/services/service-host/scheduler/service-status.d.ts +99 -0
  352. package/pd-cli/dist/services/service-host/scheduler/service-status.d.ts.map +1 -0
  353. package/pd-cli/dist/services/service-host/scheduler/service-status.js +202 -0
  354. package/pd-cli/dist/services/service-host/scheduler/service-status.js.map +1 -0
  355. package/pd-cli/dist/services/service-host/scheduler/windows.d.ts +40 -0
  356. package/pd-cli/dist/services/service-host/scheduler/windows.d.ts.map +1 -0
  357. package/pd-cli/dist/services/service-host/scheduler/windows.js +688 -0
  358. package/pd-cli/dist/services/service-host/scheduler/windows.js.map +1 -0
  359. package/pd-cli/dist/services/service-host/shadow-progress-store.d.ts +43 -0
  360. package/pd-cli/dist/services/service-host/shadow-progress-store.d.ts.map +1 -0
  361. package/pd-cli/dist/services/service-host/shadow-progress-store.js +156 -0
  362. package/pd-cli/dist/services/service-host/shadow-progress-store.js.map +1 -0
  363. package/pd-cli/dist/services/service-host/shadow-run.d.ts +87 -0
  364. package/pd-cli/dist/services/service-host/shadow-run.d.ts.map +1 -0
  365. package/pd-cli/dist/services/service-host/shadow-run.js +549 -0
  366. package/pd-cli/dist/services/service-host/shadow-run.js.map +1 -0
  367. package/pd-cli/dist/services/service-host/status/service-run-status.d.ts +114 -4
  368. package/pd-cli/dist/services/service-host/status/service-run-status.d.ts.map +1 -1
  369. package/pd-cli/dist/services/service-host/status/service-run-status.js +37 -0
  370. package/pd-cli/dist/services/service-host/status/service-run-status.js.map +1 -1
  371. package/pd-cli/dist/services/service-host/worker-adapter-codex.d.ts +2 -0
  372. package/pd-cli/dist/services/service-host/worker-adapter-codex.d.ts.map +1 -0
  373. package/pd-cli/dist/services/service-host/worker-adapter-codex.js +76 -0
  374. package/pd-cli/dist/services/service-host/worker-adapter-codex.js.map +1 -0
  375. package/pd-cli/dist/services/service-host/worker-adapter-openclaw.d.ts +2 -0
  376. package/pd-cli/dist/services/service-host/worker-adapter-openclaw.d.ts.map +1 -0
  377. package/pd-cli/dist/services/service-host/worker-adapter-openclaw.js +49 -0
  378. package/pd-cli/dist/services/service-host/worker-adapter-openclaw.js.map +1 -0
  379. package/pd-cli/dist/services/service-host/worker-adapter-workbuddy.d.ts +2 -0
  380. package/pd-cli/dist/services/service-host/worker-adapter-workbuddy.d.ts.map +1 -0
  381. package/pd-cli/dist/services/service-host/worker-adapter-workbuddy.js +36 -0
  382. package/pd-cli/dist/services/service-host/worker-adapter-workbuddy.js.map +1 -0
  383. package/pd-cli/dist/services/service-host/worker-adapter.d.ts +187 -0
  384. package/pd-cli/dist/services/service-host/worker-adapter.d.ts.map +1 -0
  385. package/pd-cli/dist/services/service-host/worker-adapter.js +609 -0
  386. package/pd-cli/dist/services/service-host/worker-adapter.js.map +1 -0
  387. package/pd-cli/dist/services/service-host/worker-env.d.ts +84 -0
  388. package/pd-cli/dist/services/service-host/worker-env.d.ts.map +1 -0
  389. package/pd-cli/dist/services/service-host/worker-env.js +195 -0
  390. package/pd-cli/dist/services/service-host/worker-env.js.map +1 -0
  391. package/pd-cli/dist/services/service-host/worker-process.d.ts +75 -0
  392. package/pd-cli/dist/services/service-host/worker-process.d.ts.map +1 -0
  393. package/pd-cli/dist/services/service-host/worker-process.js +225 -0
  394. package/pd-cli/dist/services/service-host/worker-process.js.map +1 -0
  395. package/pd-cli/dist/services/service-host/workspace-dispatch.d.ts +61 -0
  396. package/pd-cli/dist/services/service-host/workspace-dispatch.d.ts.map +1 -0
  397. package/pd-cli/dist/services/service-host/workspace-dispatch.js +105 -0
  398. package/pd-cli/dist/services/service-host/workspace-dispatch.js.map +1 -0
  399. package/pd-cli/dist/services/service-host/workspace-handover.d.ts +190 -0
  400. package/pd-cli/dist/services/service-host/workspace-handover.d.ts.map +1 -0
  401. package/pd-cli/dist/services/service-host/workspace-handover.js +1393 -0
  402. package/pd-cli/dist/services/service-host/workspace-handover.js.map +1 -0
  403. package/pd-cli/package.json +6 -5
  404. package/pd-mcp-server/dist/submit-assembly.js +159 -42
  405. package/pd-mcp-server/dist/version.d.ts +1 -1
  406. package/pd-mcp-server/dist/version.js +1 -1
  407. package/pd-mcp-server/package.json +1 -1
  408. package/plugin/dist/bundle.js +662 -637
  409. package/plugin/dist/openclaw-worker.d.ts +92 -0
  410. package/plugin/dist/openclaw-worker.js +2446 -0
  411. package/plugin/dist/openclaw.plugin.json +1 -1
  412. package/plugin/dist/service/gateway-consumer-lease.d.ts +142 -0
  413. package/plugin/dist/service/gateway-quiesce-ack.d.ts +40 -0
  414. package/plugin/dist/service/internalization-auto-consumer-service.d.ts +68 -1
  415. package/plugin/openclaw.plugin.json +1 -1
  416. package/plugin/package.json +5 -1
  417. package/release-manager/dist/installer.js +77 -30
  418. package/release-manager/dist/installers/mcp-registration-conflict.js +34 -1
  419. package/release-manager/dist/installers/workbuddy-host-installer.js +284 -21
  420. package/release-manager/dist/service-host-bridge.js +292 -0
  421. package/release-manager/dist/update/install-layout.js +42 -15
  422. package/release-manager/package.json +5 -4
  423. package/workbuddy-adapter/dist/index.d.ts +1 -1
  424. package/workbuddy-adapter/dist/index.js +1 -1
  425. package/workbuddy-adapter/dist/worker/workspace-worker.d.ts +7 -0
  426. package/workbuddy-adapter/dist/worker/workspace-worker.js +179 -10
  427. package/workbuddy-adapter/package.json +1 -1
  428. 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
- return candidate.explicitChannel === 'codex_explicit_agent'
432
- ? 'Codex explicit owner statement (agent-assisted, no prefix)'
433
- : `${candidate.hostKind === 'workbuddy' ? 'WorkBuddy' : 'Codex'} explicit owner statement (PD记录痛苦 prefix)`;
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
- : { text: sanitizeString(candidate.text, workspaceDir), classification: 'owner_statement', channel: candidate.explicitChannel === 'codex_explicit_agent' ? 'codex_explicit_agent' : 'codex_explicit_prefix' } }
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 ingressDecision = isExplicit
844
- ? evaluatePainIngress(buildOwnerCorrectionIngressReport({
845
- hostKind: candidate.hostKind,
846
- channel: ownerExplicitChannel(candidate),
847
- logicalObservationKey: candidate.logicalObservationKey,
848
- rolloutIdentity: candidate.rolloutIdentity,
849
- rootSessionId: candidate.rootSessionId,
850
- hostTurnId: candidate.hostTurnId,
851
- painId,
852
- reason: ingressReasonValue,
853
- // Codex has a real governance observation anchor when ingestion
854
- // persisted one; otherwise (ingestion disabled) the statement degrades
855
- // to the Owner Manual path instead of fabricating a trace. WorkBuddy
856
- // explicit intake has no transcript evidence and degrades honestly.
857
- evidence: correctionIngressEvidence({
858
- db,
859
- hostKind: candidate.hostKind,
860
- logicalObservationKey: candidate.logicalObservationKey,
861
- rolloutIdentity: candidate.rolloutIdentity,
862
- rootSessionId: candidate.rootSessionId,
863
- hostTurnId: candidate.hostTurnId,
864
- text: candidate.text,
865
- workspaceDir,
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
- : evaluatePainIngress(buildCorrectionIngressReport({
869
- hostKind: candidate.hostKind,
870
- logicalObservationKey: candidate.logicalObservationKey,
871
- rolloutIdentity: candidate.rolloutIdentity,
872
- rootSessionId: candidate.rootSessionId,
873
- hostTurnId: candidate.hostTurnId,
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
- && ((own(correctionEvidence, 'channel') === 'codex_explicit_prefix' || own(correctionEvidence, 'channel') === 'codex_explicit_agent') && hostKind === 'codex'
1676
- || own(correctionEvidence, 'channel') === 'workbuddy_explicit_prefix' && hostKind === 'workbuddy')
1677
- && typeof own(correctionEvidence, 'text') === 'string'
1678
- && own(correctionEvidence, 'text').length > 0;
1679
- if (correctionEvidence !== undefined && !hasOwnerStatement)
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
- if (!Array.isArray(evidence) || (evidence.length === 0 && !hasOwnerStatement) || evidence.length > 8)
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
- ? correctionIngressEvidence({
1762
- db,
1763
- hostKind: markerHostKind,
1764
- logicalObservationKey: markerKey,
1765
- rolloutIdentity: typeof rolloutIdentity === 'string' ? rolloutIdentity : '',
1766
- rootSessionId: payloadParsed.sessionId,
1767
- hostTurnId,
1768
- text: payloadParsed.reason,
1769
- workspaceDir,
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 ingressDecision = ownerChannel !== undefined
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
- hostKind: markerHostKind,
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
- : evaluatePainIngress(buildCorrectionIngressReport({
1799
- hostKind: markerHostKind,
1800
- logicalObservationKey: markerKey,
1801
- rolloutIdentity: typeof rolloutIdentity === 'string' ? rolloutIdentity : '',
1802
- rootSessionId: payloadParsed.sessionId,
1803
- hostTurnId,
1804
- painId: input.canonicalPainId,
1805
- reason: payloadParsed.reason,
1806
- evidence: ingressEvidence,
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
- // Recovery path: a task link already exists. The ingress decision above
1828
- // still ran, so an inconsistent admitted marker fails closed instead of
1829
- // being reported as a healthy duplicate.
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
- ? { correctionEvidence: { ...payloadParsed.correctionEvidence, sessionId: payloadParsed.sessionId } }
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
- const codexConsent = typeof input.codexConversationIngestionEnabled === 'boolean'
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
- const codexConsent = typeof input.codexConversationIngestionEnabled === 'boolean'
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] };