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
@@ -2,7 +2,7 @@
2
2
  "id": "principles-disciple",
3
3
  "name": "Principles Disciple",
4
4
  "description": "Principles Disciple is an AI Agent Governance System. Stop correcting the same AI behavior across sessions. Turn repeated Agent corrections into Owner-approved, observable, reversible behavior principles.",
5
- "version": "4.2.1",
5
+ "version": "4.3.0",
6
6
  "activation": {
7
7
  "onStartup": true,
8
8
  "onCapabilities": [
@@ -0,0 +1,142 @@
1
+ export declare const GATEWAY_CONSUMER_LEASE_SCHEMA_VERSION = "pd.gateway-consumer-lease.v1";
2
+ export declare const GATEWAY_CONSUMER_LEASE_FILE = "gateway-consumer-lease.json";
3
+ export interface GatewayConsumerLeaseWriter {
4
+ token: string;
5
+ instanceId: string;
6
+ pid: number;
7
+ host: string;
8
+ state: 'consuming' | 'quiesced';
9
+ startedAt: string;
10
+ updatedAt: string;
11
+ }
12
+ export interface GatewayConsumerLease {
13
+ schemaVersion: string;
14
+ /** Identity of THIS consumer instance — one per process lifetime. */
15
+ token: string;
16
+ /**
17
+ * PRI-1282 review r4: per-INSTANCE identity. A Gateway restart (or a
18
+ * stop()/start() inside one process) mints a new instanceId — PID alone
19
+ * cannot distinguish two lifecycles of the same process, and a new
20
+ * instance must never be mistaken for (or allowed to clear) the old one.
21
+ */
22
+ instanceId: string;
23
+ pid: number;
24
+ host: string;
25
+ workspaceDir: string;
26
+ /** 'consuming' while cycles may be scheduled; 'quiesced' after a clean drain. */
27
+ state: 'consuming' | 'quiesced';
28
+ startedAt: string;
29
+ updatedAt: string;
30
+ /**
31
+ * PRI-1282 review r5: EVERY writer that has published to this lease,
32
+ * keyed by instanceId (upserted per publish). A single top-level record
33
+ * can only name the last writer — a quiesce confirmation that only
34
+ * consults it is blind to an earlier writer still running a cycle.
35
+ * Liveness is judged per writer.
36
+ */
37
+ writers?: GatewayConsumerLeaseWriter[];
38
+ }
39
+ /** Fresh identity for ONE consumer instance — minted per start(). */
40
+ export declare function gatewayConsumerLeaseToken(): string;
41
+ /** Fresh per-instance identity (PRI-1282 r4: PID is not an instance id). */
42
+ export declare function gatewayConsumerInstanceId(): string;
43
+ /**
44
+ * PID liveness with the same contract as service-run-lock: EPERM means the
45
+ * process exists (we just cannot signal it) → alive; ESRCH → dead; anything
46
+ * else is a platform answer we cannot classify → 'unknown' (fail-closed).
47
+ */
48
+ export declare function processAliveProbe(pid: number): 'alive' | 'dead' | 'unknown';
49
+ export declare function parseGatewayConsumerLease(raw: unknown): GatewayConsumerLease | null;
50
+ /**
51
+ * Every writer recorded on the lease — the writers[] entries, or the
52
+ * top-level record for pre-r5 single-writer leases.
53
+ */
54
+ export declare function leaseWriters(lease: GatewayConsumerLease): GatewayConsumerLeaseWriter[];
55
+ /** Read the lease; null on missing or unreadable/malformed content. */
56
+ export declare function readGatewayConsumerLease(workspaceDir: string): GatewayConsumerLease | null;
57
+ export declare function clearGatewayConsumerLease(workspaceDir: string, token: string, instanceId?: string): {
58
+ ok: true;
59
+ } | {
60
+ ok: false;
61
+ reason: string;
62
+ };
63
+ /**
64
+ * Cross-process arbitration gate for lease mutations: a SQLite
65
+ * `BEGIN IMMEDIATE` transaction on `<lease>.gate.db` (better-sqlite3 —
66
+ * same mechanism as the install-manifest CAS lock, dependency already
67
+ * shipped with the plugin). Every check-and-register / mark-and-observe
68
+ * decision runs inside the serialized section, so two Gateways can never
69
+ * interleave "I checked no other consumer" with "I registered myself".
70
+ */
71
+ export interface ConsumerLeaseGateLike {
72
+ exec(sql: string): void;
73
+ close(): void;
74
+ }
75
+ export declare function withConsumerLeaseGate<T>(workspaceDir: string, fn: () => T, openGate?: (path: string) => ConsumerLeaseGateLike): {
76
+ ok: true;
77
+ value: T;
78
+ } | {
79
+ ok: false;
80
+ reason: string;
81
+ };
82
+ /** Every public lease mutation takes the workspace's cross-process gate. */
83
+ export declare function writeGatewayConsumerLease(input: {
84
+ workspaceDir: string;
85
+ token: string;
86
+ instanceId: string;
87
+ state: 'consuming' | 'quiesced';
88
+ now?: () => Date;
89
+ openGate?: (path: string) => ConsumerLeaseGateLike;
90
+ }): {
91
+ ok: true;
92
+ } | {
93
+ ok: false;
94
+ reason: string;
95
+ };
96
+ export type ConsumerLeaseRegistration = {
97
+ ok: true;
98
+ status: 'registered';
99
+ } | {
100
+ ok: true;
101
+ status: 'refused_foreign_alive' | 'refused_foreign_unknown';
102
+ } | {
103
+ ok: false;
104
+ reason: string;
105
+ };
106
+ /**
107
+ * Serialized "check foreign consumer → register ourselves" for consumer
108
+ * start (PRI-1282 review r6): without the gate, two Gateways can each pass
109
+ * the foreign check before either writes, land two 'consuming' records,
110
+ * and then wait on each other at quiesce forever.
111
+ */
112
+ export declare function registerGatewayConsumerLease(input: {
113
+ workspaceDir: string;
114
+ token: string;
115
+ instanceId: string;
116
+ processAlive?: (pid: number) => 'alive' | 'dead' | 'unknown';
117
+ openGate?: (path: string) => ConsumerLeaseGateLike;
118
+ }): ConsumerLeaseRegistration;
119
+ export type ForeignConsumerLeaseStatus = 'alive' | 'none' | 'unknown';
120
+ /**
121
+ * Whether a DIFFERENT live process holds a consumer lease for this
122
+ * workspace — the arbitration input for quiesce-ACK honesty and restart
123
+ * resume (PRI-1282 P1-3):
124
+ * - 'alive': a lease exists, its owner is on this host, and its PID is
125
+ * provably alive — a foreign consumer may still be running;
126
+ * a fresh process MUST NOT claim the consumer stopped.
127
+ * - 'none': no lease, or its holder's PID is provably dead — the foreign
128
+ * consumer cannot be running.
129
+ * - 'unknown': lease unreadable/malformed, foreign host, or PID liveness
130
+ * undecidable — fail-closed: never ack "quiesced" on it.
131
+ *
132
+ * Process liveness and INSTANCE identity are judged separately (PRI-1282
133
+ * r4): a lease carrying THIS process's PID but a different instanceId/token
134
+ * is a DIFFERENT consumer (an older lifecycle of this process that may still
135
+ * have in-flight work) — it is 'alive', never 'none'. Only our own
136
+ * token/instanceId yields 'none' on a same-PID lease.
137
+ */
138
+ export declare function foreignConsumerLeaseStatus(workspaceDir: string, opts?: {
139
+ processAlive?: (pid: number) => 'alive' | 'dead' | 'unknown';
140
+ selfToken?: string;
141
+ selfInstanceId?: string;
142
+ }): ForeignConsumerLeaseStatus;
@@ -0,0 +1,40 @@
1
+ export declare const GATEWAY_QUIESCE_ACK_SCHEMA_VERSION = "pd.gateway-quiesce.v1";
2
+ export declare const GATEWAY_QUIESCE_ACK_FILE = "gateway-quiesce-ack.json";
3
+ export type GatewayQuiesceOutcome = 'quiesced' | 'in_flight_timeout';
4
+ export interface GatewayQuiesceAck {
5
+ schemaVersion: typeof GATEWAY_QUIESCE_ACK_SCHEMA_VERSION;
6
+ workspaceDir: string;
7
+ /** The blocking marker state the Gateway observed. */
8
+ state: 'handover_preparing' | 'service_host_owned' | 'rollback_pending';
9
+ /** Bound to the marker record — a stale ack is detectable, never trusted. */
10
+ operationId: string | null;
11
+ generation: number;
12
+ /** Must be 0 for a `quiesced` outcome. */
13
+ inFlightCycles: number;
14
+ outcome: GatewayQuiesceOutcome;
15
+ completedAt: string;
16
+ writer: {
17
+ hostKind: 'openclaw';
18
+ pid: number;
19
+ startedVia: 'timer_tick' | 'service_start';
20
+ };
21
+ }
22
+ export interface WriteGatewayQuiesceAckInput {
23
+ workspaceDir: string;
24
+ state: GatewayQuiesceAck['state'];
25
+ operationId: string | null;
26
+ generation: number;
27
+ inFlightCycles: number;
28
+ outcome: GatewayQuiesceOutcome;
29
+ startedVia: GatewayQuiesceAck['writer']['startedVia'];
30
+ }
31
+ /** Write the ack atomically (O_EXCL temp + rename). Containment-checked. */
32
+ export declare function writeGatewayQuiesceAck(input: WriteGatewayQuiesceAckInput): {
33
+ ok: boolean;
34
+ reason?: string;
35
+ };
36
+ /**
37
+ * Read + validate the ack (rc-1/rc-2/rc-3: untrusted JSON until proven).
38
+ * `null` when absent/malformed — the handover treats null as "no evidence".
39
+ */
40
+ export declare function readGatewayQuiesceAck(workspaceDir: string): GatewayQuiesceAck | null;
@@ -8,14 +8,80 @@
8
8
  * implementation. This module keeps only what is genuinely OpenClaw-specific:
9
9
  * the service lifecycle (timer chain per workspace), the OpenClaw tool
10
10
  * catalog, the plugin logger, and SystemLogger event emission.
11
+ *
12
+ * PRI-1282 (Phase 4) — §8.4 ownership gate: the install manifest's
13
+ * `backgroundExecutions` record is the ONLY consumption authority for this
14
+ * service. The marker is read (a) before the service arms a workspace's
15
+ * timer chain, and (b) before EVERY tick; any state other than
16
+ * `legacy_owned` — including an UNREADABLE manifest — fails closed: no new
17
+ * consumption cycle starts. When a blocking state is observed the workspace
18
+ * quiesces: in-flight cycles are awaited (bounded), a persisted
19
+ * `pd.gateway-quiesce.v1` acknowledgment is written (the auditable "the old
20
+ * consumer stopped" evidence the handover command waits for), and the timer
21
+ * slot degrades into a slow ownership watch that re-arms normal consumption
22
+ * only when the marker returns to `legacy_owned` (rollback) — one timer
23
+ * chain per workspace at all times, never a second resident loop.
11
24
  */
12
25
  import type { OpenClawPluginServiceContext, PluginLogger } from '../openclaw-sdk.js';
13
- import { type InternalizationConsumerCycleOutcome } from '@principles/host-runtime';
26
+ import { type AdaptiveConsumerScheduleDecision, type InternalizationConsumerCycleOutcome } from '@principles/host-runtime';
27
+ /**
28
+ * PRI-1282 P1-3 + r4: identity of ONE consumer INSTANCE — minted fresh on
29
+ * every start(), not per process. The lease
30
+ * (<workspace>/.pd/gateway-consumer-lease.json) is the workspace-scoped
31
+ * liveness record that makes "a foreign Gateway consumer is alive"
32
+ * decidable across a Gateway restart: PID liveness alone cannot distinguish
33
+ * two lifecycles of the same process, so process liveness and instance
34
+ * identity are judged separately and a new instance never clears or claims
35
+ * the old instance's lease. Anything unverifiable fails closed.
36
+ */
37
+ interface ConsumerIdentity {
38
+ readonly token: string;
39
+ readonly instanceId: string;
40
+ }
14
41
  export interface InternalizationAutoConsumerServiceShape {
15
42
  id: string;
16
43
  start: (ctx: OpenClawPluginServiceContext) => void;
17
44
  stop?: (ctx: OpenClawPluginServiceContext) => void;
18
45
  }
46
+ interface WorkspaceConsumerState {
47
+ /** Immutable per-lifecycle identity of THIS workspace's consumer (r5). */
48
+ readonly identity: ConsumerIdentity;
49
+ stopped: boolean;
50
+ quiescing: boolean;
51
+ timeoutId: ReturnType<typeof setTimeout> | null;
52
+ /** The in-flight runCycle promise — quiesce waits for this (bounded). */
53
+ inFlight: Promise<void> | null;
54
+ /** Identity of the operation last acked (avoids duplicate acks while watching). */
55
+ ackedOperation: {
56
+ state: string;
57
+ operationId: string | null;
58
+ generation: number;
59
+ } | null;
60
+ /** Adaptive-scheduler inputs, owned by this workspace's timer chain only. */
61
+ consecutiveEmptyCycles: number;
62
+ consecutiveFailures: number;
63
+ lastCycleDurationMs: number | null;
64
+ lastDecision: AdaptiveConsumerScheduleDecision | null;
65
+ }
66
+ interface RetiredWorkspaceConsumerState {
67
+ readonly identity: ConsumerIdentity;
68
+ settled: boolean;
69
+ }
70
+ /**
71
+ * Deterministic test seams (PRI-1282 r4 §3.4): let lifecycle tests inject an
72
+ * in-flight cycle, shorten the drain bound, and read the live identity
73
+ * without monkey-patching node modules. Production never touches them.
74
+ */
75
+ export declare const __autoConsumerTestSeams: {
76
+ workspaceStates: Map<string, WorkspaceConsumerState>;
77
+ drainingWorkspaceStates: Map<string, Map<string, RetiredWorkspaceConsumerState>>;
78
+ identity: (workspaceDir: string) => ConsumerIdentity;
79
+ getWorkspaceState: typeof getWorkspaceState;
80
+ injectInFlight(workspaceDir: string, inFlight: Promise<void> | null): void;
81
+ setStopDrainWaitMs(ms: number): void;
82
+ watchOwnership(workspaceDir: string, state: WorkspaceConsumerState, logger: PluginLogger): Promise<void>;
83
+ };
84
+ declare function getWorkspaceState(workspaceDir: string): WorkspaceConsumerState;
19
85
  /**
20
86
  * PRI-741 (review round): persist the OpenClaw tool declaration as workspace
21
87
  * provenance — host-neutral consumers (pd-cli activation / run-once) load it
@@ -31,3 +97,4 @@ export declare function persistOpenClawToolDeclaration(workspaceDir: string, log
31
97
  }): void;
32
98
  export declare function runConsumerCycle(workspaceDir: string, logger: PluginLogger, onOutcome?: (outcome: InternalizationConsumerCycleOutcome) => void): Promise<void>;
33
99
  export declare const InternalizationAutoConsumerService: InternalizationAutoConsumerServiceShape;
100
+ export {};
@@ -2,7 +2,7 @@
2
2
  "id": "principles-disciple",
3
3
  "name": "Principles Disciple",
4
4
  "description": "Principles Disciple is an AI Agent Governance System. Stop correcting the same AI behavior across sessions. Turn repeated Agent corrections into Owner-approved, observable, reversible behavior principles.",
5
- "version": "4.2.1",
5
+ "version": "4.3.0",
6
6
  "activation": {
7
7
  "onStartup": true,
8
8
  "onCapabilities": [
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "principles-disciple",
3
- "version": "4.2.1",
3
+ "version": "4.3.0",
4
4
  "description": "Principles Disciple is an AI Agent Governance System. Stop correcting the same AI behavior across sessions. Turn repeated Agent corrections into Owner-approved, observable, reversible behavior principles.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -17,6 +17,10 @@
17
17
  "./governance-audit": {
18
18
  "types": "./dist/governance-audit.d.ts",
19
19
  "default": "./dist/governance-audit.js"
20
+ },
21
+ "./openclaw-worker": {
22
+ "types": "./dist/openclaw-worker.d.ts",
23
+ "default": "./dist/openclaw-worker.js"
20
24
  }
21
25
  },
22
26
  "repository": {
@@ -13,13 +13,17 @@ import { checkOpenClawGateway, detectWorkspace, stopOpenClawGateway, restartOpen
13
13
  import { t } from './i18n.js';
14
14
  import { generateConfigYamlContent, ExistingConfigVerifyInfraError, validateExistingConfigYamlForPreserve, getConfigYamlPath, readEnabledChannelsFromConfigYaml, getCodexHomeDir, getOpenClawDir, getPdDir, getPdRuntimeDir, getInstallManifestPath, getPdRuntimeBackupsDir, getPluginExtDir, getInstalledPluginDir, getInstalledLayoutPackageDir, getPdBackupsDir, getInstalledPdCliDir, getInstalledBinDir, getInstalledConsoleDir, getHomeDir, isWindows, } from './mvp-config.js';
15
15
  import { detectInstalledHosts, evaluateRecordedHostPresence, getHostInstallers, isRecordedHost } from './installers/index.js';
16
- import { errnoCode } from './utils/config-file-io.js';
16
+ import { atomicReplaceTextFile, errnoCode } from './utils/config-file-io.js';
17
17
  import { readCanonicalRuntimeCohort, readInstalledRuntimeCohort, resolvePluginDataRoot } from './installers/codex-host-installer.js';
18
18
  import { runWorkbuddyEarlyPreflight } from './installers/workbuddy-host-installer.js';
19
19
  import { findForeignWorkspaceOwner } from './utils/host-workspace-ownership.js';
20
20
  import { INSTALL_LAYOUT_VERSION, getInstallLayoutPaths, getWorkbuddyWorkspaceDir, installManifestHostsForPersist, mergeInstallManifestWorkspaces, parseInstallManifest, resolvePdHome } from '@principles/install-layout';
21
+ // Namespace import keeps the shared lock capability check explicit at the
22
+ // write boundary; an incompatible older dependency cohort fails closed.
23
+ import * as installLayoutModule from '@principles/install-layout';
21
24
  import { resolveMcpServerDir } from './mcp-server-layout-compat.js';
22
25
  import { detectOpenClawMainWorkspaceDivergence } from './utils/workspace-divergence.js';
26
+ import { reconcileServiceHostScheduler } from './service-host-bridge.js';
23
27
  import { applySkillLanguageSelection } from './skill-language.js';
24
28
  import { parseReleaseAssetIdentity, parseReleaseAssetManifest, ReleaseAssetManifestError, verifyReleaseAssetManifestAsync, verifyReleaseAssetTarget, } from './update/release-asset-manifest.js';
25
29
  import { parseEmbeddedProductIdentity, ProductIdentityError } from './update/product-identity.js';
@@ -254,42 +258,58 @@ export function planUpgradeHosts(requested, persistedHosts, detected) {
254
258
  * the OD-07 governance workspace (~/.workbuddy/pd-workspace) is registered the
255
259
  * same way — derived from install-layout, never hand-joined, never reused from
256
260
  * another host's state.
261
+ *
262
+ * Merge the install's workspace registrations into a manifest read INSIDE
263
+ * the manifest write lock (PRI-1282 review, ERR-168 follow-up): computing
264
+ * the merge from a pre-lock read let an interleaved §8.4 ownership write be
265
+ * silently dropped — a handover that registered a workspace + its record
266
+ * between the read and the locked write lost the workspaces[] entry, making
267
+ * the manifest fail validation (ownership key not in the declared list).
257
268
  */
258
- function resolveInstallManifestWorkspaces(workspaceDir, host) {
259
- let current;
260
- try {
261
- current = JSON.parse(readFileSync(getInstallManifestPath(), 'utf8'));
262
- }
263
- catch (error) {
264
- if (existsSync(getInstallManifestPath()))
265
- throw error;
266
- }
267
- const parsed = parseInstallManifest(current);
268
- if (current !== undefined && !parsed.manifest) {
269
- throw new Error(parsed.error ?? 'install_manifest_malformed');
270
- }
271
- let workspaces = mergeInstallManifestWorkspaces(parsed.manifest, path.resolve(workspaceDir));
269
+ function mergeInstallManifestWorkspacesFor(current, workspaceDir, host) {
270
+ let workspaces = mergeInstallManifestWorkspaces(current, path.resolve(workspaceDir));
272
271
  if (host === 'workbuddy') {
273
272
  // Set-union via the same authority helper — order of existing entries is
274
273
  // preserved, the governance dir is appended when absent (idempotent).
275
- workspaces = mergeInstallManifestWorkspaces({ layoutVersion: parsed.manifest?.layoutVersion ?? INSTALL_LAYOUT_VERSION, mode: parsed.manifest?.mode ?? 'canonical', hosts: parsed.manifest?.hosts ?? [], workspaces }, getWorkbuddyWorkspaceDir(getHomeDir(), process.env.WORKBUDDY_CONFIG_DIR));
274
+ workspaces = mergeInstallManifestWorkspaces({ layoutVersion: current?.layoutVersion ?? INSTALL_LAYOUT_VERSION, mode: current?.mode ?? 'canonical', hosts: current?.hosts ?? [], workspaces }, getWorkbuddyWorkspaceDir(getHomeDir(), process.env.WORKBUDDY_CONFIG_DIR));
276
275
  }
277
276
  return workspaces;
278
277
  }
279
- function writeInstallManifest(hosts, workspaces) {
278
+ function writeInstallManifest(write) {
279
+ const manifestPath = getInstallManifestPath();
280
280
  mkdirSync(getPdDir(), { recursive: true });
281
- // PRI-709 P0-1: merge into the existing record. This file has more than one
282
- // writer (the update side owns `channel` / `autoCheck` / `releaseMetadataUrl`);
283
- // a wholesale replace silently deleted those fields.
284
- const existing = readInstallJsonRecord(getInstallManifestPath());
285
- const payload = {
286
- ...(existing ?? {}),
287
- layoutVersion: 1,
288
- mode: 'canonical',
289
- hosts,
290
- workspaces,
281
+ // install.json is shared with the update executor and the ownership CAS
282
+ // writer. A missing lock export is an incompatible runtime cohort, never
283
+ // permission to fall back to an unlocked read-modify-write.
284
+ const lock = installLayoutModule.withInstallManifestWriteLock;
285
+ if (typeof lock !== 'function') {
286
+ throw new Error('install_manifest_lock_unavailable: the installed @principles/install-layout does not expose the shared manifest lock; no write was performed. Update the installer/runtime cohort and retry.');
287
+ }
288
+ const writeRecord = () => {
289
+ const existing = readInstallJsonRecord(manifestPath);
290
+ const parsedCurrent = parseInstallManifest(existing);
291
+ if (existing !== undefined && !parsedCurrent.manifest) {
292
+ throw new Error(parsedCurrent.error ?? 'install_manifest_malformed');
293
+ }
294
+ const payload = {
295
+ ...(existing ?? {}),
296
+ layoutVersion: 1,
297
+ mode: 'canonical',
298
+ hosts: [...(typeof write.hosts === 'function' ? write.hosts(parsedCurrent.manifest) : write.hosts)],
299
+ workspaces: [...write.workspaces(parsedCurrent.manifest)],
300
+ };
301
+ const revalidated = parseInstallManifest(payload);
302
+ if (!revalidated.manifest) {
303
+ throw new Error(`install_manifest_write_refused: ${revalidated.error ?? 'post-merge validation failed'}`);
304
+ }
305
+ // Same-directory flushed temp + atomic replace: readers see old or new JSON,
306
+ // never a truncated manifest if the installer is interrupted.
307
+ atomicReplaceTextFile(manifestPath, JSON.stringify(payload, null, 2) + '\n');
291
308
  };
292
- writeFileSync(getInstallManifestPath(), JSON.stringify(payload, null, 2) + '\n', 'utf8');
309
+ const locked = lock({ manifestPath, operation: 'installer.writeInstallManifest', context: getPdDir() }, writeRecord);
310
+ if (!locked.ok) {
311
+ throw new Error(`could not acquire the install manifest write lock (installer.writeInstallManifest): ${locked.message}`);
312
+ }
293
313
  }
294
314
  export function commitInstallerActiveRecord(journal) {
295
315
  const paths = resolvePdHomePaths(getPdDir());
@@ -693,7 +713,13 @@ export function repairInstallManifestHosts(options = {}) {
693
713
  const backupPath = path.join(getPdRuntimeBackupsDir(), `install-manifest.backup.${Date.now()}.json`);
694
714
  mkdirSync(getPdRuntimeBackupsDir(), { recursive: true });
695
715
  writeFileSync(backupPath, readFileSync(manifestPath));
696
- writeInstallManifest([...after], [...(parsed.manifest.workspaces ?? [])]);
716
+ // Hosts too are re-derived INSIDE the lock from the freshly-read manifest
717
+ // (persisted set minus the provably-absent entries), and workspaces are
718
+ // carried verbatim from the same locked read.
719
+ writeInstallManifest({
720
+ hosts: (current) => installManifestHostsForPersist(current).filter((host) => !removed.includes(host)),
721
+ workspaces: (current) => [...(current?.workspaces ?? [])],
722
+ });
697
723
  return {
698
724
  success: true,
699
725
  applied: true,
@@ -5405,7 +5431,10 @@ transaction) {
5405
5431
  // host's registration still points at it — the exact A3 hazard class
5406
5432
  // this fix exists to close. Real install state remains file-based truth
5407
5433
  // (checkInstallStatus / host detect()).
5408
- writeInstallManifest(installManifestHosts, resolveInstallManifestWorkspaces(options.workspaceDir, options.host));
5434
+ writeInstallManifest({
5435
+ hosts: installManifestHosts,
5436
+ workspaces: (current) => mergeInstallManifestWorkspacesFor(current, options.workspaceDir, options.host),
5437
+ });
5409
5438
  // PRI-709 P0-1: persist the metadata source after the manifest write, so
5410
5439
  // the durable tier cannot be clobbered by the same install.
5411
5440
  persistReleaseMetadataSource();
@@ -5503,6 +5532,24 @@ transaction) {
5503
5532
  logger.warn(`Could not record recovery resolution for ${pendingId} (alarm stays): ${resolutionError instanceof Error ? resolutionError.message : String(resolutionError)}`);
5504
5533
  }
5505
5534
  }
5535
+ // PRI-1281 Phase 3 (task §6): user-level OS scheduler reconciliation.
5536
+ // POST-COMMIT by design — the runtime transaction is already confirmed,
5537
+ // so every bridge failure is a WARNING, never a reported install failure
5538
+ // (ERR-197). Consent-gated registration; upgrades only refresh an
5539
+ // EXISTING registration (enabled state preserved) and never create one
5540
+ // silently. Identity comes from the installer's own authoritative pdHome.
5541
+ try {
5542
+ await reconcileServiceHostScheduler({
5543
+ pdHome: getPdDir(),
5544
+ registerServiceHost: options.enableServiceHost === true || options.registerServiceHost === true,
5545
+ enableServiceHost: options.enableServiceHost === true,
5546
+ warn: (message) => logger.warn(message),
5547
+ info: (message) => logger.info(message),
5548
+ });
5549
+ }
5550
+ catch (bridgeError) {
5551
+ logger.warn(`Service Host scheduler reconciliation threw (${bridgeError instanceof Error ? bridgeError.message : String(bridgeError)}) — the install itself is unaffected; run pd service status manually.`);
5552
+ }
5506
5553
  if (spinner) {
5507
5554
  // rc-9: the runtime transaction IS committed here, but a pending host
5508
5555
  // manual action (e.g. the Codex Marketplace install) makes the run a
@@ -268,6 +268,37 @@ function readJsonObject(configPath) {
268
268
  return { ok: false, reason: `not valid JSON: ${error instanceof Error ? error.message : String(error)}` };
269
269
  }
270
270
  }
271
+ /**
272
+ * Classify an ALREADY-PARSED WorkBuddy `mcp.json` object — the exact mirror of
273
+ * `classifyOpenClawConfigObject`. The legacy-entry migration needs the verdict
274
+ * computed from the SAME bytes it parses, backs up and commits against; a
275
+ * second `checkMcpRegistrationConflict` read would judge ownership on a
276
+ * different snapshot than the write (concurrent-edit race, review 2026-11-22).
277
+ */
278
+ export function classifyWorkbuddyMcpJsonObject(config, configPath, options = {}) {
279
+ const servers = config.mcpServers;
280
+ if (servers === undefined)
281
+ return { ok: true, host: 'workbuddy', configPath, state: 'absent' };
282
+ if (!isRecord(servers)) {
283
+ return {
284
+ ok: false,
285
+ host: 'workbuddy',
286
+ configPath,
287
+ kind: 'unverifiable',
288
+ reason: `mcp_registration_unverifiable: ${configPath} mcpServers is not an object. No PD write was performed.`,
289
+ nextAction: `Repair ${configPath} manually, then re-run the installer.`,
290
+ };
291
+ }
292
+ if (Object.hasOwn(servers, PD_MCP_SERVER_NAME)) {
293
+ return classifyEntryPresence({ present: true, entry: servers[PD_MCP_SERVER_NAME], host: 'workbuddy', configPath, ownershipOptions: options });
294
+ }
295
+ return {
296
+ ok: true,
297
+ host: 'workbuddy',
298
+ configPath,
299
+ state: Object.keys(servers).length === 0 ? 'absent' : 'other_servers_only',
300
+ };
301
+ }
271
302
  function classifyJsonHost(host, configPath, options = {}) {
272
303
  const file = readJsonObject(configPath);
273
304
  if (!file.ok) {
@@ -295,7 +326,9 @@ function classifyJsonHost(host, configPath, options = {}) {
295
326
  nextAction: `Repair ${configPath} manually, then re-run the installer.`,
296
327
  };
297
328
  }
298
- const servers = host === 'openclaw' ? root.servers : root.mcpServers;
329
+ if (host === 'workbuddy')
330
+ return classifyWorkbuddyMcpJsonObject(root, configPath, options);
331
+ const { servers } = root;
299
332
  if (servers === undefined)
300
333
  return { ok: true, host, configPath, state: 'absent' };
301
334
  if (!isRecord(servers)) {