create-principles-disciple 1.144.27 → 1.145.0

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 (338) hide show
  1. package/_release/product-identity.json +2 -2
  2. package/codex-adapter/dist/index.d.ts +2 -2
  3. package/codex-adapter/dist/index.js +1 -1
  4. package/codex-adapter/dist/ingestion/admission.js +16 -0
  5. package/codex-adapter/dist/ingestion/codex-version.d.ts +10 -4
  6. package/codex-adapter/dist/ingestion/codex-version.js +10 -4
  7. package/codex-adapter/dist/ingestion/explicit-owner-statement.d.ts +48 -0
  8. package/codex-adapter/dist/ingestion/explicit-owner-statement.js +123 -0
  9. package/codex-adapter/dist/ingestion/ingestion.js +50 -1
  10. package/codex-adapter/dist/pd-hook.js +66 -3
  11. package/codex-adapter/dist/worker/workspace-worker.d.ts +14 -0
  12. package/codex-adapter/dist/worker/workspace-worker.js +194 -11
  13. package/codex-adapter/package.json +2 -2
  14. package/console/dist/server/models/ApprovalsConsoleModel.d.ts +2 -2
  15. package/console/dist/server/models/ApprovalsConsoleModel.js +1 -1
  16. package/console/dist/server/models/ApprovalsGroupedConsoleModel.js +1 -1
  17. package/console/dist/server/models/PrinciplesConsoleModel.d.ts +26 -1
  18. package/console/dist/server/models/PrinciplesConsoleModel.js +18 -1
  19. package/console/dist/server/routes/activations.js +4 -4
  20. package/console/dist/server/routes/approvals.js +2 -2
  21. package/console/dist/server/routes/failed-tasks.d.ts +9 -0
  22. package/console/dist/server/routes/failed-tasks.js +116 -7
  23. package/console/dist/server/routes/principles.js +73 -1
  24. package/console/dist/shared/prompt-injection-contract.d.ts +1 -1
  25. package/console/dist/ui/api.d.ts +5 -5
  26. package/console/dist/ui/i18n/en.json +13 -2
  27. package/console/dist/ui/i18n/zh-CN.json +13 -2
  28. package/console/dist/ui/pages/activation/ActivationPage.js +2 -1
  29. package/console/dist/ui/pages/failed-tasks/FailedTasksPage.js +42 -4
  30. package/console/dist/ui/pages/focus/FocusPage.js +3 -3
  31. package/console/dist/ui/pages/principles/PrinciplesPage.js +7 -2
  32. package/console/dist/ui/utils/validators.d.ts +6 -2
  33. package/console/dist/ui/utils/validators.js +19 -4
  34. package/console/dist/web/assets/app.css +26 -0
  35. package/console/dist/web/assets/app.js +24 -24
  36. package/console/package.json +4 -4
  37. package/core/dist/host/host-installer.d.ts +3 -1
  38. package/core/dist/host/host-installer.d.ts.map +1 -1
  39. package/core/dist/host/host-installer.js.map +1 -1
  40. package/core/dist/runtime-v2/admission-gate.d.ts +8 -0
  41. package/core/dist/runtime-v2/admission-gate.d.ts.map +1 -1
  42. package/core/dist/runtime-v2/admission-gate.js +3 -2
  43. package/core/dist/runtime-v2/admission-gate.js.map +1 -1
  44. package/core/dist/runtime-v2/config/pd-config-defaults.d.ts.map +1 -1
  45. package/core/dist/runtime-v2/config/pd-config-defaults.js +16 -1
  46. package/core/dist/runtime-v2/config/pd-config-defaults.js.map +1 -1
  47. package/core/dist/runtime-v2/context-payload.d.ts +43 -3
  48. package/core/dist/runtime-v2/context-payload.d.ts.map +1 -1
  49. package/core/dist/runtime-v2/context-payload.js +15 -1
  50. package/core/dist/runtime-v2/context-payload.js.map +1 -1
  51. package/core/dist/runtime-v2/evidence-guards.d.ts +6 -0
  52. package/core/dist/runtime-v2/evidence-guards.d.ts.map +1 -1
  53. package/core/dist/runtime-v2/evidence-guards.js +11 -0
  54. package/core/dist/runtime-v2/evidence-guards.js.map +1 -1
  55. package/core/dist/runtime-v2/evolution/evolution-types.d.ts +4 -4
  56. package/core/dist/runtime-v2/evolution/evolution-types.d.ts.map +1 -1
  57. package/core/dist/runtime-v2/evolution/evolution-types.js +1 -1
  58. package/core/dist/runtime-v2/evolution/evolution-types.js.map +1 -1
  59. package/core/dist/runtime-v2/feature-flags/feature-flag-contract.d.ts.map +1 -1
  60. package/core/dist/runtime-v2/feature-flags/feature-flag-contract.js +6 -0
  61. package/core/dist/runtime-v2/feature-flags/feature-flag-contract.js.map +1 -1
  62. package/core/dist/runtime-v2/feature-flags/feature-flag-lifecycle.d.ts.map +1 -1
  63. package/core/dist/runtime-v2/feature-flags/feature-flag-lifecycle.js +8 -0
  64. package/core/dist/runtime-v2/feature-flags/feature-flag-lifecycle.js.map +1 -1
  65. package/core/dist/runtime-v2/index.d.ts +5 -2
  66. package/core/dist/runtime-v2/index.d.ts.map +1 -1
  67. package/core/dist/runtime-v2/index.js +3 -1
  68. package/core/dist/runtime-v2/index.js.map +1 -1
  69. package/core/dist/runtime-v2/internalization/evaluator-output.d.ts +11 -0
  70. package/core/dist/runtime-v2/internalization/evaluator-output.d.ts.map +1 -1
  71. package/core/dist/runtime-v2/internalization/evaluator-output.js +10 -0
  72. package/core/dist/runtime-v2/internalization/evaluator-output.js.map +1 -1
  73. package/core/dist/runtime-v2/internalization/evaluator-prompt-builder.d.ts +3 -3
  74. package/core/dist/runtime-v2/internalization/evaluator-prompt-builder.d.ts.map +1 -1
  75. package/core/dist/runtime-v2/internalization/evaluator-prompt-builder.js +49 -5
  76. package/core/dist/runtime-v2/internalization/evaluator-prompt-builder.js.map +1 -1
  77. package/core/dist/runtime-v2/internalization/evaluator-runner.d.ts.map +1 -1
  78. package/core/dist/runtime-v2/internalization/evaluator-runner.js +13 -16
  79. package/core/dist/runtime-v2/internalization/evaluator-runner.js.map +1 -1
  80. package/core/dist/runtime-v2/internalization/owner-decision-review.d.ts.map +1 -1
  81. package/core/dist/runtime-v2/internalization/owner-decision-review.js +5 -1
  82. package/core/dist/runtime-v2/internalization/owner-decision-review.js.map +1 -1
  83. package/core/dist/runtime-v2/internalization/owner-review.d.ts +2 -2
  84. package/core/dist/runtime-v2/internalization/owner-review.js +2 -2
  85. package/core/dist/runtime-v2/internalization/scribe-output.d.ts +12 -0
  86. package/core/dist/runtime-v2/internalization/scribe-output.d.ts.map +1 -1
  87. package/core/dist/runtime-v2/internalization/scribe-output.js +20 -0
  88. package/core/dist/runtime-v2/internalization/scribe-output.js.map +1 -1
  89. package/core/dist/runtime-v2/internalization/scribe-prompt-builder.d.ts +32 -1
  90. package/core/dist/runtime-v2/internalization/scribe-prompt-builder.d.ts.map +1 -1
  91. package/core/dist/runtime-v2/internalization/scribe-prompt-builder.js +38 -1
  92. package/core/dist/runtime-v2/internalization/scribe-prompt-builder.js.map +1 -1
  93. package/core/dist/runtime-v2/internalization-queue-read-model.d.ts +6 -0
  94. package/core/dist/runtime-v2/internalization-queue-read-model.d.ts.map +1 -1
  95. package/core/dist/runtime-v2/internalization-queue-read-model.js +8 -1
  96. package/core/dist/runtime-v2/internalization-queue-read-model.js.map +1 -1
  97. package/core/dist/runtime-v2/intervention-evidence-normalizer.d.ts.map +1 -1
  98. package/core/dist/runtime-v2/intervention-evidence-normalizer.js +10 -3
  99. package/core/dist/runtime-v2/intervention-evidence-normalizer.js.map +1 -1
  100. package/core/dist/runtime-v2/pain-ingress.d.ts +1 -1
  101. package/core/dist/runtime-v2/pain-ingress.d.ts.map +1 -1
  102. package/core/dist/runtime-v2/pain-signal-bridge.d.ts +68 -2
  103. package/core/dist/runtime-v2/pain-signal-bridge.d.ts.map +1 -1
  104. package/core/dist/runtime-v2/pain-signal-bridge.js +541 -18
  105. package/core/dist/runtime-v2/pain-signal-bridge.js.map +1 -1
  106. package/core/dist/runtime-v2/pain-signal-runtime-factory.d.ts.map +1 -1
  107. package/core/dist/runtime-v2/pain-signal-runtime-factory.js +4 -0
  108. package/core/dist/runtime-v2/pain-signal-runtime-factory.js.map +1 -1
  109. package/core/dist/runtime-v2/product-telemetry/snapshot-contract.d.ts +2 -2
  110. package/core/dist/runtime-v2/product-telemetry/snapshot-contract.d.ts.map +1 -1
  111. package/core/dist/runtime-v2/product-telemetry/snapshot-contract.js +2 -2
  112. package/core/dist/runtime-v2/product-telemetry/snapshot-contract.js.map +1 -1
  113. package/core/dist/runtime-v2/store/candidate/admission-document.d.ts +90 -0
  114. package/core/dist/runtime-v2/store/candidate/admission-document.d.ts.map +1 -0
  115. package/core/dist/runtime-v2/store/candidate/admission-document.js +142 -0
  116. package/core/dist/runtime-v2/store/candidate/admission-document.js.map +1 -0
  117. package/core/dist/runtime-v2/store/candidate/candidate-store.d.ts +53 -0
  118. package/core/dist/runtime-v2/store/candidate/candidate-store.d.ts.map +1 -1
  119. package/core/dist/runtime-v2/store/candidate/memory-candidate-store.d.ts +35 -0
  120. package/core/dist/runtime-v2/store/candidate/memory-candidate-store.d.ts.map +1 -1
  121. package/core/dist/runtime-v2/store/candidate/memory-candidate-store.js +48 -0
  122. package/core/dist/runtime-v2/store/candidate/memory-candidate-store.js.map +1 -1
  123. package/core/dist/runtime-v2/store/candidate/sqlite-candidate-store.d.ts +44 -0
  124. package/core/dist/runtime-v2/store/candidate/sqlite-candidate-store.d.ts.map +1 -1
  125. package/core/dist/runtime-v2/store/candidate/sqlite-candidate-store.js +136 -0
  126. package/core/dist/runtime-v2/store/candidate/sqlite-candidate-store.js.map +1 -1
  127. package/core/dist/runtime-v2/store/context/sqlite-context-assembler.js.map +1 -1
  128. package/core/dist/runtime-v2/store/intervention-evidence-schema.js +1 -1
  129. package/core/dist/runtime-v2/store/runtime-state-manager.d.ts +65 -0
  130. package/core/dist/runtime-v2/store/runtime-state-manager.d.ts.map +1 -1
  131. package/core/dist/runtime-v2/store/runtime-state-manager.js +46 -0
  132. package/core/dist/runtime-v2/store/runtime-state-manager.js.map +1 -1
  133. package/core/dist/runtime-v2/store/sqlite-connection.d.ts.map +1 -1
  134. package/core/dist/runtime-v2/store/sqlite-connection.js +42 -0
  135. package/core/dist/runtime-v2/store/sqlite-connection.js.map +1 -1
  136. package/core/dist/runtime-v2/store/sqlite-intervention-evidence-store.d.ts +1 -1
  137. package/core/dist/runtime-v2/store/sqlite-intervention-evidence-store.d.ts.map +1 -1
  138. package/core/dist/runtime-v2/store/sqlite-intervention-evidence-store.js.map +1 -1
  139. package/core/dist/runtime-v2/store/task/sqlite-family-reopen.d.ts +19 -0
  140. package/core/dist/runtime-v2/store/task/sqlite-family-reopen.d.ts.map +1 -0
  141. package/core/dist/runtime-v2/store/task/sqlite-family-reopen.js +36 -0
  142. package/core/dist/runtime-v2/store/task/sqlite-family-reopen.js.map +1 -0
  143. package/core/dist/runtime-v2/store/task/sqlite-task-store.d.ts +23 -0
  144. package/core/dist/runtime-v2/store/task/sqlite-task-store.d.ts.map +1 -1
  145. package/core/dist/runtime-v2/store/task/sqlite-task-store.js +50 -0
  146. package/core/dist/runtime-v2/store/task/sqlite-task-store.js.map +1 -1
  147. package/core/dist/runtime-v2/task-status.d.ts +3 -1
  148. package/core/dist/runtime-v2/task-status.d.ts.map +1 -1
  149. package/core/dist/runtime-v2/task-status.js +1 -1
  150. package/core/dist/runtime-v2/task-status.js.map +1 -1
  151. package/core/dist/runtime-v2/trajectory-schema.d.ts.map +1 -1
  152. package/core/dist/runtime-v2/trajectory-schema.js +11 -0
  153. package/core/dist/runtime-v2/trajectory-schema.js.map +1 -1
  154. package/core/dist/runtime-v2/types/event-types.d.ts +2 -2
  155. package/core/dist/runtime-v2/types/event-types.d.ts.map +1 -1
  156. package/core/dist/runtime-v2/types/event-types.js +1 -1
  157. package/core/dist/runtime-v2/types/event-types.js.map +1 -1
  158. package/core/dist/runtime-v2/types/evidence-chain-contract.d.ts +1 -1
  159. package/core/dist/runtime-v2/types/evidence-chain-contract.d.ts.map +1 -1
  160. package/core/dist/runtime-v2/types/evidence-chain-contract.js +2 -2
  161. package/core/dist/runtime-v2/types/evidence-chain-contract.js.map +1 -1
  162. package/core/dist/runtime-v2/types/intervention-evidence-contract.d.ts +3 -3
  163. package/core/dist/runtime-v2/types/intervention-evidence-contract.d.ts.map +1 -1
  164. package/core/dist/runtime-v2/types/intervention-evidence-contract.js +1 -0
  165. package/core/dist/runtime-v2/types/intervention-evidence-contract.js.map +1 -1
  166. package/core/dist/telemetry-event.d.ts +2 -2
  167. package/core/dist/telemetry-event.d.ts.map +1 -1
  168. package/core/dist/telemetry-event.js +4 -0
  169. package/core/dist/telemetry-event.js.map +1 -1
  170. package/core/dist/trajectory-types.d.ts +2 -2
  171. package/core/dist/trajectory-types.d.ts.map +1 -1
  172. package/core/package.json +3 -3
  173. package/dist/index.d.ts.map +1 -1
  174. package/dist/index.js +84 -8
  175. package/dist/index.js.map +1 -1
  176. package/dist/installer.d.ts +42 -11
  177. package/dist/installer.d.ts.map +1 -1
  178. package/dist/installer.js +140 -36
  179. package/dist/installer.js.map +1 -1
  180. package/dist/installers/index.d.ts +18 -7
  181. package/dist/installers/index.d.ts.map +1 -1
  182. package/dist/installers/index.js +13 -4
  183. package/dist/installers/index.js.map +1 -1
  184. package/dist/installers/workbuddy-host-installer.d.ts +246 -0
  185. package/dist/installers/workbuddy-host-installer.d.ts.map +1 -0
  186. package/dist/installers/workbuddy-host-installer.js +1419 -0
  187. package/dist/installers/workbuddy-host-installer.js.map +1 -0
  188. package/dist/mvp-config.d.ts +24 -0
  189. package/dist/mvp-config.d.ts.map +1 -1
  190. package/dist/mvp-config.js +36 -0
  191. package/dist/mvp-config.js.map +1 -1
  192. package/dist/prompts.d.ts +13 -0
  193. package/dist/prompts.d.ts.map +1 -1
  194. package/dist/prompts.js +45 -8
  195. package/dist/prompts.js.map +1 -1
  196. package/dist/uninstaller.d.ts +1 -1
  197. package/dist/uninstaller.d.ts.map +1 -1
  198. package/dist/uninstaller.js +29 -4
  199. package/dist/uninstaller.js.map +1 -1
  200. package/host-runtime/dist/governance-signal-admission.d.ts +63 -0
  201. package/host-runtime/dist/governance-signal-admission.js +322 -53
  202. package/host-runtime/dist/host-liveness-contract.js +7 -1
  203. package/host-runtime/dist/index.d.ts +1 -0
  204. package/host-runtime/dist/index.js +5 -1
  205. package/host-runtime/dist/internalization-consumer-cycle.d.ts +12 -0
  206. package/host-runtime/dist/internalization-consumer-cycle.js +43 -1
  207. package/host-runtime/dist/intervention-evidence-ingress.d.ts +1 -1
  208. package/host-runtime/dist/product-telemetry/service.js +1 -1
  209. package/host-runtime/dist/production-pain-evidence.d.ts +59 -1
  210. package/host-runtime/dist/production-pain-evidence.js +200 -17
  211. package/host-runtime/dist/prompt-activation-deliverability.js +5 -4
  212. package/host-runtime/dist/prompt-injection-event-evidence.d.ts +1 -1
  213. package/host-runtime/dist/prompt-injection-event-evidence.js +5 -1
  214. package/host-runtime/dist/prompt-injection-projection.d.ts +14 -5
  215. package/host-runtime/dist/prompt-injection-projection.js +30 -16
  216. package/host-runtime/dist/workbuddy-worker-status.d.ts +24 -0
  217. package/host-runtime/dist/workbuddy-worker-status.js +52 -0
  218. package/host-runtime/package.json +3 -3
  219. package/install-layout/dist/index.d.ts +18 -1
  220. package/install-layout/dist/index.js +15 -2
  221. package/install-layout/package.json +1 -1
  222. package/package.json +6 -5
  223. package/pd-cli/dist/commands/candidate.d.ts.map +1 -1
  224. package/pd-cli/dist/commands/candidate.js +44 -4
  225. package/pd-cli/dist/commands/candidate.js.map +1 -1
  226. package/pd-cli/dist/commands/codex-worker.d.ts.map +1 -1
  227. package/pd-cli/dist/commands/codex-worker.js +30 -1
  228. package/pd-cli/dist/commands/codex-worker.js.map +1 -1
  229. package/pd-cli/dist/commands/config-doctor.d.ts.map +1 -1
  230. package/pd-cli/dist/commands/config-doctor.js +19 -4
  231. package/pd-cli/dist/commands/config-doctor.js.map +1 -1
  232. package/pd-cli/dist/commands/diagnose.d.ts.map +1 -1
  233. package/pd-cli/dist/commands/diagnose.js +4 -1
  234. package/pd-cli/dist/commands/diagnose.js.map +1 -1
  235. package/pd-cli/dist/commands/health-codex-install.d.ts +85 -0
  236. package/pd-cli/dist/commands/health-codex-install.d.ts.map +1 -0
  237. package/pd-cli/dist/commands/health-codex-install.js +207 -0
  238. package/pd-cli/dist/commands/health-codex-install.js.map +1 -0
  239. package/pd-cli/dist/commands/health-codex.d.ts.map +1 -1
  240. package/pd-cli/dist/commands/health-codex.js +78 -0
  241. package/pd-cli/dist/commands/health-codex.js.map +1 -1
  242. package/pd-cli/dist/commands/pain-list.d.ts +3 -2
  243. package/pd-cli/dist/commands/pain-list.d.ts.map +1 -1
  244. package/pd-cli/dist/commands/pain-list.js +10 -10
  245. package/pd-cli/dist/commands/pain-list.js.map +1 -1
  246. package/pd-cli/dist/commands/pain-record.d.ts +2 -0
  247. package/pd-cli/dist/commands/pain-record.d.ts.map +1 -1
  248. package/pd-cli/dist/commands/pain-record.js +36 -0
  249. package/pd-cli/dist/commands/pain-record.js.map +1 -1
  250. package/pd-cli/dist/commands/pain-retry.d.ts +6 -0
  251. package/pd-cli/dist/commands/pain-retry.d.ts.map +1 -1
  252. package/pd-cli/dist/commands/pain-retry.js +152 -5
  253. package/pd-cli/dist/commands/pain-retry.js.map +1 -1
  254. package/pd-cli/dist/commands/runtime-activation.d.ts +1 -1
  255. package/pd-cli/dist/commands/runtime-activation.d.ts.map +1 -1
  256. package/pd-cli/dist/commands/runtime-activation.js +3 -3
  257. package/pd-cli/dist/commands/runtime-activation.js.map +1 -1
  258. package/pd-cli/dist/commands/workbuddy-worker.d.ts +19 -0
  259. package/pd-cli/dist/commands/workbuddy-worker.d.ts.map +1 -0
  260. package/pd-cli/dist/commands/workbuddy-worker.js +168 -0
  261. package/pd-cli/dist/commands/workbuddy-worker.js.map +1 -0
  262. package/pd-cli/dist/index.js +29 -1
  263. package/pd-cli/dist/index.js.map +1 -1
  264. package/pd-cli/dist/resolve-workspace.d.ts +14 -2
  265. package/pd-cli/dist/resolve-workspace.d.ts.map +1 -1
  266. package/pd-cli/dist/resolve-workspace.js +88 -21
  267. package/pd-cli/dist/resolve-workspace.js.map +1 -1
  268. package/pd-cli/dist/services/admission-write-gate.d.ts +24 -0
  269. package/pd-cli/dist/services/admission-write-gate.d.ts.map +1 -0
  270. package/pd-cli/dist/services/admission-write-gate.js +41 -0
  271. package/pd-cli/dist/services/admission-write-gate.js.map +1 -0
  272. package/pd-cli/dist/services/pd-config-loader.d.ts +39 -7
  273. package/pd-cli/dist/services/pd-config-loader.d.ts.map +1 -1
  274. package/pd-cli/dist/services/pd-config-loader.js +111 -18
  275. package/pd-cli/dist/services/pd-config-loader.js.map +1 -1
  276. package/pd-cli/dist/services/rulehost-pipeline-runner.d.ts +10 -0
  277. package/pd-cli/dist/services/rulehost-pipeline-runner.d.ts.map +1 -1
  278. package/pd-cli/dist/services/rulehost-pipeline-runner.js +59 -4
  279. package/pd-cli/dist/services/rulehost-pipeline-runner.js.map +1 -1
  280. package/pd-cli/package.json +4 -3
  281. package/plugin/dist/bundle.js +564 -509
  282. package/plugin/dist/governance-audit.js +1 -1
  283. package/plugin/dist/openclaw.plugin.json +1 -1
  284. package/plugin/dist/rulehost-evidence.js +1 -1
  285. package/plugin/openclaw.plugin.json +1 -1
  286. package/plugin/package.json +3 -3
  287. package/release-manager/dist/index.d.ts.map +1 -1
  288. package/release-manager/dist/index.js +84 -8
  289. package/release-manager/dist/index.js.map +1 -1
  290. package/release-manager/dist/installer.d.ts +42 -11
  291. package/release-manager/dist/installer.d.ts.map +1 -1
  292. package/release-manager/dist/installer.js +140 -36
  293. package/release-manager/dist/installer.js.map +1 -1
  294. package/release-manager/dist/installers/index.d.ts +18 -7
  295. package/release-manager/dist/installers/index.d.ts.map +1 -1
  296. package/release-manager/dist/installers/index.js +13 -4
  297. package/release-manager/dist/installers/index.js.map +1 -1
  298. package/release-manager/dist/installers/workbuddy-host-installer.d.ts +246 -0
  299. package/release-manager/dist/installers/workbuddy-host-installer.d.ts.map +1 -0
  300. package/release-manager/dist/installers/workbuddy-host-installer.js +1419 -0
  301. package/release-manager/dist/installers/workbuddy-host-installer.js.map +1 -0
  302. package/release-manager/dist/mvp-config.d.ts +24 -0
  303. package/release-manager/dist/mvp-config.d.ts.map +1 -1
  304. package/release-manager/dist/mvp-config.js +36 -0
  305. package/release-manager/dist/mvp-config.js.map +1 -1
  306. package/release-manager/dist/prompts.d.ts +13 -0
  307. package/release-manager/dist/prompts.d.ts.map +1 -1
  308. package/release-manager/dist/prompts.js +45 -8
  309. package/release-manager/dist/prompts.js.map +1 -1
  310. package/release-manager/dist/uninstaller.d.ts +1 -1
  311. package/release-manager/dist/uninstaller.d.ts.map +1 -1
  312. package/release-manager/dist/uninstaller.js +29 -4
  313. package/release-manager/dist/uninstaller.js.map +1 -1
  314. package/release-manager/package.json +5 -4
  315. package/workbuddy-adapter/dist/codec/index.d.ts +2 -0
  316. package/workbuddy-adapter/dist/codec/index.js +2 -0
  317. package/workbuddy-adapter/dist/codec/input-decoder.d.ts +30 -0
  318. package/workbuddy-adapter/dist/codec/input-decoder.js +232 -0
  319. package/workbuddy-adapter/dist/codec/output-encoder.d.ts +62 -0
  320. package/workbuddy-adapter/dist/codec/output-encoder.js +75 -0
  321. package/workbuddy-adapter/dist/host-adapter.d.ts +33 -0
  322. package/workbuddy-adapter/dist/host-adapter.js +23 -0
  323. package/workbuddy-adapter/dist/index.d.ts +16 -0
  324. package/workbuddy-adapter/dist/index.js +16 -0
  325. package/workbuddy-adapter/dist/pd-hook.d.ts +17 -0
  326. package/workbuddy-adapter/dist/pd-hook.js +505 -0
  327. package/workbuddy-adapter/dist/tool-semantics.d.ts +22 -0
  328. package/workbuddy-adapter/dist/tool-semantics.js +33 -0
  329. package/workbuddy-adapter/dist/workbuddy-evidence-recorder.d.ts +50 -0
  330. package/workbuddy-adapter/dist/workbuddy-evidence-recorder.js +238 -0
  331. package/workbuddy-adapter/dist/worker/workspace-worker.d.ts +41 -0
  332. package/workbuddy-adapter/dist/worker/workspace-worker.js +219 -0
  333. package/workbuddy-adapter/dist/workspace-resolution.d.ts +15 -0
  334. package/workbuddy-adapter/dist/workspace-resolution.js +53 -0
  335. package/workbuddy-adapter/package.json +62 -0
  336. package/workbuddy-adapter/plugin/.codebuddy-plugin/plugin.json +6 -0
  337. package/workbuddy-adapter/plugin/hooks/hooks.json +62 -0
  338. package/workbuddy-adapter/plugin/scripts/wrapper.cjs +79 -0
