create-principles-disciple 1.154.5 → 1.155.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (428) hide show
  1. package/_release/product-identity.json +2 -2
  2. package/codex-adapter/dist/codec/input-decoder.d.ts +17 -0
  3. package/codex-adapter/dist/codec/input-decoder.js +39 -0
  4. package/codex-adapter/dist/ingestion/explicit-owner-statement.js +125 -1
  5. package/codex-adapter/dist/ingestion/pain-receipt-fallback.d.ts +46 -0
  6. package/codex-adapter/dist/ingestion/pain-receipt-fallback.js +193 -0
  7. package/codex-adapter/dist/ingestion/turn-context.d.ts +10 -15
  8. package/codex-adapter/dist/ingestion/turn-context.js +35 -9
  9. package/codex-adapter/dist/pd-hook.js +57 -1
  10. package/codex-adapter/dist/worker/workspace-worker.d.ts +15 -0
  11. package/codex-adapter/dist/worker/workspace-worker.js +91 -12
  12. package/codex-adapter/package.json +1 -1
  13. package/console/dist/server/index.js +11 -0
  14. package/console/dist/server/models/EvidenceChainConsoleModel.js +31 -0
  15. package/console/dist/server/routes/health.d.ts +1 -0
  16. package/console/dist/server/routes/health.js +12 -0
  17. package/console/dist/server/routes/service-host.d.ts +19 -0
  18. package/console/dist/server/routes/service-host.js +129 -0
  19. package/console/dist/web/assets/app.js +39 -39
  20. package/console/package.json +1 -1
  21. package/core/dist/runtime/adapter/pi-ai-http-transport.d.ts.map +1 -1
  22. package/core/dist/runtime/adapter/pi-ai-http-transport.js.map +1 -1
  23. package/core/dist/runtime/context-payload.d.ts +48 -0
  24. package/core/dist/runtime/context-payload.d.ts.map +1 -1
  25. package/core/dist/runtime/context-payload.js +12 -0
  26. package/core/dist/runtime/context-payload.js.map +1 -1
  27. package/core/dist/runtime/diagnostician/rootcause-prompt-builder.d.ts.map +1 -1
  28. package/core/dist/runtime/diagnostician/rootcause-prompt-builder.js +18 -0
  29. package/core/dist/runtime/diagnostician/rootcause-prompt-builder.js.map +1 -1
  30. package/core/dist/runtime/diagnostician-candidate.d.ts.map +1 -1
  31. package/core/dist/runtime/diagnostician-candidate.js +18 -2
  32. package/core/dist/runtime/diagnostician-candidate.js.map +1 -1
  33. package/core/dist/runtime/evidence-guards.d.ts +7 -3
  34. package/core/dist/runtime/evidence-guards.d.ts.map +1 -1
  35. package/core/dist/runtime/evidence-guards.js +9 -7
  36. package/core/dist/runtime/evidence-guards.js.map +1 -1
  37. package/core/dist/runtime/feature-flags/feature-flag-contract.d.ts.map +1 -1
  38. package/core/dist/runtime/feature-flags/feature-flag-contract.js +14 -0
  39. package/core/dist/runtime/feature-flags/feature-flag-contract.js.map +1 -1
  40. package/core/dist/runtime/feature-flags/feature-flag-lifecycle.d.ts.map +1 -1
  41. package/core/dist/runtime/feature-flags/feature-flag-lifecycle.js +8 -0
  42. package/core/dist/runtime/feature-flags/feature-flag-lifecycle.js.map +1 -1
  43. package/core/dist/runtime/host-submission-context.d.ts +83 -0
  44. package/core/dist/runtime/host-submission-context.d.ts.map +1 -0
  45. package/core/dist/runtime/host-submission-context.js +183 -0
  46. package/core/dist/runtime/host-submission-context.js.map +1 -0
  47. package/core/dist/runtime/index.d.ts +9 -2
  48. package/core/dist/runtime/index.d.ts.map +1 -1
  49. package/core/dist/runtime/index.js +29 -2
  50. package/core/dist/runtime/index.js.map +1 -1
  51. package/core/dist/runtime/intent/intent-doc.d.ts.map +1 -1
  52. package/core/dist/runtime/intent/intent-doc.js +29 -5
  53. package/core/dist/runtime/intent/intent-doc.js.map +1 -1
  54. package/core/dist/runtime/internalization/diag-distiller-runner.d.ts +9 -0
  55. package/core/dist/runtime/internalization/diag-distiller-runner.d.ts.map +1 -1
  56. package/core/dist/runtime/internalization/diag-distiller-runner.js +13 -0
  57. package/core/dist/runtime/internalization/diag-distiller-runner.js.map +1 -1
  58. package/core/dist/runtime/internalization/diag-rootcause-runner.d.ts +11 -0
  59. package/core/dist/runtime/internalization/diag-rootcause-runner.d.ts.map +1 -1
  60. package/core/dist/runtime/internalization/diag-rootcause-runner.js +10 -0
  61. package/core/dist/runtime/internalization/diag-rootcause-runner.js.map +1 -1
  62. package/core/dist/runtime/internalization/diag-router-runner.d.ts +9 -0
  63. package/core/dist/runtime/internalization/diag-router-runner.d.ts.map +1 -1
  64. package/core/dist/runtime/internalization/diag-router-runner.js +13 -0
  65. package/core/dist/runtime/internalization/diag-router-runner.js.map +1 -1
  66. package/core/dist/runtime/internalization/index.d.ts +1 -1
  67. package/core/dist/runtime/internalization/index.d.ts.map +1 -1
  68. package/core/dist/runtime/internalization/index.js +1 -1
  69. package/core/dist/runtime/internalization/index.js.map +1 -1
  70. package/core/dist/runtime/internalization/intake-to-internalization-bridge.d.ts +19 -0
  71. package/core/dist/runtime/internalization/intake-to-internalization-bridge.d.ts.map +1 -1
  72. package/core/dist/runtime/internalization/intake-to-internalization-bridge.js +24 -0
  73. package/core/dist/runtime/internalization/intake-to-internalization-bridge.js.map +1 -1
  74. package/core/dist/runtime/internalization/internalization-orchestrator.d.ts +8 -0
  75. package/core/dist/runtime/internalization/internalization-orchestrator.d.ts.map +1 -1
  76. package/core/dist/runtime/internalization/internalization-orchestrator.js +36 -4
  77. package/core/dist/runtime/internalization/internalization-orchestrator.js.map +1 -1
  78. package/core/dist/runtime/internalization/source-authorization-boundary.d.ts +39 -0
  79. package/core/dist/runtime/internalization/source-authorization-boundary.d.ts.map +1 -0
  80. package/core/dist/runtime/internalization/source-authorization-boundary.js +57 -0
  81. package/core/dist/runtime/internalization/source-authorization-boundary.js.map +1 -0
  82. package/core/dist/runtime/internalization/split-diagnostician-runner.d.ts.map +1 -1
  83. package/core/dist/runtime/internalization/split-diagnostician-runner.js +72 -5
  84. package/core/dist/runtime/internalization/split-diagnostician-runner.js.map +1 -1
  85. package/core/dist/runtime/pain-admission-disposition.d.ts +60 -0
  86. package/core/dist/runtime/pain-admission-disposition.d.ts.map +1 -0
  87. package/core/dist/runtime/pain-admission-disposition.js +37 -0
  88. package/core/dist/runtime/pain-admission-disposition.js.map +1 -0
  89. package/core/dist/runtime/pain-ingress-payload.d.ts +36 -2
  90. package/core/dist/runtime/pain-ingress-payload.d.ts.map +1 -1
  91. package/core/dist/runtime/pain-ingress-payload.js +63 -6
  92. package/core/dist/runtime/pain-ingress-payload.js.map +1 -1
  93. package/core/dist/runtime/pain-ingress.d.ts.map +1 -1
  94. package/core/dist/runtime/pain-ingress.js +28 -0
  95. package/core/dist/runtime/pain-ingress.js.map +1 -1
  96. package/core/dist/runtime/pain-recall-read-model.d.ts +13 -1
  97. package/core/dist/runtime/pain-recall-read-model.d.ts.map +1 -1
  98. package/core/dist/runtime/pain-recall-read-model.js +50 -7
  99. package/core/dist/runtime/pain-recall-read-model.js.map +1 -1
  100. package/core/dist/runtime/pain-receipt-recovery.d.ts +147 -0
  101. package/core/dist/runtime/pain-receipt-recovery.d.ts.map +1 -0
  102. package/core/dist/runtime/pain-receipt-recovery.js +475 -0
  103. package/core/dist/runtime/pain-receipt-recovery.js.map +1 -0
  104. package/core/dist/runtime/pain-signal-bridge.d.ts +13 -1
  105. package/core/dist/runtime/pain-signal-bridge.d.ts.map +1 -1
  106. package/core/dist/runtime/pain-signal-bridge.js +174 -0
  107. package/core/dist/runtime/pain-signal-bridge.js.map +1 -1
  108. package/core/dist/runtime/pain-signal-runtime-factory.d.ts +9 -0
  109. package/core/dist/runtime/pain-signal-runtime-factory.d.ts.map +1 -1
  110. package/core/dist/runtime/pain-signal-runtime-factory.js +8 -3
  111. package/core/dist/runtime/pain-signal-runtime-factory.js.map +1 -1
  112. package/core/dist/runtime/pain-submit-capability.d.ts +11 -0
  113. package/core/dist/runtime/pain-submit-capability.d.ts.map +1 -1
  114. package/core/dist/runtime/pain-submit-capability.js +77 -3
  115. package/core/dist/runtime/pain-submit-capability.js.map +1 -1
  116. package/core/dist/runtime/pain-target-evidence-reconcile.d.ts +55 -0
  117. package/core/dist/runtime/pain-target-evidence-reconcile.d.ts.map +1 -0
  118. package/core/dist/runtime/pain-target-evidence-reconcile.js +164 -0
  119. package/core/dist/runtime/pain-target-evidence-reconcile.js.map +1 -0
  120. package/core/dist/runtime/pain-to-principle-service.d.ts +8 -0
  121. package/core/dist/runtime/pain-to-principle-service.d.ts.map +1 -1
  122. package/core/dist/runtime/pain-to-principle-service.js +1 -0
  123. package/core/dist/runtime/pain-to-principle-service.js.map +1 -1
  124. package/core/dist/runtime/source-material-authorization.d.ts +166 -0
  125. package/core/dist/runtime/source-material-authorization.d.ts.map +1 -0
  126. package/core/dist/runtime/source-material-authorization.js +250 -0
  127. package/core/dist/runtime/source-material-authorization.js.map +1 -0
  128. package/core/dist/runtime/store/context/index.d.ts +1 -0
  129. package/core/dist/runtime/store/context/index.d.ts.map +1 -1
  130. package/core/dist/runtime/store/context/index.js +1 -0
  131. package/core/dist/runtime/store/context/index.js.map +1 -1
  132. package/core/dist/runtime/store/context/promoted-evidence-reader.d.ts +8 -0
  133. package/core/dist/runtime/store/context/promoted-evidence-reader.d.ts.map +1 -1
  134. package/core/dist/runtime/store/context/promoted-evidence-reader.js +15 -1
  135. package/core/dist/runtime/store/context/promoted-evidence-reader.js.map +1 -1
  136. package/core/dist/runtime/store/context/sqlite-context-assembler.d.ts +22 -0
  137. package/core/dist/runtime/store/context/sqlite-context-assembler.d.ts.map +1 -1
  138. package/core/dist/runtime/store/context/sqlite-context-assembler.js +153 -3
  139. package/core/dist/runtime/store/context/sqlite-context-assembler.js.map +1 -1
  140. package/core/dist/runtime/store/context/trajectory-turn-reader.d.ts +13 -0
  141. package/core/dist/runtime/store/context/trajectory-turn-reader.d.ts.map +1 -1
  142. package/core/dist/runtime/store/lifecycle/lease-manager.d.ts +15 -0
  143. package/core/dist/runtime/store/lifecycle/lease-manager.d.ts.map +1 -1
  144. package/core/dist/runtime/store/lifecycle/lease-manager.js +16 -1
  145. package/core/dist/runtime/store/lifecycle/lease-manager.js.map +1 -1
  146. package/core/dist/runtime/store/runtime-state-manager.d.ts +2 -0
  147. package/core/dist/runtime/store/runtime-state-manager.d.ts.map +1 -1
  148. package/core/dist/runtime/store/runtime-state-manager.js.map +1 -1
  149. package/core/dist/runtime/store/task/memory-task-store.d.ts +1 -0
  150. package/core/dist/runtime/store/task/memory-task-store.d.ts.map +1 -1
  151. package/core/dist/runtime/store/task/memory-task-store.js +37 -0
  152. package/core/dist/runtime/store/task/memory-task-store.js.map +1 -1
  153. package/core/dist/runtime/store/task/sqlite-task-store.d.ts +10 -0
  154. package/core/dist/runtime/store/task/sqlite-task-store.d.ts.map +1 -1
  155. package/core/dist/runtime/store/task/sqlite-task-store.js +20 -0
  156. package/core/dist/runtime/store/task/sqlite-task-store.js.map +1 -1
  157. package/core/dist/runtime/store/task/task-store.d.ts +16 -0
  158. package/core/dist/runtime/store/task/task-store.d.ts.map +1 -1
  159. package/core/dist/runtime/task-status.d.ts +13 -0
  160. package/core/dist/runtime/task-status.d.ts.map +1 -1
  161. package/core/dist/runtime/task-status.js +9 -0
  162. package/core/dist/runtime/task-status.js.map +1 -1
  163. package/core/dist/runtime/types/evidence-chain-contract.d.ts +10 -0
  164. package/core/dist/runtime/types/evidence-chain-contract.d.ts.map +1 -1
  165. package/core/dist/runtime/types/evidence-chain-contract.js +7 -0
  166. package/core/dist/runtime/types/evidence-chain-contract.js.map +1 -1
  167. package/core/package.json +2 -2
  168. package/dist/index.d.ts.map +1 -1
  169. package/dist/index.js +11 -0
  170. package/dist/index.js.map +1 -1
  171. package/dist/installer.d.ts.map +1 -1
  172. package/dist/installer.js +77 -30
  173. package/dist/installer.js.map +1 -1
  174. package/dist/installers/mcp-registration-conflict.d.ts +8 -0
  175. package/dist/installers/mcp-registration-conflict.d.ts.map +1 -1
  176. package/dist/installers/mcp-registration-conflict.js +34 -1
  177. package/dist/installers/mcp-registration-conflict.js.map +1 -1
  178. package/dist/installers/workbuddy-host-installer.d.ts +45 -13
  179. package/dist/installers/workbuddy-host-installer.d.ts.map +1 -1
  180. package/dist/installers/workbuddy-host-installer.js +284 -21
  181. package/dist/installers/workbuddy-host-installer.js.map +1 -1
  182. package/dist/prompts.d.ts +11 -0
  183. package/dist/prompts.d.ts.map +1 -1
  184. package/dist/prompts.js +4 -0
  185. package/dist/prompts.js.map +1 -1
  186. package/dist/service-host-bridge.d.ts +67 -0
  187. package/dist/service-host-bridge.d.ts.map +1 -0
  188. package/dist/service-host-bridge.js +292 -0
  189. package/dist/service-host-bridge.js.map +1 -0
  190. package/dist/uninstaller.d.ts.map +1 -1
  191. package/dist/uninstaller.js +26 -0
  192. package/dist/uninstaller.js.map +1 -1
  193. package/dist/update/install-layout.d.ts +0 -12
  194. package/dist/update/install-layout.d.ts.map +1 -1
  195. package/dist/update/install-layout.js +42 -15
  196. package/dist/update/install-layout.js.map +1 -1
  197. package/host-runtime/dist/diagnostician-auto-run.js +4 -1
  198. package/host-runtime/dist/governance-observation-store.d.ts +7 -0
  199. package/host-runtime/dist/governance-observation-store.js +15 -4
  200. package/host-runtime/dist/governance-signal-admission.d.ts +49 -0
  201. package/host-runtime/dist/governance-signal-admission.js +355 -94
  202. package/host-runtime/dist/governance-trajectory-turn-reader.d.ts +20 -4
  203. package/host-runtime/dist/governance-trajectory-turn-reader.js +77 -5
  204. package/host-runtime/dist/index.d.ts +2 -0
  205. package/host-runtime/dist/index.js +5 -0
  206. package/host-runtime/dist/internalization-consumer-cycle.js +4 -1
  207. package/host-runtime/dist/pd-config.d.ts +10 -0
  208. package/host-runtime/dist/pd-config.js +37 -0
  209. package/host-runtime/dist/signal-stage2-cycle.js +28 -1
  210. package/host-runtime/dist/source-material-authorization.d.ts +53 -0
  211. package/host-runtime/dist/source-material-authorization.js +67 -0
  212. package/host-runtime/dist/source-revocation-sweep.d.ts +172 -0
  213. package/host-runtime/dist/source-revocation-sweep.js +928 -0
  214. package/host-runtime/package.json +5 -1
  215. package/install-layout/dist/background-execution-transition.d.ts +258 -0
  216. package/install-layout/dist/background-execution-transition.js +836 -0
  217. package/install-layout/dist/index.d.ts +8 -0
  218. package/install-layout/dist/index.js +8 -0
  219. package/install-layout/package.json +6 -2
  220. package/package.json +7 -6
  221. package/pd-cli/dist/commands/candidate.d.ts.map +1 -1
  222. package/pd-cli/dist/commands/candidate.js +16 -5
  223. package/pd-cli/dist/commands/candidate.js.map +1 -1
  224. package/pd-cli/dist/commands/codex-setup.d.ts.map +1 -1
  225. package/pd-cli/dist/commands/codex-setup.js +17 -1
  226. package/pd-cli/dist/commands/codex-setup.js.map +1 -1
  227. package/pd-cli/dist/commands/codex-worker.d.ts.map +1 -1
  228. package/pd-cli/dist/commands/codex-worker.js +8 -4
  229. package/pd-cli/dist/commands/codex-worker.js.map +1 -1
  230. package/pd-cli/dist/commands/consent-sweep-revoked.d.ts +20 -0
  231. package/pd-cli/dist/commands/consent-sweep-revoked.d.ts.map +1 -0
  232. package/pd-cli/dist/commands/consent-sweep-revoked.js +85 -0
  233. package/pd-cli/dist/commands/consent-sweep-revoked.js.map +1 -0
  234. package/pd-cli/dist/commands/console.d.ts.map +1 -1
  235. package/pd-cli/dist/commands/console.js +9 -0
  236. package/pd-cli/dist/commands/console.js.map +1 -1
  237. package/pd-cli/dist/commands/context.d.ts.map +1 -1
  238. package/pd-cli/dist/commands/context.js +9 -1
  239. package/pd-cli/dist/commands/context.js.map +1 -1
  240. package/pd-cli/dist/commands/diagnose.d.ts.map +1 -1
  241. package/pd-cli/dist/commands/diagnose.js +12 -6
  242. package/pd-cli/dist/commands/diagnose.js.map +1 -1
  243. package/pd-cli/dist/commands/health-console.d.ts +1 -1
  244. package/pd-cli/dist/commands/health-console.d.ts.map +1 -1
  245. package/pd-cli/dist/commands/health-console.js +15 -1
  246. package/pd-cli/dist/commands/health-console.js.map +1 -1
  247. package/pd-cli/dist/commands/health.d.ts.map +1 -1
  248. package/pd-cli/dist/commands/health.js +7 -1
  249. package/pd-cli/dist/commands/health.js.map +1 -1
  250. package/pd-cli/dist/commands/openclaw-worker.d.ts +11 -0
  251. package/pd-cli/dist/commands/openclaw-worker.d.ts.map +1 -0
  252. package/pd-cli/dist/commands/openclaw-worker.js +199 -0
  253. package/pd-cli/dist/commands/openclaw-worker.js.map +1 -0
  254. package/pd-cli/dist/commands/pain-explicit.d.ts.map +1 -1
  255. package/pd-cli/dist/commands/pain-explicit.js +1 -0
  256. package/pd-cli/dist/commands/pain-explicit.js.map +1 -1
  257. package/pd-cli/dist/commands/pain-recall.d.ts +2 -2
  258. package/pd-cli/dist/commands/pain-recall.d.ts.map +1 -1
  259. package/pd-cli/dist/commands/pain-recall.js +7 -1
  260. package/pd-cli/dist/commands/pain-recall.js.map +1 -1
  261. package/pd-cli/dist/commands/pain-retry.d.ts.map +1 -1
  262. package/pd-cli/dist/commands/pain-retry.js +12 -6
  263. package/pd-cli/dist/commands/pain-retry.js.map +1 -1
  264. package/pd-cli/dist/commands/runtime-internalization-enqueue-successors.d.ts.map +1 -1
  265. package/pd-cli/dist/commands/runtime-internalization-enqueue-successors.js +2 -1
  266. package/pd-cli/dist/commands/runtime-internalization-enqueue-successors.js.map +1 -1
  267. package/pd-cli/dist/commands/runtime-internalization-run-once.d.ts +1 -0
  268. package/pd-cli/dist/commands/runtime-internalization-run-once.d.ts.map +1 -1
  269. package/pd-cli/dist/commands/runtime-internalization-run-once.js +32 -8
  270. package/pd-cli/dist/commands/runtime-internalization-run-once.js.map +1 -1
  271. package/pd-cli/dist/commands/runtime-internalization-wake-once.d.ts.map +1 -1
  272. package/pd-cli/dist/commands/runtime-internalization-wake-once.js +2 -1
  273. package/pd-cli/dist/commands/runtime-internalization-wake-once.js.map +1 -1
  274. package/pd-cli/dist/commands/service-handover.d.ts +12 -0
  275. package/pd-cli/dist/commands/service-handover.d.ts.map +1 -0
  276. package/pd-cli/dist/commands/service-handover.js +117 -0
  277. package/pd-cli/dist/commands/service-handover.js.map +1 -0
  278. package/pd-cli/dist/commands/service-lifecycle.d.ts +31 -0
  279. package/pd-cli/dist/commands/service-lifecycle.d.ts.map +1 -0
  280. package/pd-cli/dist/commands/service-lifecycle.js +207 -0
  281. package/pd-cli/dist/commands/service-lifecycle.js.map +1 -0
  282. package/pd-cli/dist/commands/service-run-once.d.ts +96 -0
  283. package/pd-cli/dist/commands/service-run-once.d.ts.map +1 -1
  284. package/pd-cli/dist/commands/service-run-once.js +432 -13
  285. package/pd-cli/dist/commands/service-run-once.js.map +1 -1
  286. package/pd-cli/dist/commands/workbuddy-setup.d.ts.map +1 -1
  287. package/pd-cli/dist/commands/workbuddy-setup.js +22 -2
  288. package/pd-cli/dist/commands/workbuddy-setup.js.map +1 -1
  289. package/pd-cli/dist/program.d.ts.map +1 -1
  290. package/pd-cli/dist/program.js +167 -9
  291. package/pd-cli/dist/program.js.map +1 -1
  292. package/pd-cli/dist/services/admission-write-gate.d.ts +3 -1
  293. package/pd-cli/dist/services/admission-write-gate.d.ts.map +1 -1
  294. package/pd-cli/dist/services/admission-write-gate.js +1 -0
  295. package/pd-cli/dist/services/admission-write-gate.js.map +1 -1
  296. package/pd-cli/dist/services/console-launcher.d.ts +93 -1
  297. package/pd-cli/dist/services/console-launcher.d.ts.map +1 -1
  298. package/pd-cli/dist/services/console-launcher.js +375 -10
  299. package/pd-cli/dist/services/console-launcher.js.map +1 -1
  300. package/pd-cli/dist/services/service-host/coordinator-common.d.ts +49 -0
  301. package/pd-cli/dist/services/service-host/coordinator-common.d.ts.map +1 -0
  302. package/pd-cli/dist/services/service-host/coordinator-common.js +158 -0
  303. package/pd-cli/dist/services/service-host/coordinator-common.js.map +1 -0
  304. package/pd-cli/dist/services/service-host/handover-claims.d.ts +14 -0
  305. package/pd-cli/dist/services/service-host/handover-claims.d.ts.map +1 -0
  306. package/pd-cli/dist/services/service-host/handover-claims.js +50 -0
  307. package/pd-cli/dist/services/service-host/handover-claims.js.map +1 -0
  308. package/pd-cli/dist/services/service-host/index.d.ts +19 -3
  309. package/pd-cli/dist/services/service-host/index.d.ts.map +1 -1
  310. package/pd-cli/dist/services/service-host/index.js +21 -3
  311. package/pd-cli/dist/services/service-host/index.js.map +1 -1
  312. package/pd-cli/dist/services/service-host/install-identity.d.ts +23 -3
  313. package/pd-cli/dist/services/service-host/install-identity.d.ts.map +1 -1
  314. package/pd-cli/dist/services/service-host/install-identity.js +15 -5
  315. package/pd-cli/dist/services/service-host/install-identity.js.map +1 -1
  316. package/pd-cli/dist/services/service-host/locking/service-run-lock.d.ts +130 -9
  317. package/pd-cli/dist/services/service-host/locking/service-run-lock.d.ts.map +1 -1
  318. package/pd-cli/dist/services/service-host/locking/service-run-lock.js +99 -19
  319. package/pd-cli/dist/services/service-host/locking/service-run-lock.js.map +1 -1
  320. package/pd-cli/dist/services/service-host/managed-run.d.ts +75 -0
  321. package/pd-cli/dist/services/service-host/managed-run.d.ts.map +1 -0
  322. package/pd-cli/dist/services/service-host/managed-run.js +550 -0
  323. package/pd-cli/dist/services/service-host/managed-run.js.map +1 -0
  324. package/pd-cli/dist/services/service-host/progress-evidence.d.ts +38 -0
  325. package/pd-cli/dist/services/service-host/progress-evidence.d.ts.map +1 -0
  326. package/pd-cli/dist/services/service-host/progress-evidence.js +155 -0
  327. package/pd-cli/dist/services/service-host/progress-evidence.js.map +1 -0
  328. package/pd-cli/dist/services/service-host/run-once.d.ts.map +1 -1
  329. package/pd-cli/dist/services/service-host/run-once.js +4 -136
  330. package/pd-cli/dist/services/service-host/run-once.js.map +1 -1
  331. package/pd-cli/dist/services/service-host/scheduler/contract.d.ts +184 -0
  332. package/pd-cli/dist/services/service-host/scheduler/contract.d.ts.map +1 -0
  333. package/pd-cli/dist/services/service-host/scheduler/contract.js +86 -0
  334. package/pd-cli/dist/services/service-host/scheduler/contract.js.map +1 -0
  335. package/pd-cli/dist/services/service-host/scheduler/index.d.ts +76 -0
  336. package/pd-cli/dist/services/service-host/scheduler/index.d.ts.map +1 -0
  337. package/pd-cli/dist/services/service-host/scheduler/index.js +128 -0
  338. package/pd-cli/dist/services/service-host/scheduler/index.js.map +1 -0
  339. package/pd-cli/dist/services/service-host/scheduler/linux.d.ts +27 -0
  340. package/pd-cli/dist/services/service-host/scheduler/linux.d.ts.map +1 -0
  341. package/pd-cli/dist/services/service-host/scheduler/linux.js +1010 -0
  342. package/pd-cli/dist/services/service-host/scheduler/linux.js.map +1 -0
  343. package/pd-cli/dist/services/service-host/scheduler/macos.d.ts +13 -0
  344. package/pd-cli/dist/services/service-host/scheduler/macos.d.ts.map +1 -0
  345. package/pd-cli/dist/services/service-host/scheduler/macos.js +819 -0
  346. package/pd-cli/dist/services/service-host/scheduler/macos.js.map +1 -0
  347. package/pd-cli/dist/services/service-host/scheduler/runtime-io.d.ts +13 -0
  348. package/pd-cli/dist/services/service-host/scheduler/runtime-io.d.ts.map +1 -0
  349. package/pd-cli/dist/services/service-host/scheduler/runtime-io.js +141 -0
  350. package/pd-cli/dist/services/service-host/scheduler/runtime-io.js.map +1 -0
  351. package/pd-cli/dist/services/service-host/scheduler/service-status.d.ts +99 -0
  352. package/pd-cli/dist/services/service-host/scheduler/service-status.d.ts.map +1 -0
  353. package/pd-cli/dist/services/service-host/scheduler/service-status.js +202 -0
  354. package/pd-cli/dist/services/service-host/scheduler/service-status.js.map +1 -0
  355. package/pd-cli/dist/services/service-host/scheduler/windows.d.ts +40 -0
  356. package/pd-cli/dist/services/service-host/scheduler/windows.d.ts.map +1 -0
  357. package/pd-cli/dist/services/service-host/scheduler/windows.js +688 -0
  358. package/pd-cli/dist/services/service-host/scheduler/windows.js.map +1 -0
  359. package/pd-cli/dist/services/service-host/shadow-progress-store.d.ts +43 -0
  360. package/pd-cli/dist/services/service-host/shadow-progress-store.d.ts.map +1 -0
  361. package/pd-cli/dist/services/service-host/shadow-progress-store.js +156 -0
  362. package/pd-cli/dist/services/service-host/shadow-progress-store.js.map +1 -0
  363. package/pd-cli/dist/services/service-host/shadow-run.d.ts +87 -0
  364. package/pd-cli/dist/services/service-host/shadow-run.d.ts.map +1 -0
  365. package/pd-cli/dist/services/service-host/shadow-run.js +549 -0
  366. package/pd-cli/dist/services/service-host/shadow-run.js.map +1 -0
  367. package/pd-cli/dist/services/service-host/status/service-run-status.d.ts +114 -4
  368. package/pd-cli/dist/services/service-host/status/service-run-status.d.ts.map +1 -1
  369. package/pd-cli/dist/services/service-host/status/service-run-status.js +37 -0
  370. package/pd-cli/dist/services/service-host/status/service-run-status.js.map +1 -1
  371. package/pd-cli/dist/services/service-host/worker-adapter-codex.d.ts +2 -0
  372. package/pd-cli/dist/services/service-host/worker-adapter-codex.d.ts.map +1 -0
  373. package/pd-cli/dist/services/service-host/worker-adapter-codex.js +76 -0
  374. package/pd-cli/dist/services/service-host/worker-adapter-codex.js.map +1 -0
  375. package/pd-cli/dist/services/service-host/worker-adapter-openclaw.d.ts +2 -0
  376. package/pd-cli/dist/services/service-host/worker-adapter-openclaw.d.ts.map +1 -0
  377. package/pd-cli/dist/services/service-host/worker-adapter-openclaw.js +49 -0
  378. package/pd-cli/dist/services/service-host/worker-adapter-openclaw.js.map +1 -0
  379. package/pd-cli/dist/services/service-host/worker-adapter-workbuddy.d.ts +2 -0
  380. package/pd-cli/dist/services/service-host/worker-adapter-workbuddy.d.ts.map +1 -0
  381. package/pd-cli/dist/services/service-host/worker-adapter-workbuddy.js +36 -0
  382. package/pd-cli/dist/services/service-host/worker-adapter-workbuddy.js.map +1 -0
  383. package/pd-cli/dist/services/service-host/worker-adapter.d.ts +187 -0
  384. package/pd-cli/dist/services/service-host/worker-adapter.d.ts.map +1 -0
  385. package/pd-cli/dist/services/service-host/worker-adapter.js +609 -0
  386. package/pd-cli/dist/services/service-host/worker-adapter.js.map +1 -0
  387. package/pd-cli/dist/services/service-host/worker-env.d.ts +84 -0
  388. package/pd-cli/dist/services/service-host/worker-env.d.ts.map +1 -0
  389. package/pd-cli/dist/services/service-host/worker-env.js +195 -0
  390. package/pd-cli/dist/services/service-host/worker-env.js.map +1 -0
  391. package/pd-cli/dist/services/service-host/worker-process.d.ts +75 -0
  392. package/pd-cli/dist/services/service-host/worker-process.d.ts.map +1 -0
  393. package/pd-cli/dist/services/service-host/worker-process.js +225 -0
  394. package/pd-cli/dist/services/service-host/worker-process.js.map +1 -0
  395. package/pd-cli/dist/services/service-host/workspace-dispatch.d.ts +61 -0
  396. package/pd-cli/dist/services/service-host/workspace-dispatch.d.ts.map +1 -0
  397. package/pd-cli/dist/services/service-host/workspace-dispatch.js +105 -0
  398. package/pd-cli/dist/services/service-host/workspace-dispatch.js.map +1 -0
  399. package/pd-cli/dist/services/service-host/workspace-handover.d.ts +190 -0
  400. package/pd-cli/dist/services/service-host/workspace-handover.d.ts.map +1 -0
  401. package/pd-cli/dist/services/service-host/workspace-handover.js +1393 -0
  402. package/pd-cli/dist/services/service-host/workspace-handover.js.map +1 -0
  403. package/pd-cli/package.json +6 -5
  404. package/pd-mcp-server/dist/submit-assembly.js +159 -42
  405. package/pd-mcp-server/dist/version.d.ts +1 -1
  406. package/pd-mcp-server/dist/version.js +1 -1
  407. package/pd-mcp-server/package.json +1 -1
  408. package/plugin/dist/bundle.js +662 -637
  409. package/plugin/dist/openclaw-worker.d.ts +92 -0
  410. package/plugin/dist/openclaw-worker.js +2446 -0
  411. package/plugin/dist/openclaw.plugin.json +1 -1
  412. package/plugin/dist/service/gateway-consumer-lease.d.ts +142 -0
  413. package/plugin/dist/service/gateway-quiesce-ack.d.ts +40 -0
  414. package/plugin/dist/service/internalization-auto-consumer-service.d.ts +68 -1
  415. package/plugin/openclaw.plugin.json +1 -1
  416. package/plugin/package.json +5 -1
  417. package/release-manager/dist/installer.js +77 -30
  418. package/release-manager/dist/installers/mcp-registration-conflict.js +34 -1
  419. package/release-manager/dist/installers/workbuddy-host-installer.js +284 -21
  420. package/release-manager/dist/service-host-bridge.js +292 -0
  421. package/release-manager/dist/update/install-layout.js +42 -15
  422. package/release-manager/package.json +5 -4
  423. package/workbuddy-adapter/dist/index.d.ts +1 -1
  424. package/workbuddy-adapter/dist/index.js +1 -1
  425. package/workbuddy-adapter/dist/worker/workspace-worker.d.ts +7 -0
  426. package/workbuddy-adapter/dist/worker/workspace-worker.js +179 -10
  427. package/workbuddy-adapter/package.json +1 -1
  428. package/workbuddy-adapter/plugin/.codebuddy-plugin/plugin.json +2 -2
