@sma1lboy/rove 0.9.282 → 0.9.283-next.113

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 (162) hide show
  1. package/dist/cli/{chunk-zjsfr4y7.js → chunk-0ar91r6h.js} +1 -1
  2. package/dist/cli/{chunk-3m6m1994.js → chunk-0heg44e1.js} +1 -1
  3. package/dist/cli/{chunk-n0rdn2fn.js → chunk-0sy3bez6.js} +2 -2
  4. package/dist/cli/{chunk-bagwgxsg.js → chunk-131bpjms.js} +1 -1
  5. package/dist/cli/{chunk-qcjkactr.js → chunk-1gxnd3qq.js} +1 -1
  6. package/dist/cli/chunk-1s60pwnj.js +150 -0
  7. package/dist/cli/{chunk-895yqjjz.js → chunk-22emnsn5.js} +1 -1
  8. package/dist/cli/{chunk-pm6j59da.js → chunk-2h4gfexr.js} +1 -1
  9. package/dist/cli/{chunk-zd61a32g.js → chunk-3h4nd6wg.js} +1 -1
  10. package/dist/cli/{chunk-ydaj339x.js → chunk-3ptv653h.js} +1 -1
  11. package/dist/cli/chunk-3qys4b0x.js +5 -0
  12. package/dist/cli/{chunk-0ws6j7zf.js → chunk-3vzn02mv.js} +1 -1
  13. package/dist/cli/{chunk-5rgrde6b.js → chunk-49nc2xf6.js} +3 -3
  14. package/dist/cli/{chunk-n2zgej1a.js → chunk-4gjj2ed9.js} +1 -1
  15. package/dist/cli/{chunk-h81h0arp.js → chunk-4hmaem7w.js} +3 -3
  16. package/dist/cli/{chunk-vcj2x6ne.js → chunk-4qenh5zx.js} +1 -1
  17. package/dist/cli/{chunk-8ccc9v77.js → chunk-4tmzqcnr.js} +1 -1
  18. package/dist/cli/{chunk-w7v71t7e.js → chunk-53pn0a9z.js} +1 -1
  19. package/dist/cli/{chunk-qx6d4bbb.js → chunk-5a844b1j.js} +1 -1
  20. package/dist/cli/{chunk-1k6expt9.js → chunk-5e9z8rvw.js} +4 -4
  21. package/dist/cli/{chunk-jp354m6j.js → chunk-5fryq2w1.js} +1 -1
  22. package/dist/cli/{chunk-fq2pefc5.js → chunk-5jbfscxy.js} +1 -1
  23. package/dist/cli/{chunk-e58kj4gm.js → chunk-5mhf43dx.js} +1 -1
  24. package/dist/cli/{chunk-z204mctb.js → chunk-5rqeysgc.js} +13 -13
  25. package/dist/cli/chunk-5xwfbmm2.js +63 -0
  26. package/dist/cli/chunk-5yqz2ry1.js +2 -0
  27. package/dist/cli/chunk-62z7016x.js +3 -0
  28. package/dist/cli/chunk-6622v0gx.js +2 -0
  29. package/dist/cli/{chunk-7kgcy89w.js → chunk-69f84j0j.js} +2 -2
  30. package/dist/cli/chunk-69kd26wk.js +3 -0
  31. package/dist/cli/chunk-6fsmceq4.js +2 -0
  32. package/dist/cli/{chunk-v8c4n8by.js → chunk-6gtkv1jx.js} +1 -1
  33. package/dist/cli/{chunk-ph9m6y5j.js → chunk-6pb0cs94.js} +1 -1
  34. package/dist/cli/{chunk-t2418v0z.js → chunk-6psm9tgn.js} +1 -1
  35. package/dist/cli/{chunk-s7tbwn04.js → chunk-70ymz61c.js} +1 -1
  36. package/dist/cli/{chunk-j19av093.js → chunk-76nyhhmm.js} +1 -1
  37. package/dist/cli/{chunk-pv3c4vgt.js → chunk-7n6pgw03.js} +2 -2
  38. package/dist/cli/{chunk-92hpkjkk.js → chunk-7pt7manp.js} +1 -1
  39. package/dist/cli/{chunk-x1ghdmp1.js → chunk-8ac8k0ba.js} +1 -1
  40. package/dist/cli/{chunk-pfagrkt6.js → chunk-8h94w236.js} +1 -1
  41. package/dist/cli/{chunk-9rj2fx6v.js → chunk-8ttn73cv.js} +1 -1
  42. package/dist/cli/{chunk-7zwehmay.js → chunk-8v0dw7z0.js} +1 -1
  43. package/dist/cli/{chunk-tcdz7sx9.js → chunk-8x888eam.js} +1 -1
  44. package/dist/cli/{chunk-qzzmd63x.js → chunk-8y10pmkf.js} +2 -2
  45. package/dist/cli/{chunk-5bnhecx3.js → chunk-9g07pd9v.js} +1 -1
  46. package/dist/cli/{chunk-95kk75wh.js → chunk-a9kfc9be.js} +1 -1
  47. package/dist/cli/{chunk-aqwckba5.js → chunk-abate6bw.js} +1 -1
  48. package/dist/cli/{chunk-ze4v7eda.js → chunk-an8y40tw.js} +1 -1
  49. package/dist/cli/chunk-an97ga8b.js +2 -0
  50. package/dist/cli/{chunk-hzz020xx.js → chunk-aqbvxza0.js} +1 -1
  51. package/dist/cli/{chunk-0a65j1zj.js → chunk-ar3mt81z.js} +1 -1
  52. package/dist/cli/{chunk-qecygh3f.js → chunk-av6z03kh.js} +1 -1
  53. package/dist/cli/{chunk-7r1wt7qp.js → chunk-awhsmbbe.js} +1 -1
  54. package/dist/cli/{chunk-nbf3attz.js → chunk-b5j84ad5.js} +1 -1
  55. package/dist/cli/{chunk-agvtzads.js → chunk-cacct9gd.js} +1 -1
  56. package/dist/cli/{chunk-zypkjg5t.js → chunk-cmtck38h.js} +1 -1
  57. package/dist/cli/{chunk-rjq38twt.js → chunk-d1qs7c11.js} +1 -1
  58. package/dist/cli/{chunk-x94e0rw4.js → chunk-d9x7zeh7.js} +1 -1
  59. package/dist/cli/{chunk-4gjvmfa9.js → chunk-dhp93daz.js} +5 -5
  60. package/dist/cli/chunk-dxwmnww0.js +2 -0
  61. package/dist/cli/{chunk-eege1x0a.js → chunk-e4fp3w22.js} +1 -1
  62. package/dist/cli/{chunk-p2cbtrzg.js → chunk-e9x0skb5.js} +1 -1
  63. package/dist/cli/{chunk-55e3pt18.js → chunk-edzj2nk1.js} +1 -1
  64. package/dist/cli/{chunk-1vxtd8rh.js → chunk-ee8917py.js} +1 -1
  65. package/dist/cli/{chunk-0mr6cckm.js → chunk-f1feyrth.js} +1 -1
  66. package/dist/cli/chunk-fc88wegg.js +7 -0
  67. package/dist/cli/{chunk-tg4swhr1.js → chunk-ftgvtq0a.js} +1 -1
  68. package/dist/cli/{chunk-5z02j1em.js → chunk-fv1kc5p9.js} +1 -1
  69. package/dist/cli/{chunk-z43e08kw.js → chunk-gfdd2jbp.js} +1 -1
  70. package/dist/cli/{chunk-nb0be8dz.js → chunk-gydc8fxv.js} +1 -1
  71. package/dist/cli/chunk-gygdyf0s.js +3 -0
  72. package/dist/cli/{chunk-h8v2jzth.js → chunk-j2v4h0g4.js} +1 -1
  73. package/dist/cli/{chunk-3x5g06mw.js → chunk-jkssty8x.js} +1 -1
  74. package/dist/cli/{chunk-ae8dj2fd.js → chunk-k26g5gx4.js} +1 -1
  75. package/dist/cli/{chunk-w3f993d8.js → chunk-k3tvz7yp.js} +3 -3
  76. package/dist/cli/{chunk-xqvyzv62.js → chunk-k5arcpfm.js} +1 -1
  77. package/dist/cli/{chunk-b64w1jh6.js → chunk-kfdasgg2.js} +1 -1
  78. package/dist/cli/{chunk-4g463eqt.js → chunk-kqcea37h.js} +1 -1
  79. package/dist/cli/{chunk-8qkyd589.js → chunk-ks5g5ee2.js} +1 -1
  80. package/dist/cli/{chunk-4w4tpsqx.js → chunk-mkb5mmmw.js} +1 -1
  81. package/dist/cli/{chunk-nh4dd7q4.js → chunk-n0a285kr.js} +5 -5
  82. package/dist/cli/chunk-nbcm8d58.js +3 -0
  83. package/dist/cli/{chunk-dsdtq087.js → chunk-nf1gqqv8.js} +1 -1
  84. package/dist/cli/{chunk-teh40faw.js → chunk-np319fys.js} +1 -1
  85. package/dist/cli/{chunk-ggnq2vvk.js → chunk-paashxkd.js} +1 -1
  86. package/dist/cli/chunk-pc8n5tx8.js +3 -0
  87. package/dist/cli/chunk-ph2sykrt.js +2 -0
  88. package/dist/cli/{chunk-swcfg2vb.js → chunk-phjcd6vg.js} +5 -5
  89. package/dist/cli/{chunk-97er67dc.js → chunk-pm67d2v1.js} +1 -1
  90. package/dist/cli/{chunk-vytrhm50.js → chunk-pmwk2etg.js} +1 -1
  91. package/dist/cli/{chunk-0ramhr3v.js → chunk-ptn9q6ag.js} +1 -1
  92. package/dist/cli/{chunk-4yr1534j.js → chunk-q01mp2nn.js} +1 -1
  93. package/dist/cli/{chunk-rqm2kn0c.js → chunk-q853hm7k.js} +1 -1
  94. package/dist/cli/{chunk-rjfdzjhj.js → chunk-q89yrevw.js} +1 -1
  95. package/dist/cli/{chunk-h9cjzh9j.js → chunk-qfgwpg12.js} +1 -1
  96. package/dist/cli/{chunk-zr058kbe.js → chunk-qnv8ggxh.js} +1 -1
  97. package/dist/cli/{chunk-h0wp2ghf.js → chunk-qx56q5cx.js} +1 -1
  98. package/dist/cli/{chunk-dkx7s5rk.js → chunk-rahaw21v.js} +1 -1
  99. package/dist/cli/chunk-rmnm3f9n.js +3 -0
  100. package/dist/cli/{chunk-yeq2pc68.js → chunk-rrazqtbc.js} +1 -1
  101. package/dist/cli/{chunk-29kvfqeh.js → chunk-rsdykw6f.js} +1 -1
  102. package/dist/cli/{chunk-bcyex84w.js → chunk-s7ttzm9a.js} +1 -1
  103. package/dist/cli/{chunk-njncqdwf.js → chunk-s88gxrtj.js} +1 -1
  104. package/dist/cli/{chunk-6jj8perx.js → chunk-sdjcg0pn.js} +3 -3
  105. package/dist/cli/{chunk-g4p5znv1.js → chunk-sfrsqpvn.js} +1 -1
  106. package/dist/cli/{chunk-4d5xp2p0.js → chunk-swptzzer.js} +1 -1
  107. package/dist/cli/{chunk-6hcyvg0m.js → chunk-tay29xzx.js} +1 -1
  108. package/dist/cli/chunk-ttg73nds.js +2 -0
  109. package/dist/cli/{chunk-0gbg7bg8.js → chunk-v3ccm6ah.js} +1 -1
  110. package/dist/cli/{chunk-8kspedny.js → chunk-v89nwpyr.js} +1 -1
  111. package/dist/cli/{chunk-r7tbzgt7.js → chunk-v8kksfg2.js} +1 -1
  112. package/dist/cli/{chunk-7bakcyes.js → chunk-ve2jj5qv.js} +1 -1
  113. package/dist/cli/{chunk-s5eat30g.js → chunk-vnrhhsb3.js} +2 -2
  114. package/dist/cli/{chunk-6mg5zp8y.js → chunk-vpq6yrch.js} +1 -1
  115. package/dist/cli/{chunk-kdnk8m5j.js → chunk-wzp50cjm.js} +1 -1
  116. package/dist/cli/{chunk-q012n1t1.js → chunk-xck2mva9.js} +1 -1
  117. package/dist/cli/{chunk-16e6jqq6.js → chunk-xr117xs9.js} +1 -1
  118. package/dist/cli/{chunk-tjhw09bz.js → chunk-xs6w6ekc.js} +2 -2
  119. package/dist/cli/{chunk-za8pnw78.js → chunk-y1pkmjjk.js} +1 -1
  120. package/dist/cli/{chunk-ec3esgj4.js → chunk-y8tsm0xm.js} +1 -1
  121. package/dist/cli/{chunk-v5bn5fnd.js → chunk-yprk6ygg.js} +1 -1
  122. package/dist/cli/{chunk-k3h4cpdy.js → chunk-yz859e8t.js} +2 -2
  123. package/dist/cli/{chunk-aq4j8ar4.js → chunk-z16wb344.js} +1 -1
  124. package/dist/cli/{chunk-03a986ba.js → chunk-z26xjafb.js} +1 -1
  125. package/dist/cli/{chunk-jj5f4n51.js → chunk-z3hfz52n.js} +1 -1
  126. package/dist/cli/{chunk-qkdc5tc7.js → chunk-zbw533rm.js} +1 -1
  127. package/dist/cli/chunk-zcrggyg5.js +2 -0
  128. package/dist/cli/{chunk-9q8wwfs1.js → chunk-zv4bwqcf.js} +2 -2
  129. package/dist/cli/index.js +7 -7
  130. package/dist/cli/pty-host-node.mjs +22 -2
  131. package/dist/completions/rove.bash +2 -2
  132. package/dist/completions/rove.fish +2 -2
  133. package/dist/completions/rove.zsh +2 -2
  134. package/dist/skills/rove/SKILL.md +6 -1
  135. package/dist/skills/rove/references/api-flags.md +3 -1
  136. package/dist/web/assets/index-DBYveBG5.js +63 -0
  137. package/dist/web/assets/index-T3QTIGgm.css +1 -0
  138. package/dist/web/assets/term-mount-BrP-ENHg.css +1 -0
  139. package/dist/web/assets/term-mount-QjffqQUa.js +93 -0
  140. package/dist/web/index.html +2 -2
  141. package/dist/web/relay/index.html +4 -4
  142. package/package.json +1 -1
  143. package/dist/cli/chunk-084a4eq5.js +0 -3
  144. package/dist/cli/chunk-231mqmk5.js +0 -2
  145. package/dist/cli/chunk-3xz0dmnc.js +0 -142
  146. package/dist/cli/chunk-8ew9sqwa.js +0 -2
  147. package/dist/cli/chunk-b4egks20.js +0 -7
  148. package/dist/cli/chunk-hv79ys32.js +0 -2
  149. package/dist/cli/chunk-hz1x3hak.js +0 -3
  150. package/dist/cli/chunk-jxqhq9va.js +0 -3
  151. package/dist/cli/chunk-pg48v2kc.js +0 -2
  152. package/dist/cli/chunk-qqr4tfhk.js +0 -3
  153. package/dist/cli/chunk-rfp0ayra.js +0 -3
  154. package/dist/cli/chunk-sakkdjyn.js +0 -2
  155. package/dist/cli/chunk-swzdd5aj.js +0 -2
  156. package/dist/cli/chunk-tq0h3vy6.js +0 -3
  157. package/dist/cli/chunk-x35dfb1x.js +0 -63
  158. package/dist/cli/chunk-y8n6trr4.js +0 -2
  159. package/dist/cli/chunk-z8rvxvx5.js +0 -2
  160. package/dist/cli/chunk-zpxpwgds.js +0 -4
  161. package/dist/web/assets/index-Bo92_NP5.css +0 -1
  162. package/dist/web/assets/index-Bpal5sTS.js +0 -154
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{isShellKind,shippedCompletionsPath}from"./chunk-eege1x0a.js";import{loadStateFile,patchStateFile}from"./chunk-32j6y5d1.js";import{t}from"./chunk-4d5xp2p0.js";import{ROVE_PRODUCT_NAME}from"./chunk-zt7wfnva.js";import{appendFileSync,existsSync,mkdirSync,readFileSync,writeFileSync}from"fs";import{homedir}from"os";import{basename,join}from"path";var PENDING_COMPLETIONS_KEY="welcomePendingCompletions";function detectShell(env=process.env){let shell=basename(env.SHELL??"");return shell==="zsh"||shell==="bash"||shell==="fish"?shell:null}function completionHook(shell,cli,shipped){if(shipped===null)return legacyCompletionHook(shell,cli);return shell==="fish"?`test -f "${shipped}"; and source "${shipped}"`:`[ -f "${shipped}" ] && source "${shipped}"`}function legacyCompletionHook(shell,cli){return shell==="fish"?`${cli} completions fish | source`:`command -v ${cli} >/dev/null && source <(${cli} completions ${shell})`}function shippedScriptFor(shell,cli){let path=shippedCompletionsPath(shell,cli);return existsSync(path)?path:null}function installCompletions(shell,home=homedir(),cli=ROVE_PRODUCT_NAME,shipped=shippedScriptFor(shell,cli)){let hook=completionHook(shell,cli,shipped);if(shell==="fish"){let dir=join(home,".config","fish","completions"),path=join(dir,`${cli}.fish`);return mkdirSync(dir,{recursive:!0}),writeFileSync(path,`${hook}
2
+ import{isShellKind,shippedCompletionsPath}from"./chunk-e4fp3w22.js";import{loadStateFile,patchStateFile}from"./chunk-32j6y5d1.js";import{t}from"./chunk-swptzzer.js";import{ROVE_PRODUCT_NAME}from"./chunk-zt7wfnva.js";import{appendFileSync,existsSync,mkdirSync,readFileSync,writeFileSync}from"fs";import{homedir}from"os";import{basename,join}from"path";var PENDING_COMPLETIONS_KEY="welcomePendingCompletions";function detectShell(env=process.env){let shell=basename(env.SHELL??"");return shell==="zsh"||shell==="bash"||shell==="fish"?shell:null}function completionHook(shell,cli,shipped){if(shipped===null)return legacyCompletionHook(shell,cli);return shell==="fish"?`test -f "${shipped}"; and source "${shipped}"`:`[ -f "${shipped}" ] && source "${shipped}"`}function legacyCompletionHook(shell,cli){return shell==="fish"?`${cli} completions fish | source`:`command -v ${cli} >/dev/null && source <(${cli} completions ${shell})`}function shippedScriptFor(shell,cli){let path=shippedCompletionsPath(shell,cli);return existsSync(path)?path:null}function installCompletions(shell,home=homedir(),cli=ROVE_PRODUCT_NAME,shipped=shippedScriptFor(shell,cli)){let hook=completionHook(shell,cli,shipped);if(shell==="fish"){let dir=join(home,".config","fish","completions"),path=join(dir,`${cli}.fish`);return mkdirSync(dir,{recursive:!0}),writeFileSync(path,`${hook}
3
3
  `),{path,installed:!0}}let rc=join(home,shell==="zsh"?".zshrc":".bashrc"),existing=existsSync(rc)?readFileSync(rc,"utf8"):"";if(existing.includes(hook))return{path:rc,installed:!1};let legacy=legacyCompletionHook(shell,cli);if(existing.includes(legacy))return writeFileSync(rc,existing.replace(legacy,hook)),{path:rc,installed:!0};if(existing.includes(`${cli} completions`))return{path:rc,installed:!1};return appendFileSync(rc,`
4
4
  # ${cli} completions
5
5
  ${hook}
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{PreambleStripper}from"./chunk-sq6zj3fb.js";import{shQuote}from"./chunk-y1xnjx8x.js";import{loadStateFile,updateStateFile}from"./chunk-32j6y5d1.js";import{RoveDaemonClient}from"./chunk-qzzmd63x.js";import{homeDir}from"./chunk-z1nj22va.js";import{logClientError}from"./chunk-0g4wc808.js";import{shortHomeTag}from"./chunk-eqdbfgq5.js";import{PRE_RENAME_VERSION_KEY}from"./chunk-f8gg8cqh.js";import{spawn as spawn3}from"child_process";import{mkdirSync as mkdirSync3,rmSync as rmSync2}from"fs";import{connect as netConnect}from"net";import{tmpdir}from"os";import{join}from"path";var LOCAL_MACHINE_ID="local",ALIAS_RE=/^[A-Za-z0-9][A-Za-z0-9._-]*$/;function isValidMachineAlias(alias){return alias!==LOCAL_MACHINE_ID&&alias.length<=64&&ALIAS_RE.test(alias)}function parseSshTarget(target){let trimmed=target.trim();if(!trimmed)return null;let at=trimmed.lastIndexOf("@"),user=at>=0?trimmed.slice(0,at):void 0,rest=at>=0?trimmed.slice(at+1):trimmed;if(at>=0&&!user)return null;let bracketed=/^\[([^\]]+)\](?::(\d{1,5}))?$/.exec(rest),portMatch=bracketed?null:/^([^:]*):(\d{1,5})$/.exec(rest),host=bracketed?bracketed[1]??"":portMatch?portMatch[1]??"":rest,rawPort=bracketed?bracketed[2]:portMatch?.[2],port=rawPort?Number(rawPort):void 0;if(!host||/\s/.test(host))return null;if(port!==void 0&&(port<1||port>65535))return null;return{host,...user?{user}:{},...port?{port}:{}}}function defaultMachineAlias(args){let source=!args.typedUser&&args.port===void 0&&!isIpLiteral(args.typedHost)?args.typedHost:args.remoteHostname||args.typedHost;return sanitizeAlias(source)}function isIpLiteral(host){return host.includes(":")||/^\d{1,3}(\.\d{1,3}){3}$/.test(host)}function sanitizeAlias(raw){return(raw.split(".")[0]??raw).replace(/[^A-Za-z0-9._-]/g,"-").slice(0,64)}function sshTargetOf(config){return config.user?`${config.user}@${config.host}`:config.host}function readMachines(state){let raw=state.machines;if(!raw||typeof raw!=="object"||Array.isArray(raw))return{};return raw}function listMachines(){let machines=readMachines(loadStateFile());return Object.entries(machines).map(([alias,config])=>({alias,...config}))}function getMachine(alias){return readMachines(loadStateFile())[alias]??null}function addMachine(alias,config){let added=!1;return updateStateFile((state)=>{let machines={...readMachines(state)};added=machines[alias]===void 0,machines[alias]={...config,addedAt:config.addedAt??machines[alias]?.addedAt??new Date().toISOString()},state.machines=machines;return}),{added}}function updateMachine(alias,patch){updateStateFile((state)=>{let machines={...readMachines(state)},existing=machines[alias];if(!existing)return!1;machines[alias]={...existing,...patch},state.machines=machines;return})}function setMachineIdentity(alias,identity){updateMachine(alias,{identity})}function removeMachine(alias){let removed=!1;return updateStateFile((state)=>{let machines={...readMachines(state)};if(removed=machines[alias]!==void 0,!removed)return!1;delete machines[alias],state.machines=machines;return}),removed}function dedupeMachines(entries){let kept=[],seen=[];for(let entry of entries){let identity=entry.identity;if(identity){if(seen.some((other)=>sameMachine(other,identity)))continue;seen.push(identity)}kept.push(entry)}return kept}function sameMachine(a,b){return a.hostname===b.hostname&&a.homeDir===b.homeDir&&a.daemonPid===b.daemonPid}function duplicateAliasOf(machines,self,identity){for(let[alias,config]of Object.entries(machines)){if(alias===self)continue;let other=config.identity;if(!other)continue;if(other.hostname===identity.hostname&&other.homeDir===identity.homeDir&&other.daemonPid===identity.daemonPid)return alias}return null}var CONTROL_PERSIST_SECONDS=300;function machineSocketDir(alias,home=homeDir()){let natural=join(home,".rove","machines",alias);if(Buffer.byteLength(join(natural,"daemon.sock"),"utf8")<=SOCKET_PATH_LIMIT)return natural;return join(tmpdir(),`rove-m-${shortHomeTag(home)}-${shortHomeTag(alias)}`)}var SOCKET_PATH_LIMIT=100;function localDaemonSocketPath(alias,home=homeDir()){return join(machineSocketDir(alias,home),"daemon.sock")}function localPtySocketPath(alias,home=homeDir()){return join(machineSocketDir(alias,home),"pty.sock")}function controlPath(alias,home=homeDir()){return join(machineSocketDir(alias,home),"cm")}function machineSshArgs(alias,config,opts={}){let argv=["ssh"];if(opts.batch!==!1)argv.push("-o","BatchMode=yes");if(opts.mux!==!1&&process.platform!=="win32")argv.push("-o","ControlMaster=auto","-o",`ControlPath=${controlPath(alias,opts.home)}`,"-o",`ControlPersist=${CONTROL_PERSIST_SECONDS}`);if(argv.push("-o","StrictHostKeyChecking=accept-new"),config.port)argv.push("-p",String(config.port));if(config.auth.kind==="key"&&config.auth.keyPath)argv.push("-i",config.auth.keyPath);return argv.push(sshTargetOf(config)),argv}import{spawn as spawn2}from"child_process";import{mkdirSync as mkdirSync2,rmSync}from"fs";import{createServer}from"net";import{spawn}from"child_process";import{mkdirSync}from"fs";import{posix}from"path";function isWindowsPath(path){return/^[A-Za-z]:[\\/]/.test(path)||/^\\\\[.?]\\/.test(path)}function isWindowsMachine(config){if(config.sockets&&(isWindowsPath(config.sockets.daemon)||isWindowsPath(config.sockets.pty)))return!0;return config.roveBin!==void 0&&isWindowsPath(config.roveBin)}function psQuote(value){return`'${value.replaceAll("'","''")}'`}function powershellCommand(script){return`powershell -NoProfile -NonInteractive -ExecutionPolicy Bypass -EncodedCommand ${Buffer.from(script,"utf16le").toString("base64")}`}function windowsRoveCommand(roveBin,args){return powershellCommand(`& ${psQuote(roveBin)} ${args.map(psQuote).join(" ")}; exit $LASTEXITCODE`)}var WINDOWS_LOCATE_SCRIPT=['$dirs = @("$env:APPDATA\\npm", "$env:USERPROFILE\\.bun\\bin", "$env:LOCALAPPDATA\\pnpm", $env:NVM_SYMLINK)',"$dirs += [Environment]::GetEnvironmentVariable('Path', 'User') -split ';'","foreach ($d in $dirs) { if (-not $d) { continue }",` foreach ($n in 'rove.cmd', 'rove.exe') { $p = Join-Path $d $n; if (Test-Path -LiteralPath $p) { "ROVE_BIN=$p"; exit 0 } } }`,"exit 1"].join(`
2
+ import{PreambleStripper}from"./chunk-sq6zj3fb.js";import{shQuote}from"./chunk-y1xnjx8x.js";import{loadStateFile,updateStateFile}from"./chunk-32j6y5d1.js";import{RoveDaemonClient}from"./chunk-8y10pmkf.js";import{homeDir}from"./chunk-z1nj22va.js";import{logClientError}from"./chunk-0g4wc808.js";import{shortHomeTag}from"./chunk-eqdbfgq5.js";import{PRE_RENAME_VERSION_KEY}from"./chunk-f8gg8cqh.js";import{spawn as spawn3}from"child_process";import{mkdirSync as mkdirSync3,rmSync as rmSync2}from"fs";import{connect as netConnect}from"net";import{tmpdir}from"os";import{join}from"path";var LOCAL_MACHINE_ID="local",ALIAS_RE=/^[A-Za-z0-9][A-Za-z0-9._-]*$/;function isValidMachineAlias(alias){return alias!==LOCAL_MACHINE_ID&&alias.length<=64&&ALIAS_RE.test(alias)}function parseSshTarget(target){let trimmed=target.trim();if(!trimmed)return null;let at=trimmed.lastIndexOf("@"),user=at>=0?trimmed.slice(0,at):void 0,rest=at>=0?trimmed.slice(at+1):trimmed;if(at>=0&&!user)return null;let bracketed=/^\[([^\]]+)\](?::(\d{1,5}))?$/.exec(rest),portMatch=bracketed?null:/^([^:]*):(\d{1,5})$/.exec(rest),host=bracketed?bracketed[1]??"":portMatch?portMatch[1]??"":rest,rawPort=bracketed?bracketed[2]:portMatch?.[2],port=rawPort?Number(rawPort):void 0;if(!host||/\s/.test(host))return null;if(port!==void 0&&(port<1||port>65535))return null;return{host,...user?{user}:{},...port?{port}:{}}}function defaultMachineAlias(args){let source=!args.typedUser&&args.port===void 0&&!isIpLiteral(args.typedHost)?args.typedHost:args.remoteHostname||args.typedHost;return sanitizeAlias(source)}function isIpLiteral(host){return host.includes(":")||/^\d{1,3}(\.\d{1,3}){3}$/.test(host)}function sanitizeAlias(raw){return(raw.split(".")[0]??raw).replace(/[^A-Za-z0-9._-]/g,"-").slice(0,64)}function sshTargetOf(config){return config.user?`${config.user}@${config.host}`:config.host}function readMachines(state){let raw=state.machines;if(!raw||typeof raw!=="object"||Array.isArray(raw))return{};return raw}function listMachines(){let machines=readMachines(loadStateFile());return Object.entries(machines).map(([alias,config])=>({alias,...config}))}function getMachine(alias){return readMachines(loadStateFile())[alias]??null}function addMachine(alias,config){let added=!1;return updateStateFile((state)=>{let machines={...readMachines(state)};added=machines[alias]===void 0,machines[alias]={...config,addedAt:config.addedAt??machines[alias]?.addedAt??new Date().toISOString()},state.machines=machines;return}),{added}}function updateMachine(alias,patch){updateStateFile((state)=>{let machines={...readMachines(state)},existing=machines[alias];if(!existing)return!1;machines[alias]={...existing,...patch},state.machines=machines;return})}function setMachineIdentity(alias,identity){updateMachine(alias,{identity})}function removeMachine(alias){let removed=!1;return updateStateFile((state)=>{let machines={...readMachines(state)};if(removed=machines[alias]!==void 0,!removed)return!1;delete machines[alias],state.machines=machines;return}),removed}function dedupeMachines(entries){let kept=[],seen=[];for(let entry of entries){let identity=entry.identity;if(identity){if(seen.some((other)=>sameMachine(other,identity)))continue;seen.push(identity)}kept.push(entry)}return kept}function sameMachine(a,b){return a.hostname===b.hostname&&a.homeDir===b.homeDir&&a.daemonPid===b.daemonPid}function duplicateAliasOf(machines,self,identity){for(let[alias,config]of Object.entries(machines)){if(alias===self)continue;let other=config.identity;if(!other)continue;if(other.hostname===identity.hostname&&other.homeDir===identity.homeDir&&other.daemonPid===identity.daemonPid)return alias}return null}var CONTROL_PERSIST_SECONDS=300;function machineSocketDir(alias,home=homeDir()){let natural=join(home,".rove","machines",alias);if(Buffer.byteLength(join(natural,"daemon.sock"),"utf8")<=SOCKET_PATH_LIMIT)return natural;return join(tmpdir(),`rove-m-${shortHomeTag(home)}-${shortHomeTag(alias)}`)}var SOCKET_PATH_LIMIT=100;function localDaemonSocketPath(alias,home=homeDir()){return join(machineSocketDir(alias,home),"daemon.sock")}function localPtySocketPath(alias,home=homeDir()){return join(machineSocketDir(alias,home),"pty.sock")}function controlPath(alias,home=homeDir()){return join(machineSocketDir(alias,home),"cm")}function machineSshArgs(alias,config,opts={}){let argv=["ssh"];if(opts.batch!==!1)argv.push("-o","BatchMode=yes");if(opts.mux!==!1&&process.platform!=="win32")argv.push("-o","ControlMaster=auto","-o",`ControlPath=${controlPath(alias,opts.home)}`,"-o",`ControlPersist=${CONTROL_PERSIST_SECONDS}`);if(argv.push("-o","StrictHostKeyChecking=accept-new"),config.port)argv.push("-p",String(config.port));if(config.auth.kind==="key"&&config.auth.keyPath)argv.push("-i",config.auth.keyPath);return argv.push(sshTargetOf(config)),argv}import{spawn as spawn2}from"child_process";import{mkdirSync as mkdirSync2,rmSync}from"fs";import{createServer}from"net";import{spawn}from"child_process";import{mkdirSync}from"fs";import{posix}from"path";function isWindowsPath(path){return/^[A-Za-z]:[\\/]/.test(path)||/^\\\\[.?]\\/.test(path)}function isWindowsMachine(config){if(config.sockets&&(isWindowsPath(config.sockets.daemon)||isWindowsPath(config.sockets.pty)))return!0;return config.roveBin!==void 0&&isWindowsPath(config.roveBin)}function psQuote(value){return`'${value.replaceAll("'","''")}'`}function powershellCommand(script){return`powershell -NoProfile -NonInteractive -ExecutionPolicy Bypass -EncodedCommand ${Buffer.from(script,"utf16le").toString("base64")}`}function windowsRoveCommand(roveBin,args){return powershellCommand(`& ${psQuote(roveBin)} ${args.map(psQuote).join(" ")}; exit $LASTEXITCODE`)}var WINDOWS_LOCATE_SCRIPT=['$dirs = @("$env:APPDATA\\npm", "$env:USERPROFILE\\.bun\\bin", "$env:LOCALAPPDATA\\pnpm", $env:NVM_SYMLINK)',"$dirs += [Environment]::GetEnvironmentVariable('Path', 'User') -split ';'","foreach ($d in $dirs) { if (-not $d) { continue }",` foreach ($n in 'rove.cmd', 'rove.exe') { $p = Join-Path $d $n; if (Test-Path -LiteralPath $p) { "ROVE_BIN=$p"; exit 0 } } }`,"exit 1"].join(`
3
3
  `),WINDOWS_LOCATE_ROVE=powershellCommand(WINDOWS_LOCATE_SCRIPT),WINDOWS_ROVE_MISSING=/'(?:[^'\r\n]*[\\/])?rove(?:\.cmd|\.exe|\.ps1)?' is not recognized as (?:an internal or external command|(?:the|a) name of a cmdlet)/i,WINDOWS_SCRIPTS_DISABLED=/rove\.ps1 cannot be loaded because running scripts is disabled/i;function windowsNoRoveMessage(alias,output){if(WINDOWS_SCRIPTS_DISABLED.test(output))return[`${alias}'s ssh sessions run Windows PowerShell, whose execution policy refuses npm's rove.ps1, and no rove.cmd was found to use instead.`,`On ${alias}, either allow scripts for your user: Set-ExecutionPolicy -Scope CurrentUser RemoteSigned`,'or make ssh use PowerShell 7 (elevated): New-ItemProperty -Path HKLM:\\SOFTWARE\\OpenSSH -Name DefaultShell -Value "$env:ProgramFiles\\PowerShell\\7\\pwsh.exe" -PropertyType String -Force'].join(`
4
4
  `);return[`Rove is not on the PATH of ssh sessions on ${alias} (Windows), nor in %APPDATA%\\npm, ~\\.bun\\bin or the user PATH.`,"Install it there in a PowerShell: npm install -g @sma1lboy/rove",`If it is installed elsewhere, add that folder to your user PATH on ${alias}, then restart sshd (elevated: Restart-Service sshd) so new sessions see it.`].join(`
5
5
  `)}var WINDOWS_SSHD_BANNER=/remote software version OpenSSH_for_Windows/i,WINDOWS_SSHD_STEPS=["Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0","Set-Service sshd -StartupType Automatic; Start-Service sshd","if (-not (Get-NetFirewallRule -Name OpenSSH-Server-In-TCP -ErrorAction SilentlyContinue)) { New-NetFirewallRule -Name OpenSSH-Server-In-TCP -DisplayName 'OpenSSH Server (sshd)' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22 }"];function windowsAuthorizeKeySteps(publicKey){let key=psQuote(publicKey.trim());return["# Administrator account (elevated PowerShell):",`Add-Content -Path "$env:ProgramData\\ssh\\administrators_authorized_keys" -Value ${key}`,'icacls.exe "$env:ProgramData\\ssh\\administrators_authorized_keys" /inheritance:r /grant "*S-1-5-32-544:F" /grant "SYSTEM:F"',"# Standard account (normal PowerShell):",`New-Item -ItemType Directory -Force "$HOME\\.ssh" | Out-Null; Add-Content -Path "$HOME\\.ssh\\authorized_keys" -Value ${key}`]}var PATTERNS=[["host-key-changed",/REMOTE HOST IDENTIFICATION HAS CHANGED|Host key for .* has changed/i],["host-key-unverified",/Host key verification failed|No .*host key is known for/i],["auth-denied",/Permission denied \(|Too many authentication failures|no matching host key type/i],["unresolved",/Could not resolve hostname|Name or service not known|nodename nor servname/i],["refused",/Connection refused/i],["timeout",/timed out|Operation timed out|No route to host|Network is unreachable/i]];function classifySshFailure(stderr){for(let[kind,pattern]of PATTERNS)if(pattern.test(stderr))return kind;return"unknown"}function sshFailureRemedy(kind,target,windows=!1){if(windows&&(kind==="refused"||kind==="timeout"))return[`${target} (Windows) ${kind==="refused"?"refused the connection: its OpenSSH Server is not running":"did not answer on the ssh port: its OpenSSH Server is off, or the firewall drops it"}.`,"In an elevated PowerShell there:",...WINDOWS_SSHD_STEPS.map((step)=>` ${step}`)].join(`
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{machineTasks}from"./chunk-qkdc5tc7.js";import{dedupeMachines,listMachines}from"./chunk-vytrhm50.js";import"./chunk-vp29jgbt.js";import"./chunk-gq36nzg8.js";import"./chunk-sq6zj3fb.js";import"./chunk-za8pnw78.js";import"./chunk-qecygh3f.js";import"./chunk-rjq38twt.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-5rgrde6b.js";import"./chunk-4gjvmfa9.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-4d5xp2p0.js";import"./chunk-b4egks20.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};
2
+ import{machineTasks}from"./chunk-zbw533rm.js";import{dedupeMachines,listMachines}from"./chunk-pmwk2etg.js";import"./chunk-vp29jgbt.js";import"./chunk-gq36nzg8.js";import"./chunk-sq6zj3fb.js";import"./chunk-y1pkmjjk.js";import"./chunk-av6z03kh.js";import"./chunk-d1qs7c11.js";import"./chunk-r5j8fycq.js";import"./chunk-xfgqae9t.js";import"./chunk-j1z9kgyd.js";import"./chunk-g9ba25q5.js";import"./chunk-paashxkd.js";import"./chunk-hpay0ax8.js";import"./chunk-catrr0z3.js";import"./chunk-mdc7b01e.js";import"./chunk-tn9gtf18.js";import"./chunk-22emnsn5.js";import"./chunk-sak1tphp.js";import"./chunk-y1xnjx8x.js";import"./chunk-5mhf43dx.js";import"./chunk-ar3mt81z.js";import"./chunk-s7ttzm9a.js";import"./chunk-49nc2xf6.js";import"./chunk-dhp93daz.js";import"./chunk-2tfnscxk.js";import"./chunk-aqbvxza0.js";import"./chunk-w7zv47mp.js";import"./chunk-gygdyf0s.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-swptzzer.js";import"./chunk-fc88wegg.js";import"./chunk-cmp64q4j.js";import"./chunk-8y10pmkf.js";import"./chunk-96kvwzj8.js";import"./chunk-ve2jj5qv.js";import"./chunk-ks5g5ee2.js";import"./chunk-7kysxgbq.js";import"./chunk-62z7016x.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,5 +1,5 @@
1
1
  // @bun
2
- import{installSkillErrors,missingSkillNames}from"./chunk-0gbg7bg8.js";import{installedEngineIds}from"./chunk-hzz020xx.js";import{createStateCell}from"./chunk-cmp64q4j.js";var skillMissing=createStateCell([]),POLL_MS=30000,started=!1;function refreshSkillStatus(){if(!started)return;installedEngineIds().then((installed)=>{let next=missingSkillNames(installed);if(next.join(`
2
+ import{installSkillErrors,missingSkillNames}from"./chunk-v3ccm6ah.js";import{installedEngineIds}from"./chunk-aqbvxza0.js";import{createStateCell}from"./chunk-cmp64q4j.js";var skillMissing=createStateCell([]),POLL_MS=30000,started=!1;function refreshSkillStatus(){if(!started)return;installedEngineIds().then((installed)=>{let next=missingSkillNames(installed);if(next.join(`
3
3
  `)!==skillMissing.get().join(`
4
4
  `))skillMissing.set(next)}).catch(()=>{})}function startSkillStatus(){if(started)return;started=!0,refreshSkillStatus(),setInterval(refreshSkillStatus,POLL_MS).unref?.()}function installSkillNow(){let error=installSkillErrors();return refreshSkillStatus(),error}
5
5
  export{skillMissing,refreshSkillStatus,startSkillStatus,installSkillNow};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{installSkillNow,refreshSkillStatus,skillMissing,startSkillStatus}from"./chunk-4yr1534j.js";import"./chunk-0gbg7bg8.js";import"./chunk-4gjvmfa9.js";import"./chunk-2tfnscxk.js";import"./chunk-hzz020xx.js";import"./chunk-w7zv47mp.js";import"./chunk-rfp0ayra.js";import"./chunk-40dgv828.js";import"./chunk-2brn8e1y.js";import"./chunk-7mwvvj46.js";import"./chunk-32j6y5d1.js";import"./chunk-cmp64q4j.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-91sykzqq.js";export{startSkillStatus,skillMissing,refreshSkillStatus,installSkillNow};
2
+ import{installSkillNow,refreshSkillStatus,skillMissing,startSkillStatus}from"./chunk-q01mp2nn.js";import"./chunk-v3ccm6ah.js";import"./chunk-dhp93daz.js";import"./chunk-2tfnscxk.js";import"./chunk-aqbvxza0.js";import"./chunk-w7zv47mp.js";import"./chunk-gygdyf0s.js";import"./chunk-40dgv828.js";import"./chunk-2brn8e1y.js";import"./chunk-7mwvvj46.js";import"./chunk-32j6y5d1.js";import"./chunk-cmp64q4j.js";import"./chunk-ve2jj5qv.js";import"./chunk-ks5g5ee2.js";import"./chunk-7kysxgbq.js";import"./chunk-62z7016x.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-91sykzqq.js";export{startSkillStatus,skillMissing,refreshSkillStatus,installSkillNow};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{buildPluginEnv}from"./chunk-qgrg9a5n.js";import{currentPluginPlatform,loadPluginRegistry,readPluginManifest,supportsPlatform}from"./chunk-n0rdn2fn.js";import{resolveSessionShell}from"./chunk-tn9gtf18.js";function shq(s){return`'${s.replace(/'/g,"'\\''")}'`}function buildPaneArgv(pluginId,pluginRoot,pane,opts){let env=buildPluginEnv({homeDir:opts.homeDir,socketPath:opts.socketPath,binPath:opts.binPath,pluginId,pluginRoot,extra:{ROVE_PLUGIN_ENTRYPOINT_ID:pane.id,...opts.taskId?{ROVE_PLUGIN_TASK_ID:opts.taskId}:{}}}),pairs=Object.entries(env).filter(([k])=>k.startsWith("ROVE_")||k.startsWith("ROVE_")),command=pane.command.map((a)=>a.replace(/\$\{?(?:ROVE|ROVE)_PLUGIN_ROOT\}?/g,pluginRoot)),script=`exec env ${pairs.map(([k,v])=>shq(`${k}=${v}`)).join(" ")} ${command.map(shq).join(" ")}`;return[resolveSessionShell(),"-ilc",script]}function listPaneLaunches(opts){let platform=currentPluginPlatform(),out=[];for(let entry of loadPluginRegistry(opts.homeDir).plugins){if(!entry.enabled)continue;try{let{manifest}=readPluginManifest(entry.root);if(!supportsPlatform({},manifest,platform))continue;for(let pane of manifest.panes){if(!supportsPlatform(pane,manifest,platform))continue;out.push({pluginId:entry.id,paneId:pane.id,title:pane.title,placement:pane.placement,argv:buildPaneArgv(entry.id,entry.root,pane,opts)})}}catch{}}return out}
2
+ import{buildPluginEnv}from"./chunk-qgrg9a5n.js";import{currentPluginPlatform,loadPluginRegistry,readPluginManifest,supportsPlatform}from"./chunk-0sy3bez6.js";import{resolveSessionShell}from"./chunk-tn9gtf18.js";function shq(s){return`'${s.replace(/'/g,"'\\''")}'`}function buildPaneArgv(pluginId,pluginRoot,pane,opts){let env=buildPluginEnv({homeDir:opts.homeDir,socketPath:opts.socketPath,binPath:opts.binPath,pluginId,pluginRoot,extra:{ROVE_PLUGIN_ENTRYPOINT_ID:pane.id,...opts.taskId?{ROVE_PLUGIN_TASK_ID:opts.taskId}:{}}}),pairs=Object.entries(env).filter(([k])=>k.startsWith("ROVE_")||k.startsWith("ROVE_")),command=pane.command.map((a)=>a.replace(/\$\{?(?:ROVE|ROVE)_PLUGIN_ROOT\}?/g,pluginRoot)),script=`exec env ${pairs.map(([k,v])=>shq(`${k}=${v}`)).join(" ")} ${command.map(shq).join(" ")}`;return[resolveSessionShell(),"-ilc",script]}function listPaneLaunches(opts){let platform=currentPluginPlatform(),out=[];for(let entry of loadPluginRegistry(opts.homeDir).plugins){if(!entry.enabled)continue;try{let{manifest}=readPluginManifest(entry.root);if(!supportsPlatform({},manifest,platform))continue;for(let pane of manifest.panes){if(!supportsPlatform(pane,manifest,platform))continue;out.push({pluginId:entry.id,paneId:pane.id,title:pane.title,placement:pane.placement,argv:buildPaneArgv(entry.id,entry.root,pane,opts)})}}catch{}}return out}
3
3
  export{buildPaneArgv,listPaneLaunches};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{isPathLikeArg,runOpenDirectory}from"./chunk-9q8wwfs1.js";import"./chunk-2r1fgng9.js";import"./chunk-z1nj22va.js";import"./chunk-zt7wfnva.js";import"./chunk-pn5ygqn6.js";import"./chunk-f8gg8cqh.js";import"./chunk-nc46gddg.js";import"./chunk-91sykzqq.js";export{runOpenDirectory,isPathLikeArg};
2
+ import{isPathLikeArg,runOpenDirectory}from"./chunk-zv4bwqcf.js";import"./chunk-2r1fgng9.js";import"./chunk-z1nj22va.js";import"./chunk-zt7wfnva.js";import"./chunk-pn5ygqn6.js";import"./chunk-f8gg8cqh.js";import"./chunk-nc46gddg.js";import"./chunk-91sykzqq.js";export{runOpenDirectory,isPathLikeArg};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{canonicalize}from"./chunk-1vxtd8rh.js";import{applyJitter,exponentialBackoff}from"./chunk-2tfnscxk.js";import{getRemoteRepoConfig,isRemoteRepoKey,resolveRepoRoot}from"./chunk-rfp0ayra.js";var canonPath=canonicalize;function randomDirTaskSuffix(){return Math.random().toString(36).slice(2,6).padEnd(4,"0")}function titleFromRepo(repo){let segs=repo.split(/[/\\]/).filter(Boolean);return segs.length>0?segs[segs.length-1]??repo:repo}function normalizeMainRepo(repo){let normalized=resolveRepoRoot(repo);return{repo:normalized,key:isRemoteRepoKey(normalized)?normalized:canonPath(normalized)}}function repoWorkingDir(repo){return getRemoteRepoConfig(repo)?.basePath??repo}var GH_PR_VIEW_FIELDS="number,url,title,state,baseRefName,headRefOid,reviewDecision,mergeable,statusCheckRollup,additions,deletions";function lifecycleFromState(state,reviewDecision){switch((state??"").toUpperCase()){case"MERGED":return"merged";case"CLOSED":return"closed";case"OPEN":return(reviewDecision??"").toUpperCase()==="APPROVED"?"ready_to_merge":"open";default:return"unknown"}}function entryCheckState(entry){let status=(entry.status??"").toUpperCase(),conclusion=(entry.conclusion??"").toUpperCase(),contextState=(entry.state??"").toUpperCase();if(status&&status!=="COMPLETED")return"pending";if(conclusion){if(conclusion==="SUCCESS"||conclusion==="NEUTRAL"||conclusion==="SKIPPED")return"passing";if(conclusion==="CANCELLED")return"cancelled";return"failing"}if(contextState==="SUCCESS")return"passing";if(contextState==="PENDING"||contextState==="EXPECTED")return"pending";if(contextState==="FAILURE"||contextState==="ERROR")return"failing";return"unknown"}function checkStateFromRollup(rollup){if(!rollup||rollup.length===0)return"none";let sawPending=!1,sawUnknown=!1,sawVerdict=!1;for(let entry of rollup){let s=entryCheckState(entry);if(s==="failing")return"failing";if(s==="cancelled")continue;if(sawVerdict=!0,s==="pending")sawPending=!0;else if(s==="unknown")sawUnknown=!0}if(sawPending)return"pending";if(sawUnknown)return"unknown";return sawVerdict?"passing":"none"}function mapGhPrView(view,at){if(!view||typeof view.number!=="number")return null;return{provider:"github",lifecycle:lifecycleFromState(view.state,view.reviewDecision),checkState:checkStateFromRollup(view.statusCheckRollup),number:view.number,url:view.url,title:view.title,...typeof view.additions==="number"?{additions:view.additions}:{},...typeof view.deletions==="number"?{deletions:view.deletions}:{},baseRef:view.baseRefName,reviewDecision:view.reviewDecision||void 0,mergeable:view.mergeable||void 0,...view.headRefOid?{headSha:view.headRefOid}:{},lastCheckedAt:at}}function samePrStatus(a,b){if(a===b)return!0;if(!a||!b)return!1;return a.provider===b.provider&&a.lifecycle===b.lifecycle&&a.checkState===b.checkState&&a.number===b.number&&a.url===b.url&&a.title===b.title&&a.additions===b.additions&&a.deletions===b.deletions&&a.baseRef===b.baseRef&&a.reviewDecision===b.reviewDecision&&a.mergeable===b.mergeable&&a.headSha===b.headSha}var NO_REMOTE_PATTERNS=["none of the git remotes","no git remote","to use github cli in a github repository","not a github repository"],AUTH_PATTERNS=["gh auth login","authentication required","not logged in","http 401","bad credentials","requires authentication"],NETWORK_PATTERNS=["could not resolve host","no such host","dial tcp","connection refused","connection reset","network is unreachable","i/o timeout","timeout","tls handshake","http 5","rate limit","try again"];function matchesAny(haystack,needles){return needles.some((n)=>haystack.includes(n))}function classifyGhFailure(s){if(s.parseError)return{kind:"error",error:"parse"};if(s.timedOut)return{kind:"error",error:"timeout"};if(s.spawnError)return{kind:"error",error:"missing-binary"};let err=(s.stderr??"").toLowerCase();if(matchesAny(err,NO_REMOTE_PATTERNS))return{kind:"error",error:"no-remote"};if(matchesAny(err,AUTH_PATTERNS))return{kind:"error",error:"auth"};if(matchesAny(err,NETWORK_PATTERNS))return{kind:"error",error:"network"};return{kind:"error",error:"unknown"}}function nextPrPoll(outcome,prevFailures,now,cfg,rand=Math.random){let at=(delay)=>now+applyJitter(delay,cfg.jitterRatio,rand);if(outcome.kind==="pr")return{nextAllowedAt:at(outcome.settled?cfg.settledMs:cfg.tickMs),failures:0};if(outcome.kind==="empty")return{nextAllowedAt:at(cfg.noPrMs),failures:0};if(outcome.error==="no-remote")return{nextAllowedAt:at(cfg.noRemoteMs),failures:0};let failures=prevFailures+1;return{nextAllowedAt:at(exponentialBackoff(cfg.failureBaseMs,failures-1,cfg.failureCapMs)),failures}}function checkResolutionNotify(prev,next){if(prev!=="pending")return null;if(next==="passing"||next==="failing")return next;return null}
2
+ import{canonicalize}from"./chunk-ee8917py.js";import{applyJitter,exponentialBackoff}from"./chunk-2tfnscxk.js";import{getRemoteRepoConfig,isRemoteRepoKey,resolveRepoRoot}from"./chunk-gygdyf0s.js";var canonPath=canonicalize;function randomDirTaskSuffix(){return Math.random().toString(36).slice(2,6).padEnd(4,"0")}function titleFromRepo(repo){let segs=repo.split(/[/\\]/).filter(Boolean);return segs.length>0?segs[segs.length-1]??repo:repo}function normalizeMainRepo(repo){let normalized=resolveRepoRoot(repo);return{repo:normalized,key:isRemoteRepoKey(normalized)?normalized:canonPath(normalized)}}function repoWorkingDir(repo){return getRemoteRepoConfig(repo)?.basePath??repo}var GH_PR_VIEW_FIELDS="number,url,title,state,baseRefName,headRefOid,reviewDecision,mergeable,statusCheckRollup,additions,deletions";function lifecycleFromState(state,reviewDecision){switch((state??"").toUpperCase()){case"MERGED":return"merged";case"CLOSED":return"closed";case"OPEN":return(reviewDecision??"").toUpperCase()==="APPROVED"?"ready_to_merge":"open";default:return"unknown"}}function entryCheckState(entry){let status=(entry.status??"").toUpperCase(),conclusion=(entry.conclusion??"").toUpperCase(),contextState=(entry.state??"").toUpperCase();if(status&&status!=="COMPLETED")return"pending";if(conclusion){if(conclusion==="SUCCESS"||conclusion==="NEUTRAL"||conclusion==="SKIPPED")return"passing";if(conclusion==="CANCELLED")return"cancelled";return"failing"}if(contextState==="SUCCESS")return"passing";if(contextState==="PENDING"||contextState==="EXPECTED")return"pending";if(contextState==="FAILURE"||contextState==="ERROR")return"failing";return"unknown"}function checkStateFromRollup(rollup){if(!rollup||rollup.length===0)return"none";let sawPending=!1,sawUnknown=!1,sawVerdict=!1;for(let entry of rollup){let s=entryCheckState(entry);if(s==="failing")return"failing";if(s==="cancelled")continue;if(sawVerdict=!0,s==="pending")sawPending=!0;else if(s==="unknown")sawUnknown=!0}if(sawPending)return"pending";if(sawUnknown)return"unknown";return sawVerdict?"passing":"none"}function mapGhPrView(view,at){if(!view||typeof view.number!=="number")return null;return{provider:"github",lifecycle:lifecycleFromState(view.state,view.reviewDecision),checkState:checkStateFromRollup(view.statusCheckRollup),number:view.number,url:view.url,title:view.title,...typeof view.additions==="number"?{additions:view.additions}:{},...typeof view.deletions==="number"?{deletions:view.deletions}:{},baseRef:view.baseRefName,reviewDecision:view.reviewDecision||void 0,mergeable:view.mergeable||void 0,...view.headRefOid?{headSha:view.headRefOid}:{},lastCheckedAt:at}}function samePrStatus(a,b){if(a===b)return!0;if(!a||!b)return!1;return a.provider===b.provider&&a.lifecycle===b.lifecycle&&a.checkState===b.checkState&&a.number===b.number&&a.url===b.url&&a.title===b.title&&a.additions===b.additions&&a.deletions===b.deletions&&a.baseRef===b.baseRef&&a.reviewDecision===b.reviewDecision&&a.mergeable===b.mergeable&&a.headSha===b.headSha}var NO_REMOTE_PATTERNS=["none of the git remotes","no git remote","to use github cli in a github repository","not a github repository"],AUTH_PATTERNS=["gh auth login","authentication required","not logged in","http 401","bad credentials","requires authentication"],NETWORK_PATTERNS=["could not resolve host","no such host","dial tcp","connection refused","connection reset","network is unreachable","i/o timeout","timeout","tls handshake","http 5","rate limit","try again"];function matchesAny(haystack,needles){return needles.some((n)=>haystack.includes(n))}function classifyGhFailure(s){if(s.parseError)return{kind:"error",error:"parse"};if(s.timedOut)return{kind:"error",error:"timeout"};if(s.cwdMissing)return{kind:"error",error:"worktree-missing"};if(s.spawnError)return{kind:"error",error:"missing-binary"};let err=(s.stderr??"").toLowerCase();if(matchesAny(err,NO_REMOTE_PATTERNS))return{kind:"error",error:"no-remote"};if(matchesAny(err,AUTH_PATTERNS))return{kind:"error",error:"auth"};if(matchesAny(err,NETWORK_PATTERNS))return{kind:"error",error:"network"};return{kind:"error",error:"unknown"}}function nextPrPoll(outcome,prevFailures,now,cfg,rand=Math.random){let at=(delay)=>now+applyJitter(delay,cfg.jitterRatio,rand);if(outcome.kind==="pr")return{nextAllowedAt:at(outcome.settled?cfg.settledMs:cfg.tickMs),failures:0};if(outcome.kind==="empty")return{nextAllowedAt:at(cfg.noPrMs),failures:0};if(outcome.error==="no-remote"||outcome.error==="worktree-missing")return{nextAllowedAt:at(cfg.noRemoteMs),failures:0};let failures=prevFailures+1;return{nextAllowedAt:at(exponentialBackoff(cfg.failureBaseMs,failures-1,cfg.failureCapMs)),failures}}function checkResolutionNotify(prev,next){if(prev!=="pending")return null;if(next==="passing"||next==="failing")return next;return null}
3
3
  export{GH_PR_VIEW_FIELDS,mapGhPrView,samePrStatus,classifyGhFailure,nextPrPoll,checkResolutionNotify,canonPath,randomDirTaskSuffix,titleFromRepo,normalizeMainRepo,repoWorkingDir};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{detectShell,installCompletions,recordWelcomeChoices,runPendingWelcomeInstalls,settleWelcomeInstall}from"./chunk-97er67dc.js";import"./chunk-eege1x0a.js";import"./chunk-qqr4tfhk.js";import"./chunk-32j6y5d1.js";import"./chunk-4d5xp2p0.js";import"./chunk-b4egks20.js";import"./chunk-cmp64q4j.js";import"./chunk-bejhca6z.js";import"./chunk-br8r72bf.js";import"./chunk-yt15y085.js";import"./chunk-z1nj22va.js";import"./chunk-zt7wfnva.js";import"./chunk-eqdbfgq5.js";import"./chunk-f8gg8cqh.js";import"./chunk-nc46gddg.js";import"./chunk-91sykzqq.js";export{settleWelcomeInstall,runPendingWelcomeInstalls,recordWelcomeChoices,installCompletions,detectShell};
2
+ import{detectShell,installCompletions,recordWelcomeChoices,runPendingWelcomeInstalls,settleWelcomeInstall}from"./chunk-pm67d2v1.js";import"./chunk-e4fp3w22.js";import"./chunk-nbcm8d58.js";import"./chunk-32j6y5d1.js";import"./chunk-swptzzer.js";import"./chunk-fc88wegg.js";import"./chunk-cmp64q4j.js";import"./chunk-bejhca6z.js";import"./chunk-br8r72bf.js";import"./chunk-yt15y085.js";import"./chunk-z1nj22va.js";import"./chunk-zt7wfnva.js";import"./chunk-eqdbfgq5.js";import"./chunk-f8gg8cqh.js";import"./chunk-nc46gddg.js";import"./chunk-91sykzqq.js";export{settleWelcomeInstall,runPendingWelcomeInstalls,recordWelcomeChoices,installCompletions,detectShell};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{isEngineActivityKind}from"./chunk-17e2tgyg.js";import{loadPluginRegistry,readPluginManifest}from"./chunk-n0rdn2fn.js";import{connectIfRunning}from"./chunk-e58kj4gm.js";import{activityHookAdapters}from"./chunk-4gjvmfa9.js";import{getPersistedString,setPersistedString}from"./chunk-rfp0ayra.js";import{flagValue}from"./chunk-zsfyj36g.js";import{readRoveEnv}from"./chunk-nc46gddg.js";import{join,resolve}from"path";var STDIN_READ_TIMEOUT_MS=500;async function readTextWithTimeout(read,timeoutMs=STDIN_READ_TIMEOUT_MS){let raceTimer;try{return await Promise.race([read(),new Promise((resolve2)=>{raceTimer=setTimeout(()=>resolve2(""),timeoutMs)})])}finally{if(raceTimer!==void 0)clearTimeout(raceTimer)}}async function readStdinText(isComplete){let bun=globalThis.Bun;if(bun)return bun.stdin.text();if(process.stdin.isTTY)return"";let chunks=[];try{for await(let chunk of process.stdin)if(chunks.push(chunk),isComplete?.(Buffer.concat(chunks).toString("utf8")))break}finally{process.stdin.destroy()}return Buffer.concat(chunks).toString("utf8")}function isCompleteJson(text){try{return JSON.parse(text),!0}catch{return!1}}async function readStdinPayload(){try{let text=await readTextWithTimeout(()=>readStdinText(isCompleteJson));if(!text.trim())return{};let parsed=JSON.parse(text);return parsed&&typeof parsed==="object"&&!Array.isArray(parsed)?parsed:{}}catch{return{}}}async function runHookSubcommand(argv){let[verb,...rest]=argv;if(verb==="setup"){await runHookSetup(rest);return}if(verb==="cleanup"){await runHookCleanup();return}try{if(!verb||!isEngineActivityKind(verb))return;let payload=await readStdinPayload(),payloadFlag=flagValue(rest,"--payload");if(payloadFlag)try{let extra=JSON.parse(payloadFlag);if(extra&&typeof extra==="object"&&!Array.isArray(extra))Object.assign(payload,extra)}catch{}let taskId=flagValue(rest,"--task-id"),envTaskId=process.env.ROVE_TASK_ID,envTabId=process.env.ROVE_TAB_ID,engine=flagValue(rest,"--engine"),adapters=activityHookAdapters().filter((a)=>!engine||a.vendor===engine);if(!taskId&&adapters.some((a)=>a.isUnattendedSession?.(process.env)===!0))return;let cwd=typeof payload.cwd==="string"&&payload.cwd?payload.cwd:void 0;for(let adapter of adapters){if(cwd)break;cwd=adapter.cwdFromPayload?.(payload)}cwd||=process.cwd();let detail;for(let adapter of adapters)if(detail=adapter.activityDetailFromPayload(verb,payload),detail)break;let session;for(let adapter of adapters)if(session=adapter.sessionFromPayload(payload),session)break;let client=await connectIfRunning();if(!client)return;try{let effectiveTaskId=taskId??envTaskId;await client.request("engine.reportEvent",{...effectiveTaskId?{taskId:effectiveTaskId}:{cwd},kind:verb,...engine?{engine}:{},...envTabId?{tabId:envTabId}:{},...detail?{detail}:{},...session?{sessionId:session.sessionId}:{},...session?.transcriptPath?{transcriptPath:session.transcriptPath}:{}})}finally{client.close()}}catch(err){if(readRoveEnv("HOOK_DEBUG"))console.error(`[rove hook] ${verb} failed:`,err instanceof Error?err.message:String(err))}}var SYNC_SETTING_KEY="externalWorktreeSync";function worktreeSyncAdapters(){return activityHookAdapters().filter((a)=>a.supportsWorktreeSync())}function globalSettingsPath(){return worktreeSyncAdapters()[0]?.globalSettingsPath()}function persistedSyncPath(stored){if(!stored||stored==="off")return;if(stored==="global")return globalSettingsPath();if(stored.startsWith("repo:"))return join(resolve(stored.slice(5)),".claude","settings.json");return stored}async function ensureGlobalRoveHooks(opts={}){try{let toolEvents=pluginsWantToolEvents();for(let a of activityHookAdapters()){let external=await a.externallyManagedHooks?.();if(external){if(external.notice)process.stderr.write(`
2
+ import{isEngineActivityKind}from"./chunk-17e2tgyg.js";import{loadPluginRegistry,readPluginManifest}from"./chunk-0sy3bez6.js";import{connectIfRunning}from"./chunk-5mhf43dx.js";import{activityHookAdapters}from"./chunk-dhp93daz.js";import{getPersistedString,setPersistedString}from"./chunk-gygdyf0s.js";import{flagValue}from"./chunk-zsfyj36g.js";import{readRoveEnv}from"./chunk-nc46gddg.js";import{join,resolve}from"path";var STDIN_READ_TIMEOUT_MS=500;async function readTextWithTimeout(read,timeoutMs=STDIN_READ_TIMEOUT_MS){let raceTimer;try{return await Promise.race([read(),new Promise((resolve2)=>{raceTimer=setTimeout(()=>resolve2(""),timeoutMs)})])}finally{if(raceTimer!==void 0)clearTimeout(raceTimer)}}async function readStdinText(isComplete){let bun=globalThis.Bun;if(bun)return bun.stdin.text();if(process.stdin.isTTY)return"";let chunks=[];try{for await(let chunk of process.stdin)if(chunks.push(chunk),isComplete?.(Buffer.concat(chunks).toString("utf8")))break}finally{process.stdin.destroy()}return Buffer.concat(chunks).toString("utf8")}function isCompleteJson(text){try{return JSON.parse(text),!0}catch{return!1}}async function readStdinPayload(){try{let text=await readTextWithTimeout(()=>readStdinText(isCompleteJson));if(!text.trim())return{};let parsed=JSON.parse(text);return parsed&&typeof parsed==="object"&&!Array.isArray(parsed)?parsed:{}}catch{return{}}}async function runHookSubcommand(argv){let[verb,...rest]=argv;if(verb==="setup"){await runHookSetup(rest);return}if(verb==="cleanup"){await runHookCleanup();return}try{if(!verb||!isEngineActivityKind(verb))return;let payload=await readStdinPayload(),payloadFlag=flagValue(rest,"--payload");if(payloadFlag)try{let extra=JSON.parse(payloadFlag);if(extra&&typeof extra==="object"&&!Array.isArray(extra))Object.assign(payload,extra)}catch{}let taskId=flagValue(rest,"--task-id"),envTaskId=process.env.ROVE_TASK_ID,envTabId=process.env.ROVE_TAB_ID,engine=flagValue(rest,"--engine"),adapters=activityHookAdapters().filter((a)=>!engine||a.vendor===engine);if(!taskId&&adapters.some((a)=>a.isUnattendedSession?.(process.env)===!0))return;let cwd=typeof payload.cwd==="string"&&payload.cwd?payload.cwd:void 0;for(let adapter of adapters){if(cwd)break;cwd=adapter.cwdFromPayload?.(payload)}cwd||=process.cwd();let detail;for(let adapter of adapters)if(detail=adapter.activityDetailFromPayload(verb,payload),detail)break;let session;for(let adapter of adapters)if(session=adapter.sessionFromPayload(payload),session)break;let client=await connectIfRunning();if(!client)return;try{let effectiveTaskId=taskId??envTaskId;await client.request("engine.reportEvent",{...effectiveTaskId?{taskId:effectiveTaskId}:{cwd},kind:verb,...engine?{engine}:{},...envTabId?{tabId:envTabId}:{},...detail?{detail}:{},...session?{sessionId:session.sessionId}:{},...session?.transcriptPath?{transcriptPath:session.transcriptPath}:{}})}finally{client.close()}}catch(err){if(readRoveEnv("HOOK_DEBUG"))console.error(`[rove hook] ${verb} failed:`,err instanceof Error?err.message:String(err))}}var SYNC_SETTING_KEY="externalWorktreeSync";function worktreeSyncAdapters(){return activityHookAdapters().filter((a)=>a.supportsWorktreeSync())}function globalSettingsPath(){return worktreeSyncAdapters()[0]?.globalSettingsPath()}function persistedSyncPath(stored){if(!stored||stored==="off")return;if(stored==="global")return globalSettingsPath();if(stored.startsWith("repo:"))return join(resolve(stored.slice(5)),".claude","settings.json");return stored}async function ensureGlobalRoveHooks(opts={}){try{let toolEvents=pluginsWantToolEvents();for(let a of activityHookAdapters()){let external=await a.externallyManagedHooks?.();if(external){if(external.notice)process.stderr.write(`
3
3
  ${external.notice}
4
4
  `);continue}let enginePath=a.globalSettingsPath();if(!enginePath)continue;await a.installActivityHooks(enginePath,{toolEvents,quiet:opts.quiet}),await a.removeWorktreeWatchHook(enginePath)}await cleanupWorktreeSyncHook()}catch{}}function pluginsWantToolEvents(){try{for(let entry of loadPluginRegistry().plugins){if(!entry.enabled)continue;try{if(readPluginManifest(entry.root).manifest.events.some((e)=>e.on.startsWith("tool.")))return!0}catch{}}}catch{}return!1}async function cleanupWorktreeSyncHook(){let adapters=worktreeSyncAdapters();if(adapters.length===0)return;let stored=getPersistedString(SYNC_SETTING_KEY),paths=new Set;for(let adapter of adapters){let file=adapter.globalSettingsPath();if(file)paths.add(file)}let prev=persistedSyncPath(stored);if(prev)paths.add(prev);for(let a of adapters)for(let p of paths)await a.removeWorktreeSyncHook(p);if(stored!=="off")setPersistedString(SYNC_SETTING_KEY,"off")}async function runHookCleanup(){let claude=activityHookAdapters().find((a)=>a.vendor==="claude"),path=claude?.globalSettingsPath();if(!claude||!path){process.stdout.write(`rove hook cleanup: no Claude hook adapter \u2014 nothing to do.
5
5
  `);return}await claude.removeActivityHooks(path),await claude.removeWorktreeWatchHook(path),process.stdout.write([`rove hook cleanup: removed Rove's settings-managed hooks from ${path}.`,"Only Rove's own entries were touched; your other hooks are intact.","The Claude Code plugin's hooks.json now carries these events (if the plugin","is not installed, the next Rove launch reinstalls the settings-managed set).",""].join(`
@@ -0,0 +1,3 @@
1
+ // @bun
2
+ class ClientWriter{socket;highWaterMark;onOverflow;queue=new Map;snapshots=new Map;sequence=0;queuedBytes=0;paused=!1;droppedFrames=0;overflowed=!1;constructor(socket,options={}){this.socket=socket;this.highWaterMark=options.highWaterMark??8388608,this.onOverflow=options.onOverflow??(()=>socket.destroy())}get isPaused(){return this.paused}get pendingBytes(){return this.queuedBytes}get pendingCount(){return this.queue.size}get dropped(){return this.droppedFrames}write(line,replaceKey=null){if(this.overflowed)return;if(!this.paused){if(!this.safeWrite(line))this.pause();return}if(replaceKey!==null){let previous=this.snapshots.get(replaceKey);if(previous!==void 0)this.dequeue(previous),this.droppedFrames++}let id=this.sequence++,frame={line,bytes:Buffer.byteLength(line),replaceKey};if(this.queue.set(id,frame),replaceKey!==null)this.snapshots.set(replaceKey,id);if(this.queuedBytes+=frame.bytes,this.queuedBytes<=this.highWaterMark)return;let queuedBytes=this.queuedBytes,frames=this.queue.size;this.overflowed=!0,this.queue.clear(),this.snapshots.clear(),this.queuedBytes=0,this.onOverflow({queuedBytes,frames,frameBytes:frame.bytes})}dequeue(id){let frame=this.queue.get(id);if(!frame)return;if(this.queue.delete(id),this.queuedBytes-=frame.bytes,frame.replaceKey!==null)this.snapshots.delete(frame.replaceKey)}pause(){this.paused=!0,this.socket.once("drain",()=>{if(this.paused=!1,this.overflowed)return;for(let[id,frame]of this.queue)if(this.dequeue(id),!this.safeWrite(frame.line)){this.pause();return}})}safeWrite(line){try{return this.socket.write(line)}catch{return!0}}}function objectPayload(payload){if(!payload||typeof payload!=="object"||Array.isArray(payload))return{};return payload}function requireString(payload,key){let value=payload[key];if(typeof value!=="string"||value.length===0)throw Error(`${key} is required`);return value}function optionalString(payload,key){let value=payload[key];if(value===void 0||value===null||value==="")return;if(typeof value!=="string")throw Error(`${key} must be a string`);return value}function optionalBoolean(payload,key){let value=payload[key];if(value===void 0||value===null)return;if(typeof value!=="boolean")throw Error(`${key} must be a boolean`);return value}function requireNumber(payload,key){let value=payload[key];if(typeof value!=="number"||!Number.isFinite(value))throw Error(`${key} must be a finite number`);return value}function optionalNumber(payload,key){let value=payload[key];if(value===void 0||value===null)return;if(typeof value!=="number"||!Number.isFinite(value))throw Error(`${key} must be a finite number`);return value}function optionalVendor(payload,key){let value=optionalString(payload,key);return value&&value.trim().length>0?value:void 0}function optionalActivityDetail(payload){let raw=payload.detail;if(!raw||typeof raw!=="object"||Array.isArray(raw))return;let d=raw,out={};if(d.failure==="rate_limit"||d.failure==="billing"||d.failure==="transient"||d.failure==="other")out.failure=d.failure;if(d.waiting==="permission"||d.waiting==="input")out.waiting=d.waiting;if(typeof d.note==="string")out.note=d.note;let tool=d.tool;if(tool&&typeof tool==="object"&&!Array.isArray(tool))out.tool={...typeof tool.name==="string"?{name:tool.name}:{},...typeof tool.id==="string"?{id:tool.id}:{}};let compact=d.compact;if(compact&&typeof compact==="object"&&!Array.isArray(compact))out.compact=compact.trigger==="manual"||compact.trigger==="auto"?{trigger:compact.trigger}:{};let subagent=d.subagent;if(subagent&&typeof subagent==="object"&&!Array.isArray(subagent))out.subagent={...typeof subagent.type==="string"?{type:subagent.type}:{},...typeof subagent.id==="string"?{id:subagent.id}:{}};return Object.keys(out).length>0?out:void 0}class LineReceiver{maxBytes;storage=Buffer.alloc(0);length=0;failed=!1;constructor(maxBytes=8388608){this.maxBytes=maxBytes}get pendingBytes(){return this.length}push(chunk,onLine){if(this.failed)return!1;let start=0;while(start<chunk.length){let newline=chunk.indexOf(10,start),end=newline===-1?chunk.length:newline,size=this.length+end-start;if(size>this.maxBytes)return this.failed=!0,this.storage=Buffer.alloc(0),this.length=0,!1;if(size>this.storage.length){let capacity=Math.min(this.maxBytes,Math.max(size,this.storage.length*2,1024)),grown=Buffer.allocUnsafe(capacity);this.storage.copy(grown,0,0,this.length),this.storage=grown}if(chunk.copy(this.storage,this.length,start,end),this.length=size,newline===-1)return!0;let line=this.storage.toString("utf8",0,this.length);this.length=0,onLine(line),start=newline+1}return!0}}import{StringDecoder}from"string_decoder";function createOscSignals(){return{carry:"",decoder:new StringDecoder("utf8"),records:new Map,contexts:[]}}function freeText(raw,encodedLimit,decodedLimit){if(raw===void 0)return;if(raw.length>encodedLimit||!/^[A-Za-z0-9+/]*={0,2}$/.test(raw)||raw.replace(/=+$/,"").length%4===1)throw Error("Invalid base64");let bytes=Buffer.from(raw,"base64");if(bytes.length>decodedLimit)throw Error("Text exceeds limit");let text=new TextDecoder("utf-8",{fatal:!0}).decode(bytes);if(/[\x00-\x1f\x7f-\x9f]/u.test(text))throw Error("Control character");return text}function applyProgramStatus(signals,body,now){if(Buffer.byteLength(body)+10>4096)return;let pairs=Object.create(null);for(let pair of body.split(":")){let split=pair.indexOf("=");if(split<1)continue;let key=pair.slice(0,split).trim(),value=pair.slice(split+1).trim();if(key.length>16)return;if(/^[a-z]+$/.test(key)&&/^[A-Za-z0-9_.,+/=-]*$/.test(value))pairs[key]=value}let id=pairs.id??"";if(pairs.id!==void 0&&(id.length>128||id.split("/").length>8||!/^[A-Za-z0-9_.+-]{1,32}(\/[A-Za-z0-9_.+-]{1,32})*$/.test(id)))return;let state=pairs.state;if(!["idle","working","done","blocked","error","clear"].includes(state??""))return;let msg,title;try{msg=freeText(pairs.msg,2732,2048),title=freeText(pairs.title,256,192)}catch{return}if(pairs.app!==void 0&&pairs.app.length>32)return;if(state==="clear"){for(let key of signals.records.keys())if(!id||key===id||key.startsWith(`${id}/`))signals.records.delete(key);return}if(state!=="idle"&&state!=="working"&&state!=="done"&&state!=="blocked"&&state!=="error")return;let kind=pairs.kind==="permission"||pairs.kind==="question"||pairs.kind==="auth"?pairs.kind:void 0,progress=pairs.progress!==void 0&&/^\d{1,3}$/.test(pairs.progress)&&Number(pairs.progress)<=100?Number(pairs.progress):void 0;if(signals.records.delete(id),signals.records.set(id,{id,state,at:now,...msg!==void 0?{msg}:{},...title!==void 0?{title}:{},...pairs.app&&/^[A-Za-z0-9_.+-]{1,32}$/.test(pairs.app)?{app:pairs.app}:{},...state==="blocked"&&kind?{kind}:{},...(state==="working"||state==="blocked")&&progress!==void 0?{progress}:{}}),signals.records.size>64){let first=signals.records.keys().next().value;if(first!==void 0)signals.records.delete(first)}}function applyContext(signals,body){if(Buffer.byteLength(body)>4096||/[\x00-\x1f\x7f]/.test(body))return;let[head="",...fields]=body.split(";"),split=head.indexOf("="),operation=head.slice(0,split),decodeContextField=(text)=>text.replace(/\\x(3b|5c)/g,(_,hex)=>hex==="3b"?";":"\\"),id=decodeContextField(head.slice(split+1));if(operation!=="start"&&operation!=="end"||!/^[ -~]{1,64}$/.test(id))return;let index=signals.contexts.findIndex((c)=>c.id===id);if(operation==="end"){if(index!==-1)signals.contexts.splice(index);return}if(index!==-1)signals.contexts.splice(index);if(signals.contexts.length>=32)return;let metadata=Object.create(null);for(let field of fields){let i=field.indexOf("=");if(i>0)metadata[field.slice(0,i)]=decodeContextField(field.slice(i+1))}signals.contexts.push({id,metadata})}function clearTransientStatuses(signals){for(let[id,record]of signals.records)if(record.state==="working"||record.state==="blocked"||record.state==="idle")signals.records.delete(id)}function scanOscSignals(signals,bytes,now=Date.now(),onRootChange){let text=signals.carry+signals.decoder.write(bytes);signals.carry="";let queries=0;for(let i=0;i<text.length;i++){if(text[i]!=="\x1B")continue;if(i===text.length-1){signals.carry="\x1B";break}if(text[i+1]==="c"){let hadRoot=signals.records.has("");if(signals.records.clear(),hadRoot)onRootChange?.(null);signals.contexts=[],i++;continue}if(text[i+1]!=="]")continue;let begin=i;i+=2;let end=i;while(end<text.length&&text[end]!=="\x07"&&text[end]!=="\x1B")end++;if(end===text.length||text[end]==="\x1B"&&end+1===text.length){if(text.length-begin<=8192)signals.carry=text.slice(begin);break}if(text[end]==="\x1B"&&text[end+1]!=="\\"){i=end-1;continue}let before=signals.records.get(""),body=text.slice(i,end);if(body==="7501;?")queries++;else if(body.startsWith("7501;"))applyProgramStatus(signals,body.slice(5),now);else if(body.startsWith("3008;"))applyContext(signals,body.slice(5));else if(body==="133;A"||body.startsWith("133;A;"))clearTransientStatuses(signals);let after=signals.records.get("");if(before!==after)onRootChange?.(after??null);i=end+(text[end]==="\x1B"?1:0)}return queries}function statusActivity(status){return{kind:status.state==="working"?"turn-start":status.state==="done"?"turn-complete":status.state==="blocked"?"awaiting-input":status.state==="error"?"turn-failed":"turn-interrupted",detail:{...status.msg?{note:status.msg}:{},...status.state==="blocked"?{waiting:status.kind==="permission"?"permission":"input"}:{},...status.state==="error"?{failure:"other"}:{}}}}
3
+ export{ClientWriter,createOscSignals,clearTransientStatuses,scanOscSignals,statusActivity,objectPayload,requireString,optionalString,optionalBoolean,requireNumber,optionalNumber,optionalVendor,optionalActivityDetail,LineReceiver};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{readTabsSnapshot}from"./chunk-za8pnw78.js";import{engineCanFork,engineDisplayName,getEngineProtocol,protocolEntry,sessionProtocol}from"./chunk-rjq38twt.js";import{execHostForWorktreePath}from"./chunk-895yqjjz.js";import{supportsStructuredHistory}from"./chunk-4gjvmfa9.js";import{getPersistedString,getPersistedValue}from"./chunk-rfp0ayra.js";import{parseNumstatRows}from"./chunk-t7j8g9f6.js";import{parsePorcelainRows,unquoteGitPath}from"./chunk-dmzg9zdc.js";import{recordSpawn}from"./chunk-40dgv828.js";import{readHeadSha,resolveGitDirs}from"./chunk-kg9kmwt9.js";import{READ_ONLY_GIT_ENV}from"./chunk-6xppe9bj.js";import{errorMessage}from"./chunk-2brn8e1y.js";import{t}from"./chunk-4d5xp2p0.js";import{rollupPr}from"./chunk-x1jxxmtc.js";import{isObject}from"./chunk-7ghwdjdc.js";import{acquireSync,releaseSync}from"./chunk-bejhca6z.js";import{secretsPath}from"./chunk-z1nj22va.js";import{readFile,stat}from"fs/promises";var PER_SESSION=3,SNIPPET_RADIUS=60,READ_BATCH=8,READ_BUDGET_MS=1500;function snippetOf(text,needle){let flat=text.replace(/\s+/g," "),want=needle.replace(/\s+/g," "),at=flat.toLowerCase().indexOf(want.toLowerCase());if(at<0)return null;let start=Math.max(0,at-SNIPPET_RADIUS),end=Math.min(flat.length,at+want.length+SNIPPET_RADIUS);return`${start>0?"\u2026":""}${flat.slice(start,end).trim()}${end<flat.length?"\u2026":""}`}function matchMessages(messages,needle,max){let out=[];for(let m of messages){if(m.role!=="user"&&m.role!=="assistant")continue;for(let b of m.blocks){if(b.type!=="text")continue;let snippet=snippetOf(b.text,needle);if(snippet===null)continue;out.push({role:m.role,at:m.timestamp,snippet});break}if(out.length>=max)break}return out}function prefilterToken(query){return query.split(/["\\\s]+/).reduce((a,b)=>b.length>a.length?b:a,"")}async function candidatesOf(tasks,skipped){let claimed=new Set,pinned=[],unpinned=[],sharedDirs=new Map;for(let t2 of tasks)if(t2.worktreePath)sharedDirs.set(t2.worktreePath,(sharedDirs.get(t2.worktreePath)??0)+1);for(let task of tasks){if(task.origin){skipped.push({taskId:task.id,reason:"other-machine"});continue}let vendor=task.vendor,tabs=(readTabsSnapshot(task.id)?.tabs??[]).filter((t2)=>t2.kind==="engine"),any=!1;for(let tab of tabs){let tabVendor=tab.vendor??vendor;if(!tabVendor||!supportsStructuredHistory(sessionProtocol(tabVendor))||!tab.sessionId)continue;if(claimed.has(tab.sessionId))continue;claimed.add(tab.sessionId);let reader=protocolEntry(tabVendor).history;pinned.push({task,reader,sessionId:tab.sessionId,tabId:tab.id,path:null,mtimeMs:0}),any=!0}if(any)continue;if(!vendor||!supportsStructuredHistory(sessionProtocol(vendor))){skipped.push({taskId:task.id,reason:"engine-unsupported"});continue}let worktree=task.worktreePath;if(worktree&&(sharedDirs.get(worktree)??0)===1)unpinned.push({task,reader:protocolEntry(vendor).history,worktree})}let listed=await Promise.all(unpinned.map(async({task,reader,worktree})=>(await reader.listSessionIdsForWorktree(worktree)).filter((id)=>!claimed.has(id)).map((sessionId)=>({task,reader,sessionId,path:null,mtimeMs:0})))),all=[...pinned,...listed.flat()];return Promise.all(all.map(async(c)=>{let worktree=c.task.worktreePath||c.task.repo,path=await c.reader.transcriptPath(c.sessionId,worktree).catch(()=>null),mtimeMs=path?await stat(path).then((s)=>s.mtimeMs,()=>0):0;return{...c,path,mtimeMs}}))}async function filesContaining(paths,token){if(paths.length===0||token==="")return new Set(paths);let rg=Bun.which("rg");if(rg){let proc=Bun.spawn([rg,"-l","-i","-F","--no-messages","--",token,...paths],{stdout:"pipe",stderr:"ignore"}),out=await new Response(proc.stdout).text();return await proc.exited,new Set(out.split(`
2
+ import{readTabsSnapshot}from"./chunk-y1pkmjjk.js";import{engineCanFork,engineDisplayName,getEngineProtocol,protocolEntry,sessionProtocol}from"./chunk-d1qs7c11.js";import{execHostForWorktreePath}from"./chunk-22emnsn5.js";import{supportsStructuredHistory}from"./chunk-dhp93daz.js";import{getPersistedString,getPersistedValue}from"./chunk-gygdyf0s.js";import{parseNumstatRows}from"./chunk-t7j8g9f6.js";import{parsePorcelainRows,unquoteGitPath}from"./chunk-dmzg9zdc.js";import{recordSpawn}from"./chunk-40dgv828.js";import{readHeadSha,resolveGitDirs}from"./chunk-kg9kmwt9.js";import{READ_ONLY_GIT_ENV}from"./chunk-6xppe9bj.js";import{errorMessage}from"./chunk-2brn8e1y.js";import{t}from"./chunk-swptzzer.js";import{rollupPr}from"./chunk-x1jxxmtc.js";import{isObject}from"./chunk-7ghwdjdc.js";import{acquireSync,releaseSync}from"./chunk-bejhca6z.js";import{secretsPath}from"./chunk-z1nj22va.js";import{readFile,stat}from"fs/promises";var PER_SESSION=3,SNIPPET_RADIUS=60,READ_BATCH=8,READ_BUDGET_MS=1500;function snippetOf(text,needle){let flat=text.replace(/\s+/g," "),want=needle.replace(/\s+/g," "),at=flat.toLowerCase().indexOf(want.toLowerCase());if(at<0)return null;let start=Math.max(0,at-SNIPPET_RADIUS),end=Math.min(flat.length,at+want.length+SNIPPET_RADIUS);return`${start>0?"\u2026":""}${flat.slice(start,end).trim()}${end<flat.length?"\u2026":""}`}function matchMessages(messages,needle,max){let out=[];for(let m of messages){if(m.role!=="user"&&m.role!=="assistant")continue;for(let b of m.blocks){if(b.type!=="text")continue;let snippet=snippetOf(b.text,needle);if(snippet===null)continue;out.push({role:m.role,at:m.timestamp,snippet});break}if(out.length>=max)break}return out}function prefilterToken(query){return query.split(/["\\\s]+/).reduce((a,b)=>b.length>a.length?b:a,"")}async function candidatesOf(tasks,skipped){let claimed=new Set,pinned=[],unpinned=[],sharedDirs=new Map;for(let t2 of tasks)if(t2.worktreePath)sharedDirs.set(t2.worktreePath,(sharedDirs.get(t2.worktreePath)??0)+1);for(let task of tasks){if(task.origin){skipped.push({taskId:task.id,reason:"other-machine"});continue}let vendor=task.vendor,tabs=(readTabsSnapshot(task.id)?.tabs??[]).filter((t2)=>t2.kind==="engine"),any=!1;for(let tab of tabs){let tabVendor=tab.vendor??vendor;if(!tabVendor||!supportsStructuredHistory(sessionProtocol(tabVendor))||!tab.sessionId)continue;if(claimed.has(tab.sessionId))continue;claimed.add(tab.sessionId);let reader=protocolEntry(tabVendor).history;pinned.push({task,reader,sessionId:tab.sessionId,tabId:tab.id,path:null,mtimeMs:0}),any=!0}if(any)continue;if(!vendor||!supportsStructuredHistory(sessionProtocol(vendor))){skipped.push({taskId:task.id,reason:"engine-unsupported"});continue}let worktree=task.worktreePath;if(worktree&&(sharedDirs.get(worktree)??0)===1)unpinned.push({task,reader:protocolEntry(vendor).history,worktree})}let listed=await Promise.all(unpinned.map(async({task,reader,worktree})=>(await reader.listSessionIdsForWorktree(worktree)).filter((id)=>!claimed.has(id)).map((sessionId)=>({task,reader,sessionId,path:null,mtimeMs:0})))),all=[...pinned,...listed.flat()];return Promise.all(all.map(async(c)=>{let worktree=c.task.worktreePath||c.task.repo,path=await c.reader.transcriptPath(c.sessionId,worktree).catch(()=>null),mtimeMs=path?await stat(path).then((s)=>s.mtimeMs,()=>0):0;return{...c,path,mtimeMs}}))}async function filesContaining(paths,token){if(paths.length===0||token==="")return new Set(paths);let rg=Bun.which("rg");if(rg){let proc=Bun.spawn([rg,"-l","-i","-F","--no-messages","--",token,...paths],{stdout:"pipe",stderr:"ignore"}),out=await new Response(proc.stdout).text();return await proc.exited,new Set(out.split(`
3
3
  `).filter(Boolean))}let needle=token.toLowerCase(),hits=new Set;for(let p of paths)if((await readFile(p,"utf8").catch(()=>"")).toLowerCase().includes(needle))hits.add(p);return hits}async function searchTasks(tasks,query,limit,budgetMs=READ_BUDGET_MS){let started=Date.now(),skipped=[],candidates=await candidatesOf(tasks,skipped),withPath=candidates.filter((c)=>c.path!==null).map((c)=>c.path),hits=await filesContaining(withPath,prefilterToken(query)),toRead=candidates.filter((c)=>c.path===null||hits.has(c.path)).sort((a,b)=>b.mtimeMs-a.mtimeMs),matches=[],scanned=0;while(scanned<toRead.length&&matches.length<limit&&Date.now()-started<budgetMs){let batch=toRead.slice(scanned,scanned+READ_BATCH),read=await Promise.all(batch.map((c)=>c.reader.readHistory(c.sessionId).catch(()=>[])));for(let[i,messages]of read.entries()){let c=batch[i];scanned++;for(let m of matchMessages(messages,query,Math.min(PER_SESSION,limit-matches.length)))matches.push({taskId:c.task.id,title:c.task.title,...c.tabId?{tabId:c.tabId}:{},...m});if(matches.length>=limit)break}}return{query,matches,skipped,truncated:scanned<toRead.length}}async function runWorktreeGit(worktreePath,args,options={}){if(!worktreePath)return{stdout:"",stderr:"worktreePath is required",status:-1};let exec=(options.execForPath??execHostForWorktreePath)(worktreePath),controller=options.timeoutMs&&options.timeoutMs>0?new AbortController:null,timedOut=!1,timer=controller?setTimeout(()=>{timedOut=!0,controller.abort()},options.timeoutMs):null,signal=controller&&options.signal?AbortSignal.any([controller.signal,options.signal]):controller?.signal??options.signal,result;try{recordSpawn("worktree.content",["git",...args],worktreePath),result=await exec.run(["git",...args],{cwd:worktreePath,env:READ_ONLY_GIT_ENV,signal})}catch(err){if(timer)clearTimeout(timer);return{stdout:"",stderr:errorMessage(err),status:-1}}if(timer)clearTimeout(timer);if(timedOut&&result.exitCode===-1&&!result.stderr)return{stdout:result.stdout,stderr:`git ${args.join(" ")} timed out after ${options.timeoutMs}ms`,status:-1};return{stdout:result.stdout,stderr:result.stderr,status:result.exitCode}}function readLocalWorktreeHead(worktreePath,deps={}){if(!worktreePath||(deps.execForPath??execHostForWorktreePath)(worktreePath).isRemote)return null;try{let dirs=resolveGitDirs(worktreePath);return dirs?readHeadSha(dirs):null}catch{return null}}function worktreeFilePath(worktreePath,relPath){if(!worktreePath||!relPath)return null;if(/^[/\\]/.test(relPath)||/^[a-zA-Z]:[/\\]/.test(relPath))return null;if(relPath.split(/[/\\]/).some((part)=>part===".."))return null;let parts=relPath.split("/");return`${worktreePath.replace(/\/+$/,"")}/${parts.filter(Boolean).join("/")}`}async function worktreeFileSize(worktreePath,relPath,deps={}){let path=worktreeFilePath(worktreePath,relPath);if(!path)return null;let exec=(deps.execForPath??execHostForWorktreePath)(worktreePath);try{let res=await exec.run(["wc","-c",path]);if(res.exitCode!==0)return null;let n=Number.parseInt(res.stdout.trim().split(/\s+/)[0]??"",10);return Number.isFinite(n)?n:null}catch{return null}}async function readWorktreeFile(worktreePath,relPath,deps={}){let path=worktreeFilePath(worktreePath,relPath);if(!path)return null;let exec=(deps.execForPath??execHostForWorktreePath)(worktreePath);try{return await exec.readFile(path)}catch{return null}}function filetypeOf(relPath,firstLine){let leaf=relPath.slice(relPath.lastIndexOf("/")+1),dot=leaf.lastIndexOf(".");if(dot<=0)return firstLine===void 0?void 0:shebangFiletype(firstLine);switch(leaf.slice(dot+1).toLowerCase()){case"ts":case"tsx":case"mts":case"cts":return"typescript";case"js":case"jsx":case"mjs":case"cjs":return"javascript";case"md":case"markdown":return"markdown";case"zig":return"zig";default:return}}var SHEBANG_INTERPRETERS=new Map([["node","javascript"],["nodejs","javascript"],["bun","typescript"],["deno","typescript"],["tsx","typescript"],["ts-node","typescript"]]);function shebangFiletype(line){if(!line.startsWith("#!"))return;let words=line.slice(2).trim().split(/\s+/),first=words[0]??"",program=first.slice(first.lastIndexOf("/")+1);if(program==="env"){let i=1;for(;i<words.length;i++){let word=words[i]??"";if(word==="--"){i++;break}if(["-u","--unset","-C","--chdir","-P","-a","--argv0"].includes(word)){i++;continue}if(!word.startsWith("-")&&!word.includes("="))break}let command=words[i]??"";program=command.slice(command.lastIndexOf("/")+1)}return SHEBANG_INTERPRETERS.get(program)}function patchFirstLine(patch){let lines=patch.split(`
4
4
  `),at=lines.findIndex((l)=>/^@@ -\d+(?:,\d+)? \+1(?:,\d+)? @@/.test(l));if(at<0)return;return lines.slice(at+1).find((l)=>l.startsWith(" ")||l.startsWith("+"))?.slice(1)}function contentFirstLine(text){let nl=text.indexOf(`
5
5
  `);return nl<0?text:text.slice(0,nl)}function isCombinedPathspec(relPath){return relPath==="."||relPath.endsWith("/")}function hunklessPatchNote(patch){if(/^@@/m.test(patch))return null;let binary=!1,from,to,renameFrom,renameTo,emptyChange;for(let line of patch.split(`