@sma1lboy/rove 0.9.274 → 0.9.277-next.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (236) hide show
  1. package/dist/cli/{chunk-kgs56yns.js → chunk-0a65j1zj.js} +1 -1
  2. package/dist/cli/{chunk-55ajzrj6.js → chunk-0r1jf8m9.js} +1 -1
  3. package/dist/cli/{chunk-q6septaj.js → chunk-0rvydb9q.js} +1 -1
  4. package/dist/cli/chunk-1g6vhgfe.js +14 -0
  5. package/dist/cli/{chunk-mmq6922s.js → chunk-1vxtd8rh.js} +2 -2
  6. package/dist/cli/chunk-1wwqf6kx.js +3 -0
  7. package/dist/cli/{chunk-8h437k1q.js → chunk-2kbzb24j.js} +1 -1
  8. package/dist/cli/chunk-2kt0mfvf.js +2 -0
  9. package/dist/cli/{chunk-m4dvx7bd.js → chunk-2vph030z.js} +3 -3
  10. package/dist/cli/chunk-2xsxcdp6.js +3 -0
  11. package/dist/cli/{chunk-fexzfgd1.js → chunk-2y70y8na.js} +1 -1
  12. package/dist/cli/{chunk-tw9w8pzg.js → chunk-36eyrv4r.js} +3 -3
  13. package/dist/cli/chunk-37fas9aj.js +2 -0
  14. package/dist/cli/chunk-3dhv5n19.js +2 -0
  15. package/dist/cli/{chunk-kx53jjee.js → chunk-3x5g06mw.js} +8 -6
  16. package/dist/cli/{chunk-8sggyn8y.js → chunk-3y0z478f.js} +1 -1
  17. package/dist/cli/chunk-4dt1gfb3.js +3 -0
  18. package/dist/cli/chunk-4w4tpsqx.js +2 -0
  19. package/dist/cli/chunk-5apxck3d.js +97 -0
  20. package/dist/cli/chunk-5vrg6h71.js +3 -0
  21. package/dist/cli/chunk-5xpvd182.js +2 -0
  22. package/dist/cli/chunk-5yfffvqe.js +2 -0
  23. package/dist/cli/{chunk-gryq2vgw.js → chunk-5yh5trgy.js} +1 -1
  24. package/dist/cli/chunk-61cn88e7.js +15 -0
  25. package/dist/cli/{chunk-g9yba5vh.js → chunk-671ak750.js} +2 -2
  26. package/dist/cli/chunk-676f3tva.js +5 -0
  27. package/dist/cli/chunk-6hcyvg0m.js +3 -0
  28. package/dist/cli/chunk-6mg5zp8y.js +2 -0
  29. package/dist/cli/chunk-6q4br0pt.js +2 -0
  30. package/dist/cli/chunk-6wfhq8xd.js +4 -0
  31. package/dist/cli/{chunk-ypd337d0.js → chunk-748656h7.js} +3 -3
  32. package/dist/cli/chunk-7bakcyes.js +5 -0
  33. package/dist/cli/{chunk-hfdk7j28.js → chunk-7kgcy89w.js} +1 -1
  34. package/dist/cli/chunk-8qkyd589.js +5 -0
  35. package/dist/cli/chunk-9ckvdy0j.js +3 -0
  36. package/dist/cli/{chunk-egpcaxwb.js → chunk-9fdy8vne.js} +1 -1
  37. package/dist/cli/{chunk-h8t4xg1p.js → chunk-9rj2fx6v.js} +1 -1
  38. package/dist/cli/chunk-9x2xd1rz.js +2 -0
  39. package/dist/cli/{chunk-r77pfw4m.js → chunk-9zswhjkv.js} +1 -1
  40. package/dist/cli/{chunk-p6jw0zcd.js → chunk-agvtzads.js} +1 -1
  41. package/dist/cli/chunk-aq4j8ar4.js +2 -0
  42. package/dist/cli/{chunk-ecrw211n.js → chunk-aqwckba5.js} +1 -1
  43. package/dist/cli/{chunk-rzef6szc.js → chunk-atg13xab.js} +1 -1
  44. package/dist/cli/{chunk-ez438kn3.js → chunk-b95q6zhk.js} +1 -1
  45. package/dist/cli/chunk-bagwgxsg.js +2 -0
  46. package/dist/cli/{chunk-4hnz77xf.js → chunk-bcyex84w.js} +1 -1
  47. package/dist/cli/chunk-bv050ssb.js +8 -0
  48. package/dist/cli/chunk-bykqhbvy.js +2 -0
  49. package/dist/cli/{chunk-29s67j3k.js → chunk-ca4x8s96.js} +4 -4
  50. package/dist/cli/chunk-cakyme4s.js +2 -0
  51. package/dist/cli/{chunk-16ttm9x6.js → chunk-ccmke5sx.js} +1 -1
  52. package/dist/cli/chunk-cf3vpsm5.js +3 -0
  53. package/dist/cli/chunk-d552cvb2.js +2 -0
  54. package/dist/cli/{chunk-gcg5h667.js → chunk-dsdtq087.js} +1 -1
  55. package/dist/cli/{chunk-387ecqb8.js → chunk-e58kj4gm.js} +1 -1
  56. package/dist/cli/chunk-ee314raa.js +2 -0
  57. package/dist/cli/{chunk-0rrmz6k6.js → chunk-eege1x0a.js} +1 -1
  58. package/dist/cli/{chunk-m6yy3qc1.js → chunk-fgtc1xq9.js} +1 -1
  59. package/dist/cli/{chunk-5dd7trgf.js → chunk-fq2pefc5.js} +1 -1
  60. package/dist/cli/chunk-g4p5znv1.js +2 -0
  61. package/dist/cli/chunk-g9ba25q5.js +3 -0
  62. package/dist/cli/{chunk-qe7xb4rm.js → chunk-g9xknhjq.js} +2 -2
  63. package/dist/cli/chunk-gbd5j3dv.js +2 -0
  64. package/dist/cli/{chunk-ycd28edp.js → chunk-ggjmcqpt.js} +3 -4
  65. package/dist/cli/chunk-hv79ys32.js +1 -1
  66. package/dist/cli/chunk-hz1x3hak.js +3 -0
  67. package/dist/cli/{chunk-03rbg95q.js → chunk-hzz020xx.js} +5 -5
  68. package/dist/cli/chunk-j1qy79fd.js +3 -0
  69. package/dist/cli/chunk-j9tsdn1d.js +2 -0
  70. package/dist/cli/chunk-jejmt4k0.js +140 -0
  71. package/dist/cli/chunk-jj5f4n51.js +1 -1
  72. package/dist/cli/{chunk-nzbq51h9.js → chunk-k225696b.js} +1 -1
  73. package/dist/cli/{chunk-by6fjf7m.js → chunk-kag7cfbr.js} +1 -1
  74. package/dist/cli/{chunk-jwedmkm8.js → chunk-kdnk8m5j.js} +1 -1
  75. package/dist/cli/{chunk-yzkhwn31.js → chunk-kxp04jnp.js} +1 -1
  76. package/dist/cli/chunk-m4z6kepz.js +3 -0
  77. package/dist/cli/chunk-mdc7b01e.js +3 -0
  78. package/dist/cli/{chunk-bj6sa371.js → chunk-mjyhy152.js} +1 -1
  79. package/dist/cli/chunk-mqfvzdpr.js +3 -0
  80. package/dist/cli/chunk-mqvkd2g1.js +2 -0
  81. package/dist/cli/chunk-mvtqstte.js +4 -0
  82. package/dist/cli/{chunk-qs1r0tqr.js → chunk-mxx0y791.js} +1 -1
  83. package/dist/cli/{chunk-1rjq808h.js → chunk-n0rdn2fn.js} +1 -1
  84. package/dist/cli/{chunk-3v9s3bcz.js → chunk-n2zgej1a.js} +1 -1
  85. package/dist/cli/chunk-n94vzkbe.js +3 -0
  86. package/dist/cli/chunk-njncqdwf.js +2 -0
  87. package/dist/cli/{chunk-6jk2khme.js → chunk-nw092jak.js} +1 -1
  88. package/dist/cli/{chunk-22d4fjjb.js → chunk-pfagrkt6.js} +1 -1
  89. package/dist/cli/{chunk-sa48rtjz.js → chunk-pnrftncm.js} +1 -1
  90. package/dist/cli/{chunk-mxgtz5vz.js → chunk-pqr6td4z.js} +1 -1
  91. package/dist/cli/chunk-q8ffd1pc.js +3 -0
  92. package/dist/cli/{chunk-snqa07h6.js → chunk-qcjkactr.js} +1 -1
  93. package/dist/cli/{chunk-tjj9bt7n.js → chunk-qqr4tfhk.js} +1 -1
  94. package/dist/cli/chunk-qs359899.js +3 -0
  95. package/dist/cli/{chunk-sza3tyhs.js → chunk-qzzmd63x.js} +2 -3
  96. package/dist/cli/{chunk-xkmdxcjg.js → chunk-r2bb8b11.js} +1 -1
  97. package/dist/cli/{chunk-rtpa8hg3.js → chunk-rjfdzjhj.js} +1 -1
  98. package/dist/cli/chunk-rjy900p4.js +4 -0
  99. package/dist/cli/chunk-rmsdybs3.js +20 -0
  100. package/dist/cli/{chunk-y5axx6ev.js → chunk-rztqccs3.js} +1 -1
  101. package/dist/cli/chunk-s1308b3d.js +63 -0
  102. package/dist/cli/{chunk-b492aee1.js → chunk-se00fc8v.js} +1 -1
  103. package/dist/cli/chunk-shtm72c0.js +3 -0
  104. package/dist/cli/{chunk-dpq60qph.js → chunk-t9vjj8sy.js} +1 -1
  105. package/dist/cli/chunk-ta1p2nwa.js +6 -0
  106. package/dist/cli/chunk-teh40faw.js +1 -1
  107. package/dist/cli/{chunk-gqh6atvp.js → chunk-tjhw09bz.js} +1 -1
  108. package/dist/cli/chunk-tnatqcy7.js +2 -0
  109. package/dist/cli/chunk-tq0h3vy6.js +3 -0
  110. package/dist/cli/{chunk-9er68n24.js → chunk-tt58819p.js} +1 -1
  111. package/dist/cli/chunk-tw9tfs1d.js +3 -0
  112. package/dist/cli/chunk-v6dz59gy.js +2 -0
  113. package/dist/cli/chunk-v6v272b3.js +3 -0
  114. package/dist/cli/chunk-vkv1v3xn.js +56 -0
  115. package/dist/cli/chunk-vkz6kkmm.js +24 -0
  116. package/dist/cli/chunk-vp29jgbt.js +4 -0
  117. package/dist/cli/chunk-vpsarakj.js +2 -0
  118. package/dist/cli/{chunk-xbwq4bc0.js → chunk-vr2r2ncm.js} +1 -1
  119. package/dist/cli/{chunk-qvnr8c18.js → chunk-vvqwgcge.js} +1 -1
  120. package/dist/cli/{chunk-5gzpq34w.js → chunk-vwpf55cr.js} +3 -3
  121. package/dist/cli/{chunk-zaw71cf4.js → chunk-vytrhm50.js} +1 -1
  122. package/dist/cli/chunk-w77s2df8.js +3 -0
  123. package/dist/cli/{chunk-bexnp6g4.js → chunk-w7v71t7e.js} +1 -1
  124. package/dist/cli/chunk-wfgrn8p2.js +4 -0
  125. package/dist/cli/chunk-wzss4pzh.js +3 -0
  126. package/dist/cli/chunk-x1ghdmp1.js +2 -0
  127. package/dist/cli/chunk-x1jxxmtc.js +3 -0
  128. package/dist/cli/{chunk-edrxs4cy.js → chunk-x83xbzjd.js} +5 -5
  129. package/dist/cli/{chunk-9trbc3kj.js → chunk-x85rcep5.js} +2 -2
  130. package/dist/cli/{chunk-jd7p0y5x.js → chunk-x89zw7br.js} +1 -1
  131. package/dist/cli/chunk-xg42e2ff.js +19 -0
  132. package/dist/cli/{chunk-sbds7zx4.js → chunk-xte4phd1.js} +1 -1
  133. package/dist/cli/chunk-y8b2p44q.js +1 -1
  134. package/dist/cli/chunk-ys6v36ph.js +2 -0
  135. package/dist/cli/chunk-yzdrhytj.js +10 -0
  136. package/dist/cli/{chunk-39sfhppm.js → chunk-z3qz6enf.js} +1 -1
  137. package/dist/cli/chunk-z3wrbtcq.js +22 -0
  138. package/dist/cli/chunk-z43e08kw.js +4 -0
  139. package/dist/cli/{chunk-t34kjg5y.js → chunk-zpwvjt14.js} +7 -4
  140. package/dist/cli/chunk-zrf93zrx.js +2 -0
  141. package/dist/cli/index.js +9 -12
  142. package/dist/cli/pty-host-node.mjs +259 -32
  143. package/dist/cli/rove-run.js +1 -1
  144. package/dist/cli/rove.js +1 -1
  145. package/dist/completions/rove.bash +2 -2
  146. package/dist/completions/rove.fish +2 -2
  147. package/dist/completions/rove.zsh +2 -2
  148. package/dist/skills/rove/SKILL.md +25 -10
  149. package/dist/skills/rove/references/api-flags.md +30 -14
  150. package/dist/web/assets/index-BVQbpUea.css +1 -0
  151. package/dist/web/assets/index-Cn_7vMHX.js +152 -0
  152. package/dist/web/assets/jetbrains-mono-cyrillic-500-normal-DJqRU3vO.woff +0 -0
  153. package/dist/web/assets/jetbrains-mono-cyrillic-500-normal-DmUKJPL_.woff2 +0 -0
  154. package/dist/web/assets/jetbrains-mono-cyrillic-600-normal-8K4wrrwR.woff +0 -0
  155. package/dist/web/assets/jetbrains-mono-cyrillic-600-normal-EVf6-Yzo.woff2 +0 -0
  156. package/dist/web/assets/jetbrains-mono-greek-500-normal-D7SFKleX.woff +0 -0
  157. package/dist/web/assets/jetbrains-mono-greek-500-normal-JpySY46c.woff2 +0 -0
  158. package/dist/web/assets/jetbrains-mono-greek-600-normal-H7WoG9Et.woff2 +0 -0
  159. package/dist/web/assets/jetbrains-mono-greek-600-normal-mc2nkWzM.woff +0 -0
  160. package/dist/web/assets/jetbrains-mono-latin-500-normal-BWZEU5yA.woff2 +0 -0
  161. package/dist/web/assets/jetbrains-mono-latin-500-normal-CJOVTJB7.woff +0 -0
  162. package/dist/web/assets/jetbrains-mono-latin-600-normal-BfsvjouI.woff +0 -0
  163. package/dist/web/assets/jetbrains-mono-latin-600-normal-C8RAYTDA.woff2 +0 -0
  164. package/dist/web/assets/jetbrains-mono-latin-ext-500-normal-Cut-4mMH.woff2 +0 -0
  165. package/dist/web/assets/jetbrains-mono-latin-ext-500-normal-ckzbgY84.woff +0 -0
  166. package/dist/web/assets/jetbrains-mono-latin-ext-600-normal-BfB_LPfz.woff2 +0 -0
  167. package/dist/web/assets/jetbrains-mono-latin-ext-600-normal-DObL3zCW.woff +0 -0
  168. package/dist/web/assets/jetbrains-mono-vietnamese-500-normal-DNRqzVM1.woff +0 -0
  169. package/dist/web/assets/jetbrains-mono-vietnamese-600-normal-OWROknRo.woff +0 -0
  170. package/dist/web/index.html +2 -2
  171. package/dist/web/relay/index.html +34 -0
  172. package/dist/web/sw.js +52 -0
  173. package/dist/web-ui/assets/{harness-pEyVtWV4.js → harness-C7ciHx2w.js} +2 -2
  174. package/dist/web-ui/assets/{index-Dyg-qcgB.js → index-B1FLht5L.js} +2 -2
  175. package/dist/web-ui/assets/{index-Bsn8NuKa.css → index-BDIkPexK.css} +1 -1
  176. package/dist/web-ui/index.html +2 -2
  177. package/package.json +3 -3
  178. package/dist/cli/chunk-033k4ap7.js +0 -2
  179. package/dist/cli/chunk-0g3sjn8z.js +0 -3
  180. package/dist/cli/chunk-0ppkvphp.js +0 -2
  181. package/dist/cli/chunk-11wyec8z.js +0 -2
  182. package/dist/cli/chunk-15fp4p9v.js +0 -15
  183. package/dist/cli/chunk-1exwrmjd.js +0 -3
  184. package/dist/cli/chunk-1ffqacz9.js +0 -3
  185. package/dist/cli/chunk-2v68zaaa.js +0 -2
  186. package/dist/cli/chunk-2y29zrm1.js +0 -2
  187. package/dist/cli/chunk-4d1v6066.js +0 -3
  188. package/dist/cli/chunk-4dxc29mm.js +0 -2
  189. package/dist/cli/chunk-5zsdjrgz.js +0 -4
  190. package/dist/cli/chunk-68wpp5y8.js +0 -20
  191. package/dist/cli/chunk-6h4qdckd.js +0 -3
  192. package/dist/cli/chunk-6jj82bej.js +0 -2
  193. package/dist/cli/chunk-783d1ba0.js +0 -3
  194. package/dist/cli/chunk-78v1q5mz.js +0 -2
  195. package/dist/cli/chunk-7z463zkx.js +0 -3
  196. package/dist/cli/chunk-97m9nyw7.js +0 -2
  197. package/dist/cli/chunk-9bae7f3m.js +0 -4
  198. package/dist/cli/chunk-b5c7p22a.js +0 -2
  199. package/dist/cli/chunk-b5pytfgm.js +0 -2
  200. package/dist/cli/chunk-b68dd36h.js +0 -3
  201. package/dist/cli/chunk-bbksmb5a.js +0 -3
  202. package/dist/cli/chunk-cpf78z3x.js +0 -4
  203. package/dist/cli/chunk-cyzp2btw.js +0 -63
  204. package/dist/cli/chunk-d9e4ssy7.js +0 -12
  205. package/dist/cli/chunk-e01321zn.js +0 -5
  206. package/dist/cli/chunk-ec7f3wcm.js +0 -3
  207. package/dist/cli/chunk-erx7x9xg.js +0 -97
  208. package/dist/cli/chunk-ewqqwtrj.js +0 -2
  209. package/dist/cli/chunk-fmbv4m3y.js +0 -25
  210. package/dist/cli/chunk-fs51wx31.js +0 -3
  211. package/dist/cli/chunk-fvvb0072.js +0 -3
  212. package/dist/cli/chunk-g263457v.js +0 -2
  213. package/dist/cli/chunk-g3tv8kht.js +0 -2
  214. package/dist/cli/chunk-g53yqr82.js +0 -78
  215. package/dist/cli/chunk-k67vbszb.js +0 -3
  216. package/dist/cli/chunk-kyt9ytz2.js +0 -20
  217. package/dist/cli/chunk-n2ejvjrd.js +0 -3
  218. package/dist/cli/chunk-p4s826r2.js +0 -96
  219. package/dist/cli/chunk-p6334e7v.js +0 -2
  220. package/dist/cli/chunk-q9zgj6kw.js +0 -3
  221. package/dist/cli/chunk-qfe1wf5c.js +0 -2
  222. package/dist/cli/chunk-r40aj7z6.js +0 -2
  223. package/dist/cli/chunk-sqxdfzdq.js +0 -5
  224. package/dist/cli/chunk-sz2xs0a2.js +0 -4
  225. package/dist/cli/chunk-t5y8k772.js +0 -2
  226. package/dist/cli/chunk-vht2e44j.js +0 -10
  227. package/dist/cli/chunk-vjp7drne.js +0 -2
  228. package/dist/cli/chunk-vm551pxs.js +0 -2
  229. package/dist/cli/chunk-w09356fj.js +0 -20
  230. package/dist/cli/chunk-w9cdc97q.js +0 -3
  231. package/dist/cli/chunk-x20bs6bs.js +0 -3
  232. package/dist/cli/chunk-xmqv1zx6.js +0 -2
  233. package/dist/cli/chunk-xn7bk4f9.js +0 -3
  234. package/dist/cli/chunk-zybjm7d5.js +0 -2
  235. package/dist/web/assets/index-C9vaSoIJ.js +0 -113
  236. package/dist/web/assets/index-sA2EEQJw.css +0 -1
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{formatBytes}from"./chunk-my20q579.js";import{hookConfigIssues}from"./chunk-jd7p0y5x.js";import{applyFixes,daemonRestartFix,defaultFixRuntime,engineTabsManualFix,humanOnlyFix,killOrphansManualFix,noEngineFix,reinstallManualFix,resetManualFix,skillInstallFix,spawnHelperFix}from"./chunk-8sggyn8y.js";import{inspectLegacyTmux,legacyTmuxDoctorLines}from"./chunk-gkdfct7t.js";import"./chunk-cyzp2btw.js";import"./chunk-a4hsqj1b.js";import"./chunk-d9e4ssy7.js";import"./chunk-1exwrmjd.js";import"./chunk-k67vbszb.js";import"./chunk-cpgnm1xr.js";import"./chunk-r3s2t9af.js";import"./chunk-6xr1prk6.js";import{describeAccount,detectEngineStatuses,probeableEngineIds,summarizeEngines}from"./chunk-xkmdxcjg.js";import"./chunk-7z463zkx.js";import"./chunk-4hestsjp.js";import"./chunk-qgrg9a5n.js";import"./chunk-2bgmby1d.js";import"./chunk-1rjq808h.js";import"./chunk-gq36nzg8.js";import"./chunk-5mhvjytn.js";import"./chunk-atn06ncf.js";import"./chunk-rzef6szc.js";import{resolveNodeBinary}from"./chunk-sz2xs0a2.js";import"./chunk-fvvb0072.js";import{formatDaemonInfo}from"./chunk-rxqdw6s5.js";import"./chunk-tn9gtf18.js";import"./chunk-xfgqae9t.js";import"./chunk-j1z9kgyd.js";import"./chunk-qvnr8c18.js";import"./chunk-edrxs4cy.js";import"./chunk-03rbg95q.js";import"./chunk-w7zv47mp.js";import"./chunk-2tfnscxk.js";import"./chunk-2w228s7t.js";import"./chunk-etfh8f4z.js";import"./chunk-dmzg9zdc.js";import"./chunk-kg9kmwt9.js";import"./chunk-zsfyj36g.js";import{isStaleInstallError,resolveRoveSpawn}from"./chunk-387ecqb8.js";import"./chunk-kgs56yns.js";import"./chunk-4hnz77xf.js";import"./chunk-2brn8e1y.js";import"./chunk-6h4qdckd.js";import"./chunk-e01321zn.js";import"./chunk-7kysxgbq.js";import{readableLegacyIndexPath}from"./chunk-b68dd36h.js";import"./chunk-ec7f3wcm.js";import"./chunk-xy8be792.js";import"./chunk-h2m7em1e.js";import"./chunk-7ghwdjdc.js";import"./chunk-8t7qbr1e.js";import{CURRENT_VERSION,package_default}from"./chunk-w9cdc97q.js";import{roveSkillState,skillInstallCommand}from"./chunk-68wpp5y8.js";import"./chunk-rfp0ayra.js";import"./chunk-40dgv828.js";import"./chunk-7mwvvj46.js";import"./chunk-32j6y5d1.js";import"./chunk-bejhca6z.js";import{homeDir,kvStatePath,roveStateDir}from"./chunk-z1nj22va.js";import{readPidFile}from"./chunk-br8r72bf.js";import{ROVE_PRODUCT_NAME}from"./chunk-zt7wfnva.js";import"./chunk-yt15y085.js";import{t}from"./chunk-bj6sa371.js";import"./chunk-1ffqacz9.js";import"./chunk-cmp64q4j.js";import{RoveDaemonClient,isForeignDaemonHome}from"./chunk-sza3tyhs.js";import"./chunk-96kvwzj8.js";import"./chunk-0g4wc808.js";import"./chunk-pn5ygqn6.js";import{defaultDaemonLogPath,defaultDaemonPidPath,defaultDaemonSocketPath,defaultPtyHostLogPath,defaultPtyHostPidPath,defaultPtyHostSocketPath}from"./chunk-eqdbfgq5.js";import{preRenameStateDir}from"./chunk-f8gg8cqh.js";import"./chunk-nc46gddg.js";import"./chunk-pxk2c2vj.js";import{__require}from"./chunk-91sykzqq.js";import{existsSync,readFileSync as readFileSync2,statSync as statSync2}from"fs";import{join as join2}from"path";var MIN_BUN_VERSION=package_default.engines.bun.match(/\d+\.\d+\.\d+/)?.[0]??"0.0.0";function parseBunVersion(raw){return raw.trim().match(/^v?(\d+\.\d+\.\d+)/)?.[1]??null}function isBunAtLeast(raw,minimum=MIN_BUN_VERSION){let found=parseBunVersion(raw),floor=parseBunVersion(minimum);if(!found||!floor)return!0;let a=found.split(".").map(Number),b=floor.split(".").map(Number);for(let i=0;i<3;i++){let av=a[i]??0,bv=b[i]??0;if(av!==bv)return av>bv}return!0}function classifyHookChannel(input){let total=0,hooked=0;for(let tabs of Object.values(input.tabs))for(let entry of Object.values(tabs))if(total++,entry.source==="hook")hooked++;if(total===0)return{kind:"no-tabs"};if(hooked===0)return{kind:"down",totalTabs:total};return{kind:"live",hookTabs:hooked,totalTabs:total}}function hookChannelDoctorLines(verdict,input,cliName){let configLines=(input.configIssues??[]).flatMap((issue)=>[` \u26A0 hook install skipped: ${issue.file}`,` ${issue.reason} \u2014 fix the file, then relaunch Rove`]);if(verdict.kind==="no-tabs")return["hooks: \u2014 no engine tabs yet (nothing to check)",...configLines];if(verdict.kind==="live")return[`hooks: \u2713 engine hook channel live (${verdict.hookTabs}/${verdict.totalTabs} tab(s) hook-sourced)`,...configLines];let out=[`hooks: \u2717 NO hook events reaching the daemon (0/${verdict.totalTabs} tab(s) hook-sourced)`," badges fall back to a ~10s poll, so activity looks seconds late",` daemon socket: ${input.socketPath}`,...configLines];return out.push(' \u2192 compare with an engine tab\'s own path: `ps eww -p <engine-pid> | tr " " "\\n" | grep DAEMON_SOCKET_PATH`',` \u2192 restart the engine tabs (they may hold a stale socket path), or run \`${cliName} daemon restart\``,` \u2192 debug one hook directly: \`ROVE_HOOK_DEBUG=1 echo '{}' | ${cliName} hook turn-start --engine claude\``),out}import{readdirSync,statSync}from"fs";import{createRequire}from"module";import{dirname,join}from"path";function installedSpawnHelpers(){let pkg;try{pkg=dirname(createRequire(import.meta.url).resolve("node-pty/package.json"))}catch{return[]}let prebuilds=join(pkg,"prebuilds"),arches;try{arches=readdirSync(prebuilds).filter((name)=>name.startsWith("darwin-"))}catch{return[]}let helpers=[];for(let arch of arches){let path=join(prebuilds,arch,"spawn-helper");try{helpers.push({path,executable:(statSync(path).mode&64)!==0})}catch{}}return helpers}function spawnHelperDoctorLines(helpers){let broken=helpers.filter((helper)=>!helper.executable).map((helper)=>helper.path);if(helpers.length===0)return{lines:["node-pty: ? no darwin spawn-helper found next to node-pty"],broken};if(broken.length===0)return{lines:[`node-pty: \u2713 spawn-helper executable (${helpers.length} arch)`],broken};return{lines:["node-pty: \u2717 spawn-helper is not executable \u2014 every node-pty PTY spawn fails",...broken.map((path)=>` ${path}`),` \u2192 chmod 755 ${broken.join(" ")}`],broken}}import{appendFileSync,readFileSync}from"fs";var PTY_MARKER="ROVE_TERMINAL_PTY=1",run=async(argv)=>{try{let proc=Bun.spawn([...argv],{stdin:"ignore",stdout:"pipe",stderr:"ignore"}),[stdout,code]=await Promise.all([new Response(proc.stdout).text().catch(()=>""),proc.exited]);return{code,stdout}}catch{return{code:127,stdout:""}}};function parsePsRows(output){let rows=[];for(let line of output.split(`
2
+ import{formatBytes}from"./chunk-my20q579.js";import{hookConfigIssues}from"./chunk-x89zw7br.js";import{applyFixes,daemonRestartFix,defaultFixRuntime,engineTabsManualFix,humanOnlyFix,killOrphansManualFix,noEngineFix,reinstallManualFix,resetManualFix,skillInstallFix,spawnHelperFix}from"./chunk-3y0z478f.js";import{inspectLegacyTmux,legacyTmuxDoctorLines}from"./chunk-gkdfct7t.js";import"./chunk-s1308b3d.js";import"./chunk-1g6vhgfe.js";import"./chunk-a4hsqj1b.js";import"./chunk-6hcyvg0m.js";import{skillOverview}from"./chunk-5vrg6h71.js";import"./chunk-tq0h3vy6.js";import"./chunk-cpgnm1xr.js";import"./chunk-r3s2t9af.js";import"./chunk-6xr1prk6.js";import{describeAccount,detectEngineStatuses,probeableEngineIds,summarizeEngines}from"./chunk-r2bb8b11.js";import"./chunk-q8ffd1pc.js";import"./chunk-4hestsjp.js";import"./chunk-qgrg9a5n.js";import"./chunk-2bgmby1d.js";import"./chunk-n0rdn2fn.js";import"./chunk-5mhvjytn.js";import"./chunk-atn06ncf.js";import"./chunk-vp29jgbt.js";import"./chunk-gq36nzg8.js";import{resolveNodeBinary}from"./chunk-z43e08kw.js";import"./chunk-w77s2df8.js";import"./chunk-mqfvzdpr.js";import{formatDaemonInfo}from"./chunk-rxqdw6s5.js";import"./chunk-atg13xab.js";import"./chunk-xfgqae9t.js";import"./chunk-j1z9kgyd.js";import"./chunk-g9ba25q5.js";import"./chunk-tn9gtf18.js";import{isStaleInstallError,resolveRoveSpawn}from"./chunk-e58kj4gm.js";import"./chunk-0a65j1zj.js";import"./chunk-bcyex84w.js";import"./chunk-vvqwgcge.js";import"./chunk-x83xbzjd.js";import"./chunk-2tfnscxk.js";import"./chunk-hzz020xx.js";import"./chunk-w7zv47mp.js";import"./chunk-2w228s7t.js";import"./chunk-etfh8f4z.js";import"./chunk-rfp0ayra.js";import"./chunk-dmzg9zdc.js";import"./chunk-40dgv828.js";import"./chunk-kg9kmwt9.js";import{CURRENT_VERSION,package_default}from"./chunk-9ckvdy0j.js";import"./chunk-zsfyj36g.js";import"./chunk-2brn8e1y.js";import"./chunk-7mwvvj46.js";import"./chunk-32j6y5d1.js";import{t}from"./chunk-mjyhy152.js";import"./chunk-wzss4pzh.js";import"./chunk-cmp64q4j.js";import{RoveDaemonClient,isForeignDaemonHome}from"./chunk-qzzmd63x.js";import"./chunk-96kvwzj8.js";import"./chunk-7bakcyes.js";import"./chunk-8qkyd589.js";import"./chunk-7kysxgbq.js";import{readableLegacyIndexPath}from"./chunk-hz1x3hak.js";import"./chunk-x1jxxmtc.js";import"./chunk-xy8be792.js";import"./chunk-h2m7em1e.js";import"./chunk-7ghwdjdc.js";import"./chunk-8t7qbr1e.js";import"./chunk-bejhca6z.js";import{readPidFile}from"./chunk-br8r72bf.js";import"./chunk-yt15y085.js";import{homeDir,kvStatePath,roveStateDir}from"./chunk-z1nj22va.js";import{ROVE_PRODUCT_NAME}from"./chunk-zt7wfnva.js";import"./chunk-0g4wc808.js";import"./chunk-pn5ygqn6.js";import{defaultDaemonLogPath,defaultDaemonPidPath,defaultDaemonSocketPath,defaultPtyHostLogPath,defaultPtyHostPidPath,defaultPtyHostSocketPath}from"./chunk-eqdbfgq5.js";import{preRenameStateDir}from"./chunk-f8gg8cqh.js";import"./chunk-nc46gddg.js";import"./chunk-pxk2c2vj.js";import{__require}from"./chunk-91sykzqq.js";import{existsSync,readFileSync as readFileSync2,statSync as statSync2}from"fs";import{join as join2}from"path";var MIN_BUN_VERSION=package_default.engines.bun.match(/\d+\.\d+\.\d+/)?.[0]??"0.0.0";function parseBunVersion(raw){return raw.trim().match(/^v?(\d+\.\d+\.\d+)/)?.[1]??null}function isBunAtLeast(raw,minimum=MIN_BUN_VERSION){let found=parseBunVersion(raw),floor=parseBunVersion(minimum);if(!found||!floor)return!0;let a=found.split(".").map(Number),b=floor.split(".").map(Number);for(let i=0;i<3;i++){let av=a[i]??0,bv=b[i]??0;if(av!==bv)return av>bv}return!0}function classifyHookChannel(input){let total=0,hooked=0;for(let tabs of Object.values(input.tabs))for(let entry of Object.values(tabs))if(total++,entry.source==="hook")hooked++;if(total===0)return{kind:"no-tabs"};if(hooked===0)return{kind:"down",totalTabs:total};return{kind:"live",hookTabs:hooked,totalTabs:total}}function hookChannelDoctorLines(verdict,input,cliName){let configLines=(input.configIssues??[]).flatMap((issue)=>[` \u26A0 hook install skipped: ${issue.file}`,` ${issue.reason} \u2014 fix the file, then relaunch Rove`]);if(verdict.kind==="no-tabs")return["hooks: \u2014 no engine tabs yet (nothing to check)",...configLines];if(verdict.kind==="live")return[`hooks: \u2713 engine hook channel live (${verdict.hookTabs}/${verdict.totalTabs} tab(s) hook-sourced)`,...configLines];let out=[`hooks: \u2717 NO hook events reaching the daemon (0/${verdict.totalTabs} tab(s) hook-sourced)`," badges fall back to a ~10s poll, so activity looks seconds late",` daemon socket: ${input.socketPath}`,...configLines];return out.push(' \u2192 compare with an engine tab\'s own path: `ps eww -p <engine-pid> | tr " " "\\n" | grep DAEMON_SOCKET_PATH`',` \u2192 restart the engine tabs (they may hold a stale socket path), or run \`${cliName} daemon restart\``,` \u2192 debug one hook directly: \`ROVE_HOOK_DEBUG=1 echo '{}' | ${cliName} hook turn-start --engine claude\``),out}import{readdirSync,statSync}from"fs";import{createRequire}from"module";import{dirname,join}from"path";function installedSpawnHelpers(){let pkg;try{pkg=dirname(createRequire(import.meta.url).resolve("node-pty/package.json"))}catch{return[]}let prebuilds=join(pkg,"prebuilds"),arches;try{arches=readdirSync(prebuilds).filter((name)=>name.startsWith("darwin-"))}catch{return[]}let helpers=[];for(let arch of arches){let path=join(prebuilds,arch,"spawn-helper");try{helpers.push({path,executable:(statSync(path).mode&64)!==0})}catch{}}return helpers}function spawnHelperDoctorLines(helpers){let broken=helpers.filter((helper)=>!helper.executable).map((helper)=>helper.path);if(helpers.length===0)return{lines:["node-pty: ? no darwin spawn-helper found next to node-pty"],broken};if(broken.length===0)return{lines:[`node-pty: \u2713 spawn-helper executable (${helpers.length} arch)`],broken};return{lines:["node-pty: \u2717 spawn-helper is not executable \u2014 every node-pty PTY spawn fails",...broken.map((path)=>` ${path}`),` \u2192 chmod 755 ${broken.join(" ")}`],broken}}import{appendFileSync,readFileSync}from"fs";var PTY_MARKER="ROVE_TERMINAL_PTY=1",run=async(argv)=>{try{let proc=Bun.spawn([...argv],{stdin:"ignore",stdout:"pipe",stderr:"ignore"}),[stdout,code]=await Promise.all([new Response(proc.stdout).text().catch(()=>""),proc.exited]);return{code,stdout}}catch{return{code:127,stdout:""}}};function parsePsRows(output){let rows=[];for(let line of output.split(`
3
3
  `)){let parts=line.trim().split(/\s+/);if(parts.length<6)continue;let[pid,ppid,pgid]=[parts[0],parts[1],parts[2]].map((value)=>Number.parseInt(value??"",10)),rssKb=Number.parseInt(parts[4]??"",10);if(!Number.isFinite(pid)||!Number.isFinite(ppid)||!Number.isFinite(pgid)||!Number.isFinite(rssKb))continue;rows.push({pid,ppid,pgid,etime:parts[3]??"",rssKb,command:parts.slice(5).join(" ")})}return rows}function pidAlive(pid,rows){return rows.some((row)=>row.pid===pid)}function orphanCandidates(rows,selfPgid,liveSessionPids){return rows.filter((row)=>row.ppid===1&&row.pgid!==selfPgid&&!liveSessionPids.has(row.pgid)&&!pidAlive(row.pgid,rows))}async function markedPids(pids,deps={}){let runProbe=deps.run??run,readEnviron=deps.readEnviron??((pid)=>readFileSync(`/proc/${pid}/environ`,"utf8")),marked=new Set;if(pids.length===0)return{marked,failed:null};if((deps.platform??process.platform)==="linux"){let refused=null;for(let pid of pids)try{if(readEnviron(pid).split("\x00").includes(PTY_MARKER))marked.add(pid)}catch(err){let code=err.code;if(code!=="ENOENT"&&code!=="ESRCH")refused??=`/proc/${pid}/environ: ${code??"unreadable"}`}return{marked,failed:refused}}let result=await runProbe(["ps","eww","-o","pid=,command=","-p",pids.join(",")]);if(result.code!==0)return{marked,failed:`ps eww exited ${result.code}`};let marker=new RegExp(`(^|\\s)${PTY_MARKER}(\\s|$)`);for(let line of result.stdout.split(`
4
4
  `)){let pid=Number.parseInt(line.trim().split(/\s+/)[0]??"",10);if(Number.isFinite(pid)&&marker.test(line))marked.add(pid)}return{marked,failed:null}}async function ownPgid(runProbe){let result=await runProbe(["ps","-o","pgid=","-p",String(process.pid)]),pgid=Number.parseInt(result.stdout.trim(),10);return Number.isFinite(pgid)?pgid:-1}async function collectOrphans(liveSessionPids,deps={}){let runProbe=deps.run??run;if((deps.platform??process.platform)==="win32")return{orphans:[],error:null};let ps=await runProbe(["ps","-A","-o","pid=,ppid=,pgid=,etime=,rss=,command="]);if(ps.code!==0)return{orphans:[],error:`could not read the process table \u2014 ps exited ${ps.code}`};let rows=parsePsRows(ps.stdout),candidates=orphanCandidates(rows,await ownPgid(runProbe),liveSessionPids),{marked,failed}=await markedPids(candidates.map((row)=>row.pid),deps);if(failed)return{orphans:[],error:`could not read process environments \u2014 ${failed}`};return{orphans:candidates.filter((row)=>marked.has(row.pid)),error:null}}function formatMb(rssKb){return`${(rssKb/1024).toFixed(0)} MB`}function orphanDoctorLines(orphans,error,cliName,killing=!1){if(error)return[`orphans: \u2717 ${error}`];if(orphans.length===0)return["orphans: \u2713 none \u2014 no processes left behind by a dead PTY session"];let totalMb=orphans.reduce((sum,row)=>sum+row.rssKb,0)/1024,lines=[`orphans: \u26A0 ${orphans.length} process(es) outlived the PTY session that spawned them (${totalMb.toFixed(0)} MB RSS)`," each is reparented to init, carries Rove's PTY marker, and its process"," group leader is gone \u2014 no live task owns them"];for(let row of[...orphans].sort((a,b)=>b.rssKb-a.rssKb))lines.push(` pid ${row.pid} (group ${row.pgid}) up ${row.etime}, ${formatMb(row.rssKb)}: ${row.command.slice(0,90)}`);if(!killing)lines.push(` \u2192 \`${cliName} doctor --kill-orphans\` ends those process groups (SIGTERM, then SIGKILL)`," read the list first: something you backgrounded from a Rove terminal and then"," closed the tab on looks exactly like a leak, and doctor cannot tell them apart");return lines}var GROUP_EXIT_GRACE_MS=2000,GROUP_POLL_MS=100;function logOrphanKill(pgid,signal,logPath=defaultDaemonLogPath()){try{appendFileSync(logPath,formatDaemonInfo("doctor-kill-orphans",`${signal} process group ${pgid}`))}catch{}}function groupAlive(pgid){try{return process.kill(-pgid,0),!0}catch(err){return err.code!=="ESRCH"}}async function killOrphanGroups(orphans){let groups=[...new Set(orphans.map((row)=>row.pgid))];for(let pgid of groups)try{process.kill(-pgid,"SIGTERM"),logOrphanKill(pgid,"SIGTERM")}catch{}let deadline=Date.now()+GROUP_EXIT_GRACE_MS,survivors=groups.filter(groupAlive);while(survivors.length>0&&Date.now()<deadline)await new Promise((resolve)=>setTimeout(resolve,GROUP_POLL_MS)),survivors=survivors.filter(groupAlive);for(let pgid of survivors)try{process.kill(-pgid,"SIGKILL"),logOrphanKill(pgid,"SIGKILL")}catch{}return await new Promise((resolve)=>setTimeout(resolve,GROUP_POLL_MS)),{groups,survivors:survivors.filter(groupAlive)}}function multiplexerLabel(env){if(env.TMUX)return"tmux";if(env.ZELLIJ)return"zellij";if(env.STY)return"screen";return"no"}function terminalEnvLines(env){let show=(v)=>v&&v.length>0?v:"(unset)",program=env.TERM_PROGRAM?`${env.TERM_PROGRAM}${env.TERM_PROGRAM_VERSION?` v${env.TERM_PROGRAM_VERSION}`:""}`:"(unset)";return[`terminal: TERM=${show(env.TERM)} TERM_PROGRAM=${program} COLORTERM=${show(env.COLORTERM)}`,` running inside a multiplexer: ${multiplexerLabel(env)}`]}function parseKittyProbeReply(data){let kitty=data.match(/\x1b\[\?(\d+)u/);if(kitty?.[1]!==void 0)return{kind:"supported",flags:Number.parseInt(kitty[1],10)};if(/\x1b\[\?[\d;]*c/.test(data))return{kind:"unsupported"};return null}function kittyProbeLine(result){switch(result.kind){case"supported":return` kitty keyboard protocol: \u2713 answered (flags=${result.flags})`;case"unsupported":return[" kitty keyboard protocol: \u2717 not supported \u2014 legacy key path"," (ctrl+h/ctrl+j arrive as C0 backspace/linefeed bytes; the"," split chords ctrl+\\ and ctrl+= cannot be encoded at all)"].join(`
5
5
  `);case"no-response":return" kitty keyboard protocol: ? no reply (terminal ignored both the kitty query and DA1)";case"skipped":return` kitty keyboard protocol: skipped (${result.reason})`}}async function probeKittyKeyboard(timeoutMs=300){let stdin=process.stdin;if(!stdin.isTTY||!process.stdout.isTTY)return{kind:"skipped",reason:"not an interactive terminal"};let wasRaw=stdin.isRaw===!0,buffer="";return await new Promise((resolve)=>{let done=!1,finish=(result)=>{if(done)return;if(done=!0,clearTimeout(timer),stdin.off("data",onData),stdin.pause(),!wasRaw)stdin.setRawMode(!1);resolve(result)},onData=(chunk)=>{buffer+=chunk.toString("latin1");let decided=parseKittyProbeReply(buffer);if(decided)finish(decided)},timer=setTimeout(()=>finish({kind:"no-response"}),timeoutMs);stdin.setRawMode(!0),stdin.resume(),stdin.on("data",onData),process.stdout.write("\x1B[?u\x1B[c")})}async function terminalDoctorLines(){return[...terminalEnvLines(process.env),kittyProbeLine(await probeKittyKeyboard())]}async function probeGit(){try{let proc=Bun.spawn(["git","--version"],{stdin:"ignore",stdout:"pipe",stderr:"ignore"}),text=(await new Response(proc.stdout).text()).trim();if(await proc.exited===0&&text)return{line:`git: \u2713 ${text}`,found:!0}}catch{}return{line:"git: \u2717 not found on PATH",found:!1}}function binaryLabel(binary){return binary.found?`\u2713 ${binary.path}`:`\u2717 ${binary.error}`}async function probeEngines(){let statuses=await detectEngineStatuses(await probeableEngineIds()),lines=["engines:"];for(let status of statuses){let account=describeAccount(status.account),name=`${status.vendor.padEnd(7)} `;if(lines.push(` ${name}${binaryLabel(status.binary)}${status.binary.found?` \u2014 ${account}`:""}`),status.accountError)lines.push(` \u26A0 ${status.accountError}`)}let{usable,signedOut}=summarizeEngines(statuses);return{lines,anyUsable:usable.length>0,signedOut}}var CLI_NAME=ROVE_PRODUCT_NAME;function isProcessAlive(pid){try{return process.kill(pid,0),!0}catch(err){return err.code==="EPERM"}}async function requestIfReachable(socketPath,name){let client=new RoveDaemonClient(socketPath);try{return await client.request(name,{})}catch{return null}finally{client.close()}}function fmtDuration(ms){let seconds=Math.floor(ms/1000);if(seconds<60)return`${seconds}s`;let minutes=Math.floor(seconds/60);if(minutes<60)return`${minutes}m ${seconds%60}s`;return`${Math.floor(minutes/60)}h ${minutes%60}m`}function describeFile(path){try{let stat=statSync2(path);return`present (${formatBytes(stat.size)}, modified ${stat.mtime.toISOString()})`}catch{return"absent"}}function taskCount(path){try{let parsed=JSON.parse(readFileSync2(path,"utf8"));return Array.isArray(parsed.tasks)?parsed.tasks.length:null}catch{return null}}function tailFile(path,count){try{return readFileSync2(path,"utf8").split(`
@@ -7,7 +7,7 @@ import{formatBytes}from"./chunk-my20q579.js";import{hookConfigIssues}from"./chun
7
7
  `)}catch{return""}}function describeInstall(){try{let[,entry]=resolveRoveSpawn([]);return{line:`install: \u2713 ${entry??process.execPath}`,ok:!0}}catch(err){if(!isStaleInstallError(err))return{line:`install: ? could not check (${String(err)})`,ok:!0};return{line:["install: \u2717 GONE \u2014 this process is running from an install that no longer exists on disk"," it cannot start a daemon; every reconnect fails the same way until you reinstall"," \u2192 npm install -g @sma1lboy/rove (then relaunch Rove)"].join(`
8
8
  `),ok:!1}}}async function appendUnavailableProcess(out,label,pidPath,socketPath){let pid=await readPidFile(pidPath),wedged=pid!==null&&pid!==void 0&&isProcessAlive(pid);if(wedged)out.push(`${label}: \u2717 WEDGED \u2014 process alive (pid ${pid}) but socket is unreachable`);else if(pid)out.push(`${label}: \u2717 not running (stale pidfile \u2192 pid ${pid} is gone)`);else out.push(`${label}: \u2717 not running (no pidfile)`);if(existsSync(socketPath))out.push(` orphan socket file present: ${socketPath}`);return wedged?"wedged":"down"}async function collectDoctor(){let daemonSocket=defaultDaemonSocketPath(),daemonLog=defaultDaemonLogPath(),ptySocket=defaultPtyHostSocketPath(),ptyLog=defaultPtyHostLogPath(),canonicalTasks=join2(roveStateDir(),"tasks.json"),legacyTasks=join2(preRenameStateDir(homeDir()),"tasks.json"),readableLegacy=readableLegacyIndexPath(canonicalTasks,legacyTasks),usingLegacyTasks=!existsSync(canonicalTasks)&&readableLegacy!==void 0&&existsSync(readableLegacy),tasksPath=usingLegacyTasks?legacyTasks:canonicalTasks,statePath=kvStatePath(),fixes=[],git=await probeGit();if(!git.found)fixes.push(humanOnlyFix("git"));let engines=await probeEngines();if(!engines.anyUsable)fixes.push(noEngineFix(engines.signedOut));let install=describeInstall();if(!install.ok)fixes.push(reinstallManualFix());let staleBun=!isBunAtLeast(Bun.version);if(staleBun)fixes.push(humanOnlyFix("staleBun"));let out=["Rove doctor",` build: v${CURRENT_VERSION} (${process.platform} ${process.arch}, bun ${Bun.version})`,...staleBun?[` \u26A0 bun ${Bun.version} is below the ${MIN_BUN_VERSION} Rove needs \u2014 terminals will not paint`]:[],` home: ${homeDir()}`,"",...await terminalDoctorLines(),git.line,"",...engines.lines,"",install.line,""],daemon=await requestIfReachable(daemonSocket,"daemon.status");if(daemon){let pid=typeof daemon.daemonPid==="number"?daemon.daemonPid:"?",uptime=typeof daemon.uptimeMs==="number"?fmtDuration(daemon.uptimeMs):"?",tasks=typeof daemon.taskCount==="number"?daemon.taskCount:"?",clients=typeof daemon.attachedClients==="number"?daemon.attachedClients:"?";out.push(`daemon: \u2713 running (pid ${pid}, up ${uptime}, ${tasks} task(s), ${clients} client(s))`);let version=typeof daemon.roveVersion==="string"?daemon.roveVersion:void 0;if(version&&version!==CURRENT_VERSION)out.push(` \u26A0 stale build: daemon is v${version}, you launched v${CURRENT_VERSION}`),out.push(` \u2192 run \`${CLI_NAME} daemon restart\`, then relaunch Rove`),fixes.push(daemonRestartFix(CLI_NAME,"daemonStale"));else if(version)out.push(` build: v${version}`);if(isForeignDaemonHome(typeof daemon.homeDir==="string"?daemon.homeDir:void 0,homeDir()))out.push(` \u26A0 foreign home: daemon serves ${String(daemon.homeDir)}, you are reading ${homeDir()}`),out.push(` \u2192 clear ROVE_HOME_DIR/ROVE_HOME_DIR, then \`${CLI_NAME} daemon restart\``);let tabs=(await requestIfReachable(daemonSocket,"debug.inspect"))?.activity?.tabs;if(tabs){let hookInput={socketPath:daemonSocket,configIssues:hookConfigIssues()},verdict=classifyHookChannel({tabs,...hookInput});if(out.push("",...hookChannelDoctorLines(verdict,hookInput,CLI_NAME)),verdict.kind==="down")fixes.push(daemonRestartFix(CLI_NAME,"hooksDown"),engineTabsManualFix())}else out.push("","hooks: ? could not read the daemon's activity registry (debug.inspect unavailable)"),fixes.push(daemonRestartFix(CLI_NAME,"inspectStale"))}else{let state=await appendUnavailableProcess(out,"daemon ",defaultDaemonPidPath(),daemonSocket);fixes.push(state==="wedged"?resetManualFix(CLI_NAME,"resetDaemonWedged"):daemonRestartFix(CLI_NAME,"daemonDown"));let tail=tailFile(daemonLog,8);if(tail){out.push(" last lines of daemon.log:");for(let line of tail.split(`
9
9
  `))out.push(` \u2502 ${line}`)}}out.push("");let inventory=await requestIfReachable(ptySocket,"pty.list");if(inventory){let sessions=inventory.sessions??[],parked=inventory.stats?.parkedSessions??sessions.filter((session)=>session.parked).length;if(out.push(`pty host: \u2713 running (${sessions.length} session(s), ${sessions.filter((session)=>session.alive).length} live, ${parked} parked)`),typeof inventory.pid==="number"&&typeof inventory.rssBytes==="number")out.push(` pid ${inventory.pid}, ${formatBytes(inventory.rssBytes)} RSS`);let hostVersion=typeof inventory.version==="string"?inventory.version:void 0;if(hostVersion===void 0)out.push(" build: unknown \u2014 this host predates the version check, so it is at least that old"),out.push(` \u2192 \`${CLI_NAME} reset\` replaces it (ends every live terminal and engine session)`);else if(hostVersion!==CURRENT_VERSION)out.push(` \u26A0 stale build: pty host is v${hostVersion}, you launched v${CURRENT_VERSION}`),out.push(` \u2192 \`${CLI_NAME} reset\` replaces it (ends every live terminal and engine session)`),fixes.push(resetManualFix(CLI_NAME,"resetPtyStale"));else out.push(` build: v${hostVersion}`);let stats=inventory.stats;if(stats&&typeof stats.ringBytes==="number"&&typeof stats.ringCapacityBytes==="number")out.push(` ring: ${formatBytes(stats.ringBytes)} / ${formatBytes(stats.ringCapacityBytes)}`);if(stats&&typeof stats.parkedScreenBytes==="number")out.push(` parked screens: ${formatBytes(stats.parkedScreenBytes)}`);if(stats&&typeof stats.parkRestoreDeltas==="number"&&typeof stats.parkRestoreFallbacks==="number")out.push(` park wakes: ${stats.parkRestoreDeltas} delta, ${stats.parkRestoreFallbacks} full replay fallback`)}else if(await appendUnavailableProcess(out,"pty host",defaultPtyHostPidPath(),ptySocket)==="wedged")fixes.push(resetManualFix(CLI_NAME,"resetPty"));else out.push(" starts on demand \u2014 the first task tab launches it; nothing to fix");if(process.platform==="win32"){let node=resolveNodeBinary();if(out.push(node?` node: \u2713 ${node} (the Windows PTY host runs under it)`:` node: \u2717 not found on PATH \u2014 the Windows PTY host cannot start
10
- \u2192 install Node.js from https://nodejs.org`),!node)fixes.push(humanOnlyFix("windowsNode"))}if(process.platform==="darwin"){let helpers=spawnHelperDoctorLines(installedSpawnHelpers());if(out.push(...helpers.lines),helpers.broken.length>0)fixes.push(spawnHelperFix(helpers.broken))}out.push("");let liveSessionPids=new Set;for(let session of inventory?.sessions??[])if(session.alive&&typeof session.pid==="number")liveSessionPids.add(session.pid);let orphaned=await collectOrphans(liveSessionPids);if(out.push(...orphanDoctorLines(orphaned.orphans,orphaned.error,CLI_NAME),""),orphaned.orphans.length>0)fixes.push(killOrphansManualFix(CLI_NAME,orphaned.orphans.length));let legacy=await inspectLegacyTmux();if(out.push(...legacyTmuxDoctorLines(legacy),""),legacy.sessions.length>0)fixes.push(resetManualFix(CLI_NAME,"resetLegacy"));let skill=roveSkillState(),installCommand=skillInstallCommand();if(!skill.installed)out.push("skill: \u2717 Rove agent skill not installed",` \u2192 ${installCommand}`),fixes.push(skillInstallFix(installCommand,!1));else if(skill.stale){let installed=skill.installedVersion===null?"unstamped":`v${skill.installedVersion}`;out.push(`skill: \u26A0 Rove agent skill out of date (${installed}; this Rove wants v${skill.currentVersion})`),out.push(` \u2192 ${installCommand}`),fixes.push(skillInstallFix(installCommand,!0))}else out.push(`skill: \u2713 Rove agent skill installed (v${skill.installedVersion})`);out.push("");let count=taskCount(tasksPath);return out.push(`tasks.json: ${describeFile(tasksPath)}${count===null?"":` \u2014 ${count} task(s)`}${usingLegacyTasks?` (legacy ${tasksPath}, not yet migrated)`:""}`),out.push(`state.json: ${describeFile(statePath)}`),out.push(`daemon.log: ${describeFile(daemonLog)}`),out.push(`pty.log: ${describeFile(ptyLog)}`),{lines:out,fixes,orphans:orphaned.orphans}}async function sweepOrphans(orphans){if(orphans.length===0)return["orphans: nothing to kill"];let{groups,survivors}=await killOrphanGroups(orphans),lines=[`orphans: signalled ${groups.length} process group(s) covering ${orphans.length} process(es)`];if(survivors.length>0)lines.push(` \u2717 still alive after SIGKILL: group(s) ${survivors.join(", ")} \u2014 inspect with \`ps -g <pgid>\``);else lines.push(" \u2713 all of them are gone");return lines}async function runDoctorSubcommand(argv=[]){if(argv.some((arg)=>arg==="--help"||arg==="-h"||arg==="help")){process.stdout.write([`Usage: ${CLI_NAME} doctor [--report] [--fix] [--kill-orphans]`,"","Read-only diagnosis of the daemon / Hosted PTY / engines / git / legacy tmux / state.","","Options:"," --report Also write a bug bundle (diagnosis + recent logs + env) to a file"," --fix Review the fixes one by one: safe ones run after a per-fix y/N,"," risky ones (kill sessions, install software) are printed only"," --kill-orphans End the process groups listed under `orphans:` (SIGTERM, then"," SIGKILL). Not undoable \u2014 run plain `doctor` and read the list first"," -h, --help Print this help",""].join(`
10
+ \u2192 install Node.js from https://nodejs.org`),!node)fixes.push(humanOnlyFix("windowsNode"))}if(process.platform==="darwin"){let helpers=spawnHelperDoctorLines(installedSpawnHelpers());if(out.push(...helpers.lines),helpers.broken.length>0)fixes.push(spawnHelperFix(helpers.broken))}out.push("");let liveSessionPids=new Set;for(let session of inventory?.sessions??[])if(session.alive&&typeof session.pid==="number")liveSessionPids.add(session.pid);let orphaned=await collectOrphans(liveSessionPids);if(out.push(...orphanDoctorLines(orphaned.orphans,orphaned.error,CLI_NAME),""),orphaned.orphans.length>0)fixes.push(killOrphansManualFix(CLI_NAME,orphaned.orphans.length));let legacy=await inspectLegacyTmux();if(out.push(...legacyTmuxDoctorLines(legacy),""),legacy.sessions.length>0)fixes.push(resetManualFix(CLI_NAME,"resetLegacy"));let skill=skillOverview(),installCommand=`${CLI_NAME} skill install`;if(skill.targets.length===0)out.push("skill: \u2013 no coding agent with a known skills dir found");else if(!skill.installed)out.push("skill: \u2717 Rove agent skill not installed",` \u2192 ${installCommand}`),fixes.push(skillInstallFix(installCommand,!1));else if(skill.outdated.length>0)out.push(`skill: \u26A0 Rove agent skill out of date for ${skill.outdated.map((t2)=>t2.displayName).join(", ")}`,` \u2192 ${installCommand}`),fixes.push(skillInstallFix(installCommand,!0));else out.push("skill: \u2713 Rove agent skill installed");out.push("");let count=taskCount(tasksPath);return out.push(`tasks.json: ${describeFile(tasksPath)}${count===null?"":` \u2014 ${count} task(s)`}${usingLegacyTasks?` (legacy ${tasksPath}, not yet migrated)`:""}`),out.push(`state.json: ${describeFile(statePath)}`),out.push(`daemon.log: ${describeFile(daemonLog)}`),out.push(`pty.log: ${describeFile(ptyLog)}`),{lines:out,fixes,orphans:orphaned.orphans}}async function sweepOrphans(orphans){if(orphans.length===0)return["orphans: nothing to kill"];let{groups,survivors}=await killOrphanGroups(orphans),lines=[`orphans: signalled ${groups.length} process group(s) covering ${orphans.length} process(es)`];if(survivors.length>0)lines.push(` \u2717 still alive after SIGKILL: group(s) ${survivors.join(", ")} \u2014 inspect with \`ps -g <pgid>\``);else lines.push(" \u2713 all of them are gone");return lines}async function runDoctorSubcommand(argv=[]){if(argv.some((arg)=>arg==="--help"||arg==="-h"||arg==="help")){process.stdout.write([`Usage: ${CLI_NAME} doctor [--report] [--fix] [--kill-orphans]`,"","Read-only diagnosis of the daemon / Hosted PTY / engines / git / legacy tmux / state.","","Options:"," --report Also write a bug bundle (diagnosis + recent logs + env) to a file"," --fix Review the fixes one by one: safe ones run after a per-fix y/N,"," risky ones (kill sessions, install software) are printed only"," --kill-orphans End the process groups listed under `orphans:` (SIGTERM, then"," SIGKILL). Not undoable \u2014 run plain `doctor` and read the list first"," -h, --help Print this help",""].join(`
11
11
  `));return}let report=argv.some((arg)=>arg==="--report"),fix=argv.some((arg)=>arg==="--fix"),kill=argv.some((arg)=>arg==="--kill-orphans"),known=new Set(["--report","--fix","--kill-orphans"]),unknown=argv.find((arg)=>arg.length>0&&!known.has(arg));if(unknown!==void 0)process.stderr.write(`${CLI_NAME} doctor: unexpected argument "${unknown}"
12
12
 
13
13
  Usage: ${CLI_NAME} doctor [--report] [--fix] [--kill-orphans]
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{machineTasks}from"./chunk-ta1p2nwa.js";import{dedupeMachines,listMachines}from"./chunk-vytrhm50.js";import"./chunk-vp29jgbt.js";import"./chunk-gq36nzg8.js";import"./chunk-sq6zj3fb.js";import"./chunk-tw9tfs1d.js";import"./chunk-61cn88e7.js";import"./chunk-atg13xab.js";import"./chunk-r5j8fycq.js";import"./chunk-xfgqae9t.js";import"./chunk-j1z9kgyd.js";import"./chunk-g9ba25q5.js";import"./chunk-ggnq2vvk.js";import"./chunk-hpay0ax8.js";import"./chunk-catrr0z3.js";import"./chunk-mdc7b01e.js";import"./chunk-tn9gtf18.js";import"./chunk-895yqjjz.js";import"./chunk-sak1tphp.js";import"./chunk-y1xnjx8x.js";import"./chunk-e58kj4gm.js";import"./chunk-0a65j1zj.js";import"./chunk-bcyex84w.js";import"./chunk-vvqwgcge.js";import"./chunk-x83xbzjd.js";import"./chunk-2tfnscxk.js";import"./chunk-hzz020xx.js";import"./chunk-w7zv47mp.js";import"./chunk-rfp0ayra.js";import"./chunk-40dgv828.js";import"./chunk-zsfyj36g.js";import"./chunk-2r1fgng9.js";import"./chunk-2brn8e1y.js";import"./chunk-7mwvvj46.js";import"./chunk-32j6y5d1.js";import"./chunk-mjyhy152.js";import"./chunk-wzss4pzh.js";import"./chunk-cmp64q4j.js";import"./chunk-qzzmd63x.js";import"./chunk-96kvwzj8.js";import"./chunk-7bakcyes.js";import"./chunk-8qkyd589.js";import"./chunk-7kysxgbq.js";import"./chunk-hz1x3hak.js";import"./chunk-x1jxxmtc.js";import"./chunk-xy8be792.js";import"./chunk-h2m7em1e.js";import"./chunk-7ghwdjdc.js";import"./chunk-8t7qbr1e.js";import"./chunk-bejhca6z.js";import"./chunk-br8r72bf.js";import"./chunk-yt15y085.js";import"./chunk-z1nj22va.js";import"./chunk-zt7wfnva.js";import"./chunk-0g4wc808.js";import"./chunk-pn5ygqn6.js";import"./chunk-eqdbfgq5.js";import"./chunk-f8gg8cqh.js";import"./chunk-nc46gddg.js";import"./chunk-pxk2c2vj.js";import"./chunk-91sykzqq.js";async function mergeTaskList(local){let machines=dedupeMachines(listMachines());if(machines.length===0)return local;let tasks=(local.tasks??[]).map((task)=>({...task,origin:{machineId:"local",hostLabel:"local"}}));for(let entry of machines){let remote=await machineTasks(entry);if(!remote)continue;let hostLabel=entry.alias;for(let task of remote)tasks.push({...task,origin:{machineId:entry.alias,hostLabel}})}return{tasks}}export{mergeTaskList};
@@ -1,12 +1,11 @@
1
1
  // @bun
2
- import{BUNDLED_THEME_JSONS,userThemesDir,validateTheme}from"./chunk-yzkhwn31.js";import{expandTilde}from"./chunk-2r1fgng9.js";import{errorMessage}from"./chunk-2brn8e1y.js";import"./chunk-7ghwdjdc.js";import{SUBCOMMAND_VERBS}from"./chunk-tjj9bt7n.js";import"./chunk-z1nj22va.js";import{ROVE_PRODUCT_NAME}from"./chunk-zt7wfnva.js";import"./chunk-pn5ygqn6.js";import"./chunk-f8gg8cqh.js";import"./chunk-nc46gddg.js";import"./chunk-91sykzqq.js";import{existsSync,mkdirSync,readFileSync,readdirSync,unlinkSync,writeFileSync}from"fs";import{basename,join,resolve}from"path";var CLI_NAME=ROVE_PRODUCT_NAME,THEME_VERB_ALIASES={ls:"list",rm:"remove"},BUNDLED_NAMES=Object.keys(BUNDLED_THEME_JSONS);function fail(message){process.stderr.write(`${CLI_NAME} theme: ${message}
2
+ import{ThemeInstallError,isThemeName,parseTheme,writeUserTheme}from"./chunk-wfgrn8p2.js";import{BUNDLED_THEME_JSONS,userThemesDir}from"./chunk-kxp04jnp.js";import{expandTilde}from"./chunk-2r1fgng9.js";import{errorMessage}from"./chunk-2brn8e1y.js";import{SUBCOMMAND_VERBS}from"./chunk-qqr4tfhk.js";import"./chunk-7ghwdjdc.js";import"./chunk-z1nj22va.js";import{ROVE_PRODUCT_NAME}from"./chunk-zt7wfnva.js";import"./chunk-pn5ygqn6.js";import"./chunk-f8gg8cqh.js";import"./chunk-nc46gddg.js";import"./chunk-91sykzqq.js";import{existsSync,readFileSync,readdirSync,unlinkSync}from"fs";import{basename,join,resolve}from"path";var CLI_NAME=ROVE_PRODUCT_NAME,THEME_VERB_ALIASES={ls:"list",rm:"remove"},BUNDLED_NAMES=Object.keys(BUNDLED_THEME_JSONS);function fail(message){process.stderr.write(`${CLI_NAME} theme: ${message}
3
3
  Run ${CLI_NAME} theme --help for valid names and options.
4
4
  `),process.exit(1)}function failUsage(message){process.stderr.write(`${CLI_NAME} theme: ${message}
5
5
 
6
6
  `),printUsage(),process.exit(2)}function listThemes(){let lines=[];lines.push("bundled:");for(let name of[...BUNDLED_NAMES].sort())lines.push(` ${name} [built-in]`);let dir=userThemesDir(),userFiles=[];try{userFiles=readdirSync(dir).filter((f)=>f.endsWith(".json")).sort()}catch{}if(lines.push(""),lines.push(`user (${dir}):`),userFiles.length===0)lines.push(" (none)");else for(let f of userFiles){let name=f.slice(0,-5),path=join(dir,f),overridesBundled=BUNDLED_NAMES.includes(name)?" (overrides built-in)":"";lines.push(` ${name}${overridesBundled} ${path}`)}process.stdout.write(`${lines.join(`
7
7
  `)}
8
- `)}async function readSource(source){if(/^https?:\/\//i.test(source)){let res;try{res=await fetch(source)}catch(err){fail(`failed to fetch ${source}: ${errorMessage(err)}`)}if(!res.ok)fail(`failed to fetch ${source}: HTTP ${res.status} ${res.statusText}`);let text2=await res.text(),cleanPath=source.split(/[?#]/)[0]??source,file2=basename(cleanPath)||"theme.json",defaultName2=file2.endsWith(".json")?file2.slice(0,-5):file2;return{text:text2,defaultName:defaultName2}}let abs=resolve(process.cwd(),expandTilde(source)),text;try{text=readFileSync(abs,"utf8")}catch(err){fail(`failed to read ${abs}: ${errorMessage(err)}`)}let file=basename(abs),defaultName=file.endsWith(".json")?file.slice(0,-5):file;return{text,defaultName}}function parseAddArgs(args){let source=null,name,force=!1;for(let i=0;i<args.length;i+=1){let a=args[i];if(a==="--force"||a==="-f"){force=!0;continue}if(a==="--name"||a==="-n"){let next=args[i+1];if(next===void 0)failUsage("--name requires a value");name=next,i+=1;continue}if(a.startsWith("--name=")){name=a.slice(7);continue}if(a.startsWith("--"))failUsage(`unknown flag: ${a}`);if(source===null){source=a;continue}failUsage(`unexpected positional argument: ${a}`)}if(source===null)failUsage("missing <source> (URL or path to theme JSON)");return{source,opts:{name,force}}}async function addTheme(args){let{source,opts}=parseAddArgs(args),{text,defaultName}=await readSource(source),parsed;try{parsed=JSON.parse(text)}catch(err){fail(`source is not valid JSON: ${errorMessage(err)}`)}let result=validateTheme(parsed);if(!result.ok)fail(`source is not a valid Rove theme: ${result.reason}`);let name=requireThemeName(opts.name??defaultName),dir=userThemesDir();mkdirSync(dir,{recursive:!0});let dest=join(dir,`${name}.json`);if(existsSync(dest)&&!opts.force)fail(`${dest} already exists (pass --force to overwrite)`);writeFileSync(dest,`${JSON.stringify(result.theme,null,2)}
9
- `,"utf8"),process.stdout.write(`installed theme "${name}" -> ${dest}
10
- `)}function requireThemeName(name){if(!name||!/^[a-zA-Z0-9._-]+$/.test(name)||name==="."||name==="..")fail(`invalid theme name "${name}" (use letters, digits, '.', '_', '-')`);return name}function removeTheme(args){if(!args[0])failUsage("missing <name>");if(args.length>1)failUsage(`unexpected extra arguments after "${args[0]}"`);let name=requireThemeName(args[0]);if(BUNDLED_NAMES.includes(name))fail(`"${name}" is a built-in theme and cannot be removed`);let dest=join(userThemesDir(),`${name}.json`);if(!existsSync(dest))fail(`no user theme named "${name}" (looked for ${dest})`);unlinkSync(dest),process.stdout.write(`removed theme "${name}" (${dest})
8
+ `)}async function readSource(source){if(/^https?:\/\//i.test(source)){let res;try{res=await fetch(source)}catch(err){fail(`failed to fetch ${source}: ${errorMessage(err)}`)}if(!res.ok)fail(`failed to fetch ${source}: HTTP ${res.status} ${res.statusText}`);let text2=await res.text(),cleanPath=source.split(/[?#]/)[0]??source,file2=basename(cleanPath)||"theme.json",defaultName2=file2.endsWith(".json")?file2.slice(0,-5):file2;return{text:text2,defaultName:defaultName2}}let abs=resolve(process.cwd(),expandTilde(source)),text;try{text=readFileSync(abs,"utf8")}catch(err){fail(`failed to read ${abs}: ${errorMessage(err)}`)}let file=basename(abs),defaultName=file.endsWith(".json")?file.slice(0,-5):file;return{text,defaultName}}function parseAddArgs(args){let source=null,name,force=!1;for(let i=0;i<args.length;i+=1){let a=args[i];if(a==="--force"||a==="-f"){force=!0;continue}if(a==="--name"||a==="-n"){let next=args[i+1];if(next===void 0)failUsage("--name requires a value");name=next,i+=1;continue}if(a.startsWith("--name=")){name=a.slice(7);continue}if(a.startsWith("--"))failUsage(`unknown flag: ${a}`);if(source===null){source=a;continue}failUsage(`unexpected positional argument: ${a}`)}if(source===null)failUsage("missing <source> (URL or path to theme JSON)");return{source,opts:{name,force}}}async function addTheme(args){let{source,opts}=parseAddArgs(args),{text,defaultName}=await readSource(source);try{let dest=writeUserTheme(opts.name??defaultName,parseTheme(text),opts.force);process.stdout.write(`installed theme "${opts.name??defaultName}" -> ${dest}
9
+ `)}catch(err){if(err instanceof ThemeInstallError)fail(err.message);throw err}}function requireThemeName(name){if(!isThemeName(name))fail(`invalid theme name "${name}" (use letters, digits, '.', '_', '-')`);return name}function removeTheme(args){if(!args[0])failUsage("missing <name>");if(args.length>1)failUsage(`unexpected extra arguments after "${args[0]}"`);let name=requireThemeName(args[0]);if(BUNDLED_NAMES.includes(name))fail(`"${name}" is a built-in theme and cannot be removed`);let dest=join(userThemesDir(),`${name}.json`);if(!existsSync(dest))fail(`no user theme named "${name}" (looked for ${dest})`);unlinkSync(dest),process.stdout.write(`removed theme "${name}" (${dest})
11
10
  `)}function printUsage(out=process.stderr){out.write([`Usage: ${CLI_NAME} theme <command> [args]`,"","Commands:"," list List bundled and user-installed themes"," add <source> [--name <name>] Install a theme from a URL or local path"," Pass --force to overwrite an existing user theme"," remove <name> Remove a user-installed theme","",`User themes live under: ${userThemesDir()}`,"Schema: https://raw.githubusercontent.com/sma1lboy/rove/main/packages/rove/src/tui/context/theme/theme.schema.json",""].join(`
12
11
  `))}async function runThemeSubcommand(args){let[action,...rest]=args;if(!action||action==="--help"||action==="-h"||action==="help"){if(printUsage(action?process.stdout:process.stderr),!action)process.exit(2);return}let verb=THEME_VERB_ALIASES[action]??action;if(!SUBCOMMAND_VERBS.theme.includes(verb))failUsage(`unknown action "${action}" (try ${SUBCOMMAND_VERBS.theme.map((v)=>`"${v}"`).join(", ")})`);if(verb==="list"){if(rest.length>0)failUsage(`"${action}" takes no arguments`);listThemes();return}if(verb==="add"){await addTheme(rest);return}if(verb==="remove"){removeTheme(rest);return}failUsage(`unknown action "${action}"`)}export{runThemeSubcommand};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{addRemoteRepo,addSavedRepo,backfillSavedReposFromProjects,getCustomEngineIds,getDisabledEngineIds,getPersistedString,getPersistedValue,getRemoteRepoConfig,getRemoteRepos,getRepoInitOverride,getSavedRepos,isGitRepo,isRemoteProjectsEnabled,isRemoteRepoKey,isValidBranchName,normalizeSavedRepos,remoteRepoKey,removeSavedRepo,resolveMainRepoRoot,resolveRepoRoot,setPersistedString,setRepoInitOverride,statePath}from"./chunk-rfp0ayra.js";import"./chunk-40dgv828.js";import"./chunk-7mwvvj46.js";import"./chunk-32j6y5d1.js";import"./chunk-bejhca6z.js";import"./chunk-z1nj22va.js";import"./chunk-br8r72bf.js";import"./chunk-zt7wfnva.js";import"./chunk-yt15y085.js";import"./chunk-pn5ygqn6.js";import"./chunk-eqdbfgq5.js";import"./chunk-f8gg8cqh.js";import"./chunk-nc46gddg.js";import"./chunk-91sykzqq.js";export{statePath,setRepoInitOverride,setPersistedString,resolveRepoRoot,resolveMainRepoRoot,removeSavedRepo,remoteRepoKey,normalizeSavedRepos,isValidBranchName,isRemoteRepoKey,isRemoteProjectsEnabled,isGitRepo,getSavedRepos,getRepoInitOverride,getRemoteRepos,getRemoteRepoConfig,getPersistedValue,getPersistedString,getDisabledEngineIds,getCustomEngineIds,backfillSavedReposFromProjects,addSavedRepo,addRemoteRepo};
2
+ import{addRemoteRepo,addSavedRepo,backfillSavedReposFromProjects,getCustomEngineIds,getDisabledEngineIds,getPersistedString,getPersistedValue,getRemoteRepoConfig,getRemoteRepos,getRepoInitOverride,getSavedRepos,isGitRepo,isRemoteProjectsEnabled,isRemoteRepoKey,isValidBranchName,normalizeSavedRepos,remoteRepoKey,removeSavedRepo,resolveMainRepoRoot,resolveRepoRoot,setPersistedString,setRepoInitOverride,statePath}from"./chunk-rfp0ayra.js";import"./chunk-40dgv828.js";import"./chunk-7mwvvj46.js";import"./chunk-32j6y5d1.js";import"./chunk-bejhca6z.js";import"./chunk-br8r72bf.js";import"./chunk-yt15y085.js";import"./chunk-z1nj22va.js";import"./chunk-zt7wfnva.js";import"./chunk-pn5ygqn6.js";import"./chunk-eqdbfgq5.js";import"./chunk-f8gg8cqh.js";import"./chunk-nc46gddg.js";import"./chunk-91sykzqq.js";export{statePath,setRepoInitOverride,setPersistedString,resolveRepoRoot,resolveMainRepoRoot,removeSavedRepo,remoteRepoKey,normalizeSavedRepos,isValidBranchName,isRemoteRepoKey,isRemoteProjectsEnabled,isGitRepo,getSavedRepos,getRepoInitOverride,getRemoteRepos,getRemoteRepoConfig,getPersistedValue,getPersistedString,getDisabledEngineIds,getCustomEngineIds,backfillSavedReposFromProjects,addSavedRepo,addRemoteRepo};
@@ -0,0 +1,3 @@
1
+ // @bun
2
+ import{MAX_NOTES,MULTI_REPO_CAP,REPO_NAME_RE,SESSION_PR_CAP,canonicalPrUrl,coerceTodos,isWorkspaceBackendId}from"./chunk-x1jxxmtc.js";import{toTaskId}from"./chunk-xy8be792.js";import{coerceVendorId}from"./chunk-h2m7em1e.js";import{DAEMON_MIGRATION_MARKER}from"./chunk-8t7qbr1e.js";import{LockfileError,acquire}from"./chunk-bejhca6z.js";import{logClient}from"./chunk-0g4wc808.js";import{pathSyntax,samePath}from"./chunk-pn5ygqn6.js";import{defaultClientLogPath}from"./chunk-eqdbfgq5.js";import{existsSync}from"fs";import{copyFile,readFile}from"fs/promises";import{dirname,join}from"path";var AUTO_FIX_MAX=3,AT_REST={idle:!0,turn_complete:!0};function autoFixDecision(input){let{state,pr,engine}=input;if(!state||!pr)return{do:"skip"};if(pr.lifecycle!=="open"&&pr.lifecycle!=="ready_to_merge")return{do:"skip"};if(pr.checkState==="passing")return state.attempts>0||state.stopped||state.lastSha?{do:"reset"}:{do:"skip"};if(pr.checkState!=="failing"||!pr.headSha)return{do:"skip"};if(pr.headSha===state.lastSha)return{do:"skip"};if(state.stopped)return{do:"skip"};if(state.attempts>=3)return{do:"stop"};return AT_REST[engine??""]?{do:"fire"}:{do:"wait"}}function coerceAutoFix(value){if(!value||typeof value!=="object"||Array.isArray(value))return;let v=value,attempts=typeof v.attempts==="number"&&Number.isInteger(v.attempts)&&v.attempts>=0?v.attempts:0;return{attempts:Math.min(attempts,3),...typeof v.lastSha==="string"&&v.lastSha.length>0?{lastSha:v.lastSha}:{},...v.stopped===!0?{stopped:!0}:{}}}function coerceTask(value){if(!value||typeof value!=="object")return null;let v=value;if(typeof v.id!=="string"||typeof v.title!=="string"||typeof v.repo!=="string"||typeof v.branch!=="string"||typeof v.worktreePath!=="string"||typeof v.status!=="string"||typeof v.createdAt!=="string"||typeof v.updatedAt!=="string")return null;if(!isTaskStatus(v.status))return null;let kind=v.kind==="main"?"main":v.kind==="dir"?"dir":"task",scratch=kind==="dir"&&v.scratch===!0,noProject=kind==="dir"&&v.noProject===!0,healedStatus=kind==="main"&&(v.status==="in_progress"||v.status==="done")?"backlog":v.status,deletion=coerceDeletion(v.deletion),quotaResume=coerceQuotaResume(v.quotaResume),scheduledStart=coerceScheduledStart(v.scheduledStart),linkedWorkItem=coerceLinkedWorkItem(v.linkedWorkItem),dispatcher=coerceDispatcher(v.dispatcher),lineage=coerceLineage(v,kind),routine=coerceRoutine(v.routine),extraRepos=coerceExtraRepos(v.extraRepos,v.repo),workspace=coerceWorkspace(v.workspace),sessionPrs=coerceSessionPrs(v.sessionPrs),todos=coerceTodos(v.todos),autoFixCi=coerceAutoFix(v.autoFixCi),report=coerceWorkerReport(v.report);return{id:toTaskId(v.id),title:v.title,repo:v.repo,branch:v.branch,worktreePath:v.worktreePath,status:healedStatus,pinned:typeof v.pinned==="boolean"?v.pinned:!1,...v.kept===!0?{kept:!0}:{},...typeof v.notes==="string"&&v.notes.length>0?{notes:v.notes.slice(0,MAX_NOTES)}:{},...todos?{todos}:{},...autoFixCi?{autoFixCi}:{},kind,...scratch?{scratch:!0}:{},...noProject?{noProject:!0}:{},...routine?{routine}:{},vendor:coerceVendorId(typeof v.vendor==="string"?v.vendor:void 0),...typeof v.command==="string"&&v.command.trim().length>0?{command:v.command}:{},prStatus:coercePRStatus(v.prStatus),...typeof v.modelEffort==="string"&&v.modelEffort.length>0?{modelEffort:v.modelEffort}:{},...typeof v.model==="string"&&v.model.length>0?{model:v.model}:{},...typeof v.tier==="string"&&v.tier.length>0?{tier:v.tier}:{},...typeof v.groupId==="string"&&v.groupId.length>0?{groupId:v.groupId}:{},...v.observedLanguage==="zh"||v.observedLanguage==="en"?{observedLanguage:v.observedLanguage}:{},...deletion?{deletion}:{},...quotaResume?{quotaResume}:{},...scheduledStart?{scheduledStart}:{},...linkedWorkItem?{linkedWorkItem}:{},...dispatcher?{dispatcher}:{},...lineage,...v.deleteBranchPending===!0?{deleteBranchPending:!0}:{},...typeof v.prompt==="string"&&v.prompt.length>0?{prompt:v.prompt}:{},...typeof v.baseRef==="string"&&v.baseRef.trim().length>0?{baseRef:v.baseRef}:{},...typeof v.worktreeName==="string"&&v.worktreeName.trim().length>0?{worktreeName:v.worktreeName}:{},...typeof v.gitRepo==="string"&&v.gitRepo.trim().length>0?{gitRepo:v.gitRepo}:{},...extraRepos?{extraRepos}:{},...workspace?{workspace}:{},...sessionPrs?{sessionPrs}:{},...report?{report}:{},...v.requireReport===!0?{requireReport:!0}:{},...v.archived===!0?{archived:!0}:{},createdAt:v.createdAt,updatedAt:v.updatedAt}}function coerceWorkspace(value){if(!value||typeof value!=="object")return;let w=value;if(!isWorkspaceBackendId(w.backend))return;return{backend:w.backend,...typeof w.ref==="string"&&w.ref.length>0?{ref:w.ref}:{}}}function coerceExtraRepos(value,primary){if(!Array.isArray(value))return;let out=[];for(let entry of value){if(out.length>=MULTI_REPO_CAP-1)break;if(!entry||typeof entry!=="object")continue;let e=entry;if(typeof e.name!=="string"||!REPO_NAME_RE.test(e.name))continue;if(typeof e.repo!=="string"||!pathSyntax(e.repo).isAbsolute(e.repo))continue;let repo=e.repo;if(samePath(repo,primary)||out.some((o)=>o.name===e.name||samePath(o.repo,repo)))continue;out.push({name:e.name,repo,branch:typeof e.branch==="string"?e.branch:"",worktreePath:typeof e.worktreePath==="string"?e.worktreePath:"",...typeof e.baseRef==="string"&&e.baseRef.trim().length>0?{baseRef:e.baseRef}:{},...coercePRStatus(e.prStatus)?{prStatus:coercePRStatus(e.prStatus)}:{}})}return out.length>0?out:void 0}function coerceSessionPrs(value){if(!Array.isArray(value))return;let out=[];for(let entry of value){if(!entry||typeof entry!=="object")continue;let e=entry,url=typeof e.url==="string"?canonicalPrUrl(e.url):void 0;if(!url||typeof e.addedAt!=="string"||out.some((o)=>o.url===url))continue;let status=coercePRStatus(e.status);out.push({url,addedAt:e.addedAt,...status?{status}:{}})}return out.length>0?out.slice(-SESSION_PR_CAP):void 0}function coerceWorkerReport(value){if(!value||typeof value!=="object"||Array.isArray(value))return;let v=value;if(typeof v.at!=="string"||v.at.length===0)return;return{at:v.at,...typeof v.branch==="string"&&v.branch.length>0?{branch:v.branch}:{},...typeof v.pr==="number"&&Number.isFinite(v.pr)?{pr:v.pr}:{},...typeof v.summary==="string"&&v.summary.length>0?{summary:v.summary}:{}}}function coerceDispatcher(value){if(!value||typeof value!=="object"||Array.isArray(value))return;let v=value;if(typeof v.taskId!=="string"||v.taskId.length===0)return;if(typeof v.tabId!=="string"||v.tabId.length===0)return;return{taskId:v.taskId,tabId:v.tabId}}function coerceTaskRef(value,selfId){return typeof value==="string"&&value.length>0&&value!==selfId?value:void 0}function coerceCwdSubpath(value){if(typeof value!=="string"||value.length===0)return;if(/^[/\\]|^[a-z]:/i.test(value))return;return value.split(/[/\\]/).includes("..")?void 0:value}function coerceLineage(v,kind){let selfId=v.id,parentTaskId=coerceTaskRef(v.parentTaskId,selfId),sharesWorkspaceOf=kind==="main"?void 0:coerceTaskRef(v.sharesWorkspaceOf,selfId),cwdSubpath=coerceCwdSubpath(v.cwdSubpath),ptyAlias=coerceDispatcher(v.ptyAlias);return{...parentTaskId?{parentTaskId:toTaskId(parentTaskId)}:{},...sharesWorkspaceOf?{sharesWorkspaceOf:toTaskId(sharesWorkspaceOf)}:{},...cwdSubpath?{cwdSubpath}:{},...ptyAlias?{ptyAlias}:{}}}function coerceRoutine(value){if(!value||typeof value!=="object"||Array.isArray(value))return;let v=value;if(typeof v.automationId!=="string"||v.automationId.length===0)return;return{automationId:v.automationId}}function coerceQuotaResume(value){if(!value||typeof value!=="object"||Array.isArray(value))return;let v=value;if(typeof v.resumeAt!=="string"||v.resumeAt.length===0)return;if(typeof v.requestedAt!=="string"||v.requestedAt.length===0)return;return{resumeAt:v.resumeAt,requestedAt:v.requestedAt}}function coerceScheduledStart(value){if(!value||typeof value!=="object"||Array.isArray(value))return;let v=value;if(typeof v.at!=="string"||v.at.length===0)return;if(typeof v.prompt!=="string"||v.prompt.length===0)return;return{at:v.at,prompt:v.prompt}}function coerceLinkedWorkItem(value){if(!value||typeof value!=="object"||Array.isArray(value))return;let v=value;if(v.provider!=="github")return;if(v.type!=="issue"&&v.type!=="pr")return;if(typeof v.number!=="number"||!Number.isFinite(v.number))return;if(typeof v.title!=="string"||typeof v.url!=="string"||v.url.length===0)return;return{provider:v.provider,type:v.type,number:v.number,title:v.title,url:v.url}}function coerceDeletion(value){if(!value||typeof value!=="object"||Array.isArray(value))return;let v=value;if(v.phase!=="queued"&&v.phase!=="running"&&v.phase!=="error"||typeof v.force!=="boolean"||typeof v.requestedAt!=="string"||v.requestedAt.length===0||v.error!==void 0&&typeof v.error!=="string")return;return{phase:v.phase,force:v.force,...typeof v.deleteBranch==="boolean"?{deleteBranch:v.deleteBranch}:{},requestedAt:v.requestedAt,...typeof v.error==="string"?{error:v.error}:{}}}function coercePRStatus(value){if(!value||typeof value!=="object"||Array.isArray(value))return;let v=value;if(!isPRProviderId(v.provider)||!isPRLifecycleState(v.lifecycle)||!isPRCheckState(v.checkState))return;return{provider:v.provider,lifecycle:v.lifecycle,checkState:v.checkState,...typeof v.number==="number"&&Number.isFinite(v.number)?{number:v.number}:{},...typeof v.url==="string"?{url:v.url}:{},...typeof v.title==="string"?{title:v.title}:{},...typeof v.additions==="number"&&Number.isFinite(v.additions)?{additions:v.additions}:{},...typeof v.deletions==="number"&&Number.isFinite(v.deletions)?{deletions:v.deletions}:{},...typeof v.baseRef==="string"?{baseRef:v.baseRef}:{},...typeof v.reviewDecision==="string"?{reviewDecision:v.reviewDecision}:{},...typeof v.mergeable==="string"?{mergeable:v.mergeable}:{},...typeof v.headSha==="string"?{headSha:v.headSha}:{},...typeof v.lastCheckedAt==="string"?{lastCheckedAt:v.lastCheckedAt}:{},...typeof v.lastError==="string"?{lastError:v.lastError}:{}}}function isPRProviderId(v){return v==="github"||v==="gitlab"||v==="bitbucket"||v==="unknown"}function isPRLifecycleState(v){return v==="creating"||v==="open"||v==="ready_to_merge"||v==="merged"||v==="closed"||v==="unknown"}function isPRCheckState(v){return v==="none"||v==="pending"||v==="passing"||v==="failing"||v==="unknown"}function isTaskStatus(s){return s==="backlog"||s==="in_progress"||s==="in_review"||s==="done"||s==="canceled"||s==="error"}var sleep=(ms)=>new Promise((resolve)=>setTimeout(resolve,ms)),LOCK_RETRY_DELAY_MS=25,LOCK_MAX_WAIT_MS=5000;async function acquireWithRetry(lockPath){let deadline=Date.now()+LOCK_MAX_WAIT_MS;for(;;)try{return await acquire(lockPath)}catch(err){if(!(err instanceof LockfileError)||Date.now()>=deadline)throw err;await sleep(LOCK_RETRY_DELAY_MS)}}var CURRENT_VERSION=3;async function backupCorruptManifest(path,now=()=>new Date){let backupPath=`${path}.corrupt-${now().toISOString().replaceAll(":","-")}`;try{return await copyFile(path,backupPath),backupPath}catch{return null}}var SUPPORTED_VERSIONS=new Set([1,2,3]);function warnManifestRecovery(message,manifestPath){console.warn(message),logClient("tasks-index",message,manifestPath?defaultClientLogPath(dirname(dirname(manifestPath))):void 0)}async function recoverUnsupportedVersion(parsed,sourcePath){if(!parsed||typeof parsed!=="object"||Array.isArray(parsed))return!1;let version=parsed.version;if(version===void 0||SUPPORTED_VERSIONS.has(version))return!1;let backup=await backupCorruptManifest(sourcePath);return warnManifestRecovery(`[rove] tasks.json at ${sourcePath} has unsupported version=${String(version)}; recovering with empty index.${backup?` Original bytes backed up to ${backup}.`:" Backup copy failed; the stale file is left in place."}`,sourcePath),!0}function normalizeIndex(parsed,source){if(!parsed||typeof parsed!=="object"||Array.isArray(parsed))return warnManifestRecovery(`[rove] tasks.json at ${source} is not an object; recovering with empty index.`,source),{version:CURRENT_VERSION,tasks:[]};let obj=parsed,version=obj.version;if(version!==void 0&&!SUPPORTED_VERSIONS.has(version))return warnManifestRecovery(`[rove] tasks.json at ${source} has unsupported version=${String(version)}; recovering with empty index.`,source),{version:CURRENT_VERSION,tasks:[]};let rawTasks=Array.isArray(obj.tasks)?obj.tasks:[],tasks=[];for(let entry of rawTasks){let task=coerceTask(entry);if(task)tasks.push(task);else console.warn(`[rove] dropping malformed task entry from ${source}: ${JSON.stringify(entry)}`)}return{version:CURRENT_VERSION,tasks}}var TOMBSTONE_TTL_MS=2592000000;function readableLegacyIndexPath(canonicalPath,legacyPath){return existsSync(join(dirname(canonicalPath),DAEMON_MIGRATION_MARKER))?void 0:legacyPath}async function readDiskIndex(path,legacyPath){let raw,sourcePath=path;try{raw=await readFile(sourcePath,"utf8")}catch(err){if(err.code!=="ENOENT")throw err;let legacy=readableLegacyIndexPath(path,legacyPath);if(!legacy)return{tasks:[],removed:[]};sourcePath=legacy;try{raw=await readFile(sourcePath,"utf8")}catch(legacyErr){if(legacyErr.code==="ENOENT")return{tasks:[],removed:[]};throw legacyErr}}let parsed;try{parsed=JSON.parse(raw)}catch{return await backupCorruptManifest(sourcePath),{tasks:[],removed:[]}}if(await recoverUnsupportedVersion(parsed,sourcePath))return{tasks:[],removed:[]};return{tasks:normalizeIndex(parsed,sourcePath).tasks,removed:coerceTombstones(parsed)}}function coerceTombstones(parsed){if(!parsed||typeof parsed!=="object"||Array.isArray(parsed))return[];let raw=parsed.removed;if(!Array.isArray(raw))return[];let out=[];for(let entry of raw){if(!entry||typeof entry!=="object")continue;let v=entry;if(typeof v.id==="string"&&v.id.length>0&&typeof v.at==="string")out.push({id:v.id,at:v.at})}return out}function mergeTasksWithDisk(cacheTasks,diskTasks,dirty,removed,diskRemoved=[],now=Date.now()){let tombstones=new Map;for(let t of diskRemoved){let at=Date.parse(t.at);if(!Number.isFinite(at)||now-at>TOMBSTONE_TTL_MS)continue;tombstones.set(t.id,t.at)}for(let[id,at]of removed)tombstones.set(id,at);let diskById=new Map(diskTasks.map((t)=>[t.id,t])),result=[],included=new Set;for(let task of cacheTasks){if(tombstones.has(task.id))continue;if(dirty.has(task.id))result.push(task);else{let onDisk=diskById.get(task.id);if(onDisk===void 0)continue;result.push(onDisk)}included.add(task.id)}for(let task of diskTasks){if(included.has(task.id)||tombstones.has(task.id))continue;result.push(task),included.add(task.id)}return{tasks:result,removed:[...tombstones].map(([id,at])=>({id,at}))}}async function recoverIndexFromDisk(path,legacyPath){let raw,sourcePath=path;try{raw=await readFile(path,"utf8")}catch(err){if(err.code!=="ENOENT")throw err;let legacy=readableLegacyIndexPath(path,legacyPath),legacyRaw;if(legacy)try{legacyRaw=await readFile(legacy,"utf8"),sourcePath=legacy}catch(legacyErr){if(legacyErr.code!=="ENOENT")throw legacyErr}if(legacyRaw===void 0)return{version:CURRENT_VERSION,tasks:[]};raw=legacyRaw}let parsed;try{parsed=JSON.parse(raw)}catch(err){let backup=await backupCorruptManifest(sourcePath);return warnManifestRecovery(`[rove] tasks.json at ${sourcePath} is corrupted (${err.message}); recovering with empty index.${backup?` Original bytes backed up to ${backup}.`:" Backup copy failed; the stale file is left in place."}`,sourcePath),{version:CURRENT_VERSION,tasks:[]}}if(await recoverUnsupportedVersion(parsed,sourcePath))return{version:CURRENT_VERSION,tasks:[]};return normalizeIndex(parsed,sourcePath)}
3
+ export{AUTO_FIX_MAX,autoFixDecision,acquireWithRetry,readableLegacyIndexPath,readDiskIndex,mergeTasksWithDisk,recoverIndexFromDisk};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{errorMessage}from"./chunk-2brn8e1y.js";import{JsonHookAdapter,ROVE_HOOK_VERSION,bobAuthSecretsPath,claudeGlobalConfigPath,codexAuthPath,copilotConfigPath,editJsonSettings,hookCommandQuoting,isRoveHook,kimiCredentialsPath,readTextFileSyncBounded,roveHookArgs,roveHookInvocation,updateSharedJson}from"./chunk-e01321zn.js";import{quoteShellArgv}from"./chunk-7kysxgbq.js";import{isObject}from"./chunk-7ghwdjdc.js";import{getCustomEngineIds,getDisabledEngineIds}from"./chunk-rfp0ayra.js";import{__require}from"./chunk-91sykzqq.js";var GEMINI={rules:[{state:"blocked",any:["\u2502 apply this change","\u2502 allow execution","waiting for user confirmation"]},{state:"blocked",all:["do you want to proceed"],any:["yes"]},{state:"working",any:["esc to cancel"]}]},OPENCODE={rules:[{state:"blocked",any:["\u25B3 permission required"]},{state:"blocked",all:["esc dismiss"],any:["enter confirm","enter submit","enter toggle"]},{state:"working",any:["esc interrupt","esc to interrupt","ctrl+c to interrupt","esc again to interrupt"]},{state:"idle",any:["enter send"]}]},CURSOR={rules:[{state:"blocked",any:["press any key to log in"]},{state:"blocked",all:["proceed (y)"]},{state:"blocked",any:["run this command?","waiting for approval","skip (esc or n)","(y) (enter)"]},{state:"working",any:["esc to cancel","ctrl+c to stop"]}]},GROK={rules:[{state:"blocked",any:["\u26A0 action required","ctrl+o:yolo"]},{state:"blocked",all:["\u2503"],lineRegex:["^\\s*\u2503\\s+\\S+\\s+\\(\u25CB\\)"]},{state:"working",any:["[stop]"],lineRegex:["^\\s*[\\u2800-\\u28FF]"]}]},DROID={rules:[{state:"blocked",all:["enter to select","esc to cancel"],any:["> yes, allow","> no, cancel"]},{state:"blocked",all:["enter select","esc cancel"]},{state:"working",any:["esc to stop"]}]},AMP={rules:[{state:"blocked",any:["waiting for approval","run this command?","allow editing file:","allow creating file:","confirm tool call"]},{state:"working",lineRegex:["^\\s*\u2570\\s+\\S+\\s+(thinking|streaming|running tools|waiting)\\s+\u2500"]}]},CLINE={rules:[{state:"blocked",any:["let cline use this tool"]},{state:"blocked",all:["execute command?","yes"],any:["[act mode]","[plan mode]"]},{state:"blocked",all:["use this tool?","yes"],any:["[act mode]","[plan mode]"]}]},KIRO={rules:[{state:"blocked",all:["requires approval"],any:["yes, single permission","trust, always allow","no (tab to edit)","esc to close"]},{state:"blocked",all:["pending from subagents","tool approval"],any:["approve all pending","configure individually","exit (cancel subagents)"]},{state:"working",any:["kiro is working"]},{state:"working",all:["esc to cancel"],lineRegex:["^\\s*[\u25D4\u25D1\u25D5\u25CF]\\s+[A-Za-z]"]}]},MAKI={rules:[{state:"blocked",all:["permission required","y allow","n deny"]},{state:"blocked",all:["permission required"],any:["confirm allow","confirm deny"]},{state:"blocked",all:["permission required","enter deny","esc cancel"]},{state:"blocked",all:["plan complete","enter confirm"],any:["space toggle parallel","edit plan"]},{state:"working",bottomLines:1,lineRegex:["^( [\\u2800-\\u28FF]){1,2} \\[(BUILD|PLAN|BASH)\\]"]},{state:"idle",bottomLines:1,lineRegex:["^ \\[(BUILD|PLAN|BASH)\\]"]}]},ANTIGRAVITY={rules:[{state:"blocked",all:["requesting permission for:","do you want to proceed?"]},{state:"blocked",all:["requesting permission for:","tab amend","edit command"]},{state:"working",lineRegex:["^\\s*[\\u2800-\\u28FF]+\\s+[A-Za-z]+\\w*ing\\b"]},{state:"working",bottomLines:5,lineRegex:["\xB7\\s*[1-9][0-9]*\\s+task"]}]},DEVIN={rules:[{state:"blocked",bottomLines:8,all:["do you trust the authors of this directory?","yes, trust "]},{state:"blocked",bottomLines:8,all:["approve once","select","confirm","esc cancel"]},{state:"working",bottomLines:8,all:["running tools","esc to interrupt"]},{state:"working",bottomLines:6,all:["guide devin while it works"]},{state:"working",bottomLines:8,all:["reading shell ","timeout:"]},{state:"idle",bottomLines:8,all:["ask devin to build","features, fix bugs","your code"],lineRegex:["^\\s*\u276D Ask Devin to build"]},{state:"idle",bottomLines:6,all:["context:"],lineRegex:["^\\s*\u276D"]}]},QODERCLI={rules:[{state:"blocked",all:["waiting for user confirmation"],any:["yes","no","allow","reject"]},{state:"blocked",all:["awaiting approval"],any:["allow","reject"]},{state:"blocked",any:["permission required","allow once or always?","asking user","enter your response","review your answers:","shell awaiting input"]},{state:"working",any:["(esc to cancel,"]},{state:"working",lineRegex:["^\\s*[\\u2800-\\u28FF]\\s+.*[A-Za-z]"]}]},HERMES={rules:[{state:"blocked",bottomLines:14,any:["dangerous","approval","allow once","hermes needs your","type your answer","approve once","start a new session","keep going"],lineRegex:["enter\\s+(?:to\\s+)?(?:confirm|send)","press enter","\u2191/\u2193\\s+(?:to\\s+)?select","show full command","type 1/2/3","y/n quick","other \\(type"]},{state:"blocked",bottomLines:14,any:["sudo password","skill setup"]},{state:"blocked",bottomLines:14,all:["\uD83D\uDD11","for "]},{state:"working",bottomLines:5,any:["msg=interrupt","ctrl+c to interrupt","ctrl+c cancel"]}]},KILO={rules:[{state:"blocked",any:["\u25B3 permission required"]},{state:"blocked",all:["esc dismiss"],any:["enter confirm","enter submit","enter toggle"],lineRegex:["\u2191\u2193\\s*select","\u21C6\\s*tab"]},{state:"working",any:["esc interrupt"]}]},MASTRACODE={rules:[]};import{existsSync}from"fs";import{homedir}from"os";import{dirname,join}from"path";function parseFlatHooks(raw){if(raw===void 0)return{ok:!0,doc:{}};let parsed;try{parsed=JSON.parse(raw)}catch(err){return{ok:!1,reason:`not valid JSON (${err instanceof Error?err.message:String(err)})`}}if(!isObject(parsed))return{ok:!1,reason:"top level is not a JSON object"};if(parsed.hooks===void 0)return{ok:!0,doc:parsed};if(!isObject(parsed.hooks))return{ok:!1,reason:'"hooks" is not an object'};for(let[event,entries]of Object.entries(parsed.hooks))if(!Array.isArray(entries))return{ok:!1,reason:`"hooks.${event}" is not an array`};return{ok:!0,doc:parsed}}function mergeFlatHooks(format,current,install,inv=roveHookInvocation()){let verbs=format.eventMap.map((spec)=>spec.verb),{hooks:rawHooks,...rest}=current,hooks=isObject(rawHooks)?{...rawHooks}:{},quoting=hookCommandQuoting();for(let{event,verb}of format.eventMap){let kept=(Array.isArray(hooks[event])?hooks[event]:[]).filter((entry)=>!isRoveHook(entry,verbs));if(install){let command=quoteShellArgv([...inv,"hook",verb,...roveHookArgs(format.vendor)],quoting);kept.push(format.withType?{type:"command",command}:{command})}if(kept.length>0)hooks[event]=kept;else delete hooks[event]}return{version:1,...rest,hooks}}var CURSOR_HOOK_EVENT_MAP=[{event:"sessionStart",verb:"session-start"}],CURSOR_FORMAT={vendor:"cursor",eventMap:CURSOR_HOOK_EVENT_MAP};function cursorHooksPath(home=homedir()){let override=process.env.CURSOR_CONFIG_DIR?.trim();return join(override||join(home,".cursor"),"hooks.json")}function parseCursorHooks(raw){return parseFlatHooks(raw)}function mergeCursorHooks(current,install,inv=roveHookInvocation()){return mergeFlatHooks(CURSOR_FORMAT,current,install,inv)}class CursorHookAdapter{vendor="cursor";supportsHooks(){return!0}globalSettingsPath(){return cursorHooksPath()}activityDetailFromPayload(){return}cwdFromPayload(payload){let roots=payload.workspace_roots;return Array.isArray(roots)?firstString(...roots):void 0}sessionFromPayload(payload){let sessionId=firstString(payload.session_id,payload.conversation_id);if(!sessionId)return;let transcriptPath=firstString(payload.transcript_path);return{sessionId,...transcriptPath?{transcriptPath}:{}}}async installActivityHooks(settingsFilePath,opts={}){if(!existsSync(dirname(settingsFilePath)))return{ok:!0};let outcome=await editJsonSettings(settingsFilePath,(cur)=>mergeCursorHooks(cur,!0),parseCursorHooks);if(!outcome.ok&&!opts.quiet)process.stderr.write(`[rove hooks] cursor: skipped ${outcome.file}: ${outcome.reason}
2
+ import{getCustomEngineIds,getDisabledEngineIds}from"./chunk-rfp0ayra.js";import{errorMessage}from"./chunk-2brn8e1y.js";import{JsonHookAdapter,ROVE_HOOK_VERSION,bobAuthSecretsPath,claudeGlobalConfigPath,codexAuthPath,copilotConfigPath,editJsonSettings,hookCommandQuoting,isRoveHook,kimiCredentialsPath,readTextFileSyncBounded,roveHookArgs,roveHookInvocation,skillsDirUnder,updateSharedJson,xdgConfigHome}from"./chunk-8qkyd589.js";import{quoteShellArgv}from"./chunk-7kysxgbq.js";import{isObject}from"./chunk-7ghwdjdc.js";import{__require}from"./chunk-91sykzqq.js";import{homedir as homedir9}from"os";import{join as join8}from"path";var GEMINI={rules:[{state:"blocked",any:["\u2502 apply this change","\u2502 allow execution","waiting for user confirmation"]},{state:"blocked",all:["do you want to proceed"],any:["yes"]},{state:"working",any:["esc to cancel"]}]},OPENCODE={rules:[{state:"blocked",any:["\u25B3 permission required"]},{state:"blocked",all:["esc dismiss"],any:["enter confirm","enter submit","enter toggle"]},{state:"working",any:["esc interrupt","esc to interrupt","ctrl+c to interrupt","esc again to interrupt"]},{state:"idle",any:["enter send"]}]},CURSOR={rules:[{state:"blocked",any:["press any key to log in"]},{state:"blocked",all:["proceed (y)"]},{state:"blocked",any:["run this command?","waiting for approval","skip (esc or n)","(y) (enter)"]},{state:"working",any:["esc to cancel","ctrl+c to stop"]}]},GROK={rules:[{state:"blocked",any:["\u26A0 action required","ctrl+o:yolo"]},{state:"blocked",all:["\u2503"],lineRegex:["^\\s*\u2503\\s+\\S+\\s+\\(\u25CB\\)"]},{state:"working",any:["[stop]"],lineRegex:["^\\s*[\\u2800-\\u28FF]"]}]},DROID={rules:[{state:"blocked",all:["enter to select","esc to cancel"],any:["> yes, allow","> no, cancel"]},{state:"blocked",all:["enter select","esc cancel"]},{state:"working",any:["esc to stop"]}]},AMP={rules:[{state:"blocked",any:["waiting for approval","run this command?","allow editing file:","allow creating file:","confirm tool call"]},{state:"working",lineRegex:["^\\s*\u2570\\s+\\S+\\s+(thinking|streaming|running tools|waiting)\\s+\u2500"]}]},CLINE={rules:[{state:"blocked",any:["let cline use this tool"]},{state:"blocked",all:["execute command?","yes"],any:["[act mode]","[plan mode]"]},{state:"blocked",all:["use this tool?","yes"],any:["[act mode]","[plan mode]"]}]},KIRO={rules:[{state:"blocked",all:["requires approval"],any:["yes, single permission","trust, always allow","no (tab to edit)","esc to close"]},{state:"blocked",all:["pending from subagents","tool approval"],any:["approve all pending","configure individually","exit (cancel subagents)"]},{state:"working",any:["kiro is working"]},{state:"working",all:["esc to cancel"],lineRegex:["^\\s*[\u25D4\u25D1\u25D5\u25CF]\\s+[A-Za-z]"]}]},MAKI={rules:[{state:"blocked",all:["permission required","y allow","n deny"]},{state:"blocked",all:["permission required"],any:["confirm allow","confirm deny"]},{state:"blocked",all:["permission required","enter deny","esc cancel"]},{state:"blocked",all:["plan complete","enter confirm"],any:["space toggle parallel","edit plan"]},{state:"working",bottomLines:1,lineRegex:["^( [\\u2800-\\u28FF]){1,2} \\[(BUILD|PLAN|BASH)\\]"]},{state:"idle",bottomLines:1,lineRegex:["^ \\[(BUILD|PLAN|BASH)\\]"]}]},ANTIGRAVITY={rules:[{state:"blocked",all:["requesting permission for:","do you want to proceed?"]},{state:"blocked",all:["requesting permission for:","tab amend","edit command"]},{state:"working",lineRegex:["^\\s*[\\u2800-\\u28FF]+\\s+[A-Za-z]+\\w*ing\\b"]},{state:"working",bottomLines:5,lineRegex:["\xB7\\s*[1-9][0-9]*\\s+task"]}]},DEVIN={rules:[{state:"blocked",bottomLines:8,all:["do you trust the authors of this directory?","yes, trust "]},{state:"blocked",bottomLines:8,all:["approve once","select","confirm","esc cancel"]},{state:"working",bottomLines:8,all:["running tools","esc to interrupt"]},{state:"working",bottomLines:6,all:["guide devin while it works"]},{state:"working",bottomLines:8,all:["reading shell ","timeout:"]},{state:"idle",bottomLines:8,all:["ask devin to build","features, fix bugs","your code"],lineRegex:["^\\s*\u276D Ask Devin to build"]},{state:"idle",bottomLines:6,all:["context:"],lineRegex:["^\\s*\u276D"]}]},QODERCLI={rules:[{state:"blocked",all:["waiting for user confirmation"],any:["yes","no","allow","reject"]},{state:"blocked",all:["awaiting approval"],any:["allow","reject"]},{state:"blocked",any:["permission required","allow once or always?","asking user","enter your response","review your answers:","shell awaiting input"]},{state:"working",any:["(esc to cancel,"]},{state:"working",lineRegex:["^\\s*[\\u2800-\\u28FF]\\s+.*[A-Za-z]"]}]},HERMES={rules:[{state:"blocked",bottomLines:14,any:["dangerous","approval","allow once","hermes needs your","type your answer","approve once","start a new session","keep going"],lineRegex:["enter\\s+(?:to\\s+)?(?:confirm|send)","press enter","\u2191/\u2193\\s+(?:to\\s+)?select","show full command","type 1/2/3","y/n quick","other \\(type"]},{state:"blocked",bottomLines:14,any:["sudo password","skill setup"]},{state:"blocked",bottomLines:14,all:["\uD83D\uDD11","for "]},{state:"working",bottomLines:5,any:["msg=interrupt","ctrl+c to interrupt","ctrl+c cancel"]}]},KILO={rules:[{state:"blocked",any:["\u25B3 permission required"]},{state:"blocked",all:["esc dismiss"],any:["enter confirm","enter submit","enter toggle"],lineRegex:["\u2191\u2193\\s*select","\u21C6\\s*tab"]},{state:"working",any:["esc interrupt"]}]},MASTRACODE={rules:[]};import{existsSync}from"fs";import{homedir}from"os";import{dirname,join}from"path";function parseFlatHooks(raw){if(raw===void 0)return{ok:!0,doc:{}};let parsed;try{parsed=JSON.parse(raw)}catch(err){return{ok:!1,reason:`not valid JSON (${err instanceof Error?err.message:String(err)})`}}if(!isObject(parsed))return{ok:!1,reason:"top level is not a JSON object"};if(parsed.hooks===void 0)return{ok:!0,doc:parsed};if(!isObject(parsed.hooks))return{ok:!1,reason:'"hooks" is not an object'};for(let[event,entries]of Object.entries(parsed.hooks))if(!Array.isArray(entries))return{ok:!1,reason:`"hooks.${event}" is not an array`};return{ok:!0,doc:parsed}}function mergeFlatHooks(format,current,install,inv=roveHookInvocation()){let verbs=format.eventMap.map((spec)=>spec.verb),{hooks:rawHooks,...rest}=current,hooks=isObject(rawHooks)?{...rawHooks}:{},quoting=hookCommandQuoting();for(let{event,verb}of format.eventMap){let kept=(Array.isArray(hooks[event])?hooks[event]:[]).filter((entry)=>!isRoveHook(entry,verbs));if(install){let command=quoteShellArgv([...inv,"hook",verb,...roveHookArgs(format.vendor)],quoting);kept.push(format.withType?{type:"command",command}:{command})}if(kept.length>0)hooks[event]=kept;else delete hooks[event]}return{version:1,...rest,hooks}}var CURSOR_HOOK_EVENT_MAP=[{event:"sessionStart",verb:"session-start"}],CURSOR_FORMAT={vendor:"cursor",eventMap:CURSOR_HOOK_EVENT_MAP};function cursorHooksPath(home=homedir()){let override=process.env.CURSOR_CONFIG_DIR?.trim();return join(override||join(home,".cursor"),"hooks.json")}function parseCursorHooks(raw){return parseFlatHooks(raw)}function mergeCursorHooks(current,install,inv=roveHookInvocation()){return mergeFlatHooks(CURSOR_FORMAT,current,install,inv)}class CursorHookAdapter{vendor="cursor";supportsHooks(){return!0}globalSettingsPath(){return cursorHooksPath()}activityDetailFromPayload(){return}cwdFromPayload(payload){let roots=payload.workspace_roots;return Array.isArray(roots)?firstString(...roots):void 0}sessionFromPayload(payload){let sessionId=firstString(payload.session_id,payload.conversation_id);if(!sessionId)return;let transcriptPath=firstString(payload.transcript_path);return{sessionId,...transcriptPath?{transcriptPath}:{}}}async installActivityHooks(settingsFilePath,opts={}){if(!existsSync(dirname(settingsFilePath)))return{ok:!0};let outcome=await editJsonSettings(settingsFilePath,(cur)=>mergeCursorHooks(cur,!0),parseCursorHooks);if(!outcome.ok&&!opts.quiet)process.stderr.write(`[rove hooks] cursor: skipped ${outcome.file}: ${outcome.reason}
3
3
  `);return outcome}async removeActivityHooks(settingsFilePath){if(!existsSync(settingsFilePath))return;await editJsonSettings(settingsFilePath,(cur)=>mergeCursorHooks(cur,!1),parseCursorHooks)}hookConfigRefusal(raw){let parsed=parseCursorHooks(raw);return parsed.ok?void 0:parsed.reason}supportsWorktreeSync(){return!1}async removeWorktreeSyncHook(){}async removeWorktreeWatchHook(){}}function firstString(...values){for(let value of values)if(typeof value==="string"&&value)return value;return}import{homedir as homedir2}from"os";import{join as join2}from"path";import{existsSync as existsSync2}from"fs";import{dirname as dirname2}from"path";function sessionStartOnly(matcher){return[{event:"SessionStart",verb:"session-start",...matcher?{matcher}:{}}]}class SessionStartHookAdapter extends JsonHookAdapter{installGuardDir(settingsFilePath){return dirname2(settingsFilePath)}async installActivityHooks(settingsFilePath,opts={}){if(!existsSync2(this.installGuardDir(settingsFilePath)))return{ok:!0};return super.installActivityHooks(settingsFilePath,opts)}async removeActivityHooks(settingsFilePath){if(!existsSync2(settingsFilePath))return;await super.removeActivityHooks(settingsFilePath)}sessionFromPayload(payload){if(typeof payload.session_id!=="string"||!payload.session_id)return;return{sessionId:payload.session_id,...typeof payload.transcript_path==="string"&&payload.transcript_path?{transcriptPath:payload.transcript_path}:{}}}}var DEVIN_HOOK_EVENT_MAP=sessionStartOnly();function devinSettingsPath(home=homedir2()){let xdg=process.env.XDG_CONFIG_HOME?.trim();return join2(xdg||join2(home,".config"),"devin","config.json")}class DevinHookAdapter extends SessionStartHookAdapter{vendor="devin";eventMap=DEVIN_HOOK_EVENT_MAP;globalSettingsPath(){return devinSettingsPath()}}import{homedir as homedir3}from"os";import{join as join3}from"path";var DROID_HOOK_EVENT_MAP=sessionStartOnly();function droidSettingsPath(home=homedir3()){return join3(home,".factory","settings.json")}class DroidHookAdapter extends SessionStartHookAdapter{vendor="droid";eventMap=DROID_HOOK_EVENT_MAP;globalSettingsPath(){return droidSettingsPath()}}import{homedir as homedir4}from"os";import{dirname as dirname3,join as join4}from"path";var GROK_HOOK_EVENT_MAP=sessionStartOnly();function grokConfigDir(home=homedir4()){return process.env.GROK_HOME?.trim()||join4(home,".grok")}function grokHooksPath(home=homedir4()){return join4(grokConfigDir(home),"hooks","rove.json")}class GrokHookAdapter extends SessionStartHookAdapter{vendor="grok";eventMap=GROK_HOOK_EVENT_MAP;globalSettingsPath(){return grokHooksPath()}installGuardDir(settingsFilePath){return dirname3(dirname3(settingsFilePath))}sessionFromPayload(payload){let sessionId=firstString2(payload.session_id,payload.sessionId);if(!sessionId)return;let transcriptPath=firstString2(payload.transcript_path,payload.transcriptPath);return{sessionId,...transcriptPath?{transcriptPath}:{}}}}function firstString2(...values){for(let value of values)if(typeof value==="string"&&value)return value;return}import{existsSync as existsSync3}from"fs";import{rm}from"fs/promises";import{homedir as homedir5}from"os";import path2 from"path";import{mkdir,readFile,writeFile}from"fs/promises";import path from"path";async function writeIfChanged(file,content){try{if(await readFile(file,"utf8").catch(()=>{return})===content)return;await mkdir(path.dirname(file),{recursive:!0}),await writeFile(file,content)}catch{}}var HERMES_PLUGIN_NAME="rove-agent-state";function indentOf(line){if(!line.trim()||line.trim().startsWith("#"))return;let match=/^ */.exec(line),indent=match?match[0].length:0;return line[indent]==="\t"?void 0:indent}function keyAt(line,indent){if(indentOf(line)!==indent)return;return/^ *(["']?)([A-Za-z0-9_.-]+)\1:(?:\s|$)/.exec(line)?.[2]}function inlineValue(line){return(/^ *(["']?)[A-Za-z0-9_.-]+\1:(.*)$/.exec(line)?.[2]??"").trim()}function listItemAt(line,indent){if(indentOf(line)!==indent)return;let match=/^ *- *(.*)$/.exec(line);if(!match)return;return match[1].trim().replace(/^["']|["']$/g,"")}function join5(lines,trailingNewline){return lines.join(`
4
4
  `)+(trailingNewline?`
5
5
  `:"")}function setHermesPluginEnabled(content,enabled){let trailingNewline=content.endsWith(`
@@ -78,7 +78,7 @@ def register(ctx):
78
78
  ctx.register_hook("on_session_reset", _report)
79
79
  `}function hermesConfigDir(home=homedir5()){return path2.join(home,".hermes")}function hermesConfigPath(home=homedir5()){return path2.join(hermesConfigDir(home),"config.yaml")}class HermesHookAdapter{vendor="hermes";supportsHooks(){return!0}globalSettingsPath(){return hermesConfigPath()}activityDetailFromPayload(){return}sessionFromPayload(payload){let sessionId=typeof payload.session_id==="string"?payload.session_id:void 0;return sessionId?{sessionId}:void 0}async installActivityHooks(settingsFilePath,opts={}){let configDir=path2.dirname(settingsFilePath);if(!existsSync3(configDir))return{ok:!0};let pluginDir=path2.join(configDir,"plugins",HERMES_PLUGIN_NAME);await writeIfChanged(path2.join(pluginDir,"plugin.yaml"),HERMES_PLUGIN_MANIFEST),await writeIfChanged(path2.join(pluginDir,"__init__.py"),renderHermesPluginSource({vendor:this.vendor,invocation:roveHookInvocation()}));let outcome=await this.editConfig(settingsFilePath,!0);if(!outcome.ok&&!opts.quiet)process.stderr.write(`[rove hooks] hermes: skipped ${outcome.file}: ${outcome.reason}
80
80
  `);return outcome}async removeActivityHooks(settingsFilePath){if(existsSync3(settingsFilePath))await this.editConfig(settingsFilePath,!1);try{await rm(path2.join(path2.dirname(settingsFilePath),"plugins",HERMES_PLUGIN_NAME),{recursive:!0,force:!0})}catch{}}hookConfigRefusal(raw){let edit=setHermesPluginEnabled(raw,!0);return edit.ok?void 0:edit.reason}supportsWorktreeSync(){return!1}async removeWorktreeSyncHook(){}async removeWorktreeWatchHook(){}async editConfig(file,enabled){let rejected;try{await updateSharedJson(file,(raw)=>({raw:raw??""}),(doc)=>{let raw=String(doc.raw??""),edit=setHermesPluginEnabled(raw,enabled);if(!edit.ok){rejected=edit.reason;return}return edit.content===raw?void 0:edit.content})}catch(err){return{ok:!1,file,reason:err instanceof Error?err.message:String(err)}}if(rejected!==void 0)return{ok:!1,file,reason:rejected};return{ok:!0}}}import{existsSync as existsSync4}from"fs";import{homedir as homedir6}from"os";import{dirname as dirname4,join as join6}from"path";var MASTRACODE_HOOK_EVENT_MAP=[{event:"SessionStart",verb:"session-start"},{event:"UserPromptSubmit",verb:"turn-start"},{event:"AgentStart",verb:"turn-start"},{event:"PermissionRequest",verb:"awaiting-input"},{event:"PermissionResult",verb:"turn-start"},{event:"Interrupt",verb:"turn-interrupted"},{event:"AgentEnd",verb:"turn-complete"},{event:"Stop",verb:"turn-complete"}],MASTRACODE_FORMAT={vendor:"mastracode",eventMap:MASTRACODE_HOOK_EVENT_MAP,withType:!0};function mastracodeHooksPath(home=homedir6()){return join6(home,".mastracode","hooks.json")}function mergeMastracodeHooks(current,install,inv=roveHookInvocation()){return mergeFlatHooks(MASTRACODE_FORMAT,current,install,inv)}class MastracodeHookAdapter{vendor="mastracode";supportsHooks(){return!0}globalSettingsPath(){return mastracodeHooksPath()}activityDetailFromPayload(kind){return kind==="awaiting-input"?{waiting:"permission"}:void 0}sessionFromPayload(payload){if(typeof payload.session_id!=="string"||!payload.session_id)return;return{sessionId:payload.session_id,...typeof payload.transcript_path==="string"&&payload.transcript_path?{transcriptPath:payload.transcript_path}:{}}}async installActivityHooks(settingsFilePath,opts={}){if(!existsSync4(dirname4(settingsFilePath)))return{ok:!0};let outcome=await editJsonSettings(settingsFilePath,(cur)=>mergeMastracodeHooks(cur,!0),parseMastracodeHooks);if(!outcome.ok&&!opts.quiet)process.stderr.write(`[rove hooks] mastracode: skipped ${outcome.file}: ${outcome.reason}
81
- `);return outcome}async removeActivityHooks(settingsFilePath){if(!existsSync4(settingsFilePath))return;await editJsonSettings(settingsFilePath,(cur)=>mergeMastracodeHooks(cur,!1),parseMastracodeHooks)}hookConfigRefusal(raw){let parsed=parseMastracodeHooks(raw);return parsed.ok?void 0:parsed.reason}supportsWorktreeSync(){return!1}async removeWorktreeSyncHook(){}async removeWorktreeWatchHook(){}}function parseMastracodeHooks(raw){return parseFlatHooks(raw)}import{existsSync as existsSync5}from"fs";import{rm as rm2}from"fs/promises";import{homedir as homedir7}from"os";import path3 from"path";function renderOpencodePluginSource(opts){let{vendor,invocation}=opts;return`/**
81
+ `);return outcome}async removeActivityHooks(settingsFilePath){if(!existsSync4(settingsFilePath))return;await editJsonSettings(settingsFilePath,(cur)=>mergeMastracodeHooks(cur,!1),parseMastracodeHooks)}hookConfigRefusal(raw){let parsed=parseMastracodeHooks(raw);return parsed.ok?void 0:parsed.reason}supportsWorktreeSync(){return!1}async removeWorktreeSyncHook(){}async removeWorktreeWatchHook(){}}function parseMastracodeHooks(raw){return parseFlatHooks(raw)}import{existsSync as existsSync5}from"fs";import{rm as rm2}from"fs/promises";import{homedir as homedir7}from"os";import path3 from"path";function isTransientFailureText(message){return/unable to connect|fetch failed|network error|connection (error|refused|reset|closed)|socket hang up|econn(refused|reset)|etimedout|enotfound|eai_again|\b50[0234]\b|internal server error|bad gateway|service unavailable|gateway timeout/i.test(message)}function renderOpencodePluginSource(opts){let{vendor,invocation}=opts;return`/**
82
82
  * Rove activity hook \u2014 GENERATED, installed and rewritten by Rove on every
83
83
  * launch (${vendor}). Local edits are overwritten; to stop reporting, delete
84
84
  * this file or turn Rove's global hooks off. Add your own plugins beside it.
@@ -204,6 +204,6 @@ export const RoveAgentState = async (input) => {
204
204
  },
205
205
  }
206
206
  }
207
- `}var ACTIVITY_PLUGIN_FILE="rove-agent-state.js",FAMILY_DIRS={opencode:{configDir:"opencode",pluginDir:"plugins"},kilo:{configDir:"kilo",pluginDir:"plugin"}};function opencodeFamilyConfigDir(vendor,home=homedir7()){return path3.join(home,".config",FAMILY_DIRS[vendor].configDir)}function opencodeFamilyPluginPath(vendor,home=homedir7()){return path3.join(opencodeFamilyConfigDir(vendor,home),FAMILY_DIRS[vendor].pluginDir,ACTIVITY_PLUGIN_FILE)}function opencodeFailureDetail(payload){let raw=typeof payload.error_message==="string"?payload.error_message:"",message=raw.toLowerCase(),note=raw?raw.slice(0,200):void 0;return{failure:(()=>{if(/insufficient|credit|billing|payment required|\b402\b|quota exceeded|out of credits/.test(message))return"billing";if(/rate.?limit|too many requests|\b429\b|overloaded|capacity/.test(message))return"rate_limit";return"other"})(),...note?{note}:{}}}class OpencodeFamilyHookAdapter{family;vendor;constructor(family){this.family=family;this.vendor=family}supportsHooks(){return!0}globalSettingsPath(){return opencodeFamilyPluginPath(this.family)}activityDetailFromPayload(kind,payload){if(kind==="turn-failed")return opencodeFailureDetail(payload);if(kind==="awaiting-input")return{waiting:payload.waiting==="input"?"input":"permission"};return}sessionFromPayload(payload){let sessionId=typeof payload.session_id==="string"?payload.session_id:void 0;return sessionId?{sessionId}:void 0}async installActivityHooks(settingsFilePath){let configDir=path3.dirname(path3.dirname(settingsFilePath));if(!existsSync5(configDir))return{ok:!0};let source=renderOpencodePluginSource({vendor:this.family,invocation:roveHookInvocation()});return await writeIfChanged(settingsFilePath,source),{ok:!0}}async removeActivityHooks(settingsFilePath){try{await rm2(settingsFilePath,{force:!0})}catch{}}supportsWorktreeSync(){return!1}async removeWorktreeSyncHook(){}async removeWorktreeWatchHook(){}}import{homedir as homedir8}from"os";import{join as join7}from"path";var QODERCLI_HOOK_EVENT_MAP=sessionStartOnly("*");function qodercliSettingsPath(home=homedir8()){let override=process.env.QODERCLI_CONFIG_DIR?.trim();return join7(override||join7(home,".qoder"),"settings.json")}class QodercliHookAdapter extends SessionStartHookAdapter{vendor="qodercli";eventMap=QODERCLI_HOOK_EVENT_MAP;globalSettingsPath(){return qodercliSettingsPath()}}var pluginEngines=new Map;function registerPluginEngine(id,spec){if(Object.hasOwn(CONTRIB_ENGINES,id))return!1;return pluginEngines.set(id,spec),!0}function clearPluginEngines(){pluginEngines.clear()}function pluginEngineIds(){return[...pluginEngines.keys()]}var CONTRIB_ENGINES={gemini:{displayName:"Gemini CLI",defaultCommand:["gemini"],screenManifest:GEMINI},opencode:{displayName:"OpenCode",defaultCommand:["opencode"],screenManifest:OPENCODE,firstMessageDelivery:"paste",createHookAdapter:()=>new OpencodeFamilyHookAdapter("opencode")},cursor:{displayName:"Cursor Agent",defaultCommand:["cursor-agent"],screenManifest:CURSOR,createHookAdapter:()=>new CursorHookAdapter},grok:{displayName:"Grok CLI",defaultCommand:["grok"],screenManifest:GROK,createHookAdapter:()=>new GrokHookAdapter},droid:{displayName:"Droid",defaultCommand:["droid"],screenManifest:DROID,createHookAdapter:()=>new DroidHookAdapter},amp:{displayName:"Amp",defaultCommand:["amp"],screenManifest:AMP},devin:{displayName:"Devin",defaultCommand:["devin"],processNames:["devin-cli"],screenManifest:DEVIN,createHookAdapter:()=>new DevinHookAdapter},qodercli:{displayName:"Qoder CLI",defaultCommand:["qodercli"],processNames:["qoder","qoderclicn","qodercn"],screenManifest:QODERCLI,createHookAdapter:()=>new QodercliHookAdapter},cline:{displayName:"Cline",defaultCommand:["cline"],screenManifest:CLINE},kiro:{displayName:"Kiro CLI",defaultCommand:["kiro-cli"],processNames:["kiro"],screenManifest:KIRO},maki:{displayName:"Maki",defaultCommand:["maki"],screenManifest:MAKI},antigravity:{displayName:"Antigravity",defaultCommand:["agy"],processNames:["antigravity","antigravity-cli"],screenManifest:ANTIGRAVITY},hermes:{displayName:"Hermes Agent",defaultCommand:["hermes"],processNames:["hermes-agent"],screenManifest:HERMES,createHookAdapter:()=>new HermesHookAdapter},kilo:{displayName:"Kilo",defaultCommand:["kilo"],processNames:["kilo-code"],screenManifest:KILO,firstMessageDelivery:"paste",createHookAdapter:()=>new OpencodeFamilyHookAdapter("kilo")},mastracode:{displayName:"MastraCode",defaultCommand:["mastracode"],processNames:["mastra-code"],screenManifest:MASTRACODE,createHookAdapter:()=>new MastracodeHookAdapter}};function isContribEngine(id){return Object.hasOwn(CONTRIB_ENGINES,id)||pluginEngines.has(id)}var CONTRIB_ENGINE_IDS=Object.keys(CONTRIB_ENGINES);function contribEngineEntry(id,base){let spec=CONTRIB_ENGINES[id]??pluginEngines.get(id);if(!spec)return base;return{...base,displayName:spec.displayName,defaultCommand:spec.defaultCommand,...spec.processNames?{processNames:spec.processNames}:{},screenManifest:spec.screenManifest,...spec.identity?{identity:spec.identity}:{},...spec.firstMessageDelivery?{firstMessageDelivery:spec.firstMessageDelivery}:{},...spec.createHookAdapter?{createHookAdapter:spec.createHookAdapter}:{}}}import{homedir as homedir10}from"os";import{spawnSync}from"child_process";import{existsSync as existsSync6,statSync}from"fs";import{homedir as homedir9}from"os";import path4 from"path";var defaultBinaryDeps={fileExists(p){try{return statSync(p).isFile()}catch{return!1}},env(name){return process.env[name]},home(){return homedir9()},which(name){let cmd=process.platform==="win32"?"where":"which",out=spawnSync(cmd,[name],{encoding:"utf8"});if(out.status!==0)return;let first=out.stdout.split(`
208
- `).map((l)=>l.trim()).filter(Boolean)[0];if(!first)return;if(first.startsWith(`${name}:`)&&first.includes("aliased to")){let aliasTarget=first.split("aliased to")[1]?.trim();return aliasTarget&&existsSync6(aliasTarget)?aliasTarget:void 0}return first},readdir(p){try{return __require("fs").readdirSync(p)}catch{return[]}}};class BinaryNotFoundError extends Error{checkedPaths;constructor(label,hint,checkedPaths){super(`${label} not found. Checked: ${checkedPaths.join(", ")}. ${hint}`);this.name="BinaryNotFoundError",this.checkedPaths=checkedPaths}}function npmStyleDirs({deps,home},locations=["system","nvm","windowsNpm","npmGlobal","local","bun","bin"]){return locations.flatMap((location)=>{switch(location){case"system":return["/opt/homebrew/bin","/usr/local/bin","/usr/bin","/bin"];case"homebrew":return["/opt/homebrew/bin","/usr/local/bin"];case"nvm":{let bin=deps.env("NVM_BIN");return bin?[bin]:[]}case"windowsNpm":{if((deps.platform?.()??process.platform)!=="win32")return[];let appData=deps.env("APPDATA"),localAppData=deps.env("LOCALAPPDATA");return[...localAppData?[path4.join(localAppData,"npm")]:[],...appData?[path4.join(appData,"npm")]:[],path4.join(home,"AppData/Roaming/npm")]}case"npmGlobal":return[path4.join(home,".npm-global/bin")];case"local":return[path4.join(home,".local/bin")];case"yarn":return[path4.join(home,".yarn/bin")];case"bun":return[path4.join(home,".bun/bin")];case"bin":return[path4.join(home,"bin")]}})}function npmStyleBinaryCandidates(ctx,name){let names=(ctx.deps.platform?.()??process.platform)==="win32"?[`${name}.exe`,`${name}.cmd`,name]:[name];return npmStyleDirs(ctx).flatMap((dir)=>names.map((n)=>path4.join(dir,n)))}function createBinaryFinder(spec){return async function(deps=defaultBinaryDeps){let checked=[],whichResult=deps.which(spec.name);if(whichResult){if(checked.push(`which:${whichResult}`),deps.fileExists(whichResult))return whichResult}for(let candidate of spec.candidates({deps,home:deps.home()}))if(checked.push(candidate),deps.fileExists(candidate))return candidate;throw spec.notFound(checked)}}class BobBinaryNotFoundError extends BinaryNotFoundError{constructor(checkedPaths){super("IBM Bob Shell binary","Ensure 'bob' is on PATH (for example `curl -fsSL https://bob.ibm.com/download/bobshell.sh | bash`).",checkedPaths);this.name="BobBinaryNotFoundError"}}var findBobBinary=createBinaryFinder({name:"bob",candidates:(ctx)=>npmStyleBinaryCandidates(ctx,"bob"),notFound:(checked)=>new BobBinaryNotFoundError(checked)});import path5 from"path";class ClaudeBinaryNotFoundError extends BinaryNotFoundError{constructor(checkedPaths){super("Claude Code binary","Ensure 'claude' is on PATH, or install at ~/.claude/local/claude.",checkedPaths);this.name="ClaudeBinaryNotFoundError"}}var findClaudeBinary=createBinaryFinder({name:"claude",candidates({deps,home}){let out=[path5.join(home,".claude","local","claude")];out.push(...npmStyleDirs({deps,home},["nvm"]).map((dir)=>path5.join(dir,"claude")));let nvmRoot=path5.join(home,".nvm","versions","node"),versions=(deps.readdir?.(nvmRoot)??[]).sort((a,b)=>b.localeCompare(a,void 0,{numeric:!0}));for(let v of versions)out.push(path5.join(nvmRoot,v,"bin","claude"));return out.push(...npmStyleDirs({deps,home},["system","local","npmGlobal","yarn","bun","bin"]).map((dir)=>path5.join(dir,"claude"))),out},notFound:(checked)=>new ClaudeBinaryNotFoundError(checked)});import path6 from"path";class CodexBinaryNotFoundError extends BinaryNotFoundError{constructor(checkedPaths){super("Codex CLI binary","Ensure 'codex' is on PATH (e.g. `brew install codex` or the official installer).",checkedPaths);this.name="CodexBinaryNotFoundError"}}var findCodexBinary=createBinaryFinder({name:"codex",candidates({deps,home}){return npmStyleDirs({deps,home},["system","nvm","local","bun","bin"]).map((dir)=>path6.join(dir,"codex"))},notFound:(checked)=>new CodexBinaryNotFoundError(checked)});class CopilotBinaryNotFoundError extends BinaryNotFoundError{constructor(checkedPaths){super("GitHub Copilot CLI binary","Ensure 'copilot' is on PATH (for example `npm install -g @github/copilot` or `brew install copilot-cli`).",checkedPaths);this.name="CopilotBinaryNotFoundError"}}var findCopilotBinary=createBinaryFinder({name:"copilot",candidates:(ctx)=>npmStyleBinaryCandidates(ctx,"copilot"),notFound:(checked)=>new CopilotBinaryNotFoundError(checked)});import path7 from"path";class KimiBinaryNotFoundError extends BinaryNotFoundError{constructor(checkedPaths){super("Kimi Code CLI binary","Ensure 'kimi' is on PATH or installed at ~/.kimi-code/bin/kimi.",checkedPaths);this.name="KimiBinaryNotFoundError"}}var findKimiBinary=createBinaryFinder({name:"kimi",candidates:(ctx)=>[path7.join(ctx.home,".kimi-code/bin"),...npmStyleDirs(ctx,["local","bin","homebrew"])].map((dir)=>path7.join(dir,"kimi")),notFound:(checked)=>new KimiBinaryNotFoundError(checked)});import path8 from"path";class PiFamilyBinaryNotFoundError extends BinaryNotFoundError{constructor(name,checkedPaths){super(`${name} CLI binary`,`Ensure '${name}' is on PATH (e.g. \`brew install ${name}\`, or \`npm i -g ${name==="omp"?"@oh-my-pi/pi-coding-agent":"@earendil-works/pi-coding-agent"}\`).`,checkedPaths);this.name="PiFamilyBinaryNotFoundError"}}function candidatesFor(name,ctx){let{home}=ctx,out=npmStyleDirs(ctx,["system","local","bun","bin"]).map((dir)=>path8.join(dir,name)),packageName=name==="omp"?"@oh-my-pi/pi-coding-agent":"@earendil-works/pi-coding-agent";for(let prefix of[path8.join(home,".npm-global"),"/usr/local","/opt/homebrew"])out.push(path8.join(prefix,"bin",name)),out.push(path8.join(prefix,"lib/node_modules",packageName,"dist","cli.js"));return out}var findPiBinary=createBinaryFinder({name:"pi",candidates:(ctx)=>candidatesFor("pi",ctx),notFound:(checked)=>new PiFamilyBinaryNotFoundError("pi",checked)}),findOmpBinary=createBinaryFinder({name:"omp",candidates:(ctx)=>candidatesFor("omp",ctx),notFound:(checked)=>new PiFamilyBinaryNotFoundError("omp",checked)});var defaultDeps={readFile(p){return readTextFileSyncBounded(p)},env(name){return process.env[name]},home(){return homedir10()},findClaudeBinary(){return findClaudeBinary()},findCodexBinary(){return findCodexBinary()},findBobBinary(){return findBobBinary()},findCopilotBinary(){return findCopilotBinary()},findKimiBinary(){return findKimiBinary()},findPiBinary(){return findPiBinary()},findOmpBinary(){return findOmpBinary()}};function decodeJwtPayload(jwt){let parts=jwt.split(".");if(parts.length!==3)return null;let payload=parts[1];if(!payload)return null;let b64=payload.replace(/-/g,"+").replace(/_/g,"/"),padded=b64+"=".repeat((4-b64.length%4)%4);try{let json=Buffer.from(padded,"base64").toString("utf8"),obj=JSON.parse(json);return typeof obj==="object"&&obj!==null?obj:null}catch{return null}}async function probeBinary(probe){try{return{found:!0,path:await probe()}}catch(err){if(err instanceof BinaryNotFoundError)return{found:!1,error:"not found on PATH"};return{found:!1,error:errorMessage(err)}}}var cachedDefaultVendors=null;async function probeAvailableVendors(deps){return(await Promise.all([["claude",()=>deps.findClaudeBinary()],["codex",()=>deps.findCodexBinary()],["copilot",()=>deps.findCopilotBinary()],["kimi",()=>deps.findKimiBinary()],["pi",()=>deps.findPiBinary()],["omp",()=>deps.findOmpBinary()]].map(async([vendor,probe])=>(await probeBinary(probe)).found?vendor:null))).filter((v)=>v!==null)}function detectAvailableVendors(deps=defaultDeps){if(deps!==defaultDeps)return probeAvailableVendors(deps);if(cachedDefaultVendors)return cachedDefaultVendors;let pending=probeAvailableVendors(deps).catch((err)=>{throw cachedDefaultVendors=null,err});return cachedDefaultVendors=pending,pending}function resetAvailableVendorsCache(){cachedDefaultVendors=null,cachedContribEngines=null}async function installedEngineIds(deps=defaultDeps){let builtins=await detectAvailableVendors(deps),contrib=await detectContribEngines();return[...new Set([...builtins,...getCustomEngineIds(),...contrib])]}async function availableEngineIds(deps=defaultDeps){let disabled=new Set(getDisabledEngineIds());return(await installedEngineIds(deps)).filter((id)=>!disabled.has(id))}var cachedContribEngines=null;function detectContribEngines(){if(cachedContribEngines)return cachedContribEngines;let which=globalThis.Bun?.which;return cachedContribEngines=Promise.resolve([...which?CONTRIB_ENGINE_IDS.filter((id)=>{let bin=CONTRIB_ENGINES[id]?.defaultCommand[0];return bin?which(bin)!==null:!1}):[],...pluginEngineIds()]),cachedContribEngines}async function detectClaudeAccount(deps=defaultDeps){let binary=await probeBinary(()=>deps.findClaudeBinary()),configPath=claudeGlobalConfigPath(deps.env,deps.home()),raw;try{raw=deps.readFile(configPath)}catch(err){return{binary,account:{kind:"none"},accountError:`read ${configPath}: ${errorMessage(err)}`}}if(raw===null)return{binary,account:{kind:"none"}};let parsed;try{parsed=JSON.parse(raw)}catch(err){return{binary,account:{kind:"none"},accountError:`parse ${configPath}: ${errorMessage(err)}`}}let oauth=parsed?.oauthAccount;if(!oauth||typeof oauth!=="object")return{binary,account:{kind:"none"}};let o=oauth,email=typeof o.emailAddress==="string"?o.emailAddress:void 0;if(!email)return{binary,account:{kind:"none"}};return{binary,account:{kind:"oauth",email,organization:typeof o.organizationName==="string"?o.organizationName:void 0,displayName:typeof o.displayName==="string"?o.displayName:void 0,billingType:typeof o.billingType==="string"?o.billingType:void 0}}}async function detectCodexAccount(deps=defaultDeps){let binary=await probeBinary(()=>deps.findCodexBinary()),authPath=codexAuthPath(deps.env,deps.home()),raw;try{raw=deps.readFile(authPath)}catch(err){return{binary,account:{kind:"none"},accountError:`read ${authPath}: ${errorMessage(err)}`}}if(raw===null)return{binary,account:{kind:"none"}};let parsed;try{parsed=JSON.parse(raw)}catch(err){return{binary,account:{kind:"none"},accountError:`parse ${authPath}: ${errorMessage(err)}`}}let obj=parsed??{},tokens=obj.tokens,idToken=typeof tokens?.id_token==="string"?tokens.id_token:void 0;if(idToken){let payload=decodeJwtPayload(idToken);if(!payload)return{binary,account:{kind:"none"},accountError:"codex id_token: malformed JWT"};let email=typeof payload.email==="string"?payload.email:void 0,authClaimRaw=payload["https://api.openai.com/auth"],authClaim=isObject(authClaimRaw)?authClaimRaw:void 0,plan=typeof authClaim?.chatgpt_plan_type==="string"?authClaim.chatgpt_plan_type:void 0;if(email)return{binary,account:{kind:"chatgpt",email,plan}};return{binary,account:{kind:"none"},accountError:"codex id_token: no email claim"}}let apiKey=obj.OPENAI_API_KEY;if(typeof apiKey==="string"&&apiKey.length>0)return{binary,account:{kind:"apikey"}};return{binary,account:{kind:"none"}}}async function detectCopilotAccount(deps=defaultDeps){let binary=await probeBinary(()=>deps.findCopilotBinary());for(let source of["COPILOT_GITHUB_TOKEN","GH_TOKEN","GITHUB_TOKEN"])if(deps.env(source)?.trim())return{binary,account:{kind:"token",source}};let configPath=copilotConfigPath(deps.env,deps.home()),raw;try{raw=deps.readFile(configPath)}catch(err){return{binary,account:{kind:"none"},accountError:`read ${configPath}: ${errorMessage(err)}`}}if(raw===null)return{binary,account:{kind:"none"}};let parsed;try{parsed=JSON.parse(raw)}catch(err){return{binary,account:{kind:"none"},accountError:`parse ${configPath}: ${errorMessage(err)}`}}if(!isObject(parsed))return{binary,account:{kind:"none"}};if(hasStringDeep(parsed,["github_token","oauth_token","access_token","token","selectedUser","currentUser","user"]))return{binary,account:{kind:"oauth"}};return{binary,account:{kind:"none"}}}async function detectBobAccount(deps=defaultDeps){let binary=await probeBinary(()=>deps.findBobBinary()),secretsPath=bobAuthSecretsPath(deps.home()),raw;try{raw=deps.readFile(secretsPath)}catch(err){return{binary,account:{kind:"none"},accountError:`read ${secretsPath}: ${errorMessage(err)}`}}if(raw===null)return{binary,account:{kind:"none"}};let parsed;try{parsed=JSON.parse(raw)}catch(err){return{binary,account:{kind:"none"},accountError:`parse ${secretsPath}: ${errorMessage(err)}`}}if(!isObject(parsed))return{binary,account:{kind:"none"}};let signedIn=Object.entries(parsed).some(([key,value])=>key.startsWith("bob.auth.tokens-")&&typeof value==="string"&&value.length>0);return{binary,account:signedIn?{kind:"oauth"}:{kind:"none"}}}async function detectKimiAccount(deps=defaultDeps){let binary=await probeBinary(()=>deps.findKimiBinary()),credPath=kimiCredentialsPath(deps.env,deps.home()),raw;try{raw=deps.readFile(credPath)}catch(err){return{binary,account:{kind:"none"},accountError:`read ${credPath}: ${errorMessage(err)}`}}if(raw===null)return{binary,account:{kind:"none"}};let parsed;try{parsed=JSON.parse(raw)}catch(err){return{binary,account:{kind:"none"},accountError:`parse ${credPath}: ${errorMessage(err)}`}}if(!isObject(parsed))return{binary,account:{kind:"none"}};let token=parsed.access_token;if(typeof token==="string"&&token.length>0)return{binary,account:{kind:"oauth"}};return{binary,account:{kind:"none"}}}function hasStringDeep(value,interestingKeys,depth=0){if(depth>4||!isObject(value))return!1;for(let[key,entry]of Object.entries(value)){if(interestingKeys.includes(key)&&typeof entry==="string"&&entry.length>0)return!0;if(isObject(entry)&&hasStringDeep(entry,interestingKeys,depth+1))return!0}return!1}
209
- export{parseFlatHooks,mergeFlatHooks,writeIfChanged,registerPluginEngine,clearPluginEngines,pluginEngineIds,isContribEngine,CONTRIB_ENGINE_IDS,contribEngineEntry,resetAvailableVendorsCache,installedEngineIds,availableEngineIds,detectClaudeAccount,detectCodexAccount,detectCopilotAccount,detectBobAccount,detectKimiAccount};
207
+ `}var ACTIVITY_PLUGIN_FILE="rove-agent-state.js",FAMILY_DIRS={opencode:{configDir:"opencode",pluginDir:"plugins"},kilo:{configDir:"kilo",pluginDir:"plugin"}};function opencodeFamilyConfigDir(vendor,home=homedir7()){return path3.join(home,".config",FAMILY_DIRS[vendor].configDir)}function opencodeFamilyPluginPath(vendor,home=homedir7()){return path3.join(opencodeFamilyConfigDir(vendor,home),FAMILY_DIRS[vendor].pluginDir,ACTIVITY_PLUGIN_FILE)}function opencodeFailureDetail(payload){let raw=typeof payload.error_message==="string"?payload.error_message:"",message=raw.toLowerCase(),note=raw?raw.slice(0,200):void 0;return{failure:(()=>{if(/insufficient|credit|billing|payment required|\b402\b|quota exceeded|out of credits/.test(message))return"billing";if(/rate.?limit|too many requests|\b429\b|overloaded|capacity/.test(message))return"rate_limit";if(isTransientFailureText(message))return"transient";return"other"})(),...note?{note}:{}}}class OpencodeFamilyHookAdapter{family;vendor;constructor(family){this.family=family;this.vendor=family}supportsHooks(){return!0}globalSettingsPath(){return opencodeFamilyPluginPath(this.family)}activityDetailFromPayload(kind,payload){if(kind==="turn-failed")return opencodeFailureDetail(payload);if(kind==="awaiting-input")return{waiting:payload.waiting==="input"?"input":"permission"};return}sessionFromPayload(payload){let sessionId=typeof payload.session_id==="string"?payload.session_id:void 0;return sessionId?{sessionId}:void 0}async installActivityHooks(settingsFilePath){let configDir=path3.dirname(path3.dirname(settingsFilePath));if(!existsSync5(configDir))return{ok:!0};let source=renderOpencodePluginSource({vendor:this.family,invocation:roveHookInvocation()});return await writeIfChanged(settingsFilePath,source),{ok:!0}}async removeActivityHooks(settingsFilePath){try{await rm2(settingsFilePath,{force:!0})}catch{}}supportsWorktreeSync(){return!1}async removeWorktreeSyncHook(){}async removeWorktreeWatchHook(){}}import{homedir as homedir8}from"os";import{join as join7}from"path";var QODERCLI_HOOK_EVENT_MAP=sessionStartOnly("*");function qodercliSettingsPath(home=homedir8()){let override=process.env.QODERCLI_CONFIG_DIR?.trim();return join7(override||join7(home,".qoder"),"settings.json")}class QodercliHookAdapter extends SessionStartHookAdapter{vendor="qodercli";eventMap=QODERCLI_HOOK_EVENT_MAP;globalSettingsPath(){return qodercliSettingsPath()}}var pluginEngines=new Map;function registerPluginEngine(id,spec){if(Object.hasOwn(CONTRIB_ENGINES,id))return!1;return pluginEngines.set(id,spec),!0}function clearPluginEngines(){pluginEngines.clear()}function pluginEngineIds(){return[...pluginEngines.keys()]}var CONTRIB_ENGINES={gemini:{displayName:"Gemini CLI",defaultCommand:["gemini"],screenManifest:GEMINI,skillsDir:()=>skillsDirUnder(join8(homedir9(),".gemini"))},opencode:{displayName:"OpenCode",defaultCommand:["opencode"],screenManifest:OPENCODE,firstMessageDelivery:"paste",createHookAdapter:()=>new OpencodeFamilyHookAdapter("opencode"),skillsDir:()=>skillsDirUnder(join8(xdgConfigHome(),"opencode"))},cursor:{displayName:"Cursor Agent",defaultCommand:["cursor-agent"],screenManifest:CURSOR,createHookAdapter:()=>new CursorHookAdapter,skillsDir:()=>skillsDirUnder(join8(homedir9(),".cursor"))},grok:{displayName:"Grok CLI",defaultCommand:["grok"],screenManifest:GROK,createHookAdapter:()=>new GrokHookAdapter,skillsDir:()=>skillsDirUnder(grokConfigDir())},droid:{displayName:"Droid",defaultCommand:["droid"],screenManifest:DROID,createHookAdapter:()=>new DroidHookAdapter,skillsDir:()=>skillsDirUnder(join8(homedir9(),".factory"))},amp:{displayName:"Amp",defaultCommand:["amp"],screenManifest:AMP},devin:{displayName:"Devin",defaultCommand:["devin"],processNames:["devin-cli"],screenManifest:DEVIN,createHookAdapter:()=>new DevinHookAdapter,skillsDir:()=>skillsDirUnder(join8(xdgConfigHome(),"devin"))},qodercli:{displayName:"Qoder CLI",defaultCommand:["qodercli"],processNames:["qoder","qoderclicn","qodercn"],screenManifest:QODERCLI,createHookAdapter:()=>new QodercliHookAdapter,skillsDir:()=>skillsDirUnder(join8(homedir9(),".qoder"))},cline:{displayName:"Cline",defaultCommand:["cline"],screenManifest:CLINE},kiro:{displayName:"Kiro CLI",defaultCommand:["kiro-cli"],processNames:["kiro"],screenManifest:KIRO,skillsDir:()=>skillsDirUnder(join8(homedir9(),".kiro"))},maki:{displayName:"Maki",defaultCommand:["maki"],screenManifest:MAKI},antigravity:{displayName:"Antigravity",defaultCommand:["agy"],processNames:["antigravity","antigravity-cli"],screenManifest:ANTIGRAVITY,skillsDir:()=>skillsDirUnder(join8(homedir9(),".gemini","antigravity"))},hermes:{displayName:"Hermes Agent",defaultCommand:["hermes"],processNames:["hermes-agent"],screenManifest:HERMES,createHookAdapter:()=>new HermesHookAdapter,skillsDir:()=>skillsDirUnder(hermesConfigDir())},kilo:{displayName:"Kilo",defaultCommand:["kilo"],processNames:["kilo-code"],screenManifest:KILO,firstMessageDelivery:"paste",createHookAdapter:()=>new OpencodeFamilyHookAdapter("kilo"),skillsDir:()=>skillsDirUnder(join8(homedir9(),".kilo"))},mastracode:{displayName:"MastraCode",defaultCommand:["mastracode"],processNames:["mastra-code"],screenManifest:MASTRACODE,createHookAdapter:()=>new MastracodeHookAdapter}};function isContribEngine(id){return Object.hasOwn(CONTRIB_ENGINES,id)||pluginEngines.has(id)}var CONTRIB_ENGINE_IDS=Object.keys(CONTRIB_ENGINES);function contribEngineEntry(id,base){let spec=CONTRIB_ENGINES[id]??pluginEngines.get(id);if(!spec)return base;return{...base,displayName:spec.displayName,defaultCommand:spec.defaultCommand,...spec.processNames?{processNames:spec.processNames}:{},screenManifest:spec.screenManifest,...spec.identity?{identity:spec.identity}:{},...spec.firstMessageDelivery?{firstMessageDelivery:spec.firstMessageDelivery}:{},...spec.createHookAdapter?{createHookAdapter:spec.createHookAdapter}:{},...spec.skillsDir?{skillsDir:spec.skillsDir}:{}}}import{homedir as homedir11}from"os";import{spawnSync}from"child_process";import{existsSync as existsSync6,statSync}from"fs";import{homedir as homedir10}from"os";import path4 from"path";var defaultBinaryDeps={fileExists(p){try{return statSync(p).isFile()}catch{return!1}},env(name){return process.env[name]},home(){return homedir10()},which(name){let cmd=process.platform==="win32"?"where":"which",out=spawnSync(cmd,[name],{encoding:"utf8"});if(out.status!==0)return;let first=out.stdout.split(`
208
+ `).map((l)=>l.trim()).filter(Boolean)[0];if(!first)return;if(first.startsWith(`${name}:`)&&first.includes("aliased to")){let aliasTarget=first.split("aliased to")[1]?.trim();return aliasTarget&&existsSync6(aliasTarget)?aliasTarget:void 0}return first},readdir(p){try{return __require("fs").readdirSync(p)}catch{return[]}}};class BinaryNotFoundError extends Error{checkedPaths;constructor(label,hint,checkedPaths){super(`${label} not found. Checked: ${checkedPaths.join(", ")}. ${hint}`);this.name="BinaryNotFoundError",this.checkedPaths=checkedPaths}}function npmStyleDirs({deps,home},locations=["system","nvm","windowsNpm","npmGlobal","local","bun","bin"]){return locations.flatMap((location)=>{switch(location){case"system":return["/opt/homebrew/bin","/usr/local/bin","/usr/bin","/bin"];case"homebrew":return["/opt/homebrew/bin","/usr/local/bin"];case"nvm":{let bin=deps.env("NVM_BIN");return bin?[bin]:[]}case"windowsNpm":{if((deps.platform?.()??process.platform)!=="win32")return[];let appData=deps.env("APPDATA"),localAppData=deps.env("LOCALAPPDATA");return[...localAppData?[path4.join(localAppData,"npm")]:[],...appData?[path4.join(appData,"npm")]:[],path4.join(home,"AppData/Roaming/npm")]}case"npmGlobal":return[path4.join(home,".npm-global/bin")];case"local":return[path4.join(home,".local/bin")];case"yarn":return[path4.join(home,".yarn/bin")];case"bun":return[path4.join(home,".bun/bin")];case"bin":return[path4.join(home,"bin")]}})}function npmStyleBinaryCandidates(ctx,name){let names=(ctx.deps.platform?.()??process.platform)==="win32"?[`${name}.exe`,`${name}.cmd`,name]:[name];return npmStyleDirs(ctx).flatMap((dir)=>names.map((n)=>path4.join(dir,n)))}function createBinaryFinder(spec){return async function(deps=defaultBinaryDeps){let checked=[],whichResult=deps.which(spec.name);if(whichResult){if(checked.push(`which:${whichResult}`),deps.fileExists(whichResult))return whichResult}for(let candidate of spec.candidates({deps,home:deps.home()}))if(checked.push(candidate),deps.fileExists(candidate))return candidate;throw spec.notFound(checked)}}class BobBinaryNotFoundError extends BinaryNotFoundError{constructor(checkedPaths){super("IBM Bob Shell binary","Ensure 'bob' is on PATH (for example `curl -fsSL https://bob.ibm.com/download/bobshell.sh | bash`).",checkedPaths);this.name="BobBinaryNotFoundError"}}var findBobBinary=createBinaryFinder({name:"bob",candidates:(ctx)=>npmStyleBinaryCandidates(ctx,"bob"),notFound:(checked)=>new BobBinaryNotFoundError(checked)});import path5 from"path";class ClaudeBinaryNotFoundError extends BinaryNotFoundError{constructor(checkedPaths){super("Claude Code binary","Ensure 'claude' is on PATH, or install at ~/.claude/local/claude.",checkedPaths);this.name="ClaudeBinaryNotFoundError"}}var findClaudeBinary=createBinaryFinder({name:"claude",candidates({deps,home}){let out=[path5.join(home,".claude","local","claude")];out.push(...npmStyleDirs({deps,home},["nvm"]).map((dir)=>path5.join(dir,"claude")));let nvmRoot=path5.join(home,".nvm","versions","node"),versions=(deps.readdir?.(nvmRoot)??[]).sort((a,b)=>b.localeCompare(a,void 0,{numeric:!0}));for(let v of versions)out.push(path5.join(nvmRoot,v,"bin","claude"));return out.push(...npmStyleDirs({deps,home},["system","local","npmGlobal","yarn","bun","bin"]).map((dir)=>path5.join(dir,"claude"))),out},notFound:(checked)=>new ClaudeBinaryNotFoundError(checked)});import path6 from"path";class CodexBinaryNotFoundError extends BinaryNotFoundError{constructor(checkedPaths){super("Codex CLI binary","Ensure 'codex' is on PATH (e.g. `brew install codex` or the official installer).",checkedPaths);this.name="CodexBinaryNotFoundError"}}var findCodexBinary=createBinaryFinder({name:"codex",candidates({deps,home}){return npmStyleDirs({deps,home},["system","nvm","local","bun","bin"]).map((dir)=>path6.join(dir,"codex"))},notFound:(checked)=>new CodexBinaryNotFoundError(checked)});class CopilotBinaryNotFoundError extends BinaryNotFoundError{constructor(checkedPaths){super("GitHub Copilot CLI binary","Ensure 'copilot' is on PATH (for example `npm install -g @github/copilot` or `brew install copilot-cli`).",checkedPaths);this.name="CopilotBinaryNotFoundError"}}var findCopilotBinary=createBinaryFinder({name:"copilot",candidates:(ctx)=>npmStyleBinaryCandidates(ctx,"copilot"),notFound:(checked)=>new CopilotBinaryNotFoundError(checked)});import path7 from"path";class KimiBinaryNotFoundError extends BinaryNotFoundError{constructor(checkedPaths){super("Kimi Code CLI binary","Ensure 'kimi' is on PATH or installed at ~/.kimi-code/bin/kimi.",checkedPaths);this.name="KimiBinaryNotFoundError"}}var findKimiBinary=createBinaryFinder({name:"kimi",candidates:(ctx)=>[path7.join(ctx.home,".kimi-code/bin"),...npmStyleDirs(ctx,["local","bin","homebrew"])].map((dir)=>path7.join(dir,"kimi")),notFound:(checked)=>new KimiBinaryNotFoundError(checked)});import path8 from"path";class PiFamilyBinaryNotFoundError extends BinaryNotFoundError{constructor(name,checkedPaths){super(`${name} CLI binary`,`Ensure '${name}' is on PATH (e.g. \`brew install ${name}\`, or \`npm i -g ${name==="omp"?"@oh-my-pi/pi-coding-agent":"@earendil-works/pi-coding-agent"}\`).`,checkedPaths);this.name="PiFamilyBinaryNotFoundError"}}function candidatesFor(name,ctx){let{home}=ctx,out=npmStyleDirs(ctx,["system","local","bun","bin"]).map((dir)=>path8.join(dir,name)),packageName=name==="omp"?"@oh-my-pi/pi-coding-agent":"@earendil-works/pi-coding-agent";for(let prefix of[path8.join(home,".npm-global"),"/usr/local","/opt/homebrew"])out.push(path8.join(prefix,"bin",name)),out.push(path8.join(prefix,"lib/node_modules",packageName,"dist","cli.js"));return out}var findPiBinary=createBinaryFinder({name:"pi",candidates:(ctx)=>candidatesFor("pi",ctx),notFound:(checked)=>new PiFamilyBinaryNotFoundError("pi",checked)}),findOmpBinary=createBinaryFinder({name:"omp",candidates:(ctx)=>candidatesFor("omp",ctx),notFound:(checked)=>new PiFamilyBinaryNotFoundError("omp",checked)});var defaultDeps={readFile(p){return readTextFileSyncBounded(p)},env(name){return process.env[name]},home(){return homedir11()},findClaudeBinary(){return findClaudeBinary()},findCodexBinary(){return findCodexBinary()},findBobBinary(){return findBobBinary()},findCopilotBinary(){return findCopilotBinary()},findKimiBinary(){return findKimiBinary()},findPiBinary(){return findPiBinary()},findOmpBinary(){return findOmpBinary()}};function decodeJwtPayload(jwt){let parts=jwt.split(".");if(parts.length!==3)return null;let payload=parts[1];if(!payload)return null;let b64=payload.replace(/-/g,"+").replace(/_/g,"/"),padded=b64+"=".repeat((4-b64.length%4)%4);try{let json=Buffer.from(padded,"base64").toString("utf8"),obj=JSON.parse(json);return typeof obj==="object"&&obj!==null?obj:null}catch{return null}}async function probeBinary(probe){try{return{found:!0,path:await probe()}}catch(err){if(err instanceof BinaryNotFoundError)return{found:!1,error:"not found on PATH"};return{found:!1,error:errorMessage(err)}}}var cachedDefaultVendors=null;async function probeAvailableVendors(deps){return(await Promise.all([["claude",()=>deps.findClaudeBinary()],["codex",()=>deps.findCodexBinary()],["copilot",()=>deps.findCopilotBinary()],["kimi",()=>deps.findKimiBinary()],["pi",()=>deps.findPiBinary()],["omp",()=>deps.findOmpBinary()]].map(async([vendor,probe])=>(await probeBinary(probe)).found?vendor:null))).filter((v)=>v!==null)}function detectAvailableVendors(deps=defaultDeps){if(deps!==defaultDeps)return probeAvailableVendors(deps);if(cachedDefaultVendors)return cachedDefaultVendors;let pending=probeAvailableVendors(deps).catch((err)=>{throw cachedDefaultVendors=null,err});return cachedDefaultVendors=pending,pending}function resetAvailableVendorsCache(){cachedDefaultVendors=null,cachedContribEngines=null}async function installedEngineIds(deps=defaultDeps){let builtins=await detectAvailableVendors(deps),contrib=await detectContribEngines();return[...new Set([...builtins,...getCustomEngineIds(),...contrib])]}async function availableEngineIds(deps=defaultDeps){let disabled=new Set(getDisabledEngineIds());return(await installedEngineIds(deps)).filter((id)=>!disabled.has(id))}var cachedContribEngines=null;function detectContribEngines(){if(cachedContribEngines)return cachedContribEngines;let which=globalThis.Bun?.which;return cachedContribEngines=Promise.resolve([...which?CONTRIB_ENGINE_IDS.filter((id)=>{let bin=CONTRIB_ENGINES[id]?.defaultCommand[0];return bin?which(bin)!==null:!1}):[],...pluginEngineIds()]),cachedContribEngines}async function detectClaudeAccount(deps=defaultDeps){let binary=await probeBinary(()=>deps.findClaudeBinary()),configPath=claudeGlobalConfigPath(deps.env,deps.home()),raw;try{raw=deps.readFile(configPath)}catch(err){return{binary,account:{kind:"none"},accountError:`read ${configPath}: ${errorMessage(err)}`}}if(raw===null)return{binary,account:{kind:"none"}};let parsed;try{parsed=JSON.parse(raw)}catch(err){return{binary,account:{kind:"none"},accountError:`parse ${configPath}: ${errorMessage(err)}`}}let oauth=parsed?.oauthAccount;if(!oauth||typeof oauth!=="object")return{binary,account:{kind:"none"}};let o=oauth,email=typeof o.emailAddress==="string"?o.emailAddress:void 0;if(!email)return{binary,account:{kind:"none"}};return{binary,account:{kind:"oauth",email,organization:typeof o.organizationName==="string"?o.organizationName:void 0,displayName:typeof o.displayName==="string"?o.displayName:void 0,billingType:typeof o.billingType==="string"?o.billingType:void 0}}}async function detectCodexAccount(deps=defaultDeps){let binary=await probeBinary(()=>deps.findCodexBinary()),authPath=codexAuthPath(deps.env,deps.home()),raw;try{raw=deps.readFile(authPath)}catch(err){return{binary,account:{kind:"none"},accountError:`read ${authPath}: ${errorMessage(err)}`}}if(raw===null)return{binary,account:{kind:"none"}};let parsed;try{parsed=JSON.parse(raw)}catch(err){return{binary,account:{kind:"none"},accountError:`parse ${authPath}: ${errorMessage(err)}`}}let obj=parsed??{},tokens=obj.tokens,idToken=typeof tokens?.id_token==="string"?tokens.id_token:void 0;if(idToken){let payload=decodeJwtPayload(idToken);if(!payload)return{binary,account:{kind:"none"},accountError:"codex id_token: malformed JWT"};let email=typeof payload.email==="string"?payload.email:void 0,authClaimRaw=payload["https://api.openai.com/auth"],authClaim=isObject(authClaimRaw)?authClaimRaw:void 0,plan=typeof authClaim?.chatgpt_plan_type==="string"?authClaim.chatgpt_plan_type:void 0;if(email)return{binary,account:{kind:"chatgpt",email,plan}};return{binary,account:{kind:"none"},accountError:"codex id_token: no email claim"}}let apiKey=obj.OPENAI_API_KEY;if(typeof apiKey==="string"&&apiKey.length>0)return{binary,account:{kind:"apikey"}};return{binary,account:{kind:"none"}}}async function detectCopilotAccount(deps=defaultDeps){let binary=await probeBinary(()=>deps.findCopilotBinary());for(let source of["COPILOT_GITHUB_TOKEN","GH_TOKEN","GITHUB_TOKEN"])if(deps.env(source)?.trim())return{binary,account:{kind:"token",source}};let configPath=copilotConfigPath(deps.env,deps.home()),raw;try{raw=deps.readFile(configPath)}catch(err){return{binary,account:{kind:"none"},accountError:`read ${configPath}: ${errorMessage(err)}`}}if(raw===null)return{binary,account:{kind:"none"}};let parsed;try{parsed=JSON.parse(raw)}catch(err){return{binary,account:{kind:"none"},accountError:`parse ${configPath}: ${errorMessage(err)}`}}if(!isObject(parsed))return{binary,account:{kind:"none"}};if(hasStringDeep(parsed,["github_token","oauth_token","access_token","token","selectedUser","currentUser","user"]))return{binary,account:{kind:"oauth"}};return{binary,account:{kind:"none"}}}async function detectBobAccount(deps=defaultDeps){let binary=await probeBinary(()=>deps.findBobBinary()),secretsPath=bobAuthSecretsPath(deps.home()),raw;try{raw=deps.readFile(secretsPath)}catch(err){return{binary,account:{kind:"none"},accountError:`read ${secretsPath}: ${errorMessage(err)}`}}if(raw===null)return{binary,account:{kind:"none"}};let parsed;try{parsed=JSON.parse(raw)}catch(err){return{binary,account:{kind:"none"},accountError:`parse ${secretsPath}: ${errorMessage(err)}`}}if(!isObject(parsed))return{binary,account:{kind:"none"}};let signedIn=Object.entries(parsed).some(([key,value])=>key.startsWith("bob.auth.tokens-")&&typeof value==="string"&&value.length>0);return{binary,account:signedIn?{kind:"oauth"}:{kind:"none"}}}async function detectKimiAccount(deps=defaultDeps){let binary=await probeBinary(()=>deps.findKimiBinary()),credPath=kimiCredentialsPath(deps.env,deps.home()),raw;try{raw=deps.readFile(credPath)}catch(err){return{binary,account:{kind:"none"},accountError:`read ${credPath}: ${errorMessage(err)}`}}if(raw===null)return{binary,account:{kind:"none"}};let parsed;try{parsed=JSON.parse(raw)}catch(err){return{binary,account:{kind:"none"},accountError:`parse ${credPath}: ${errorMessage(err)}`}}if(!isObject(parsed))return{binary,account:{kind:"none"}};let token=parsed.access_token;if(typeof token==="string"&&token.length>0)return{binary,account:{kind:"oauth"}};return{binary,account:{kind:"none"}}}function hasStringDeep(value,interestingKeys,depth=0){if(depth>4||!isObject(value))return!1;for(let[key,entry]of Object.entries(value)){if(interestingKeys.includes(key)&&typeof entry==="string"&&entry.length>0)return!0;if(isObject(entry)&&hasStringDeep(entry,interestingKeys,depth+1))return!0}return!1}
209
+ export{parseFlatHooks,mergeFlatHooks,writeIfChanged,isTransientFailureText,registerPluginEngine,clearPluginEngines,pluginEngineIds,isContribEngine,CONTRIB_ENGINE_IDS,contribEngineEntry,resetAvailableVendorsCache,installedEngineIds,availableEngineIds,detectClaudeAccount,detectCodexAccount,detectCopilotAccount,detectBobAccount,detectKimiAccount};
@@ -0,0 +1,3 @@
1
+ // @bun
2
+ import{ensurePtyHostReachable}from"./chunk-z43e08kw.js";import{DEFAULT_TERMINAL_COLORS,parseTerminalDefaultColors}from"./chunk-mqfvzdpr.js";import{BUNDLED_THEMES,DEFAULT_THEME,readPersistedUiPrefs}from"./chunk-cf3vpsm5.js";import{loadUserThemes,parseRgbLiteral}from"./chunk-kxp04jnp.js";import{ENGINE_EXIT_BANNER,REPO_INIT_TIMEOUT_SECONDS,initMarkerSaysFinished}from"./chunk-61cn88e7.js";import{aliasKey,isUnderKey,unclaimedSessions}from"./chunk-g9ba25q5.js";import{engineProcessIn,foregroundEngineIn,parsePsSnapshot,psSnapshot}from"./chunk-vvqwgcge.js";import{engineEntry}from"./chunk-x83xbzjd.js";import{terminalRows}from"./chunk-etfh8f4z.js";import{RoveDaemonClient}from"./chunk-qzzmd63x.js";import{BUILTIN_VENDORS}from"./chunk-h2m7em1e.js";import{LockfileError,acquire,release}from"./chunk-bejhca6z.js";import{defaultDeliveryLockDir,defaultPtyHostSocketPath}from"./chunk-eqdbfgq5.js";function normalizeHex(value){let m=/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/.exec(value);if(!m)return null;let digits=m[1];if(digits.length===3){let[r,g,b]=digits;return`#${r}${r}${g}${g}${b}${b}`.toLowerCase()}return`#${digits.slice(0,6)}`.toLowerCase()}function rgbToHex({r,g,b}){let hex=(n)=>n.toString(16).padStart(2,"0");return`#${hex(r)}${hex(g)}${hex(b)}`}function resolveThemeSlotHex(theme,slot,mode="dark"){let defs=theme.defs??{};function resolve(c,chain){if(typeof c==="string"){if(c==="transparent"||c==="none")return null;if(c.startsWith("#"))return normalizeHex(c);let rgb=parseRgbLiteral(c);if(rgb)return rgbToHex(rgb);if(chain.includes(c))return null;let next=defs[c]??theme.theme[c];if(next===void 0)return null;return resolve(next,[...chain,c])}if(!c||typeof c!=="object")return null;let variant=c[mode];return typeof variant==="string"?resolve(variant,chain):null}let value=theme.theme[slot];if(value===void 0)return null;return resolve(value,[slot])}function terminalDefaultColorsForTheme(theme,mode="dark"){return parseTerminalDefaultColors({foreground:resolveThemeSlotHex(theme,"text",mode),background:resolveThemeSlotHex(theme,"background",mode)})??DEFAULT_TERMINAL_COLORS}function readPersistedTerminalDefaultColors(){let themes={...BUNDLED_THEMES};for(let{name,theme}of loadUserThemes())themes[name]=theme;let prefs=readPersistedUiPrefs(DEFAULT_THEME,(name)=>Boolean(themes[name])),selected=themes[prefs.theme]??themes[DEFAULT_THEME];return selected?terminalDefaultColorsForTheme(selected,prefs.themeMode==="light"?"light":"dark"):DEFAULT_TERMINAL_COLORS}async function enginePresence(pid,extraLaunch,snapshot=psSnapshot){if(!pid)return{kind:"none"};try{let rows=parsePsSnapshot(await snapshot([pid])),engine=foregroundEngineIn(rows,pid);if(engine)return{kind:"engine",vendor:engine.vendor};return engineProcessIn(rows,pid,extraLaunch)?{kind:"engine",vendor:null}:{kind:"none"}}catch{return{kind:"unknown"}}}import{basename}from"path";import path from"path";var DELIVERY_LOCK_TIMEOUT_MS=5000,DELIVERY_LOCK_RETRY_MS=20;function lockFileName(key){return`${key.replace(/[^A-Za-z0-9._-]/g,"_")}.lock`}function deliveryLockPath(key,lockDir=defaultDeliveryLockDir()){return path.join(lockDir,lockFileName(key))}var sleep=(ms)=>new Promise((resolve)=>setTimeout(resolve,ms));async function withDeliveryLock(key,fn,opts={}){let lockPath=deliveryLockPath(key,opts.lockDir??defaultDeliveryLockDir()),deadline=Date.now()+(opts.timeoutMs??DELIVERY_LOCK_TIMEOUT_MS),token=null;for(;;)try{token=await acquire(lockPath);break}catch(err){if(!(err instanceof LockfileError))break;if(Date.now()>=deadline)break;await sleep(DELIVERY_LOCK_RETRY_MS)}try{return await fn()}finally{if(token!==null)await release(lockPath,token).catch(()=>{})}}var PASTE_READY_TIMEOUT_MS=15000,PASTE_READY_POLL_MS=100;function bracketedPasteActive(output){let on=output.lastIndexOf("\x1B[?2004h");if(on===-1)return!1;return on>output.lastIndexOf("\x1B[?2004l")}function encodePaste(prompt,bracketed){return bracketed?`\x1B[200~${prompt}\x1B[201~`:prompt}async function connectHostedSessionClient(socketPath){let client=new RoveDaemonClient(socketPath);try{await client.connect()}catch(error){throw client.close(),error}return{rpc:client,close:()=>client.close()}}async function openHostedSessionHost(){try{return await connectHostedSessionClient(defaultPtyHostSocketPath())}catch{return null}}async function ensureHostedSessionHost(){return connectHostedSessionClient(await ensurePtyHostReachable())}async function listHostedSessionsOrNull(rpc){try{let{sessions}=await rpc.request("pty.list",{});return sessions??[]}catch{return null}}async function listHostedSessions(rpc){return await listHostedSessionsOrNull(rpc)??[]}function isHostedTaskKey(key,taskId){return(key.split("::")[0]??key)===taskId}function hostedTaskKeys(sessions,taskId,scope){return sessions.filter((session)=>isHostedTaskKey(session.key,taskId)&&!scope?.spare.some((base)=>isUnderKey(session.key,base))||(scope?.also.some((base)=>isUnderKey(session.key,base))??!1)).map((session)=>session.key)}async function killHostedSessions(rpc,keys,opts){let payload=opts?.wait===!0?{wait:!0}:{};await Promise.all(keys.map((key)=>rpc.request("pty.kill",{key,...payload}).catch(()=>{})))}function commandHasEngineWord(command,engineBin){for(let part of command)for(let token of part.split(/\s+/)){let bare=token.replace(/^['"]+|['"]+$/g,"");if(bare&&basename(bare)===engineBin)return!0}return!1}function builtinEngineBins(){return BUILTIN_VENDORS.flatMap((vendor)=>{let entry=engineEntry(vendor);return[entry.defaultCommand[0],...entry.processNames??[]]}).filter((bin)=>Boolean(bin))}function sessionArgvNamesEngine(command,engineBin){if(!command||command.length===0)return!1;if(engineBin&&commandHasEngineWord(command,engineBin))return!0;return builtinEngineBins().some((bin)=>commandHasEngineWord(command,bin))}function tabOrder(key){let n=Number(/tab-(\d+)$/.exec(key)?.[1]);return Number.isFinite(n)?n:Number.POSITIVE_INFINITY}function findHostedEngineKey(sessions,taskId,engineBin,scope){if(scope?.alias){let key=aliasKey(scope.alias);if(sessions.some((s)=>s.alive&&s.key===key))return key}let mine=unclaimedSessions(sessions,scope).filter((s)=>s.alive&&isHostedTaskKey(s.key,taskId)).sort((a,b)=>tabOrder(a.key)-tabOrder(b.key)),tab1=mine.find((s)=>s.key===`${taskId}::tab-1`);if(tab1)return tab1.key;if(engineBin){let byCommand=mine.find((s)=>commandHasEngineWord(s.command,engineBin));if(byCommand)return byCommand.key}return mine.find((s)=>sessionArgvNamesEngine(s.command))?.key??null}var SUBMIT_DELAY_MS=150,CONFIRM_TAIL_CHARS=24,CONFIRM_TIMEOUT_MS=2000,CONFIRM_POLL_MS=100;function flatten(text){return text.replace(/\s+/g," ")}async function confirmPromptLanded(rpc,key,prompt,sinceOffset){let tail=flatten(prompt).trim().slice(-CONFIRM_TAIL_CHARS);if(tail.length===0)return!1;let deadline=Date.now()+CONFIRM_TIMEOUT_MS;for(;;){let peek=await rpc.request("pty.peek",{key,sinceOffset});if(!peek.alive)return!1;if(flatten(Buffer.from(peek.data,"base64").toString("utf8")).includes(tail))return!0;if(Date.now()>=deadline)return!1;await new Promise((resolve)=>setTimeout(resolve,CONFIRM_POLL_MS))}}async function writeAndConfirm(rpc,key,prompt,sinceOffset,opts){let ready=await awaitPasteReady(rpc,key,{timeoutMs:opts?.pasteReadyTimeoutMs}),{bytes}=await writeHostedPrompt(rpc,key,prompt,{ready,vendor:opts?.vendor}),confirmed=await confirmPromptLanded(rpc,key,prompt,sinceOffset);return{bytes,ready,confirmed}}async function writeHostedPromptIfLive(rpc,key,prompt,opts){let peek=await rpc.request("pty.peek",{key});if(!peek.alive)return null;return writeAndConfirm(rpc,key,prompt,peek.offset,opts)}async function awaitPasteReady(rpc,key,opts={}){let sleep2=opts.sleep??((ms)=>new Promise((resolve)=>setTimeout(resolve,ms))),deadline=Date.now()+(opts.timeoutMs??PASTE_READY_TIMEOUT_MS);for(;;){let peek=await rpc.request("pty.peek",{key});if(!peek.alive)return!1;if(bracketedPasteActive(Buffer.from(peek.data,"base64").toString("latin1")))return!0;if(Date.now()>=deadline)return!1;await sleep2(PASTE_READY_POLL_MS)}}async function writeHostedPrompt(rpc,key,prompt,opts){let bracketed=opts?.ready??await awaitPasteReady(rpc,key),capabilities=opts?.vendor?engineEntry(opts.vendor).capabilities:void 0,prepared=capabilities?.preparePromptSubmission?.(prompt),data=encodePaste(prepared??prompt,bracketed);return await withDeliveryLock(key,async()=>{await rpc.request("pty.write",{key,data}),await new Promise((resolve)=>setTimeout(resolve,SUBMIT_DELAY_MS)),await rpc.request("pty.write",{key,data:`${capabilities?.beforePromptSubmit??""}\r`})}),{bytes:Buffer.byteLength(data,"utf8")}}var deliverToHostedKey=writeHostedPromptIfLive;async function ensureHostedEngine(rpc,cwd,launch,defaultColors=readPersistedTerminalDefaultColors()){let result=await rpc.request("pty.open",{key:launch.key,cwd,command:launch.command,defaultColors});return await rpc.request("pty.detach",{key:launch.key}).catch(()=>{}),result}var FIRST_MESSAGE_ENGINE_TIMEOUT_MS=20000,FIRST_MESSAGE_POLL_INTERVAL_MS=500,FIRST_MESSAGE_SETTLE_MS=1500;async function awaitEngineProcess(rpc,key,engineBin,opts={}){let sleep2=opts.sleep??((ms)=>new Promise((resolve)=>setTimeout(resolve,ms))),snapshot=opts.snapshot;if(opts.initMarkerPath){let initDeadline=Date.now()+(opts.initTimeoutMs??REPO_INIT_TIMEOUT_SECONDS*1000);while(Date.now()<initDeadline){let{sessions=[]}=await rpc.request("pty.list",{});if(!sessions.find((s)=>s.key===key)?.alive)return null;if(initMarkerSaysFinished(opts.initMarkerPath))break;await sleep2(opts.intervalMs??FIRST_MESSAGE_POLL_INTERVAL_MS)}}let deadline=Date.now()+(opts.timeoutMs??FIRST_MESSAGE_ENGINE_TIMEOUT_MS);while(Date.now()<deadline){let{sessions=[]}=await rpc.request("pty.list",{}),session=sessions.find((s)=>s.key===key);if(!session?.alive)return null;if(session.pid){let presence=await enginePresence(session.pid,engineBin,snapshot);if(presence.kind==="engine")return{pid:session.pid,vendor:presence.vendor}}await sleep2(opts.intervalMs??FIRST_MESSAGE_POLL_INTERVAL_MS)}return null}async function hostedSessionFailureLine(rpc,key,limit=200){try{let peek=await rpc.request("pty.peek",{key}),lines=terminalRows(Buffer.from(peek.data,"base64").toString("utf8")).map((row)=>row.trim()).filter((row)=>row.length>0),line=lines.findLast((row)=>ENGINE_EXIT_BANNER.test(row))??lines.at(-1);return line===void 0?void 0:line.slice(0,limit)}catch{return}}async function pastePromptWhenEngineUp(rpc,key,engineBin,prompt,opts={}){let sleep2=opts.sleep??((ms)=>new Promise((resolve)=>setTimeout(resolve,ms))),engine=await awaitEngineProcess(rpc,key,engineBin,opts);if(engine!==null){if(!await awaitPasteReady(rpc,key,{timeoutMs:opts.pasteReadyTimeoutMs,sleep:sleep2}))await sleep2(opts.settleMs??FIRST_MESSAGE_SETTLE_MS);return await writeHostedPromptIfLive(rpc,key,prompt,{...opts,vendor:engine.vendor})}return null}
3
+ export{resolveThemeSlotHex,readPersistedTerminalDefaultColors,withDeliveryLock,enginePresence,awaitEngineProcess,hostedSessionFailureLine,pastePromptWhenEngineUp,openHostedSessionHost,ensureHostedSessionHost,listHostedSessionsOrNull,listHostedSessions,isHostedTaskKey,hostedTaskKeys,killHostedSessions,sessionArgvNamesEngine,findHostedEngineKey,deliverToHostedKey,ensureHostedEngine};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{AUTO_MACHINE,LOCAL_MACHINE,forwardVerb,invokeRouted,machineDaemonSocket,machinePtySocket,machineTasks,pickMachine,repoHosts,repoWanted,requireMachine,routeTarget}from"./chunk-ta1p2nwa.js";import"./chunk-vytrhm50.js";import"./chunk-vp29jgbt.js";import"./chunk-gq36nzg8.js";import"./chunk-sq6zj3fb.js";import"./chunk-tw9tfs1d.js";import"./chunk-61cn88e7.js";import"./chunk-atg13xab.js";import"./chunk-r5j8fycq.js";import"./chunk-xfgqae9t.js";import"./chunk-j1z9kgyd.js";import"./chunk-g9ba25q5.js";import"./chunk-ggnq2vvk.js";import"./chunk-hpay0ax8.js";import"./chunk-catrr0z3.js";import"./chunk-mdc7b01e.js";import"./chunk-tn9gtf18.js";import"./chunk-895yqjjz.js";import"./chunk-sak1tphp.js";import"./chunk-y1xnjx8x.js";import"./chunk-e58kj4gm.js";import"./chunk-0a65j1zj.js";import"./chunk-bcyex84w.js";import"./chunk-vvqwgcge.js";import"./chunk-x83xbzjd.js";import"./chunk-2tfnscxk.js";import"./chunk-hzz020xx.js";import"./chunk-w7zv47mp.js";import"./chunk-rfp0ayra.js";import"./chunk-40dgv828.js";import"./chunk-zsfyj36g.js";import"./chunk-2r1fgng9.js";import"./chunk-2brn8e1y.js";import"./chunk-7mwvvj46.js";import"./chunk-32j6y5d1.js";import"./chunk-mjyhy152.js";import"./chunk-wzss4pzh.js";import"./chunk-cmp64q4j.js";import"./chunk-qzzmd63x.js";import"./chunk-96kvwzj8.js";import"./chunk-7bakcyes.js";import"./chunk-8qkyd589.js";import"./chunk-7kysxgbq.js";import"./chunk-hz1x3hak.js";import"./chunk-x1jxxmtc.js";import"./chunk-xy8be792.js";import"./chunk-h2m7em1e.js";import"./chunk-7ghwdjdc.js";import"./chunk-8t7qbr1e.js";import"./chunk-bejhca6z.js";import"./chunk-br8r72bf.js";import"./chunk-yt15y085.js";import"./chunk-z1nj22va.js";import"./chunk-zt7wfnva.js";import"./chunk-0g4wc808.js";import"./chunk-pn5ygqn6.js";import"./chunk-eqdbfgq5.js";import"./chunk-f8gg8cqh.js";import"./chunk-nc46gddg.js";import"./chunk-pxk2c2vj.js";import"./chunk-91sykzqq.js";export{routeTarget,requireMachine,repoWanted,repoHosts,pickMachine,machineTasks,machinePtySocket,machineDaemonSocket,invokeRouted,forwardVerb,LOCAL_MACHINE,AUTO_MACHINE};