create-principles-disciple 1.154.4 → 1.155.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (409) 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 +10 -0
  14. package/console/dist/server/models/EvidenceChainConsoleModel.js +31 -0
  15. package/console/dist/server/routes/service-host.d.ts +19 -0
  16. package/console/dist/server/routes/service-host.js +129 -0
  17. package/console/dist/web/assets/app.js +37 -37
  18. package/core/dist/runtime/context-payload.d.ts +48 -0
  19. package/core/dist/runtime/context-payload.d.ts.map +1 -1
  20. package/core/dist/runtime/context-payload.js +12 -0
  21. package/core/dist/runtime/context-payload.js.map +1 -1
  22. package/core/dist/runtime/diagnostician/rootcause-prompt-builder.d.ts.map +1 -1
  23. package/core/dist/runtime/diagnostician/rootcause-prompt-builder.js +18 -0
  24. package/core/dist/runtime/diagnostician/rootcause-prompt-builder.js.map +1 -1
  25. package/core/dist/runtime/diagnostician-candidate.d.ts.map +1 -1
  26. package/core/dist/runtime/diagnostician-candidate.js +18 -2
  27. package/core/dist/runtime/diagnostician-candidate.js.map +1 -1
  28. package/core/dist/runtime/evidence-guards.d.ts +7 -3
  29. package/core/dist/runtime/evidence-guards.d.ts.map +1 -1
  30. package/core/dist/runtime/evidence-guards.js +9 -7
  31. package/core/dist/runtime/evidence-guards.js.map +1 -1
  32. package/core/dist/runtime/feature-flags/feature-flag-contract.d.ts.map +1 -1
  33. package/core/dist/runtime/feature-flags/feature-flag-contract.js +14 -0
  34. package/core/dist/runtime/feature-flags/feature-flag-contract.js.map +1 -1
  35. package/core/dist/runtime/feature-flags/feature-flag-lifecycle.d.ts.map +1 -1
  36. package/core/dist/runtime/feature-flags/feature-flag-lifecycle.js +8 -0
  37. package/core/dist/runtime/feature-flags/feature-flag-lifecycle.js.map +1 -1
  38. package/core/dist/runtime/host-submission-context.d.ts +83 -0
  39. package/core/dist/runtime/host-submission-context.d.ts.map +1 -0
  40. package/core/dist/runtime/host-submission-context.js +183 -0
  41. package/core/dist/runtime/host-submission-context.js.map +1 -0
  42. package/core/dist/runtime/index.d.ts +9 -2
  43. package/core/dist/runtime/index.d.ts.map +1 -1
  44. package/core/dist/runtime/index.js +29 -2
  45. package/core/dist/runtime/index.js.map +1 -1
  46. package/core/dist/runtime/intent/intent-doc.d.ts.map +1 -1
  47. package/core/dist/runtime/intent/intent-doc.js +29 -5
  48. package/core/dist/runtime/intent/intent-doc.js.map +1 -1
  49. package/core/dist/runtime/internalization/diag-distiller-runner.d.ts +9 -0
  50. package/core/dist/runtime/internalization/diag-distiller-runner.d.ts.map +1 -1
  51. package/core/dist/runtime/internalization/diag-distiller-runner.js +13 -0
  52. package/core/dist/runtime/internalization/diag-distiller-runner.js.map +1 -1
  53. package/core/dist/runtime/internalization/diag-rootcause-runner.d.ts +11 -0
  54. package/core/dist/runtime/internalization/diag-rootcause-runner.d.ts.map +1 -1
  55. package/core/dist/runtime/internalization/diag-rootcause-runner.js +10 -0
  56. package/core/dist/runtime/internalization/diag-rootcause-runner.js.map +1 -1
  57. package/core/dist/runtime/internalization/diag-router-runner.d.ts +9 -0
  58. package/core/dist/runtime/internalization/diag-router-runner.d.ts.map +1 -1
  59. package/core/dist/runtime/internalization/diag-router-runner.js +13 -0
  60. package/core/dist/runtime/internalization/diag-router-runner.js.map +1 -1
  61. package/core/dist/runtime/internalization/index.d.ts +1 -1
  62. package/core/dist/runtime/internalization/index.d.ts.map +1 -1
  63. package/core/dist/runtime/internalization/index.js +1 -1
  64. package/core/dist/runtime/internalization/index.js.map +1 -1
  65. package/core/dist/runtime/internalization/intake-to-internalization-bridge.d.ts +19 -0
  66. package/core/dist/runtime/internalization/intake-to-internalization-bridge.d.ts.map +1 -1
  67. package/core/dist/runtime/internalization/intake-to-internalization-bridge.js +24 -0
  68. package/core/dist/runtime/internalization/intake-to-internalization-bridge.js.map +1 -1
  69. package/core/dist/runtime/internalization/internalization-orchestrator.d.ts +8 -0
  70. package/core/dist/runtime/internalization/internalization-orchestrator.d.ts.map +1 -1
  71. package/core/dist/runtime/internalization/internalization-orchestrator.js +36 -4
  72. package/core/dist/runtime/internalization/internalization-orchestrator.js.map +1 -1
  73. package/core/dist/runtime/internalization/source-authorization-boundary.d.ts +39 -0
  74. package/core/dist/runtime/internalization/source-authorization-boundary.d.ts.map +1 -0
  75. package/core/dist/runtime/internalization/source-authorization-boundary.js +57 -0
  76. package/core/dist/runtime/internalization/source-authorization-boundary.js.map +1 -0
  77. package/core/dist/runtime/internalization/split-diagnostician-runner.d.ts.map +1 -1
  78. package/core/dist/runtime/internalization/split-diagnostician-runner.js +72 -5
  79. package/core/dist/runtime/internalization/split-diagnostician-runner.js.map +1 -1
  80. package/core/dist/runtime/pain-admission-disposition.d.ts +60 -0
  81. package/core/dist/runtime/pain-admission-disposition.d.ts.map +1 -0
  82. package/core/dist/runtime/pain-admission-disposition.js +37 -0
  83. package/core/dist/runtime/pain-admission-disposition.js.map +1 -0
  84. package/core/dist/runtime/pain-ingress-payload.d.ts +36 -2
  85. package/core/dist/runtime/pain-ingress-payload.d.ts.map +1 -1
  86. package/core/dist/runtime/pain-ingress-payload.js +63 -6
  87. package/core/dist/runtime/pain-ingress-payload.js.map +1 -1
  88. package/core/dist/runtime/pain-ingress.d.ts.map +1 -1
  89. package/core/dist/runtime/pain-ingress.js +28 -0
  90. package/core/dist/runtime/pain-ingress.js.map +1 -1
  91. package/core/dist/runtime/pain-recall-read-model.d.ts +13 -1
  92. package/core/dist/runtime/pain-recall-read-model.d.ts.map +1 -1
  93. package/core/dist/runtime/pain-recall-read-model.js +50 -7
  94. package/core/dist/runtime/pain-recall-read-model.js.map +1 -1
  95. package/core/dist/runtime/pain-receipt-recovery.d.ts +147 -0
  96. package/core/dist/runtime/pain-receipt-recovery.d.ts.map +1 -0
  97. package/core/dist/runtime/pain-receipt-recovery.js +475 -0
  98. package/core/dist/runtime/pain-receipt-recovery.js.map +1 -0
  99. package/core/dist/runtime/pain-signal-bridge.d.ts +13 -1
  100. package/core/dist/runtime/pain-signal-bridge.d.ts.map +1 -1
  101. package/core/dist/runtime/pain-signal-bridge.js +174 -0
  102. package/core/dist/runtime/pain-signal-bridge.js.map +1 -1
  103. package/core/dist/runtime/pain-signal-runtime-factory.d.ts +9 -0
  104. package/core/dist/runtime/pain-signal-runtime-factory.d.ts.map +1 -1
  105. package/core/dist/runtime/pain-signal-runtime-factory.js +8 -3
  106. package/core/dist/runtime/pain-signal-runtime-factory.js.map +1 -1
  107. package/core/dist/runtime/pain-submit-capability.d.ts +11 -0
  108. package/core/dist/runtime/pain-submit-capability.d.ts.map +1 -1
  109. package/core/dist/runtime/pain-submit-capability.js +77 -3
  110. package/core/dist/runtime/pain-submit-capability.js.map +1 -1
  111. package/core/dist/runtime/pain-target-evidence-reconcile.d.ts +55 -0
  112. package/core/dist/runtime/pain-target-evidence-reconcile.d.ts.map +1 -0
  113. package/core/dist/runtime/pain-target-evidence-reconcile.js +164 -0
  114. package/core/dist/runtime/pain-target-evidence-reconcile.js.map +1 -0
  115. package/core/dist/runtime/pain-to-principle-service.d.ts +8 -0
  116. package/core/dist/runtime/pain-to-principle-service.d.ts.map +1 -1
  117. package/core/dist/runtime/pain-to-principle-service.js +1 -0
  118. package/core/dist/runtime/pain-to-principle-service.js.map +1 -1
  119. package/core/dist/runtime/source-material-authorization.d.ts +166 -0
  120. package/core/dist/runtime/source-material-authorization.d.ts.map +1 -0
  121. package/core/dist/runtime/source-material-authorization.js +250 -0
  122. package/core/dist/runtime/source-material-authorization.js.map +1 -0
  123. package/core/dist/runtime/store/context/index.d.ts +1 -0
  124. package/core/dist/runtime/store/context/index.d.ts.map +1 -1
  125. package/core/dist/runtime/store/context/index.js +1 -0
  126. package/core/dist/runtime/store/context/index.js.map +1 -1
  127. package/core/dist/runtime/store/context/promoted-evidence-reader.d.ts +8 -0
  128. package/core/dist/runtime/store/context/promoted-evidence-reader.d.ts.map +1 -1
  129. package/core/dist/runtime/store/context/promoted-evidence-reader.js +15 -1
  130. package/core/dist/runtime/store/context/promoted-evidence-reader.js.map +1 -1
  131. package/core/dist/runtime/store/context/sqlite-context-assembler.d.ts +22 -0
  132. package/core/dist/runtime/store/context/sqlite-context-assembler.d.ts.map +1 -1
  133. package/core/dist/runtime/store/context/sqlite-context-assembler.js +153 -3
  134. package/core/dist/runtime/store/context/sqlite-context-assembler.js.map +1 -1
  135. package/core/dist/runtime/store/context/trajectory-turn-reader.d.ts +13 -0
  136. package/core/dist/runtime/store/context/trajectory-turn-reader.d.ts.map +1 -1
  137. package/core/dist/runtime/store/lifecycle/lease-manager.d.ts +15 -0
  138. package/core/dist/runtime/store/lifecycle/lease-manager.d.ts.map +1 -1
  139. package/core/dist/runtime/store/lifecycle/lease-manager.js +16 -1
  140. package/core/dist/runtime/store/lifecycle/lease-manager.js.map +1 -1
  141. package/core/dist/runtime/store/runtime-state-manager.d.ts +2 -0
  142. package/core/dist/runtime/store/runtime-state-manager.d.ts.map +1 -1
  143. package/core/dist/runtime/store/runtime-state-manager.js.map +1 -1
  144. package/core/dist/runtime/store/task/memory-task-store.d.ts +1 -0
  145. package/core/dist/runtime/store/task/memory-task-store.d.ts.map +1 -1
  146. package/core/dist/runtime/store/task/memory-task-store.js +37 -0
  147. package/core/dist/runtime/store/task/memory-task-store.js.map +1 -1
  148. package/core/dist/runtime/store/task/sqlite-task-store.d.ts +10 -0
  149. package/core/dist/runtime/store/task/sqlite-task-store.d.ts.map +1 -1
  150. package/core/dist/runtime/store/task/sqlite-task-store.js +20 -0
  151. package/core/dist/runtime/store/task/sqlite-task-store.js.map +1 -1
  152. package/core/dist/runtime/store/task/task-store.d.ts +16 -0
  153. package/core/dist/runtime/store/task/task-store.d.ts.map +1 -1
  154. package/core/dist/runtime/task-status.d.ts +13 -0
  155. package/core/dist/runtime/task-status.d.ts.map +1 -1
  156. package/core/dist/runtime/task-status.js +9 -0
  157. package/core/dist/runtime/task-status.js.map +1 -1
  158. package/core/dist/runtime/types/evidence-chain-contract.d.ts +10 -0
  159. package/core/dist/runtime/types/evidence-chain-contract.d.ts.map +1 -1
  160. package/core/dist/runtime/types/evidence-chain-contract.js +7 -0
  161. package/core/dist/runtime/types/evidence-chain-contract.js.map +1 -1
  162. package/core/package.json +1 -1
  163. package/dist/index.d.ts.map +1 -1
  164. package/dist/index.js +11 -0
  165. package/dist/index.js.map +1 -1
  166. package/dist/installer.d.ts.map +1 -1
  167. package/dist/installer.js +77 -30
  168. package/dist/installer.js.map +1 -1
  169. package/dist/installers/mcp-registration-conflict.d.ts +8 -0
  170. package/dist/installers/mcp-registration-conflict.d.ts.map +1 -1
  171. package/dist/installers/mcp-registration-conflict.js +34 -1
  172. package/dist/installers/mcp-registration-conflict.js.map +1 -1
  173. package/dist/installers/workbuddy-host-installer.d.ts +45 -13
  174. package/dist/installers/workbuddy-host-installer.d.ts.map +1 -1
  175. package/dist/installers/workbuddy-host-installer.js +284 -21
  176. package/dist/installers/workbuddy-host-installer.js.map +1 -1
  177. package/dist/prompts.d.ts +11 -0
  178. package/dist/prompts.d.ts.map +1 -1
  179. package/dist/prompts.js +4 -0
  180. package/dist/prompts.js.map +1 -1
  181. package/dist/service-host-bridge.d.ts +67 -0
  182. package/dist/service-host-bridge.d.ts.map +1 -0
  183. package/dist/service-host-bridge.js +292 -0
  184. package/dist/service-host-bridge.js.map +1 -0
  185. package/dist/uninstaller.d.ts.map +1 -1
  186. package/dist/uninstaller.js +26 -0
  187. package/dist/uninstaller.js.map +1 -1
  188. package/dist/update/install-layout.d.ts +0 -12
  189. package/dist/update/install-layout.d.ts.map +1 -1
  190. package/dist/update/install-layout.js +42 -15
  191. package/dist/update/install-layout.js.map +1 -1
  192. package/host-runtime/dist/diagnostician-auto-run.js +4 -1
  193. package/host-runtime/dist/governance-observation-store.d.ts +7 -0
  194. package/host-runtime/dist/governance-observation-store.js +15 -4
  195. package/host-runtime/dist/governance-signal-admission.d.ts +49 -0
  196. package/host-runtime/dist/governance-signal-admission.js +355 -94
  197. package/host-runtime/dist/governance-trajectory-turn-reader.d.ts +20 -4
  198. package/host-runtime/dist/governance-trajectory-turn-reader.js +77 -5
  199. package/host-runtime/dist/index.d.ts +2 -0
  200. package/host-runtime/dist/index.js +5 -0
  201. package/host-runtime/dist/internalization-consumer-cycle.js +4 -1
  202. package/host-runtime/dist/pd-config.d.ts +10 -0
  203. package/host-runtime/dist/pd-config.js +37 -0
  204. package/host-runtime/dist/signal-stage2-cycle.js +28 -1
  205. package/host-runtime/dist/source-material-authorization.d.ts +53 -0
  206. package/host-runtime/dist/source-material-authorization.js +67 -0
  207. package/host-runtime/dist/source-revocation-sweep.d.ts +172 -0
  208. package/host-runtime/dist/source-revocation-sweep.js +928 -0
  209. package/host-runtime/package.json +5 -1
  210. package/install-layout/dist/background-execution-transition.d.ts +258 -0
  211. package/install-layout/dist/background-execution-transition.js +836 -0
  212. package/install-layout/dist/index.d.ts +8 -0
  213. package/install-layout/dist/index.js +8 -0
  214. package/install-layout/package.json +6 -2
  215. package/package.json +4 -4
  216. package/pd-cli/dist/commands/candidate.d.ts.map +1 -1
  217. package/pd-cli/dist/commands/candidate.js +16 -5
  218. package/pd-cli/dist/commands/candidate.js.map +1 -1
  219. package/pd-cli/dist/commands/codex-setup.d.ts.map +1 -1
  220. package/pd-cli/dist/commands/codex-setup.js +17 -1
  221. package/pd-cli/dist/commands/codex-setup.js.map +1 -1
  222. package/pd-cli/dist/commands/codex-worker.d.ts.map +1 -1
  223. package/pd-cli/dist/commands/codex-worker.js +8 -4
  224. package/pd-cli/dist/commands/codex-worker.js.map +1 -1
  225. package/pd-cli/dist/commands/consent-sweep-revoked.d.ts +20 -0
  226. package/pd-cli/dist/commands/consent-sweep-revoked.d.ts.map +1 -0
  227. package/pd-cli/dist/commands/consent-sweep-revoked.js +85 -0
  228. package/pd-cli/dist/commands/consent-sweep-revoked.js.map +1 -0
  229. package/pd-cli/dist/commands/context.d.ts.map +1 -1
  230. package/pd-cli/dist/commands/context.js +9 -1
  231. package/pd-cli/dist/commands/context.js.map +1 -1
  232. package/pd-cli/dist/commands/diagnose.d.ts.map +1 -1
  233. package/pd-cli/dist/commands/diagnose.js +12 -6
  234. package/pd-cli/dist/commands/diagnose.js.map +1 -1
  235. package/pd-cli/dist/commands/openclaw-worker.d.ts +11 -0
  236. package/pd-cli/dist/commands/openclaw-worker.d.ts.map +1 -0
  237. package/pd-cli/dist/commands/openclaw-worker.js +199 -0
  238. package/pd-cli/dist/commands/openclaw-worker.js.map +1 -0
  239. package/pd-cli/dist/commands/pain-explicit.d.ts.map +1 -1
  240. package/pd-cli/dist/commands/pain-explicit.js +1 -0
  241. package/pd-cli/dist/commands/pain-explicit.js.map +1 -1
  242. package/pd-cli/dist/commands/pain-recall.d.ts +2 -2
  243. package/pd-cli/dist/commands/pain-recall.d.ts.map +1 -1
  244. package/pd-cli/dist/commands/pain-recall.js +7 -1
  245. package/pd-cli/dist/commands/pain-recall.js.map +1 -1
  246. package/pd-cli/dist/commands/pain-retry.d.ts.map +1 -1
  247. package/pd-cli/dist/commands/pain-retry.js +12 -6
  248. package/pd-cli/dist/commands/pain-retry.js.map +1 -1
  249. package/pd-cli/dist/commands/runtime-internalization-enqueue-successors.d.ts.map +1 -1
  250. package/pd-cli/dist/commands/runtime-internalization-enqueue-successors.js +2 -1
  251. package/pd-cli/dist/commands/runtime-internalization-enqueue-successors.js.map +1 -1
  252. package/pd-cli/dist/commands/runtime-internalization-run-once.d.ts +1 -0
  253. package/pd-cli/dist/commands/runtime-internalization-run-once.d.ts.map +1 -1
  254. package/pd-cli/dist/commands/runtime-internalization-run-once.js +32 -8
  255. package/pd-cli/dist/commands/runtime-internalization-run-once.js.map +1 -1
  256. package/pd-cli/dist/commands/runtime-internalization-wake-once.d.ts.map +1 -1
  257. package/pd-cli/dist/commands/runtime-internalization-wake-once.js +2 -1
  258. package/pd-cli/dist/commands/runtime-internalization-wake-once.js.map +1 -1
  259. package/pd-cli/dist/commands/service-handover.d.ts +12 -0
  260. package/pd-cli/dist/commands/service-handover.d.ts.map +1 -0
  261. package/pd-cli/dist/commands/service-handover.js +117 -0
  262. package/pd-cli/dist/commands/service-handover.js.map +1 -0
  263. package/pd-cli/dist/commands/service-lifecycle.d.ts +31 -0
  264. package/pd-cli/dist/commands/service-lifecycle.d.ts.map +1 -0
  265. package/pd-cli/dist/commands/service-lifecycle.js +207 -0
  266. package/pd-cli/dist/commands/service-lifecycle.js.map +1 -0
  267. package/pd-cli/dist/commands/service-run-once.d.ts +96 -0
  268. package/pd-cli/dist/commands/service-run-once.d.ts.map +1 -1
  269. package/pd-cli/dist/commands/service-run-once.js +432 -13
  270. package/pd-cli/dist/commands/service-run-once.js.map +1 -1
  271. package/pd-cli/dist/commands/workbuddy-setup.d.ts.map +1 -1
  272. package/pd-cli/dist/commands/workbuddy-setup.js +22 -2
  273. package/pd-cli/dist/commands/workbuddy-setup.js.map +1 -1
  274. package/pd-cli/dist/program.d.ts.map +1 -1
  275. package/pd-cli/dist/program.js +167 -9
  276. package/pd-cli/dist/program.js.map +1 -1
  277. package/pd-cli/dist/services/admission-write-gate.d.ts +3 -1
  278. package/pd-cli/dist/services/admission-write-gate.d.ts.map +1 -1
  279. package/pd-cli/dist/services/admission-write-gate.js +1 -0
  280. package/pd-cli/dist/services/admission-write-gate.js.map +1 -1
  281. package/pd-cli/dist/services/service-host/coordinator-common.d.ts +49 -0
  282. package/pd-cli/dist/services/service-host/coordinator-common.d.ts.map +1 -0
  283. package/pd-cli/dist/services/service-host/coordinator-common.js +158 -0
  284. package/pd-cli/dist/services/service-host/coordinator-common.js.map +1 -0
  285. package/pd-cli/dist/services/service-host/handover-claims.d.ts +14 -0
  286. package/pd-cli/dist/services/service-host/handover-claims.d.ts.map +1 -0
  287. package/pd-cli/dist/services/service-host/handover-claims.js +50 -0
  288. package/pd-cli/dist/services/service-host/handover-claims.js.map +1 -0
  289. package/pd-cli/dist/services/service-host/index.d.ts +19 -3
  290. package/pd-cli/dist/services/service-host/index.d.ts.map +1 -1
  291. package/pd-cli/dist/services/service-host/index.js +21 -3
  292. package/pd-cli/dist/services/service-host/index.js.map +1 -1
  293. package/pd-cli/dist/services/service-host/install-identity.d.ts +23 -3
  294. package/pd-cli/dist/services/service-host/install-identity.d.ts.map +1 -1
  295. package/pd-cli/dist/services/service-host/install-identity.js +15 -5
  296. package/pd-cli/dist/services/service-host/install-identity.js.map +1 -1
  297. package/pd-cli/dist/services/service-host/locking/service-run-lock.d.ts +130 -9
  298. package/pd-cli/dist/services/service-host/locking/service-run-lock.d.ts.map +1 -1
  299. package/pd-cli/dist/services/service-host/locking/service-run-lock.js +99 -19
  300. package/pd-cli/dist/services/service-host/locking/service-run-lock.js.map +1 -1
  301. package/pd-cli/dist/services/service-host/managed-run.d.ts +75 -0
  302. package/pd-cli/dist/services/service-host/managed-run.d.ts.map +1 -0
  303. package/pd-cli/dist/services/service-host/managed-run.js +550 -0
  304. package/pd-cli/dist/services/service-host/managed-run.js.map +1 -0
  305. package/pd-cli/dist/services/service-host/progress-evidence.d.ts +38 -0
  306. package/pd-cli/dist/services/service-host/progress-evidence.d.ts.map +1 -0
  307. package/pd-cli/dist/services/service-host/progress-evidence.js +155 -0
  308. package/pd-cli/dist/services/service-host/progress-evidence.js.map +1 -0
  309. package/pd-cli/dist/services/service-host/run-once.d.ts.map +1 -1
  310. package/pd-cli/dist/services/service-host/run-once.js +4 -136
  311. package/pd-cli/dist/services/service-host/run-once.js.map +1 -1
  312. package/pd-cli/dist/services/service-host/scheduler/contract.d.ts +184 -0
  313. package/pd-cli/dist/services/service-host/scheduler/contract.d.ts.map +1 -0
  314. package/pd-cli/dist/services/service-host/scheduler/contract.js +86 -0
  315. package/pd-cli/dist/services/service-host/scheduler/contract.js.map +1 -0
  316. package/pd-cli/dist/services/service-host/scheduler/index.d.ts +76 -0
  317. package/pd-cli/dist/services/service-host/scheduler/index.d.ts.map +1 -0
  318. package/pd-cli/dist/services/service-host/scheduler/index.js +128 -0
  319. package/pd-cli/dist/services/service-host/scheduler/index.js.map +1 -0
  320. package/pd-cli/dist/services/service-host/scheduler/linux.d.ts +27 -0
  321. package/pd-cli/dist/services/service-host/scheduler/linux.d.ts.map +1 -0
  322. package/pd-cli/dist/services/service-host/scheduler/linux.js +1010 -0
  323. package/pd-cli/dist/services/service-host/scheduler/linux.js.map +1 -0
  324. package/pd-cli/dist/services/service-host/scheduler/macos.d.ts +13 -0
  325. package/pd-cli/dist/services/service-host/scheduler/macos.d.ts.map +1 -0
  326. package/pd-cli/dist/services/service-host/scheduler/macos.js +819 -0
  327. package/pd-cli/dist/services/service-host/scheduler/macos.js.map +1 -0
  328. package/pd-cli/dist/services/service-host/scheduler/runtime-io.d.ts +13 -0
  329. package/pd-cli/dist/services/service-host/scheduler/runtime-io.d.ts.map +1 -0
  330. package/pd-cli/dist/services/service-host/scheduler/runtime-io.js +141 -0
  331. package/pd-cli/dist/services/service-host/scheduler/runtime-io.js.map +1 -0
  332. package/pd-cli/dist/services/service-host/scheduler/service-status.d.ts +99 -0
  333. package/pd-cli/dist/services/service-host/scheduler/service-status.d.ts.map +1 -0
  334. package/pd-cli/dist/services/service-host/scheduler/service-status.js +202 -0
  335. package/pd-cli/dist/services/service-host/scheduler/service-status.js.map +1 -0
  336. package/pd-cli/dist/services/service-host/scheduler/windows.d.ts +40 -0
  337. package/pd-cli/dist/services/service-host/scheduler/windows.d.ts.map +1 -0
  338. package/pd-cli/dist/services/service-host/scheduler/windows.js +688 -0
  339. package/pd-cli/dist/services/service-host/scheduler/windows.js.map +1 -0
  340. package/pd-cli/dist/services/service-host/shadow-progress-store.d.ts +43 -0
  341. package/pd-cli/dist/services/service-host/shadow-progress-store.d.ts.map +1 -0
  342. package/pd-cli/dist/services/service-host/shadow-progress-store.js +156 -0
  343. package/pd-cli/dist/services/service-host/shadow-progress-store.js.map +1 -0
  344. package/pd-cli/dist/services/service-host/shadow-run.d.ts +87 -0
  345. package/pd-cli/dist/services/service-host/shadow-run.d.ts.map +1 -0
  346. package/pd-cli/dist/services/service-host/shadow-run.js +549 -0
  347. package/pd-cli/dist/services/service-host/shadow-run.js.map +1 -0
  348. package/pd-cli/dist/services/service-host/status/service-run-status.d.ts +114 -4
  349. package/pd-cli/dist/services/service-host/status/service-run-status.d.ts.map +1 -1
  350. package/pd-cli/dist/services/service-host/status/service-run-status.js +37 -0
  351. package/pd-cli/dist/services/service-host/status/service-run-status.js.map +1 -1
  352. package/pd-cli/dist/services/service-host/worker-adapter-codex.d.ts +2 -0
  353. package/pd-cli/dist/services/service-host/worker-adapter-codex.d.ts.map +1 -0
  354. package/pd-cli/dist/services/service-host/worker-adapter-codex.js +76 -0
  355. package/pd-cli/dist/services/service-host/worker-adapter-codex.js.map +1 -0
  356. package/pd-cli/dist/services/service-host/worker-adapter-openclaw.d.ts +2 -0
  357. package/pd-cli/dist/services/service-host/worker-adapter-openclaw.d.ts.map +1 -0
  358. package/pd-cli/dist/services/service-host/worker-adapter-openclaw.js +49 -0
  359. package/pd-cli/dist/services/service-host/worker-adapter-openclaw.js.map +1 -0
  360. package/pd-cli/dist/services/service-host/worker-adapter-workbuddy.d.ts +2 -0
  361. package/pd-cli/dist/services/service-host/worker-adapter-workbuddy.d.ts.map +1 -0
  362. package/pd-cli/dist/services/service-host/worker-adapter-workbuddy.js +36 -0
  363. package/pd-cli/dist/services/service-host/worker-adapter-workbuddy.js.map +1 -0
  364. package/pd-cli/dist/services/service-host/worker-adapter.d.ts +187 -0
  365. package/pd-cli/dist/services/service-host/worker-adapter.d.ts.map +1 -0
  366. package/pd-cli/dist/services/service-host/worker-adapter.js +609 -0
  367. package/pd-cli/dist/services/service-host/worker-adapter.js.map +1 -0
  368. package/pd-cli/dist/services/service-host/worker-env.d.ts +84 -0
  369. package/pd-cli/dist/services/service-host/worker-env.d.ts.map +1 -0
  370. package/pd-cli/dist/services/service-host/worker-env.js +195 -0
  371. package/pd-cli/dist/services/service-host/worker-env.js.map +1 -0
  372. package/pd-cli/dist/services/service-host/worker-process.d.ts +75 -0
  373. package/pd-cli/dist/services/service-host/worker-process.d.ts.map +1 -0
  374. package/pd-cli/dist/services/service-host/worker-process.js +225 -0
  375. package/pd-cli/dist/services/service-host/worker-process.js.map +1 -0
  376. package/pd-cli/dist/services/service-host/workspace-dispatch.d.ts +61 -0
  377. package/pd-cli/dist/services/service-host/workspace-dispatch.d.ts.map +1 -0
  378. package/pd-cli/dist/services/service-host/workspace-dispatch.js +105 -0
  379. package/pd-cli/dist/services/service-host/workspace-dispatch.js.map +1 -0
  380. package/pd-cli/dist/services/service-host/workspace-handover.d.ts +190 -0
  381. package/pd-cli/dist/services/service-host/workspace-handover.d.ts.map +1 -0
  382. package/pd-cli/dist/services/service-host/workspace-handover.js +1393 -0
  383. package/pd-cli/dist/services/service-host/workspace-handover.js.map +1 -0
  384. package/pd-cli/package.json +6 -5
  385. package/pd-mcp-server/dist/submit-assembly.js +159 -42
  386. package/pd-mcp-server/dist/version.d.ts +1 -1
  387. package/pd-mcp-server/dist/version.js +1 -1
  388. package/pd-mcp-server/package.json +1 -1
  389. package/plugin/dist/bundle.js +586 -568
  390. package/plugin/dist/openclaw-worker.d.ts +92 -0
  391. package/plugin/dist/openclaw-worker.js +2439 -0
  392. package/plugin/dist/openclaw.plugin.json +1 -1
  393. package/plugin/dist/service/gateway-consumer-lease.d.ts +142 -0
  394. package/plugin/dist/service/gateway-quiesce-ack.d.ts +40 -0
  395. package/plugin/dist/service/internalization-auto-consumer-service.d.ts +68 -1
  396. package/plugin/openclaw.plugin.json +1 -1
  397. package/plugin/package.json +5 -1
  398. package/release-manager/dist/installer.js +77 -30
  399. package/release-manager/dist/installers/mcp-registration-conflict.js +34 -1
  400. package/release-manager/dist/installers/workbuddy-host-installer.js +284 -21
  401. package/release-manager/dist/service-host-bridge.js +292 -0
  402. package/release-manager/dist/update/install-layout.js +42 -15
  403. package/release-manager/package.json +2 -2
  404. package/workbuddy-adapter/dist/index.d.ts +1 -1
  405. package/workbuddy-adapter/dist/index.js +1 -1
  406. package/workbuddy-adapter/dist/worker/workspace-worker.d.ts +7 -0
  407. package/workbuddy-adapter/dist/worker/workspace-worker.js +179 -10
  408. package/workbuddy-adapter/package.json +1 -1
  409. package/workbuddy-adapter/plugin/.codebuddy-plugin/plugin.json +2 -2
