@agimon-ai/po-runner 0.0.0-alpha.21 → 0.0.0-alpha.210

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 (332) hide show
  1. package/LICENSE +21 -149
  2. package/README.md +34 -206
  3. package/dist/apiContracts.cjs +45 -2
  4. package/dist/apiContracts.cjs.map +1 -1
  5. package/dist/apiContracts.d.mts +2 -2
  6. package/dist/apiContracts.d.mts.map +1 -1
  7. package/dist/apiContracts.mjs +45 -2
  8. package/dist/apiContracts.mjs.map +1 -1
  9. package/dist/{bashResult-BqDa7sbC.mjs → bashResult-BLCLerXE.mjs} +57 -7
  10. package/dist/bashResult-BLCLerXE.mjs.map +1 -0
  11. package/dist/{bashResult-C2iKhHpD.cjs → bashResult-CZYiyl4p.cjs} +74 -6
  12. package/dist/bashResult-CZYiyl4p.cjs.map +1 -0
  13. package/dist/{bashResult-DcrRaBLv.d.mts → bashResult-CgVS_JpL.d.mts} +8 -3
  14. package/dist/{bashResult-DcrRaBLv.d.mts.map → bashResult-CgVS_JpL.d.mts.map} +1 -1
  15. package/dist/{bashRunService-DjOH5kye.cjs → bashRunService-DmuA1mKL.cjs} +52 -31
  16. package/dist/bashRunService-DmuA1mKL.cjs.map +1 -0
  17. package/dist/{bashRunService-Ci0cGdYO.d.mts → bashRunService-Iotfc_nV.d.mts} +21 -2
  18. package/dist/bashRunService-Iotfc_nV.d.mts.map +1 -0
  19. package/dist/{bashRunService-Cl3pYccr.mjs → bashRunService-Luy2hPMS.mjs} +52 -31
  20. package/dist/bashRunService-Luy2hPMS.mjs.map +1 -0
  21. package/dist/bashRunService.cjs +1 -1
  22. package/dist/bashRunService.d.mts +4 -4
  23. package/dist/bashRunService.d.mts.map +1 -1
  24. package/dist/bashRunService.mjs +1 -1
  25. package/dist/bashSchema.cjs +1 -1
  26. package/dist/bashSchema.d.mts +1 -1
  27. package/dist/bashSchema.mjs +1 -1
  28. package/dist/bashTool-D2ECDAhc.cjs +43 -0
  29. package/dist/bashTool-D2ECDAhc.cjs.map +1 -0
  30. package/dist/{bashTool-B1EwZLo_.d.mts → bashTool-Dc1ld2E3.d.mts} +3 -9
  31. package/dist/bashTool-Dc1ld2E3.d.mts.map +1 -0
  32. package/dist/bashTool-vg8uhbkj.mjs +26 -0
  33. package/dist/bashTool-vg8uhbkj.mjs.map +1 -0
  34. package/dist/bashTool.cjs +3 -3
  35. package/dist/bashTool.cjs.map +1 -1
  36. package/dist/bashTool.d.mts +4 -4
  37. package/dist/bashTool.d.mts.map +1 -1
  38. package/dist/bashTool.mjs +3 -3
  39. package/dist/bashTool.mjs.map +1 -1
  40. package/dist/bin/cli.cjs +372 -9
  41. package/dist/bin/cli.cjs.map +1 -1
  42. package/dist/bin/cli.d.mts.map +1 -1
  43. package/dist/bin/cli.mjs +369 -8
  44. package/dist/bin/cli.mjs.map +1 -1
  45. package/dist/bin/logSink.cjs +27 -24
  46. package/dist/bin/logSink.cjs.map +1 -1
  47. package/dist/bin/logSink.mjs +24 -21
  48. package/dist/bin/logSink.mjs.map +1 -1
  49. package/dist/bin/runnerHost.cjs +141 -53
  50. package/dist/bin/runnerHost.cjs.map +1 -1
  51. package/dist/bin/runnerHost.d.mts.map +1 -1
  52. package/dist/bin/runnerHost.mjs +141 -53
  53. package/dist/bin/runnerHost.mjs.map +1 -1
  54. package/dist/cliApp-7iTUx5KZ.cjs +351 -0
  55. package/dist/cliApp-7iTUx5KZ.cjs.map +1 -0
  56. package/dist/cliApp-S4iEO-fi.mjs +338 -0
  57. package/dist/cliApp-S4iEO-fi.mjs.map +1 -0
  58. package/dist/cliApp.cjs +2 -1
  59. package/dist/cliApp.d.mts +9 -4
  60. package/dist/cliApp.d.mts.map +1 -1
  61. package/dist/cliApp.mjs +1 -1
  62. package/dist/compaction.d.mts +1 -1
  63. package/dist/extensions/mcp-ui.mjs +7 -6
  64. package/dist/extensions/mcp-ui.mjs.map +1 -1
  65. package/dist/extensions/mcp.cjs +37 -17
  66. package/dist/extensions/mcp.cjs.map +1 -1
  67. package/dist/extensions/mcp.d.mts.map +1 -1
  68. package/dist/extensions/mcp.mjs +37 -17
  69. package/dist/extensions/mcp.mjs.map +1 -1
  70. package/dist/extensions/native.mjs +1225 -374
  71. package/dist/extensions/native.mjs.map +1 -1
  72. package/dist/extensions/server.cjs +900 -221
  73. package/dist/extensions/server.cjs.map +1 -1
  74. package/dist/extensions/server.d.mts.map +1 -1
  75. package/dist/extensions/server.mjs +908 -227
  76. package/dist/extensions/server.mjs.map +1 -1
  77. package/dist/extensions/web.mjs +924 -766
  78. package/dist/extensions/web.mjs.map +1 -1
  79. package/dist/headless-CMj9hunm.cjs +237 -0
  80. package/dist/headless-CMj9hunm.cjs.map +1 -0
  81. package/dist/headless-CUJt5Ihx.mjs +226 -0
  82. package/dist/headless-CUJt5Ihx.mjs.map +1 -0
  83. package/dist/{index-DM7yJpMs.d.mts → index-7_nuKoVm.d.mts} +6 -6
  84. package/dist/index-7_nuKoVm.d.mts.map +1 -0
  85. package/dist/index-BCCF1sGD.d.mts.map +1 -1
  86. package/dist/{index-CzCF_OP9.d.mts → index-CH-z0BX3.d.mts} +11 -4
  87. package/dist/index-CH-z0BX3.d.mts.map +1 -0
  88. package/dist/{index-C-IC35d9.d.mts → index-CJNsR-Ir.d.mts} +10 -7
  89. package/dist/index-CJNsR-Ir.d.mts.map +1 -0
  90. package/dist/{index--xF7DvsE.d.mts → index-CNCb1usM.d.mts} +8 -2
  91. package/dist/index-CNCb1usM.d.mts.map +1 -0
  92. package/dist/index-EMbmq9gu.d.mts +45 -0
  93. package/dist/index-EMbmq9gu.d.mts.map +1 -0
  94. package/dist/index-QlfncPRs.d.mts +58 -0
  95. package/dist/index-QlfncPRs.d.mts.map +1 -0
  96. package/dist/index-qSi4-EJW.d.mts +49 -0
  97. package/dist/index-qSi4-EJW.d.mts.map +1 -0
  98. package/dist/index.cjs +4 -4
  99. package/dist/index.d.mts +4 -4
  100. package/dist/index.mjs +4 -4
  101. package/dist/launch.cjs +4 -0
  102. package/dist/launch.d.mts +55 -0
  103. package/dist/launch.d.mts.map +1 -0
  104. package/dist/launch.mjs +1 -0
  105. package/dist/{launcher-CCYsFBM9.mjs → launcher-3xMxw72I.mjs} +45 -31
  106. package/dist/launcher-3xMxw72I.mjs.map +1 -0
  107. package/dist/{launcher-BG5t9nvG.d.mts → launcher-CDDBTvZq.d.mts} +4 -3
  108. package/dist/launcher-CDDBTvZq.d.mts.map +1 -0
  109. package/dist/{launcher-ZgDdyXpq.cjs → launcher-D7qAhSRL.cjs} +47 -33
  110. package/dist/launcher-D7qAhSRL.cjs.map +1 -0
  111. package/dist/launcher.cjs +1 -1
  112. package/dist/launcher.d.mts +5 -5
  113. package/dist/launcher.d.mts.map +1 -1
  114. package/dist/launcher.mjs +1 -1
  115. package/dist/lifeline-26IaW5w7.d.mts +34 -0
  116. package/dist/lifeline-26IaW5w7.d.mts.map +1 -0
  117. package/dist/lifeline-B4cjtrBe.cjs +27 -0
  118. package/dist/lifeline-B4cjtrBe.cjs.map +1 -0
  119. package/dist/lifeline-C1v2ItCY.mjs +214 -0
  120. package/dist/lifeline-C1v2ItCY.mjs.map +1 -0
  121. package/dist/lifeline-D4_ZRAhO.cjs +229 -0
  122. package/dist/lifeline-D4_ZRAhO.cjs.map +1 -0
  123. package/dist/lifeline-nPh3cx5A.mjs +10 -0
  124. package/dist/lifeline-nPh3cx5A.mjs.map +1 -0
  125. package/dist/lifeline.cjs +4 -1
  126. package/dist/lifeline.d.mts +4 -21
  127. package/dist/lifeline.mjs +3 -3
  128. package/dist/logFile-B9FSwmE0.cjs +44 -0
  129. package/dist/logFile-B9FSwmE0.cjs.map +1 -0
  130. package/dist/{logFile-C7oQ_v-g.d.mts → logFile-BirfZtS1.d.mts} +4 -4
  131. package/dist/logFile-BirfZtS1.d.mts.map +1 -0
  132. package/dist/logFile-D1EOKqmL.mjs +39 -0
  133. package/dist/logFile-D1EOKqmL.mjs.map +1 -0
  134. package/dist/logFile.cjs +1 -1
  135. package/dist/logFile.d.mts +3 -3
  136. package/dist/logFile.d.mts.map +1 -1
  137. package/dist/logFile.mjs +1 -1
  138. package/dist/{logReader-mq9uVurh.mjs → logReader-BYKii_s_.mjs} +99 -52
  139. package/dist/logReader-BYKii_s_.mjs.map +1 -0
  140. package/dist/{logReader-MdW9ffvV.d.mts → logReader-Bn3WEdjg.d.mts} +4 -2
  141. package/dist/{logReader-MdW9ffvV.d.mts.map → logReader-Bn3WEdjg.d.mts.map} +1 -1
  142. package/dist/{logReader-DHCK2BEr.cjs → logReader-DpMjBqfn.cjs} +101 -54
  143. package/dist/logReader-DpMjBqfn.cjs.map +1 -0
  144. package/dist/logReader.cjs +1 -1
  145. package/dist/logReader.d.mts +2 -2
  146. package/dist/logReader.mjs +1 -1
  147. package/dist/po-runtime-identity.json +1 -0
  148. package/dist/{ptyHost-D35hNmtd.cjs → ptyHost-C-oWV455.cjs} +20 -14
  149. package/dist/ptyHost-C-oWV455.cjs.map +1 -0
  150. package/dist/{ptyHost-CwbLLr90.mjs → ptyHost-C2zu-ZfO.mjs} +19 -13
  151. package/dist/ptyHost-C2zu-ZfO.mjs.map +1 -0
  152. package/dist/{ptyHost-DWWtRrGn.d.mts → ptyHost-C_6x2xuJ.d.mts} +2 -2
  153. package/dist/{ptyHost-DWWtRrGn.d.mts.map → ptyHost-C_6x2xuJ.d.mts.map} +1 -1
  154. package/dist/ptyHost.cjs +1 -1
  155. package/dist/ptyHost.d.mts +2 -2
  156. package/dist/ptyHost.d.mts.map +1 -1
  157. package/dist/ptyHost.mjs +1 -1
  158. package/dist/{reconcile-wNYQJZF-.mjs → reconcile-DUaX_vKZ.mjs} +2 -2
  159. package/dist/reconcile-DUaX_vKZ.mjs.map +1 -0
  160. package/dist/{reconcile-5cZ11jSD.cjs → reconcile-DjF9T1hN.cjs} +2 -2
  161. package/dist/reconcile-DjF9T1hN.cjs.map +1 -0
  162. package/dist/reconcile.cjs +1 -1
  163. package/dist/reconcile.d.mts +3 -3
  164. package/dist/reconcile.mjs +1 -1
  165. package/dist/responseEnvelope.cjs +5 -2
  166. package/dist/responseEnvelope.d.mts +15 -6
  167. package/dist/responseEnvelope.d.mts.map +1 -1
  168. package/dist/responseEnvelope.mjs +3 -3
  169. package/dist/{rmuxBackend-Dh0CYVAL.cjs → rmuxBackend-9tHTx1vf.cjs} +82 -48
  170. package/dist/rmuxBackend-9tHTx1vf.cjs.map +1 -0
  171. package/dist/{rmuxBackend-rjrVTG6K.mjs → rmuxBackend-BaK-R35I.mjs} +79 -45
  172. package/dist/rmuxBackend-BaK-R35I.mjs.map +1 -0
  173. package/dist/{rmuxBackend-CaEWooWn.d.mts → rmuxBackend-xFzlANM9.d.mts} +4 -4
  174. package/dist/rmuxBackend-xFzlANM9.d.mts.map +1 -0
  175. package/dist/rmuxBackend.cjs +1 -1
  176. package/dist/rmuxBackend.d.mts +2 -2
  177. package/dist/rmuxBackend.mjs +1 -1
  178. package/dist/rolldown-runtime-8H4AJuhK.mjs +14 -0
  179. package/dist/{rolldown-runtime-VH7oDXx4.cjs → rolldown-runtime-C0BPl7ul.cjs} +15 -0
  180. package/dist/{rtkProcessor-Iw9gP5Xp.mjs → rtkProcessor-DOXcp51z.mjs} +6 -5
  181. package/dist/rtkProcessor-DOXcp51z.mjs.map +1 -0
  182. package/dist/{rtkProcessor-DSGbM-Cm.cjs → rtkProcessor-J2gLQvM4.cjs} +8 -6
  183. package/dist/rtkProcessor-J2gLQvM4.cjs.map +1 -0
  184. package/dist/rtkProcessor.cjs +1 -1
  185. package/dist/rtkProcessor.mjs +1 -1
  186. package/dist/{runnerDependencies-DSun3xO-.cjs → runnerDependencies-CABYjW7H.cjs} +97 -64
  187. package/dist/runnerDependencies-CABYjW7H.cjs.map +1 -0
  188. package/dist/{runnerDependencies-7h_cxOva.mjs → runnerDependencies-DmvIcpZi.mjs} +95 -62
  189. package/dist/runnerDependencies-DmvIcpZi.mjs.map +1 -0
  190. package/dist/runnerDependencies.cjs +1 -1
  191. package/dist/runnerDependencies.d.mts +1 -1
  192. package/dist/runnerDependencies.mjs +1 -1
  193. package/dist/runnerHost-BvNYPMeh.mjs +165 -0
  194. package/dist/runnerHost-BvNYPMeh.mjs.map +1 -0
  195. package/dist/runnerHost-C2F5oxzn.cjs +184 -0
  196. package/dist/runnerHost-C2F5oxzn.cjs.map +1 -0
  197. package/dist/runnerLaunch-BAf7hXMr.cjs +192 -0
  198. package/dist/runnerLaunch-BAf7hXMr.cjs.map +1 -0
  199. package/dist/runnerLaunch-Bimgdh4h.mjs +175 -0
  200. package/dist/runnerLaunch-Bimgdh4h.mjs.map +1 -0
  201. package/dist/runnerNamer.d.mts +1 -1
  202. package/dist/{runnerPaths-B41rMOY6.cjs → runnerPaths-CSkswyjR.cjs} +97 -179
  203. package/dist/runnerPaths-CSkswyjR.cjs.map +1 -0
  204. package/dist/{runnerPaths-Dibbvyx_.mjs → runnerPaths-D3P7_EhW.mjs} +91 -179
  205. package/dist/runnerPaths-D3P7_EhW.mjs.map +1 -0
  206. package/dist/runnerPaths.cjs +1 -1
  207. package/dist/runnerPaths.d.mts +7 -9
  208. package/dist/runnerPaths.d.mts.map +1 -1
  209. package/dist/runnerPaths.mjs +1 -1
  210. package/dist/{runnerRegistry-dQYlMSpQ.cjs → runnerRegistry-B8K1L3lq.cjs} +68 -45
  211. package/dist/runnerRegistry-B8K1L3lq.cjs.map +1 -0
  212. package/dist/{runnerRegistry-V-Ocaf4N.d.mts → runnerRegistry-BlZhS9yL.d.mts} +2 -2
  213. package/dist/{runnerRegistry-V-Ocaf4N.d.mts.map → runnerRegistry-BlZhS9yL.d.mts.map} +1 -1
  214. package/dist/{runnerRegistry-BgaR5O86.mjs → runnerRegistry-Dqca6SD3.mjs} +53 -29
  215. package/dist/runnerRegistry-Dqca6SD3.mjs.map +1 -0
  216. package/dist/runnerRegistry-NW6oAJ71.cjs +60 -0
  217. package/dist/runnerRegistry-NW6oAJ71.cjs.map +1 -0
  218. package/dist/runnerRegistry-l0C_55oO.mjs +13 -0
  219. package/dist/runnerRegistry-l0C_55oO.mjs.map +1 -0
  220. package/dist/runnerRegistry.cjs +1 -1
  221. package/dist/runnerRegistry.d.mts +2 -2
  222. package/dist/runnerRegistry.mjs +1 -1
  223. package/dist/runnerSequence-ZTYgZ_2W.cjs +32 -0
  224. package/dist/runnerSequence-ZTYgZ_2W.cjs.map +1 -0
  225. package/dist/runnerSequence-k-_Fd77y.mjs +9 -0
  226. package/dist/runnerSequence-k-_Fd77y.mjs.map +1 -0
  227. package/dist/runnerSequenceStore-CaY7S_Sd.mjs +76 -0
  228. package/dist/runnerSequenceStore-CaY7S_Sd.mjs.map +1 -0
  229. package/dist/runnerSequenceStore-Ck6M-8r_.cjs +89 -0
  230. package/dist/runnerSequenceStore-Ck6M-8r_.cjs.map +1 -0
  231. package/dist/services/lifeline/client.cjs +88 -4
  232. package/dist/services/lifeline/client.cjs.map +1 -1
  233. package/dist/services/lifeline/client.d.mts +16 -0
  234. package/dist/services/lifeline/client.d.mts.map +1 -1
  235. package/dist/services/lifeline/client.mjs +83 -2
  236. package/dist/services/lifeline/client.mjs.map +1 -1
  237. package/dist/services/runnerSupervisor/index.cjs +36 -22
  238. package/dist/services/runnerSupervisor/index.cjs.map +1 -1
  239. package/dist/services/runnerSupervisor/index.d.mts +7 -5
  240. package/dist/services/runnerSupervisor/index.d.mts.map +1 -1
  241. package/dist/services/runnerSupervisor/index.mjs +35 -21
  242. package/dist/services/runnerSupervisor/index.mjs.map +1 -1
  243. package/dist/session-CdVeSD7F.mjs +8 -0
  244. package/dist/session-CdVeSD7F.mjs.map +1 -0
  245. package/dist/session-DnUj8Q71.cjs +25 -0
  246. package/dist/session-DnUj8Q71.cjs.map +1 -0
  247. package/dist/session-ISEGK4z9.mjs +26 -0
  248. package/dist/session-ISEGK4z9.mjs.map +1 -0
  249. package/dist/session-PQd3azWf.cjs +43 -0
  250. package/dist/session-PQd3azWf.cjs.map +1 -0
  251. package/dist/session.cjs +4 -3
  252. package/dist/session.d.mts +3 -1
  253. package/dist/session.d.mts.map +1 -1
  254. package/dist/session.mjs +3 -3
  255. package/dist/{type-DwMZoINK.d.mts → type-BWY9vvSq.d.mts} +6 -4
  256. package/dist/type-BWY9vvSq.d.mts.map +1 -0
  257. package/dist/{type-Do0YxwVQ.d.mts → type-bZgYQ7hv.d.mts} +11 -11
  258. package/dist/{type-Do0YxwVQ.d.mts.map → type-bZgYQ7hv.d.mts.map} +1 -1
  259. package/dist/types.d.mts +1 -1
  260. package/llms.txt +2 -1
  261. package/locales/vi.json +169 -0
  262. package/locales/zh-CN.json +169 -0
  263. package/package.json +95 -30
  264. package/skills/po-runner/SKILL.md +32 -14
  265. package/src/prompts/codemode-how-to-runner/SKILL.md +85 -0
  266. package/src/prompts/help-how-to-runner/SKILL.md +51 -0
  267. package/dist/bashResult-BqDa7sbC.mjs.map +0 -1
  268. package/dist/bashResult-C2iKhHpD.cjs.map +0 -1
  269. package/dist/bashRunService-Ci0cGdYO.d.mts.map +0 -1
  270. package/dist/bashRunService-Cl3pYccr.mjs.map +0 -1
  271. package/dist/bashRunService-DjOH5kye.cjs.map +0 -1
  272. package/dist/bashTool-B1EwZLo_.d.mts.map +0 -1
  273. package/dist/bashTool-BvC3YOgG.mjs +0 -24
  274. package/dist/bashTool-BvC3YOgG.mjs.map +0 -1
  275. package/dist/bashTool-euL6zMDl.cjs +0 -41
  276. package/dist/bashTool-euL6zMDl.cjs.map +0 -1
  277. package/dist/cliApp-T8Fx_-1j.cjs +0 -244
  278. package/dist/cliApp-T8Fx_-1j.cjs.map +0 -1
  279. package/dist/cliApp-q97eVh4E.mjs +0 -237
  280. package/dist/cliApp-q97eVh4E.mjs.map +0 -1
  281. package/dist/headless-DOlCixyf.mjs +0 -169
  282. package/dist/headless-DOlCixyf.mjs.map +0 -1
  283. package/dist/headless-Dko_yBiy.cjs +0 -180
  284. package/dist/headless-Dko_yBiy.cjs.map +0 -1
  285. package/dist/index--xF7DvsE.d.mts.map +0 -1
  286. package/dist/index-BzeXJk6V.d.mts +0 -12
  287. package/dist/index-BzeXJk6V.d.mts.map +0 -1
  288. package/dist/index-C-IC35d9.d.mts.map +0 -1
  289. package/dist/index-CzCF_OP9.d.mts.map +0 -1
  290. package/dist/index-DM7yJpMs.d.mts.map +0 -1
  291. package/dist/launcher-BG5t9nvG.d.mts.map +0 -1
  292. package/dist/launcher-CCYsFBM9.mjs.map +0 -1
  293. package/dist/launcher-ZgDdyXpq.cjs.map +0 -1
  294. package/dist/lifeline-Bm-bHIjS.mjs +0 -88
  295. package/dist/lifeline-Bm-bHIjS.mjs.map +0 -1
  296. package/dist/lifeline-eJdZV0nN.d.mts +0 -19
  297. package/dist/lifeline-eJdZV0nN.d.mts.map +0 -1
  298. package/dist/lifeline-m7laIzIP.cjs +0 -98
  299. package/dist/lifeline-m7laIzIP.cjs.map +0 -1
  300. package/dist/lifeline.d.mts.map +0 -1
  301. package/dist/logFile-C7oQ_v-g.d.mts.map +0 -1
  302. package/dist/logFile-CnPKtxPy.cjs +0 -67
  303. package/dist/logFile-CnPKtxPy.cjs.map +0 -1
  304. package/dist/logFile-XcDHBwu1.mjs +0 -60
  305. package/dist/logFile-XcDHBwu1.mjs.map +0 -1
  306. package/dist/logReader-DHCK2BEr.cjs.map +0 -1
  307. package/dist/logReader-mq9uVurh.mjs.map +0 -1
  308. package/dist/ptyHost-CwbLLr90.mjs.map +0 -1
  309. package/dist/ptyHost-D35hNmtd.cjs.map +0 -1
  310. package/dist/reconcile-5cZ11jSD.cjs.map +0 -1
  311. package/dist/reconcile-wNYQJZF-.mjs.map +0 -1
  312. package/dist/rmuxBackend-CaEWooWn.d.mts.map +0 -1
  313. package/dist/rmuxBackend-Dh0CYVAL.cjs.map +0 -1
  314. package/dist/rmuxBackend-rjrVTG6K.mjs.map +0 -1
  315. package/dist/rtkProcessor-DSGbM-Cm.cjs.map +0 -1
  316. package/dist/rtkProcessor-Iw9gP5Xp.mjs.map +0 -1
  317. package/dist/runnerDependencies-7h_cxOva.mjs.map +0 -1
  318. package/dist/runnerDependencies-DSun3xO-.cjs.map +0 -1
  319. package/dist/runnerPaths-B41rMOY6.cjs.map +0 -1
  320. package/dist/runnerPaths-Dibbvyx_.mjs.map +0 -1
  321. package/dist/runnerRegistry-BgaR5O86.mjs.map +0 -1
  322. package/dist/runnerRegistry-dQYlMSpQ.cjs.map +0 -1
  323. package/dist/session-BKYnH4R6.mjs +0 -18
  324. package/dist/session-BKYnH4R6.mjs.map +0 -1
  325. package/dist/session-BvqzhXZY.cjs +0 -29
  326. package/dist/session-BvqzhXZY.cjs.map +0 -1
  327. package/dist/session-DE2Acesp.mjs +0 -6
  328. package/dist/session-DE2Acesp.mjs.map +0 -1
  329. package/dist/session-SfIPtdZO.cjs +0 -11
  330. package/dist/session-SfIPtdZO.cjs.map +0 -1
  331. package/dist/type-DwMZoINK.d.mts.map +0 -1
  332. package/src/prompts/po-use-runner/SKILL.md +0 -47