@@ -0,0 +1,609 @@
1
+ /**
2
+ * Worker Adapter minimal unified contract (TD §2.3, SPEC §11 Phase 2).
3
+ *
4
+ * The Service Host knows ONLY this stable contract — it never judges Pain
5
+ * content, candidate selection or business task internals (no second
6
+ * Diagnostician/Internalization/Recovery/candidate pipeline; no second Task
7
+ * Store, Queue or Lease). Each adapter wraps ONE existing bounded Worker
8
+ * Cycle entry — `pd <host> worker --once --json --workspace <dir>` — in a
9
+ * real subprocess of the ACTIVE RELEASE CLI (never a source worktree), and
10
+ * normalizes its structured result into the contract fields:
11
+ *
12
+ * hostKind / adapterVersion / supports / executeOnce
13
+ * cycleOutcome / reason / nextAction / lastProgressAt
14
+ * health (liveness facts) / startedAt / completedAt / durationMs.
15
+ *
16
+ * Unknown or malformed Worker output fails CLOSED (rc-1..rc-4): an
17
+ * unparseable or shape-rejected result is `failed`, never a guessed
18
+ * success. `supports` judges ONLY from validated discovery evidence — a
19
+ * host binding claim or a persisted host-tool declaration — never from
20
+ * `host.*` feature flags, cwd, or environment variables (TD §5.1).
21
+ */
22
+ import * as fs from 'node:fs';
23
+ import * as path from 'node:path';
24
+ import { getInstallLayoutPaths, getPdCliEntry } from '@principles/install-layout';
25
+ import { collectWorkspaceCredentialEnvNames, loadPdConfigForPlugin } from '@principles/host-runtime';
26
+ import { buildWorkerEnvironment, LAUNCH_CONTROL_ENV_VARS } from './worker-env.js';
27
+ import { runWorkerProcess } from './worker-process.js';
28
+ import { diffTaskProgress, readTaskProgressSnapshot, } from './progress-evidence.js';
29
+ export const WORKER_ADAPTER_CONTRACT_VERSION = 'pd.worker-adapter.v1';
30
+ /**
31
+ * The Phase 2 SHADOW host set — deliberately WITHOUT openclaw (instruction
32
+ * §8.5): shadow-run drives real cycles, and OpenClaw workspaces must only be
33
+ * driven by the managed path after their §8.4 handover. Extending shadow to
34
+ * OpenClaw would let `--shadow --host openclaw` consume a legacy-owned
35
+ * workspace next to the Gateway AutoConsumer.
36
+ */
37
+ export const WORKER_HOST_KINDS = ['codex', 'workbuddy'];
38
+ /**
39
+ * The MANAGED host set (PRI-1282 Phase 4): every host whose worker the
40
+ * coordinator may drive for a `service_host_owned` workspace — OpenClaw
41
+ * joins here, where the ownership admission gate is the only entry.
42
+ */
43
+ export const MANAGED_WORKER_HOST_KINDS = ['codex', 'workbuddy', 'openclaw'];
44
+ // ── runtime guards (rc-1 / rc-2 / rc-4 / rc-5) ─────────────────────────────
45
+ function isPlainRecord(value) {
46
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
47
+ }
48
+ function readString(source, key) {
49
+ const value = source[key];
50
+ return typeof value === 'string' && value.length > 0 ? value : null;
51
+ }
52
+ function readNumber(value) {
53
+ return typeof value === 'number' && Number.isFinite(value) ? value : 0;
54
+ }
55
+ const WORKER_RESULT_MODES = new Set(['ready', 'paused', 'degraded']);
56
+ /** Same-path comparison under the workspace identity rule (win32 case-insensitive). */
57
+ function sameWorkspaceDir(a, b) {
58
+ const resolved = (value) => (process.platform === 'win32' ? path.resolve(value).toLowerCase() : path.resolve(value));
59
+ return resolved(a) === resolved(b);
60
+ }
61
+ /** Resolve the ACTIVE RELEASE CLI entry — canonical runtime first, legacy extension fallback. */
62
+ export function resolveActiveReleaseCliEntry(identity) {
63
+ const paths = getInstallLayoutPaths(identity.homeDir, {});
64
+ const canonical = getPdCliEntry(paths, 'canonical');
65
+ try {
66
+ if (fs.statSync(canonical).isFile())
67
+ return { kind: 'entry', entry: canonical, source: 'canonical' };
68
+ }
69
+ catch {
70
+ // fall through to legacy
71
+ }
72
+ const legacy = getPdCliEntry(paths, 'legacy');
73
+ try {
74
+ if (fs.statSync(legacy).isFile())
75
+ return { kind: 'entry', entry: legacy, source: 'legacy' };
76
+ }
77
+ catch {
78
+ // fall through to refusal
79
+ }
80
+ return {
81
+ kind: 'missing',
82
+ reason: 'cli_entry_missing',
83
+ nextAction: `No installed pd-cli entry exists for this install (looked for ${canonical} and ${legacy}). Repair the install with npx create-principles-disciple; the shadow cycle refused instead of running a Worker from a source worktree.`,
84
+ };
85
+ }
86
+ function livenessFacts(config, workspaceDir) {
87
+ const raw = config.readLiveness(workspaceDir);
88
+ const record = raw !== null && isPlainRecord(raw) ? raw : null;
89
+ const runningStage = record !== null ? record.runningStage : undefined;
90
+ return {
91
+ livenessFile: path.join(path.resolve(workspaceDir), '.state', config.livenessFileName),
92
+ livenessRecorded: record !== null,
93
+ lastCycleDriver: record !== null ? readString(record, 'lastCycleDriver') : null,
94
+ lastCycleCompletedAt: record !== null ? readString(record, 'lastCycleCompletedAt') : null,
95
+ lastCycleMode: record !== null ? readString(record, 'lastCycleMode') : null,
96
+ runningStage: typeof runningStage === 'string' ? runningStage : null,
97
+ lastInvocationId: record !== null ? readString(record, 'lastInvocationId') : null,
98
+ };
99
+ }
100
+ const STDERR_TAIL_PERSIST = 400;
101
+ /**
102
+ * Sanitize worker-emitted free text before it reaches the persisted status
103
+ * (F3 review fix, CWE-532): subprocess stderr and worker-reported
104
+ * reason/nextAction strings can embed absolute filesystem paths, config
105
+ * fragments or upstream error content — truncation alone removes none of
106
+ * that. Discipline (EP-08 / ERR-198): strip control characters, redact
107
+ * absolute-path-like substrings to `<path>`, and bound the remainder.
108
+ * Closed reason codes produced by OUR worker survive verbatim; only
109
+ * embedded path/whitespace noise is normalized.
110
+ */
111
+ // P2-04 (final-remediation review): path redaction must not stop at the
112
+ // FIRST segment group — a Windows path containing spaces
113
+ // (`C:\Users\Jane Doe\…`) used to leak its tail because the old pattern
114
+ // required every segment to be whitespace-free. Middle segments may
115
+ // contain spaces only when followed by another separator; the final
116
+ // segment stays whitespace-bounded so an English sentence is not eaten.
117
+ // eslint-disable-next-line no-control-regex -- control chars must not break path matching; they are stripped after redaction
118
+ const WINDOWS_DRIVE_PATH = /[A-Za-z]:[\\/](?:[^\x00-\x1F\\/:*?"<>|]+[\\/])*[^\s\x00-\x1F\\/:*?"<>|]*/g;
119
+ // eslint-disable-next-line no-control-regex -- same rationale as WINDOWS_DRIVE_PATH
120
+ const WINDOWS_UNC_PATH = /\\\\[^\s\x00-\x1F\\/:*?"<>|]+[\\/](?:[^\x00-\x1F\\/:*?"<>|]+[\\/])*[^\s\x00-\x1F\\/:*?"<>|]*/g;
121
+ // eslint-disable-next-line no-control-regex -- same rationale as WINDOWS_DRIVE_PATH
122
+ const POSIX_ABS_PATH = /\/(?:[^\s"'`\\/:*?<>|\x00-\x1F]+\/)+[^\s"'`\\/:*?<>|\x00-\x1F]*/g;
123
+ // Credential material must never reach a status file or plain log: only the
124
+ // variable NAME survives (`FOO_API_KEY=<redacted>`), the value is dropped.
125
+ const CREDENTIAL_ASSIGNMENT = /\b(?:[A-Za-z0-9_]*(?:API_?KEY|TOKEN|SECRET|PASSWORD|PASSWD|CREDENTIAL)[A-Za-z0-9_]*)\s*[=:]\s*["']?[^\s"'`,;]+/g;
126
+ const BEARER_TOKEN = /\bBearer\s+[^\s"'`,;]+/g;
127
+ const API_KEY_LIKE = /\b(?:sk|pk|ghp|gho|ghu|ghs|xox[baprs]|AIza|eyJ)[A-Za-z0-9_\-.]{7,}/g;
128
+ export function sanitizeWorkerText(value, max = STDERR_TAIL_PERSIST) {
129
+ const withoutSecrets = value
130
+ .replace(BEARER_TOKEN, 'Bearer <redacted>')
131
+ .replace(CREDENTIAL_ASSIGNMENT, '<redacted>')
132
+ .replace(API_KEY_LIKE, '<redacted>');
133
+ const withoutPaths = withoutSecrets
134
+ .replace(WINDOWS_UNC_PATH, '<path>')
135
+ .replace(WINDOWS_DRIVE_PATH, '<path>')
136
+ .replace(POSIX_ABS_PATH, '<path>');
137
+ const clean = withoutPaths.replace(/[^\x20-\x7E]+/g, ' ');
138
+ return clean.length > max ? `${clean.slice(0, max - 1)}…` : clean;
139
+ }
140
+ /** Back-compat name for the stderr-tail sanitization. */
141
+ function boundedTail(value) {
142
+ return sanitizeWorkerText(value, STDERR_TAIL_PERSIST);
143
+ }
144
+ /** Env var names that can never be re-admitted through the credential allowlist (pointer set + runtime-launch steering names, worker-env.ts — one deny-list, two checkpoints). */
145
+ const POINTER_ENV_NAMES = new Set([
146
+ 'PD_EXPERIMENT_ROOT', 'PD_WORKSPACE_DIR', 'OPENCLAW_STATE_DIR', 'OPENCLAW_HOME',
147
+ 'PD_COMPANION_WORKER_IPC', 'PD_INVOCATION_SOURCE', 'HOME', 'USERPROFILE', 'CODEX_HOME',
148
+ 'WORKBUDDY_CONFIG_DIR',
149
+ ...LAUNCH_CONTROL_ENV_VARS,
150
+ ]);
151
+ /**
152
+ * Read the credential names out of an effective config value: the shared
153
+ * host-runtime collector (PRI-1282 Phase 4 — one source for the Service
154
+ * Host allowlist and the OpenClaw worker readiness check) minus the
155
+ * pointer/launch deny-list, which is this package's environment-isolation
156
+ * domain. A future shape change degrades to an empty allowlist — the
157
+ * worker reports config problems itself — never a guess.
158
+ */
159
+ function collectCredentialEnvNames(effective) {
160
+ return collectWorkspaceCredentialEnvNames(effective)
161
+ .filter((name) => !POINTER_ENV_NAMES.has(name.toUpperCase()));
162
+ }
163
+ /**
164
+ * Extract the credential variable NAMES the workspace's effective runtime
165
+ * config actually uses (`apiKeyEnv` on each runtime profile — F4 review
166
+ * fix). Read-only: an invalid/unreadable config yields an empty list (the
167
+ * worker will report the config problem itself); a valid config yields the
168
+ * exact names `resolveProviderApiKey` will read from the child env. Names
169
+ * are defensively validated and pointer names can never be re-admitted.
170
+ */
171
+ export function readConfigCredentialEnvNames(workspaceDir) {
172
+ try {
173
+ const config = loadPdConfigForPlugin(workspaceDir);
174
+ if (!config.ok)
175
+ return [];
176
+ const { effective } = config;
177
+ return collectCredentialEnvNames(effective);
178
+ }
179
+ catch {
180
+ return [];
181
+ }
182
+ }
183
+ /**
184
+ * The shared once-CLI adapter implementation: build the allowlist env, run
185
+ * the bounded child, diff task progress, read liveness, normalize. Both
186
+ * host adapters are thin configurations of this one implementation — the
187
+ * Worker invocation protocol is shared, only evidence shapes differ.
188
+ */
189
+ export function createOnceCliWorkerAdapter(config) {
190
+ return {
191
+ hostKind: config.hostKind,
192
+ adapterVersion: WORKER_ADAPTER_CONTRACT_VERSION,
193
+ supports(descriptor) {
194
+ if (descriptor.discoveryVerdict !== 'authorized') {
195
+ return {
196
+ supported: false,
197
+ reason: `workspace_not_authorized:${descriptor.discoveryVerdict}`,
198
+ nextAction: 'Only discovery-authorized workspaces may run a shadow cycle; fix the workspace registration first.',
199
+ };
200
+ }
201
+ const byClaim = descriptor.claimingHosts.includes(config.hostKind);
202
+ const byDeclaration = descriptor.declaredHostKinds.includes(config.hostKind);
203
+ if (!byClaim && !byDeclaration) {
204
+ return {
205
+ supported: false,
206
+ reason: 'no_host_binding_evidence',
207
+ nextAction: `No validated ${config.hostKind} binding (claim or host-tool declaration) exists for this workspace; host.* feature flags are not identity evidence.`,
208
+ };
209
+ }
210
+ return { supported: true };
211
+ },
212
+ async executeOnce(input) {
213
+ const now = input.probes?.now ?? (() => new Date());
214
+ const startedDate = now();
215
+ const workspaceDir = path.resolve(input.workspaceDir);
216
+ // P1-01: the workspace deadline is MONOTONIC and covers the entire
217
+ // adapter path, not only the subprocess window.
218
+ const deadlineAtMs = input.deadlineAtMs ?? (performance.now() + input.timeoutMs);
219
+ const remainingBudgetMs = () => deadlineAtMs - performance.now();
220
+ const budgetExhaustedNextAction = 'The per-workspace timeout budget was exhausted before this step finished (entry resolution/config/snapshot/post-cycle work counts against the same budget as the Worker run); raise --timeout-ms or select hosts in separate runs.';
221
+ const adapterVersion = WORKER_ADAPTER_CONTRACT_VERSION;
222
+ const base = {
223
+ hostKind: config.hostKind,
224
+ adapterVersion,
225
+ workspaceDir,
226
+ invocationId: input.invocationId,
227
+ startedAt: startedDate.toISOString(),
228
+ };
229
+ const emptyProgress = {
230
+ taskStateChanged: false,
231
+ changedTaskCount: 0,
232
+ diagnosticianSucceeded: false,
233
+ downstreamRan: false,
234
+ postProcessingResumed: 0,
235
+ catchUpProcessed: 0,
236
+ evidenceReadable: false,
237
+ evidenceReason: 'not_attempted',
238
+ };
239
+ const finish = (outcome, extra) => {
240
+ const completedDate = now();
241
+ return {
242
+ ...base,
243
+ cycleOutcome: outcome,
244
+ ...(extra.reason !== undefined ? { reason: extra.reason } : {}),
245
+ ...(extra.nextAction !== undefined ? { nextAction: extra.nextAction } : {}),
246
+ lastProgressAt: extra.lastProgressAt ?? null,
247
+ businessProgress: extra.businessProgress ?? emptyProgress,
248
+ health: livenessFacts(config, workspaceDir),
249
+ completedAt: completedDate.toISOString(),
250
+ durationMs: Math.max(0, completedDate.getTime() - startedDate.getTime()),
251
+ worker: {
252
+ cliEntry: '',
253
+ cliEntrySource: 'canonical',
254
+ exitCode: null,
255
+ termSignal: null,
256
+ timedOut: false,
257
+ cancelled: false,
258
+ stdoutTruncated: false,
259
+ ...(extra.worker ?? {}),
260
+ environmentReport: {
261
+ stripped: [],
262
+ pinnedFromTrustedIdentity: [],
263
+ passedThrough: [],
264
+ invocationSource: 'service_host',
265
+ },
266
+ },
267
+ };
268
+ };
269
+ // ── Active-release CLI entry (never a source worktree) ──
270
+ const resolveEntry = input.probes?.resolveCliEntry ?? resolveActiveReleaseCliEntry;
271
+ const entry = resolveEntry(input.identity);
272
+ if (entry.kind === 'missing') {
273
+ return finish('unavailable', { reason: entry.reason, nextAction: entry.nextAction });
274
+ }
275
+ // ── Allowlist environment (TD §5.2) ──
276
+ const inherited = input.inheritedEnv ?? process.env;
277
+ // F4 review fix: the workspace's OWN effective runtime config names its
278
+ // credential variables (`apiKeyEnv`). Names outside the generic
279
+ // credential pattern must still reach the child, or a workspace whose
280
+ // operator exported a custom-named key would lose a working credential
281
+ // versus a direct worker run (resolveProviderApiKey reads the env var
282
+ // by that exact name before falling back to the PD credentials file).
283
+ // Names only — values ride the inherited env untouched and are never
284
+ // recorded.
285
+ const credentialEnvAllowlist = readConfigCredentialEnvNames(workspaceDir);
286
+ const { env, report: environmentReport } = buildWorkerEnvironment({
287
+ identity: input.identity,
288
+ hostKind: config.hostKind,
289
+ inheritedEnv: inherited,
290
+ credentialEnvAllowlist,
291
+ // F13 (TD §5.2): pass the invocation id explicitly to the Worker.
292
+ invocationId: input.invocationId,
293
+ });
294
+ // ── Hard deadline check BEFORE any store read or spawn (P1-01 §C /
295
+ // P1-02): entry/config/env work may have consumed the whole budget —
296
+ // no new read or Worker may start past it, and the refusal is a
297
+ // timeout, not a Worker failure. ──
298
+ if (remainingBudgetMs() <= 0) {
299
+ return finish('timeout', { reason: 'workspace_timeout_budget_exhausted', nextAction: budgetExhaustedNextAction, worker: { cliEntry: entry.entry, cliEntrySource: entry.source } });
300
+ }
301
+ // ── Pre-cycle task snapshot (progress evidence, task §6): the SQLite
302
+ // busy wait is capped by the same remaining workspace budget. ──
303
+ const readSnapshot = input.probes?.readTaskProgressSnapshot ?? readTaskProgressSnapshot;
304
+ const before = readSnapshot(workspaceDir, { busyTimeoutMs: remainingBudgetMs() });
305
+ if (remainingBudgetMs() <= 0) {
306
+ return finish('timeout', { reason: 'workspace_timeout_budget_exhausted', nextAction: budgetExhaustedNextAction, worker: { cliEntry: entry.entry, cliEntrySource: entry.source } });
307
+ }
308
+ // ── The bounded real cycle: pd <host> worker --once --json --workspace <dir> ──
309
+ const runProcess = input.probes?.spawnWorkerProcess ?? runWorkerProcess;
310
+ const proc = await runProcess({
311
+ cliEntry: entry.entry,
312
+ args: [config.hostKind, 'worker', '--once', '--json', '--workspace', workspaceDir],
313
+ env,
314
+ timeoutMs: Math.max(1, Math.floor(remainingBudgetMs())),
315
+ ...(input.signal !== undefined ? { signal: input.signal } : {}),
316
+ });
317
+ const worker = {
318
+ cliEntry: entry.entry,
319
+ cliEntrySource: entry.source,
320
+ exitCode: proc.exitCode,
321
+ termSignal: proc.termSignal,
322
+ timedOut: proc.timedOut,
323
+ cancelled: proc.cancelled,
324
+ stdoutTruncated: proc.stdoutTruncated,
325
+ ...(proc.stderrTail.length > 0 ? { stderrTail: boundedTail(proc.stderrTail) } : {}),
326
+ ...(proc.closePending === true ? { closePending: true } : {}),
327
+ environmentReport,
328
+ };
329
+ // ── Post-cycle snapshot is INSIDE the same budget (P1-02): a deadline
330
+ // crossed before OR DURING the read is a timeout — never a normal
331
+ // completion and never disguised as evidence-unavailable; the real
332
+ // worker evidence (exit/termination/stdout) still rides the record.
333
+ // The SQLite busy wait is capped by the remaining budget, which
334
+ // bounds lock contention; an uninterruptible OS-level I/O stall can
335
+ // still overrun, so the post-read deadline check is the second line
336
+ // of defence. ──
337
+ if (remainingBudgetMs() <= 0) {
338
+ return finish('timeout', { reason: 'workspace_timeout_budget_exhausted', nextAction: budgetExhaustedNextAction, worker });
339
+ }
340
+ const after = readSnapshot(workspaceDir, { busyTimeoutMs: remainingBudgetMs() });
341
+ if (remainingBudgetMs() <= 0) {
342
+ // Still a timeout — but when the read DID succeed and shows a
343
+ // persisted task-state change, that measured evidence rides the
344
+ // record. Dropping it loses the change forever: the next run's
345
+ // baseline is the post-change state, so the transition would
346
+ // never be diffed again.
347
+ if (before.ok && after.ok) {
348
+ const measured = diffTaskProgress(before.snapshot, after.snapshot);
349
+ if (measured.taskStateChanged) {
350
+ return finish('timeout', {
351
+ reason: 'workspace_timeout_budget_exhausted',
352
+ nextAction: budgetExhaustedNextAction,
353
+ worker,
354
+ lastProgressAt: measured.changedAt ?? undefined,
355
+ businessProgress: { ...emptyProgress, taskStateChanged: true, changedTaskCount: measured.changedCount, evidenceReadable: true },
356
+ });
357
+ }
358
+ }
359
+ return finish('timeout', { reason: 'workspace_timeout_budget_exhausted', nextAction: budgetExhaustedNextAction, worker });
360
+ }
361
+ let taskProgress = null;
362
+ let evidenceReason;
363
+ if (!before.ok)
364
+ evidenceReason = sanitizeWorkerText(before.reason);
365
+ else if (!after.ok)
366
+ evidenceReason = sanitizeWorkerText(after.reason);
367
+ else
368
+ taskProgress = diffTaskProgress(before.snapshot, after.snapshot);
369
+ // ── Parse + guard the worker result (fail-closed, rc-1..rc-4) ──
370
+ let parsed = null;
371
+ let parseProblem = null;
372
+ if (proc.spawnError !== undefined)
373
+ parseProblem = 'spawn';
374
+ else if (proc.timedOut)
375
+ parseProblem = 'timeout';
376
+ else if (proc.cancelled)
377
+ parseProblem = 'cancelled';
378
+ else {
379
+ try {
380
+ const raw = JSON.parse(proc.stdout);
381
+ if (!isPlainRecord(raw))
382
+ parseProblem = 'worker_result_not_object';
383
+ else
384
+ parsed = raw;
385
+ }
386
+ catch {
387
+ parseProblem = 'worker_result_unparseable';
388
+ }
389
+ }
390
+ if (parsed !== null) {
391
+ const resultWorkspace = readString(parsed, 'workspaceDir');
392
+ const mode = readString(parsed, 'mode');
393
+ if (resultWorkspace === null || !sameWorkspaceDir(resultWorkspace, workspaceDir)) {
394
+ parseProblem = `worker_result_rejected:workspace_mismatch${resultWorkspace === null ? '' : `(${sanitizeWorkerText(resultWorkspace, 120)})`}`;
395
+ parsed = null;
396
+ }
397
+ else if (mode === null || !WORKER_RESULT_MODES.has(mode)) {
398
+ parseProblem = `worker_result_rejected:unknown_mode${mode === null ? '' : `(${mode.slice(0, 40)})`}`;
399
+ parsed = null;
400
+ }
401
+ }
402
+ const completedDate = now();
403
+ const health = livenessFacts(config, workspaceDir);
404
+ const assemble = (args) => ({
405
+ ...base,
406
+ cycleOutcome: args.outcome,
407
+ ...(args.reason !== undefined ? { reason: args.reason } : {}),
408
+ ...(args.nextAction !== undefined ? { nextAction: args.nextAction } : {}),
409
+ lastProgressAt: args.lastProgressAt ?? null,
410
+ businessProgress: args.businessProgress,
411
+ health,
412
+ completedAt: completedDate.toISOString(),
413
+ durationMs: Math.max(0, completedDate.getTime() - startedDate.getTime()),
414
+ worker,
415
+ ...(args.workerMode !== undefined ? { workerMode: args.workerMode } : {}),
416
+ });
417
+ // Process-level outcomes first (never fabricate a success over a kill).
418
+ if (proc.spawnError !== undefined) {
419
+ // P2-04: spawn errors are free-form OS text (paths, config
420
+ // fragments) — sanitize before the status file like stderr.
421
+ return assemble({ outcome: 'unavailable', reason: sanitizeWorkerText(proc.spawnError), nextAction: 'The Worker child could not be started; check the active release install and Node executable.', businessProgress: emptyProgress });
422
+ }
423
+ if (proc.timedOut) {
424
+ return assemble({
425
+ outcome: 'timeout',
426
+ reason: `worker_timeout:${input.timeoutMs}ms`,
427
+ nextAction: 'The bounded deadline fired and the Worker child was terminated (SIGTERM→SIGKILL). Any held task lease recovers through the existing Lease TTL / Recovery Sweep on a later cycle; re-run the shadow cycle after investigating the hang.',
428
+ businessProgress: emptyProgress,
429
+ });
430
+ }
431
+ if (proc.cancelled) {
432
+ return assemble({
433
+ outcome: 'cancelled',
434
+ reason: 'worker_cancelled',
435
+ nextAction: 'The caller aborted the shadow execution; any held task lease recovers through the existing Lease TTL / Recovery Sweep.',
436
+ businessProgress: emptyProgress,
437
+ });
438
+ }
439
+ if (proc.termSignal !== null) {
440
+ // CodeRabbit review fix: a signal kill that is neither our deadline
441
+ // nor our cancel is an EXTERNAL termination (e.g. OOM/SIGTERM) — it
442
+ // must not be classified by whatever stdout was captured.
443
+ return assemble({
444
+ outcome: 'failed',
445
+ reason: `worker_terminated_by_signal:${proc.termSignal}`,
446
+ nextAction: 'The Worker child was terminated by a signal outside the bounded-timeout/cancel paths; investigate the external kill before re-running.',
447
+ businessProgress: { ...emptyProgress, evidenceReason: evidenceReason ?? 'not_attempted' },
448
+ });
449
+ }
450
+ if (parsed === null) {
451
+ const reason = parseProblem === 'timeout' || parseProblem === 'cancelled' || parseProblem === 'spawn'
452
+ ? 'worker_result_missing'
453
+ : (parseProblem ?? 'worker_result_unparseable');
454
+ return assemble({
455
+ outcome: 'failed',
456
+ reason: `${reason}:exit=${proc.exitCode ?? 'none'}`,
457
+ nextAction: 'The Worker output could not be validated against the adapter contract (fail-closed). Inspect the stderr tail and the workspace liveness record, then re-run.',
458
+ businessProgress: { ...emptyProgress, evidenceReason: evidenceReason ?? 'not_attempted' },
459
+ });
460
+ }
461
+ const mode = readString(parsed, 'mode') ?? 'unknown';
462
+ // F3: worker-reported free text is sanitized before persistence (paths
463
+ // redacted, control chars stripped, bounded) — the manual worker CLI
464
+ // prints the full detail; the status carries the desensitized form.
465
+ const rawReason = readString(parsed, 'reason');
466
+ const rawNextAction = readString(parsed, 'nextAction');
467
+ const workerReason = rawReason !== null ? sanitizeWorkerText(rawReason, 300) : undefined;
468
+ const workerNextAction = rawNextAction !== null ? sanitizeWorkerText(rawNextAction, 300) : undefined;
469
+ const reportEvidence = config.extractCycleEvidence(parsed);
470
+ const evidenceReadable = taskProgress !== null;
471
+ const businessProgress = {
472
+ taskStateChanged: taskProgress?.taskStateChanged ?? false,
473
+ changedTaskCount: taskProgress?.changedCount ?? 0,
474
+ ...reportEvidence,
475
+ evidenceReadable,
476
+ ...(evidenceReason !== undefined ? { evidenceReason } : {}),
477
+ };
478
+ // P2-02 (final-remediation + final-closure review): cycle OUTCOME and
479
+ // business PROGRESS are independent facts — a paused/degraded cycle
480
+ // can still record real progress, and `lastProgressAt` then carries
481
+ // the evidenced timestamp. Strict precedence:
482
+ // 1. the trusted task-diff `changedAt` (real task state change);
483
+ // 2. the worker's persisted liveness completion time — ONLY when it
484
+ // belongs to THIS invocation (`lastInvocationId` match, present
485
+ // and parseable): a stale record from an older/foreign worker can
486
+ // never smuggle a historical timestamp into this cycle;
487
+ // 3. the adapter's own `completedAt` — the SPEC-sanctioned fallback
488
+ // for corroborating report evidence without usable liveness;
489
+ // no evidence → null, never a fabricated timestamp.
490
+ const corroboratingEvidence = reportEvidence.diagnosticianSucceeded
491
+ || reportEvidence.downstreamRan
492
+ || reportEvidence.postProcessingResumed > 0
493
+ || reportEvidence.catchUpProcessed > 0;
494
+ const currentInvocationLivenessAt = health.lastInvocationId === input.invocationId
495
+ && health.lastCycleCompletedAt !== null
496
+ && Number.isFinite(Date.parse(health.lastCycleCompletedAt))
497
+ ? health.lastCycleCompletedAt
498
+ : null;
499
+ const progressAt = taskProgress?.taskStateChanged === true
500
+ ? taskProgress.changedAt
501
+ : corroboratingEvidence
502
+ ? (currentInvocationLivenessAt ?? completedDate.toISOString())
503
+ : null;
504
+ if (mode === 'paused') {
505
+ // CodeRabbit review fix: a paused cycle may still carry non-blocking
506
+ // degradations (WorkBuddy runs catch-up before the pause early-return).
507
+ // Dropping them would exit 0 over a real failure — surface them as a
508
+ // degraded outcome instead.
509
+ const degradations = Array.isArray(parsed.degradations)
510
+ ? parsed.degradations.filter((d) => typeof d === 'string' && d.length > 0).slice(0, 5)
511
+ : [];
512
+ if (degradations.length > 0) {
513
+ return assemble({
514
+ outcome: 'degraded',
515
+ reason: `paused_with_degradations:${degradations.join('|').slice(0, 160)}`,
516
+ nextAction: workerNextAction ?? 'The cycle paused AND reported non-blocking degradations; investigate the degradation before treating the pause as clean.',
517
+ lastProgressAt: progressAt,
518
+ businessProgress,
519
+ workerMode: mode,
520
+ });
521
+ }
522
+ return assemble({ outcome: 'paused', reason: workerReason ?? 'paused', nextAction: workerNextAction, lastProgressAt: progressAt, businessProgress, workerMode: mode });
523
+ }
524
+ if (mode === 'degraded') {
525
+ // F7 review fix: a degraded CYCLE and persisted business progress are
526
+ // independent facts — the worker may have completed a diagnosis
527
+ // before a later step degraded. When the trusted task diff shows a
528
+ // real state change, the evidenced timestamp is recorded here (the
529
+ // outcome stays truthfully degraded); without one, no timestamp.
530
+ return assemble({
531
+ outcome: 'degraded',
532
+ reason: workerReason ?? 'degraded',
533
+ nextAction: workerNextAction,
534
+ lastProgressAt: progressAt,
535
+ businessProgress,
536
+ workerMode: mode,
537
+ });
538
+ }
539
+ // mode === 'ready'
540
+ if (proc.exitCode !== 0 && proc.exitCode !== null) {
541
+ return assemble({
542
+ outcome: 'failed',
543
+ reason: `worker_exit_nonzero:${proc.exitCode}`,
544
+ nextAction: 'The Worker reported a non-ready result with a non-zero exit; inspect its stderr tail and the workspace state.',
545
+ businessProgress,
546
+ workerMode: mode,
547
+ });
548
+ }
549
+ if (!evidenceReadable) {
550
+ return assemble({
551
+ outcome: 'degraded',
552
+ reason: `progress_evidence_unavailable:${evidenceReason ?? 'unknown'}`,
553
+ nextAction: 'The cycle completed but the task-progress evidence could not be read from the workspace state store; the reported progress is degraded, not guessed.',
554
+ businessProgress,
555
+ workerMode: mode,
556
+ });
557
+ }
558
+ const cycleEvidence = reportEvidence.diagnosticianSucceeded
559
+ || reportEvidence.downstreamRan
560
+ || reportEvidence.postProcessingResumed > 0
561
+ || reportEvidence.catchUpProcessed > 0;
562
+ if (taskProgress !== null && (taskProgress.taskStateChanged || cycleEvidence)) {
563
+ return assemble({
564
+ outcome: 'cycle_completed',
565
+ lastProgressAt: progressAt ?? completedDate.toISOString(),
566
+ businessProgress,
567
+ workerMode: mode,
568
+ });
569
+ }
570
+ return assemble({
571
+ outcome: 'cycle_completed_without_business_progress',
572
+ businessProgress,
573
+ workerMode: mode,
574
+ });
575
+ },
576
+ };
577
+ }
578
+ /** Guarded report-evidence readers shared by the host adapter configs. */
579
+ export function readReportSection(parsed, section) {
580
+ const { report } = parsed;
581
+ if (!isPlainRecord(report))
582
+ return null;
583
+ const inner = report[section];
584
+ return isPlainRecord(inner) ? inner : null;
585
+ }
586
+ export function readReportEvidence(parsed) {
587
+ const diagnostician = readReportSection(parsed, 'diagnostician');
588
+ const downstream = readReportSection(parsed, 'downstream');
589
+ // F5 review fix: `downstream.ran` alone records an ATTEMPT (the shared
590
+ // consumer cycle started), not a persisted business outcome — only a
591
+ // succeeded run is progress evidence. Attempts that retried/failed are
592
+ // visible to the task-status diff instead.
593
+ const runStatus = downstream !== null ? downstream.runStatus : undefined;
594
+ return {
595
+ diagnosticianSucceeded: diagnostician !== null && readString(diagnostician, 'status') === 'succeeded',
596
+ downstreamRan: downstream !== null && downstream.ran === true && runStatus === 'succeeded',
597
+ };
598
+ }
599
+ /** Array-field length (e.g. postProcessing.resumedTaskIds, catchUp.rollouts) or numeric count (catchUp.ingested). */
600
+ export function readReportCount(parsed, section, key) {
601
+ const inner = readReportSection(parsed, section);
602
+ if (inner === null)
603
+ return 0;
604
+ const value = inner[key];
605
+ if (Array.isArray(value))
606
+ return value.length;
607
+ return readNumber(value);
608
+ }
609
+ //# sourceMappingURL=worker-adapter.js.map
@@ -0,0 +1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