@@ -3,24 +3,32 @@ import { escapeXml } from '@principles/core/prompt-builder';
3
3
  import { loadPdConfigForPlugin } from './pd-config.js';
4
4
  import { buildActivePrinciplePromptContext, readPromptActivationCandidates, MAX_SHARED_DIAGNOSTIC_IDS } from './active-principle-prompt.js';
5
5
  import { readWorkspaceHostKindFacts } from './host-liveness-contract.js';
6
- export const PROMPT_INJECTION_TARGET_HOSTS = ['openclaw', 'codex'];
6
+ /** Single host roster (review P2): every consumer derives from this list, so a
7
+ * new host cannot fork route-unconfirmed per-host forecasts from the routes. */
8
+ export const PROMPT_INJECTION_TARGET_HOSTS = ['openclaw', 'codex', 'workbuddy'];
9
+ /** Runtime membership test derived from the roster (rc-2): the ONE guard for
10
+ * "is this untrusted host-kind string a host with a known prompt-injection
11
+ * route". Every consumer narrows with this — never by re-typing the literals
12
+ * (review R1: each re-typed list forked the roster and dropped WorkBuddy). */
13
+ export function isPromptInjectionTargetHost(kind) {
14
+ return typeof kind === 'string' && PROMPT_INJECTION_TARGET_HOSTS.includes(kind);
15
+ }
7
16
  export const PROMPT_INJECTION_UNIT = 'utf16_code_units';
