create-principles-disciple 1.154.5 → 1.155.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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,549 @@
1
+ /**
2
+ * The Phase 2 shadow coordinator (SPEC §11 Phase 2 + Phase 2 准入边界, task §9).
3
+ *
4
+ * An EXPLICIT, MANUAL, BOUNDED shadow cycle — default-off, never scheduled:
5
+ *
6
+ * pd service run-once --shadow --workspace <dir> [--host codex|workbuddy]
7
+ *
8
+ * Runs the SAME trusted prefix as the Phase 1 dry-run (identity → install
9
+ * lock → active release → manifest → validated claims → discovery), then —
10
+ * for each EXPLICITLY requested workspace only — admits the target
11
+ * (authorized verdict + legacy-owned marker projection + adapter binding
12
+ * evidence), and drives ONE bounded real Worker Cycle per bound host
13
+ * through the unified Worker Adapter. A shadow cycle calls the REAL worker
14
+ * (business tasks may advance); it is never presented as a zero-side-effect
15
+ * dry-run, and it never:
16
+ *
17
+ * - registers an OS scheduler (Phase 3);
18
+ * - modifies the owner marker / enters the §8.4 handover state machine;
19
+ * - stops Companion Worker supervision or OpenClaw AutoConsumer;
20
+ * - executes anything beyond legacy-owned, discovery-authorized,
21
+ * explicitly-selected workspaces.
22
+ *
23
+ * Concurrency with the still-owning legacy consumer is converged by the
24
+ * EXISTING Durable Lease / fencing (same-task double acquisition is a
25
+ * structured lease_conflict, not corruption). Each workspace failure is
26
+ * isolated (FR-07): one timeout or crash never blocks the others.
27
+ */
28
+ import * as fs from 'node:fs';
29
+ import * as path from 'node:path';
30
+ import { randomUUID } from 'node:crypto';
31
+ import { collectHostWorkspaceClaims } from '@principles/install-layout';
32
+ import { loadHostToolDeclarations } from '@principles/host-runtime';
33
+ import { resolveCoordinatorInstallIdentity, } from './install-identity.js';
34
+ import { discoverWorkspaces } from './workspace-discovery.js';
35
+ import { projectWorkspaceOwnerAliases } from './owner-projection.js';
36
+ import { buildEmptyDiscovery, claimOptionsFor, defaultListDir, discoveryIncompleteRoots, hostRootReports, manifestSection, readManifest, } from './coordinator-common.js';
37
+ import { mergeShadowProgress, readShadowProgress, } from './shadow-progress-store.js';
38
+ import { acquireServiceRunLock, holdsServiceRunLock, releaseServiceRunLock, serviceRunLockPath, } from './locking/service-run-lock.js';
39
+ import { readActiveReleaseFacts, writeServiceRunStatus, } from './status/service-run-status.js';
40
+ import { WORKER_HOST_KINDS } from './worker-adapter.js';
41
+ import { carriedProgress, dispatchWorkspaceAdapters, workspaceStateFor, } from './workspace-dispatch.js';
42
+ import { createCodexWorkerAdapter } from './worker-adapter-codex.js';
43
+ import { createWorkbuddyWorkerAdapter } from './worker-adapter-workbuddy.js';
44
+ /**
45
+ * Default per-workspace bound. The Codex worker's own stage deadlines sum to
46
+ * ~40 minutes (catch-up 5 + reconcile 5 + diagnosis 15 + post-processing 5 +
47
+ * downstream 10 + stage-2), so 45 minutes bounds one full cycle with margin
48
+ * without letting a hung child outlive the coordinator.
49
+ */
50
+ export const DEFAULT_SHADOW_WORKSPACE_TIMEOUT_MS = 45 * 60_000;
51
+ const MIN_SHADOW_WORKSPACE_TIMEOUT_MS = 1_000;
52
+ /** Workspace identity for admission matching — the discovery identity rule (§9.1.6). */
53
+ function workspaceIdentity(dir) {
54
+ const resolved = path.resolve(dir);
55
+ let real;
56
+ try {
57
+ real = fs.realpathSync.native(resolved);
58
+ }
59
+ catch {
60
+ real = undefined;
61
+ }
62
+ const form = real ?? resolved;
63
+ return process.platform === 'win32' ? form.toLowerCase() : form;
64
+ }
65
+ /** Probe persisted host-tool declarations with the EXISTING validation authority (F2 review fix). */
66
+ function declaredHostKinds(canonicalDir) {
67
+ // `loadHostToolDeclarations` is the host-runtime authority: content is
68
+ // untrusted input, structurally validated (version/hostKind/mappings) —
69
+ // a same-named file that does not parse as a valid declaration is NOT
70
+ // binding evidence (CWE-345 fix). A workspace whose declaration store is
71
+ // invalid keeps its claim-based evidence path; the declaration adds
72
+ // nothing here.
73
+ const loaded = loadHostToolDeclarations(canonicalDir);
74
+ if (!loaded.ok)
75
+ return [];
76
+ const declared = [];
77
+ for (const declaration of loaded.declarations) {
78
+ if (WORKER_HOST_KINDS.includes(declaration.hostKind)) {
79
+ declared.push(declaration.hostKind);
80
+ }
81
+ }
82
+ return declared;
83
+ }
84
+ function buildDescriptor(entry) {
85
+ return {
86
+ canonicalDir: entry.canonicalDir,
87
+ discoveryVerdict: entry.verdict,
88
+ claimingHosts: entry.hosts,
89
+ declaredHostKinds: declaredHostKinds(entry.canonicalDir),
90
+ };
91
+ }
92
+ /**
93
+ * Read the carried-forward progress projection (F6 review fix): a small
94
+ * per-install store keyed by canonical workspace identity, MERGED across
95
+ * runs — not the latest-run status file's execution list (which loses
96
+ * A→B→A sequences and is replaced wholesale by dry-runs). A corrupt or
97
+ * unreadable store degrades to "no previous progress" and is reported in
98
+ * the persisted status (`progressCarryVerdict`), never silently.
99
+ */
100
+ function readPreviousProgress(pdHome) {
101
+ const read = readShadowProgress(pdHome);
102
+ if (!read.ok) {
103
+ return { at: new Map(), verdict: read.verdict };
104
+ }
105
+ const at = new Map();
106
+ for (const [key, entry] of read.entries) {
107
+ at.set(key, entry.lastProgressAt);
108
+ }
109
+ return { at, verdict: read.verdict };
110
+ }
111
+ /** Assemble the versioned shadow status document (v1 + additive shadow section). */
112
+ function buildShadowStatus(args) {
113
+ return {
114
+ schemaVersion: 'pd.service-run-status.v1',
115
+ runId: args.runId,
116
+ outcome: 'completed',
117
+ dryRun: false,
118
+ triggerSource: 'manual',
119
+ startedAt: args.startedAt.toISOString(),
120
+ completedAt: args.completedAt.toISOString(),
121
+ durationMs: Math.max(0, args.completedAt.getTime() - args.startedAt.getTime()),
122
+ installation: {
123
+ pdHome: args.identity.pdHome,
124
+ homeDir: args.identity.homeDir,
125
+ homeSource: args.identity.homeSource,
126
+ mode: args.identity.mode,
127
+ activeRelease: args.activeRelease,
128
+ },
129
+ environmentIsolation: {
130
+ pdExperimentRootStripped: args.identity.environment.experimentRootStripped,
131
+ ignoredIdentityEnvVars: args.identity.environment.ignoredIdentityEnvVars,
132
+ inheritedHostRootEnvVars: args.identity.environment.inheritedHostRootEnvVars,
133
+ ...(args.identity.environment.ignoredHostRootEnvVars.length > 0
134
+ ? { ignoredHostRootEnvVars: args.identity.environment.ignoredHostRootEnvVars }
135
+ : {}),
136
+ },
137
+ manifest: args.manifest,
138
+ discovery: {
139
+ discoveredTotal: args.discovery.discoveredTotal,
140
+ counts: args.discovery.counts,
141
+ hostRoots: args.hostRoots,
142
+ incomplete: discoveryIncompleteRoots(args.hostRoots).length > 0 || args.bindingDiagnostics.length > 0,
143
+ },
144
+ workspaces: args.discovery.workspaces,
145
+ shadow: {
146
+ requestedWorkspaces: args.requested,
147
+ ...(args.hostFilter !== undefined ? { hostFilter: args.hostFilter } : {}),
148
+ perWorkspaceTimeoutMs: args.timeoutMs,
149
+ progressCarryVerdict: args.progressCarryVerdict,
150
+ executions: args.executions,
151
+ },
152
+ nextAction: args.nextAction,
153
+ };
154
+ }
155
+ function shadowNextAction(executions) {
156
+ const admitted = executions.filter((e) => e.admission === 'admitted');
157
+ const refused = executions.filter((e) => e.admission === 'refused');
158
+ const bad = admitted.filter((e) => e.workspaceState === 'failed' || e.workspaceState === 'degraded' || e.workspaceState === 'unavailable');
159
+ if (refused.length > 0) {
160
+ const reasons = refused.map((e) => `${e.requestedDir} (${e.refusalReason ?? 'refused'})`).join('; ');
161
+ return `Shadow run complete with refusals: ${reasons}. Fix the admission blockers (authorization / owner state / binding evidence) or re-check the requested paths; no worker ran for them.`;
162
+ }
163
+ if (bad.length > 0) {
164
+ return `Shadow run complete with ${bad.length} non-healthy workspace execution(s); inspect each execution's reason and nextAction. The legacy consumer remains the unique automatic lifecycle owner; nothing was handed over.`;
165
+ }
166
+ return 'Shadow run complete. The legacy consumer remains the unique automatic lifecycle owner; no owner marker was modified and no scheduler was registered.';
167
+ }
168
+ async function completeShadowRun(identity, context) {
169
+ const { options } = context;
170
+ const timeoutMs = Math.max(MIN_SHADOW_WORKSPACE_TIMEOUT_MS, options.timeoutMs ?? DEFAULT_SHADOW_WORKSPACE_TIMEOUT_MS);
171
+ const hostRoots = hostRootReports(identity, context.listDir);
172
+ const lockLost = () => ({
173
+ ok: false,
174
+ outcome: 'refused',
175
+ runId: context.runId,
176
+ reason: 'service_run_lock_lost',
177
+ nextAction: 'The install-level run lock was taken over mid-run, so the run stopped before writing status. ' +
178
+ 'Inspect the current holder and re-run; do not treat this run\'s results as authoritative.',
179
+ });
180
+ const persistRefusal = (args) => {
181
+ if (!context.holdsLock(context.handle))
182
+ return lockLost();
183
+ const status = buildShadowStatus({
184
+ identity,
185
+ runId: context.runId,
186
+ startedAt: context.startedAt,
187
+ completedAt: new Date(),
188
+ activeRelease: args.activeRelease,
189
+ manifest: args.manifest ?? { verdict: 'ok', hosts: [], unknownHosts: [], workspacesCount: 0 },
190
+ discovery: args.discovery ?? buildEmptyDiscovery(),
191
+ hostRoots,
192
+ bindingDiagnostics: [],
193
+ requested: options.workspaces,
194
+ ...(options.hostFilter !== undefined ? { hostFilter: options.hostFilter } : {}),
195
+ timeoutMs,
196
+ executions: [],
197
+ progressCarryVerdict: 'missing',
198
+ nextAction: args.nextAction,
199
+ });
200
+ return {
201
+ ok: false,
202
+ outcome: 'refused',
203
+ runId: context.runId,
204
+ reason: args.reason,
205
+ nextAction: status.nextAction,
206
+ statusWrite: writeServiceRunStatus(identity.pdHome, status),
207
+ };
208
+ };
209
+ // ── Trusted prefix: active release → manifest → claims → discovery ──
210
+ const activeRelease = readActiveReleaseFacts(identity.activeRecordPath);
211
+ const manifestRead = readManifest(identity);
212
+ if (activeRelease.verdict !== 'ok') {
213
+ return persistRefusal({
214
+ reason: activeRelease.reason ?? 'active_release_invalid',
215
+ activeRelease,
216
+ manifest: manifestSection(manifestRead),
217
+ nextAction: activeRelease.verdict === 'missing'
218
+ ? 'Install or repair PD with npx create-principles-disciple — no active release record exists for this install.'
219
+ : 'Repair the install with the PD installer/updater; the active release record could not be verified against the authoritative schema.',
220
+ });
221
+ }
222
+ if (manifestRead.manifest === undefined) {
223
+ return persistRefusal({
224
+ reason: manifestRead.reason ?? 'install_manifest_invalid',
225
+ activeRelease,
226
+ manifest: manifestSection(manifestRead),
227
+ nextAction: manifestRead.verdict === 'missing'
228
+ ? 'Run npx create-principles-disciple to install PD (no manifest exists for this user-level install).'
229
+ : 'Repair the install manifest with the PD installer/updater before running the coordinator; the run refused instead of treating the install as empty.',
230
+ });
231
+ }
232
+ const readDiagnostics = [];
233
+ const claimOptions = claimOptionsFor(identity, readDiagnostics, context.claimReaders);
234
+ const claims = collectHostWorkspaceClaims(claimOptions);
235
+ const discovery = discoverWorkspaces({ manifest: manifestRead.manifest, claims, claimOptions });
236
+ // ── Admission + execution (explicit selection only, task §9) ──
237
+ const entriesByIdentity = new Map();
238
+ for (const entry of discovery.workspaces) {
239
+ entriesByIdentity.set(workspaceIdentity(entry.canonicalDir), entry);
240
+ }
241
+ const previousProgress = readPreviousProgress(identity.pdHome);
242
+ const executions = [];
243
+ // R2 review fix: an interrupt must stop the QUEUE, not just the
244
+ // in-flight worker — check before dispatching each workspace/adapter so a
245
+ // cancelled run never starts a Worker only to terminate it. The function
246
+ // indirection keeps repeated checks un-narrowed by TypeScript.
247
+ const isAborted = () => options.signal?.aborted === true;
248
+ // CR review fix: dedupe by canonical identity — the same workspace passed
249
+ // via a symlink AND its real path must still get exactly ONE cycle.
250
+ const dispatchedIdentities = new Set();
251
+ for (const requested of options.workspaces) {
252
+ if (isAborted())
253
+ break;
254
+ const requestedIdentity = workspaceIdentity(requested);
255
+ const entry = entriesByIdentity.get(requestedIdentity);
256
+ const refuse = (reason, refusalNextAction) => {
257
+ executions.push({
258
+ requestedDir: requested,
259
+ canonicalDir: entry?.canonicalDir ?? null,
260
+ hostKind: null,
261
+ admission: 'refused',
262
+ refusalReason: reason,
263
+ refusalNextAction,
264
+ workspaceState: 'unavailable',
265
+ lastProgressAt: previousProgress.at.get(requestedIdentity) ?? null,
266
+ lastProgressSource: previousProgress.at.has(requestedIdentity) ? 'previous_run' : null,
267
+ });
268
+ };
269
+ if (entry === undefined) {
270
+ refuse('workspace_not_in_authorized_discovery', 'The requested path is not among the authorized discovery results (install manifest + validated claims). Register the workspace or fix the path; shadow never executes undiscovered workspaces.');
271
+ continue;
272
+ }
273
+ if (dispatchedIdentities.has(requestedIdentity)) {
274
+ refuse('duplicate_workspace_selection', 'The same canonical workspace was selected more than once (e.g. via a symlink plus its real path). Select it once; shadow runs at most one cycle per bound host per workspace.');
275
+ continue;
276
+ }
277
+ if (entry.verdict !== 'authorized') {
278
+ refuse(`workspace_not_authorized:${entry.verdict}${entry.reason !== undefined ? `:${entry.reason}` : ''}`, entry.nextAction ?? 'Fix the workspace registration/on-disk state; only authorized workspaces may run a shadow cycle.');
279
+ continue;
280
+ }
281
+ // Owner admission (§8.4 read-only projection): shadow runs ONLY on
282
+ // legacy-owned workspaces — the old consumer stays the unique automatic
283
+ // lifecycle owner and NO marker transition ever happens here.
284
+ const owner = projectWorkspaceOwnerAliases(manifestRead.manifest, entry.sources.filter((s) => s.source === 'manifest').map((s) => s.path), process.platform);
285
+ if (owner.effectiveOwner !== 'legacy' || owner.state !== 'legacy_owned') {
286
+ refuse(`shadow_requires_legacy_owned_workspace:${owner.state}:${owner.effectiveOwner}`, 'This workspace is not in the plain legacy-owned state (§8.4); Phase 2 shadow never touches handover/rollback/service-host-owned workspaces. Reconcile the backgroundExecutions record first.');
287
+ continue;
288
+ }
289
+ dispatchedIdentities.add(requestedIdentity);
290
+ const descriptor = buildDescriptor(entry);
291
+ const hostKinds = options.hostFilter !== undefined ? [options.hostFilter] : [...WORKER_HOST_KINDS];
292
+ const previousAt = previousProgress.at.get(requestedIdentity);
293
+ const hadPrevious = previousProgress.at.has(requestedIdentity);
294
+ // Shared bounded dispatch (workspace-dispatch): one monotonic budget for
295
+ // the WHOLE workspace, serial bound adapters, abort checks before every
296
+ // dispatch — identical semantics in shadow and managed modes.
297
+ const dispatch = await dispatchWorkspaceAdapters({
298
+ workspaceDir: entry.canonicalDir,
299
+ descriptor,
300
+ hostKinds,
301
+ timeoutMs,
302
+ adapters: context.adapters,
303
+ activeRelease,
304
+ identity,
305
+ inheritedEnv: context.env,
306
+ ...(options.signal !== undefined ? { signal: options.signal } : {}),
307
+ probes: {
308
+ ...(context.options.probes?.spawnWorkerProcess !== undefined
309
+ ? { spawnWorkerProcess: context.options.probes.spawnWorkerProcess }
310
+ : {}),
311
+ ...(context.options.probes?.resolveCliEntry !== undefined
312
+ ? { resolveCliEntry: context.options.probes.resolveCliEntry }
313
+ : {}),
314
+ ...(context.options.probes?.now !== undefined ? { now: context.options.probes.now } : {}),
315
+ },
316
+ isAborted,
317
+ });
318
+ let supportedAny = false;
319
+ for (const { hostKind, outcome } of dispatch.entries) {
320
+ if (outcome.kind === 'unsupported')
321
+ continue; // not binding evidence for THIS host; other hosts may still run
322
+ supportedAny = true;
323
+ if (outcome.kind === 'budget_exhausted') {
324
+ executions.push({
325
+ requestedDir: requested,
326
+ canonicalDir: entry.canonicalDir,
327
+ hostKind,
328
+ admission: 'admitted',
329
+ workspaceState: 'failed',
330
+ refusalReason: 'workspace_timeout_budget_exhausted',
331
+ refusalNextAction: 'The per-workspace timeout budget was consumed by an earlier adapter cycle on this workspace; raise --timeout-ms or select hosts in separate runs.',
332
+ lastProgressAt: previousAt ?? null,
333
+ lastProgressSource: hadPrevious ? 'previous_run' : null,
334
+ });
335
+ continue;
336
+ }
337
+ if (outcome.kind === 'adapter_threw') {
338
+ executions.push({
339
+ requestedDir: requested,
340
+ canonicalDir: entry.canonicalDir,
341
+ hostKind,
342
+ admission: 'admitted',
343
+ workspaceState: 'failed',
344
+ lastProgressAt: previousAt ?? null,
345
+ lastProgressSource: hadPrevious ? 'previous_run' : null,
346
+ refusalReason: `adapter_threw:${outcome.sanitizedMessage}`,
347
+ refusalNextAction: 'The Worker Adapter threw before returning a structured result; inspect the adapter and workspace state, then re-run the shadow cycle.',
348
+ });
349
+ continue;
350
+ }
351
+ const carried = carriedProgress(outcome.result, previousAt);
352
+ executions.push({
353
+ requestedDir: requested,
354
+ canonicalDir: entry.canonicalDir,
355
+ hostKind,
356
+ admission: 'admitted',
357
+ workspaceState: workspaceStateFor(outcome.result.cycleOutcome),
358
+ ...carried,
359
+ execution: outcome.result,
360
+ });
361
+ }
362
+ if (!supportedAny) {
363
+ // The abort landed between the workspace gate and the first adapter
364
+ // dispatch — skip this workspace entirely rather than recording a
365
+ // refusal the workspace never earned.
366
+ if (isAborted())
367
+ break;
368
+ const supported = hostKinds.join('|');
369
+ refuse(`no_adapter_supports_workspace:${supported}`, 'No Worker Adapter accepted this workspace (no validated host binding — claim or host-tool declaration — for the selected host kind). host.* feature flags are not identity evidence.');
370
+ }
371
+ }
372
+ if (!context.holdsLock(context.handle))
373
+ return lockLost();
374
+ // ── Progress projection merge (F6): this run's evidenced values overwrite
375
+ // by key; every other workspace's entry survives (A→B→A / dry-run-in-between
376
+ // keep their recorded progress). The merge runs while the install lock is
377
+ // held; a write failure is surfaced in nextAction but does NOT fabricate
378
+ // per-workspace values (rc-9).
379
+ const progressUpdates = new Map();
380
+ const nowIso = new Date().toISOString();
381
+ for (const record of executions) {
382
+ if (record.admission === 'admitted' && record.canonicalDir !== null
383
+ && record.lastProgressAt !== null
384
+ && (record.lastProgressSource === 'task_state_change' || record.lastProgressSource === 'cycle_evidence')) {
385
+ progressUpdates.set(workspaceIdentity(record.canonicalDir), {
386
+ lastProgressAt: record.lastProgressAt,
387
+ source: record.lastProgressSource,
388
+ updatedAt: nowIso,
389
+ });
390
+ }
391
+ }
392
+ const progressCarryVerdict = previousProgress.verdict;
393
+ let progressWriteNote = '';
394
+ if (progressUpdates.size > 0) {
395
+ const merged = mergeShadowProgress(identity.pdHome, progressUpdates);
396
+ if (!merged.ok) {
397
+ progressWriteNote = ` Additionally, the cross-run progress projection could not be updated (${merged.reason}); the status below is still truthful for this run.`;
398
+ }
399
+ }
400
+ const status = buildShadowStatus({
401
+ identity,
402
+ runId: context.runId,
403
+ startedAt: context.startedAt,
404
+ completedAt: new Date(),
405
+ activeRelease,
406
+ manifest: manifestSection(manifestRead),
407
+ discovery,
408
+ hostRoots,
409
+ bindingDiagnostics: readDiagnostics,
410
+ requested: options.workspaces,
411
+ ...(options.hostFilter !== undefined ? { hostFilter: options.hostFilter } : {}),
412
+ timeoutMs,
413
+ executions,
414
+ progressCarryVerdict,
415
+ nextAction: `${shadowNextAction(executions)}${progressWriteNote}`,
416
+ });
417
+ const statusWrite = writeServiceRunStatus(identity.pdHome, status);
418
+ return {
419
+ ok: true,
420
+ outcome: 'completed',
421
+ runId: context.runId,
422
+ identity,
423
+ activeRelease,
424
+ manifest: status.manifest,
425
+ discovery,
426
+ executions,
427
+ statusWrite,
428
+ status,
429
+ };
430
+ }
431
+ /**
432
+ * Execute one bounded shadow run. Never throws for expected refusals —
433
+ * everything expected is a structured result (rc-9).
434
+ */
435
+ export async function runServiceShadowOnce(options) {
436
+ const runId = randomUUID();
437
+ const startedAt = new Date();
438
+ const env = options.env ?? process.env;
439
+ // Explicit selection is REQUIRED — "run everything discovered" is not a
440
+ // Phase 2 mode (task §9: default-off, explicit, bounded).
441
+ const requested = options.workspaces.filter((dir) => dir.trim().length > 0);
442
+ if (requested.length === 0) {
443
+ return {
444
+ ok: false,
445
+ outcome: 'refused',
446
+ runId,
447
+ reason: 'shadow_requires_explicit_workspace',
448
+ nextAction: 'Shadow mode requires one or more explicit --workspace <dir> selections; Phase 2 never runs all discovered workspaces by default.',
449
+ };
450
+ }
451
+ // F1 review fix: shadow resolves host roots from the TRUSTED HOME only —
452
+ // inherited OPENCLAW_STATE_DIR / CODEX_HOME / WORKBUDDY_CONFIG_DIR overrides
453
+ // can never steer discovery NOR the child env pins toward an experiment or
454
+ // foreign root (TD §5.2). The dry-run keeps the shared production
455
+ // precedence; the ignored overrides are recorded in the env view.
456
+ const identityResult = resolveCoordinatorInstallIdentity(env, {
457
+ ...(options.trustedHomeDir !== undefined ? { trustedHomeDir: options.trustedHomeDir } : {}),
458
+ canonicalHostRootsOnly: true,
459
+ });
460
+ if (!identityResult.ok) {
461
+ return { ok: false, outcome: 'refused', runId, reason: identityResult.reason, nextAction: identityResult.nextAction };
462
+ }
463
+ const { identity } = identityResult;
464
+ const lock = acquireServiceRunLock(identity.pdHome, {
465
+ probes: {
466
+ ...(options.probes?.processAlive !== undefined ? { processAlive: options.probes.processAlive } : {}),
467
+ },
468
+ });
469
+ if (!lock.ok) {
470
+ if (lock.kind === 'held') {
471
+ return {
472
+ ok: true,
473
+ outcome: 'already_running',
474
+ runId,
475
+ identity,
476
+ holderBodyHash: lock.holderBodyHash,
477
+ reason: 'service_run_lock_held',
478
+ nextAction: 'Another run-once coordinator holds the install-level lock. Wait for it to finish; do not start a second instance.',
479
+ };
480
+ }
481
+ const lockPathForMessage = serviceRunLockPath(identity.pdHome);
482
+ return {
483
+ ok: false,
484
+ outcome: 'refused',
485
+ runId,
486
+ reason: lock.kind === 'corrupt'
487
+ ? `service_run_lock_corrupt:${lock.detail}`
488
+ : `service_run_lock_unwritable:${lock.detail}`,
489
+ nextAction: lock.kind === 'corrupt'
490
+ ? ['Inspect the run lock by hand at', lockPathForMessage, '— a lock this old must stay verifiable before any coordinator may run.'].join(' ')
491
+ : 'Check the permissions of the PD service directory and retry.',
492
+ };
493
+ }
494
+ const handle = lock.handle;
495
+ const releaseLock = options.probes?.releaseLock ?? releaseServiceRunLock;
496
+ const adapters = {
497
+ codex: options.probes?.adapters?.codex ?? createCodexWorkerAdapter(),
498
+ workbuddy: options.probes?.adapters?.workbuddy ?? createWorkbuddyWorkerAdapter(),
499
+ };
500
+ let result;
501
+ let runError;
502
+ let runThrew = false;
503
+ try {
504
+ result = await completeShadowRun(identity, {
505
+ runId,
506
+ startedAt,
507
+ handle,
508
+ env,
509
+ options: { ...options, workspaces: requested },
510
+ holdsLock: options.probes?.holdsLock ?? holdsServiceRunLock,
511
+ listDir: options.probes?.listDir ?? defaultListDir,
512
+ ...(options.probes?.claimReaders !== undefined ? { claimReaders: options.probes.claimReaders } : {}),
513
+ adapters,
514
+ });
515
+ }
516
+ catch (error) {
517
+ runThrew = true;
518
+ runError = error;
519
+ result = { ok: false, outcome: 'refused', runId, reason: 'internal_error', nextAction: '' };
520
+ }
521
+ const release = releaseLock(handle);
522
+ const releaseFailed = release === 'failed_busy' || release === 'failed_unwritable';
523
+ if (runThrew) {
524
+ if (releaseFailed) {
525
+ console.error(`pd service run-once (shadow): lock release also failed (${release}) after the run error`);
526
+ }
527
+ throw runError;
528
+ }
529
+ if (releaseFailed) {
530
+ if (result.outcome === 'completed') {
531
+ return {
532
+ ok: false,
533
+ outcome: 'refused',
534
+ runId,
535
+ reason: `service_run_lock_release_failed:${release === 'failed_busy' ? 'busy' : 'unwritable'}`,
536
+ nextAction: 'The shadow run finished but its run lock could not be released through the arbitration gate. ' +
537
+ 'The leftover lock carries a dead-holder PID once this process exits, so the next run recovers ' +
538
+ 'on PID evidence — inspect the service directory and the gate database before re-running.',
539
+ statusWrite: result.statusWrite,
540
+ };
541
+ }
542
+ return {
543
+ ...result,
544
+ nextAction: `${result.nextAction} (Additionally, the run lock release failed: ${release}.)`,
545
+ };
546
+ }
547
+ return result;
548
+ }
549
+ //# sourceMappingURL=shadow-run.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shadow-run.js","sourceRoot":"","sources":["../../../src/services/service-host/shadow-run.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,0BAA0B,EAAqD,MAAM,4BAA4B,CAAC;AAC3H,OAAO,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AACpE,OAAO,EACL,iCAAiC,GAElC,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,kBAAkB,EAA+D,MAAM,0BAA0B,CAAC;AAC3H,OAAO,EAAE,4BAA4B,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,EACL,mBAAmB,EACnB,eAAe,EACf,cAAc,EACd,wBAAwB,EACxB,eAAe,EACf,eAAe,EACf,YAAY,GACb,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,mBAAmB,EACnB,kBAAkB,GAGnB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,qBAAqB,EACrB,mBAAmB,EACnB,qBAAqB,EACrB,kBAAkB,GAInB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,sBAAsB,EACtB,qBAAqB,GAKtB,MAAM,gCAAgC,CAAC;AAKxC,OAAO,EAAE,iBAAiB,EAAgE,MAAM,qBAAqB,CAAC;AACtH,OAAO,EACL,eAAe,EACf,yBAAyB,EACzB,iBAAiB,GAClB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AACrE,OAAO,EAAE,4BAA4B,EAAE,MAAM,+BAA+B,CAAC;AAE7E;;;;;GAKG;AACH,MAAM,CAAC,MAAM,mCAAmC,GAAG,EAAE,GAAG,MAAM,CAAC;AAC/D,MAAM,+BAA+B,GAAG,K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