@@ -0,0 +1,158 @@
1
+ /**
2
+ * Shared coordinator steps (SPEC-PD-SERVICE-HOST-001 §8.2 steps 3–5, TD §5).
3
+ *
4
+ * The dry-run coordinator (run-once.ts, Phase 1) and the shadow coordinator
5
+ * (shadow-run.ts, Phase 2) execute the SAME prefix pipeline: manifest read
6
+ * with the five fail-closed verdicts, per-host root reporting, and manifest
7
+ * section projection. Those steps live here once so the two flows can never
8
+ * drift apart; each flow keeps its own execution phase.
9
+ */
10
+ import * as fs from 'node:fs';
11
+ import { parseInstallManifest, } from '@principles/install-layout';
12
+ /** Read + parse the manifest with the five task-required verdicts. */
13
+ export function readManifest(identity) {
14
+ let raw;
15
+ try {
16
+ raw = fs.readFileSync(identity.manifestPath, 'utf8');
17
+ }
18
+ catch (error) {
19
+ const code = typeof error === 'object' && error !== null && Object.hasOwn(error, 'code')
20
+ ? String(Reflect.get(error, 'code'))
21
+ : '';
22
+ if (code === 'ENOENT') {
23
+ return { manifest: undefined, verdict: 'missing', reason: 'install_manifest_missing' };
24
+ }
25
+ return {
26
+ manifest: undefined,
27
+ verdict: 'read_failed',
28
+ reason: code !== '' ? `install_manifest_read_failed:${code}` : 'install_manifest_read_failed',
29
+ };
30
+ }
31
+ let parsed;
32
+ try {
33
+ parsed = JSON.parse(raw);
34
+ }
35
+ catch (error) {
36
+ const message = error instanceof Error ? error.message : String(error);
37
+ return { manifest: undefined, verdict: 'unparsable', reason: `install_manifest_unparsable:${message.slice(0, 120)}` };
38
+ }
39
+ const result = parseInstallManifest(parsed);
40
+ if (result.manifest === undefined) {
41
+ const error = result.error ?? 'install_manifest_malformed';
42
+ return {
43
+ manifest: undefined,
44
+ verdict: error.startsWith('install_manifest_unsupported_version') ? 'version_mismatch' : 'invalid',
45
+ reason: error,
46
+ };
47
+ }
48
+ return { manifest: result.manifest, verdict: 'ok' };
49
+ }
50
+ /** Empty discovery counts for refusal statuses. */
51
+ export function zeroCounts() {
52
+ return { authorized: 0, degraded: 0, unavailable: 0, conflicting: 0, invalid: 0, discovered: 0 };
53
+ }
54
+ /** Build the empty discovery result used by refusal statuses. */
55
+ export function buildEmptyDiscovery() {
56
+ return { workspaces: [], discoveredTotal: 0, counts: zeroCounts() };
57
+ }
58
+ /**
59
+ * The default host-root listability probe (P2-1). `statSync` succeeding is
60
+ * not enough — a directory the OS reports but `readdir` refuses (EACCES /
61
+ * EPERM) or fails on (EIO, transient FS errors) is NOT listable, and the
62
+ * claims collector could not have seen the workspaces under it. The four
63
+ * verdicts are distinct and none is ever faked:
64
+ * - `missing` — ENOENT/ENOTDIR at stat, or the dir vanished before readdir;
65
+ * - `not_directory` — the path exists but is not a directory;
66
+ * - `unreadable` — exists, is a directory, readdir failed for any reason;
67
+ * - `readable` — readdir actually succeeded.
68
+ */
69
+ export function defaultListDir(dir) {
70
+ try {
71
+ if (!fs.statSync(dir).isDirectory())
72
+ return 'not_directory';
73
+ }
74
+ catch (error) {
75
+ const code = typeof error === 'object' && error !== null && Object.hasOwn(error, 'code')
76
+ ? String(Reflect.get(error, 'code'))
77
+ : '';
78
+ return code === 'ENOENT' || code === 'ENOTDIR' ? 'missing' : 'unreadable';
79
+ }
80
+ try {
81
+ fs.readdirSync(dir);
82
+ return 'readable';
83
+ }
84
+ catch (error) {
85
+ const code = typeof error === 'object' && error !== null && Object.hasOwn(error, 'code')
86
+ ? String(Reflect.get(error, 'code'))
87
+ : '';
88
+ return code === 'ENOENT' || code === 'ENOTDIR' ? 'missing' : 'unreadable';
89
+ }
90
+ }
91
+ /**
92
+ * Per-host root report (P1-2/P2-1): for every host, which root the claims
93
+ * collector consulted, whether an env override STEERED it, and whether the
94
+ * directory was actually LISTABLE. "Steered" = the variable was inherited
95
+ * AND honored: in the default mode the inherited host-root overrides steer
96
+ * discovery (P1-2); in `canonicalHostRootsOnly` mode (shadow) they were
97
+ * ignored (`identity.environment.ignoredHostRootEnvVars`) and the root is
98
+ * the trusted-home default. An unreadable root — whichever way it was
99
+ * selected — is surfaced as incomplete discovery, never silently folded
100
+ * into "no workspaces".
101
+ */
102
+ export function hostRootReports(identity, listDir) {
103
+ const honored = new Set(identity.environment.inheritedHostRootEnvVars);
104
+ for (const ignored of identity.environment.ignoredHostRootEnvVars)
105
+ honored.delete(ignored);
106
+ const roots = [
107
+ {
108
+ host: 'openclaw',
109
+ root: identity.hostRoots.openclawHome,
110
+ source: honored.has('OPENCLAW_STATE_DIR') || honored.has('OPENCLAW_HOME') ? 'env' : 'default',
111
+ },
112
+ { host: 'codex', root: identity.hostRoots.codexHome, source: honored.has('CODEX_HOME') ? 'env' : 'default' },
113
+ {
114
+ host: 'workbuddy',
115
+ root: identity.hostRoots.workbuddyConfigDir,
116
+ source: honored.has('WORKBUDDY_CONFIG_DIR') ? 'env' : 'default',
117
+ },
118
+ ];
119
+ return roots.map((entry) => ({ ...entry, status: listDir(entry.root) }));
120
+ }
121
+ /** True when at least one consulted host root exists but could not be listed. */
122
+ export function discoveryIncompleteRoots(hostRoots) {
123
+ return hostRoots.filter((r) => r.status === 'unreadable' || r.status === 'not_directory');
124
+ }
125
+ /** Project a manifest read into the persisted status section. */
126
+ export function manifestSection(read) {
127
+ return read.manifest === undefined
128
+ ? {
129
+ verdict: read.verdict,
130
+ ...(read.reason !== undefined ? { reason: read.reason } : {}),
131
+ hosts: [],
132
+ unknownHosts: [],
133
+ workspacesCount: 0,
134
+ }
135
+ : {
136
+ verdict: 'ok',
137
+ hosts: [...read.manifest.hosts, ...(read.manifest.unknownHosts ?? [])],
138
+ unknownHosts: [...(read.manifest.unknownHosts ?? [])],
139
+ workspacesCount: (read.manifest.workspaces ?? []).length,
140
+ };
141
+ }
142
+ /**
143
+ * Claim-collection options for the shared prefix (P1-2): custom host roots
144
+ * (env overrides) reach the collector so workspaces under them stay
145
+ * discoverable; they can never steer pdHome itself.
146
+ */
147
+ export function claimOptionsFor(identity, readDiagnostics, claimReaders) {
148
+ return {
149
+ homeDir: identity.homeDir,
150
+ codexHome: identity.hostRoots.codexHome,
151
+ openclawHome: identity.hostRoots.openclawHome,
152
+ workbuddyConfigDir: identity.hostRoots.workbuddyConfigDir,
153
+ platform: process.platform,
154
+ readDiagnostics,
155
+ ...(claimReaders !== undefined ? { readers: claimReaders } : {}),
156
+ };
157
+ }
158
+ //# sourceMappingURL=coordinator-common.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coordinator-common.js","sourceRoot":"","sources":["../../../src/services/service-host/coordinator-common.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,EACL,oBAAoB,GAKrB,MAAM,4BAA4B,CAAC;AAKpC,sEAAsE;AACtE,MAAM,UAAU,YAAY,CAAC,QAAyB;IAKpD,IAAI,GAAW,CAAC;IAChB,IAAI,CAAC;QACH,GAAG,GAAG,EAAE,CAAC,YAAY,CAAC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;IACvD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,GAAG,OAAO,KAAK,KAAK,QAAQ,IAAI,KAA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;GAIG;AACH,MAAM,UAAU,eAAe,CAC7B,QAAyB,EACzB,eAAwC,EACxC,YAA+B;IAE/B,OAAO;QACL,OAAO,EAAE,QAAQ,CAAC,OAAO;QACzB,SAAS,EAAE,QAAQ,CAAC,SAAS,CAAC,SAAS;QACvC,YAAY,EAAE,QAAQ,CAAC,SAAS,CAAC,YAAY;QAC7C,kBAAkB,EAAE,QAAQ,CAAC,SAAS,CAAC,kBAAkB;QACzD,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,eAAe;QACf,GAAG,CAAC,YAAY,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,YAAY,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACjE,CAAC;AACJ,CAAC"}
@@ -0,0 +1,14 @@
1
+ export interface HandoverBindingResult {
2
+ /** An OpenClaw claim (any of the three validated sources) names this workspace. */
3
+ readonly openclawClaimed: boolean;
4
+ /** Cross-host conflict owner(s); `null` when unambiguous. */
5
+ readonly foreignOwner: string | null;
6
+ /**
7
+ * PRI-1282 review (P1-4): a binding file that could not be read or parsed
8
+ * is NOT "no claim" — it means foreign ownership cannot be proven either
9
+ * way, and the handover must fail closed. Lists the offending files.
10
+ */
11
+ readonly bindingUnverifiable: string | null;
12
+ }
13
+ export declare function collectHostWorkspaceClaimsFor(workspaceDir: string, homeDir: string, env?: Readonly<Record<string, string | undefined>>): HandoverBindingResult;
14
+ //# sourceMappingURL=handover-claims.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handover-claims.d.ts","sourceRoot":"","sources":["../../../src/services/service-host/handover-claims.ts"],"names":[],"mappings":"AAgBA,MAAM,WAAW,qBAAqB;IACpC,mFAAmF;IACnF,QAAQ,CAAC,eAAe,EAAE,OAAO,CAAC;IAClC,6DAA6D;IAC7D,QAAQ,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC;;;;OAIG;IACH,QAAQ,CAAC,mBAAmB,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7C;AAED,wBAAgB,6BAA6B,CAC3C,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,MAAM,EACf,GAAG,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,GACjD,qBAAqB,CAgCvB"}
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Host-binding verification for the §8.4 handover (PRI-1282 Phase 4).
3
+ *
4
+ * Thin wrapper over the EXISTING authorized-discovery authorities
5
+ * (`collectHostWorkspaceClaims` + `findForeignWorkspaceOwner`) — the handover
6
+ * never invents a second binding source. A workspace is handover-eligible
7
+ * when OpenClaw holds a VALIDATED claim (default dir / host declaration /
8
+ * payload binding) and no OTHER host claims it.
9
+ */
10
+ import * as fs from 'node:fs';
11
+ import * as path from 'node:path';
12
+ import { findForeignWorkspaceOwner, collectHostWorkspaceClaims } from '@principles/install-layout';
13
+ import { resolveCoordinatorInstallIdentity } from './install-identity.js';
14
+ import { claimOptionsFor } from './coordinator-common.js';
15
+ export function collectHostWorkspaceClaimsFor(workspaceDir, homeDir, env) {
16
+ const identity = resolveCoordinatorInstallIdentity(env ?? process.env, { trustedHomeDir: homeDir });
17
+ if (!identity.ok)
18
+ return { openclawClaimed: false, foreignOwner: 'install_identity_unresolved', bindingUnverifiable: null };
19
+ const diagnostics = [];
20
+ const options = claimOptionsFor(identity.identity, diagnostics);
21
+ const claims = collectHostWorkspaceClaims(options);
22
+ const canonical = path.resolve(workspaceDir);
23
+ // Claims are matched by REAL-directory identity, not lexical spelling —
24
+ // the manifest may hold an alias of the same directory (PRI-1282 review),
25
+ // which is exactly the shape `findForeignWorkspaceOwner` resolves too.
26
+ const identityOf = (candidate) => {
27
+ const lexical = path.resolve(candidate);
28
+ let resolved = lexical;
29
+ try {
30
+ resolved = fs.realpathSync.native(lexical);
31
+ }
32
+ catch {
33
+ // Best effort: a missing path compares lexically.
34
+ }
35
+ return process.platform === 'win32' ? resolved.toLowerCase() : resolved;
36
+ };
37
+ const canonicalIdentity = identityOf(canonical);
38
+ const samePath = (candidate) => identityOf(candidate) === canonicalIdentity;
39
+ const openclawClaimed = claims.some((claim) => claim.host === 'openclaw' && samePath(claim.workspaceDir));
40
+ const foreign = findForeignWorkspaceOwner('openclaw', canonical, options);
41
+ const foreignOwner = foreign.owners.length > 0 ? foreign.owners.join('+') : null;
42
+ // PRI-1282 review (P1-4): an unreadable/malformed binding file was skipped
43
+ // during claim collection — treat "cannot verify foreign ownership" as a
44
+ // blocking fact, not as silence. The caller fails closed on this.
45
+ const bindingUnverifiable = diagnostics.length > 0
46
+ ? diagnostics.map((d) => `${d.file}(${d.status})`).join(', ')
47
+ : null;
48
+ return { openclawClaimed, foreignOwner, bindingUnverifiable };
49
+ }
50
+ //# sourceMappingURL=handover-claims.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handover-claims.js","sourceRoot":"","sources":["../../../src/services/service-host/handover-claims.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,yBAAyB,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAC;AACnG,OAAO,EAAE,iCAAiC,EAAE,MAAM,uBAAuB,CAAC;AAC1E,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAgB1D,MAAM,UAAU,6BAA6B,CAC3C,YAAoB,EACpB,OAAe,EACf,GAAkD;IAElD,MAAM,QAAQ,GAAG,iCAAiC,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,EAAE,EAAE,cAAc,EAAE,OAAO,EAAE,CAAC,CAAC;IACpG,IAAI,CAAC,QAAQ,CAAC,EAAE;QAAE,OAAO,EAAE,eAAe,EAAE,KAAK,EAAE,YAAY,EAAE,6BAA6B,EAAE,mBAAmB,EAAE,IAAI,EAAE,CAAC;IAC5H,MAAM,WAAW,GAA4B,EA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CAAC,CAAC,CAAC,IAAI,CAAC;IACjF,2EAA2E;IAC3E,yEAAyE;IACzE,kEAAkE;IAClE,MAAM,mBAAmB,GAAG,WAAW,CAAC,MAAM,GAAG,CAAC;QAChD,CAAC,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;QAC7D,CAAC,CAAC,IAAI,CAAC;IACT,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,mBAAmB,EAAE,CAAC;AAChE,CAAC"}
@@ -3,13 +3,29 @@
3
3
  * (SPEC-PD-SERVICE-HOST-001 / ADR-0020 §11.6 narrow scope).