8
17
  /**
9
18
  * THE one route formula (P4): Codex always injects through the shared route
10
- * (codex-adapter has no flag branch); OpenClaw routes by its
11
- * `abstraction_layer_v1` gate. Every consumer that needs "which route would
12
- * host X take" must call this — never re-type the ternary.
19
+ * (codex-adapter has no flag branch); so does WorkBuddy (workbuddy-adapter
20
+ * renders through the shared runtime unconditionally — it has no legacy
21
+ * route); OpenClaw routes by its `abstraction_layer_v1` gate. Every consumer
22
+ * that needs "which route would host X take" must call this — never re-type
23
+ * the ternary.
13
24
  */
14
25
  export function promptRouteForHost(hostKind, flagEnabled) {
15
- if (hostKind === 'codex')
26
+ if (hostKind === 'codex' || hostKind === 'workbuddy')
16
27
  return 'shared_render';
17
28
  return flagEnabled ? 'shared_render' : 'legacy_trim';
18
29
  }
19
30
  function standardHostRoutes(flagEnabled) {
20
- return [
21
- { hostKind: 'openclaw', route: promptRouteForHost('openclaw', flagEnabled) },
22
- { hostKind: 'codex', route: promptRouteForHost('codex', flagEnabled) },
23
- ];
31
+ return PROMPT_INJECTION_TARGET_HOSTS.map((hostKind) => ({ hostKind, route: promptRouteForHost(hostKind, flagEnabled) }));
24
32
  }
