@agimon-ai/po-runner 0.0.0-alpha.1 → 0.0.0-stage

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 (322) hide show
  1. package/README.md +2 -256
  2. package/package.json +3 -300
  3. package/LICENSE +0 -21
  4. package/dist/ansiScrub-CsqTSaVT.mjs +0 -71
  5. package/dist/ansiScrub-CsqTSaVT.mjs.map +0 -1
  6. package/dist/ansiScrub-D5gpHDch.cjs +0 -100
  7. package/dist/ansiScrub-D5gpHDch.cjs.map +0 -1
  8. package/dist/ansiScrub.cjs +0 -7
  9. package/dist/ansiScrub.d.mts +0 -26
  10. package/dist/ansiScrub.d.mts.map +0 -1
  11. package/dist/ansiScrub.mjs +0 -2
  12. package/dist/apiContracts.cjs +0 -162
  13. package/dist/apiContracts.cjs.map +0 -1
  14. package/dist/apiContracts.d.mts +0 -53
  15. package/dist/apiContracts.d.mts.map +0 -1
  16. package/dist/apiContracts.mjs +0 -157
  17. package/dist/apiContracts.mjs.map +0 -1
  18. package/dist/bashResult-DNgtahGR.cjs +0 -629
  19. package/dist/bashResult-DNgtahGR.cjs.map +0 -1
  20. package/dist/bashResult-DcrRaBLv.d.mts +0 -49
  21. package/dist/bashResult-DcrRaBLv.d.mts.map +0 -1
  22. package/dist/bashResult-bIVSzoj-.mjs +0 -546
  23. package/dist/bashResult-bIVSzoj-.mjs.map +0 -1
  24. package/dist/bashRunService-CJ02XaAq.mjs +0 -440
  25. package/dist/bashRunService-CJ02XaAq.mjs.map +0 -1
  26. package/dist/bashRunService-Ci0cGdYO.d.mts +0 -71
  27. package/dist/bashRunService-Ci0cGdYO.d.mts.map +0 -1
  28. package/dist/bashRunService-DyqxOSlx.cjs +0 -445
  29. package/dist/bashRunService-DyqxOSlx.cjs.map +0 -1
  30. package/dist/bashRunService.cjs +0 -3
  31. package/dist/bashRunService.d.mts +0 -36
  32. package/dist/bashRunService.d.mts.map +0 -1
  33. package/dist/bashRunService.mjs +0 -2
  34. package/dist/bashSchema.cjs +0 -5
  35. package/dist/bashSchema.d.mts +0 -7
  36. package/dist/bashSchema.d.mts.map +0 -1
  37. package/dist/bashSchema.mjs +0 -2
  38. package/dist/bashTool-B1EwZLo_.d.mts +0 -20
  39. package/dist/bashTool-B1EwZLo_.d.mts.map +0 -1
  40. package/dist/bashTool-C-k7fmyh.mjs +0 -24
  41. package/dist/bashTool-C-k7fmyh.mjs.map +0 -1
  42. package/dist/bashTool-CdgtqVFD.cjs +0 -41
  43. package/dist/bashTool-CdgtqVFD.cjs.map +0 -1
  44. package/dist/bashTool.cjs +0 -13
  45. package/dist/bashTool.cjs.map +0 -1
  46. package/dist/bashTool.d.mts +0 -8
  47. package/dist/bashTool.d.mts.map +0 -1
  48. package/dist/bashTool.mjs +0 -11
  49. package/dist/bashTool.mjs.map +0 -1
  50. package/dist/bin/cli.cjs +0 -78
  51. package/dist/bin/cli.cjs.map +0 -1
  52. package/dist/bin/cli.d.mts +0 -4
  53. package/dist/bin/cli.d.mts.map +0 -1
  54. package/dist/bin/cli.mjs +0 -77
  55. package/dist/bin/cli.mjs.map +0 -1
  56. package/dist/bin/logSink.cjs +0 -102
  57. package/dist/bin/logSink.cjs.map +0 -1
  58. package/dist/bin/logSink.d.mts +0 -4
  59. package/dist/bin/logSink.d.mts.map +0 -1
  60. package/dist/bin/logSink.mjs +0 -99
  61. package/dist/bin/logSink.mjs.map +0 -1
  62. package/dist/bin/runnerHost.cjs +0 -131
  63. package/dist/bin/runnerHost.cjs.map +0 -1
  64. package/dist/bin/runnerHost.d.mts +0 -4
  65. package/dist/bin/runnerHost.d.mts.map +0 -1
  66. package/dist/bin/runnerHost.mjs +0 -127
  67. package/dist/bin/runnerHost.mjs.map +0 -1
  68. package/dist/cliApp-Dj9nwaOv.cjs +0 -244
  69. package/dist/cliApp-Dj9nwaOv.cjs.map +0 -1
  70. package/dist/cliApp-v8Z3rMCi.mjs +0 -237
  71. package/dist/cliApp-v8Z3rMCi.mjs.map +0 -1
  72. package/dist/cliApp.cjs +0 -3
  73. package/dist/cliApp.d.mts +0 -18
  74. package/dist/cliApp.d.mts.map +0 -1
  75. package/dist/cliApp.mjs +0 -2
  76. package/dist/clock-Cv2pddgo.mjs +0 -16
  77. package/dist/clock-Cv2pddgo.mjs.map +0 -1
  78. package/dist/clock-euJkweLq.d.mts +0 -11
  79. package/dist/clock-euJkweLq.d.mts.map +0 -1
  80. package/dist/clock-jqnLWziT.cjs +0 -21
  81. package/dist/clock-jqnLWziT.cjs.map +0 -1
  82. package/dist/clock.cjs +0 -3
  83. package/dist/clock.d.mts +0 -10
  84. package/dist/clock.d.mts.map +0 -1
  85. package/dist/clock.mjs +0 -2
  86. package/dist/compaction-4QSUsBxq.cjs +0 -40
  87. package/dist/compaction-4QSUsBxq.cjs.map +0 -1
  88. package/dist/compaction-DCw80VZj.mjs +0 -29
  89. package/dist/compaction-DCw80VZj.mjs.map +0 -1
  90. package/dist/compaction.cjs +0 -4
  91. package/dist/compaction.d.mts +0 -10
  92. package/dist/compaction.d.mts.map +0 -1
  93. package/dist/compaction.mjs +0 -2
  94. package/dist/config.cjs +0 -41
  95. package/dist/config.d.mts +0 -2
  96. package/dist/config.mjs +0 -2
  97. package/dist/extensions/mcp-ui.mjs +0 -23
  98. package/dist/extensions/mcp-ui.mjs.map +0 -1
  99. package/dist/extensions/mcp.cjs +0 -142
  100. package/dist/extensions/mcp.cjs.map +0 -1
  101. package/dist/extensions/mcp.d.mts +0 -5
  102. package/dist/extensions/mcp.d.mts.map +0 -1
  103. package/dist/extensions/mcp.mjs +0 -114
  104. package/dist/extensions/mcp.mjs.map +0 -1
  105. package/dist/extensions/server.cjs +0 -1156
  106. package/dist/extensions/server.cjs.map +0 -1
  107. package/dist/extensions/server.d.mts +0 -5
  108. package/dist/extensions/server.d.mts.map +0 -1
  109. package/dist/extensions/server.mjs +0 -1146
  110. package/dist/extensions/server.mjs.map +0 -1
  111. package/dist/extensions/web.mjs +0 -1785
  112. package/dist/extensions/web.mjs.map +0 -1
  113. package/dist/headless-BGYfIlNk.mjs +0 -169
  114. package/dist/headless-BGYfIlNk.mjs.map +0 -1
  115. package/dist/headless-CHUsBGhg.cjs +0 -180
  116. package/dist/headless-CHUsBGhg.cjs.map +0 -1
  117. package/dist/index-BZL7keVW.d.mts +0 -31
  118. package/dist/index-BZL7keVW.d.mts.map +0 -1
  119. package/dist/index-BwB_jTI9.d.mts +0 -12
  120. package/dist/index-BwB_jTI9.d.mts.map +0 -1
  121. package/dist/index-D9-IXax4.d.mts +0 -43
  122. package/dist/index-D9-IXax4.d.mts.map +0 -1
  123. package/dist/index-DBz0DxnL.d.mts +0 -39
  124. package/dist/index-DBz0DxnL.d.mts.map +0 -1
  125. package/dist/index-DM7yJpMs.d.mts +0 -25
  126. package/dist/index-DM7yJpMs.d.mts.map +0 -1
  127. package/dist/index-Dhi8asLH.d.mts +0 -22
  128. package/dist/index-Dhi8asLH.d.mts.map +0 -1
  129. package/dist/index.cjs +0 -19
  130. package/dist/index.d.mts +0 -7
  131. package/dist/index.mjs +0 -6
  132. package/dist/launcher-BDm6-DiQ.mjs +0 -150
  133. package/dist/launcher-BDm6-DiQ.mjs.map +0 -1
  134. package/dist/launcher-BG5t9nvG.d.mts +0 -39
  135. package/dist/launcher-BG5t9nvG.d.mts.map +0 -1
  136. package/dist/launcher-SlyE8R3b.cjs +0 -157
  137. package/dist/launcher-SlyE8R3b.cjs.map +0 -1
  138. package/dist/launcher.cjs +0 -3
  139. package/dist/launcher.d.mts +0 -33
  140. package/dist/launcher.d.mts.map +0 -1
  141. package/dist/launcher.mjs +0 -2
  142. package/dist/lifeline-BZaQA0rm.mjs +0 -88
  143. package/dist/lifeline-BZaQA0rm.mjs.map +0 -1
  144. package/dist/lifeline-BuV_erib.cjs +0 -98
  145. package/dist/lifeline-BuV_erib.cjs.map +0 -1
  146. package/dist/lifeline-eJdZV0nN.d.mts +0 -19
  147. package/dist/lifeline-eJdZV0nN.d.mts.map +0 -1
  148. package/dist/lifeline.cjs +0 -6
  149. package/dist/lifeline.d.mts +0 -21
  150. package/dist/lifeline.d.mts.map +0 -1
  151. package/dist/lifeline.mjs +0 -3
  152. package/dist/logFile-C7oQ_v-g.d.mts +0 -16
  153. package/dist/logFile-C7oQ_v-g.d.mts.map +0 -1
  154. package/dist/logFile-CNvepZh0.cjs +0 -67
  155. package/dist/logFile-CNvepZh0.cjs.map +0 -1
  156. package/dist/logFile-KKPbkC-a.mjs +0 -60
  157. package/dist/logFile-KKPbkC-a.mjs.map +0 -1
  158. package/dist/logFile.cjs +0 -3
  159. package/dist/logFile.d.mts +0 -11
  160. package/dist/logFile.d.mts.map +0 -1
  161. package/dist/logFile.mjs +0 -2
  162. package/dist/logReader-B6J7L7Ua.cjs +0 -282
  163. package/dist/logReader-B6J7L7Ua.cjs.map +0 -1
  164. package/dist/logReader-MdW9ffvV.d.mts +0 -43
  165. package/dist/logReader-MdW9ffvV.d.mts.map +0 -1
  166. package/dist/logReader-UfbDbwQl.mjs +0 -257
  167. package/dist/logReader-UfbDbwQl.mjs.map +0 -1
  168. package/dist/logReader.cjs +0 -4
  169. package/dist/logReader.d.mts +0 -3
  170. package/dist/logReader.mjs +0 -2
  171. package/dist/processControl-BAOa3oo_.d.mts +0 -14
  172. package/dist/processControl-BAOa3oo_.d.mts.map +0 -1
  173. package/dist/processControl-DApTpV16.mjs +0 -26
  174. package/dist/processControl-DApTpV16.mjs.map +0 -1
  175. package/dist/processControl-DNJ1WZ9N.cjs +0 -31
  176. package/dist/processControl-DNJ1WZ9N.cjs.map +0 -1
  177. package/dist/processControl.cjs +0 -3
  178. package/dist/processControl.d.mts +0 -10
  179. package/dist/processControl.d.mts.map +0 -1
  180. package/dist/processControl.mjs +0 -2
  181. package/dist/ptyHost-DWWtRrGn.d.mts +0 -38
  182. package/dist/ptyHost-DWWtRrGn.d.mts.map +0 -1
  183. package/dist/ptyHost-DlQtTB8F.mjs +0 -150
  184. package/dist/ptyHost-DlQtTB8F.mjs.map +0 -1
  185. package/dist/ptyHost-MI2Z6WTG.cjs +0 -157
  186. package/dist/ptyHost-MI2Z6WTG.cjs.map +0 -1
  187. package/dist/ptyHost.cjs +0 -3
  188. package/dist/ptyHost.d.mts +0 -26
  189. package/dist/ptyHost.d.mts.map +0 -1
  190. package/dist/ptyHost.mjs +0 -2
  191. package/dist/ptySpawner-B6GsueZd.d.mts +0 -28
  192. package/dist/ptySpawner-B6GsueZd.d.mts.map +0 -1
  193. package/dist/ptySpawner-DEi1KOnd.mjs +0 -17
  194. package/dist/ptySpawner-DEi1KOnd.mjs.map +0 -1
  195. package/dist/ptySpawner-ijw0g5_T.cjs +0 -22
  196. package/dist/ptySpawner-ijw0g5_T.cjs.map +0 -1
  197. package/dist/ptySpawner.cjs +0 -3
  198. package/dist/ptySpawner.d.mts +0 -14
  199. package/dist/ptySpawner.d.mts.map +0 -1
  200. package/dist/ptySpawner.mjs +0 -2
  201. package/dist/reconcile-BugwYFbV.cjs +0 -133
  202. package/dist/reconcile-BugwYFbV.cjs.map +0 -1
  203. package/dist/reconcile-DMeNSxwn.mjs +0 -114
  204. package/dist/reconcile-DMeNSxwn.mjs.map +0 -1
  205. package/dist/reconcile.cjs +0 -5
  206. package/dist/reconcile.d.mts +0 -36
  207. package/dist/reconcile.d.mts.map +0 -1
  208. package/dist/reconcile.mjs +0 -2
  209. package/dist/responseEnvelope.cjs +0 -19
  210. package/dist/responseEnvelope.d.mts +0 -50
  211. package/dist/responseEnvelope.d.mts.map +0 -1
  212. package/dist/responseEnvelope.mjs +0 -3
  213. package/dist/rmuxBackend-CaEWooWn.d.mts +0 -36
  214. package/dist/rmuxBackend-CaEWooWn.d.mts.map +0 -1
  215. package/dist/rmuxBackend-DfyQwJrc.mjs +0 -509
  216. package/dist/rmuxBackend-DfyQwJrc.mjs.map +0 -1
  217. package/dist/rmuxBackend-DlxgqRZ1.cjs +0 -523
  218. package/dist/rmuxBackend-DlxgqRZ1.cjs.map +0 -1
  219. package/dist/rmuxBackend.cjs +0 -4
  220. package/dist/rmuxBackend.d.mts +0 -3
  221. package/dist/rmuxBackend.mjs +0 -2
  222. package/dist/rolldown-runtime-VH7oDXx4.cjs +0 -28
  223. package/dist/rtkProcessor-B4_urXQr.mjs +0 -10
  224. package/dist/rtkProcessor-B4_urXQr.mjs.map +0 -1
  225. package/dist/rtkProcessor-B9KPdyzr.mjs +0 -309
  226. package/dist/rtkProcessor-B9KPdyzr.mjs.map +0 -1
  227. package/dist/rtkProcessor-Bc4L4o_8.cjs +0 -335
  228. package/dist/rtkProcessor-Bc4L4o_8.cjs.map +0 -1
  229. package/dist/rtkProcessor-CVZvNhkJ.d.mts +0 -35
  230. package/dist/rtkProcessor-CVZvNhkJ.d.mts.map +0 -1
  231. package/dist/rtkProcessor-CsrCPyTQ.cjs +0 -33
  232. package/dist/rtkProcessor-CsrCPyTQ.cjs.map +0 -1
  233. package/dist/rtkProcessor.cjs +0 -11
  234. package/dist/rtkProcessor.d.mts +0 -7
  235. package/dist/rtkProcessor.d.mts.map +0 -1
  236. package/dist/rtkProcessor.mjs +0 -3
  237. package/dist/runnerConfig-BQBlVAXn.mjs +0 -134
  238. package/dist/runnerConfig-BQBlVAXn.mjs.map +0 -1
  239. package/dist/runnerConfig-BjtulXBI.d.mts +0 -57
  240. package/dist/runnerConfig-BjtulXBI.d.mts.map +0 -1
  241. package/dist/runnerConfig-D2tGq5ZM.cjs +0 -367
  242. package/dist/runnerConfig-D2tGq5ZM.cjs.map +0 -1
  243. package/dist/runnerDependencies-DruByBGS.mjs +0 -647
  244. package/dist/runnerDependencies-DruByBGS.mjs.map +0 -1
  245. package/dist/runnerDependencies-KMZigIxB.cjs +0 -667
  246. package/dist/runnerDependencies-KMZigIxB.cjs.map +0 -1
  247. package/dist/runnerDependencies.cjs +0 -3
  248. package/dist/runnerDependencies.d.mts +0 -2
  249. package/dist/runnerDependencies.mjs +0 -2
  250. package/dist/runnerNamer-B8FH7n2v.mjs +0 -44
  251. package/dist/runnerNamer-B8FH7n2v.mjs.map +0 -1
  252. package/dist/runnerNamer-we1XVYfM.cjs +0 -49
  253. package/dist/runnerNamer-we1XVYfM.cjs.map +0 -1
  254. package/dist/runnerNamer.cjs +0 -3
  255. package/dist/runnerNamer.d.mts +0 -11
  256. package/dist/runnerNamer.d.mts.map +0 -1
  257. package/dist/runnerNamer.mjs +0 -2
  258. package/dist/runnerPaths-BTEuzxw0.cjs +0 -471
  259. package/dist/runnerPaths-BTEuzxw0.cjs.map +0 -1
  260. package/dist/runnerPaths-B_dAAeco.mjs +0 -451
  261. package/dist/runnerPaths-B_dAAeco.mjs.map +0 -1
  262. package/dist/runnerPaths.cjs +0 -3
  263. package/dist/runnerPaths.d.mts +0 -50
  264. package/dist/runnerPaths.d.mts.map +0 -1
  265. package/dist/runnerPaths.mjs +0 -2
  266. package/dist/runnerRegistry-BmkZTJHi.cjs +0 -371
  267. package/dist/runnerRegistry-BmkZTJHi.cjs.map +0 -1
  268. package/dist/runnerRegistry-CeOHEjBv.mjs +0 -339
  269. package/dist/runnerRegistry-CeOHEjBv.mjs.map +0 -1
  270. package/dist/runnerRegistry-CtJiD02R.d.mts +0 -88
  271. package/dist/runnerRegistry-CtJiD02R.d.mts.map +0 -1
  272. package/dist/runnerRegistry.cjs +0 -4
  273. package/dist/runnerRegistry.d.mts +0 -3
  274. package/dist/runnerRegistry.mjs +0 -2
  275. package/dist/runnerSettings-DiV1lvzx.d.mts +0 -34
  276. package/dist/runnerSettings-DiV1lvzx.d.mts.map +0 -1
  277. package/dist/services/lifeline/client.cjs +0 -52
  278. package/dist/services/lifeline/client.cjs.map +0 -1
  279. package/dist/services/lifeline/client.d.mts +0 -22
  280. package/dist/services/lifeline/client.d.mts.map +0 -1
  281. package/dist/services/lifeline/client.mjs +0 -48
  282. package/dist/services/lifeline/client.mjs.map +0 -1
  283. package/dist/services/runnerSupervisor/index.cjs +0 -207
  284. package/dist/services/runnerSupervisor/index.cjs.map +0 -1
  285. package/dist/services/runnerSupervisor/index.d.mts +0 -71
  286. package/dist/services/runnerSupervisor/index.d.mts.map +0 -1
  287. package/dist/services/runnerSupervisor/index.mjs +0 -195
  288. package/dist/services/runnerSupervisor/index.mjs.map +0 -1
  289. package/dist/session-BC43uEyG.cjs +0 -29
  290. package/dist/session-BC43uEyG.cjs.map +0 -1
  291. package/dist/session-Chsb_Nh2.mjs +0 -18
  292. package/dist/session-Chsb_Nh2.mjs.map +0 -1
  293. package/dist/session-DE2Acesp.mjs +0 -6
  294. package/dist/session-DE2Acesp.mjs.map +0 -1
  295. package/dist/session-SfIPtdZO.cjs +0 -11
  296. package/dist/session-SfIPtdZO.cjs.map +0 -1
  297. package/dist/session.cjs +0 -6
  298. package/dist/session.d.mts +0 -11
  299. package/dist/session.d.mts.map +0 -1
  300. package/dist/session.mjs +0 -3
  301. package/dist/spawner-BxFsINXP.cjs +0 -68
  302. package/dist/spawner-BxFsINXP.cjs.map +0 -1
  303. package/dist/spawner-CdrN_HNk.d.mts +0 -35
  304. package/dist/spawner-CdrN_HNk.d.mts.map +0 -1
  305. package/dist/spawner-LoVsn55-.mjs +0 -63
  306. package/dist/spawner-LoVsn55-.mjs.map +0 -1
  307. package/dist/spawner.cjs +0 -3
  308. package/dist/spawner.d.mts +0 -9
  309. package/dist/spawner.d.mts.map +0 -1
  310. package/dist/spawner.mjs +0 -2
  311. package/dist/type-BXM03qSw.d.mts +0 -44
  312. package/dist/type-BXM03qSw.d.mts.map +0 -1
  313. package/dist/type-C31e1gla.d.mts +0 -43
  314. package/dist/type-C31e1gla.d.mts.map +0 -1
  315. package/dist/type-vWQNTahw.d.mts +0 -12
  316. package/dist/type-vWQNTahw.d.mts.map +0 -1
  317. package/dist/types.cjs +0 -0
  318. package/dist/types.d.mts +0 -3
  319. package/dist/types.mjs +0 -1
  320. package/llms.txt +0 -9
  321. package/skills/doom-runner/SKILL.md +0 -78
  322. package/src/prompts/po-use-runner/SKILL.md +0 -47