4
4
  *
5
5
  * Phase 1 public surface: the read-only run-once coordinator and its
6
- * building blocks. No Worker Adapter, no OS scheduler, no handover —
7
- * Phase 2+ extends this package within the same boundary (TD §11).
6
+ * building blocks. Phase 2 adds the unified Worker Adapter contract and the
7
+ * explicit, bounded shadow coordinator (PRI-1280). Phase 3 adds the managed
8
+ * run (the OS scheduler entry), the Scheduler Adapter Contract with the
9
+ * three user-level platform adapters, and the unified read-only status
10
+ * contract (PRI-1281). No owner-marker writes, no handover — later phases
11
+ * extend this package within the same boundary (TD §11).
8
12
  */
9
13
  export { resolveCoordinatorInstallIdentity, stripExperimentRoot, type CoordinatorEnvView, type InstallIdentity, } from './install-identity.js';
10
14
  export { WORKSPACE_DISCOVERY_VERDICTS, discoverWorkspaces, type DiscoverWorkspacesInput, type DiscoveryProbes, type WorkspaceDiscoveryEntry, type WorkspaceDiscoveryResult, type WorkspaceDiscoveryVerdict, type WorkspaceSourceRef, } from './workspace-discovery.js';
11
15
  export { projectWorkspaceOwner, type OwnerProjection } from './owner-projection.js';