25
33
  /**
26
34
  * Resolve the effective route for this workspace. Pure read of existing
@@ -83,8 +91,8 @@ export function resolvePromptInjectionRouteDecision(input) {
83
91
  perHost: standardHostRoutes(flagEnabled),
84
92
  };
85
93
  }
86
- const knownKinds = facts.effectiveKinds.filter((kind) => kind === 'openclaw' || kind === 'codex');
87
- const unknownKinds = facts.effectiveKinds.filter((kind) => kind !== 'openclaw' && kind !== 'codex');
94
+ const knownKinds = facts.effectiveKinds.filter(isPromptInjectionTargetHost);
95
+ const unknownKinds = facts.effectiveKinds.filter((kind) => !isPromptInjectionTargetHost(kind));
88
96
  if (unknownKinds.length > 0) {
89
97
  return {
90
98
  status: 'unconfirmed',
@@ -92,7 +100,7 @@ export function resolvePromptInjectionRouteDecision(input) {
92
100
  declaredHostKinds: facts.declaredKinds,
93
101
  effectiveHostKinds: facts.effectiveKinds,
94
102
  unconfirmedReason: `unknown_host_kind_declared: ${unknownKinds.join(', ')} has no known prompt-injection route`,
95
- nextAction: 'pass an explicit target host (openclaw|codex) for this request, or remove the unknown host declaration',
103
+ nextAction: 'pass an explicit target host (openclaw|codex|workbuddy) for this request, or remove the unknown host declaration',
96
104
  perHost: standardHostRoutes(flagEnabled),
97
105
  };
98
106
  }
@@ -117,7 +125,7 @@ export function resolvePromptInjectionRouteDecision(input) {
117
125
  declaredHostKinds: facts.declaredKinds,
118
126
  effectiveHostKinds: facts.effectiveKinds,
119
127
  unconfirmedReason: 'no_host_facts_and_flag_off: no host declaration or host evidence exists, and the applicable hosts would take different routes',
120
- nextAction: 'pass an explicit target host (openclaw|codex), or let a host run once in this workspace so it persists its declaration',
128
+ nextAction: 'pass an explicit target host (openclaw|codex|workbuddy), or let a host run once in this workspace so it persists its declaration',
121
129
  perHost: standardHostRoutes(flagEnabled),
122
130
  };
123
131
  }
@@ -151,8 +159,8 @@ export function resolvePromptInjectionRouteDecision(input) {
151
159
  flagEnabled,
152
160
  declaredHostKinds: facts.declaredKinds,
153
161
  effectiveHostKinds: facts.effectiveKinds,
154
- unconfirmedReason: 'multi_host_routes_differ: openclaw would take the legacy list route and codex the shared route under the current flag-off config',
155
- nextAction: 'pass an explicit target host (openclaw|codex) for this request, or enable abstraction_layer_v1 so both hosts share one route',
162
+ unconfirmedReason: 'multi_host_routes_differ: openclaw would take the legacy list route while codex/workbuddy would take the shared route under the current flag-off config',
163
+ nextAction: 'pass an explicit target host (openclaw|codex|workbuddy) for this request, or enable abstraction_layer_v1 so all hosts share one route',
156
164
  perHost: standardHostRoutes(flagEnabled),
157
165
  };
158
166
  }
@@ -216,7 +224,13 @@ function isDiagnosticCapHit(ids) {
216
224
  */