@@ -1,18 +1,13 @@
1
- const require_rolldown_runtime = require("./rolldown-runtime-VH7oDXx4.cjs");
2
- let node_fs = require("node:fs");
3
- node_fs = require_rolldown_runtime.__toESM(node_fs, 1);
1
+ const require_rolldown_runtime = require("./rolldown-runtime-C0BPl7ul.cjs");
2
+ const require_session = require("./session-PQd3azWf.cjs");
3
+ const require_runnerRegistry = require("./runnerRegistry-NW6oAJ71.cjs");
4
+ let node_fs_promises = require("node:fs/promises");
5
+ node_fs_promises = require_rolldown_runtime.__toESM(node_fs_promises, 1);
4
6
  let node_path = require("node:path");
5
7
  node_path = require_rolldown_runtime.__toESM(node_path, 1);
6
8
  let node_child_process = require("node:child_process");
7
9
  let node_util = require("node:util");
8
10
  let _agimon_ai_foundation_process_registry = require("@agimon-ai/foundation-process-registry");
9
- let _agimon_ai_po_core_childProcess = require("@agimon-ai/po-core/childProcess");
10
- //#region src/constants/runnerRegistry.ts
11
- const SERVICE_TYPE = "tool";
12
- const SERVICE_PREFIX = "po-runner:";
13
- const RUNNER_TAG = "po-runner";
14
- const REGISTRY_PATH_ENV = "PROCESS_REGISTRY_PATH";
15
- //#endregion
16
11
  //#region src/services/runnerRecord/index.ts