16
+ export { buildEmptyDiscovery, claimOptionsFor, defaultListDir, discoveryIncompleteRoots, hostRootReports, manifestSection, readManifest, } from './coordinator-common.js';
12
17
  export { SERVICE_RUN_LOCK_STALE_MS, acquireServiceRunLock, holdsServiceRunLock, releaseServiceRunLock, serviceRunLockPath, type AcquireServiceRunLockResult, type LockBodyRead, type ReleaseServiceRunLockResult, type ServiceRunLockHandle, } from './locking/service-run-lock.js';
13
- export { SERVICE_RUN_STATUS_SCHEMA_VERSION, readActiveReleaseFacts, serviceRunStatusPath, writeServiceRunStatus, type ActiveReleaseFacts, type ServiceRunStatus, } from './status/service-run-status.js';
18
+ export { SERVICE_RUN_STATUS_SCHEMA_VERSION, readActiveReleaseFacts, readServiceRunStatus, serviceRunStatusPath, writeServiceRunStatus, type ActiveReleaseFacts, type ManagedExecutionRecord, type ManagedRunStatusSection, type ServiceRunStatus, type ServiceRunStatusRead, type ServiceRunTriggerSource, type ShadowExecutionRecord, type ShadowRunStatusSection, } from './status/service-run-status.js';
14
19
  export { runServiceRunOnce, type RunOnceOptions, type RunOnceResult, } from './run-once.js';