217
225
  export async function buildLivePromptInjectionProjection(input) {
218
226
  const flagEnabled = computeFeatureFlagsFromConfig(loadPdConfigForPlugin(input.workspaceDir).effective).flags.abstraction_layer_v1?.enabled === true;
219
- const sharedRoute = input.targetHost === 'codex' ? true : flagEnabled;
227
+ // Route face follows THE one route formula (review P2-2: a re-typed
228
+ // codex-only ternary forecast WorkBuddy as legacy_trim while its adapter
229
+ // renders shared unconditionally). No explicit target (console callers)
230
+ // keeps the flag-gated workspace default.
231
+ const sharedRoute = input.targetHost === undefined
232
+ ? flagEnabled
233
+ : promptRouteForHost(input.targetHost, flagEnabled) === 'shared_render';
220
234
  if (sharedRoute) {
221
235
  const context = await buildActivePrinciplePromptContext(input);
222
236
  const oversized = context.oversizedActivationIds ?? [];
@@ -0,0 +1,24 @@
1
+ /**
2
+ * WorkBuddy worker status-mode semantics — host-runtime authority (mirrors
3
+ * the Codex Slice D placement): the CLI worker --status and any health
4
+ * surface share ONE mode evaluation, which only depends on host-neutral
5
+ * inputs (governance workspace directory, .pd/config.yaml flags, install
6
+ * manifest registration). The WorkBuddy evaluation has NO ingestion step to
7
+ * gate — the hook is the only evidence producer in the WorkBuddy MVP
8
+ * (SPEC workbuddy-host-adapter §1 Excluded: no transcript reads).
9
+ *
10
+ * SPEC §15 worker mode, evaluated WITHOUT executing anything (no lease, no
11
+ * LLM). `manual_action_required` means no Companion-registered worker serves
12
+ * this governance workspace — manual `pd diagnose` / `pd runtime
13
+ * internalization run-once` is the recovery route.
14
+ */
15
+ export type WorkbuddyWorkerMode = 'ready' | 'manual_action_required' | 'paused' | 'degraded';
16
+ export interface WorkbuddyWorkerStatusEvaluation {
17
+ readonly mode: WorkbuddyWorkerMode;
18
+ readonly reason?: string;
19
+ readonly nextAction?: string;
20
+ }
21
+ export declare function computeWorkbuddyWorkerStatusMode(input: {
22
+ workspaceDir: string;
23
+ registeredInInstallManifest: boolean;
24
+ }): WorkbuddyWorkerStatusEvaluation;
@@ -0,0 +1,52 @@
1
+ /**
2
+ * WorkBuddy worker status-mode semantics — host-runtime authority (mirrors
3
+ * the Codex Slice D placement): the CLI worker --status and any health
4
+ * surface share ONE mode evaluation, which only depends on host-neutral
5
+ * inputs (governance workspace directory, .pd/config.yaml flags, install
6
+ * manifest registration). The WorkBuddy evaluation has NO ingestion step to
7
+ * gate — the hook is the only evidence producer in the WorkBuddy MVP
8
+ * (SPEC workbuddy-host-adapter §1 Excluded: no transcript reads).
9
+ *
10
+ * SPEC §15 worker mode, evaluated WITHOUT executing anything (no lease, no
11
+ * LLM). `manual_action_required` means no Companion-registered worker serves
12
+ * this governance workspace — manual `pd diagnose` / `pd runtime
13
+ * internalization run-once` is the recovery route.
14
+ */
15
+ import * as fs from 'node:fs';
16
+ import * as path from 'node:path';
17
+ import { loadPdConfigForPlugin } from './pd-config.js';
18
+ import { computeFeatureFlagsFromConfig } from '@principles/core/runtime-v2';
19
+ function directoryExists(dir) {
20
+ try {
21
+ return fs.statSync(dir).isDirectory();
22
+ }
23
+ catch {
24
+ return false;
25
+ }
26
+ }
27
+ export function computeWorkbuddyWorkerStatusMode(input) {
28
+ const workspaceDir = path.resolve(input.workspaceDir);
29
+ if (!directoryExists(workspaceDir)) {
30
+ return { mode: 'degraded', reason: 'workspace_missing', nextAction: 'The governance workspace directory does not exist; run the WorkBuddy setup flow to initialize it.' };
31
+ }
32
+ const config = loadPdConfigForPlugin(workspaceDir);
33
+ if (!config.ok) {
34
+ const [first] = config.errors;
35
+ return { mode: 'degraded', reason: `pd_config_invalid:${first?.reason ?? 'unknown'}`, nextAction: first?.nextAction ?? 'Repair the governance workspace .pd/config.yaml.' };
36
+ }
37
+ const { flags } = computeFeatureFlagsFromConfig(config.effective);
38
+ if (flags['host.workbuddy']?.enabled !== true) {
39
+ return { mode: 'paused', reason: 'host.workbuddy_disabled', nextAction: 'Set features.host.workbuddy.enabled=true in the governance workspace .pd/config.yaml to enable WorkBuddy PD behavior.' };
40
+ }
41
+ if (flags.internalization_auto_consumer?.enabled !== true) {
42
+ return { mode: 'paused', reason: 'internalization_auto_consumer_disabled', nextAction: 'Automatic execution is paused; manual commands remain available: pd diagnose, pd runtime internalization run-once.' };
43
+ }
44
+ if (!input.registeredInInstallManifest) {
45
+ return {
46
+ mode: 'manual_action_required',
47
+ reason: 'workspace_not_in_install_manifest',
48
+ nextAction: `No Companion worker is registered for this governance workspace. Manual path: pd diagnose --workspace "${workspaceDir}", then pd runtime internalization run-once.`,
49
+ };
50
+ }
51
+ return { mode: 'ready' };
52
+ }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@principles/host-runtime",
3
- "version": "0.8.2",
3
+ "version": "0.9.0",
4
4
  "description": "Shared host-neutral orchestration for Principles Disciple MVP-Core hook paths.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -24,14 +24,14 @@
24
24
  "@principles/core": "file:../core",
25
25
  "@principles/install-layout": "file:../install-layout",
26
26
  "better-sqlite3": "^13.0.3",
27
- "js-yaml": "^5.4.1"
27
+ "js-yaml": "^5.4.3"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@types/better-sqlite3": "^9.6.0",
31
31
  "@types/node": "^26.4.1",
32
32
  "@types/js-yaml": "^4.0.9",
33
33
  "typescript": "^7.0.2",
34
- "vite": "^8.3.0",
34
+ "vite": "^8.3.4",
35
35
  "vitest": "^5.0.0"
36
36
  },
37
37
  "repository": {
@@ -1,7 +1,7 @@
1
1
  export declare const INSTALL_LAYOUT_VERSION: 1;
2
2
  export declare const INSTALL_LAYOUT_MODES: readonly ['canonical', 'legacy'];
3
3
  export type InstallLayoutMode = (typeof INSTALL_LAYOUT_MODES)[number];
4
- export declare const INSTALL_HOSTS: readonly ['codex', 'openclaw'];
4
+ export declare const INSTALL_HOSTS: readonly ['codex', 'openclaw', 'workbuddy'];
5
5
  export type InstallHost = (typeof INSTALL_HOSTS)[number];
6
6
  export interface InstallManifest {
7
7
  layoutVersion: typeof INSTALL_LAYOUT_VERSION;
@@ -44,6 +44,13 @@ export interface InstallLayoutPaths {
44
44
  * links like any other runtime component.
45
45
  */
46
46
  codexAdapterDir: string;
47
+ /**
48
+ * WorkBuddy host adapter component (payload dir workbuddy-adapter/, npm
49
+ * name @principles/workbuddy-adapter; SPEC workbuddy-host-adapter §4.1).
50
+ * The WorkBuddy plugin wrapper resolves this dir to load the adapter entry
51
+ * the same way the Codex hook resolves the canonical runtime.
52
+ */
53
+ workbuddyAdapterDir: string;
47
54
  }
48
55
  export interface LayoutResolution {
49
56
  mode: InstallLayoutMode | 'missing';
@@ -65,6 +72,16 @@ export declare function parseInstallManifest(value: unknown): {
65
72
  error?: string;
66
73
  };
67
74
  export declare function getInstallLayoutPaths(homeDir: string): InstallLayoutPaths;
75
+ /**
76
+ * WorkBuddy governance workspace (SPEC workbuddy-host-adapter §4.1 OD-07,
77
+ * frozen by Phase 0 probe P06 2026-10-12): an explicit user-level directory
78
+ * under the WorkBuddy config root, shared across projects, never auto-reused
79
+ * from Codex/OpenClaw state. projectDir stays the host cwd; this dir owns
80
+ * governance state (state.db / trajectory). The dir is CREATED only by the
81
+ * explicit setup flow — its absence means "not initialized", never a silent
82
+ * fallback to another host's database.
83
+ */
84
+ export declare function getWorkbuddyWorkspaceDir(homeDir: string): string;
68
85
  export declare function resolveInstallLayout(options: ResolveInstallLayoutOptions): LayoutResolution;
69
86
  export declare function getConsoleServerEntry(paths: InstallLayoutPaths, mode: InstallLayoutMode): string;
70
87
  export declare function getConsoleWebIndex(paths: InstallLayoutPaths, mode: InstallLayoutMode): string;
@@ -1,7 +1,7 @@
1
1
  import * as path from 'node:path';
2
2
  export const INSTALL_LAYOUT_VERSION = 1;
3
3
  export const INSTALL_LAYOUT_MODES = ['canonical', 'legacy'];
4
- export const INSTALL_HOSTS = ['codex', 'openclaw'];
4
+ export const INSTALL_HOSTS = ['codex', 'openclaw', 'workbuddy'];
5
5
  function isRecord(value) {
6
6
  return typeof value === 'object' && value !== null && !Array.isArray(value);
7
7
  }
@@ -48,7 +48,7 @@ export function parseInstallManifest(value) {
48
48
  return { error: 'install_manifest_malformed: mode must be canonical or legacy' };
49
49
  }
50
50
  if (!Array.isArray(value.hosts) || value.hosts.length === 0 || !value.hosts.every(isHost)) {
51
- return { error: 'install_manifest_malformed: hosts must contain codex and/or openclaw' };
51
+ return { error: 'install_manifest_malformed: hosts must contain codex, openclaw and/or workbuddy' };
52
52
  }
53
53
  const hosts = [...new Set(value.hosts)];
54
54
  const workspaces = parseWorkspaceList(value.workspaces);
@@ -78,8 +78,21 @@ export function getInstallLayoutPaths(homeDir) {
78
78
  openClawExtensionDir: path.join(openClawDir, 'extensions', 'principles-disciple'),
79
79
  releaseManagerDir: path.join(runtimeDir, 'release-manager'),
80
80
  codexAdapterDir: path.join(runtimeDir, 'codex-adapter'),
81
+ workbuddyAdapterDir: path.join(runtimeDir, 'workbuddy-adapter'),
81
82
  };
82
83
  }
84
+ /**
85
+ * WorkBuddy governance workspace (SPEC workbuddy-host-adapter §4.1 OD-07,
86
+ * frozen by Phase 0 probe P06 2026-10-12): an explicit user-level directory
87
+ * under the WorkBuddy config root, shared across projects, never auto-reused
88
+ * from Codex/OpenClaw state. projectDir stays the host cwd; this dir owns
89
+ * governance state (state.db / trajectory). The dir is CREATED only by the
90
+ * explicit setup flow — its absence means "not initialized", never a silent
91
+ * fallback to another host's database.
92
+ */
93
+ export function getWorkbuddyWorkspaceDir(homeDir) {
94
+ return path.join(path.resolve(homeDir), '.workbuddy', 'pd-workspace');
95
+ }
83
96
  export function resolveInstallLayout(options) {
84
97
  const paths = getInstallLayoutPaths(options.homeDir);
85
98
  const parsed = parseInstallManifest(options.manifest);
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@principles/install-layout",
3
- "version": "0.2.7",
3
+ "version": "0.3.0",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-principles-disciple",
3
- "version": "1.144.27",
3
+ "version": "1.145.0",
4
4
  "description": "Interactive CLI installer for Principles Disciple OpenClaw plugin",
5
5
  "type": "module",
6
6
  "bin": {
@@ -25,6 +25,7 @@
25
25
  "core",
26
26
  "host-runtime",
27
27
  "codex-adapter",
28
+ "workbuddy-adapter",
28
29
  "install-layout",
29
30
  "release-manager",
30
31
  "trust/root.json",
@@ -56,12 +57,12 @@
56
57
  "author": "csuzngjh",
57
58
  "license": "MIT",
58
59
  "dependencies": {
59
- "@principles/install-layout": "^0.2.7",
60
+ "@principles/install-layout": "^0.3.0",
60
61
  "@tufjs/models": "3.0.1",
61
62
  "@inquirer/prompts": "^8.7.2",
62
63
  "commander": "^14.0.3",
63
64
  "fs-extra": "^11.4.0",
64
- "js-yaml": "^5.4.1",
65
+ "js-yaml": "^5.4.3",
65
66
  "ora": "^9.4.1",
66
67
  "picocolors": "^1.0.0",
67
68
  "semver": "^7.8.5",
@@ -75,7 +76,7 @@
75
76
  "@types/semver": "^7.8.0",
76
77
  "@types/tar": "^7.0.87",
77
78
  "typescript": "^7.0.2",
78
- "vite": "^8.3.0",
79
+ "vite": "^8.3.4",
79
80
  "vitest": "^5.0.0"
80
81
  },
81
82
  "engines": {
@@ -87,6 +88,6 @@
87
88
  "directory": "packages/create-principles-disciple"
88
89
  },
89
90
  "pd": {
90
- "bundledPluginVersion": "2.1.0"
91
+ "bundledPluginVersion": "2.1.3"
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AAC;IACnB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAiFD,wBAAsB,sCAAsC,CAAC,IAAI,EAAE,wBAAwB,GAAG,OAAO,CAAC,IAAI,CAAC,CAoT1G;AAID,UAAU,qBAAqB;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED;;;;;GAKG;AACH,wBAAsB,oBAAoB,CAAC,IAAI,EAAE,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC,CA+CrF"}
@@ -27,6 +27,7 @@ import { resolveRuntimeAdapterFromConfig } from '../services/runtime-adapter-res
27
27
  import { resolvePromptFullPipelineSeedMode } from '../services/pd-config-loader.js';
28
28
  import { createRemediationResult, remediationAction } from './remediation-output.js';
29
29
  import { checkAdmissionGate } from './admission-gate.js';
30
+ import { enforceFullAdmissionForWrite } from '../services/admission-write-gate.js';
30
31
  async function updateCandidateStatus(opts) {
31
32
  const { stateManager, candidateId, targetStatus, expectedCurrentStatus } = opts;
32
33
  const db = stateManager.connection;
@@ -169,7 +170,11 @@ export async function handleCandidateList(opts) {
169
170
  return;
170
171
  }
171
172
  if (result.candidates.length === 0) {
172
- console.log(`No candidates found for task: ${opts.taskId}`);
173
+ // An empty result must name the library it queried: with one .pd/state.db per
174
+ // host workspace, "no candidates" and "wrong workspace" are otherwise identical
175
+ // to the Owner (PRI-957). Resolved for display so a relative -w still reads as
176
+ // the absolute directory the query hit.
177
+ console.log(`No candidates found for task: ${opts.taskId} (workspace: ${path.resolve(workspaceDir)})`);
173
178
  return;
174
179
  }
175
180
  console.log(`\nPrinciple Candidates for Task: ${opts.taskId}\n`);
@@ -710,6 +715,32 @@ export async function handleCandidateIntake(opts) {
710
715
  }
711
716
  // PRI-442 Stage 4: admission gate check — refuse non-admitted candidates
712
717
  // to prevent CLI from bypassing the production admission gate.
718
+ // SPEC-CODEX-PAIN-CLOSURE-001 CR-03 (§7.2): the partial record check is a
719
+ // FAST pre-refusal only. The write permission itself comes from the
720
+ // persisted admission disposition; when it is missing (pre-CR-03 records)
721
+ // a full re-evaluation from the persisted materials runs and is saved.
722
+ // SPEC CR-03 §7.2 (review S1): the persisted/full admission gate owns the
723
+ // write permission; the partial record check below stays a fast pre-refusal.
724
+ const fullGate = await enforceFullAdmissionForWrite(stateManager, opts.candidateId);
725
+ if (fullGate !== null) {
726
+ const result = {
727
+ candidateId: opts.candidateId,
728
+ status: 'refused',
729
+ admissionDecision: fullGate.decision,
730
+ reason: fullGate.reason,
731
+ nextAction: fullGate.nextAction,
732
+ };
733
+ if (opts.json) {
734
+ console.log(JSON.stringify(result, null, 2));
735
+ }
736
+ else {
737
+ console.error(`Admission gate refused candidate ${opts.candidateId}: ${fullGate.decision}`);
738
+ console.error(` Reason: ${fullGate.reason}`);
739
+ console.error(` Next Action: ${fullGate.nextAction}`);
740
+ }
741
+ process.exit(1);
742
+ return;
743
+ }
713
744
  const admissionBlock = checkAdmissionGate(candidate);
714
745
  if (admissionBlock) {
715
746
  const result = {
@@ -888,7 +919,11 @@ export async function handleCandidateReview(opts) {
888
919
  // `create` keeps the pre-check: a low-confidence candidate still cannot
889
920
  // become a new Principle via the CLI.
890
921
  if (opts.decide === 'create') {
891
- const admissionBlock = checkAdmissionGate(candidate);
922
+ // SPEC review S1: a CREATE decision is a governance write — it passes
923
+ // the full admission gate (the reuse verdict remains exempt by
924
+ // PRI-917 R5 F4: a reuse decision creates nothing).
925
+ const createFullGate = await enforceFullAdmissionForWrite(stateManager, opts.candidateId);
926
+ const admissionBlock = createFullGate ?? checkAdmissionGate(candidate);
892
927
  if (admissionBlock) {
893
928
  const payload = {
894
929
  candidateId: opts.candidateId,
@@ -1188,7 +1223,10 @@ export async function handleCandidateRepair(opts) {
1188
1223
  // re-verify admission before re-intaking to prevent bypassing the gate.
1189
1224
  // A consumed candidate that would fail the gate indicates data corruption
1190
1225
  // or a prior bypass; refuse and surface the reason.
1191
- const admissionBlock = checkAdmissionGate(candidate);
1226
+ // SPEC review S1: repair re-intake passes the SAME full write gate —
1227
+ // a corrupted admission document can never be repaired into the Ledger.
1228
+ const repairFullGate = await enforceFullAdmissionForWrite(stateManager, opts.candidateId);
1229
+ const admissionBlock = repairFullGate ?? checkAdmissionGate(candidate);
1192
1230
  if (admissionBlock) {
1193
1231
  const result = {
1194
1232
  candidateId: opts.candidateId,
@@ -1457,7 +1495,9 @@ export async function handleCandidateInternalizationBackfill(opts) {
1457
1495
  }
1458
1496
  // PRI-442 Stage 4: admission gate check — refuse non-admitted pending
1459
1497
  // candidates to prevent backfill from bypassing the admission gate.
1460
- const admissionBlock = checkAdmissionGate(candidate);
1498
+ // SPEC review S1: backfill writes pass the full admission gate too.
1499
+ const backfillFullGate = await enforceFullAdmissionForWrite(stateManager, candidateId);
1500
+ const admissionBlock = backfillFullGate ?? checkAdmissionGate(candidate);
1461
1501
  if (admissionBlock) {
1462
1502
  output.intakeFailed++;
1463
1503
  output.results.push({ candidateId, route: 'unknown', status: 'intake_failed', reason: `Admission gate refused: ${admissionBlock.reason}`, statusBefore: 'pending', statusAfter: 'pending', intakeDecision: 'skipped', seedDecision: 'skipped', nextAction: admissionBlock.nextAction });