17
12
  /** The disk record's shape guard, shared by the registry and every reader of its files. */
18
13
  function isRunnerRecord(value) {
@@ -44,9 +39,13 @@ function formatRunnerStatus(count) {
44
39
  }
45
40
  //#endregion
46
41
  //#region src/services/runnerRegistry/index.ts
42
+ var runnerRegistry_exports = /* @__PURE__ */ require_rolldown_runtime.__exportAll({
43
+ RunnerRegistry: () => RunnerRegistry,
44
+ createDefaultProcessRegistry: () => createDefaultProcessRegistry
45
+ });
47
46
  /** Opens the SQLite-backed registry the rest of the monorepo already shares. */
48
47
  function createDefaultProcessRegistry(env = process.env) {
49
- return (0, _agimon_ai_foundation_process_registry.createProcessRegistryService)(env[REGISTRY_PATH_ENV]);
48
+ return (0, _agimon_ai_foundation_process_registry.createProcessRegistryService)(env[require_runnerRegistry.REGISTRY_PATH_ENV]);
50
49
  }
51
50
  function sessionTag(sessionId) {
52
51
  return `session:${sessionId}`;
@@ -92,26 +91,29 @@ var RunnerRegistry = class {
92
91
  processControl;
93
92
  registry;
94
93
  environment;
94
+ telemetry;
95
95
  subscriptions = /* @__PURE__ */ new Set();
96
- constructor(paths, processControl, registry, environment) {
96
+ recordWrites = Promise.resolve();
97
+ constructor(paths, processControl, registry, environment, telemetry) {
97
98
  this.paths = paths;
98
99
  this.processControl = processControl;
99
100
  this.registry = registry;
100
101
  this.environment = environment;
102
+ this.telemetry = telemetry;
101
103
  }
102
104
  async register(input) {
103
105
  const startedAt = (/* @__PURE__ */ new Date()).toISOString();
104
- const rootSessionId = (0, _agimon_ai_po_core_childProcess.resolveRootSessionId)(input.sessionId, this.environment);
106
+ const rootSessionId = require_session.resolveRootSessionId(input.sessionId, this.environment);
105
107
  const identity = await processStartedAt(input.pid);
106
108
  const response = await this.registry.registerProcess({
107
- repositoryPath: this.repositoryPath(),
108
- serviceName: `${SERVICE_PREFIX}${input.id}`,
109
- serviceType: SERVICE_TYPE,
109
+ repositoryPath: await this.repositoryPath(),
110
+ serviceName: `${require_runnerRegistry.SERVICE_PREFIX}${input.id}`,
111
+ serviceType: require_runnerRegistry.SERVICE_TYPE,
110
112
  pid: input.pid,
111
113
  command: input.command,
112
114
  ...identity === void 0 ? {} : { processStartedAt: identity },
113
115
  tags: (0, _agimon_ai_foundation_process_registry.resolveProcessTags)([
114
- RUNNER_TAG,
116
+ require_runnerRegistry.RUNNER_TAG,
115
117
  `runner:${input.id}`,
116
118
  sessionTag(input.sessionId)
117
119
  ]),
@@ -149,15 +151,15 @@ var RunnerRegistry = class {
149
151
  ...input.backendTarget ? { backendTarget: input.backendTarget } : {},
150
152
  hostPid: process.pid
151
153
  };
152
- this.writeRecord(record);
154
+ await this.writeRecord(record);
153
155
  this.notify(record.sessionId);
154
156
  return record;
155
157
  }
156
158
  async list() {
157
159
  return (await this.registry.listProcesses({
158
- repositoryPath: this.repositoryPath(),
159
- serviceType: SERVICE_TYPE,
160
- tags: (0, _agimon_ai_foundation_process_registry.resolveProcessTags)([RUNNER_TAG])
160
+ repositoryPath: await this.repositoryPath(),
161
+ serviceType: require_runnerRegistry.SERVICE_TYPE,
162
+ tags: (0, _agimon_ai_foundation_process_registry.resolveProcessTags)([require_runnerRegistry.RUNNER_TAG])
161
163
  })).map(toRunnerRecord);
162
164
  }
163
165
  async listBySession(sessionId) {
@@ -167,13 +169,13 @@ var RunnerRegistry = class {
167
169
  return (await this.list()).filter((record) => (record.rootSessionId ?? record.sessionId) === rootSessionId);
168
170
  }
169
171
  async listAll(sessionId) {
170
- this.paths.ensureDirectories(sessionId);
172
+ await this.paths.ensureDirectories(sessionId);
171
173
  const records = [];
172
174
  const directory = this.paths.stateDirectory(sessionId);
173
- for (const entry of node_fs.default.readdirSync(directory)) {
175
+ for (const entry of await node_fs_promises.default.readdir(directory)) {
174
176
  if (!isPrimaryMetadataEntry(entry)) continue;
175
177
  try {
176
- const parsed = JSON.parse(node_fs.default.readFileSync(`${directory}/${entry}`, "utf8"));
178
+ const parsed = JSON.parse(await node_fs_promises.default.readFile(`${directory}/${entry}`, "utf8"));
177
179
  if (isRunnerRecord(parsed)) records.push(parsed);
178
180
  } catch (error) {
179
181
  process.emitWarning(`Could not read runner metadata ${entry}: ${String(error)}`);
@@ -184,7 +186,7 @@ var RunnerRegistry = class {
184
186
  async get(id, sessionId) {
185
187
  const target = this.paths.statePathFor(id, sessionId);
186
188
  try {
187
- const parsed = JSON.parse(node_fs.default.readFileSync(target, "utf8"));
189
+ const parsed = JSON.parse(await node_fs_promises.default.readFile(target, "utf8"));
188
190
  if (!isRunnerRecord(parsed) || parsed.id !== id) {
189
191
  process.emitWarning(`Could not read runner metadata ${node_path.default.basename(target)}: invalid runner record`);
190
192
  return;
@@ -203,7 +205,7 @@ var RunnerRegistry = class {
203
205
  ...record,
204
206
  promoted: true
205
207
  };
206
- this.writeRecord(promoted);
208
+ await this.writeRecord(promoted);
207
209
  this.notify(promoted.sessionId);
208
210
  return promoted;
209
211
  }
@@ -217,7 +219,7 @@ var RunnerRegistry = class {
217
219
  ...rest,
218
220
  ...intent ? { terminationIntent: intent } : {}
219
221
  };
220
- this.writeRecord(updated);
222
+ await this.writeRecord(updated);
221
223
  return updated;
222
224
  }
223
225
  async complete(id, outcome, sessionId) {
@@ -242,16 +244,17 @@ var RunnerRegistry = class {
242
244
  finishedAt: (/* @__PURE__ */ new Date()).toISOString()
243
245
  }
244
246
  };
245
- this.writeRecord(completed);
247
+ await this.writeRecord(completed);
246
248
  await this.release(id, completed.sessionId);
249
+ await this.recordFinished(completed);
247
250
  return completed;
248
251
  }
249
252
  async release(id, sessionId) {
250
253
  const ownedSessionId = sessionId ?? (await this.list()).find((record) => record.id === id)?.sessionId ?? (await this.get(id))?.sessionId;
251
254
  const response = await this.registry.releaseProcess({
252
- repositoryPath: this.repositoryPath(),
253
- serviceName: `${SERVICE_PREFIX}${id}`,
254
- serviceType: SERVICE_TYPE,
255
+ repositoryPath: await this.repositoryPath(),
256
+ serviceName: `${require_runnerRegistry.SERVICE_PREFIX}${id}`,
257
+ serviceType: require_runnerRegistry.SERVICE_TYPE,
255
258
  kill: false,
256
259
  releasePort: false,
257
260
  force: true
@@ -291,6 +294,22 @@ var RunnerRegistry = class {
291
294
  process.emitWarning(`Runner registry listener failed: ${String(error)}`);
292
295
  }
293
296
  }
297
+ async recordFinished(record) {
298
+ const { exit } = record;
299
+ if (!this.telemetry || !exit) return;
300
+ try {
301
+ await this.telemetry.recordEvent("po_runner.process_finished", {
302
+ outcome: exit.reason,
303
+ "runner.backend": record.backend,
304
+ ...exit.code === null ? {} : { "runner.exit_code": exit.code },
305
+ ...exit.signal ? { "runner.signal": exit.signal } : {},
306
+ ...exit.terminationReason ? { "runner.termination_reason": exit.terminationReason } : {},
307
+ duration_ms: Date.parse(exit.finishedAt) - Date.parse(record.startedAt)
308
+ });
309
+ } catch (error) {
310
+ process.emitWarning(`Could not record runner telemetry: ${String(error)}`);
311
+ }
312
+ }
294
313
  removeSubscription(registration) {
295
314
  const listeners = listenersBySession.get(registration.key);
296
315
  listeners?.delete(registration.listener);
@@ -300,15 +319,19 @@ var RunnerRegistry = class {
300
319
  subscriptionKey(sessionId) {
301
320
  return JSON.stringify([node_path.default.resolve(this.paths.stateDirectory(sessionId)), sessionId]);
302
321
  }
303
- repositoryPath() {
304
- return (0, _agimon_ai_foundation_process_registry.normalizeRepositoryPath)(this.paths.repositoryPath());
322
+ async repositoryPath() {
323
+ return (0, _agimon_ai_foundation_process_registry.normalizeRepositoryPath)(await this.paths.repositoryPath());
305
324
  }
306
325
  writeRecord(record) {
307
- this.paths.ensureDirectories(record.sessionId);
308
- const target = this.paths.statePathFor(record.id, record.sessionId);
309
- const temporary = `${target}.${process.pid}.tmp`;
310
- node_fs.default.writeFileSync(temporary, `${JSON.stringify(record, null, 2)}\n`, "utf8");
311
- node_fs.default.renameSync(temporary, target);
326
+ const write = this.recordWrites.then(async () => {
327
+ await this.paths.ensureDirectories(record.sessionId);
328
+ const target = this.paths.statePathFor(record.id, record.sessionId);
329
+ const temporary = `${target}.${process.pid}.tmp`;
330
+ await node_fs_promises.default.writeFile(temporary, `${JSON.stringify(record, null, 2)}\n`, "utf8");
331
+ await node_fs_promises.default.rename(temporary, target);
332
+ });
333
+ this.recordWrites = write.catch(() => void 0);
334
+ return write;
312
335
  }
313
336
  };
314
337
  /** Every field is read back from metadata this class wrote on registration. */
@@ -338,12 +361,6 @@ function isPrimaryMetadataEntry(entry) {
338
361
  return entry.endsWith(".json") && !entry.endsWith(".command.json") && !entry.endsWith(".exit.json");
339
362
  }
340
363
  //#endregion
341
- Object.defineProperty(exports, "REGISTRY_PATH_ENV", {
342
- enumerable: true,
343
- get: function() {
344
- return REGISTRY_PATH_ENV;
345
- }
346
- });
347
364
  Object.defineProperty(exports, "RunnerRegistry", {
348
365
  enumerable: true,
349
366
  get: function() {
@@ -380,5 +397,11 @@ Object.defineProperty(exports, "isRunnerRecord", {
380
397
  return isRunnerRecord;
381
398
  }
382
399
  });
400
+ Object.defineProperty(exports, "runnerRegistry_exports", {
401
+ enumerable: true,
402
+ get: function() {
403
+ return runnerRegistry_exports;
404
+ }
405
+ });
383
406
 
384
- //# sourceMappingURL=runnerRegistry-dQYlMSpQ.cjs.map
407
+ //# sourceMappingURL=runnerRegistry-B8K1L3lq.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runnerRegistry-B8K1L3lq.cjs","names":["createProcessRegistryService","REGISTRY_PATH_ENV","promisify","execFile","resolveRootSessionId","SERVICE_PREFIX","SERVICE_TYPE","resolveProcessTags","RUNNER_TAG","fs","path","normalizeRepositoryPath"],"sources":["../src/services/runnerRecord/index.ts","../src/services/runnerRegistry/index.ts"],"sourcesContent":["import type { RunnerRecord } from '../../types/runnerRegistry';\n\n/** The disk record's shape guard, shared by the registry and every reader of its files. */\nexport function isRunnerRecord(value: unknown): value is RunnerRecord {\n if (typeof value !== 'object' || value === null) return false;\n const record = value as Partial<RunnerRecord>;\n return (\n typeof record.id === 'string' &&\n typeof record.name === 'string' &&\n typeof record.pid === 'number' &&\n typeof record.command === 'string' &&\n typeof record.cwd === 'string' &&\n typeof record.logPath === 'string' &&\n typeof record.sessionId === 'string' &&\n typeof record.startedAt === 'string' &&\n (record.state === 'running' || record.state === 'completed') &&\n typeof record.promoted === 'boolean' &&\n (record.backend === 'rmux' || record.backend === 'tmux' || record.backend === 'native')\n );\n}\n\n/** What the agent reads when a runner it sent to the background exits. Shared by the Pi and server hosts. */\nexport function formatRunnerFinished(record: RunnerRecord): string {\n const outcome = record.exit?.reason ?? record.state;\n const code = record.exit?.code === null || record.exit?.code === undefined ? '' : `, exit code ${record.exit.code}`;\n return [\n `Background runner ${record.name} exited: ${outcome}${code}.`,\n `Runner ID: ${record.id}`,\n `Log: ${record.logPath}`,\n `Inspect: po-runner logs ${record.id}`,\n ].join('\\n');\n}\n\n/** The one line the person sees in the transcript for the same exit. */\nexport function formatRunnerFinishedNotice(record: RunnerRecord): string {\n const reason = record.exit?.reason ?? record.state;\n const code = record.exit?.code === null || record.exit?.code === undefined ? '' : `exit ${record.exit.code}`;\n const outcome = reason === 'completed' ? code : [reason, code].filter(Boolean).join(', ');\n return `Background runner ${record.name} finished${outcome ? ` · ${outcome}` : ''}`;\n}\n/** Compact footer text. An absent value removes the group entirely. */\nexport function formatRunnerStatus(count: number): string | undefined {\n return count > 0 ? `Runners ${count} ●` : undefined;\n}\n\nexport function formatRunnerFooterContribution(count: number): { fullText: string; compactText: string } | undefined {\n return count > 0 ? { fullText: `Runner ${count}`, compactText: `R${count}` } : undefined;\n}\n","import { execFile } from 'node:child_process';\nimport fs from 'node:fs/promises';\nimport path from 'node:path';\nimport { promisify } from 'node:util';\n\nimport {\n createProcessRegistryService,\n normalizeRepositoryPath,\n type ProcessRegistryRecord,\n type ProcessRegistryService,\n resolveProcessTags,\n} from '@agimon-ai/foundation-process-registry';\nimport type { PoTelemetry } from '@agimon-ai/po-core/telemetry';\n\nimport {\n COMMAND_SIDECAR_SUFFIX,\n EXIT_SIDECAR_SUFFIX,\n JSON_EXTENSION,\n NOT_FOUND_ERROR_CODE,\n REGISTRY_PATH_ENV,\n RUNNER_TAG,\n SERVICE_PREFIX,\n SERVICE_TYPE,\n} from '../../constants/runnerRegistry';\nimport type { IProcessControl } from '../../types/processControl';\nimport type {\n CompleteRunnerInput,\n IRunnerRegistry,\n RegisterRunnerInput,\n RunnerRecord,\n RunnerTerminationIntent,\n} from '../../types/runnerRegistry';\nimport type { IRunnerPaths } from '../runnerPaths/type';\nimport { isRunnerRecord } from '../runnerRecord';\nimport { resolveRootSessionId } from '../session';\n\n/** The slice of the shared registry service this wrapper depends on. */\nexport type ProcessRegistryPort = Pick<\n ProcessRegistryService,\n 'registerProcess' | 'releaseProcess' | 'listProcesses' | 'close'\n>;\n\n/** Opens the SQLite-backed registry the rest of the monorepo already shares. */\nexport function createDefaultProcessRegistry(\n env: Readonly<Record<string, string | undefined>> = process.env,\n): ProcessRegistryPort {\n return createProcessRegistryService(env[REGISTRY_PATH_ENV]);\n}\n\nfunction sessionTag(sessionId: string): string {\n return `session:${sessionId}`;\n}\n\nfunction readString(record: ProcessRegistryRecord, key: string): string {\n const value = record.metadata?.[key];\n return typeof value === 'string' ? value : '';\n}\n\nfunction readNumber(record: ProcessRegistryRecord, key: string): number {\n const value = record.metadata?.[key];\n return typeof value === 'number' ? value : 0;\n}\n\nconst runCommand = promisify(execFile);\n\n/**\n * The process start time the registry stores to prove a pid is still the\n * process it registered.\n *\n * The registry resolves it itself when the caller omits it, and it does so with\n * `execFileSync`, which stops this process for the length of a `ps` on every\n * runner that starts. Reading it here costs the same subprocess and blocks\n * nothing: the command is already running by the time a runner is registered.\n *\n * The value has to match what the registry would have read, so the command and\n * the trimming are deliberately identical to its own.\n */\nasync function processStartedAt(pid: number): Promise<string | undefined> {\n if (process.platform === 'win32') return undefined;\n try {\n const { stdout } = await runCommand('ps', ['-o', 'lstart=', '-p', String(pid)], { encoding: 'utf8' });\n return stdout.trim() || undefined;\n } catch {\n return undefined;\n }\n}\n\ntype ListenerRegistration = Readonly<{ key: string; listener: () => void }>;\n\n// Server plugin replacement can leave an in-flight tool and its publisher on different registry instances.\nconst listenersBySession = new Map<string, Set<() => void>>();\n\nexport class RunnerRegistry implements IRunnerRegistry {\n private readonly subscriptions = new Set<ListenerRegistration>();\n private recordWrites: Promise<void> = Promise.resolve();\n\n constructor(\n private readonly paths: IRunnerPaths,\n private readonly processControl: IProcessControl,\n private readonly registry: ProcessRegistryPort,\n private readonly environment: Readonly<Record<string, string | undefined>>,\n /** Records each runner once, here where it completes, instead of in every command's host process. */\n private readonly telemetry?: Pick<PoTelemetry, 'recordEvent'>,\n ) {}\n\n async register(input: RegisterRunnerInput): Promise<RunnerRecord> {\n const startedAt = new Date().toISOString();\n const rootSessionId = resolveRootSessionId(input.sessionId, this.environment);\n const identity = await processStartedAt(input.pid);\n const response = await this.registry.registerProcess({\n repositoryPath: await this.repositoryPath(),\n serviceName: `${SERVICE_PREFIX}${input.id}`,\n serviceType: SERVICE_TYPE,\n pid: input.pid,\n command: input.command,\n ...(identity === undefined ? {} : { processStartedAt: identity }),\n tags: resolveProcessTags([RUNNER_TAG, `runner:${input.id}`, sessionTag(input.sessionId)]),\n metadata: {\n id: input.id,\n name: input.name,\n command: input.command,\n cwd: input.cwd,\n logPath: input.logPath,\n interactive: input.interactive,\n sessionId: input.sessionId,\n rootSessionId,\n backend: input.backend,\n ...(input.backendTarget ? { backendTarget: input.backendTarget } : {}),\n startedAt,\n hostPid: process.pid,\n },\n // The caller has already resolved name collisions against live records,\n // so anything still holding this name is stale.\n force: true,\n });\n if (!response.success) throw new Error(response.error ?? `Failed to register runner ${input.name}`);\n const record: RunnerRecord = {\n id: input.id,\n name: input.name,\n pid: input.pid,\n command: input.command,\n cwd: input.cwd,\n logPath: input.logPath,\n interactive: input.interactive,\n sessionId: input.sessionId,\n rootSessionId,\n startedAt,\n state: 'running',\n promoted: false,\n backend: input.backend,\n ...(input.backendTarget ? { backendTarget: input.backendTarget } : {}),\n hostPid: process.pid,\n };\n await this.writeRecord(record);\n this.notify(record.sessionId);\n return record;\n }\n\n async list(): Promise<RunnerRecord[]> {\n const records = await this.registry.listProcesses({\n repositoryPath: await this.repositoryPath(),\n serviceType: SERVICE_TYPE,\n tags: resolveProcessTags([RUNNER_TAG]),\n });\n return records.map(toRunnerRecord);\n }\n\n async listBySession(sessionId: string): Promise<RunnerRecord[]> {\n const records = await this.list();\n return records.filter((record) => record.sessionId === sessionId);\n }\n\n async listByRootSession(rootSessionId: string): Promise<RunnerRecord[]> {\n const records = await this.list();\n return records.filter((record) => (record.rootSessionId ?? record.sessionId) === rootSessionId);\n }\n\n async listAll(sessionId?: string): Promise<RunnerRecord[]> {\n await this.paths.ensureDirectories(sessionId);\n const records: RunnerRecord[] = [];\n const directory = this.paths.stateDirectory(sessionId);\n for (const entry of await fs.readdir(directory)) {\n if (!isPrimaryMetadataEntry(entry)) continue;\n try {\n const parsed: unknown = JSON.parse(await fs.readFile(`${directory}/${entry}`, 'utf8'));\n if (isRunnerRecord(parsed)) records.push(parsed);\n } catch (error) {\n process.emitWarning(`Could not read runner metadata ${entry}: ${String(error)}`);\n }\n }\n return records.sort((left, right) => right.startedAt.localeCompare(left.startedAt));\n }\n\n async get(id: string, sessionId?: string): Promise<RunnerRecord | undefined> {\n const target = this.paths.statePathFor(id, sessionId);\n try {\n const parsed: unknown = JSON.parse(await fs.readFile(target, 'utf8'));\n if (!isRunnerRecord(parsed) || parsed.id !== id) {\n process.emitWarning(`Could not read runner metadata ${path.basename(target)}: invalid runner record`);\n return undefined;\n }\n return parsed;\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code === NOT_FOUND_ERROR_CODE) return undefined;\n process.emitWarning(`Could not read runner metadata ${path.basename(target)}: ${String(error)}`);\n return undefined;\n }\n }\n\n async markPromoted(id: string): Promise<RunnerRecord | undefined> {\n const record = await this.get(id);\n if (!record) return undefined;\n const promoted = { ...record, promoted: true };\n await this.writeRecord(promoted);\n this.notify(promoted.sessionId);\n return promoted;\n }\n\n async requestTermination(\n id: string,\n intent: RunnerTerminationIntent | undefined,\n sessionId?: string,\n ): Promise<RunnerRecord | undefined> {\n const record = await this.get(id, sessionId);\n if (!record) return undefined;\n if (record.state === 'completed') return record;\n if (intent !== undefined && record.terminationIntent !== undefined) return record;\n const { terminationIntent: _previous, ...rest } = record;\n const updated: RunnerRecord = { ...rest, ...(intent ? { terminationIntent: intent } : {}) };\n await this.writeRecord(updated);\n return updated;\n }\n\n async complete(id: string, outcome: CompleteRunnerInput, sessionId?: string): Promise<RunnerRecord | undefined> {\n const persisted = await this.get(id, sessionId);\n if (persisted?.state === 'completed') {\n await this.release(id, persisted.sessionId);\n return persisted;\n }\n const active = await this.list();\n const record =\n persisted ??\n active.find((candidate) => candidate.id === id && (sessionId === undefined || candidate.sessionId === sessionId));\n if (!record) {\n const belongsToAnotherSession =\n sessionId !== undefined && active.some((candidate) => candidate.id === id && candidate.sessionId !== sessionId);\n if (!belongsToAnotherSession) await this.release(id, sessionId);\n return undefined;\n }\n const completed: RunnerRecord = {\n ...record,\n state: 'completed',\n exit: {\n ...outcome,\n ...(outcome.signal !== null && outcome.terminationReason === undefined && record.terminationIntent === undefined\n ? { terminationReason: 'external_signal' as const }\n : {}),\n ...record.terminationIntent,\n finishedAt: new Date().toISOString(),\n },\n };\n await this.writeRecord(completed);\n await this.release(id, completed.sessionId);\n await this.recordFinished(completed);\n return completed;\n }\n\n async release(id: string, sessionId?: string): Promise<void> {\n const activeSessionId = sessionId ?? (await this.list()).find((record) => record.id === id)?.sessionId;\n const ownedSessionId = activeSessionId ?? (await this.get(id))?.sessionId;\n const response = await this.registry.releaseProcess({\n repositoryPath: await this.repositoryPath(),\n serviceName: `${SERVICE_PREFIX}${id}`,\n serviceType: SERVICE_TYPE,\n kill: false,\n releasePort: false,\n force: true,\n });\n if (!response.success && !response.error?.includes('No matching process entry')) {\n throw new Error(response.error ?? `Failed to release runner ${id}`);\n }\n if (ownedSessionId !== undefined) this.notify(ownedSessionId);\n }\n\n async pruneDead(): Promise<string[]> {\n const dead = (await this.list()).filter((record) => !this.processControl.isAlive(record.pid));\n for (const record of dead) {\n await this.complete(record.id, { reason: 'backend_lost', code: null, signal: null }, record.sessionId);\n }\n return dead.map((record) => record.id);\n }\n\n subscribe(listener: () => void, sessionId: string): () => void {\n const subscribed = (): void => listener();\n const registration = { key: this.subscriptionKey(sessionId), listener: subscribed };\n const listeners = listenersBySession.get(registration.key) ?? new Set<() => void>();\n listeners.add(subscribed);\n listenersBySession.set(registration.key, listeners);\n this.subscriptions.add(registration);\n return () => this.removeSubscription(registration);\n }\n\n close(): void {\n for (const registration of this.subscriptions) this.removeSubscription(registration);\n this.registry.close();\n }\n\n private notify(sessionId: string): void {\n for (const listener of listenersBySession.get(this.subscriptionKey(sessionId)) ?? []) {\n try {\n listener();\n } catch (error) {\n process.emitWarning(`Runner registry listener failed: ${String(error)}`);\n }\n }\n }\n\n private async recordFinished(record: RunnerRecord): Promise<void> {\n const { exit } = record;\n if (!this.telemetry || !exit) return;\n try {\n await this.telemetry.recordEvent('po_runner.process_finished', {\n outcome: exit.reason,\n 'runner.backend': record.backend,\n ...(exit.code === null ? {} : { 'runner.exit_code': exit.code }),\n ...(exit.signal ? { 'runner.signal': exit.signal } : {}),\n ...(exit.terminationReason ? { 'runner.termination_reason': exit.terminationReason } : {}),\n duration_ms: Date.parse(exit.finishedAt) - Date.parse(record.startedAt),\n });\n } catch (error) {\n process.emitWarning(`Could not record runner telemetry: ${String(error)}`);\n }\n }\n\n private removeSubscription(registration: ListenerRegistration): void {\n const listeners = listenersBySession.get(registration.key);\n listeners?.delete(registration.listener);\n if (listeners?.size === 0) listenersBySession.delete(registration.key);\n this.subscriptions.delete(registration);\n }\n\n private subscriptionKey(sessionId: string): string {\n return JSON.stringify([path.resolve(this.paths.stateDirectory(sessionId)), sessionId]);\n }\n\n private async repositoryPath(): Promise<string> {\n return normalizeRepositoryPath(await this.paths.repositoryPath());\n }\n\n private writeRecord(record: RunnerRecord): Promise<void> {\n const write = this.recordWrites.then(async () => {\n await this.paths.ensureDirectories(record.sessionId);\n const target = this.paths.statePathFor(record.id, record.sessionId);\n const temporary = `${target}.${process.pid}.tmp`;\n await fs.writeFile(temporary, `${JSON.stringify(record, null, 2)}\\n`, 'utf8');\n await fs.rename(temporary, target);\n });\n // Keep later writes ordered even after a failed write, which its caller observes.\n this.recordWrites = write.catch(() => undefined);\n return write;\n }\n}\n\n/** Every field is read back from metadata this class wrote on registration. */\nfunction toRunnerRecord(record: ProcessRegistryRecord): RunnerRecord {\n return {\n id: readString(record, 'id'),\n name: readString(record, 'name'),\n pid: record.pid,\n command: readString(record, 'command'),\n cwd: readString(record, 'cwd'),\n logPath: readString(record, 'logPath'),\n interactive: record.metadata?.interactive === true,\n sessionId: readString(record, 'sessionId'),\n ...(readString(record, 'rootSessionId') ? { rootSessionId: readString(record, 'rootSessionId') } : {}),\n startedAt: readString(record, 'startedAt'),\n state: 'running',\n promoted: false,\n backend: readBackend(record.metadata?.backend),\n ...(readString(record, 'backendTarget') ? { backendTarget: readString(record, 'backendTarget') } : {}),\n hostPid: readNumber(record, 'hostPid'),\n };\n}\n\nfunction readBackend(value: unknown): RunnerRecord['backend'] {\n return value === 'rmux' || value === 'tmux' ? value : 'native';\n}\n\nfunction isPrimaryMetadataEntry(entry: string): boolean {\n return (\n entry.endsWith(JSON_EXTENSION) && !entry.endsWith(COMMAND_SIDECAR_SUFFIX) && !entry.endsWith(EXIT_SIDECAR_SUFFIX)\n );\n}\n"],"mappings":";;;;;;;;;;;;AAGA,SAAgB,eAAe,OAAuC;CACpE,IAAI,OAAO,UAAU,YAAY,UAAU,MAAM,OAAO;CACxD,MAAM,SAAS;CACf,OACE,OAAO,OAAO,OAAO,YACrB,OAAO,OAAO,SAAS,YACvB,OAAO,OAAO,QAAQ,YACtB,OAAO,OAAO,YAAY,YAC1B,OAAO,OAAO,QAAQ,YACtB,OAAO,OAAO,YAAY,YAC1B,OAAO,OAAO,cAAc,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as n, RegisterRunnerInput as r, CompleteRunnerInput as t };
86
- //# sourceMappingURL=runnerRegistry-V-Ocaf4N.d.mts.map
85
+ export { RunnerRecord as a, RunnerExit as i, IRunnerRegistry as n, RunnerTerminationIntent as o, RegisterRunnerInput as r, CompleteRunnerInput as t };
86
+ //# sourceMappingURL=runnerRegistry-BlZhS9yL.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"runnerRegistry-V-Ocaf4N.d.mts","names":[],"sources":["../src/types/runnerRegistry.ts"],"mappings":";KAAY;KACA;KACA;KASA;KAOA;EACV;EACA,mBAAmB,QAAQ;EAC3B;;UAGe;EACf,QAAQ;EACR;EACA,QAAQ,OAAO;EACf,oBAAoB;EACpB;EACA;;;UAIe;EACf;EACA;;EAEA;EACA;EACA;EACA;EACA;EACA;;EAEA;EACA;EACA,OAAO;EACP;EACA,SAAS;EACT;EACA,OAAO;;EAEP,oBAAoB;;EAEpB;;UAGe;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,SAAS;EACT;;UAGe;EACf,QAAQ;EACR;EACA,QAAQ,OAAO;EACf,oBAAoB;EACpB;;;UAIe;EACf,SAAS,OAAO,sBAAsB,QAAQ;EAC9C,QAAQ,QAAQ;;EAEhB,cAAc,oBAAoB,QAAQ;;EAE1C,kBAAkB,wBAAwB,QAAQ;;EAElD,QAAQ,qBAAqB,QAAQ;EACrC,IAAI,YAAY,qBAAqB,QAAQ;EAC7C,aAAa,aAAa,QAAQ;EAClC,mBACE,YACA,QAAQ,qCACR,qBACC,QAAQ;EACX,SAAS,YAAY,SAAS,qBAAqB,qBAAqB,QAAQ;;EAEhF,QAAQ,YAAY,qBAAqB;;EAEzC,aAAa;;EAEb,UAAU,sBAAsB;EAChC"}
1
+ {"version":3,"file":"runnerRegistry-BlZhS9yL.d.mts","names":[],"sources":["../src/types/runnerRegistry.ts"],"mappings":";KAAY;KACA;KACA;KASA;KAOA;EACV;EACA,mBAAmB,QAAQ;EAC3B;;UAGe;EACf,QAAQ;EACR;EACA,QAAQ,OAAO;EACf,oBAAoB;EACpB;EACA;;;UAIe;EACf;EACA;;EAEA;EACA;EACA;EACA;EACA;EACA;;EAEA;EACA;EACA,OAAO;EACP;EACA,SAAS;EACT;EACA,OAAO;;EAEP,oBAAoB;;EAEpB;;UAGe;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,SAAS;EACT;;UAGe;EACf,QAAQ;EACR;EACA,QAAQ,OAAO;EACf,oBAAoB;EACpB;;;UAIe;EACf,SAAS,OAAO,sBAAsB,QAAQ;EAC9C,QAAQ,QAAQ;;EAEhB,cAAc,oBAAoB,QAAQ;;EAE1C,kBAAkB,wBAAwB,QAAQ;;EAElD,QAAQ,qBAAqB,QAAQ;EACrC,IAAI,YAAY,qBAAqB,QAAQ;EAC7C,aAAa,aAAa,QAAQ;EAClC,mBACE,YACA,QAAQ,qCACR,qBACC,QAAQ;EACX,SAAS,YAAY,SAAS,qBAAqB,qBAAqB,QAAQ;;EAEhF,QAAQ,YAAY,qBAAqB;;EAEzC,aAAa;;EAEb,UAAU,sBAAsB;EAChC"}
@@ -1,15 +1,11 @@
1
- import fs from "node:fs";
1
+ import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.mjs";
2
+ import { r as resolveRootSessionId } from "./session-ISEGK4z9.mjs";
3
+ import { a as REGISTRY_PATH_ENV, c as SERVICE_TYPE, o as RUNNER_TAG, s as SERVICE_PREFIX } from "./runnerRegistry-l0C_55oO.mjs";
4
+ import fs from "node:fs/promises";
2
5
  import path from "node:path";
3
6
  import { execFile } from "node:child_process";
4
7
  import { promisify } from "node:util";
5
8
  import { createProcessRegistryService, normalizeRepositoryPath, resolveProcessTags } from "@agimon-ai/foundation-process-registry";
6
- import { resolveRootSessionId } from "@agimon-ai/po-core/childProcess";
7
- //#region src/constants/runnerRegistry.ts
8
- const SERVICE_TYPE = "tool";
9
- const SERVICE_PREFIX = "po-runner:";
10
- const RUNNER_TAG = "po-runner";
11
- const REGISTRY_PATH_ENV = "PROCESS_REGISTRY_PATH";
12
- //#endregion
13
9
  //#region src/services/runnerRecord/index.ts
14
10
  /** The disk record's shape guard, shared by the registry and every reader of its files. */
15
11
  function isRunnerRecord(value) {
@@ -41,6 +37,10 @@ function formatRunnerStatus(count) {
41
37
  }
42
38
  //#endregion
43
39
  //#region src/services/runnerRegistry/index.ts
40
+ var runnerRegistry_exports = /* @__PURE__ */ __exportAll({
41
+ RunnerRegistry: () => RunnerRegistry,
42
+ createDefaultProcessRegistry: () => createDefaultProcessRegistry
43
+ });
44
44
  /** Opens the SQLite-backed registry the rest of the monorepo already shares. */
45
45
  function createDefaultProcessRegistry(env = process.env) {
46
46
  return createProcessRegistryService(env[REGISTRY_PATH_ENV]);
@@ -89,19 +89,22 @@ var RunnerRegistry = class {
89
89
  processControl;
90
90
  registry;
91
91
  environment;
92
+ telemetry;
92
93
  subscriptions = /* @__PURE__ */ new Set();
93
- constructor(paths, processControl, registry, environment) {
94
+ recordWrites = Promise.resolve();
95
+ constructor(paths, processControl, registry, environment, telemetry) {
94
96
  this.paths = paths;
95
97
  this.processControl = processControl;
96
98
  this.registry = registry;
97
99
  this.environment = environment;
100
+ this.telemetry = telemetry;
98
101
  }
99
102
  async register(input) {
100
103
  const startedAt = (/* @__PURE__ */ new Date()).toISOString();
101
104
  const rootSessionId = resolveRootSessionId(input.sessionId, this.environment);
102
105
  const identity = await processStartedAt(input.pid);
103
106
  const response = await this.registry.registerProcess({
104
- repositoryPath: this.repositoryPath(),
107
+ repositoryPath: await this.repositoryPath(),
105
108
  serviceName: `${SERVICE_PREFIX}${input.id}`,
106
109
  serviceType: SERVICE_TYPE,
107
110
  pid: input.pid,
@@ -146,13 +149,13 @@ var RunnerRegistry = class {
146
149
  ...input.backendTarget ? { backendTarget: input.backendTarget } : {},
147
150
  hostPid: process.pid
148
151
  };
149
- this.writeRecord(record);
152
+ await this.writeRecord(record);
150
153
  this.notify(record.sessionId);
151
154
  return record;
152
155
  }
153
156
  async list() {
154
157
  return (await this.registry.listProcesses({
155
- repositoryPath: this.repositoryPath(),
158
+ repositoryPath: await this.repositoryPath(),
156
159
  serviceType: SERVICE_TYPE,
157
160
  tags: resolveProcessTags([RUNNER_TAG])
158
161
  })).map(toRunnerRecord);
@@ -164,13 +167,13 @@ var RunnerRegistry = class {
164
167
  return (await this.list()).filter((record) => (record.rootSessionId ?? record.sessionId) === rootSessionId);
165
168
  }
166
169
  async listAll(sessionId) {
167
- this.paths.ensureDirectories(sessionId);
170
+ await this.paths.ensureDirectories(sessionId);
168
171
  const records = [];
169
172
  const directory = this.paths.stateDirectory(sessionId);
170
- for (const entry of fs.readdirSync(directory)) {
173
+ for (const entry of await fs.readdir(directory)) {
171
174
  if (!isPrimaryMetadataEntry(entry)) continue;
172
175
  try {
173
- const parsed = JSON.parse(fs.readFileSync(`${directory}/${entry}`, "utf8"));
176
+ const parsed = JSON.parse(await fs.readFile(`${directory}/${entry}`, "utf8"));
174
177
  if (isRunnerRecord(parsed)) records.push(parsed);
175
178
  } catch (error) {
176
179
  process.emitWarning(`Could not read runner metadata ${entry}: ${String(error)}`);
@@ -181,7 +184,7 @@ var RunnerRegistry = class {
181
184
  async get(id, sessionId) {
182
185
  const target = this.paths.statePathFor(id, sessionId);
183
186
  try {
184
- const parsed = JSON.parse(fs.readFileSync(target, "utf8"));
187
+ const parsed = JSON.parse(await fs.readFile(target, "utf8"));
185
188
  if (!isRunnerRecord(parsed) || parsed.id !== id) {
186
189
  process.emitWarning(`Could not read runner metadata ${path.basename(target)}: invalid runner record`);
187
190
  return;
@@ -200,7 +203,7 @@ var RunnerRegistry = class {
200
203
  ...record,
201
204
  promoted: true
202
205
  };
203
- this.writeRecord(promoted);
206
+ await this.writeRecord(promoted);
204
207
  this.notify(promoted.sessionId);
205
208
  return promoted;
206
209
  }
@@ -214,7 +217,7 @@ var RunnerRegistry = class {
214
217
  ...rest,
215
218
  ...intent ? { terminationIntent: intent } : {}
216
219
  };
217
- this.writeRecord(updated);
220
+ await this.writeRecord(updated);
218
221
  return updated;
219
222
  }
220
223
  async complete(id, outcome, sessionId) {
@@ -239,14 +242,15 @@ var RunnerRegistry = class {
239
242
  finishedAt: (/* @__PURE__ */ new Date()).toISOString()
240
243
  }
241
244
  };
242
- this.writeRecord(completed);
245
+ await this.writeRecord(completed);
243
246
  await this.release(id, completed.sessionId);
247
+ await this.recordFinished(completed);
244
248
  return completed;
245
249
  }
246
250
  async release(id, sessionId) {
247
251
  const ownedSessionId = sessionId ?? (await this.list()).find((record) => record.id === id)?.sessionId ?? (await this.get(id))?.sessionId;
248
252
  const response = await this.registry.releaseProcess({
249
- repositoryPath: this.repositoryPath(),
253
+ repositoryPath: await this.repositoryPath(),
250
254
  serviceName: `${SERVICE_PREFIX}${id}`,
251
255
  serviceType: SERVICE_TYPE,
252
256
  kill: false,
@@ -288,6 +292,22 @@ var RunnerRegistry = class {
288
292
  process.emitWarning(`Runner registry listener failed: ${String(error)}`);
289
293
  }
290
294
  }
295
+ async recordFinished(record) {
296
+ const { exit } = record;
297
+ if (!this.telemetry || !exit) return;
298
+ try {
299
+ await this.telemetry.recordEvent("po_runner.process_finished", {
300
+ outcome: exit.reason,
301
+ "runner.backend": record.backend,
302
+ ...exit.code === null ? {} : { "runner.exit_code": exit.code },
303
+ ...exit.signal ? { "runner.signal": exit.signal } : {},
304
+ ...exit.terminationReason ? { "runner.termination_reason": exit.terminationReason } : {},
305
+ duration_ms: Date.parse(exit.finishedAt) - Date.parse(record.startedAt)
306
+ });
307
+ } catch (error) {
308
+ process.emitWarning(`Could not record runner telemetry: ${String(error)}`);
309
+ }
310
+ }
291
311
  removeSubscription(registration) {
292
312
  const listeners = listenersBySession.get(registration.key);
293
313
  listeners?.delete(registration.listener);
@@ -297,15 +317,19 @@ var RunnerRegistry = class {
297
317
  subscriptionKey(sessionId) {
298
318
  return JSON.stringify([path.resolve(this.paths.stateDirectory(sessionId)), sessionId]);
299
319
  }
300
- repositoryPath() {
301
- return normalizeRepositoryPath(this.paths.repositoryPath());
320
+ async repositoryPath() {
321
+ return normalizeRepositoryPath(await this.paths.repositoryPath());
302
322
  }
303
323
  writeRecord(record) {
304
- this.paths.ensureDirectories(record.sessionId);
305
- const target = this.paths.statePathFor(record.id, record.sessionId);
306
- const temporary = `${target}.${process.pid}.tmp`;
307
- fs.writeFileSync(temporary, `${JSON.stringify(record, null, 2)}\n`, "utf8");
308
- fs.renameSync(temporary, target);
324
+ const write = this.recordWrites.then(async () => {
325
+ await this.paths.ensureDirectories(record.sessionId);
326
+ const target = this.paths.statePathFor(record.id, record.sessionId);
327
+ const temporary = `${target}.${process.pid}.tmp`;
328
+ await fs.writeFile(temporary, `${JSON.stringify(record, null, 2)}\n`, "utf8");
329
+ await fs.rename(temporary, target);
330
+ });
331
+ this.recordWrites = write.catch(() => void 0);
332
+ return write;
309
333
  }
310
334
  };
311
335
  /** Every field is read back from metadata this class wrote on registration. */
@@ -335,6 +359,6 @@ function isPrimaryMetadataEntry(entry) {
335
359
  return entry.endsWith(".json") && !entry.endsWith(".command.json") && !entry.endsWith(".exit.json");
336
360
  }
337
361
  //#endregion
338
- export { formatRunnerStatus as a, formatRunnerFinishedNotice as i, createDefaultProcessRegistry as n, isRunnerRecord as o, formatRunnerFinished as r, REGISTRY_PATH_ENV as s, RunnerRegistry as t };
362
+ export { formatRunnerFinishedNotice as a, formatRunnerFinished as i, createDefaultProcessRegistry as n, formatRunnerStatus as o, runnerRegistry_exports as r, isRunnerRecord as s, RunnerRegistry as t };
339
363
 
340
- //# sourceMappingURL=runnerRegistry-BgaR5O86.mjs.map
364
+ //# sourceMappingURL=runnerRegistry-Dqca6SD3.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runnerRegistry-Dqca6SD3.mjs","names":[],"sources":["../src/services/runnerRecord/index.ts","../src/services/runnerRegistry/index.ts"],"sourcesContent":["import type { RunnerRecord } from '../../types/runnerRegistry';\n\n/** The disk record's shape guard, shared by the registry and every reader of its files. */\nexport function isRunnerRecord(value: unknown): value is RunnerRecord {\n if (typeof value !== 'object' || value === null) return false;\n const record = value as Partial<RunnerRecord>;\n return (\n typeof record.id === 'string' &&\n typeof record.name === 'string' &&\n typeof record.pid === 'number' &&\n typeof record.command === 'string' &&\n typeof record.cwd === 'string' &&\n typeof record.logPath === 'string' &&\n typeof record.sessionId === 'string' &&\n typeof record.startedAt === 'string' &&\n (record.state === 'running' || record.state === 'completed') &&\n typeof record.promoted === 'boolean' &&\n (record.backend === 'rmux' || record.backend === 'tmux' || record.backend === 'native')\n );\n}\n\n/** What the agent reads when a runner it sent to the background exits. Shared by the Pi and server hosts. */\nexport function formatRunnerFinished(record: RunnerRecord): string {\n const outcome = record.exit?.reason ?? record.state;\n const code = record.exit?.code === null || record.exit?.code === undefined ? '' : `, exit code ${record.exit.code}`;\n return [\n `Background runner ${record.name} exited: ${outcome}${code}.`,\n `Runner ID: ${record.id}`,\n `Log: ${record.logPath}`,\n `Inspect: po-runner logs ${record.id}`,\n ].join('\\n');\n}\n\n/** The one line the person sees in the transcript for the same exit. */\nexport function formatRunnerFinishedNotice(record: RunnerRecord): string {\n const reason = record.exit?.reason ?? record.state;\n const code = record.exit?.code === null || record.exit?.code === undefined ? '' : `exit ${record.exit.code}`;\n const outcome = reason === 'completed' ? code : [reason, code].filter(Boolean).join(', ');\n return `Background runner ${record.name} finished${outcome ? ` · ${outcome}` : ''}`;\n}\n/** Compact footer text. An absent value removes the group entirely. */\nexport function formatRunnerStatus(count: number): string | undefined {\n return count > 0 ? `Runners ${count} ●` : undefined;\n}\n\nexport function formatRunnerFooterContribution(count: number): { fullText: string; compactText: string } | undefined {\n return count > 0 ? { fullText: `Runner ${count}`, compactText: `R${count}` } : undefined;\n}\n","import { execFile } from 'node:child_process';\nimport fs from 'node:fs/promises';\nimport path from 'node:path';\nimport { promisify } from 'node:util';\n\nimport {\n createProcessRegistryService,\n normalizeRepositoryPath,\n type ProcessRegistryRecord,\n type ProcessRegistryService,\n resolveProcessTags,\n} from '@agimon-ai/foundation-process-registry';\nimport type { PoTelemetry } from '@agimon-ai/po-core/telemetry';\n\nimport {\n COMMAND_SIDECAR_SUFFIX,\n EXIT_SIDECAR_SUFFIX,\n JSON_EXTENSION,\n NOT_FOUND_ERROR_CODE,\n REGISTRY_PATH_ENV,\n RUNNER_TAG,\n SERVICE_PREFIX,\n SERVICE_TYPE,\n} from '../../constants/runnerRegistry';\nimport type { IProcessControl } from '../../types/processControl';\nimport type {\n CompleteRunnerInput,\n IRunnerRegistry,\n RegisterRunnerInput,\n RunnerRecord,\n RunnerTerminationIntent,\n} from '../../types/runnerRegistry';\nimport type { IRunnerPaths } from '../runnerPaths/type';\nimport { isRunnerRecord } from '../runnerRecord';\nimport { resolveRootSessionId } from '../session';\n\n/** The slice of the shared registry service this wrapper depends on. */\nexport type ProcessRegistryPort = Pick<\n ProcessRegistryService,\n 'registerProcess' | 'releaseProcess' | 'listProcesses' | 'close'\n>;\n\n/** Opens the SQLite-backed registry the rest of the monorepo already shares. */\nexport function createDefaultProcessRegistry(\n env: Readonly<Record<string, string | undefined>> = process.env,\n): ProcessRegistryPort {\n return createProcessRegistryService(env[REGISTRY_PATH_ENV]);\n}\n\nfunction sessionTag(sessionId: string): string {\n return `session:${sessionId}`;\n}\n\nfunction readString(record: ProcessRegistryRecord, key: string): string {\n const value = record.metadata?.[key];\n return typeof value === 'string' ? value : '';\n}\n\nfunction readNumber(record: ProcessRegistryRecord, key: string): number {\n const value = record.metadata?.[key];\n return typeof value === 'number' ? value : 0;\n}\n\nconst runCommand = promisify(execFile);\n\n/**\n * The process start time the registry stores to prove a pid is still the\n * process it registered.\n *\n * The registry resolves it itself when the caller omits it, and it does so with\n * `execFileSync`, which stops this process for the length of a `ps` on every\n * runner that starts. Reading it here costs the same subprocess and blocks\n * nothing: the command is already running by the time a runner is registered.\n *\n * The value has to match what the registry would have read, so the command and\n * the trimming are deliberately identical to its own.\n */\nasync function processStartedAt(pid: number): Promise<string | undefined> {\n if (process.platform === 'win32') return undefined;\n try {\n const { stdout } = await runCommand('ps', ['-o', 'lstart=', '-p', String(pid)], { encoding: 'utf8' });\n return stdout.trim() || undefined;\n } catch {\n return undefined;\n }\n}\n\ntype ListenerRegistration = Readonly<{ key: string; listener: () => void }>;\n\n// Server plugin replacement can leave an in-flight tool and its publisher on different registry instances.\nconst listenersBySession = new Map<string, Set<() => void>>();\n\nexport class RunnerRegistry implements IRunnerRegistry {\n private readonly subscriptions = new Set<ListenerRegistration>();\n private recordWrites: Promise<void> = Promise.resolve();\n\n constructor(\n private readonly paths: IRunnerPaths,\n private readonly processControl: IProcessControl,\n private readonly registry: ProcessRegistryPort,\n private readonly environment: Readonly<Record<string, string | undefined>>,\n /** Records each runner once, here where it completes, instead of in every command's host process. */\n private readonly telemetry?: Pick<PoTelemetry, 'recordEvent'>,\n ) {}\n\n async register(input: RegisterRunnerInput): Promise<RunnerRecord> {\n const startedAt = new Date().toISOString();\n const rootSessionId = resolveRootSessionId(input.sessionId, this.environment);\n const identity = await processStartedAt(input.pid);\n const response = await this.registry.registerProcess({\n repositoryPath: await this.repositoryPath(),\n serviceName: `${SERVICE_PREFIX}${input.id}`,\n serviceType: SERVICE_TYPE,\n pid: input.pid,\n command: input.command,\n ...(identity === undefined ? {} : { processStartedAt: identity }),\n tags: resolveProcessTags([RUNNER_TAG, `runner:${input.id}`, sessionTag(input.sessionId)]),\n metadata: {\n id: input.id,\n name: input.name,\n command: input.command,\n cwd: input.cwd,\n logPath: input.logPath,\n interactive: input.interactive,\n sessionId: input.sessionId,\n rootSessionId,\n backend: input.backend,\n ...(input.backendTarget ? { backendTarget: input.backendTarget } : {}),\n startedAt,\n hostPid: process.pid,\n },\n // The caller has already resolved name collisions against live records,\n // so anything still holding this name is stale.\n force: true,\n });\n if (!response.success) throw new Error(response.error ?? `Failed to register runner ${input.name}`);\n const record: RunnerRecord = {\n id: input.id,\n name: input.name,\n pid: input.pid,\n command: input.command,\n cwd: input.cwd,\n logPath: input.logPath,\n interactive: input.interactive,\n sessionId: input.sessionId,\n rootSessionId,\n startedAt,\n state: 'running',\n promoted: false,\n backend: input.backend,\n ...(input.backendTarget ? { backendTarget: input.backendTarget } : {}),\n hostPid: process.pid,\n };\n await this.writeRecord(record);\n this.notify(record.sessionId);\n return record;\n }\n\n async list(): Promise<RunnerRecord[]> {\n const records = await this.registry.listProcesses({\n repositoryPath: await this.repositoryPath(),\n serviceType: SERVICE_TYPE,\n tags: resolveProcessTags([RUNNER_TAG]),\n });\n return records.map(toRunnerRecord);\n }\n\n async listBySession(sessionId: string): Promise<RunnerRecord[]> {\n const records = await this.list();\n return records.filter((record) => record.sessionId === sessionId);\n }\n\n async listByRootSession(rootSessionId: string): Promise<RunnerRecord[]> {\n const records = await this.list();\n return records.filter((record) => (record.rootSessionId ?? record.sessionId) === rootSessionId);\n }\n\n async listAll(sessionId?: string): Promise<RunnerRecord[]> {\n await this.paths.ensureDirectories(sessionId);\n const records: RunnerRecord[] = [];\n const directory = this.paths.stateDirectory(sessionId);\n for (const entry of await fs.readdir(directory)) {\n if (!isPrimaryMetadataEntry(entry)) continue;\n try {\n const parsed: unknown = JSON.parse(await fs.readFile(`${directory}/${entry}`, 'utf8'));\n if (isRunnerRecord(parsed)) records.push(parsed);\n } catch (error) {\n process.emitWarning(`Could not read runner metadata ${entry}: ${String(error)}`);\n }\n }\n return records.sort((left, right) => right.startedAt.localeCompare(left.startedAt));\n }\n\n async get(id: string, sessionId?: string): Promise<RunnerRecord | undefined> {\n const target = this.paths.statePathFor(id, sessionId);\n try {\n const parsed: unknown = JSON.parse(await fs.readFile(target, 'utf8'));\n if (!isRunnerRecord(parsed) || parsed.id !== id) {\n process.emitWarning(`Could not read runner metadata ${path.basename(target)}: invalid runner record`);\n return undefined;\n }\n return parsed;\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code === NOT_FOUND_ERROR_CODE) return undefined;\n process.emitWarning(`Could not read runner metadata ${path.basename(target)}: ${String(error)}`);\n return undefined;\n }\n }\n\n async markPromoted(id: string): Promise<RunnerRecord | undefined> {\n const record = await this.get(id);\n if (!record) return undefined;\n const promoted = { ...record, promoted: true };\n await this.writeRecord(promoted);\n this.notify(promoted.sessionId);\n return promoted;\n }\n\n async requestTermination(\n id: string,\n intent: RunnerTerminationIntent | undefined,\n sessionId?: string,\n ): Promise<RunnerRecord | undefined> {\n const record = await this.get(id, sessionId);\n if (!record) return undefined;\n if (record.state === 'completed') return record;\n if (intent !== undefined && record.terminationIntent !== undefined) return record;\n const { terminationIntent: _previous, ...rest } = record;\n const updated: RunnerRecord = { ...rest, ...(intent ? { terminationIntent: intent } : {}) };\n await this.writeRecord(updated);\n return updated;\n }\n\n async complete(id: string, outcome: CompleteRunnerInput, sessionId?: string): Promise<RunnerRecord | undefined> {\n const persisted = await this.get(id, sessionId);\n if (persisted?.state === 'completed') {\n await this.release(id, persisted.sessionId);\n return persisted;\n }\n const active = await this.list();\n const record =\n persisted ??\n active.find((candidate) => candidate.id === id && (sessionId === undefined || candidate.sessionId === sessionId));\n if (!record) {\n const belongsToAnotherSession =\n sessionId !== undefined && active.some((candidate) => candidate.id === id && candidate.sessionId !== sessionId);\n if (!belongsToAnotherSession) await this.release(id, sessionId);\n return undefined;\n }\n const completed: RunnerRecord = {\n ...record,\n state: 'completed',\n exit: {\n ...outcome,\n ...(outcome.signal !== null && outcome.terminationReason === undefined && record.terminationIntent === undefined\n ? { terminationReason: 'external_signal' as const }\n : {}),\n ...record.terminationIntent,\n finishedAt: new Date().toISOString(),\n },\n };\n await this.writeRecord(completed);\n await this.release(id, completed.sessionId);\n await this.recordFinished(completed);\n return completed;\n }\n\n async release(id: string, sessionId?: string): Promise<void> {\n const activeSessionId = sessionId ?? (await this.list()).find((record) => record.id === id)?.sessionId;\n const ownedSessionId = activeSessionId ?? (await this.get(id))?.sessionId;\n const response = await this.registry.releaseProcess({\n repositoryPath: await this.repositoryPath(),\n serviceName: `${SERVICE_PREFIX}${id}`,\n serviceType: SERVICE_TYPE,\n kill: false,\n releasePort: false,\n force: true,\n });\n if (!response.success && !response.error?.includes('No matching process entry')) {\n throw new Error(response.error ?? `Failed to release runner ${id}`);\n }\n if (ownedSessionId !== undefined) this.notify(ownedSessionId);\n }\n\n async pruneDead(): Promise<string[]> {\n const dead = (await this.list()).filter((record) => !this.processControl.isAlive(record.pid));\n for (const record of dead) {\n await this.complete(record.id, { reason: 'backend_lost', code: null, signal: null }, record.sessionId);\n }\n return dead.map((record) => record.id);\n }\n\n subscribe(listener: () => void, sessionId: string): () => void {\n const subscribed = (): void => listener();\n const registration = { key: this.subscriptionKey(sessionId), listener: subscribed };\n const listeners = listenersBySession.get(registration.key) ?? new Set<() => void>();\n listeners.add(subscribed);\n listenersBySession.set(registration.key, listeners);\n this.subscriptions.add(registration);\n return () => this.removeSubscription(registration);\n }\n\n close(): void {\n for (const registration of this.subscriptions) this.removeSubscription(registration);\n this.registry.close();\n }\n\n private notify(sessionId: string): void {\n for (const listener of listenersBySession.get(this.subscriptionKey(sessionId)) ?? []) {\n try {\n listener();\n } catch (error) {\n process.emitWarning(`Runner registry listener failed: ${String(error)}`);\n }\n }\n }\n\n private async recordFinished(record: RunnerRecord): Promise<void> {\n const { exit } = record;\n if (!this.telemetry || !exit) return;\n try {\n await this.telemetry.recordEvent('po_runner.process_finished', {\n outcome: exit.reason,\n 'runner.backend': record.backend,\n ...(exit.code === null ? {} : { 'runner.exit_code': exit.code }),\n ...(exit.signal ? { 'runner.signal': exit.signal } : {}),\n ...(exit.terminationReason ? { 'runner.termination_reason': exit.terminationReason } : {}),\n duration_ms: Date.parse(exit.finishedAt) - Date.parse(record.startedAt),\n });\n } catch (error) {\n process.emitWarning(`Could not record runner telemetry: ${String(error)}`);\n }\n }\n\n private removeSubscription(registration: ListenerRegistration): void {\n const listeners = listenersBySession.get(registration.key);\n listeners?.delete(registration.listener);\n if (listeners?.size === 0) listenersBySession.delete(registration.key);\n this.subscriptions.delete(registration);\n }\n\n private subscriptionKey(sessionId: string): string {\n return JSON.stringify([path.resolve(this.paths.stateDirectory(sessionId)), sessionId]);\n }\n\n private async repositoryPath(): Promise<string> {\n return normalizeRepositoryPath(await this.paths.repositoryPath());\n }\n\n private writeRecord(record: RunnerRecord): Promise<void> {\n const write = this.recordWrites.then(async () => {\n await this.paths.ensureDirectories(record.sessionId);\n const target = this.paths.statePathFor(record.id, record.sessionId);\n const temporary = `${target}.${process.pid}.tmp`;\n await fs.writeFile(temporary, `${JSON.stringify(record, null, 2)}\\n`, 'utf8');\n await fs.rename(temporary, target);\n });\n // Keep later writes ordered even after a failed write, which its caller observes.\n this.recordWrites = write.catch(() => undefined);\n return write;\n }\n}\n\n/** Every field is read back from metadata this class wrote on registration. */\nfunction toRunnerRecord(record: ProcessRegistryRecord): RunnerRecord {\n return {\n id: readString(record, 'id'),\n name: readString(record, 'name'),\n pid: record.pid,\n command: readString(record, 'command'),\n cwd: readString(record, 'cwd'),\n logPath: readString(record, 'logPath'),\n interactive: record.metadata?.interactive === true,\n sessionId: readString(record, 'sessionId'),\n ...(readString(record, 'rootSessionId') ? { rootSessionId: readString(record, 'rootSessionId') } : {}),\n startedAt: readString(record, 'startedAt'),\n state: 'running',\n promoted: false,\n backend: readBackend(record.metadata?.backend),\n ...(readString(record, 'backendTarget') ? { backendTarget: readString(record, 'backendTarget') } : {}),\n hostPid: readNumber(record, 'hostPid'),\n };\n}\n\nfunction readBackend(value: unknown): RunnerRecord['backend'] {\n return value === 'rmux' || value === 'tmux' ? value : 'native';\n}\n\nfunction isPrimaryMetadataEntry(entry: string): boolean {\n return (\n entry.endsWith(JSON_EXTENSION) && !entry.endsWith(COMMAND_SIDECAR_SUFFIX) && !entry.endsWith(EXIT_SIDECAR_SUFFIX)\n );\n}\n"],"mappings":";;;;;;;;;;AAGA,SAAgB,eAAe,OAAuC;CACpE,IAAI,OAAO,UAAU,YAAY,UAAU,MAAM,OAAO;CACxD,MAAM,SAAS;CACf,OACE,OAAO,OAAO,OAAO,YACrB,OAAO,OAAO,SAAS,YACvB,OAAO,OAAO,QAAQ,YACtB,OAAO,OA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EAAE,KAAK,MAAM;GAC5E,MAAM,GAAG,OAAO,WAAW,MAAM;EACnC,CAAC;EAED,KAAK,eAAe,MAAM,YAAY,KAAA,CAAS;EAC/C,OAAO;CACT;AACF;;AAGA,SAAS,eAAe,QAA6C;CACnE,OAAO;EACL,IAAI,WAAW,QAAQ,IAAI;EAC3B,MAAM,WAAW,QAAQ,MAAM;EAC/B,KAAK,OAAO;EACZ,SAAS,WAAW,QAAQ,SAAS;EACrC,KAAK,WAAW,QAAQ,KAAK;EAC7B,SAAS,WAAW,QAAQ,SAAS;EACrC,aAAa,OAAO,UAAU,gBAAgB;EAC9C,WAAW,WAAW,QAAQ,WAAW;EACzC,GAAI,WAAW,QAAQ,eAAe,IAAI,EAAE,eAAe,WAAW,QAAQ,eAAe,EAAE,IAAI,CAAC;EACpG,WAAW,WAAW,QAAQ,WAAW;EACzC,OAAO;EACP,UAAU;EACV,SAAS,YAAY,OAAO,UAAU,OAAO;EAC7C,GAAI,WAAW,QAAQ,eAAe,IAAI,EAAE,eAAe,WAAW,QAAQ,eAAe,EAAE,IAAI,CAAC;EACpG,SAAS,WAAW,QAAQ,SAAS;CACvC;AACF;AAEA,SAAS,YAAY,OAAyC;CAC5D,OAAO,UAAU,UAAU,UAAU,SAAS,QAAQ;AACxD;AAEA,SAAS,uBAAuB,OAAwB;CACtD,OACE,MAAM,SAAA,OAAuB,KAAK,CAAC,MAAM,SAAA,eAA+B,KAAK,CAAC,MAAM,SAAA,YAA4B;AAEpH"}
@@ -0,0 +1,60 @@
1
+ //#region src/constants/runnerRegistry.ts
2
+ const SERVICE_TYPE = "tool";
3
+ const SERVICE_PREFIX = "po-runner:";
4
+ const RUNNER_TAG = "po-runner";
5
+ const REGISTRY_PATH_ENV = "PROCESS_REGISTRY_PATH";
6
+ const JSON_EXTENSION = ".json";
7
+ const COMMAND_SIDECAR_SUFFIX = ".command.json";
8
+ const EXIT_SIDECAR_SUFFIX = ".exit.json";
9
+ const NOT_FOUND_ERROR_CODE = "ENOENT";
10
+ //#endregion
11
+ Object.defineProperty(exports, "COMMAND_SIDECAR_SUFFIX", {
12
+ enumerable: true,
13
+ get: function() {
14
+ return COMMAND_SIDECAR_SUFFIX;
15
+ }
16
+ });
17
+ Object.defineProperty(exports, "EXIT_SIDECAR_SUFFIX", {
18
+ enumerable: true,
19
+ get: function() {
20
+ return EXIT_SIDECAR_SUFFIX;
21
+ }
22
+ });
23
+ Object.defineProperty(exports, "JSON_EXTENSION", {
24
+ enumerable: true,
25
+ get: function() {
26
+ return JSON_EXTENSION;
27
+ }
28
+ });
29
+ Object.defineProperty(exports, "NOT_FOUND_ERROR_CODE", {
30
+ enumerable: true,
31
+ get: function() {
32
+ return NOT_FOUND_ERROR_CODE;
33
+ }
34
+ });
35
+ Object.defineProperty(exports, "REGISTRY_PATH_ENV", {
36
+ enumerable: true,
37
+ get: function() {
38
+ return REGISTRY_PATH_ENV;
39
+ }
40
+ });
41
+ Object.defineProperty(exports, "RUNNER_TAG", {
42
+ enumerable: true,
43
+ get: function() {
44
+ return RUNNER_TAG;
45
+ }
46
+ });
47
+ Object.defineProperty(exports, "SERVICE_PREFIX", {
48
+ enumerable: true,
49
+ get: function() {
50
+ return SERVICE_PREFIX;
51
+ }
52
+ });
53
+ Object.defineProperty(exports, "SERVICE_TYPE", {
54
+ enumerable: true,
55
+ get: function() {
56
+ return SERVICE_TYPE;
57
+ }
58
+ });
59
+
60
+ //# sourceMappingURL=runnerRegistry-NW6oAJ71.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runnerRegistry-NW6oAJ71.cjs","names":[],"sources":["../src/constants/runnerRegistry.ts"],"sourcesContent":["export const SERVICE_TYPE = 'tool';\nexport const SERVICE_PREFIX = 'po-runner:';\nexport const RUNNER_TAG = 'po-runner';\nexport const REGISTRY_PATH_ENV = 'PROCESS_REGISTRY_PATH';\nexport const JSON_EXTENSION = '.json';\nexport const COMMAND_SIDECAR_SUFFIX = '.command.json';\nexport const EXIT_SIDECAR_SUFFIX = '.exit.json';\nexport const NOT_FOUND_ERROR_CODE = 'ENOENT';\n"],"mappings":";AAAA,MAAa,eAAe;AAC5B,MAAa,iBAAiB;AAC9B,MAAa,aAAa;AAC1B,MAAa,oBAAoB;AACjC,MAAa,iBAAiB;AAC9B,MAAa,yBAAyB;AACtC,MAAa,sBAAsB;AACnC,MAAa,uBAAuB"}
@@ -0,0 +1,13 @@
1
+ //#region src/constants/runnerRegistry.ts
2
+ const SERVICE_TYPE = "tool";
3
+ const SERVICE_PREFIX = "po-runner:";
4
+ const RUNNER_TAG = "po-runner";
5
+ const REGISTRY_PATH_ENV = "PROCESS_REGISTRY_PATH";
6
+ const JSON_EXTENSION = ".json";
7
+ const COMMAND_SIDECAR_SUFFIX = ".command.json";
8
+ const EXIT_SIDECAR_SUFFIX = ".exit.json";
9
+ const NOT_FOUND_ERROR_CODE = "ENOENT";
10
+ //#endregion
11
+ export { REGISTRY_PATH_ENV as a, SERVICE_TYPE as c, NOT_FOUND_ERROR_CODE as i, EXIT_SIDECAR_SUFFIX as n, RUNNER_TAG as o, JSON_EXTENSION as r, SERVICE_PREFIX as s, COMMAND_SIDECAR_SUFFIX as t };
12
+
13
+ //# sourceMappingURL=runnerRegistry-l0C_55oO.mjs.map