20
+ export { WORKER_ADAPTER_CONTRACT_VERSION, WORKER_HOST_KINDS, resolveActiveReleaseCliEntry, type AdapterCycleHealth, type AdapterCycleOutcome, type AdapterCycleResult, type AdapterSupport, type BusinessProgressEvidence, type CliWorkerHostConfig, type WorkerAdapter, type WorkerAdapterExecuteInput, type WorkerAdapterProbes, type WorkerHostKind, type WorkspaceDescriptor, } from './worker-adapter.js';
21
+ export { createCodexWorkerAdapter } from './worker-adapter-codex.js';
22
+ export { createWorkbuddyWorkerAdapter } from './worker-adapter-workbuddy.js';
23
+ export { buildWorkerEnvironment, type WorkerEnvironment, type WorkerEnvironmentReport, } from './worker-env.js';
24
+ export { runWorkerProcess, type WorkerProcessOptions, type WorkerProcessResult, } from './worker-process.js';
25
+ export { diffTaskProgress, readTaskProgressSnapshot, type TaskProgressEvidence, type TaskProgressRead, type TaskProgressSnapshot, } from './progress-evidence.js';
26
+ export { DEFAULT_SHADOW_WORKSPACE_TIMEOUT_MS, runServiceShadowOnce, type ShadowRunOptions, type ShadowRunProbes, type ShadowRunResult, } from './shadow-run.js';
27
+ export { carriedProgress, dispatchWorkspaceAdapters, workspaceStateFor, type AdapterDispatchEntry, type AdapterDispatchOutcome, type DispatchWorkspaceAdaptersArgs, type WorkspaceDispatchResult, } from './workspace-dispatch.js';
28
+ export { DEFAULT_MANAGED_WORKSPACE_TIMEOUT_MS, runServiceManagedOnce, type ManagedRunOptions, type ManagedRunProbes, type ManagedRunResult, } from './managed-run.js';
29
+ export { DEFAULT_SCHEDULER_INTERVAL_MS, buildWindowsTaskXml, buildMacosLaunchAgentPlist, buildLinuxServiceUnit, buildLinuxTimerUnit, createLinuxSchedulerAdapter, createMacosSchedulerAdapter, createSpawnSchedulerRunner, createWindowsSchedulerAdapter, nodeSchedulerFileIo, runSchedulerLifecycle, schedulerIdentityFor, schedulerInvocationArgs, validateSchedulerIntervalMs, parseWindowsIntervalMs, parseMacosStartIntervalMs, parseLinuxTimerIntervalMs, type MacosSchedulerDeps, type LinuxSchedulerDeps, type SchedulerAdapter, type SchedulerAdapterResolution, type SchedulerCommandResult, type SchedulerCommandRunner, type SchedulerFileIo, type SchedulerFacts, type SchedulerIdentity, type SchedulerLifecycleOperation, type SchedulerLifecycleOptions, type SchedulerLifecycleResult, type SchedulerOperationResult, type SchedulerPlatform, type SchedulerRegistration, type WindowsSchedulerDeps, } from './scheduler/index.js';
30
+ export { SERVICE_HOST_STATUS_SCHEMA_VERSION, composeServiceHostStatus, type ServiceHostStatusDocument, type ServiceHostStatusOptions, type ServiceHostStatusResult, type ServiceHostStatusWorkspace, } from './scheduler/service-status.js';
15
31
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/service-host/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EACL,iCAAiC,EACjC,mBAAmB,EACnB,KAAK,kBAAkB,EACvB,KAAK,eAAe,GACrB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,4BAA4B,EAC5B,kBAAkB,EAClB,KAAK,uBAAuB,EAC5B,KAAK,eAAe,EACpB,KAAK,uBAAuB,EAC5B,KAAK,wBAAwB,EAC7B,KAAK,yBAAyB,EAC9B,KAAK,kBAAkB,GACxB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,qBAAqB,EAAE,KAAK,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACpF,OAAO,EACL,yBAAyB,EACzB,qBAAqB,EACrB,mBAAmB,EACnB,qBAAqB,EACrB,kBAAkB,EAClB,KAAK,2BAA2B,EAChC,KAAK,YAAY,EACjB,KAAK,2BAA2B,EAChC,KAAK,oBAAoB,GAC1B,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,iCAAiC,EACjC,sBAAsB,EACtB,oBAAoB,EACpB,qBAAqB,EACrB,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,GACtB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,iBAAiB,EACjB,KAAK,cAAc,EACnB,KAAK,aAAa,GACnB,MAAM,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/service-host/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EACL,iCAAiC,EACjC,mBAAmB,EACnB,KAAK,kBAAkB,EACvB,KAAK,eAAe,GACrB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,4BAA4B,EAC5B,kBAAkB,EAClB,KAAK,uBAAuB,EAC5B,KAAK,eAAe,EACpB,KAAK,uBAAuB,EAC5B,KAAK,wBAAwB,EAC7B,KAAK,yBAAyB,EAC9B,KAAK,kBAAkB,GACxB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,qBAAqB,EAAE,KAAK,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACpF,OAAO,EACL,mBAAmB,EACnB,eAAe,EACf,cAAc,EACd,wBAAwB,EACxB,eAAe,EACf,eAAe,EACf,YAAY,GACb,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,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3,13 +3,31 @@
3
3
  * (SPEC-PD-SERVICE-HOST-001 / ADR-0020 §11.6 narrow scope).