package/README.md CHANGED
@@ -1,257 +1,3 @@
1
- # @agimon-ai/po-runner
1
+ # Temporary Holding Version
2
2
 
3
- Supervised shell execution, background process control, durable logs.
4
-
5
- Part of the [Po distribution](https://www.npmjs.com/package/@agimon-ai/po).
6
-
7
- Runner provides the native `bash` tool in sessions that load it. Short commands return
8
- inline; long commands can be promoted to a background runner instead of blocking the agent.
9
- In native server sessions, an agent-watched runner retains background-work ownership until its
10
- completion wake-up is admitted. Delayed or retried handoffs must not let a workflow step finish early.
11
-
12
- > **Alpha:** tool and process contracts may change between releases.
13
-
14
- ## Requirements
15
-
16
- - Node.js 24 or newer
17
- - `/bin/bash`
18
- - macOS or Linux on arm64 or x64 for bundled RMUX and RTK support
19
-
20
- Linux native loading also depends on a compatible system loader and libc. The bundled binaries are
21
- glibc-linked, so a musl host such as Alpine cannot run them.
22
-
23
- RTK is optional. Eligible commands return bounded raw output with an "RTK is unavailable" note
24
- when its binary is missing or cannot start. A synchronous spawn failure or an `ENOENT`, `EACCES`,
25
- or `ENOEXEC` spawn error disables further attempts for that `RtkProcessor` instance. Missing-path
26
- resolution and ordinary processing failures are not latched.
27
-
28
- Panes come from the first backend that answers: bundled RMUX, then `rmux` on PATH, then `tmux` on
29
- PATH. Only when none is available does a non-interactive command fall back to a supervised
30
- subprocess, and interactive commands need one of them. A tmux-backed run is supervised by the same
31
- host process as an RMUX one, so exit metadata and logs behave the same; its session names carry a
32
- `doom-tmux-` prefix rather than `doom-runner-`.
33
-
34
- ## Install
35
-
36
- `po init` and `dpi init` include Runner in `default.packages` in `.po/modes.yaml`. Move
37
- it to a named layer to enable it only in selected major modes.
38
-
39
- ## Use the `bash` tool
40
-
41
- ```json
42
- {
43
- "command": "pnpm test",
44
- "timeout": 60
45
- }
46
- ```
47
-
48
- Commands crossing the promotion threshold move to a supervised runner. The default threshold is 60
49
- seconds. Set `background: true` to detach immediately, or `interactive: true` only when a command
50
- needs terminal input.
51
-
52
- Runner requires `PI_SESSION_ID` for session ownership. Processes, controls, and logs remain
53
- addressable after transcript compaction because their identity is outside model context.
54
-
55
- ### RTK result processing
56
-
57
- Runner keeps the complete original log, then uses the matching RTK stdin filter only for
58
- conservatively recognized single commands. Current safe mappings cover `cargo test`, `pytest`, plain
59
- unified `git diff`, structured `grep` or `rg`, `go test -json`, and JSON-formatted `ruff check`.
60
- Compound commands, pipelines, redirects, substitutions, incompatible formats, unsupported commands,
61
- and logs above RTK's 10 MiB stdin limit return bounded raw output instead. An eligible RTK failure
62
- also returns bounded raw output with a warning and does not change the command exit result.
63
-
64
- ## Inspect and control runs
65
-
66
- The `doom-runner` CLI supports:
67
-
68
- ```bash
69
- doom-runner list
70
- doom-runner status <runner-id>
71
- doom-runner logs <runner-id>
72
- doom-runner input <runner-id> --text "y" --enter
73
- doom-runner stop <runner-id>
74
- doom-runner stop-all
75
- ```
76
-
77
- The `input` command requires a running interactive process backed by RMUX or tmux.
78
-
79
- Stop runs that are no longer required.
80
-
81
- ## Storage and limits
82
-
83
- By default, session-scoped logs and registry data live under:
84
-
85
- ```text
86
- ~/.po/agent/doom-runner/<session>/
87
- ```
88
-
89
- Logs remain complete until TTL cleanup and are eligible for cleanup after seven days by default. The
90
- legacy log-size configuration exports remain available for compatibility but no longer rotate log
91
- content. Result limits, retention, and the promotion threshold remain environment-configurable.
92
-
93
- ### Result excerpts
94
-
95
- A result that exceeds the ceiling is returned as an excerpt: roughly the first fifth of the budget
96
- holds the opening lines, the rest holds the closing ones, and a marker between them states how many
97
- lines were dropped.
98
-
99
- The budget depends on the exit status. A command that **failed** gets 8 KiB and 120 lines, because
100
- its output is the evidence. A command that **succeeded** gets 2 KiB, because exiting 0 has already
101
- reported the outcome and the rest is mostly progress lines and repeated warnings:
102
-
103
- ```text
104
- Log excerpt (71 of 604 lines):
105
- $ pnpm build
106
- Compiling 1200 modules...
107
- compiled src/module-0.ts
108
- … [5 lines elided] …
109
- compiled src/module-599.ts
110
- Build succeeded in 12.4s
111
- exit status 0
112
- Full log: /path/to/run.log (17.0 KB, 604 lines); inspect with doom-runner logs run-a
113
- ```
114
-
115
- Three ceilings apply and whichever binds first wins: bytes, lines, and tokens. Tokens are there
116
- because bytes do not track context cost. Measured against `gpt-tokenizer`, real text runs from about
117
- 1.4 characters per token for base64 to 4.7 for English prose, so 8 KiB of one costs several times
118
- what 8 KiB of the other does. The defaults are 2,048 tokens on failure and 512 on success.
119
-
120
- Token counts are estimated rather than tokenized: truncation runs on every command and is
121
- synchronous, so loading a vocabulary would charge every session for a table most never need. The
122
- estimator models how BPE behaves, with punctuation forcing boundaries, natural words cheap, and
123
- letter-digit runs expensive. Its worst error against `gpt-tokenizer` is a factor of about 1.46
124
- either way, which is why the byte ceiling stays behind it as the hard bound.
125
-
126
- `DOOM_RUNNER_RESULT_MAX_BYTES`, `DOOM_RUNNER_RESULT_MAX_TOKENS`, and their
127
- `DOOM_RUNNER_SUCCESS_*` counterparts move these for one invocation. A pragma overrides all of
128
- them, which is how one noisy successful command can still ask for the wider result. Raising only
129
- `maxResultBytes` will not help when the token ceiling is the one binding.
130
-
131
- Error lines found in the dropped span are rescued into that marker's block, up to ten entries.
132
- Matching looks for a severity word in the first 60 characters, so `[widget] build: error TS2322`
133
- and a line behind a timestamp both count, while `0 errors`, `no failures`, and `--error-format` do
134
- not. Byte-identical lines collapse to one entry with an occurrence count. Lines that share a shape
135
- but differ in detail keep every variant, joined inside brackets so nothing actionable is lost:
136
-
137
- ```text
138
- ERROR in [src/widget-100.ts:100:7|src/widget-200.ts:200:7] - Type mismatch
139
- error: connection refused (×40)
140
- ```
141
-
142
- The complete raw log on disk is never truncated.
143
-
144
- ### Configuration
145
-
146
- Four layers, most specific first: a per-command pragma, then an environment variable, then project
147
- configuration, then the built-in default. Project configuration is the project's baseline, so an
148
- environment variable set for one invocation still wins over it.
149
-
150
- One command that needs a wider result can say so on its first line. The pragma is a shell comment,
151
- so it stays harmless to the command itself:
152
-
153
- ```bash
154
- # @doom: {"maxResultBytes": 32768, "maxResultTokens": 8192, "maxResultLines": 300}
155
- pnpm build
156
- ```
157
-
158
- Project settings follow Pi's convention for extension configuration: one JSON file per extension
159
- under the config directory, at `.pi/po-runner.json`. It is read only when the project is
160
- trusted, and an unrecognized or out-of-range key is reported rather than silently ignored.
161
-
162
- ```json
163
- {
164
- "maxResultBytes": 16384,
165
- "maxResultLines": 200,
166
- "successMaxResultBytes": 2048,
167
- "maxResultTokens": 2048,
168
- "successMaxResultTokens": 512,
169
- "headRatio": 0.2,
170
- "errorPatterns": ["^FEHLER", "^\\s*FAILED\\b"],
171
- "errorMaxEntries": 10,
172
- "errorMaxVariantsJoined": 6,
173
- "errorBudgetRatio": 0.2
174
- }
175
- ```
176
-
177
- `errorPatterns` extends the built-in matcher rather than replacing it, which is what makes output
178
- it does not recognize reachable. Ceilings apply to every numeric key so a checked-in file cannot
179
- flood the model's context.
180
-
181
- Commands inherit the Po process environment and the operating system user's privileges. Logs
182
- may contain prompts, source, command output, credentials, or other secrets; restrict access and
183
- retention accordingly.
184
-
185
- ### Host-wide resource budget
186
-
187
- The headless Po server shares one heavy-job queue across its sessions. Known
188
- noninteractive build, test, lint, and typecheck commands acquire a slot before
189
- launching. The default is two concurrent jobs; set `DOOM_RUNNER_MAX_HEAVY_JOBS`
190
- to a positive integer in the server's environment to change it. The waiting queue
191
- is bounded to 128 jobs. Cancellation removes queued work without launching it.
192
-
193
- A background promotion keeps its slot until the process exits. Closing one
194
- session does not release another session's slot. Interactive commands and ordinary
195
- inspection commands bypass this queue. This is admission for recognized command
196
- forms, not an operating-system CPU quota or a parser for arbitrary shell scripts.
197
-
198
- For noninteractive native, RMUX, and tmux launches, unset child environment values
199
- default to `NX_NATIVE_COMMAND_RUNNER=false`, `NX_TUI=false`, `NX_PARALLEL=2`, and
200
- `VITEST_MAX_WORKERS=2`. Explicit environment values still win; interactive launches
201
- keep their original settings.
202
-
203
- The server records changed queue counts as `po_server.execution_budget`
204
- events with the host PID, running jobs, queued jobs, and limit. These are not
205
- per-session memory measurements.
206
-
207
- ## Native artifacts
208
-
209
- Runner selects the matching optional dependencies automatically:
210
-
211
- | Host | RMUX package | RTK package |
212
- | ----------- | ---------------------------------------- | --------------------------------------- |
213
- | macOS arm64 | `@agimon-ai/po-runner-rmux-darwin-arm64` | `@agimon-ai/po-runner-rtk-darwin-arm64` |
214
- | macOS x64 | `@agimon-ai/po-runner-rmux-darwin-x64` | `@agimon-ai/po-runner-rtk-darwin-x64` |
215
- | Linux arm64 | `@agimon-ai/po-runner-rmux-linux-arm64` | `@agimon-ai/po-runner-rtk-linux-arm64` |
216
- | Linux x64 | `@agimon-ai/po-runner-rmux-linux-x64` | `@agimon-ai/po-runner-rtk-linux-x64` |
217
-
218
- Do not install platform packages directly. They contain native executables and export only package
219
- metadata. RMUX is dual-licensed under MIT or Apache-2.0. RTK v0.45.0 is licensed under Apache-2.0.
220
-
221
- ## Public API
222
-
223
- ```ts
224
- import {
225
- createRunnerDependencies,
226
- DEFAULT_BG_THRESHOLD_MS,
227
- DEFAULT_LOG_MAX_BYTES,
228
- DEFAULT_LOG_TTL_MS,
229
- RmuxBackend,
230
- rtkPackageForTarget,
231
- } from '@agimon-ai/po-runner';
232
- ```
233
-
234
- Declared subpaths expose process supervision, configuration, tools, and response envelopes for host authors.
235
-
236
- ## Development
237
-
238
- ```bash
239
- pnpm build
240
- pnpm typecheck
241
- pnpm test
242
- pnpm lint
243
- ```
244
-
245
- Maintained by [Agimon](https://agimon.ai/about).
246
-
247
- ## License
248
-
249
- MIT
250
-
251
- ## Extension lifecycle and source layout
252
-
253
- Public capabilities use flat kebab-case subpaths such as `runner-dependencies`, `rmux-backend`, `runner-paths`, `bash-tool`, and `response-envelope`. Flat `src/exports/` files only forward these capabilities. Executable `bin/*` paths remain unchanged. The former nested service aliases and container entry are removed.
254
-
255
- ### Native session ownership
256
-
257
- The Po server facet owns runner startup, history retention, background completion notifications, and successful-compaction recovery. The standalone `po-runner` command remains available. Runner project settings retain the existing headless bridge's trusted-project assumption, validation, and environment-over-project precedence. Optional runner activity toggles do not restart the retained supervisor.
3
+ This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
package/package.json CHANGED
@@ -1,303 +1,6 @@
1
1
  {
2
2
  "name": "@agimon-ai/po-runner",
3
- "version": "0.0.0-alpha.1",
4
- "description": "Supervised shell execution, background process control, and run logs for Pi coding agents.",
5
- "keywords": [
6
- "ai",
7
- "background-process",
8
- "coding-agent",
9
- "developer-tools",
10
- "doom-runner",
11
- "pi-coding-agent",
12
- "pi-package",
13
- "po",
14
- "process-supervision",
15
- "shell"
16
- ],
17
- "homepage": "https://agimon.ai",
18
- "bugs": {
19
- "url": "https://github.com/AgiFlow/po/issues"
20
- },
21
- "license": "MIT",
22
- "author": "Vuong Ngo",
23
- "repository": {
24
- "type": "git",
25
- "url": "git+https://github.com/AgiFlow/po.git",
26
- "directory": "packages/default/po-runner"
27
- },
28
- "bin": {
29
- "po-runner": "./dist/bin/cli.mjs"
30
- },
31
- "files": [
32
- "dist",
33
- "skills",
34
- "llms.txt",
35
- "src/prompts",
36
- "README.md",
37
- "LICENSE",
38
- "package.json"
39
- ],
40
- "type": "module",
41
- "main": "./dist/index.cjs",
42
- "module": "./dist/index.mjs",
43
- "types": "./dist/index.d.mts",
44
- "jsnext:main": "./dist/index.mjs",
45
- "exports": {
46
- ".": {
47
- "types": "./dist/index.d.mts",
48
- "import": "./dist/index.mjs",
49
- "require": "./dist/index.cjs"
50
- },
51
- "./ansiScrub": {
52
- "types": "./dist/ansiScrub.d.mts",
53
- "import": "./dist/ansiScrub.mjs",
54
- "require": "./dist/ansiScrub.cjs"
55
- },
56
- "./bashRunService": {
57
- "types": "./dist/bashRunService.d.mts",
58
- "import": "./dist/bashRunService.mjs",
59
- "require": "./dist/bashRunService.cjs"
60
- },
61
- "./bashSchema": {
62
- "types": "./dist/bashSchema.d.mts",
63
- "import": "./dist/bashSchema.mjs",
64
- "require": "./dist/bashSchema.cjs"
65
- },
66
- "./bashTool": {
67
- "types": "./dist/bashTool.d.mts",
68
- "import": "./dist/bashTool.mjs",
69
- "require": "./dist/bashTool.cjs"
70
- },
71
- "./bin/cli": {
72
- "types": "./dist/bin/cli.d.mts",
73
- "import": "./dist/bin/cli.mjs",
74
- "require": "./dist/bin/cli.cjs"
75
- },
76
- "./bin/logSink": {
77
- "types": "./dist/bin/logSink.d.mts",
78
- "import": "./dist/bin/logSink.mjs",
79
- "require": "./dist/bin/logSink.cjs"
80
- },
81
- "./bin/runnerHost": {
82
- "types": "./dist/bin/runnerHost.d.mts",
83
- "import": "./dist/bin/runnerHost.mjs",
84
- "require": "./dist/bin/runnerHost.cjs"
85
- },
86
- "./cliApp": {
87
- "types": "./dist/cliApp.d.mts",
88
- "import": "./dist/cliApp.mjs",
89
- "require": "./dist/cliApp.cjs"
90
- },
91
- "./clock": {
92
- "types": "./dist/clock.d.mts",
93
- "import": "./dist/clock.mjs",
94
- "require": "./dist/clock.cjs"
95
- },
96
- "./compaction": {
97
- "types": "./dist/compaction.d.mts",
98
- "import": "./dist/compaction.mjs",
99
- "require": "./dist/compaction.cjs"
100
- },
101
- "./config": {
102
- "types": "./dist/config.d.mts",
103
- "import": "./dist/config.mjs",
104
- "require": "./dist/config.cjs"
105
- },
106
- "./extensions/server": {
107
- "types": "./dist/extensions/server.d.mts",
108
- "import": "./dist/extensions/server.mjs",
109
- "require": "./dist/extensions/server.cjs"
110
- },
111
- "./extensions/web": {
112
- "import": "./dist/extensions/web.mjs"
113
- },
114
- "./launcher": {
115
- "types": "./dist/launcher.d.mts",
116
- "import": "./dist/launcher.mjs",
117
- "require": "./dist/launcher.cjs"
118
- },
119
- "./lifeline": {
120
- "types": "./dist/lifeline.d.mts",
121
- "import": "./dist/lifeline.mjs",
122
- "require": "./dist/lifeline.cjs"
123
- },
124
- "./logFile": {
125
- "types": "./dist/logFile.d.mts",
126
- "import": "./dist/logFile.mjs",
127
- "require": "./dist/logFile.cjs"
128
- },
129
- "./logReader": {
130
- "types": "./dist/logReader.d.mts",
131
- "import": "./dist/logReader.mjs",
132
- "require": "./dist/logReader.cjs"
133
- },
134
- "./processControl": {
135
- "types": "./dist/processControl.d.mts",
136
- "import": "./dist/processControl.mjs",
137
- "require": "./dist/processControl.cjs"
138
- },
139
- "./ptyHost": {
140
- "types": "./dist/ptyHost.d.mts",
141
- "import": "./dist/ptyHost.mjs",
142
- "require": "./dist/ptyHost.cjs"
143
- },
144
- "./ptySpawner": {
145
- "types": "./dist/ptySpawner.d.mts",
146
- "import": "./dist/ptySpawner.mjs",
147
- "require": "./dist/ptySpawner.cjs"
148
- },
149
- "./reconcile": {
150
- "types": "./dist/reconcile.d.mts",
151
- "import": "./dist/reconcile.mjs",
152
- "require": "./dist/reconcile.cjs"
153
- },
154
- "./responseEnvelope": {
155
- "types": "./dist/responseEnvelope.d.mts",
156
- "import": "./dist/responseEnvelope.mjs",
157
- "require": "./dist/responseEnvelope.cjs"
158
- },
159
- "./rmuxBackend": {
160
- "types": "./dist/rmuxBackend.d.mts",
161
- "import": "./dist/rmuxBackend.mjs",
162
- "require": "./dist/rmuxBackend.cjs"
163
- },
164
- "./rtkProcessor": {
165
- "types": "./dist/rtkProcessor.d.mts",
166
- "import": "./dist/rtkProcessor.mjs",
167
- "require": "./dist/rtkProcessor.cjs"
168
- },
169
- "./runnerDependencies": {
170
- "types": "./dist/runnerDependencies.d.mts",
171
- "import": "./dist/runnerDependencies.mjs",
172
- "require": "./dist/runnerDependencies.cjs"
173
- },
174
- "./runnerNamer": {
175
- "types": "./dist/runnerNamer.d.mts",
176
- "import": "./dist/runnerNamer.mjs",
177
- "require": "./dist/runnerNamer.cjs"
178
- },
179
- "./runnerPaths": {
180
- "types": "./dist/runnerPaths.d.mts",
181
- "import": "./dist/runnerPaths.mjs",
182
- "require": "./dist/runnerPaths.cjs"
183
- },
184
- "./runnerRegistry": {
185
- "types": "./dist/runnerRegistry.d.mts",
186
- "import": "./dist/runnerRegistry.mjs",
187
- "require": "./dist/runnerRegistry.cjs"
188
- },
189
- "./session": {
190
- "types": "./dist/session.d.mts",
191
- "import": "./dist/session.mjs",
192
- "require": "./dist/session.cjs"
193
- },
194
- "./spawner": {
195
- "types": "./dist/spawner.d.mts",
196
- "import": "./dist/spawner.mjs",
197
- "require": "./dist/spawner.cjs"
198
- },
199
- "./types": {
200
- "types": "./dist/types.d.mts",
201
- "import": "./dist/types.mjs",
202
- "require": "./dist/types.cjs"
203
- },
204
- "./package.json": "./package.json"
205
- },
206
- "publishConfig": {
207
- "access": "public",
208
- "registry": "https://registry.npmjs.org/"
209
- },
210
- "dependencies": {
211
- "@agimon-ai/foundation-process-registry": "0.30.12",
212
- "@agimon-ai/po-core": "0.0.0-alpha.1",
213
- "@agimon-ai/po-telemetry": "0.0.0-alpha.1",
214
- "@agimon-ai/po-ui": "0.0.0-alpha.1",
215
- "@agimon-ai/po-web-components": "0.0.0-alpha.1",
216
- "@agimon-ai/po-web-security": "0.0.0-alpha.1",
217
- "@deepseek-ai/cordis": "4.0.4",
218
- "@rmux/sdk": "0.6.5",
219
- "@xterm/headless": "6.0.0",
220
- "hono": "4.13.12",
221
- "typebox": "1.3.34"
222
- },
223
- "devDependencies": {
224
- "@agimon-ai/po-build": "0.0.0-alpha.1",
225
- "@earendil-works/pi-coding-agent": "1.0.2",
226
- "@tanstack/react-store": "0.11.2",
227
- "@tanstack/store": "0.11.2",
228
- "@types/node": "26.6.4",
229
- "@types/react": "19.3.0",
230
- "@vitest/coverage-v8": "5.0.3",
231
- "react": "19.3.0",
232
- "react-dom": "19.3.0",
233
- "tsdown": "0.23.0",
234
- "typescript": "7.0.2",
235
- "vitest": "5.0.3"
236
- },
237
- "peerDependencies": {
238
- "@earendil-works/pi-coding-agent": "1.0.2"
239
- },
240
- "peerDependenciesMeta": {
241
- "@earendil-works/pi-coding-agent": {
242
- "optional": true
243
- }
244
- },
245
- "optionalDependencies": {
246
- "@agimon-ai/po-runner-rmux-darwin-arm64": "0.0.0-alpha.1",
247
- "@agimon-ai/po-runner-rmux-darwin-x64": "0.0.0-alpha.1",
248
- "@agimon-ai/po-runner-rmux-linux-arm64": "0.0.0-alpha.1",
249
- "@agimon-ai/po-runner-rmux-linux-x64": "0.0.0-alpha.1",
250
- "@agimon-ai/po-runner-rtk-darwin-arm64": "0.0.0-alpha.1",
251
- "@agimon-ai/po-runner-rtk-darwin-x64": "0.0.0-alpha.1",
252
- "@agimon-ai/po-runner-rtk-linux-arm64": "0.0.0-alpha.1",
253
- "@agimon-ai/po-runner-rtk-linux-x64": "0.0.0-alpha.1"
254
- },
255
- "engines": {
256
- "node": ">=24"
257
- },
258
- "poMcp": {
259
- "entry": "./generated/mcp.ts",
260
- "dist": "./dist/extensions/mcp.mjs",
261
- "scopes": [
262
- "session"
263
- ],
264
- "ui": {
265
- "entry": "./generated/mcp-ui.ts",
266
- "dist": "./dist/extensions/mcp-ui.mjs",
267
- "widgets": [
268
- "@agimon-ai/po-runner/bash"
269
- ]
270
- }
271
- },
272
- "poServer": {
273
- "entry": "./generated/server.ts",
274
- "dist": "./dist/extensions/server.mjs",
275
- "scopes": [
276
- "global",
277
- "workspace",
278
- "session"
279
- ],
280
- "contracts": {
281
- "entry": "./src/exports/apiContracts.ts",
282
- "dist": "./dist/apiContracts.mjs"
283
- }
284
- },
285
- "poWeb": {
286
- "pluginId": "runner",
287
- "channels": [
288
- "runner_runs"
289
- ],
290
- "client": "./dist/extensions/web.mjs",
291
- "scopes": [
292
- "session"
293
- ]
294
- },
295
- "scripts": {
296
- "build": "tsdown && tsdown --config tsdown.mcp.config.ts",
297
- "build:mcp": "tsdown --config tsdown.mcp.config.ts",
298
- "test": "vitest --run",
299
- "typecheck": "tsc --noEmit && tsc --noEmit -p tsconfig.web.json && tsc --noEmit -p tsconfig.mcp.json",
300
- "lint": "oxlint . && oxfmt . --check",
301
- "fixcode": "oxlint . --fix && oxfmt ."
302
- }
3
+ "version": "0.0.0-stage",
4
+ "stub": true,
5
+ "description": "Temporary package placeholder for staged publishing"
303
6
  }
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 Vuong Ngo
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
@@ -1,71 +0,0 @@
1
- //#region src/constants/ansiScrub.ts
2
- const CONTROL_PATTERN = /[\u0007\u0008]/g;
3
- //#endregion
4
- //#region src/services/ansiScrub/index.ts
5
- /**
6
- * Turns terminal output into text worth grepping.
7
- *
8
- * PTY output is written for a screen, not a file: colours, cursor moves and
9
- * carriage-return redraws all end up in the byte stream. Without this a single
10
- * progress bar becomes thousands of near-identical log lines.
11
- */
12
- /**
13
- * CSI sequences (colours, cursor moves), OSC strings, the two-byte Fe escapes,
14
- * and the keypad-mode escapes shells emit around every prompt.
15
- */
16
- const ANSI_PATTERN = new RegExp([
17
- "\\u001B\\[[0-9;?]*[ -/]*[@-~]",
18
- "\\u001B\\][^\\u0007\\u001B]*(?:\\u0007|\\u001B\\\\)",
19
- "\\u001B[@-Z\\\\-_]",
20
- "\\u001B[=><]"
21
- ].join("|"), "g");
22
- /** Bell and backspace, which a terminal consumes rather than displays. */
23
- /**
24
- * The same set minus SGR, the sequence that only sets colour and weight.
25
- *
26
- * The final byte class omits `m`, so `ESC[32m` survives while cursor moves,
27
- * OSC strings and keypad escapes are still removed.
28
- */
29
- const ANSI_PATTERN_KEEPING_COLOUR = new RegExp([
30
- "\\u001B\\[[0-9;?]*[ -/]*[@-ln-~]",
31
- "\\u001B\\][^\\u0007\\u001B]*(?:\\u0007|\\u001B\\\\)",
32
- "\\u001B[@-Z\\\\-_]",
33
- "\\u001B[=><]"
34
- ].join("|"), "g");
35
- /** Removes escape sequences, leaving the characters a user would have seen. */
36
- function stripAnsi(text) {
37
- return text.replace(ANSI_PATTERN, "").replace(CONTROL_PATTERN, "");
38
- }
39
- /**
40
- * Removes everything `stripAnsi` does except colour.
41
- *
42
- * Logs are read back by a terminal renderer as well as by grep, and a command
43
- * that colours its own output has already said how it should look.
44
- */
45
- function stripAnsiKeepingColour(text) {
46
- return text.replace(ANSI_PATTERN_KEEPING_COLOUR, "").replace(CONTROL_PATTERN, "");
47
- }
48
- /**
49
- * Collapses carriage-return redraws.
50
- *
51
- * A bare `\r` returns the cursor to the start of the current line, so whatever
52
- * follows overwrites it. Only the final state of each line is kept. The `\r` of
53
- * a CRLF pair is a line terminator rather than a redraw, so it is normalised
54
- * away first: a pseudo terminal ends every line that way, and treating it as a
55
- * redraw would blank the whole log.
56
- */
57
- function collapseCarriageReturns(text) {
58
- return text.replace(/\r\n/g, "\n").split("\n").map((line) => line.includes("\r") ? line.split("\r").at(-1) ?? "" : line).join("\n");
59
- }
60
- /** Full scrub applied to PTY output before it reaches the log file. */
61
- function scrubTerminalOutput(text) {
62
- return collapseCarriageReturns(stripAnsiKeepingColour(text));
63
- }
64
- /** Plain-text scrub, for the copy the model reads. */
65
- function scrubTerminalOutputToPlainText(text) {
66
- return collapseCarriageReturns(stripAnsi(text));
67
- }
68
- //#endregion
69
- export { stripAnsiKeepingColour as a, stripAnsi as i, scrubTerminalOutput as n, scrubTerminalOutputToPlainText as r, collapseCarriageReturns as t };
70
-
71
- //# sourceMappingURL=ansiScrub-CsqTSaVT.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ansiScrub-CsqTSaVT.mjs","names":[],"sources":["../src/constants/ansiScrub.ts","../src/services/ansiScrub/index.ts"],"sourcesContent":["// oxlint-disable-next-line no-control-regex -- matching terminal control bytes is the whole job\nexport const CONTROL_PATTERN = /[\\u0007\\u0008]/g;\n","import { CONTROL_PATTERN } from '../../constants/ansiScrub';\n/**\n * Turns terminal output into text worth grepping.\n *\n * PTY output is written for a screen, not a file: colours, cursor moves and\n * carriage-return redraws all end up in the byte stream. Without this a single\n * progress bar becomes thousands of near-identical log lines.\n */\n\n/**\n * CSI sequences (colours, cursor moves), OSC strings, the two-byte Fe escapes,\n * and the keypad-mode escapes shells emit around every prompt.\n */\nconst ANSI_PATTERN = new RegExp(\n [\n '\\\\u001B\\\\[[0-9;?]*[ -/]*[@-~]',\n '\\\\u001B\\\\][^\\\\u0007\\\\u001B]*(?:\\\\u0007|\\\\u001B\\\\\\\\)',\n '\\\\u001B[@-Z\\\\\\\\-_]',\n '\\\\u001B[=><]',\n ].join('|'),\n 'g',\n);\n\n/** Bell and backspace, which a terminal consumes rather than displays. */\n// oxlint-disable-next-line no-control-regex -- matching terminal control bytes is the whole job\n\n/**\n * The same set minus SGR, the sequence that only sets colour and weight.\n *\n * The final byte class omits `m`, so `ESC[32m` survives while cursor moves,\n * OSC strings and keypad escapes are still removed.\n */\nconst ANSI_PATTERN_KEEPING_COLOUR = new RegExp(\n [\n '\\\\u001B\\\\[[0-9;?]*[ -/]*[@-ln-~]',\n '\\\\u001B\\\\][^\\\\u0007\\\\u001B]*(?:\\\\u0007|\\\\u001B\\\\\\\\)',\n '\\\\u001B[@-Z\\\\\\\\-_]',\n '\\\\u001B[=><]',\n ].join('|'),\n 'g',\n);\n\n/** Removes escape sequences, leaving the characters a user would have seen. */\nexport function stripAnsi(text: string): string {\n return text.replace(ANSI_PATTERN, '').replace(CONTROL_PATTERN, '');\n}\n\n/**\n * Removes everything `stripAnsi` does except colour.\n *\n * Logs are read back by a terminal renderer as well as by grep, and a command\n * that colours its own output has already said how it should look.\n */\nexport function stripAnsiKeepingColour(text: string): string {\n return text.replace(ANSI_PATTERN_KEEPING_COLOUR, '').replace(CONTROL_PATTERN, '');\n}\n\n/**\n * Collapses carriage-return redraws.\n *\n * A bare `\\r` returns the cursor to the start of the current line, so whatever\n * follows overwrites it. Only the final state of each line is kept. The `\\r` of\n * a CRLF pair is a line terminator rather than a redraw, so it is normalised\n * away first: a pseudo terminal ends every line that way, and treating it as a\n * redraw would blank the whole log.\n */\nexport function collapseCarriageReturns(text: string): string {\n return text\n .replace(/\\r\\n/g, '\\n')\n .split('\\n')\n .map((line) => (line.includes('\\r') ? (line.split('\\r').at(-1) ?? '') : line))\n .join('\\n');\n}\n\n/** Full scrub applied to PTY output before it reaches the log file. */\nexport function scrubTerminalOutput(text: string): string {\n return collapseCarriageReturns(stripAnsiKeepingColour(text));\n}\n\n/** Plain-text scrub, for the copy the model reads. */\nexport function scrubTerminalOutputToPlainText(text: string): string {\n return collapseCarriageReturns(stripAnsi(text));\n}\n"],"mappings":";AACA,MAAa,kBAAkB;;;;;;;;;;;;;;ACY/B,MAAM,eAAe,IAAI,OACvB;CACE;CACA;CACA;CACA;AACF,CAAC,CAAC,KAAK,GAAG,GACV,GACF;;;;;;;;AAWA,MAAM,8BAA8B,IAAI,OACtC;CACE;CACA;CACA;CACA;AACF,CAAC,CAAC,KAAK,GAAG,GACV,GACF;;AAGA,SAAgB,UAAU,MAAsB;CAC9C,OAAO,KAAK,QAAQ,cAAc,EAAE,CAAC,CAAC,QAAQ,iBAAiB,EAAE;AACnE;;;;;;;AAQA,SAAgB,uBAAuB,MAAsB;CAC3D,OAAO,KAAK,QAAQ,6BAA6B,EAAE,CAAC,CAAC,QAAQ,iBAAiB,EAAE;AAClF;;;;;;;;;;AAWA,SAAgB,wBAAwB,MAAsB;CAC5D,OAAO,KACJ,QAAQ,SAAS,IAAI,CAAC,CACtB,MAAM,IAAI,CAAC,CACX,KAAK,SAAU,KAAK,SAAS,IAAI,IAAK,KAAK,MAAM,IAAI,CAAC,CAAC,GAAG,EAAE,KAAK,KAAM,IAAK,CAAC,CAC7E,KAAK,IAAI;AACd;;AAGA,SAAgB,oBAAoB,MAAsB;CACxD,OAAO,wBAAwB,uBAAuB,IAAI,CAAC;AAC7D;;AAGA,SAAgB,+BAA+B,MAAsB;CACnE,OAAO,wBAAwB,UAAU,IAAI,CAAC;AAChD"}