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

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,60 +1,17 @@
1
- import { createApiClient, defineActivityGroup, defineChannelFile, defineFill, defineNativePlugin, defineSessionStore, nativeApiTransport, sessionApiAddress } from "@agimon-ai/po-core/native";
1
+ import { createApiClient, defineActivityGroup, defineChannelFile, defineFill, defineNativePlugin, defineSessionStore, defineToolRenderer, nativeApiTransport, sessionApiAddress, t, useT } from "@agimon-ai/po-core/native";
2
+ import { ArrowRightIcon, Button, Dot, EmptyState, FileIcon, FolderIcon, Input, ListRow, LiveDuration, LoadingState, MessageItem, MessageItemBody, MessageItemHeader, MessageItemStatus, PlayCircleIcon, SearchIcon, Sheet, SheetBody, SheetContent, SheetFooter, SheetHeader, SheetTitle, StatusBadge, SyntaxLine, TerminalIcon, ansiSpans, fontOf, toolTone, useSyntaxLines } from "@agimon-ai/po-native-components";
3
+ import { createElement, memo, useCallback, useEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
2
4
  import { View } from "react-native-unistyles/components/native/View";
3
5
  import { Text } from "react-native-unistyles/components/native/Text";
4
6
  import { ScrollView } from "react-native-unistyles/components/native/ScrollView";
5
- import { Button, Dot, Input, Label, ListRow, Sheet, SheetBody, SheetContent, SheetHeader, SheetTitle, Textarea, fontOf } from "@agimon-ai/po-native-components";
6
- import { useCallback, useEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
7
+ import { Pressable } from "react-native-unistyles/components/native/Pressable";
7
8
  import { StyleSheet } from "react-native-unistyles";
8
9
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
9
- //#region src/extensions/workspaces/sessions/(frontend)/_lib/format.ts
10
- /**
11
- * Local copy of the runtime's formatUptime (src/services/bashResult/index.ts):
12
- * the web plugin may reach only src/types, so the one helper it needs lives here.
13
- */
14
- function formatRunnerUptime(startedAt, now) {
15
- const started = Date.parse(startedAt);
16
- if (Number.isNaN(started)) return "unknown";
17
- const seconds = Math.max(0, Math.floor((now - started) / 1e3));
18
- if (seconds < 60) return `${seconds}s`;
19
- const minutes = Math.floor(seconds / 60);
20
- if (minutes < 60) return `${minutes}m`;
21
- const hours = Math.floor(minutes / 60);
22
- return hours < 24 ? `${hours}h` : `${Math.floor(hours / 24)}d`;
23
- }
24
- /**
25
- * The lines a log view shows: the slice's text, then whatever the follow
26
- * stream appended, bounded to the newest `max`.
27
- *
28
- * A log file ends with a newline, and the reader hands its text back with that
29
- * newline intact, so a naive split reports one blank line more than the file
30
- * has. Dropping exactly one trailing empty entry keeps the count the reader
31
- * sees equal to the count the server reported.
32
- */
33
- function logViewLines(text, appended, max, options = {}) {
34
- const split = text.split("\n");
35
- if (split.length > 0 && split[split.length - 1] === "") split.pop();
36
- if (options.dropPartialTail === true && split.length > 0) split.pop();
37
- const all = [...split, ...appended];
38
- const lines = all.slice(-max);
39
- return {
40
- lines,
41
- hidden: all.length - lines.length
42
- };
43
- }
44
- /**
45
- * Absolute 1-based numbers for a tail, counted back from the last line.
46
- *
47
- * A tail is contiguous, so only its end has to be known. Grep results are not
48
- * contiguous and carry their own numbers from the reader instead.
49
- */
50
- function tailLineNumbers(lastLineNumber, count) {
51
- const first = Math.max(1, lastLineNumber - count + 1);
52
- return Array.from({ length: count }, (_, index) => first + index);
53
- }
54
- //#endregion
10
+ import { AppState } from "react-native";
11
+ import { FlatList } from "react-native-unistyles/components/native/FlatList";
55
12
  //#region src/extensions/workspaces/sessions/(frontend)/_lib/launchLine.ts
56
13
  /**
57
- * The `/runners start` line the launch form sends.
14
+ * The `/runners start` line the runners panel's command bar sends.
58
15
  *
59
16
  * WHY THE BUILDER LIVES HERE AND THE PARSER DOES NOT:
60
17
  * Cockpit code is compiled into the host bundle and may import only this
@@ -70,6 +27,21 @@ const RUNNER_SHELL_REQUEST = {
70
27
  name: "shell",
71
28
  interactive: true
72
29
  };
30
+ /**
31
+ * What the runners panel's Run sends: the typed command on a terminal when
32
+ * one is available, or a login shell when nothing was typed.
33
+ */
34
+ function runnerRunRequest(command, cwd) {
35
+ const where = cwd.trim() === "" ? {} : { cwd };
36
+ return command.trim() === "" ? {
37
+ ...RUNNER_SHELL_REQUEST,
38
+ ...where
39
+ } : {
40
+ command,
41
+ ...where,
42
+ preferInteractive: true
43
+ };
44
+ }
73
45
  /** Quotes a value that carries whitespace, which is how a value survives tokenizing. */
74
46
  function quote(value) {
75
47
  return /\s/u.test(value) ? `"${value}"` : value;
@@ -80,7 +52,7 @@ function runnerLaunchLine(request) {
80
52
  const pairs = [
81
53
  ...name === "" ? [] : [`name=${quote(name)}`],
82
54
  ...cwd === "" ? [] : [`cwd=${quote(cwd)}`],
83
- ...request.interactive === true ? ["interactive=true"] : []
55
+ ...request.interactive === true ? ["interactive=true"] : request.preferInteractive === true ? ["interactive=prefer"] : []
84
56
  ];
85
57
  return [
86
58
  RUNNERS_START_LINE,
@@ -89,12 +61,6 @@ function runnerLaunchLine(request) {
89
61
  request.command.trim()
90
62
  ].join(" ");
91
63
  }
92
- /** What the form will not let a reader send, worded the way the session would answer. */
93
- function launchProblems(request) {
94
- const problems = [];
95
- if (request.command.trim() === "") problems.push("A runner needs a command to run.");
96
- return problems;
97
- }
98
64
  //#endregion
99
65
  //#region src/constants/webRunners.ts
100
66
  const RUNNER_RUNS_TYPE = "runner_runs";
@@ -106,17 +72,46 @@ const runners = defineSessionStore({
106
72
  runs: [],
107
73
  stopRequested: []
108
74
  });
75
+ /** Short commands stay out of the activity card, but remain in the runner feed. */
76
+ function isRunnerActivityVisible(run, now = Date.now()) {
77
+ return run.state === "running" && now - Date.parse(run.startedAt) > 3e3;
78
+ }
109
79
  /** The runner channel keeps the dock's busy state aligned with its rendered run list. */
110
80
  const runnerActivitySource = {
111
81
  subscribe(listener) {
112
- const subscription = runners.store.subscribe(listener);
113
- return () => subscription.unsubscribe();
82
+ let timer;
83
+ const schedule = () => {
84
+ clearTimeout(timer);
85
+ const now = Date.now();
86
+ let deadline = Infinity;
87
+ for (const session of Object.values(runners.store.state)) {
88
+ if (!session) continue;
89
+ for (const run of session.runs) {
90
+ if (run.state !== "running") continue;
91
+ const revealAt = Date.parse(run.startedAt) + 3001;
92
+ if (revealAt > now) deadline = Math.min(deadline, revealAt);
93
+ }
94
+ }
95
+ if (Number.isFinite(deadline)) timer = setTimeout(() => {
96
+ listener();
97
+ schedule();
98
+ }, Math.min(deadline - now, 2147483647));
99
+ };
100
+ const subscription = runners.store.subscribe(() => {
101
+ listener();
102
+ schedule();
103
+ });
104
+ schedule();
105
+ return () => {
106
+ subscription.unsubscribe();
107
+ clearTimeout(timer);
108
+ };
114
109
  },
115
110
  isActive(sessionId) {
116
- return runners.select(runners.store.state, sessionId).runs.some((run) => run.state === "running");
111
+ return runners.select(runners.store.state, sessionId).runs.some((run) => isRunnerActivityVisible(run));
117
112
  }
118
113
  };
119
- function isRecord$1(value) {
114
+ function isRecord$2(value) {
120
115
  return typeof value === "object" && value !== null && !Array.isArray(value);
121
116
  }
122
117
  /**
@@ -152,123 +147,222 @@ function requestRunnerStart(send, sessionId, request) {
152
147
  const runnerRunsChannel = runners.channel({
153
148
  channel: RUNNER_RUNS_TYPE,
154
149
  parse(input) {
155
- if (!isRecord$1(input) || !Array.isArray(input.runs)) return null;
156
- return { runs: input.runs.filter(isRecord$1) };
150
+ if (!isRecord$2(input) || !Array.isArray(input.runs)) return null;
151
+ const failure = input.startFailure;
152
+ return {
153
+ runs: input.runs.filter(isRecord$2),
154
+ ...typeof input.sessionDirectory === "string" ? { sessionDirectory: input.sessionDirectory } : {},
155
+ ...isRecord$2(failure) && typeof failure.id === "string" && typeof failure.message === "string" ? { startFailure: {
156
+ id: failure.id,
157
+ message: failure.message
158
+ } } : {}
159
+ };
157
160
  },
158
- reduce(current, { runs }) {
159
- const stillRunning = new Set(runs.filter((run) => run.state === "running").map((run) => run.id));
161
+ reduce(current, payload) {
162
+ const stillRunning = new Set(payload.runs.filter((run) => run.state === "running").map((run) => run.id));
160
163
  return {
161
- runs,
164
+ ...payload,
165
+ loaded: true,
162
166
  stopRequested: current.stopRequested.filter((id) => stillRunning.has(id))
163
167
  };
164
168
  }
165
169
  });
166
170
  //#endregion
167
- //#region src/extensions/workspaces/sessions/(frontend)/_components/LaunchRunnerSheet.native.tsx
168
- function LaunchRunnerSheet({ sessionId, send, defaultCwd, onClose }) {
169
- const [command, setCommand] = useState("");
170
- const [cwd, setCwd] = useState(defaultCwd ?? "");
171
- const [name, setName] = useState("");
172
- const [interactive, setInteractive] = useState(false);
173
- const request = {
174
- command,
175
- cwd,
176
- name,
177
- interactive
171
+ //#region src/extensions/workspaces/sessions/(frontend)/_lib/format.ts
172
+ /**
173
+ * The lines a log view shows: the slice's text, then whatever the follow
174
+ * stream appended, bounded to the newest `max`.
175
+ *
176
+ * A log file ends with a newline, and the reader hands its text back with that
177
+ * newline intact, so a naive split reports one blank line more than the file
178
+ * has. Dropping exactly one trailing empty entry keeps the count the reader
179
+ * sees equal to the count the server reported.
180
+ */
181
+ function logViewLines(text, appended, max, options = {}) {
182
+ const split = text.split("\n");
183
+ if (split.length > 0 && split[split.length - 1] === "") split.pop();
184
+ if (options.dropPartialTail === true && split.length > 0) split.pop();
185
+ const all = [...split, ...appended];
186
+ const lines = all.slice(-max);
187
+ return {
188
+ lines,
189
+ hidden: all.length - lines.length
178
190
  };
179
- const problems = launchProblems(request);
180
- return /* @__PURE__ */ jsx(Sheet, {
181
- open: true,
182
- onOpenChange: (open) => {
183
- if (!open) onClose();
184
- },
185
- children: /* @__PURE__ */ jsxs(SheetContent, { children: [/* @__PURE__ */ jsx(SheetHeader, { children: /* @__PURE__ */ jsx(SheetTitle, { children: "Launch a runner" }) }), /* @__PURE__ */ jsx(SheetBody, { children: /* @__PURE__ */ jsxs(View, {
186
- style: styles$3.form,
187
- children: [
188
- /* @__PURE__ */ jsx(Label, { children: "Command" }),
189
- /* @__PURE__ */ jsx(Textarea, {
190
- testID: "runner-launch-command",
191
- value: command,
192
- onChangeText: setCommand,
193
- placeholder: "pnpm test"
194
- }),
195
- /* @__PURE__ */ jsx(Label, { children: "Cwd" }),
196
- /* @__PURE__ */ jsx(Input, {
197
- testID: "runner-launch-cwd",
198
- value: cwd,
199
- onChangeText: setCwd,
200
- placeholder: "the session's own directory"
201
- }),
202
- /* @__PURE__ */ jsx(Label, { children: "Name" }),
203
- /* @__PURE__ */ jsx(Input, {
204
- testID: "runner-launch-name",
205
- value: name,
206
- onChangeText: setName,
207
- placeholder: "chosen for you when empty"
208
- }),
209
- /* @__PURE__ */ jsx(Label, { children: "Needs a terminal, for a command that prompts (requires rmux or tmux)" }),
210
- /* @__PURE__ */ jsx(Button, {
211
- testID: "runner-launch-interactive",
212
- variant: "outline",
213
- accessibilityState: { checked: interactive },
214
- onPress: () => setInteractive((value) => !value),
215
- children: interactive ? "Terminal enabled" : "Terminal off"
216
- }),
217
- /* @__PURE__ */ jsx(Label, { children: "Sent to the session" }),
218
- /* @__PURE__ */ jsx(Text, {
219
- selectable: true,
220
- testID: "runner-launch-line",
221
- style: styles$3.line,
222
- children: runnerLaunchLine(request)
223
- }),
224
- problems.length > 0 ? /* @__PURE__ */ jsx(Text, {
225
- style: styles$3.error,
226
- children: problems.join(" ")
227
- }) : null,
228
- /* @__PURE__ */ jsx(Button, {
229
- variant: "outline",
230
- onPress: onClose,
231
- children: "Cancel"
232
- }),
233
- /* @__PURE__ */ jsx(Button, {
234
- testID: "runner-launch-submit",
235
- disabled: problems.length > 0,
236
- onPress: () => {
237
- if (problems.length > 0) return;
238
- requestRunnerStart(send, sessionId, request);
239
- onClose();
240
- },
241
- children: "Launch"
191
+ }
192
+ /**
193
+ * Absolute 1-based numbers for a tail, counted back from the last line.
194
+ *
195
+ * A tail is contiguous, so only its end has to be known. Grep results are not
196
+ * contiguous and carry their own numbers from the reader instead.
197
+ */
198
+ function tailLineNumbers(lastLineNumber, count) {
199
+ const first = Math.max(1, lastLineNumber - count + 1);
200
+ return Array.from({ length: count }, (_, index) => first + index);
201
+ }
202
+ /**
203
+ * A folder as the command bar names it: the session directory by its last
204
+ * segment, a folder inside it relative to it, anything else as written.
205
+ */
206
+ function runnerFolderLabel(folder, sessionDirectory, t) {
207
+ if (folder === "" || folder === sessionDirectory) return sessionDirectory === void 0 ? t?.("runner.ui.sessionDirectory", "session directory") ?? "session directory" : sessionDirectory.split("/").pop() ?? sessionDirectory;
208
+ if (sessionDirectory !== void 0 && folder.startsWith(`${sessionDirectory}/`)) return folder.slice(sessionDirectory.length + 1);
209
+ return folder;
210
+ }
211
+ /** The folders the picker offers past the session directory: those in use, then the one in effect. */
212
+ function runnerFolders(inUse, current, sessionDirectory) {
213
+ const folders = /* @__PURE__ */ new Set([...inUse, current]);
214
+ folders.delete("");
215
+ if (sessionDirectory !== void 0) folders.delete(sessionDirectory);
216
+ return [...folders];
217
+ }
218
+ /**
219
+ * Undoes iOS smart punctuation, which React Native cannot switch off: a shell
220
+ * reads ‘hi’ as literal quotes and a long dash before port as no flag at all.
221
+ */
222
+ function plainPunctuation(text) {
223
+ return text.replace(/[‘’]/g, "'").replace(/[“”]/g, "\"").replace(/\u2014/g, "--");
224
+ }
225
+ /** The badge a run wears: its state while running, then how it ended. */
226
+ function runnerBadge(run, t) {
227
+ if (run === void 0) return {
228
+ tone: "neutral",
229
+ label: t?.("runner.ui.gone", "gone") ?? "gone"
230
+ };
231
+ if (run.state === "running") return {
232
+ tone: "running",
233
+ label: t?.("runner.ui.running", "running") ?? "running"
234
+ };
235
+ if (run.exit === void 0 || run.exit.reason === "stopped") return {
236
+ tone: "neutral",
237
+ label: t?.("runner.ui.stopped", "stopped") ?? "stopped"
238
+ };
239
+ return run.exit.reason === "completed" && (run.exit.code === 0 || run.exit.code === null) ? {
240
+ tone: "ok",
241
+ label: t?.("runner.ui.done", "done") ?? "done"
242
+ } : {
243
+ tone: "error",
244
+ label: run.exit.reason === "failed" ? t?.("runner.ui.failed", "failed") ?? "failed" : run.exit.reason === "timed_out" ? t?.("runner.ui.timedOut", "timed out") ?? "timed out" : run.exit.reason === "completed" ? t?.("runner.ui.completed", "completed") ?? "completed" : run.exit.reason === "backend_lost" ? t?.("runner.ui.backendLost", "backend lost") ?? "backend lost" : run.exit.reason === "launcher_error" ? t?.("runner.ui.launcherError", "launcher error") ?? "launcher error" : run.exit.reason === "signaled" ? t?.("runner.ui.signaled", "signaled") ?? "signaled" : String(run.exit.reason).replace("_", " ")
245
+ };
246
+ }
247
+ //#endregion
248
+ //#region src/extensions/workspaces/sessions/(frontend)/_components/RunnerCommandBar.native.tsx
249
+ /**
250
+ * The phone's command bar: the command and Run on one line, the folder it runs
251
+ * in on the row under it, chosen from a bottom sheet.
252
+ */
253
+ function RunnerCommandBar({ command, onCommandChange, cwd, onCwdChange, sessionDirectory, folders, problem, onLaunch, defaultFolderOpen = false }) {
254
+ const t = useT();
255
+ const [folderOpen, setFolderOpen] = useState(defaultFolderOpen);
256
+ const [path, setPath] = useState("");
257
+ const pick = (next) => {
258
+ onCwdChange(next);
259
+ setPath("");
260
+ setFolderOpen(false);
261
+ };
262
+ const choices = ["", ...runnerFolders(folders, cwd, sessionDirectory)];
263
+ return /* @__PURE__ */ jsxs(View, {
264
+ style: styles$4.bar,
265
+ children: [
266
+ /* @__PURE__ */ jsxs(View, {
267
+ style: styles$4.line,
268
+ children: [/* @__PURE__ */ jsx(View, {
269
+ style: styles$4.grow,
270
+ children: /* @__PURE__ */ jsx(Input, {
271
+ testID: "runners-panel-command",
272
+ accessibilityLabel: t("runner.ui.commandToRunLabel", "Command to run"),
273
+ size: "lg",
274
+ value: command,
275
+ onChangeText: (text) => onCommandChange(plainPunctuation(text)),
276
+ onSubmitEditing: onLaunch,
277
+ placeholder: t("runner.ui.aCommandLikePnpmDev", "a command, like pnpm dev"),
278
+ autoCapitalize: "none",
279
+ autoCorrect: false,
280
+ returnKeyType: "go"
281
+ })
282
+ }), /* @__PURE__ */ jsx(Button, {
283
+ testID: "runners-panel-run",
284
+ variant: "primary",
285
+ size: "lg",
286
+ onPress: onLaunch,
287
+ children: command.trim() === "" ? t("runner.ui.openShellLabel", "Open shell") : t("runner.ui.runLabel", "Run")
288
+ })]
289
+ }),
290
+ /* @__PURE__ */ jsx(ListRow, {
291
+ leading: /* @__PURE__ */ jsx(FolderIcon, {
292
+ size: 14,
293
+ color: problem === void 0 ? "faint" : "red"
242
294
  }),
243
- /* @__PURE__ */ jsx(Text, {
244
- style: styles$3.meta,
245
- children: "It appears above once the runtime starts it."
246
- })
247
- ]
248
- }) })] })
295
+ title: runnerFolderLabel(cwd, sessionDirectory, t),
296
+ description: t("runner.ui.runsInLabel", "Runs in"),
297
+ disclosure: true,
298
+ accessibilityLabel: t("runner.ui.runsInFolder", "Runs in {folder}", { folder: runnerFolderLabel(cwd, sessionDirectory, t) }),
299
+ onPress: () => setFolderOpen(true)
300
+ }),
301
+ problem === void 0 ? /* @__PURE__ */ jsx(Text, {
302
+ style: styles$4.meta,
303
+ children: t("runner.ui.leaveTheCommandEmptyForAPlainShellLabel", "Leave the command empty for a plain shell.")
304
+ }) : /* @__PURE__ */ jsx(Text, {
305
+ accessibilityRole: "alert",
306
+ testID: "runners-panel-problem",
307
+ style: styles$4.problem,
308
+ children: problem
309
+ }),
310
+ /* @__PURE__ */ jsx(Sheet, {
311
+ open: folderOpen,
312
+ onOpenChange: setFolderOpen,
313
+ children: /* @__PURE__ */ jsxs(SheetContent, { children: [
314
+ /* @__PURE__ */ jsx(SheetHeader, {
315
+ closeLabel: t("runner.ui.closeFoldersLabel", "Close folders"),
316
+ children: /* @__PURE__ */ jsx(SheetTitle, { children: t("runner.ui.runsInLabel", "Runs in") })
317
+ }),
318
+ /* @__PURE__ */ jsxs(SheetBody, { children: [/* @__PURE__ */ jsx(View, { children: choices.map((folder) => /* @__PURE__ */ jsx(ListRow, {
319
+ title: folder === "" ? t("runner.ui.sessionDirectoryLabel", "Session directory") : runnerFolderLabel(folder, sessionDirectory, t),
320
+ description: folder === "" ? sessionDirectory ?? t("runner.ui.sessionStartedHere", "Where this session started") : folder,
321
+ selected: folder === cwd,
322
+ onPress: () => pick(folder)
323
+ }, folder)) }), /* @__PURE__ */ jsx(Input, {
324
+ testID: "runners-panel-cwd-path",
325
+ accessibilityLabel: t("runner.ui.anotherFolderLabel", "Another folder"),
326
+ value: path,
327
+ onChangeText: (text) => setPath(plainPunctuation(text)),
328
+ onSubmitEditing: () => {
329
+ if (path.trim() !== "") pick(path.trim());
330
+ },
331
+ placeholder: t("runner.ui.anotherFolderLikePackagesweb", "another folder, like packages/web"),
332
+ autoCapitalize: "none",
333
+ autoCorrect: false,
334
+ returnKeyType: "done"
335
+ })] }),
336
+ /* @__PURE__ */ jsx(SheetFooter, { children: t("runner.ui.aRelativeFolderStartsFromTheSessionDirectoryLabel", "A relative folder starts from the session directory.") })
337
+ ] })
338
+ })
339
+ ]
249
340
  });
250
341
  }
251
- const styles$3 = StyleSheet.create((theme) => ({
252
- form: {
253
- gap: theme.spacing(2),
342
+ const styles$4 = StyleSheet.create((theme) => ({
343
+ bar: {
344
+ gap: theme.spacing(1.5),
254
345
  uni__dependencies: [0]
255
346
  },
256
347
  line: {
257
- color: theme.colors.green,
258
- fontFamily: fontOf(theme.fontFamily.mono),
259
- fontSize: theme.fontSize.sm,
348
+ flexDirection: "row",
349
+ alignItems: "center",
350
+ gap: theme.spacing(2),
260
351
  uni__dependencies: [0]
261
352
  },
262
- error: {
263
- color: theme.colors.red,
353
+ grow: { flex: 1 },
354
+ meta: {
355
+ color: theme.colors.dim,
264
356
  fontFamily: fontOf(theme.fontFamily.sans),
265
- fontSize: theme.fontSize.base,
357
+ fontSize: theme.fontSize.sm,
358
+ lineHeight: theme.lineHeight.sm,
266
359
  uni__dependencies: [0]
267
360
  },
268
- meta: {
269
- color: theme.colors.dim,
361
+ problem: {
362
+ color: theme.colors.red,
270
363
  fontFamily: fontOf(theme.fontFamily.sans),
271
364
  fontSize: theme.fontSize.sm,
365
+ lineHeight: theme.lineHeight.sm,
272
366
  uni__dependencies: [0]
273
367
  }
274
368
  }));
@@ -370,7 +464,7 @@ const api = createApiClient(routes, {
370
464
  //#endregion
371
465
  //#region src/extensions/workspaces/sessions/(frontend)/_lib/logApi.native.ts
372
466
  const UNREACHABLE = "The cockpit hub is unreachable.";
373
- function isRecord(value) {
467
+ function isRecord$1(value) {
374
468
  return typeof value === "object" && value !== null && !Array.isArray(value);
375
469
  }
376
470
  /** Reads one runner's log: the last N lines, or the lines matching a substring with context. */
@@ -389,7 +483,7 @@ async function fetchRunnerLog(sessionId, runId, params = {}, signal) {
389
483
  if (result.status === 0) return { error: signal?.aborted === true ? "" : UNREACHABLE };
390
484
  return { error: result.error === "" ? `The hub answered ${String(result.status)}.` : result.error };
391
485
  }
392
- if (!isRecord(result.data) || typeof result.data.text !== "string") return { error: `The hub answered ${String(result.status)}.` };
486
+ if (!isRecord$1(result.data) || typeof result.data.text !== "string") return { error: `The hub answered ${String(result.status)}.` };
393
487
  return { slice: result.data };
394
488
  }
395
489
  //#endregion
@@ -401,11 +495,20 @@ function useRunners(sessionId) {
401
495
  }, []);
402
496
  return useSyncExternalStore(subscribe, () => runners.select(runners.store.state, sessionId));
403
497
  }
498
+ /** Pause finite reads and clocks while native is not active; entering active refreshes immediately. */
499
+ function useRunnerForeground() {
500
+ const subscribe = useCallback((listener) => {
501
+ const subscription = AppState.addEventListener("change", listener);
502
+ return () => subscription.remove();
503
+ }, []);
504
+ return useSyncExternalStore(subscribe, () => AppState.currentState === "active");
505
+ }
404
506
  /** Native uses finite reads instead of browser SSE. Read a bounded tail through the host's sealed transport. */
405
507
  function useRunnerTail(sessionId, runId, running) {
508
+ const foreground = useRunnerForeground();
406
509
  const [tail, setTail] = useState();
407
510
  useEffect(() => {
408
- if (sessionId === null || !running) return;
511
+ if (sessionId === null || !running || !foreground) return;
409
512
  const controller = new AbortController();
410
513
  let timer;
411
514
  const read = async () => {
@@ -431,16 +534,64 @@ function useRunnerTail(sessionId, runId, running) {
431
534
  }, [
432
535
  sessionId,
433
536
  runId,
434
- running
537
+ running,
538
+ foreground
435
539
  ]);
436
540
  return running && tail?.id === `${sessionId}:${runId}` ? tail.text : void 0;
437
541
  }
438
542
  //#endregion
439
543
  //#region src/extensions/workspaces/sessions/(frontend)/_components/RunnerLogPanel.native.tsx
544
+ /** The top of both runner screens: name, outcome, an action, and the command in its folder. */
545
+ function RunnerRunHeader({ run, name, sessionDirectory, action }) {
546
+ const t = useT();
547
+ const badge = runnerBadge(run, t);
548
+ /** A long command would eat a phone screen, so it starts as one truncated line. */
549
+ const [commandOpen, setCommandOpen] = useState(false);
550
+ return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs(View, {
551
+ style: styles$3.header,
552
+ children: [
553
+ /* @__PURE__ */ jsx(Text, {
554
+ numberOfLines: 1,
555
+ style: styles$3.title,
556
+ children: name
557
+ }),
558
+ /* @__PURE__ */ jsx(StatusBadge, {
559
+ tone: badge.tone,
560
+ children: badge.label
561
+ }),
562
+ /* @__PURE__ */ jsx(View, { style: styles$3.grow }),
563
+ action
564
+ ]
565
+ }), run ? /* @__PURE__ */ jsxs(Pressable, {
566
+ testID: "runner-log-command-toggle",
567
+ accessibilityRole: "button",
568
+ accessibilityState: { expanded: commandOpen },
569
+ accessibilityHint: commandOpen ? t("runner.ui.collapsesTheCommandLabel", "Collapses the command") : t("runner.ui.showsTheFullCommandLabel", "Shows the full command"),
570
+ style: styles$3.commandBox,
571
+ onPress: () => setCommandOpen((open) => !open),
572
+ children: [/* @__PURE__ */ jsxs(Text, {
573
+ selectable: commandOpen,
574
+ numberOfLines: commandOpen ? void 0 : 1,
575
+ style: styles$3.command,
576
+ children: [/* @__PURE__ */ jsx(Text, {
577
+ style: styles$3.prompt,
578
+ children: "$ "
579
+ }), run.command]
580
+ }), commandOpen ? /* @__PURE__ */ jsxs(Text, {
581
+ numberOfLines: 1,
582
+ style: styles$3.folder,
583
+ children: [t("runner.ui.in", "in"), runnerFolderLabel(run.cwd, sessionDirectory, t)]
584
+ }) : null]
585
+ }) : /* @__PURE__ */ jsx(Text, {
586
+ style: styles$3.meta,
587
+ children: t("runner.ui.noLongerListedItsLogStaysReadableLabel", "No longer listed; its log stays readable.")
588
+ })] });
589
+ }
440
590
  function runnerLogTab(run) {
591
+ const t$2 = t;
441
592
  return {
442
593
  id: `runner-log-${run.id}`,
443
- label: `log · ${run.name}`,
594
+ label: t$2("runner.ui.logTab", "log · {name}", { name: run.name }),
444
595
  panel: (props) => /* @__PURE__ */ jsx(RunnerLogPanel, {
445
596
  ...props,
446
597
  runId: run.id
@@ -448,7 +599,9 @@ function runnerLogTab(run) {
448
599
  };
449
600
  }
450
601
  function RunnerLogPanel({ sessionId, runId, sendSessionFrame }) {
602
+ const t = useT();
451
603
  const session = useRunners(sessionId);
604
+ const foreground = useRunnerForeground();
452
605
  const run = session.runs.find((candidate) => candidate.id === runId);
453
606
  const [typed, setTyped] = useState("");
454
607
  const [query, setQuery] = useState("");
@@ -464,7 +617,7 @@ function RunnerLogPanel({ sessionId, runId, sendSessionFrame }) {
464
617
  return () => clearTimeout(timer);
465
618
  }, [typed]);
466
619
  useEffect(() => {
467
- if (sessionId === null) return;
620
+ if (sessionId === null || !foreground) return;
468
621
  const controller = new AbortController();
469
622
  let timer;
470
623
  const read = async () => {
@@ -475,13 +628,21 @@ function RunnerLogPanel({ sessionId, runId, sendSessionFrame }) {
475
628
  contextLines: context
476
629
  }, controller.signal);
477
630
  if (controller.signal.aborted) return;
478
- setLoaded("error" in result ? {
479
- key: requestKey,
480
- error: result.error
481
- } : {
482
- key: requestKey,
483
- slice: result.slice,
484
- error: ""
631
+ setLoaded((previous) => {
632
+ const next = "error" in result ? {
633
+ key: requestKey,
634
+ error: result.error
635
+ } : {
636
+ key: requestKey,
637
+ slice: result.slice,
638
+ error: ""
639
+ };
640
+ if (previous?.key !== next.key || previous.error !== next.error) return next;
641
+ const before = previous.slice;
642
+ const after = next.slice;
643
+ if (before === after) return previous;
644
+ if (!before || !after) return next;
645
+ return before.text === after.text && before.totalLines === after.totalLines && before.lineCount === after.lineCount && before.fileSize === after.fileSize && before.completeBytes === after.completeBytes && before.path === after.path && before.exists === after.exists && before.truncated === after.truncated && before.runId === after.runId && before.running === after.running && before.lineNumbers?.length === after.lineNumbers?.length && (before.lineNumbers?.every((number, index) => number === after.lineNumbers?.[index]) ?? true) ? previous : next;
485
646
  });
486
647
  if (following && query === "" && ("error" in result || result.slice.running)) timer = setTimeout(() => void read(), 2e3);
487
648
  };
@@ -497,107 +658,140 @@ function RunnerLogPanel({ sessionId, runId, sendSessionFrame }) {
497
658
  ignoreCase,
498
659
  context,
499
660
  following,
500
- requestKey
661
+ requestKey,
662
+ foreground
501
663
  ]);
502
- const lines = logViewLines(slice?.text ?? "", [], 2e3).lines;
503
- const numbers = query === "" ? tailLineNumbers(slice?.totalLines ?? 0, lines.length) : slice?.lineNumbers ?? [];
504
664
  const stopping = session.stopRequested.includes(runId);
665
+ const live = following && query === "" && slice?.running === true;
505
666
  return /* @__PURE__ */ jsxs(View, {
506
667
  testID: "runner-log-panel",
507
- style: styles$2.panel,
668
+ style: styles$3.panel,
508
669
  children: [
509
- /* @__PURE__ */ jsx(Text, {
510
- style: styles$2.title,
511
- children: run?.name ?? runId
512
- }),
513
- /* @__PURE__ */ jsx(Text, {
514
- style: styles$2.meta,
515
- children: run?.state ?? "no longer listed; its log stays readable"
670
+ /* @__PURE__ */ jsx(RunnerRunHeader, {
671
+ run,
672
+ name: run?.name ?? runId,
673
+ sessionDirectory: session.sessionDirectory,
674
+ action: run?.state === "running" && sessionId !== null ? /* @__PURE__ */ jsx(Button, {
675
+ variant: stopping ? "outline" : "danger-outline",
676
+ size: "sm",
677
+ disabled: stopping,
678
+ onPress: () => requestRunnerStop(sendSessionFrame, sessionId, runId),
679
+ children: stopping ? t("runner.ui.stoppingLabelProgress", "Stopping…") : t("runner.ui.stopLabel", "Stop")
680
+ }) : null
516
681
  }),
517
- run ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Text, {
518
- selectable: true,
519
- style: styles$2.meta,
520
- children: run.command
521
- }), /* @__PURE__ */ jsx(Text, {
522
- selectable: true,
523
- style: styles$2.meta,
524
- children: run.cwd
525
- })] }) : null,
526
- run?.state === "running" && sessionId !== null ? /* @__PURE__ */ jsx(Button, {
527
- variant: "danger-outline",
528
- disabled: stopping,
529
- onPress: () => requestRunnerStop(sendSessionFrame, sessionId, runId),
530
- children: stopping ? "Stopping…" : "Stop"
531
- }) : null,
532
- /* @__PURE__ */ jsx(Label, { children: "Search this log" }),
533
682
  /* @__PURE__ */ jsx(Input, {
534
683
  testID: "runner-log-search",
684
+ accessibilityLabel: t("runner.ui.searchThisLogLabel", "Search this log"),
685
+ placeholder: t("runner.ui.searchOutputLabel", "Search output"),
535
686
  value: typed,
536
- onChangeText: setTyped
687
+ onChangeText: setTyped,
688
+ autoCapitalize: "none",
689
+ returnKeyType: "search"
537
690
  }),
538
691
  /* @__PURE__ */ jsxs(View, {
539
- style: styles$2.actions,
692
+ style: styles$3.actions,
540
693
  children: [
541
694
  /* @__PURE__ */ jsx(Button, {
542
- variant: "outline",
695
+ variant: ignoreCase ? "subtle" : "outline",
696
+ size: "sm",
543
697
  accessibilityState: { selected: ignoreCase },
544
698
  onPress: () => setIgnoreCase((value) => !value),
545
- children: "aA"
699
+ children: ignoreCase ? t("runner.ui.anyCaseLabel", "Any case") : t("runner.ui.matchCaseLabel", "Match case")
546
700
  }),
547
- /* @__PURE__ */ jsxs(Button, {
548
- variant: "outline",
549
- disabled: query === "",
701
+ query === "" ? null : /* @__PURE__ */ jsx(Button, {
702
+ variant: context > 0 ? "subtle" : "outline",
703
+ size: "sm",
550
704
  onPress: () => setContext((value) => value === 0 ? 2 : 0),
551
- children: [
552
- "± ",
553
- context,
554
- " lines"
555
- ]
705
+ children: t("runner.ui.contextLines", "± {count} lines", { count: context })
556
706
  }),
557
- /* @__PURE__ */ jsx(Button, {
558
- variant: "outline",
559
- disabled: query !== "" || slice?.running !== true,
560
- accessibilityState: { selected: following },
707
+ query === "" && slice?.running === true ? /* @__PURE__ */ jsx(Button, {
708
+ variant: live ? "subtle" : "outline",
709
+ size: "sm",
710
+ accessibilityState: { selected: live },
561
711
  onPress: () => setFollowing((value) => !value),
562
- children: query !== "" ? "Follow · paused" : "Follow"
563
- })
712
+ children: live ? t("runner.ui.followingLabel", "Following") : t("runner.ui.followLabel", "Follow")
713
+ }) : null
564
714
  ]
565
715
  }),
566
- /* @__PURE__ */ jsx(Text, {
567
- style: styles$2.meta,
568
- children: slice === void 0 ? "Reading…" : query !== "" ? `${slice.lineCount} matching of ${slice.totalLines} lines` : `${following && slice.running ? "Tailing" : "Showing"} last ${lines.length} of ${slice.totalLines} lines`
569
- }),
570
- /* @__PURE__ */ jsx(ScrollView, {
571
- style: styles$2.log,
572
- children: error !== "" ? /* @__PURE__ */ jsx(Text, {
573
- accessibilityRole: "alert",
574
- style: styles$2.error,
575
- children: error
576
- }) : slice?.exists === false ? /* @__PURE__ */ jsx(Text, {
577
- style: styles$2.meta,
578
- children: "This runner has not written a log yet."
579
- }) : slice && lines.length === 0 ? /* @__PURE__ */ jsx(Text, {
580
- style: styles$2.meta,
581
- children: query === "" ? "The log is empty." : "Nothing matched."
582
- }) : lines.map((line, index) => /* @__PURE__ */ jsxs(Text, {
583
- selectable: true,
584
- style: styles$2.meta,
585
- children: [
586
- numbers[index],
587
- " ",
588
- line
589
- ]
590
- }, `${numbers[index] ?? index}`))
716
+ /* @__PURE__ */ jsx(RunnerLogOutput, {
717
+ slice,
718
+ error,
719
+ query,
720
+ live
591
721
  }),
592
722
  /* @__PURE__ */ jsx(Text, {
593
723
  selectable: true,
594
- style: styles$2.meta,
724
+ numberOfLines: 1,
725
+ ellipsizeMode: "middle",
726
+ style: styles$3.path,
595
727
  children: run?.logPath ?? slice?.path ?? ""
596
728
  })
597
729
  ]
598
730
  });
599
731
  }
600
- const styles$2 = StyleSheet.create((theme) => ({
732
+ const RunnerLogOutput = memo(function RunnerLogOutput({ slice, error, query, live }) {
733
+ const t = useT();
734
+ const lines = useMemo(() => logViewLines(slice?.text ?? "", [], 2e3).lines, [slice?.text]);
735
+ const rows = useMemo(() => {
736
+ const numbers = query === "" ? tailLineNumbers(slice?.totalLines ?? 0, lines.length) : slice?.lineNumbers ?? [];
737
+ const gutter = String(numbers.at(-1) ?? 0).length;
738
+ return lines.map((text, index) => ({
739
+ key: String(numbers[index] ?? index),
740
+ number: `${String(numbers[index] ?? "").padStart(gutter)} `,
741
+ text
742
+ }));
743
+ }, [
744
+ lines,
745
+ query,
746
+ slice?.totalLines,
747
+ slice?.lineNumbers
748
+ ]);
749
+ const renderItem = useCallback(({ item }) => /* @__PURE__ */ jsxs(Text, {
750
+ selectable: true,
751
+ style: styles$3.line,
752
+ children: [/* @__PURE__ */ jsx(Text, {
753
+ style: styles$3.number,
754
+ children: item.number
755
+ }), item.text]
756
+ }), []);
757
+ const keyExtractor = useCallback((item) => item.key, []);
758
+ const empty = error !== "" ? /* @__PURE__ */ jsx(Text, {
759
+ accessibilityRole: "alert",
760
+ style: styles$3.error,
761
+ children: error
762
+ }) : slice?.exists === false ? /* @__PURE__ */ jsx(Text, {
763
+ style: styles$3.meta,
764
+ children: t("runner.ui.thisRunnerHasNotWrittenALogYetLabel", "This runner has not written a log yet.")
765
+ }) : slice ? /* @__PURE__ */ jsx(Text, {
766
+ style: styles$3.meta,
767
+ children: query === "" ? t("runner.ui.theLogIsEmptyLabel", "The log is empty.") : t("runner.ui.nothingMatchedLabel", "Nothing matched.")
768
+ }) : null;
769
+ return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Text, {
770
+ style: styles$3.meta,
771
+ children: slice === void 0 ? error === "" ? t("runner.ui.readingLabelProgress", "Reading…") : "" : query !== "" ? t("runner.ui.matchingLines", "{count} matching of {total} lines", {
772
+ count: slice.lineCount,
773
+ total: slice.totalLines
774
+ }) : live ? t("runner.ui.tailingLines", "Tailing last {count} of {total} lines", {
775
+ count: lines.length,
776
+ total: slice.totalLines
777
+ }) : t("runner.ui.showingLines", "Showing last {count} of {total} lines", {
778
+ count: lines.length,
779
+ total: slice.totalLines
780
+ })
781
+ }), /* @__PURE__ */ jsx(FlatList, {
782
+ style: styles$3.log,
783
+ contentContainerStyle: styles$3.logBody,
784
+ data: error !== "" || slice?.exists === false ? [] : rows,
785
+ renderItem,
786
+ keyExtractor,
787
+ ListEmptyComponent: empty ?? void 0,
788
+ initialNumToRender: 20,
789
+ maxToRenderPerBatch: 20,
790
+ windowSize: 5,
791
+ accessibilityLabel: t("runner.ui.runnerLogOutputLabel", "Runner log output")
792
+ })] });
793
+ });
794
+ const styles$3 = StyleSheet.create((theme) => ({
601
795
  panel: {
602
796
  flex: 1,
603
797
  gap: theme.spacing(2),
@@ -605,13 +799,46 @@ const styles$2 = StyleSheet.create((theme) => ({
605
799
  backgroundColor: theme.colors.bg,
606
800
  uni__dependencies: [0]
607
801
  },
802
+ header: {
803
+ flexDirection: "row",
804
+ alignItems: "center",
805
+ gap: theme.spacing(2),
806
+ minHeight: 32,
807
+ uni__dependencies: [0]
808
+ },
809
+ grow: { flex: 1 },
608
810
  title: {
811
+ flexShrink: 1,
609
812
  color: theme.colors.hi,
610
813
  fontWeight: "600",
611
814
  fontFamily: fontOf(theme.fontFamily.sans),
612
815
  fontSize: theme.fontSize.base,
613
816
  uni__dependencies: [0]
614
817
  },
818
+ commandBox: {
819
+ gap: theme.spacing(1),
820
+ paddingHorizontal: theme.spacing(3),
821
+ paddingVertical: theme.spacing(2),
822
+ borderRadius: theme.borderRadius.md,
823
+ backgroundColor: theme.colors.deep,
824
+ uni__dependencies: [0]
825
+ },
826
+ command: {
827
+ color: theme.colors.hi,
828
+ fontFamily: fontOf(theme.fontFamily.mono),
829
+ fontSize: theme.fontSize.sm,
830
+ uni__dependencies: [0]
831
+ },
832
+ prompt: {
833
+ color: theme.colors.faint,
834
+ uni__dependencies: [0]
835
+ },
836
+ folder: {
837
+ color: theme.colors.dim,
838
+ fontFamily: fontOf(theme.fontFamily.mono),
839
+ fontSize: theme.fontSize.xs,
840
+ uni__dependencies: [0]
841
+ },
615
842
  meta: {
616
843
  color: theme.colors.dim,
617
844
  fontFamily: fontOf(theme.fontFamily.sans),
@@ -622,7 +849,7 @@ const styles$2 = StyleSheet.create((theme) => ({
622
849
  error: {
623
850
  color: theme.colors.red,
624
851
  fontFamily: fontOf(theme.fontFamily.sans),
625
- fontSize: theme.fontSize.base,
852
+ fontSize: theme.fontSize.sm,
626
853
  uni__dependencies: [0]
627
854
  },
628
855
  actions: {
@@ -633,8 +860,30 @@ const styles$2 = StyleSheet.create((theme) => ({
633
860
  },
634
861
  log: {
635
862
  flex: 1,
863
+ borderRadius: theme.borderRadius.md,
636
864
  backgroundColor: theme.colors.deep,
637
865
  uni__dependencies: [0]
866
+ },
867
+ logBody: {
868
+ padding: theme.spacing(3),
869
+ uni__dependencies: [0]
870
+ },
871
+ line: {
872
+ color: theme.colors.text,
873
+ fontFamily: fontOf(theme.fontFamily.mono),
874
+ fontSize: theme.fontSize.xs,
875
+ lineHeight: theme.lineHeight.sm,
876
+ uni__dependencies: [0]
877
+ },
878
+ number: {
879
+ color: theme.colors.faint,
880
+ uni__dependencies: [0]
881
+ },
882
+ path: {
883
+ color: theme.colors.faint,
884
+ fontFamily: fontOf(theme.fontFamily.mono),
885
+ fontSize: theme.fontSize.xs,
886
+ uni__dependencies: [0]
638
887
  }
639
888
  }));
640
889
  //#endregion
@@ -663,35 +912,89 @@ async function sendRunnerInput(sessionId, runId, text) {
663
912
  //#region src/extensions/workspaces/sessions/(frontend)/_components/RunnerShellPanel.native.tsx
664
913
  /** The host renders genuine terminal bytes; this package owns every scoped API call. */
665
914
  function runnerShellTab(run) {
915
+ const t$1 = t;
666
916
  return {
667
917
  id: `runner-shell-${run.id}`,
668
- label: `shell · ${run.name}`,
918
+ label: t$1("runner.ui.shellTab", "shell · {name}", { name: run.name }),
669
919
  panel: (props) => /* @__PURE__ */ jsx(RunnerShellPanel, {
670
920
  ...props,
671
921
  runId: run.id
672
922
  })
673
923
  };
674
924
  }
675
- function RunnerShellPanel({ sessionId, runId, renderRunnerTerminal }) {
925
+ /**
926
+ * One terminal runner, full screen. A phone keyboard has no Ctrl key, so
927
+ * Ctrl-C is a button; Search opens the runner's log, which the sink keeps
928
+ * scrubbed beside the raw bytes for exactly that.
929
+ */
930
+ function RunnerShellPanel({ sessionId, runId, renderRunnerTerminal, sendSessionFrame, openTransientTab }) {
931
+ const t = useT();
932
+ const session = useRunners(sessionId);
933
+ const run = session.runs.find((candidate) => candidate.id === runId);
934
+ const live = run?.state === "running";
935
+ const stopping = session.stopRequested.includes(runId);
676
936
  const request = useMemo(() => sessionId === null ? void 0 : {
677
937
  key: `${sessionId}:${runId}`,
678
938
  read: (from, generation, signal) => readRunnerScreen(sessionId, runId, from, generation, signal),
679
939
  write: (text) => sendRunnerInput(sessionId, runId, text)
680
940
  }, [sessionId, runId]);
681
- return /* @__PURE__ */ jsx(View, {
682
- style: styles$1.panel,
683
- children: request === void 0 ? /* @__PURE__ */ jsx(Text, {
684
- style: styles$1.meta,
685
- children: "Select a session to attach to this runner."
686
- }) : renderRunnerTerminal?.(request)
941
+ return /* @__PURE__ */ jsxs(View, {
942
+ style: styles$2.panel,
943
+ children: [
944
+ /* @__PURE__ */ jsx(RunnerRunHeader, {
945
+ run,
946
+ name: run?.name ?? runId,
947
+ sessionDirectory: session.sessionDirectory,
948
+ action: live && sessionId !== null ? /* @__PURE__ */ jsx(Button, {
949
+ testID: "runner-shell-stop",
950
+ variant: stopping ? "outline" : "danger-outline",
951
+ size: "sm",
952
+ disabled: stopping,
953
+ onPress: () => requestRunnerStop(sendSessionFrame, sessionId, runId),
954
+ children: stopping ? t("runner.ui.stoppingLabelProgress", "Stopping…") : t("runner.ui.stopLabel", "Stop")
955
+ }) : null
956
+ }),
957
+ /* @__PURE__ */ jsx(View, {
958
+ style: styles$2.terminal,
959
+ children: request === void 0 ? /* @__PURE__ */ jsx(Text, {
960
+ style: styles$2.meta,
961
+ children: t("runner.ui.selectASessionToAttachToThisRunnerLabel", "Select a session to attach to this runner.")
962
+ }) : renderRunnerTerminal?.(request)
963
+ }),
964
+ /* @__PURE__ */ jsxs(View, {
965
+ style: styles$2.actions,
966
+ children: [run ? /* @__PURE__ */ jsxs(Button, {
967
+ testID: "runner-shell-search",
968
+ variant: "outline",
969
+ onPress: () => openTransientTab(runnerLogTab(run)),
970
+ style: styles$2.action,
971
+ children: [/* @__PURE__ */ jsx(SearchIcon, { size: 14 }), t("runner.ui.searchOutputLabel", "Search output")]
972
+ }) : null, live && sessionId !== null ? /* @__PURE__ */ jsx(Button, {
973
+ testID: "runner-shell-interrupt",
974
+ variant: "outline",
975
+ onPress: () => void sendRunnerInput(sessionId, runId, ""),
976
+ style: styles$2.action,
977
+ children: "Ctrl-C"
978
+ }) : null]
979
+ })
980
+ ]
687
981
  });
688
982
  }
689
- const styles$1 = StyleSheet.create((theme) => ({
983
+ const styles$2 = StyleSheet.create((theme) => ({
690
984
  panel: {
691
985
  flex: 1,
986
+ gap: theme.spacing(2),
987
+ padding: theme.spacing(3),
692
988
  backgroundColor: theme.colors.bg,
693
989
  uni__dependencies: [0]
694
990
  },
991
+ actions: {
992
+ flexDirection: "row",
993
+ gap: theme.spacing(2),
994
+ uni__dependencies: [0]
995
+ },
996
+ action: { flex: 1 },
997
+ terminal: { flex: 1 },
695
998
  meta: {
696
999
  color: theme.colors.dim,
697
1000
  fontFamily: fontOf(theme.fontFamily.sans),
@@ -701,184 +1004,236 @@ const styles$1 = StyleSheet.create((theme) => ({
701
1004
  }));
702
1005
  //#endregion
703
1006
  //#region src/extensions/workspaces/sessions/(frontend)/_components/RunnersPanel.native.tsx
1007
+ /** A runner's own screen: its terminal when it has one, its log when it does not. */
1008
+ function runnerTab(run) {
1009
+ return run.interactive ? runnerShellTab(run) : runnerLogTab(run);
1010
+ }
704
1011
  function runnersTab() {
705
1012
  return {
706
1013
  id: "runner-runs",
707
- label: "runners",
1014
+ label: t("runner.ui.runnersTab", "runners"),
708
1015
  panel: RunnersPanel
709
1016
  };
710
1017
  }
711
- function RunnerRow({ run, props, stopping, now, detail = false }) {
1018
+ function RunnerRow({ run, props, stopping }) {
1019
+ const t = useT();
712
1020
  const tail = useRunnerTail(props.sessionId, run.id, run.state === "running");
713
- return /* @__PURE__ */ jsxs(View, {
1021
+ return /* @__PURE__ */ jsxs(Pressable, {
714
1022
  testID: `activity-runner-${run.id}`,
715
- style: styles.row,
716
- children: [
717
- /* @__PURE__ */ jsx(ListRow, {
718
- leading: /* @__PURE__ */ jsx(Dot, {
1023
+ accessibilityRole: "button",
1024
+ accessibilityLabel: t("runner.ui.openRunner", "Open {name}", { name: run.name }),
1025
+ onPress: () => props.openTransientTab(runnerTab(run)),
1026
+ style: ({ pressed }) => [styles$1.row, pressed && styles$1.pressed],
1027
+ children: [/* @__PURE__ */ jsxs(View, {
1028
+ style: styles$1.line,
1029
+ children: [
1030
+ /* @__PURE__ */ jsx(Dot, {
719
1031
  tone: "yellow",
720
1032
  pulse: true
721
1033
  }),
722
- title: run.name,
723
- description: `${formatRunnerUptime(run.startedAt, now)}${run.interactive ? " · tty" : ""}`,
724
- onPress: () => props.openTransientTab(runnerLogTab(run))
725
- }),
726
- /* @__PURE__ */ jsx(Text, {
727
- numberOfLines: detail ? void 0 : 1,
728
- style: styles.meta,
729
- children: tail ?? run.command
730
- }),
731
- detail ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Text, {
732
- selectable: true,
733
- style: styles.meta,
734
- children: run.command
735
- }), /* @__PURE__ */ jsx(Text, {
736
- selectable: true,
737
- style: styles.meta,
738
- children: run.cwd
739
- })] }) : null,
740
- /* @__PURE__ */ jsxs(View, {
741
- style: styles.actions,
742
- children: [
743
- detail ? /* @__PURE__ */ jsx(Button, {
744
- variant: "outline",
745
- onPress: () => props.openTransientTab(runnerLogTab(run)),
746
- children: "Log"
747
- }) : null,
748
- detail && run.interactive && props.sessionId !== null ? /* @__PURE__ */ jsx(Button, {
749
- variant: "outline",
750
- onPress: () => props.openTransientTab(runnerShellTab(run)),
751
- children: "Shell"
752
- }) : null,
753
- props.sessionId !== null ? /* @__PURE__ */ jsx(Button, {
754
- testID: `activity-runner-stop-${run.id}`,
755
- variant: stopping ? "outline" : "danger-outline",
756
- disabled: stopping,
757
- onPress: () => {
758
- if (props.sessionId !== null) requestRunnerStop(props.sendSessionFrame, props.sessionId, run.id);
759
- },
760
- children: stopping ? "Stopping…" : "Stop"
761
- }) : null
762
- ]
763
- })
764
- ]
1034
+ /* @__PURE__ */ jsx(Text, {
1035
+ numberOfLines: 1,
1036
+ style: styles$1.name,
1037
+ children: run.name
1038
+ }),
1039
+ /* @__PURE__ */ jsx(RunnerUptime, { startedAt: run.startedAt }),
1040
+ props.sessionId !== null ? /* @__PURE__ */ jsx(Button, {
1041
+ testID: `activity-runner-stop-${run.id}`,
1042
+ size: "xs",
1043
+ variant: stopping ? "outline" : "danger-outline",
1044
+ disabled: stopping,
1045
+ onPress: () => {
1046
+ if (props.sessionId !== null) requestRunnerStop(props.sendSessionFrame, props.sessionId, run.id);
1047
+ },
1048
+ children: stopping ? t("runner.ui.stoppingLabelProgress", "Stopping…") : t("runner.ui.stopLabel", "Stop")
1049
+ }) : null
1050
+ ]
1051
+ }), /* @__PURE__ */ jsx(Text, {
1052
+ numberOfLines: 1,
1053
+ style: styles$1.tail,
1054
+ children: tail ?? `$ ${run.command}`
1055
+ })]
765
1056
  });
766
1057
  }
767
1058
  function RunnersActivitySection(props) {
1059
+ const t = useT();
768
1060
  const session = useRunners(props.sessionId);
769
- const running = session.runs.filter((run) => run.state === "running");
770
- const [now, setNow] = useState(() => Date.now());
771
- useEffect(() => {
772
- const timer = setInterval(() => setNow(Date.now()), 1e4);
773
- return () => clearInterval(timer);
774
- }, []);
1061
+ useSyncExternalStore(runnerActivitySource.subscribe, () => session.runs.filter((run) => isRunnerActivityVisible(run)).length);
1062
+ const running = session.runs.filter((run) => isRunnerActivityVisible(run));
775
1063
  return running.length === 0 ? /* @__PURE__ */ jsxs(View, {
776
- style: styles.row,
1064
+ style: styles$1.idle,
777
1065
  children: [/* @__PURE__ */ jsx(Text, {
778
- style: styles.meta,
779
- children: "Idle"
780
- }), props.sessionId !== null ? /* @__PURE__ */ jsx(Button, {
781
- variant: "ghost",
1066
+ style: styles$1.meta,
1067
+ children: t("runner.ui.idleLabel", "Idle")
1068
+ }), props.sessionId !== null ? /* @__PURE__ */ jsxs(Pressable, {
1069
+ accessibilityRole: "button",
782
1070
  testID: "activity-runner-launch",
1071
+ hitSlop: 10,
783
1072
  onPress: () => props.openTransientTab(runnersTab()),
784
- children: "Launch a runner"
1073
+ style: styles$1.launch,
1074
+ children: [/* @__PURE__ */ jsx(Text, {
1075
+ style: styles$1.launchText,
1076
+ children: t("runner.ui.launchARunnerLabel", "Launch a runner")
1077
+ }), /* @__PURE__ */ jsx(ArrowRightIcon, {
1078
+ size: 14,
1079
+ color: "green"
1080
+ })]
785
1081
  }) : null]
786
1082
  }) : /* @__PURE__ */ jsx(View, { children: running.map((run) => /* @__PURE__ */ jsx(RunnerRow, {
787
1083
  run,
788
1084
  props,
789
- now,
790
1085
  stopping: session.stopRequested.includes(run.id)
791
1086
  }, run.id)) });
792
1087
  }
1088
+ /**
1089
+ * Every running runner and the one place to start another: type a command
1090
+ * and Run hosts it on a terminal (plain output when the host has no rmux or
1091
+ * tmux), or leave it empty for a login shell. The started runner opens on
1092
+ * its own screen.
1093
+ */
793
1094
  function RunnersPanel(props) {
1095
+ const t = useT();
794
1096
  const { openTransientTab } = props;
795
1097
  const session = useRunners(props.sessionId);
796
1098
  const running = session.runs.filter((run) => run.state === "running");
797
- const [launching, setLaunching] = useState(false);
798
- const [now, setNow] = useState(() => Date.now());
1099
+ const [command, setCommand] = useState("");
1100
+ const [cwd, setCwd] = useState("");
799
1101
  const baseline = useRef(null);
1102
+ /** What the pending launch ran, put back if the start fails. */
1103
+ const launched = useRef("");
800
1104
  const timeout = useRef(void 0);
801
- useEffect(() => {
802
- const timer = setInterval(() => setNow(Date.now()), 1e4);
803
- return () => clearInterval(timer);
804
- }, []);
805
1105
  useEffect(() => {
806
1106
  if (baseline.current === null) return;
807
- const shell = session.runs.find((run) => run.state === "running" && run.interactive && !baseline.current?.has(run.id));
808
- if (shell === void 0) return;
1107
+ const started = session.runs.find((run) => run.state === "running" && !baseline.current?.has(run.id));
1108
+ if (started === void 0) return;
809
1109
  baseline.current = null;
810
1110
  clearTimeout(timeout.current);
811
- openTransientTab(runnerShellTab(shell));
1111
+ openTransientTab(runnerTab(started));
812
1112
  }, [session.runs, openTransientTab]);
1113
+ const failureId = session.startFailure?.id;
1114
+ useEffect(() => {
1115
+ if (failureId === void 0 || baseline.current === null) return;
1116
+ baseline.current = null;
1117
+ clearTimeout(timeout.current);
1118
+ setCommand(launched.current);
1119
+ }, [failureId]);
813
1120
  useEffect(() => () => clearTimeout(timeout.current), []);
1121
+ const launch = () => {
1122
+ if (props.sessionId === null) return;
1123
+ baseline.current = new Set(session.runs.map((run) => run.id));
1124
+ clearTimeout(timeout.current);
1125
+ timeout.current = setTimeout(() => {
1126
+ baseline.current = null;
1127
+ }, 3e4);
1128
+ requestRunnerStart(props.sendSessionFrame, props.sessionId, runnerRunRequest(command, cwd));
1129
+ launched.current = command;
1130
+ setCommand("");
1131
+ };
814
1132
  return /* @__PURE__ */ jsxs(View, {
815
- style: styles.panel,
1133
+ style: styles$1.panel,
816
1134
  children: [
817
- /* @__PURE__ */ jsx(Text, {
818
- style: styles.title,
819
- children: running.length === 0 ? "Nothing running" : `${running.length} running`
820
- }),
821
- props.sessionId !== null ? /* @__PURE__ */ jsxs(View, {
822
- style: styles.actions,
823
- children: [/* @__PURE__ */ jsx(Button, {
824
- variant: "outline",
825
- onPress: () => {
826
- if (props.sessionId === null) return;
827
- baseline.current = new Set(session.runs.map((run) => run.id));
828
- clearTimeout(timeout.current);
829
- timeout.current = setTimeout(() => {
830
- baseline.current = null;
831
- }, 3e4);
832
- requestRunnerStart(props.sendSessionFrame, props.sessionId, RUNNER_SHELL_REQUEST);
833
- },
834
- children: "Start shell"
835
- }), /* @__PURE__ */ jsx(Button, {
836
- onPress: () => setLaunching(true),
837
- children: "Run command"
1135
+ /* @__PURE__ */ jsxs(View, {
1136
+ style: styles$1.header,
1137
+ children: [/* @__PURE__ */ jsx(Text, {
1138
+ style: styles$1.title,
1139
+ children: t("runner.ui.runnersLabel", "Runners")
1140
+ }), /* @__PURE__ */ jsx(Text, {
1141
+ style: styles$1.meta,
1142
+ children: running.length === 0 ? t("runner.ui.nothingRunningLabel", "Nothing running") : t("runner.ui.runningCount", "{count} running", { count: running.length })
838
1143
  })]
1144
+ }),
1145
+ props.sessionId !== null ? /* @__PURE__ */ jsx(RunnerCommandBar, {
1146
+ command,
1147
+ onCommandChange: setCommand,
1148
+ cwd,
1149
+ onCwdChange: setCwd,
1150
+ folders: running.map((run) => run.cwd),
1151
+ ...session.sessionDirectory === void 0 ? {} : { sessionDirectory: session.sessionDirectory },
1152
+ ...session.startFailure === void 0 ? {} : { problem: session.startFailure.message },
1153
+ onLaunch: launch
839
1154
  }) : null,
840
- /* @__PURE__ */ jsx(ScrollView, { children: running.length === 0 ? /* @__PURE__ */ jsx(Text, {
841
- style: styles.meta,
842
- children: "A command that outlives its turn moves to a runner and appears here while it works."
843
- }) : running.map((run) => /* @__PURE__ */ jsx(RunnerRow, {
844
- run,
845
- props,
846
- now,
847
- stopping: session.stopRequested.includes(run.id),
848
- detail: true
849
- }, run.id)) }),
850
- launching && props.sessionId !== null ? /* @__PURE__ */ jsx(LaunchRunnerSheet, {
851
- sessionId: props.sessionId,
852
- send: props.sendSessionFrame,
853
- defaultCwd: running[0]?.cwd,
854
- onClose: () => setLaunching(false)
855
- }) : null
1155
+ /* @__PURE__ */ jsx(ScrollView, { children: running.length === 0 && props.sessionId !== null && session.loaded !== true ? /* @__PURE__ */ jsx(LoadingState, {
1156
+ testID: "runners-panel-loading",
1157
+ label: t("runner.ui.loadingRunnersLabel", "Loading runners")
1158
+ }) : running.length === 0 ? /* @__PURE__ */ jsx(EmptyState, {
1159
+ testID: "runners-panel-empty",
1160
+ icon: /* @__PURE__ */ jsx(TerminalIcon, { size: 20 }),
1161
+ title: t("runner.ui.nothingRunningYetLabel", "Nothing running yet"),
1162
+ description: props.sessionId === null ? t("runner.ui.openSessionHint", "Open a session to start a runner.") : t("runner.ui.launchHint", "Type a command above, like pnpm dev, and it opens here as a live terminal.")
1163
+ }) : running.map((run) => /* @__PURE__ */ jsx(ListRow, {
1164
+ leading: /* @__PURE__ */ jsx(Dot, {
1165
+ tone: "yellow",
1166
+ pulse: true
1167
+ }),
1168
+ title: run.name,
1169
+ description: /* @__PURE__ */ jsxs(View, {
1170
+ style: styles$1.line,
1171
+ children: [/* @__PURE__ */ jsxs(Text, {
1172
+ style: styles$1.meta,
1173
+ children: [run.command, " · "]
1174
+ }), /* @__PURE__ */ jsx(RunnerUptime, { startedAt: run.startedAt })]
1175
+ }),
1176
+ disclosure: true,
1177
+ onPress: () => openTransientTab(runnerTab(run))
1178
+ }, run.id)) })
856
1179
  ]
857
1180
  });
858
1181
  }
859
- const styles = StyleSheet.create((theme) => ({
1182
+ function RunnerUptime({ startedAt }) {
1183
+ const t = useT();
1184
+ return /* @__PURE__ */ jsx(LiveDuration, {
1185
+ label: t("runner.ui.running", "running"),
1186
+ since: Date.parse(startedAt),
1187
+ style: styles$1.meta
1188
+ });
1189
+ }
1190
+ const styles$1 = StyleSheet.create((theme) => ({
860
1191
  panel: {
861
1192
  flex: 1,
862
- gap: theme.spacing(2),
863
- padding: theme.spacing(3),
1193
+ gap: theme.spacing(3),
1194
+ padding: theme.spacing(4),
864
1195
  backgroundColor: theme.colors.bg,
865
1196
  uni__dependencies: [0]
866
1197
  },
1198
+ header: {
1199
+ flexDirection: "row",
1200
+ alignItems: "center",
1201
+ gap: theme.spacing(2),
1202
+ uni__dependencies: [0]
1203
+ },
867
1204
  row: {
868
1205
  gap: theme.spacing(1),
869
1206
  paddingVertical: theme.spacing(2),
870
1207
  uni__dependencies: [0]
871
1208
  },
872
- actions: {
1209
+ pressed: { opacity: .6 },
1210
+ line: {
873
1211
  flexDirection: "row",
874
- flexWrap: "wrap",
1212
+ alignItems: "center",
875
1213
  gap: theme.spacing(2),
876
1214
  uni__dependencies: [0]
877
1215
  },
878
- title: {
1216
+ name: {
1217
+ flex: 1,
879
1218
  color: theme.colors.hi,
880
1219
  fontFamily: fontOf(theme.fontFamily.sans),
881
1220
  fontSize: theme.fontSize.base,
1221
+ lineHeight: theme.lineHeight.base,
1222
+ fontWeight: theme.fontWeight.medium,
1223
+ uni__dependencies: [0]
1224
+ },
1225
+ tail: {
1226
+ paddingLeft: theme.spacing(3.5),
1227
+ color: theme.colors.dim,
1228
+ fontFamily: fontOf(theme.fontFamily.mono),
1229
+ fontSize: theme.fontSize.sm,
1230
+ lineHeight: theme.lineHeight.sm,
1231
+ uni__dependencies: [0]
1232
+ },
1233
+ title: {
1234
+ color: theme.colors.hi,
1235
+ fontFamily: fontOf(theme.fontFamily.sans),
1236
+ fontSize: theme.fontSize.lg,
882
1237
  fontWeight: "600",
883
1238
  uni__dependencies: [0]
884
1239
  },
@@ -888,22 +1243,73 @@ const styles = StyleSheet.create((theme) => ({
888
1243
  fontSize: theme.fontSize.sm,
889
1244
  lineHeight: theme.lineHeight.sm,
890
1245
  uni__dependencies: [0]
1246
+ },
1247
+ idle: {
1248
+ flexDirection: "row",
1249
+ alignItems: "center",
1250
+ flexWrap: "wrap",
1251
+ gap: theme.spacing(4),
1252
+ uni__dependencies: [0]
1253
+ },
1254
+ launch: {
1255
+ flexDirection: "row",
1256
+ alignItems: "center",
1257
+ gap: theme.spacing(1),
1258
+ uni__dependencies: [0]
1259
+ },
1260
+ launchText: {
1261
+ color: theme.colors.green,
1262
+ fontFamily: fontOf(theme.fontFamily.sans),
1263
+ fontSize: theme.fontSize.base,
1264
+ lineHeight: theme.lineHeight.base,
1265
+ fontWeight: theme.fontWeight.medium,
1266
+ uni__dependencies: [0]
891
1267
  }
892
1268
  }));
893
1269
  //#endregion
894
1270
  //#region src/extensions/workspaces/sessions/(frontend)/activity-group/runners.native.ts
895
1271
  var runners_native_default = defineActivityGroup({
1272
+ label: (t) => t("runner.activityGroup.label", "Runners"),
896
1273
  name: "runners",
897
1274
  keys: "r l",
898
- statusKey: "po-runner-runners",
1275
+ icon: () => createElement(PlayCircleIcon),
899
1276
  activeSource: runnerActivitySource,
900
- transientTab: runnersTab,
901
- order: 20
1277
+ transientTab: runnersTab
902
1278
  });
903
1279
  //#endregion
904
1280
  //#region src/extensions/workspaces/sessions/(frontend)/channel/runner-runs.native.ts
905
1281
  var runner_runs_native_default = defineChannelFile(runnerRunsChannel);
906
1282
  //#endregion
1283
+ //#region src/extensions/workspaces/sessions/(frontend)/fill/Runner.help.guides.native.ts
1284
+ var Runner_help_guides_native_default = defineFill({
1285
+ slot: "help.guides",
1286
+ id: "Runner",
1287
+ order: 160,
1288
+ data: {
1289
+ version: 1,
1290
+ category: "tools",
1291
+ labelKey: "runner.guides.runner",
1292
+ label: "Runner",
1293
+ guides: [{
1294
+ id: "about",
1295
+ questionKey: "runner.guides.whatDoesRunnerDo",
1296
+ question: "What does Runner do?",
1297
+ order: 0,
1298
+ answerKey: "runner.guides.runnerRunsShellCommandsForPoAndKeepsFullLogsLongCommandsCanContinueInTheBackgroundWhilePoWorksOnOtherThings",
1299
+ answer: "Runner runs shell commands for Po and keeps full logs. Long commands can continue in the background while Po works on other things.",
1300
+ keywords: ["shell", "background"]
1301
+ }, {
1302
+ id: "use",
1303
+ questionKey: "runner.guides.howDoICheckOrStopACommand",
1304
+ question: "How do I check or stop a command?",
1305
+ order: 1,
1306
+ answerKey: "runner.guides.askPoToCheckARunnerReadItsFullLogOrStopItARunnerIDMeansWorkIsBeingTrackedNotThatItSucceeded",
1307
+ answer: "Ask Po to check a runner, read its full log, or stop it. A runner ID means work is being tracked, not that it succeeded.",
1308
+ keywords: ["logs", "cancel"]
1309
+ }]
1310
+ }
1311
+ });
1312
+ //#endregion
907
1313
  //#region src/extensions/workspaces/sessions/(frontend)/fill/Runners.activity.runners.native.tsx
908
1314
  var Runners_activity_runners_native_default = defineFill({
909
1315
  slot: "activity.runners",
@@ -911,13 +1317,452 @@ var Runners_activity_runners_native_default = defineFill({
911
1317
  component: RunnersActivitySection
912
1318
  });
913
1319
  //#endregion
1320
+ //#region src/extensions/workspaces/sessions/(frontend)/tool/_lib/bashToolFormat.ts
1321
+ const ELLIPSIS = "…";
1322
+ /** Spaced so the join never glues two words into one unreadable token. */
1323
+ const GAP = " … ";
1324
+ /** Wide enough to keep a realistic command intact, short enough to stay on a few rows. */
1325
+ const MAX_COMMAND_LENGTH = 160;
1326
+ /** Live output is unbounded while a command runs, so the running state keeps only a window. */
1327
+ const STREAM_TAIL_LINES = 12;
1328
+ const BYTES_PER_KB = 1024;
1329
+ const BYTES_PER_MB = BYTES_PER_KB * BYTES_PER_KB;
1330
+ /** The user's home on the two platforms the runner ships for; the browser cannot ask the OS. */
1331
+ const HOME_PATH = /(?<![\w.-])(?:\/Users|\/home)\/[^/\s]+(?=\/|\s|$)/g;
1332
+ function isRecord(value) {
1333
+ return typeof value === "object" && value !== null && !Array.isArray(value);
1334
+ }
1335
+ /** Narrows the result details to the fields the card reads; anything else is ignored. */
1336
+ function bashResultDetails(details) {
1337
+ if (!isRecord(details)) return {};
1338
+ const out = {};
1339
+ if (typeof details.id === "string") out.id = details.id;
1340
+ if (typeof details.runner === "string") out.runner = details.runner;
1341
+ if (typeof details.exitCode === "number" || details.exitCode === null) out.exitCode = details.exitCode;
1342
+ if (typeof details.logPath === "string") out.logPath = details.logPath;
1343
+ if (typeof details.fileSize === "number") out.fileSize = details.fileSize;
1344
+ if (typeof details.lines === "number") out.lines = details.lines;
1345
+ if (details.timedOut === true) out.timedOut = true;
1346
+ if (details.promoted === true) out.promoted = true;
1347
+ if (typeof details.reason === "string") out.reason = details.reason;
1348
+ if (typeof details.tail === "string") out.tail = details.tail;
1349
+ if (typeof details.tailLines === "number") out.tailLines = details.tailLines;
1350
+ if (typeof details.sequenceId === "string") {
1351
+ out.sequenceId = details.sequenceId;
1352
+ if (Array.isArray(details.stages)) out.stages = details.stages.flatMap((stage) => {
1353
+ if (!isRecord(stage) || !Number.isInteger(stage.index) || Number(stage.index) < 0 || typeof stage.state !== "string") return [];
1354
+ return [{
1355
+ index: Number(stage.index),
1356
+ state: stage.state,
1357
+ ...typeof stage.logPath === "string" ? { logPath: stage.logPath } : {}
1358
+ }];
1359
+ });
1360
+ }
1361
+ return out;
1362
+ }
1363
+ /** `/Users/me/x` becomes `~/x`. Absolute home paths are what push these lines onto extra rows. */
1364
+ function abbreviateHome(text) {
1365
+ return text.replace(HOME_PATH, "~");
1366
+ }
1367
+ /** Collapse a heredoc or multi-line script to one scannable line plus a count. */
1368
+ function collapseCommand(command, t) {
1369
+ const lines = command.split("\n").map((line) => line.trim()).filter((line) => line.length > 0);
1370
+ const first = lines[0] ?? "";
1371
+ return lines.length > 1 ? t?.("runner.ui.commandMoreLines", "{command} … +{count} lines", {
1372
+ command: first,
1373
+ count: lines.length - 1
1374
+ }) ?? `${first} ${ELLIPSIS} +${lines.length - 1} lines` : first;
1375
+ }
1376
+ /** Drop the middle rather than the end, so a long pipeline keeps both its source and its sink. */
1377
+ function truncateMiddle(text, max = MAX_COMMAND_LENGTH) {
1378
+ if (text.length <= max) return text;
1379
+ const keep = max - 3;
1380
+ const head = Math.ceil(keep / 2);
1381
+ let start = text.slice(0, head);
1382
+ let end = text.slice(text.length - (keep - head));
1383
+ const lastSpace = start.lastIndexOf(" ");
1384
+ if (lastSpace > start.length / 2) start = start.slice(0, lastSpace);
1385
+ const firstSpace = end.indexOf(" ");
1386
+ if (firstSpace >= 0 && firstSpace < end.length / 2) end = end.slice(firstSpace + 1);
1387
+ return `${start}${GAP}${end}`;
1388
+ }
1389
+ /** Arrays are separate commands; the expanded body keeps their boundaries visible. */
1390
+ function bashCommandText(command) {
1391
+ if (typeof command === "string") return command;
1392
+ return Array.isArray(command) && command.every((entry) => typeof entry === "string") ? command.join("\n\n") : "";
1393
+ }
1394
+ function formatBashCommand(command, t) {
1395
+ const text = bashCommandText(command);
1396
+ if (text.length === 0) return "";
1397
+ const first = Array.isArray(command) ? bashCommandText(command[0]) : text;
1398
+ const suffix = Array.isArray(command) && command.length > 1 ? t?.("runner.ui.moreCommands", " … +{count} commands", { count: command.length - 1 }) ?? ` ${ELLIPSIS} +${command.length - 1} commands` : "";
1399
+ return truncateMiddle(`${abbreviateHome(collapseCommand(first, t))}${suffix}`);
1400
+ }
1401
+ /** Human-readable byte count, matching how pi reports output sizes. */
1402
+ function formatSize(bytes) {
1403
+ if (bytes < BYTES_PER_KB) return `${bytes} B`;
1404
+ if (bytes < BYTES_PER_MB) return `${(bytes / BYTES_PER_KB).toFixed(1)} KB`;
1405
+ return `${(bytes / BYTES_PER_MB).toFixed(1)} MB`;
1406
+ }
1407
+ /** The metadata footer, collapsed from five lines to one. */
1408
+ function formatResultSummary(details, t) {
1409
+ const parts = [];
1410
+ if (details.lines !== void 0) parts.push(t?.("runner.ui.lineCount", "{count} lines", { count: details.lines.toLocaleString("en-US") }) ?? `${details.lines.toLocaleString("en-US")} lines`);
1411
+ if (details.fileSize !== void 0) parts.push(formatSize(details.fileSize));
1412
+ if (details.runner !== void 0) parts.push(details.runner);
1413
+ return parts.join(" · ");
1414
+ }
1415
+ /** Last `max` lines, so a chatty command cannot push the transcript off screen. */
1416
+ function lastLines(text, max) {
1417
+ const all = text.split("\n");
1418
+ while (all.length > 0 && all[all.length - 1]?.trim() === "") all.pop();
1419
+ return all.length <= max ? all : all.slice(-max);
1420
+ }
1421
+ function bashResultView(input, t) {
1422
+ const details = bashResultDetails(input.details);
1423
+ const logs = (details.stages ?? []).flatMap((stage) => stage.logPath === void 0 ? [] : [t?.("runner.ui.stageLog", "stage {index} · {state} · {path}", {
1424
+ index: stage.index + 1,
1425
+ state: stage.state,
1426
+ path: stage.logPath
1427
+ }) ?? `stage ${stage.index + 1} · ${stage.state} · ${stage.logPath}`]);
1428
+ if (input.isPartial) return {
1429
+ lines: [...logs, ...lastLines(input.output, STREAM_TAIL_LINES)],
1430
+ status: {
1431
+ glyph: "◐",
1432
+ tone: "running",
1433
+ text: t?.("runner.ui.running", "running") ?? "running"
1434
+ },
1435
+ hidden: 0
1436
+ };
1437
+ if (input.isError) {
1438
+ const all = lastLines(details.sequenceId === void 0 ? input.output : details.tail ?? input.output, Number.MAX_SAFE_INTEGER);
1439
+ const lines = [...logs, ...input.expanded ? all : all.slice(-12)];
1440
+ const summary = formatResultSummary(details, t);
1441
+ return {
1442
+ lines,
1443
+ status: {
1444
+ glyph: "✗",
1445
+ tone: "error",
1446
+ text: summary.length > 0 ? summary : t?.("runner.ui.failed", "failed") ?? "failed"
1447
+ },
1448
+ hidden: Math.max(0, all.length + logs.length - lines.length)
1449
+ };
1450
+ }
1451
+ if (details.promoted === true) {
1452
+ const label = details.runner ?? details.id ?? "runner";
1453
+ const suffix = details.id === void 0 ? "" : ` · ${details.id}`;
1454
+ return {
1455
+ lines: logs,
1456
+ status: {
1457
+ glyph: "●",
1458
+ tone: "background",
1459
+ text: t?.("runner.ui.backgroundStatus", "{label}{suffix} · background", {
1460
+ label,
1461
+ suffix
1462
+ }) ?? `${label}${suffix} · background`
1463
+ },
1464
+ hidden: 0
1465
+ };
1466
+ }
1467
+ const all = lastLines(details.tail ?? (details.sequenceId === void 0 ? "" : input.output), Number.MAX_SAFE_INTEGER);
1468
+ const lines = [...logs, ...input.expanded ? all : all.slice(-12)];
1469
+ const exited = details.exitCode !== void 0 && details.exitCode !== null;
1470
+ const failed = details.timedOut === true || exited && details.exitCode !== 0;
1471
+ const meta = [];
1472
+ if (details.timedOut === true) meta.push(t?.("runner.ui.timedOut", "timed out") ?? "timed out");
1473
+ else if (failed) meta.push(t?.("runner.ui.exitCode", "exit {code}", { code: details.exitCode ?? "" }) ?? `exit ${details.exitCode}`);
1474
+ const summary = formatResultSummary(details, t);
1475
+ if (summary.length > 0) meta.push(summary);
1476
+ const text = meta.length > 0 ? meta.join(" · ") : failed ? t?.("runner.ui.failed", "failed") ?? "failed" : lines.length === 0 ? t?.("runner.ui.done", "done") ?? "done" : "";
1477
+ return {
1478
+ lines,
1479
+ status: text.length > 0 ? {
1480
+ glyph: failed ? "✗" : "✓",
1481
+ tone: failed ? "error" : "ok",
1482
+ text
1483
+ } : null,
1484
+ hidden: Math.max(0, all.length + logs.length - lines.length)
1485
+ };
1486
+ }
1487
+ /**
1488
+ * A promoted command's outcome, read from the runner the channel reports
1489
+ * rather than from the tool call, which returned when the run went to the
1490
+ * background. The card never reads Completed while the runner still runs.
1491
+ */
1492
+ function backgroundOutcome(run, t) {
1493
+ if (run === void 0) return {
1494
+ tone: "info",
1495
+ badge: t?.("runner.ui.inBackground", "In background") ?? "In background"
1496
+ };
1497
+ if (run.exit === void 0) return {
1498
+ tone: "running",
1499
+ badge: t?.("runner.ui.inBackground", "In background") ?? "In background"
1500
+ };
1501
+ const { reason, code } = run.exit;
1502
+ const exit = code === null ? "" : t?.("runner.ui.exitSuffix", " · exit {code}", { code }) ?? ` · exit ${code}`;
1503
+ if (reason === "completed") return {
1504
+ tone: "ok",
1505
+ badge: t?.("runner.ui.completedExit", "Completed{exit}", { exit }) ?? `Completed${exit}`
1506
+ };
1507
+ if (reason === "stopped") return {
1508
+ tone: "neutral",
1509
+ badge: t?.("runner.ui.stoppedLabel", "Stopped") ?? "Stopped"
1510
+ };
1511
+ return {
1512
+ tone: "error",
1513
+ badge: t?.("runner.ui.failedExit", "Failed{exit}", { exit }) ?? `Failed${exit}`
1514
+ };
1515
+ }
1516
+ //#endregion
1517
+ //#region src/extensions/workspaces/sessions/(frontend)/tool/_components/BashToolMessage.native.tsx
1518
+ const STATUS_TONE = {
1519
+ running: "running",
1520
+ ok: "ok",
1521
+ error: "error",
1522
+ background: "info"
1523
+ };
1524
+ /** Lets the shell grammar colour the command; the path is only a grammar hint. */
1525
+ const SHELL_HINT = { path: "command.sh" };
1526
+ const ANSI_CLASS_PREFIX = "text-po-";
1527
+ /**
1528
+ * The ANSI span's named colour as a theme token. Exact 256 and truecolour
1529
+ * runs stay in the output's own ink, since the phone keeps to theme tokens.
1530
+ */
1531
+ function ansiToken(className) {
1532
+ return className?.startsWith(ANSI_CLASS_PREFIX) === true ? className.slice(8) : void 0;
1533
+ }
1534
+ /** The command as it was run, wrapped and coloured as the shell it is. */
1535
+ function CommandText({ text }) {
1536
+ const lines = text.split("\n");
1537
+ const spans = useSyntaxLines(text, SHELL_HINT);
1538
+ return /* @__PURE__ */ jsx(ScrollView, {
1539
+ testID: "tool-result-bash-command",
1540
+ nestedScrollEnabled: true,
1541
+ style: styles.commandBox,
1542
+ children: lines.map((line, index) => /* @__PURE__ */ jsx(SyntaxLine, {
1543
+ selectable: true,
1544
+ spans: spans?.[index],
1545
+ text: line,
1546
+ style: [styles.mono, styles.text]
1547
+ }, index))
1548
+ });
1549
+ }
1550
+ /** The tail with the colours the command wrote, bounded so one chatty command cannot own the card. */
1551
+ function OutputText({ text }) {
1552
+ return /* @__PURE__ */ jsx(ScrollView, {
1553
+ testID: "tool-result-bash-output",
1554
+ nestedScrollEnabled: true,
1555
+ style: styles.outputBox,
1556
+ children: /* @__PURE__ */ jsx(Text, {
1557
+ selectable: true,
1558
+ style: [styles.mono, styles.dim],
1559
+ children: ansiSpans(text).map((span, index) => {
1560
+ const token = ansiToken(span.className);
1561
+ return /* @__PURE__ */ jsx(Text, {
1562
+ style: [
1563
+ token !== void 0 && styles.ink(token),
1564
+ span.bold === true && styles.bold,
1565
+ span.italic === true && styles.italic,
1566
+ span.underline === true && styles.underline
1567
+ ],
1568
+ children: span.text
1569
+ }, index);
1570
+ })
1571
+ })
1572
+ });
1573
+ }
1574
+ /**
1575
+ * The bash tool's timeline item on native, as the web's: the command shortened
1576
+ * to one row in the header with the runner's log and stop beside it, and once
1577
+ * expanded the command as it was run, the tail, its status and the log path.
1578
+ * A failed call shows only the reason in red; the header carries the failure.
1579
+ */
1580
+ function BashToolMessage({ sessionId, args, result, output, running, isError, sendSessionFrame, openTransientTab }) {
1581
+ const t = useT();
1582
+ const details = bashResultDetails(result?.details);
1583
+ const processId = details.sequenceId === void 0 ? details.id : void 0;
1584
+ const runnerId = details.promoted === true ? processId : void 0;
1585
+ const session = useRunners(sessionId);
1586
+ const run = processId === void 0 ? void 0 : session.runs.find((entry) => entry.id === processId);
1587
+ const stopping = runnerId !== void 0 && session.stopRequested.includes(runnerId);
1588
+ const rawCommand = bashCommandText(args.command);
1589
+ const command = formatBashCommand(args.command, t);
1590
+ const stoppable = sessionId !== null && runnerId !== void 0 && run !== void 0 && run.exit === void 0;
1591
+ const background = runnerId === void 0 ? void 0 : backgroundOutcome(run, t);
1592
+ return /* @__PURE__ */ jsx(MessageItem, {
1593
+ tone: background?.tone ?? toolTone({
1594
+ running,
1595
+ isError
1596
+ }),
1597
+ expandable: true,
1598
+ children: ({ expanded }) => {
1599
+ const view = bashResultView({
1600
+ details: result?.details,
1601
+ output,
1602
+ expanded: true,
1603
+ isPartial: running,
1604
+ isError
1605
+ }, t);
1606
+ const reason = view.lines.length > 0 ? view.lines.join("\n") : output;
1607
+ return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(MessageItemHeader, {
1608
+ title: "bash",
1609
+ ...background ? { badge: background.badge } : {},
1610
+ children: /* @__PURE__ */ jsxs(View, {
1611
+ testID: "tool-call-bash",
1612
+ style: styles.summary,
1613
+ children: [
1614
+ /* @__PURE__ */ jsx(Text, {
1615
+ numberOfLines: 1,
1616
+ style: [styles.mono, styles.command],
1617
+ children: command
1618
+ }),
1619
+ run !== void 0 && sessionId !== null ? /* @__PURE__ */ jsx(Button, {
1620
+ variant: "outline",
1621
+ size: "xs",
1622
+ testID: "tool-result-bash-open-log",
1623
+ accessibilityLabel: t("runner.ui.openThisRunnersFullLog", "open this runner's full log"),
1624
+ onPress: () => openTransientTab(runnerLogTab(run)),
1625
+ children: /* @__PURE__ */ jsxs(View, {
1626
+ style: styles.buttonLabel,
1627
+ children: [/* @__PURE__ */ jsx(FileIcon, { size: 10 }), /* @__PURE__ */ jsx(Text, {
1628
+ style: [styles.sans, styles.buttonText],
1629
+ children: t("runner.ui.log", "log")
1630
+ })]
1631
+ })
1632
+ }) : null,
1633
+ stoppable ? /* @__PURE__ */ jsx(Button, {
1634
+ size: "xs",
1635
+ variant: stopping ? "outline" : "danger-outline",
1636
+ disabled: stopping,
1637
+ testID: "tool-result-bash-stop",
1638
+ accessibilityLabel: stopping ? t("runner.ui.stopRequestedTheRunnerReportsItsOwnExit", "stop requested; the runner reports its own exit") : t("runner.ui.askTheRuntimeToStopThisRunner", "ask the runtime to stop this runner"),
1639
+ onPress: () => {
1640
+ if (sessionId !== null && runnerId !== void 0) requestRunnerStop(sendSessionFrame, sessionId, runnerId);
1641
+ },
1642
+ children: stopping ? t("runner.ui.stoppingProgress", "stopping…") : t("runner.ui.stop", "stop")
1643
+ }) : null
1644
+ ]
1645
+ })
1646
+ }), !expanded ? null : isError ? /* @__PURE__ */ jsx(MessageItemBody, {
1647
+ testID: "tool-result-bash",
1648
+ children: /* @__PURE__ */ jsx(Text, {
1649
+ selectable: true,
1650
+ style: [styles.mono, styles.error],
1651
+ children: reason
1652
+ })
1653
+ }) : /* @__PURE__ */ jsxs(MessageItemBody, {
1654
+ testID: "tool-result-bash",
1655
+ style: styles.body,
1656
+ children: [
1657
+ rawCommand.length > 0 ? /* @__PURE__ */ jsx(CommandText, { text: rawCommand }) : null,
1658
+ view.lines.length > 0 ? /* @__PURE__ */ jsx(OutputText, { text: view.lines.join("\n") }) : null,
1659
+ view.status ? /* @__PURE__ */ jsx(MessageItemStatus, {
1660
+ testID: "tool-result-bash-status",
1661
+ tone: STATUS_TONE[view.status.tone],
1662
+ glyph: view.status.glyph,
1663
+ children: view.status.text
1664
+ }) : null,
1665
+ details.sequenceId === void 0 && details.logPath !== void 0 ? /* @__PURE__ */ jsxs(Text, {
1666
+ testID: "tool-result-bash-log",
1667
+ selectable: true,
1668
+ style: [styles.sans, styles.dim],
1669
+ children: [t("runner.ui.fullLog", "full log ·"), details.logPath]
1670
+ }) : null
1671
+ ]
1672
+ })] });
1673
+ }
1674
+ });
1675
+ }
1676
+ const styles = StyleSheet.create((theme) => ({
1677
+ summary: {
1678
+ flex: 1,
1679
+ flexDirection: "row",
1680
+ alignItems: "center",
1681
+ gap: theme.spacing(2),
1682
+ minWidth: 0,
1683
+ uni__dependencies: [0]
1684
+ },
1685
+ sans: {
1686
+ fontFamily: fontOf(theme.fontFamily.sans),
1687
+ fontSize: theme.fontSize.base,
1688
+ lineHeight: theme.lineHeight.base,
1689
+ uni__dependencies: [0]
1690
+ },
1691
+ mono: {
1692
+ fontFamily: fontOf(theme.fontFamily.mono),
1693
+ fontSize: theme.fontSize.sm,
1694
+ lineHeight: theme.lineHeightRelaxed.sm,
1695
+ uni__dependencies: [0]
1696
+ },
1697
+ command: {
1698
+ flex: 1,
1699
+ minWidth: 0,
1700
+ color: theme.colors.text,
1701
+ uni__dependencies: [0]
1702
+ },
1703
+ buttonLabel: {
1704
+ flexDirection: "row",
1705
+ alignItems: "center",
1706
+ gap: theme.spacing(1),
1707
+ uni__dependencies: [0]
1708
+ },
1709
+ buttonText: {
1710
+ fontSize: theme.fontSize.xs,
1711
+ color: theme.colors.text,
1712
+ uni__dependencies: [0]
1713
+ },
1714
+ body: {
1715
+ gap: theme.spacing(2),
1716
+ uni__dependencies: [0]
1717
+ },
1718
+ commandBox: { maxHeight: 160 },
1719
+ outputBox: {
1720
+ maxHeight: 384,
1721
+ borderTopWidth: 1,
1722
+ borderTopColor: theme.colors["border-soft"],
1723
+ paddingTop: theme.spacing(2),
1724
+ uni__dependencies: [0]
1725
+ },
1726
+ text: {
1727
+ color: theme.colors.text,
1728
+ uni__dependencies: [0]
1729
+ },
1730
+ dim: {
1731
+ color: theme.colors.dim,
1732
+ uni__dependencies: [0]
1733
+ },
1734
+ error: {
1735
+ color: theme.colors.red,
1736
+ uni__dependencies: [0]
1737
+ },
1738
+ ink: (token) => ({
1739
+ color: theme.colors[token],
1740
+ uni__dependencies: [0]
1741
+ }),
1742
+ bold: { fontWeight: "bold" },
1743
+ italic: { fontStyle: "italic" },
1744
+ underline: { textDecorationLine: "underline" }
1745
+ }));
1746
+ //#endregion
1747
+ //#region src/extensions/workspaces/sessions/(frontend)/tool/bash.native.tsx
1748
+ var bash_native_default = defineToolRenderer({ message: BashToolMessage });
1749
+ //#endregion
914
1750
  //#region generated/native.ts
915
- const via = (identity, value) => value === void 0 ? void 0 : {
916
- ...identity,
917
- ...value
1751
+ const via = (identity, value) => {
1752
+ if (value === void 0) return void 0;
1753
+ const declaration = value;
1754
+ return {
1755
+ ...identity,
1756
+ ...declaration,
1757
+ ...declaration.relations === void 0 ? {} : { relations: declaration.relations.map((relation) => ({
1758
+ evidence: "declared",
1759
+ ...relation
1760
+ })) }
1761
+ };
918
1762
  };
919
1763
  const nativePlugin = defineNativePlugin({
920
1764
  id: "runner",
1765
+ packageName: "@agimon-ai/po-runner",
921
1766
  session: {
922
1767
  get activityGroups() {
923
1768
  return [via({ name: "runners" }, runners_native_default)];
@@ -927,9 +1772,15 @@ const nativePlugin = defineNativePlugin({
927
1772
  },
928
1773
  get fills() {
929
1774
  return [via({
1775
+ slot: "help.guides",
1776
+ id: "runner"
1777
+ }, Runner_help_guides_native_default), via({
930
1778
  slot: "activity.runners",
931
1779
  id: "runners"
932
1780
  }, Runners_activity_runners_native_default)];
1781
+ },
1782
+ get toolRenderers() {
1783
+ return [via({ tools: ["bash"] }, bash_native_default)];
933
1784
  }
934
1785
  }
935
1786
  });