4
4
  *
5
5
  * Phase 1 public surface: the read-only run-once coordinator and its
6
- * building blocks. No Worker Adapter, no OS scheduler, no handover —
7
- * Phase 2+ extends this package within the same boundary (TD §11).
6
+ * building blocks. Phase 2 adds the unified Worker Adapter contract and the
7
+ * explicit, bounded shadow coordinator (PRI-1280). Phase 3 adds the managed
8
+ * run (the OS scheduler entry), the Scheduler Adapter Contract with the
9
+ * three user-level platform adapters, and the unified read-only status
10
+ * contract (PRI-1281). No owner-marker writes, no handover — later phases
11
+ * extend this package within the same boundary (TD §11).
8
12
  */
9
13
  export { resolveCoordinatorInstallIdentity, stripExperimentRoot, } from './install-identity.js';
10
14
  export { WORKSPACE_DISCOVERY_VERDICTS, discoverWorkspaces, } from './workspace-discovery.js';
11
15
  export { projectWorkspaceOwner } from './owner-projection.js';
16
+ export { buildEmptyDiscovery, claimOptionsFor, defaultListDir, discoveryIncompleteRoots, hostRootReports, manifestSection, readManifest, } from './coordinator-common.js';
12
17
  export { SERVICE_RUN_LOCK_STALE_MS, acquireServiceRunLock, holdsServiceRunLock, releaseServiceRunLock, serviceRunLockPath, } from './locking/service-run-lock.js';
13
- export { SERVICE_RUN_STATUS_SCHEMA_VERSION, readActiveReleaseFacts, serviceRunStatusPath, writeServiceRunStatus, } from './status/service-run-status.js';
18
+ export { SERVICE_RUN_STATUS_SCHEMA_VERSION, readActiveReleaseFacts, readServiceRunStatus, serviceRunStatusPath, writeServiceRunStatus, } from './status/service-run-status.js';
14
19
  export { runServiceRunOnce, } from './run-once.js';
20
+ // ── Phase 2 (PRI-1280): Worker Adapter contract + shadow coordinator ──
21
+ export { WORKER_ADAPTER_CONTRACT_VERSION, WORKER_HOST_KINDS, resolveActiveReleaseCliEntry, } from './worker-adapter.js';
22
+ export { createCodexWorkerAdapter } from './worker-adapter-codex.js';
23
+ export { createWorkbuddyWorkerAdapter } from './worker-adapter-workbuddy.js';
24
+ export { buildWorkerEnvironment, } from './worker-env.js';
25
+ export { runWorkerProcess, } from './worker-process.js';
26
+ export { diffTaskProgress, readTaskProgressSnapshot, } from './progress-evidence.js';
27
+ export { DEFAULT_SHADOW_WORKSPACE_TIMEOUT_MS, runServiceShadowOnce, } from './shadow-run.js';
28
+ // ── Phase 3 (PRI-1281): shared dispatch core + managed run + OS scheduler ──
29
+ export { carriedProgress, dispatchWorkspaceAdapters, workspaceStateFor, } from './workspace-dispatch.js';
30
+ export { DEFAULT_MANAGED_WORKSPACE_TIMEOUT_MS, runServiceManagedOnce, } from './managed-run.js';
31
+ export { DEFAULT_SCHEDULER_INTERVAL_MS, buildWindowsTaskXml, buildMacosLaunchAgentPlist, buildLinuxServiceUnit, buildLinuxTimerUnit, createLinuxSchedulerAdapter, createMacosSchedulerAdapter, createSpawnSchedulerRunner, createWindowsSchedulerAdapter, nodeSchedulerFileIo, runSchedulerLifecycle, schedulerIdentityFor, schedulerInvocationArgs, validateSchedulerIntervalMs, parseWindowsIntervalMs, parseMacosStartIntervalMs, parseLinuxTimerIntervalMs, } from './scheduler/index.js';
32
+ export { SERVICE_HOST_STATUS_SCHEMA_VERSION, composeServiceHostStatus, } from './scheduler/service-status.js';
15
33
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/services/service-host/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EACL,iCAAiC,EACjC,mBAAmB,GAGpB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,4BAA4B,EAC5B,kBAAkB,GAOnB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,qBAAqB,EAAwB,MAAM,uBAAuB,CAAC;AACpF,OAAO,EACL,yBAAyB,EACzB,qBAAqB,EACrB,mBAAmB,EACnB,qBAAqB,EACrB,kBAAkB,GAKnB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,iCAAiC,EACjC,sBAAsB,EACtB,oBAAoB,EACpB,qBAAqB,GAGtB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,iBAAiB,GAGlB,MAAM,eAAe,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/services/service-host/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EACL,iCAAiC,EACjC,mBAAmB,GAGpB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,4BAA4B,EAC5B,kBAAkB,GAOnB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,qBAAqB,EAAwB,MAAM,uBAAuB,CAAC;AACpF,OAAO,EACL,mBAAmB,EACnB,eAAe,EACf,cAAc,EACd,wBAAwB,EACxB,eAAe,EACf,eAAe,EACf,YAAY,GACb,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,yBAAyB,EACzB,qBAAqB,EACrB,mBAAmB,EACnB,qBAAqB,EACrB,kBAAkB,GAKnB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,iCAAiC,EACjC,sBAAsB,EACtB,oBAAoB,EACpB,oBAAoB,EACpB,qBAAqB,GAStB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,iBAAiB,GAGlB,MAAM,eAAe,CAAC;AACvB,yEAAyE;AACzE,OAAO,EACL,+BAA+B,EAC/B,iBAAiB,EACjB,4BAA4B,GAY7B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AACrE,OAAO,EAAE,4BAA4B,EAAE,MAAM,+BAA+B,CAAC;AAC7E,OAAO,EACL,sBAAsB,GAGvB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,gBAAgB,GAGjB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,gBAAgB,EAChB,wBAAwB,GAIzB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,mCAAmC,EACnC,oBAAoB,GAIrB,MAAM,iBAAiB,CAAC;AACzB,8EAA8E;AAC9E,OAAO,EACL,eAAe,EACf,yBAAyB,EACzB,iBAAiB,GAKlB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,oCAAoC,EACpC,qBAAqB,GAItB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,6BAA6B,EAC7B,mBAAmB,EACnB,0BAA0B,EAC1B,qBAAqB,EACrB,mBAAmB,EACnB,2BAA2B,EAC3B,2BAA2B,EAC3B,0BAA0B,EAC1B,6BAA6B,EAC7B,mBAAmB,EACnB,qBAAqB,EACrB,oBAAoB,EACpB,uBAAuB,EACvB,2BAA2B,EAC3B,sBAAsB,EACtB,yBAAyB,EACzB,yBAAyB,GAiB1B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,kCAAkC,EAClC,wBAAwB,GAKzB,MAAM,+BAA+B,CAAC"}
@@ -12,11 +12,19 @@ export interface CoordinatorEnvView {
12
12
  */
13
13
  readonly ignoredIdentityEnvVars: readonly string[];
14
14
  /**
15
- * Host-root overrides present in the inherited env. These DID steer
16
- * workspace discovery (P1-2) but cannot move pdHome — listed here so an
17
- * operator can tell a custom-root run apart from a default-root run.
15
+ * Host-root overrides present in the inherited env. In the default (Phase 1
16
+ * dry-run) mode these DID steer workspace discovery (P1-2) but cannot move
17
+ * pdHome. In `canonicalHostRootsOnly` mode they did NOT steer anything —
18
+ * see `ignoredHostRootEnvVars`.
18
19
  */
19
20
  readonly inheritedHostRootEnvVars: readonly string[];
21
+ /**
22
+ * Host-root overrides that were present in the inherited env but did NOT
23
+ * steer host-root resolution (always empty in the default mode; the present
24
+ * list in `canonicalHostRootsOnly` mode). Recorded so a polluted run is
25
+ * observable, never silent (rc-9).
26
+ */
27
+ readonly ignoredHostRootEnvVars: readonly string[];
20
28
  }
21
29
  export interface InstallIdentity {
22
30
  /** `<home>/.pd` — the install root this coordinator owns. */
@@ -53,6 +61,18 @@ export interface ResolveInstallIdentityOptions {
53
61
  * When omitted the OS account record is consulted.
54
62
  */
55
63
  readonly trustedHomeDir?: string;
64
+ /**
65
+ * Resolve host roots from the trusted home ONLY (canonical
66
+ * `<home>/.openclaw` / `<home>/.codex` / `<home>/.workbuddy` defaults),
67
+ * ignoring inherited `OPENCLAW_STATE_DIR` / `OPENCLAW_HOME` /
68
+ * `CODEX_HOME` / `WORKBUDDY_CONFIG_DIR` overrides (recorded as
69
+ * `ignoredHostRootEnvVars`). The Phase 2 shadow coordinator sets this: a
70
+ * real cycle must never be discovered from — nor pinned to — an
71
+ * experiment/custom root an inherited env happened to name (TD §5.2). The
72
+ * Phase 1 dry-run keeps the shared production precedence (env honored for
73
+ * discovery, P1-2) because it starts nothing.
74
+ */
75
+ readonly canonicalHostRootsOnly?: boolean;
56
76
  }
57
77
  /** Strip the experiment-root switch, keeping every other variable intact. */
58
78
  export declare function stripExperimentRoot(env: Readonly<Record<string, string | undefined>>): {
@@ -1 +1 @@
1
- {"version":3,"file":"install-identity.d.ts","sourceRoot":"","sources":["../../../src/services/service-host/install-identity.ts"],"names":[],"mappings":"AAkDA,MAAM,WAAW,kBAAkB;IACjC,wEAAwE;IACxE,QAAQ,CAAC,uBAAuB,EAAE,OAAO,CAAC;IAC1C,8EAA8E;IAC9E,QAAQ,CAAC,sBAAsB,EAAE,OAAO,CAAC;IACzC,sFAAsF;IACtF,QAAQ,CAAC,4BAA4B,CAAC,EAAE,MAAM,CAAC;IAC/C;;;;OAIG;IACH,QAAQ,CAAC,sBAAsB,EAAE,SAAS,MAAM,EAAE,CAAC;IACnD;;;;OAIG;IACH,QAAQ,CAAC,wBAAwB,EAAE,SAAS,MAAM,EAAE,CAAC;CACtD;AAED,MAAM,WAAW,eAAe;IAC9B,6DAA6D;IAC7D,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,yDAAyD;IACzD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB;;;;OAIG;IACH,QAAQ,CAAC,UAAU,EAAE,eAAe,GAAG,UAAU,CAAC;IAClD,gEAAgE;I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C,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,GAChD;IAAE,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;IAAC,IAAI,EAAE,kBAAkB,CAAA;CAAE,CAmCvE;AAoBD;;;;;;;;GAQG;AACH,wBAAgB,iCAAiC,CAC/C,GAAG,GAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAe,EAC/D,OAAO,GAAE,6BAAkC,GAC1C;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,QAAQ,EAAE,eAAe,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,CAgE7F"}
@@ -56,6 +56,9 @@ export function stripExperimentRoot(env) {
56
56
  const base = {
57
57
  ignoredIdentityEnvVars,
58
58
  inheritedHostRootEnvVars,
59
+ // Overridden by resolveCoordinatorInstallIdentity when host-root
60
+ // resolution ignores the inherited overrides (canonicalHostRootsOnly).
61
+ ignoredHostRootEnvVars: [],
59
62
  };
60
63
  const raw = env[PD_EXPERIMENT_ROOT];
61
64
  if (raw === undefined) {
@@ -134,10 +137,17 @@ export function resolveCoordinatorInstallIdentity(env = process.env, options = {
134
137
  'Fix the OS account home directory, or reinstall PD with `npx create-principles-disciple`.',
135
138
  };
136
139
  }
137
- // HOME/USERPROFILE are deliberately NOT removed from `stripped`: the env is
138
- // also consulted for host-root overrides (P1-2), and the trusted home is
139
- // passed explicitly so the vars can never steer identity.
140
- const resolution = resolvePdHome({ env: stripped, homeDir });
140
+ // canonicalHostRootsOnly: host-root resolution sees an EMPTY env — the
141
+ // overrides resolve to the trusted-home defaults — while the inherited
142
+ // presence is recorded as ignored (rc-9). HOME/USERPROFILE stay in
143
+ // `stripped` (they are never consulted for host roots anyway).
144
+ const ignoredHostRootEnvVars = options.canonicalHostRootsOnly === true
145
+ ? view.inheritedHostRootEnvVars
146
+ : [];
147
+ const resolution = resolvePdHome({
148
+ env: options.canonicalHostRootsOnly === true ? {} : stripped,
149
+ homeDir,
150
+ });
141
151
  if (!resolution.ok) {
142
152
  return {
143
153
  ok: false,
@@ -159,7 +169,7 @@ export function resolveCoordinatorInstallIdentity(env = process.env, options = {
159
169
  workbuddyConfigDir: resolution.workbuddyConfigDir,
160
170
  },
161
171
  mode: 'production',
162
- environment: view,
172
+ environment: { ...view, ignoredHostRootEnvVars },
163
173
  },
164
174
  };
165
175
  }
@@ -1 +1 @@
1
- {"version":3,"file":"install-identity.js","sourceRoot":"","sources":["../../../src/services/service-host/install-identity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAE3D,mEAAmE;AACnE,MAAM,kBAAkB,GAAG,oBAAoB,CAAC;AAEhD;;;;GAIG;AACH,MAAM,yBAAyB,GAAG,CAAC,MAAM,EAAE,aAAa,CAAU,CAAC;AACnE,MAAM,kBAAkB,GAAG;IACzB,oBAAoB;IACpB,eAAe;IACf,YAAY;IACZ,sBAAsB;CACd,CAAC;AA6DX,6EAA6E;AAC7E,MAAM,UAAU,mBAAmB,CACjC,GAAiD;IAEjD,MAAM,KAAK,GAAG,CAAC,IAAY,EAAW,EAAE;QACtC,MAAM,KAAK,GAAG,GAAG,CAAC,IAAI,CAAC,CAAC;QACxB,OAAO,KAAK,KAAK,SAAS,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC;IACxD,CAAC,CAAC;IACF,MAAM,sBAAsB,GAAG,yBAAyB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACvE,MAAM,wBAAwB,GAAG,kBAAkB,CAAC,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IACJ,CAAC;IACD,4EAA4E;IAC5E,yEAAyE;IACzE,0DAA0D;IAC1D,MAAM,UAAU,GAAG,aAAa,CAAC,EAAE,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC;IAC7D,IAAI,CAAC,UAAU,CAAC,EAAE,EAAE,CAAC;QACnB,OAAO;YACL,EAAE,EAAE,KAAK;YACT,MAAM,EAAE,4BAA4B,UAAU,CAAC,MAAM,EAAE;YACvD,UAAU,EAAE,UAAU,CAAC,UAAU;SAClC,CAAC;IACJ,CAAC;IACD,OAAO;QACL,EAAE,EAAE,IAAI;QACR,QAAQ,EAAE;YACR,MAAM,EAAE,UAAU,CAAC,MAAM;YACzB,OAAO,EAAE,UAAU,CAAC,OAAO;YAC3B,UAAU;YACV,YAAY,EAAE,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,cAAc,CAAC;YAC1D,gBAAgB,EAAE,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,aAAa,CAAC;YAC7D,SAAS,EAAE;gBACT,YAAY,EAAE,UAAU,CAAC,YAAY;gBACrC,SAAS,EAAE,UAAU,CAAC,SAAS;gBAC/B,kBAAkB,EAAE,UAAU,CAAC,kBAAkB;aAClD;YACD,IAAI,EAAE,YAAY;YAClB,WAAW,EAAE,IAAI;SAClB;KACF,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"install-identity.js","sourceRoot":"","sources":["../../../src/services/service-host/install-identity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAE3D,mEAAmE;AACnE,MAAM,kBAAkB,GAAG,oBAAoB,CAAC;AAEhD;;;;GAIG;AACH,MAAM,yBAAyB,GAAG,CAAC,MAAM,EAAE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AU;YACV,YAAY,EAAE,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,cAAc,CAAC;YAC1D,gBAAgB,EAAE,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,aAAa,CAAC;YAC7D,SAAS,EAAE;gBACT,YAAY,EAAE,UAAU,CAAC,YAAY;gBACrC,SAAS,EAAE,UAAU,CAAC,SAAS;gBAC/B,kBAAkB,EAAE,UAAU,CAAC,kBAAkB;aAClD;YACD,IAAI,EAAE,YAAY;YAClB,WAAW,EAAE,EAAE,GAAG,IAAI,EAAE,sBAAsB,EAAE;SACjD;KACF,CAAC;AACJ,CAAC"}
@@ -1,3 +1,90 @@
1
+ /**
2
+ * Install-level single-instance run lock (SPEC-PD-SERVICE-HOST-001 §8.2 step
3
+ * 2, FR-08; TD §2.1 `locking/service-run-lock.ts`).
4
+ *
5
+ * The protocol is the one proven by PRI-1151's cross-process control-state
6
+ * lock (`host-runtime/product-telemetry/control-state-lock.ts`): atomic
7
+ * `'wx'` create with an owner body `<pid> <token> <createdAtISO>`; ownership-
8
+ * checked release; stale takeover gated on holder-liveness proof. It is
9
+ * re-declared here rather than exported because the semantic contract
10
+ * genuinely differs (P7: a real variation axis, not a speculative seam):
11
+ *
12
+ * - The control-state lock guards millisecond-scale read-modify-write
13
+ * transactions (5s stale window). A run-once coordinator legitimately
14
+ * runs for minutes, so a second coordinator must NEVER take over a lock
15
+ * that may still be a live run — the stale window is 30 minutes by
16
+ * default.
17
+ * - Contention is an IMMEDIATE verdict, not a bounded wait: SPEC §8.2
18
+ * requires the second instance to report `already_running`, not to queue
19
+ * behind the first.
20
+ * - A stale mtime whose body cannot be read is `corrupt` (fail-closed,
21
+ * human decision), never silently takeover-able and never reported as a
22
+ * live run.
23
+ *
24
+ * ── Concurrency protocol (P1-4 round 4: SQLite arbitration) ────────────────
25
+ *
26
+ * Every acquisition, takeover and release decision is serialized through a
27
+ * dedicated arbitration gate: the stable, short-lived SQLite database
28
+ * `<pdHome>/service/service-run-gate.db`, guarded by `BEGIN IMMEDIATE`.
29
+ * While one process holds the transaction, a contender's `BEGIN IMMEDIATE`
30
+ * fails with SQLITE_BUSY — ACQUIRE waits zero milliseconds (SPEC §8.2
31
+ * immediate `already_running`, never a queue), RELEASE retries briefly and
32
+ * bounded. A gate that cannot be opened or transacted at all maps to
33
+ * `unwritable` (fail-closed).
34
+ *
35
+ * The state machine inside the transaction is:
36
+ *
37
+ * evaluateLock ─ 'absent' → 'wx' create → acquired
38
+ * ├ 'fresh' → held
39
+ * ├ 'dead' → re-evaluate → unlink → 'wx' create
40
+ * │ → acquired(staleTakenOver)
41
+ * ├ 'stale-alive' → held (live or inconclusive owner)
42
+ * ├ 'stale-unreadable' → corrupt (identity unverifiable)
43
+ * └ 'stale-anonymous' → corrupt (no holder identity)
44
+ *
45
+ * 'dead' means the recorded holder PID is PROVABLY dead — age does not
46
+ * matter: a verifiably-exited holder is recovered immediately rather than
47
+ * waiting out the stale window (§P0.8).
48
+ *
49
+ * Why this closes the file-mutex races:
50
+ *
51
+ * - No mutex file exists. The arbiter is a real cross-process lock held by
52
+ * the OS/SQLite, not a file whose mtime pretends to prove liveness — so
53
+ * "stale mutex" reclaim is impossible by construction, and a live
54
+ * coordinator's arbitration can never be reclaimed by file-age
55
+ * heuristics (P1-4A moot). File age only feeds `evaluateLock`, and only
56
+ * inside the serialized section where PID liveness remains the sole
57
+ * takeover authority.
58
+ * - verify→delete→create is one transaction: two stale breakers cannot
59
+ * interleave (P1-4B). The first commits before the second's BEGIN
60
+ * completes; the second re-evaluates AFTER the first's lock is already
61
+ * in place and reports `held`.
62
+ * - A crashed coordinator releases its transaction through the OS
63
+ * automatically — recovery is immediate and deterministic (P1-4B).
64
+ * - Release is verify-body + unlink inside the SAME transaction: a true
65
+ * compare-and-delete under the arbiter, never a read→compare→unlink
66
+ * window (P1-4C). A foreign body is never unlinked.
67
+ * - No generic sweep touches arbitration state: `sweepOrphanSidecars`
68
+ * only removes age-proven legacy sidecars (`.mtx`, `.take-*`, `.rel-*`),
69
+ * none of which the new protocol creates or reads (P1-4D). The gate
70
+ * database and its `-journal`/`-wal`/`-shm` sidecars are never swept.
71
+ *
72
+ * No heartbeat exists and none is needed for Phase 1: a run is bounded far
73
+ * below the stale window, and mid-run ownership is re-verified by
74
+ * `holdsServiceRunLock` (the body compare IS the heartbeat-identity check —
75
+ * a file no longer carrying our body means we lost the run). PID liveness
76
+ * remains the sole takeover authority — file age alone is never the sole
77
+ * eviction signal (same rule as `principles-core/ledger-file-lock.ts`).
78
+ *
79
+ * Cross-platform note: `BEGIN IMMEDIATE` is the same advisory-file-lock
80
+ * arbitration on POSIX and Windows (SQLite's POSIX fcntl locks and Windows
81
+ * LockFileEx regions are both released by the OS on process death), and the
82
+ * lock file itself still changes hands only via 'wx' create + unlink —
83
+ * never rename, whose overwrite semantics differ between the platforms. A
84
+ * file still open by its dead holder is not unlinkable on Windows — unlink
85
+ * failure aborts the takeover fail-closed inside the transaction.
86
+ */
87
+ import * as fs from 'node:fs';
1
88
  /**
2
89
  * A lock older than this is treated as a crashed holder. A legitimate
3
90
  * run-once (bounded cycles, Phase 2 per-workspace timeouts) must stay well
@@ -6,6 +93,18 @@
6
93
  export declare const SERVICE_RUN_LOCK_STALE_MS: number;
7
94
  /** The one lock file per install: `<pdHome>/service/service-run.lock`. */
8
95
  export declare function serviceRunLockPath(pdHome: string): string;
96
+ /**
97
+ * The per-workspace consumer mutex: `<pdHome>/service/workspace-runs/<hash>.lock`.
98
+ *
99
+ * A consuming Worker child holds this for the whole cycle, so an
100
+ * orchestrator (handover resume / rollback) can prove "an old worker is
101
+ * still running on THIS workspace" by holder-PID liveness instead of
102
+ * guessing from the coordinator's own lock. The workspace is addressed by
103
+ * its canonical real directory — the same spelling-or-alias identity rule
104
+ * the §8.4 ownership projection uses — so either path spelling reaches the
105
+ * same mutex (PRI-1282 review).
106
+ */
107
+ export declare function workspaceServiceRunLockPath(pdHome: string, workspaceDir: string): string;
9
108
  export interface ServiceRunLockHandle {
10
109
  readonly lockPath: string;
11
110
  /** Random per-acquisition token; identifies THIS holder inside the body. */
@@ -65,6 +164,13 @@ export interface ServiceRunLockProbes {
65
164
  * (§P0). Production never sets it.
66
165
  */
67
166
  readonly gateEndFailure?: boolean;
167
+ /**
168
+ * Deterministic test seam: replace the lock-file stat (default
169
+ * `fs.statSync`). Lets tests reproduce EACCES/EIO/ENOTDIR stat failures on
170
+ * every platform without depending on OS permission behavior —
171
+ * production never sets it.
172
+ */
173
+ readonly statLock?: (lockPath: string) => fs.Stats;
68
174
  }
69
175
  /**
70
176
  * Structured lock-file read outcome (P0 round 6): a missing file and an
@@ -84,20 +190,35 @@ export type LockBodyRead = {
84
190
  export declare function readLockBodyStatus(lockPath: string): LockBodyRead;
85
191
  /** True when the lock file still carries OUR body (mid-run ownership re-check). */
86
192
  export declare function holdsServiceRunLock(handle: ServiceRunLockHandle): boolean;
193
+ /** Acquire the install-level single-instance run lock (see {@link acquireLockAt}). */
194
+ export declare function acquireServiceRunLock(pdHome: string, options?: {
195
+ staleMs?: number;
196
+ probes?: ServiceRunLockProbes;
197
+ }): AcquireServiceRunLockResult;
87
198
  /**
88
- * Acquire the install-level single-instance run lock. Every decision —
89
- * evaluate, stale takeover, create — runs inside the arbitration gate
90
- * (§P1-4 round 4), immediate verdicts, no wait loop (`already_running`
91
- * semantics, §8.2). A stale takeover additionally requires the recorded
92
- * holder PID to be demonstrably DEAD; a live, unknown or unverifiable
93
- * holder is NEVER taken over, and the verify→delete→create sequence is
94
- * serialized by the same transaction that a second contender's BEGIN
95
- * cannot enter.
199
+ * Acquire the per-workspace consumer mutex (see
200
+ * {@link workspaceServiceRunLockPath}). Same protocol as the install-level
201
+ * lock; the Worker child holds it for its whole consuming cycle so a
202
+ * handover resume / rollback can prove the old worker is still running
203
+ * (PRI-1282 review).
96
204
  */
97
- export declare function acquireServiceRunLock(pdHome: string, options?: {
205
+ export declare function acquireWorkspaceServiceRunLock(pdHome: string, workspaceDir: string, options?: {
98
206
  staleMs?: number;
99
207
  probes?: ServiceRunLockProbes;
100
208
  }): AcquireServiceRunLockResult;
209
+ /**
210
+ * Non-mutating liveness probe: is a CONSUMING worker holding this lock
211
+ * right now? 'free' means no holder or a provably-dead one (recoverable);
212
+ * 'held' means a live or inconclusive holder — an orchestrator must refuse
213
+ * to overlap it; 'corrupt' means the body cannot be verified (fail-closed).
214
+ */
215
+ export declare function probeServiceRunLockState(lockPath: string, options?: {
216
+ staleMs?: number;
217
+ probes?: ServiceRunLockProbes;
218
+ }): {
219
+ state: 'free' | 'held' | 'corrupt';
220
+ detail?: string;
221
+ };
101
222
  /**
102
223
  * Structured release outcome (§三): a release can never be silent.
103
224
  * - `released` — our lock was verified and unlinked under the gate;