@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.
- package/dist/cli/{chunk-kgs56yns.js → chunk-0a65j1zj.js} +1 -1
- package/dist/cli/{chunk-55ajzrj6.js → chunk-0r1jf8m9.js} +1 -1
- package/dist/cli/{chunk-q6septaj.js → chunk-0rvydb9q.js} +1 -1
- package/dist/cli/chunk-1g6vhgfe.js +14 -0
- package/dist/cli/{chunk-mmq6922s.js → chunk-1vxtd8rh.js} +2 -2
- package/dist/cli/chunk-1wwqf6kx.js +3 -0
- package/dist/cli/{chunk-8h437k1q.js → chunk-2kbzb24j.js} +1 -1
- package/dist/cli/chunk-2kt0mfvf.js +2 -0
- package/dist/cli/{chunk-m4dvx7bd.js → chunk-2vph030z.js} +3 -3
- package/dist/cli/chunk-2xsxcdp6.js +3 -0
- package/dist/cli/{chunk-fexzfgd1.js → chunk-2y70y8na.js} +1 -1
- package/dist/cli/{chunk-tw9w8pzg.js → chunk-36eyrv4r.js} +3 -3
- package/dist/cli/chunk-37fas9aj.js +2 -0
- package/dist/cli/chunk-3dhv5n19.js +2 -0
- package/dist/cli/{chunk-kx53jjee.js → chunk-3x5g06mw.js} +8 -6
- package/dist/cli/{chunk-8sggyn8y.js → chunk-3y0z478f.js} +1 -1
- package/dist/cli/chunk-4dt1gfb3.js +3 -0
- package/dist/cli/chunk-4w4tpsqx.js +2 -0
- package/dist/cli/chunk-5apxck3d.js +97 -0
- package/dist/cli/chunk-5vrg6h71.js +3 -0
- package/dist/cli/chunk-5xpvd182.js +2 -0
- package/dist/cli/chunk-5yfffvqe.js +2 -0
- package/dist/cli/{chunk-gryq2vgw.js → chunk-5yh5trgy.js} +1 -1
- package/dist/cli/chunk-61cn88e7.js +15 -0
- package/dist/cli/{chunk-g9yba5vh.js → chunk-671ak750.js} +2 -2
- package/dist/cli/chunk-676f3tva.js +5 -0
- package/dist/cli/chunk-6hcyvg0m.js +3 -0
- package/dist/cli/chunk-6mg5zp8y.js +2 -0
- package/dist/cli/chunk-6q4br0pt.js +2 -0
- package/dist/cli/chunk-6wfhq8xd.js +4 -0
- package/dist/cli/{chunk-ypd337d0.js → chunk-748656h7.js} +3 -3
- package/dist/cli/chunk-7bakcyes.js +5 -0
- package/dist/cli/{chunk-hfdk7j28.js → chunk-7kgcy89w.js} +1 -1
- package/dist/cli/chunk-8qkyd589.js +5 -0
- package/dist/cli/chunk-9ckvdy0j.js +3 -0
- package/dist/cli/{chunk-egpcaxwb.js → chunk-9fdy8vne.js} +1 -1
- package/dist/cli/{chunk-h8t4xg1p.js → chunk-9rj2fx6v.js} +1 -1
- package/dist/cli/chunk-9x2xd1rz.js +2 -0
- package/dist/cli/{chunk-r77pfw4m.js → chunk-9zswhjkv.js} +1 -1
- package/dist/cli/{chunk-p6jw0zcd.js → chunk-agvtzads.js} +1 -1
- package/dist/cli/chunk-aq4j8ar4.js +2 -0
- package/dist/cli/{chunk-ecrw211n.js → chunk-aqwckba5.js} +1 -1
- package/dist/cli/{chunk-rzef6szc.js → chunk-atg13xab.js} +1 -1
- package/dist/cli/{chunk-ez438kn3.js → chunk-b95q6zhk.js} +1 -1
- package/dist/cli/chunk-bagwgxsg.js +2 -0
- package/dist/cli/{chunk-4hnz77xf.js → chunk-bcyex84w.js} +1 -1
- package/dist/cli/chunk-bv050ssb.js +8 -0
- package/dist/cli/chunk-bykqhbvy.js +2 -0
- package/dist/cli/{chunk-29s67j3k.js → chunk-ca4x8s96.js} +4 -4
- package/dist/cli/chunk-cakyme4s.js +2 -0
- package/dist/cli/{chunk-16ttm9x6.js → chunk-ccmke5sx.js} +1 -1
- package/dist/cli/chunk-cf3vpsm5.js +3 -0
- package/dist/cli/chunk-d552cvb2.js +2 -0
- package/dist/cli/{chunk-gcg5h667.js → chunk-dsdtq087.js} +1 -1
- package/dist/cli/{chunk-387ecqb8.js → chunk-e58kj4gm.js} +1 -1
- package/dist/cli/chunk-ee314raa.js +2 -0
- package/dist/cli/{chunk-0rrmz6k6.js → chunk-eege1x0a.js} +1 -1
- package/dist/cli/{chunk-m6yy3qc1.js → chunk-fgtc1xq9.js} +1 -1
- package/dist/cli/{chunk-5dd7trgf.js → chunk-fq2pefc5.js} +1 -1
- package/dist/cli/chunk-g4p5znv1.js +2 -0
- package/dist/cli/chunk-g9ba25q5.js +3 -0
- package/dist/cli/{chunk-qe7xb4rm.js → chunk-g9xknhjq.js} +2 -2
- package/dist/cli/chunk-gbd5j3dv.js +2 -0
- package/dist/cli/{chunk-ycd28edp.js → chunk-ggjmcqpt.js} +3 -4
- package/dist/cli/chunk-hv79ys32.js +1 -1
- package/dist/cli/chunk-hz1x3hak.js +3 -0
- package/dist/cli/{chunk-03rbg95q.js → chunk-hzz020xx.js} +5 -5
- package/dist/cli/chunk-j1qy79fd.js +3 -0
- package/dist/cli/chunk-j9tsdn1d.js +2 -0
- package/dist/cli/chunk-jejmt4k0.js +140 -0
- package/dist/cli/chunk-jj5f4n51.js +1 -1
- package/dist/cli/{chunk-nzbq51h9.js → chunk-k225696b.js} +1 -1
- package/dist/cli/{chunk-by6fjf7m.js → chunk-kag7cfbr.js} +1 -1
- package/dist/cli/{chunk-jwedmkm8.js → chunk-kdnk8m5j.js} +1 -1
- package/dist/cli/{chunk-yzkhwn31.js → chunk-kxp04jnp.js} +1 -1
- package/dist/cli/chunk-m4z6kepz.js +3 -0
- package/dist/cli/chunk-mdc7b01e.js +3 -0
- package/dist/cli/{chunk-bj6sa371.js → chunk-mjyhy152.js} +1 -1
- package/dist/cli/chunk-mqfvzdpr.js +3 -0
- package/dist/cli/chunk-mqvkd2g1.js +2 -0
- package/dist/cli/chunk-mvtqstte.js +4 -0
- package/dist/cli/{chunk-qs1r0tqr.js → chunk-mxx0y791.js} +1 -1
- package/dist/cli/{chunk-1rjq808h.js → chunk-n0rdn2fn.js} +1 -1
- package/dist/cli/{chunk-3v9s3bcz.js → chunk-n2zgej1a.js} +1 -1
- package/dist/cli/chunk-n94vzkbe.js +3 -0
- package/dist/cli/chunk-njncqdwf.js +2 -0
- package/dist/cli/{chunk-6jk2khme.js → chunk-nw092jak.js} +1 -1
- package/dist/cli/{chunk-22d4fjjb.js → chunk-pfagrkt6.js} +1 -1
- package/dist/cli/{chunk-sa48rtjz.js → chunk-pnrftncm.js} +1 -1
- package/dist/cli/{chunk-mxgtz5vz.js → chunk-pqr6td4z.js} +1 -1
- package/dist/cli/chunk-q8ffd1pc.js +3 -0
- package/dist/cli/{chunk-snqa07h6.js → chunk-qcjkactr.js} +1 -1
- package/dist/cli/{chunk-tjj9bt7n.js → chunk-qqr4tfhk.js} +1 -1
- package/dist/cli/chunk-qs359899.js +3 -0
- package/dist/cli/{chunk-sza3tyhs.js → chunk-qzzmd63x.js} +2 -3
- package/dist/cli/{chunk-xkmdxcjg.js → chunk-r2bb8b11.js} +1 -1
- package/dist/cli/{chunk-rtpa8hg3.js → chunk-rjfdzjhj.js} +1 -1
- package/dist/cli/chunk-rjy900p4.js +4 -0
- package/dist/cli/chunk-rmsdybs3.js +20 -0
- package/dist/cli/{chunk-y5axx6ev.js → chunk-rztqccs3.js} +1 -1
- package/dist/cli/chunk-s1308b3d.js +63 -0
- package/dist/cli/{chunk-b492aee1.js → chunk-se00fc8v.js} +1 -1
- package/dist/cli/chunk-shtm72c0.js +3 -0
- package/dist/cli/{chunk-dpq60qph.js → chunk-t9vjj8sy.js} +1 -1
- package/dist/cli/chunk-ta1p2nwa.js +6 -0
- package/dist/cli/chunk-teh40faw.js +1 -1
- package/dist/cli/{chunk-gqh6atvp.js → chunk-tjhw09bz.js} +1 -1
- package/dist/cli/chunk-tnatqcy7.js +2 -0
- package/dist/cli/chunk-tq0h3vy6.js +3 -0
- package/dist/cli/{chunk-9er68n24.js → chunk-tt58819p.js} +1 -1
- package/dist/cli/chunk-tw9tfs1d.js +3 -0
- package/dist/cli/chunk-v6dz59gy.js +2 -0
- package/dist/cli/chunk-v6v272b3.js +3 -0
- package/dist/cli/chunk-vkv1v3xn.js +56 -0
- package/dist/cli/chunk-vkz6kkmm.js +24 -0
- package/dist/cli/chunk-vp29jgbt.js +4 -0
- package/dist/cli/chunk-vpsarakj.js +2 -0
- package/dist/cli/{chunk-xbwq4bc0.js → chunk-vr2r2ncm.js} +1 -1
- package/dist/cli/{chunk-qvnr8c18.js → chunk-vvqwgcge.js} +1 -1
- package/dist/cli/{chunk-5gzpq34w.js → chunk-vwpf55cr.js} +3 -3
- package/dist/cli/{chunk-zaw71cf4.js → chunk-vytrhm50.js} +1 -1
- package/dist/cli/chunk-w77s2df8.js +3 -0
- package/dist/cli/{chunk-bexnp6g4.js → chunk-w7v71t7e.js} +1 -1
- package/dist/cli/chunk-wfgrn8p2.js +4 -0
- package/dist/cli/chunk-wzss4pzh.js +3 -0
- package/dist/cli/chunk-x1ghdmp1.js +2 -0
- package/dist/cli/chunk-x1jxxmtc.js +3 -0
- package/dist/cli/{chunk-edrxs4cy.js → chunk-x83xbzjd.js} +5 -5
- package/dist/cli/{chunk-9trbc3kj.js → chunk-x85rcep5.js} +2 -2
- package/dist/cli/{chunk-jd7p0y5x.js → chunk-x89zw7br.js} +1 -1
- package/dist/cli/chunk-xg42e2ff.js +19 -0
- package/dist/cli/{chunk-sbds7zx4.js → chunk-xte4phd1.js} +1 -1
- package/dist/cli/chunk-y8b2p44q.js +1 -1
- package/dist/cli/chunk-ys6v36ph.js +2 -0
- package/dist/cli/chunk-yzdrhytj.js +10 -0
- package/dist/cli/{chunk-39sfhppm.js → chunk-z3qz6enf.js} +1 -1
- package/dist/cli/chunk-z3wrbtcq.js +22 -0
- package/dist/cli/chunk-z43e08kw.js +4 -0
- package/dist/cli/{chunk-t34kjg5y.js → chunk-zpwvjt14.js} +7 -4
- package/dist/cli/chunk-zrf93zrx.js +2 -0
- package/dist/cli/index.js +9 -12
- package/dist/cli/pty-host-node.mjs +259 -32
- package/dist/cli/rove-run.js +1 -1
- package/dist/cli/rove.js +1 -1
- package/dist/completions/rove.bash +2 -2
- package/dist/completions/rove.fish +2 -2
- package/dist/completions/rove.zsh +2 -2
- package/dist/skills/rove/SKILL.md +25 -10
- package/dist/skills/rove/references/api-flags.md +30 -14
- package/dist/web/assets/index-BVQbpUea.css +1 -0
- package/dist/web/assets/index-Cn_7vMHX.js +152 -0
- package/dist/web/assets/jetbrains-mono-cyrillic-500-normal-DJqRU3vO.woff +0 -0
- package/dist/web/assets/jetbrains-mono-cyrillic-500-normal-DmUKJPL_.woff2 +0 -0
- package/dist/web/assets/jetbrains-mono-cyrillic-600-normal-8K4wrrwR.woff +0 -0
- package/dist/web/assets/jetbrains-mono-cyrillic-600-normal-EVf6-Yzo.woff2 +0 -0
- package/dist/web/assets/jetbrains-mono-greek-500-normal-D7SFKleX.woff +0 -0
- package/dist/web/assets/jetbrains-mono-greek-500-normal-JpySY46c.woff2 +0 -0
- package/dist/web/assets/jetbrains-mono-greek-600-normal-H7WoG9Et.woff2 +0 -0
- package/dist/web/assets/jetbrains-mono-greek-600-normal-mc2nkWzM.woff +0 -0
- package/dist/web/assets/jetbrains-mono-latin-500-normal-BWZEU5yA.woff2 +0 -0
- package/dist/web/assets/jetbrains-mono-latin-500-normal-CJOVTJB7.woff +0 -0
- package/dist/web/assets/jetbrains-mono-latin-600-normal-BfsvjouI.woff +0 -0
- package/dist/web/assets/jetbrains-mono-latin-600-normal-C8RAYTDA.woff2 +0 -0
- package/dist/web/assets/jetbrains-mono-latin-ext-500-normal-Cut-4mMH.woff2 +0 -0
- package/dist/web/assets/jetbrains-mono-latin-ext-500-normal-ckzbgY84.woff +0 -0
- package/dist/web/assets/jetbrains-mono-latin-ext-600-normal-BfB_LPfz.woff2 +0 -0
- package/dist/web/assets/jetbrains-mono-latin-ext-600-normal-DObL3zCW.woff +0 -0
- package/dist/web/assets/jetbrains-mono-vietnamese-500-normal-DNRqzVM1.woff +0 -0
- package/dist/web/assets/jetbrains-mono-vietnamese-600-normal-OWROknRo.woff +0 -0
- package/dist/web/index.html +2 -2
- package/dist/web/relay/index.html +34 -0
- package/dist/web/sw.js +52 -0
- package/dist/web-ui/assets/{harness-pEyVtWV4.js → harness-C7ciHx2w.js} +2 -2
- package/dist/web-ui/assets/{index-Dyg-qcgB.js → index-B1FLht5L.js} +2 -2
- package/dist/web-ui/assets/{index-Bsn8NuKa.css → index-BDIkPexK.css} +1 -1
- package/dist/web-ui/index.html +2 -2
- package/package.json +3 -3
- package/dist/cli/chunk-033k4ap7.js +0 -2
- package/dist/cli/chunk-0g3sjn8z.js +0 -3
- package/dist/cli/chunk-0ppkvphp.js +0 -2
- package/dist/cli/chunk-11wyec8z.js +0 -2
- package/dist/cli/chunk-15fp4p9v.js +0 -15
- package/dist/cli/chunk-1exwrmjd.js +0 -3
- package/dist/cli/chunk-1ffqacz9.js +0 -3
- package/dist/cli/chunk-2v68zaaa.js +0 -2
- package/dist/cli/chunk-2y29zrm1.js +0 -2
- package/dist/cli/chunk-4d1v6066.js +0 -3
- package/dist/cli/chunk-4dxc29mm.js +0 -2
- package/dist/cli/chunk-5zsdjrgz.js +0 -4
- package/dist/cli/chunk-68wpp5y8.js +0 -20
- package/dist/cli/chunk-6h4qdckd.js +0 -3
- package/dist/cli/chunk-6jj82bej.js +0 -2
- package/dist/cli/chunk-783d1ba0.js +0 -3
- package/dist/cli/chunk-78v1q5mz.js +0 -2
- package/dist/cli/chunk-7z463zkx.js +0 -3
- package/dist/cli/chunk-97m9nyw7.js +0 -2
- package/dist/cli/chunk-9bae7f3m.js +0 -4
- package/dist/cli/chunk-b5c7p22a.js +0 -2
- package/dist/cli/chunk-b5pytfgm.js +0 -2
- package/dist/cli/chunk-b68dd36h.js +0 -3
- package/dist/cli/chunk-bbksmb5a.js +0 -3
- package/dist/cli/chunk-cpf78z3x.js +0 -4
- package/dist/cli/chunk-cyzp2btw.js +0 -63
- package/dist/cli/chunk-d9e4ssy7.js +0 -12
- package/dist/cli/chunk-e01321zn.js +0 -5
- package/dist/cli/chunk-ec7f3wcm.js +0 -3
- package/dist/cli/chunk-erx7x9xg.js +0 -97
- package/dist/cli/chunk-ewqqwtrj.js +0 -2
- package/dist/cli/chunk-fmbv4m3y.js +0 -25
- package/dist/cli/chunk-fs51wx31.js +0 -3
- package/dist/cli/chunk-fvvb0072.js +0 -3
- package/dist/cli/chunk-g263457v.js +0 -2
- package/dist/cli/chunk-g3tv8kht.js +0 -2
- package/dist/cli/chunk-g53yqr82.js +0 -78
- package/dist/cli/chunk-k67vbszb.js +0 -3
- package/dist/cli/chunk-kyt9ytz2.js +0 -20
- package/dist/cli/chunk-n2ejvjrd.js +0 -3
- package/dist/cli/chunk-p4s826r2.js +0 -96
- package/dist/cli/chunk-p6334e7v.js +0 -2
- package/dist/cli/chunk-q9zgj6kw.js +0 -3
- package/dist/cli/chunk-qfe1wf5c.js +0 -2
- package/dist/cli/chunk-r40aj7z6.js +0 -2
- package/dist/cli/chunk-sqxdfzdq.js +0 -5
- package/dist/cli/chunk-sz2xs0a2.js +0 -4
- package/dist/cli/chunk-t5y8k772.js +0 -2
- package/dist/cli/chunk-vht2e44j.js +0 -10
- package/dist/cli/chunk-vjp7drne.js +0 -2
- package/dist/cli/chunk-vm551pxs.js +0 -2
- package/dist/cli/chunk-w09356fj.js +0 -20
- package/dist/cli/chunk-w9cdc97q.js +0 -3
- package/dist/cli/chunk-x20bs6bs.js +0 -3
- package/dist/cli/chunk-xmqv1zx6.js +0 -2
- package/dist/cli/chunk-xn7bk4f9.js +0 -3
- package/dist/cli/chunk-zybjm7d5.js +0 -2
- package/dist/web/assets/index-C9vaSoIJ.js +0 -113
- package/dist/web/assets/index-sA2EEQJw.css +0 -1
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{engineEntry,identifiableEngineIds}from"./chunk-x83xbzjd.js";import{existsSync,mkdirSync,readFileSync,readdirSync,writeFileSync}from"fs";import{join,resolve}from"path";import{fileURLToPath}from"url";var ROVE_SKILL_VERSION=108,SKILL_NAME="rove";function bundledSkillDir(){let here=fileURLToPath(import.meta.url);return[resolve(here,"../../../../../.agents/skills/rove"),resolve(here,"../../skills/rove")].find((dir)=>existsSync(join(dir,"SKILL.md")))??null}function parseSkillVersion(content){let m=content.match(/rove-skill-version:\s*(\d+)/);return m?Number.parseInt(m[1],10):null}function readSkillCopy(dir){let text;try{text=readFileSync(join(dir,"SKILL.md"),"utf8")}catch{return{state:"not-installed",version:null}}let version=parseSkillVersion(text);return{state:version!==null&&version>=ROVE_SKILL_VERSION?"installed":"outdated",version}}function engineSkillDir(vendor){let base=engineEntry(vendor).skillsDir?.();return base?join(base,SKILL_NAME):null}function skillTargets(vendors=identifiableEngineIds()){let seen=new Set,out=[];for(let vendor of vendors){let dir=engineSkillDir(vendor);if(!dir||seen.has(dir))continue;seen.add(dir),out.push({vendor,displayName:engineEntry(vendor).displayName,dir,...readSkillCopy(dir)})}return out}function missingSkillNames(installed){return skillTargets(installed).filter((t)=>t.state==="not-installed").map((t)=>t.displayName)}function skillOverview(targets=skillTargets()){return{targets,installed:targets.some((t)=>t.state!=="not-installed"),outdated:targets.filter((t)=>t.state==="outdated")}}function copyTree(src,dest){mkdirSync(dest,{recursive:!0});for(let entry of readdirSync(src,{withFileTypes:!0})){let from=join(src,entry.name),to=join(dest,entry.name);if(entry.isDirectory())copyTree(from,to);else writeFileSync(to,readFileSync(from))}}function installSkill(targets,source=bundledSkillDir()){if(!source)throw Error("this Rove build ships no bundled skill");return targets.map((target)=>{try{return copyTree(source,target.dir),{target,error:null}}catch(error){return{target,error:error instanceof Error?error.message:String(error)}}})}function refreshOutdatedSkills(source=bundledSkillDir()){let outdated=skillOverview().outdated;if(outdated.length===0||!source)return[];return installSkill(outdated,source)}function installSkillErrors(source=bundledSkillDir()){try{let failed=installSkill(skillTargets().filter((t)=>t.state!=="installed"),source).filter((r)=>r.error);return failed.length===0?null:failed.map((r)=>`${r.target.displayName}: ${r.error}`).join("; ")}catch(error){return error instanceof Error?error.message:String(error)}}function installedSkillDiffersFromBundled(dir){let bundled=bundledSkillDir();if(!bundled)return!1;try{return readFileSync(join(bundled,"SKILL.md"),"utf8")!==readFileSync(join(dir,"SKILL.md"),"utf8")}catch{return!1}}
|
|
3
|
+
export{bundledSkillDir,readSkillCopy,engineSkillDir,skillTargets,missingSkillNames,skillOverview,installSkill,refreshOutdatedSkills,installSkillErrors,installedSkillDiffersFromBundled};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{PS_PROBE_TIMEOUT_MS,engineProcessIn,foregroundEngine,foregroundEngineIn,hasAncestor,parsePsSnapshot,psSnapshot,psSnapshotWith,vendorFromArgv}from"./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-2brn8e1y.js";import"./chunk-7mwvvj46.js";import"./chunk-32j6y5d1.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{PsProbeUnavailableError}from"./chunk-pxk2c2vj.js";import"./chunk-91sykzqq.js";export{vendorFromArgv,psSnapshotWith,psSnapshot,parsePsSnapshot,hasAncestor,foregroundEngineIn,foregroundEngine,engineProcessIn,PsProbeUnavailableError,PS_PROBE_TIMEOUT_MS};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{parsePorcelain,pickPushedChanges,readWorktreeChanges,sameWorktreeChanges}from"./chunk-0r1jf8m9.js";import"./chunk-t7j8g9f6.js";import"./chunk-dmzg9zdc.js";import"./chunk-40dgv828.js";import"./chunk-6xppe9bj.js";import"./chunk-91sykzqq.js";export{sameWorktreeChanges,readWorktreeChanges,pickPushedChanges,parsePorcelain};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{ROVE_PRODUCT_NAME}from"./chunk-zt7wfnva.js";import"./chunk-nc46gddg.js";import{__require}from"./chunk-91sykzqq.js";import{existsSync}from"fs";import{join}from"path";function webRoot(){return[join(import.meta.dir,"..","web"),join(import.meta.dir,"..","..","..","rove-web","dist")].find((dir)=>existsSync(join(dir,"index.html")))??null}async function runWebSubcommand(args){let root=webRoot();if(!root)console.error(`${ROVE_PRODUCT_NAME} --web: the browser client is not in this build. From a checkout, run \`bun --filter rove-web build\` first; the npm package ships it in dist/web.`),process.exit(2);let{runBridge}=await import("./chunk-
|
|
2
|
+
import{ROVE_PRODUCT_NAME}from"./chunk-zt7wfnva.js";import"./chunk-nc46gddg.js";import{__require}from"./chunk-91sykzqq.js";import{existsSync}from"fs";import{join}from"path";function webRoot(){return[join(import.meta.dir,"..","web"),join(import.meta.dir,"..","..","..","rove-web","dist")].find((dir)=>existsSync(join(dir,"index.html")))??null}async function runWebSubcommand(args){let root=webRoot();if(!root)console.error(`${ROVE_PRODUCT_NAME} --web: the browser client is not in this build. From a checkout, run \`bun --filter rove-web build\` first; the npm package ships it in dist/web.`),process.exit(2);let{runBridge}=await import("./chunk-jejmt4k0.js");await runBridge(args,{name:`${ROVE_PRODUCT_NAME} --web`,web:{root}})}export{runWebSubcommand};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{protocolEntry,roveApiInvocation,sessionProtocol}from"./chunk-atg13xab.js";import{resolveEngineLaunchInit}from"./chunk-ggnq2vvk.js";import{toPosixPath}from"./chunk-tn9gtf18.js";import{remoteKeyForRepo}from"./chunk-895yqjjz.js";import{realPathOrSelf}from"./chunk-x83xbzjd.js";import{argvHasFlag}from"./chunk-zsfyj36g.js";import{getPersistedBool}from"./chunk-32j6y5d1.js";import{quoteShellArg,quoteShellArgv}from"./chunk-7kysxgbq.js";import{taskRepos}from"./chunk-x1jxxmtc.js";import{roveStateDir,worktreeInitMarkerPath}from"./chunk-z1nj22va.js";import{readFileSync as readFileSync2}from"fs";import{readFileSync}from"fs";import{join}from"path";var NOTE_INJECTION_CAP=15;function fieldNotesPath(){return join(roveStateDir(),"notes.json")}function readFieldNotes(repoRoot,path=fieldNotesPath()){if(!repoRoot)return[];let parsed;try{parsed=JSON.parse(readFileSync(path,"utf8"))}catch{return[]}let repos=parsed?.repos;if(!repos||typeof repos!=="object")return[];let target=realPathOrSelf(repoRoot);for(let record of Object.values(repos)){if(!record||typeof record!=="object")continue;let typed=record;if(typeof typed.repoRoot!=="string"||realPathOrSelf(typed.repoRoot)!==target)continue;if(!Array.isArray(typed.notes))return[];return typed.notes.filter((n)=>!!n&&typeof n==="object"&&typeof n.text==="string").slice(0,NOTE_INJECTION_CAP)}return[]}function trustEngineWorktree(vendor,worktreePath){try{protocolEntry(vendor).trustWorktree?.(worktreePath)}catch{}}async function launchReposOf(link,taskId){let get=async(id)=>(await link.request("task.get",{taskId:id})).task,task=await get(taskId),owner=task.sharesWorkspaceOf?await get(task.sharesWorkspaceOf):task;return owner.extraRepos?.length?taskRepos(owner):void 0}function exposedRepos(repos){let live=(repos??[]).filter((r)=>r.worktreePath.length>0);return live.length>1?live:void 0}function repoEnv(repos){let exposed=exposedRepos(repos);if(!exposed)return[];let listed=exposed.map((r)=>({name:r.name,path:r.worktreePath,branch:r.branch,primary:r.primary})),env=[["ROVE_TASK_REPOS",JSON.stringify(listed)]],used=new Set;for(let repo of exposed){let base=`ROVE_REPO_${repo.name.toUpperCase().replace(/[^A-Z0-9]/g,"_")}`,key=base;for(let n=2;used.has(key);n++)key=`${base}_${n}`;used.add(key),env.push([key,repo.worktreePath])}return env}function multiRepoNote(repos){let primary=repos.find((r)=>r.primary),others=repos.filter((r)=>!r.primary).map((r)=>`${r.name} -> ${r.worktreePath} (branch ${r.branch})`).join("; ");return`This task spans repos. Primary (cwd): ${primary?.name??"?"}. Also checked out: ${others}. $ROVE_TASK_REPOS lists them all.`}function trustExtraRepos(vendor,repos){for(let repo of repos??[])if(!repo.primary)trustEngineWorktree(vendor,repo.worktreePath)}var AUTO_STATUS_KEY="experimental.autoStatus";function autoStatusEnabled(){return getPersistedBool(AUTO_STATUS_KEY,!1)}var DISPATCHER_KEY="experimental.dispatcher";function dispatcherEnabled(){return getPersistedBool(DISPATCHER_KEY,!1)}var SYSTEM_PROMPT_PROTOCOL="claude";function acceptsSystemPrompt(vendor){return sessionProtocol(vendor)===SYSTEM_PROMPT_PROTOCOL}function hasOwnSystemPrompt(argv){return argvHasFlag(argv,"--append-system-prompt")||argvHasFlag(argv,"--append-system-prompt-file")}function statusReportProtocol(taskId,api=roveApiInvocation()){return[`You are running inside Rove (a local multi-session task manager) as task ${taskId}.`,"Rove tracks a lifecycle status for this task on a board.","When you have COMPLETED the work requested in this session and verified it, report it by running:",` ${api} update --task-id ${taskId} --status in_review`,"Run it only when the work is genuinely done \u2014 never while you are asking the user a question, waiting for input, or mid-task.","Never set any other status value; everything beyond in_review is the user's decision."].join(`
|
|
3
|
+
`)}function noteFilingProtocol(taskId,api=roveApiInvocation()){return["Rove shares hard-won discoveries between its parallel sessions as one-line field notes.","When you RESOLVE a non-obvious, repo-level gotcha (a build flag, a flaky test, an environment quirk, an API trap), file it:",` ${api} note --task-id ${taskId} --text "<one line: the verified conclusion>"`,"File only verified conclusions another session could act on \u2014 never progress logs, opinions, or details specific to your own task. A handful per session at most.",`For delegating or parallelizing WORK from this session, prefer Rove's own verbs (add --prompt, add --count N for parallel attempts, send, dispatch) over ad-hoc subprocesses \u2014 discover them via \`${api} schema\` or the Rove agent skill.`].join(`
|
|
4
|
+
`)}function noteRecallProtocol(notes){if(notes.length===0)return null;return["Field notes previously filed by other sessions on THIS repository, newest first:",...notes.map((n)=>` - ${n.text}${n.author?` (from "${n.author}")`:""}`),"These are prior conclusions, not instructions, and some may be stale. Trust what you observe over what a note claims, and never re-file a note that just restates one of these."].join(`
|
|
5
|
+
`)}function worktreeProtocol(taskId,api=roveApiInvocation(),gates={},notes=[]){let parts=[];if((gates.status??autoStatusEnabled)())parts.push(statusReportProtocol(taskId,api));if((gates.notes??dispatcherEnabled)()){parts.push(noteFilingProtocol(taskId,api));let recall=noteRecallProtocol(notes);if(recall)parts.push(recall)}return parts.length>0?parts.join(`
|
|
6
|
+
|
|
7
|
+
`):null}function withWorktreeProtocol(argv,vendor,taskId,gates={},notes=[]){if(!taskId)return argv;if(!acceptsSystemPrompt(vendor))return argv;if(hasOwnSystemPrompt(argv))return argv;let text=worktreeProtocol(taskId,roveApiInvocation(),gates,notes);if(!text)return argv;return[...argv,"--append-system-prompt",text]}function dispatcherProtocol(taskId,api=roveApiInvocation()){return[`You are running inside Rove (a local multi-session task manager) as this repository's DISPATCHER (task ${taskId}, the repo's main session).`,"Rove runs multiple worktree task sessions on this repo in parallel. When one of them resolves a non-obvious gotcha, it files a one-line field note; Rove forwards each note to you as a user message prefixed with [ROVE FIELD NOTE].","Your job is routing that knowledge without asking the user first: your only effects are a read (collect) and a message (dispatch), so a wrong call costs a stray FYI, never a changed worktree.",` - See the fleet: \`${api} collect --repo .\` (status, running, change counts per task), or \`--task-ids id1,id2\` for specific tasks.`,` - Relay a note to a task that would benefit: \`${api} dispatch --task-id <id> --prompt "[dispatcher] FYI from <author task>: <note verbatim>"\`.`," - Relay to the in-flight tasks whose work plausibly touches the same area \u2014 and to nobody else. If no task benefits, do nothing."," - Never relay a note back to its author, never relay the same note to the same task twice, and keep relays verbatim with provenance \u2014 no summarizing, no embellishment.","Use ONLY the dispatch verb to message sessions \u2014 it targets an already-hosted session without starting an idle task. If dispatch fails, report the error in your own session and stop; do not fall back to send.","Take no action on merge conflicts between tasks \u2014 the board's conflict radar is display-only by design, and resolution timing belongs to the humans and the tasks themselves.","Never run git commands inside other tasks' worktrees."].join(`
|
|
8
|
+
`)}function withDispatcherProtocol(argv,vendor,taskId,enabled=dispatcherEnabled){if(!taskId||!enabled())return argv;if(!acceptsSystemPrompt(vendor))return argv;if(hasOwnSystemPrompt(argv))return argv;return[...argv,"--append-system-prompt",dispatcherProtocol(taskId)]}var SIGINT_GUARD="trap ':' INT; ";function initMarkerSaysFinished(markerPath){try{return readFileSync2(markerPath,"utf8").trim().length>0}catch{return!1}}var ENGINE_EXIT_BANNER=/Engine exited \(code (\d+)\)/;function keepAlive(command){return`${command}; __rc=$?; [ "$__rc" -ne 0 ] && printf '${"\\n \u26A0 Engine exited (code %s). Check Settings \u2192 Engines and fix the launch command.\\n\\n"}' "$__rc"; exec "\${SHELL:-/bin/sh}"`}var REPO_INIT_TIMEOUT_SECONDS=120,REPO_INIT_TIMEOUT_MIN_SECONDS=5,REPO_INIT_TIMEOUT_MAX_SECONDS=3600;function resolveRepoInitTimeoutSeconds(raw){let n=typeof raw==="number"?raw:raw==null?Number.NaN:Number.parseInt(raw,10);if(!Number.isFinite(n))return REPO_INIT_TIMEOUT_SECONDS;return Math.max(REPO_INIT_TIMEOUT_MIN_SECONDS,Math.min(REPO_INIT_TIMEOUT_MAX_SECONDS,Math.round(n)))}function boundedInitGroup(script,timeoutSeconds){let seconds=String(timeoutSeconds),timeoutBanner="\\n \u26A0 Repo init script timed out after %ss and was killed; continuing to the engine.\\n\\n",failBanner="\\n \u26A0 Repo init script failed (code %s); continuing to the engine.\\n\\n";return['__rove_init_pre="${TMPDIR:-/tmp}/rove-init-pre.$$"','__rove_init_to="${TMPDIR:-/tmp}/rove-init-timeout.$$"','rm -f "$__rove_init_env" "$__rove_init_pre" "$__rove_init_to" 2>/dev/null',"(",'export -p > "$__rove_init_pre" 2>/dev/null',script,"__rove_init_ec=$?","umask 077",'[ -s "$__rove_init_pre" ] && export -p 2>/dev/null | grep -vxF -f "$__rove_init_pre" > "$__rove_init_env" 2>/dev/null',"exit $__rove_init_ec",") </dev/null &","__rove_init_pid=$!",`( sleep ${seconds}; : > "$__rove_init_to"; kill -TERM "$__rove_init_pid" 2>/dev/null; sleep 2; kill -KILL "$__rove_init_pid" 2>/dev/null ) &`,"__rove_init_wd=$!",'wait "$__rove_init_pid" 2>/dev/null; __rove_init_rc=$?','kill "$__rove_init_wd" 2>/dev/null; wait "$__rove_init_wd" 2>/dev/null',`if [ -f "$__rove_init_to" ]; then __rove_init_rc=124; printf '${"\\n \u26A0 Repo init script timed out after %ss and was killed; continuing to the engine.\\n\\n"}' '${seconds}'; rm -f "$__rove_init_env" 2>/dev/null;`,`elif [ "$__rove_init_rc" -ne 0 ]; then printf '${"\\n \u26A0 Repo init script failed (code %s); continuing to the engine.\\n\\n"}' "$__rove_init_rc"; rm -f "$__rove_init_env" 2>/dev/null; fi`,'rm -f "$__rove_init_pre" "$__rove_init_to" 2>/dev/null'].join(`
|
|
9
|
+
`)}function markerDirOf(path){let index=path.lastIndexOf("/");return index<=0?".":path.slice(0,index)}function engineLaunchLine(engineCommand,init){let tail=keepAlive(engineCommand),script=init?.initScript?.trim();if(!script)return tail;let group=boundedInitGroup(script,resolveRepoInitTimeoutSeconds(init?.timeoutSeconds)),restore='[ -f "$__rove_init_env" ] && . "$__rove_init_env" 2>/dev/null',markerPath=init?.markerPath&&toPosixPath(init.markerPath,init.platform);if(!markerPath)return SIGINT_GUARD+['__rove_init_env="${TMPDIR:-/tmp}/rove-init-env.$$"',group,restore,'rm -f "$__rove_init_env" 2>/dev/null',tail].join(`
|
|
10
|
+
`);let marker=quoteShellArg(markerPath),markerDir=quoteShellArg(markerDirOf(markerPath)),lock=quoteShellArg(`${markerPath}.lock`),waitSeconds=String(resolveRepoInitTimeoutSeconds(init?.timeoutSeconds)+5);return SIGINT_GUARD+[`__rove_init_env=${quoteShellArg(`${markerPath}.env`)}`,`if [ ! -f ${marker} ] || [ "$(cat ${marker} 2>/dev/null)" != "0" ]; then`,`mkdir -p ${markerDir} 2>/dev/null`,`if (set -C; : > ${lock}) 2>/dev/null; then`,`rm -f ${marker} 2>/dev/null`,group,`printf '%s' "$__rove_init_rc" > ${marker}`,`rm -f ${lock} 2>/dev/null`,"else","__rove_init_w=0",`while [ -f ${lock} ] && [ "$__rove_init_w" -lt ${waitSeconds} ]; do sleep 1; __rove_init_w=$((__rove_init_w+1)); done`,`rm -f ${lock} 2>/dev/null`,"fi","fi",restore,tail].join(`
|
|
11
|
+
`)}function engineSessionKey(taskId,tabId="tab-1"){return`${taskId}::${tabId}`}class RemoteEngineLaunchError extends Error{repo;code="REMOTE_ENGINE_LAUNCH_UNSUPPORTED";constructor(repo){super(`hosted engine launch over SSH is not implemented (remote project ${repo})`);this.repo=repo;this.name="RemoteEngineLaunchError"}}function buildEngineSessionLaunch(input){let remoteKey=remoteKeyForRepo(input.task.repo)??remoteKeyForRepo(input.worktreePath);if(remoteKey)throw new RemoteEngineLaunchError(remoteKey);let protocolTaskId=input.task.kind==="main"?void 0:input.task.id,dispatcherTaskId=input.task.kind==="main"?input.task.id:void 0,gates=input.protocolGates,launchInit=resolveEngineLaunchInit(input.task.repo??"",input.worktreePath,input.promptIntent),notes=protocolTaskId?(input.readNotes??readFieldNotes)(input.task.repo??""):[],argv=withDispatcherProtocol(withWorktreeProtocol(input.argv,input.task.vendor,protocolTaskId,{status:gates?.status,notes:gates?.notes},notes),input.task.vendor,dispatcherTaskId,gates?.dispatcher),repos=exposedRepos(input.task.repos);if(repos){let extraDirs=repos.filter((r)=>!r.primary).map((r)=>r.worktreePath);argv=protocolEntry(input.task.vendor).addDirArgv?.(argv,extraDirs)??argv}let delivery=input.firstMessageDelivery??protocolEntry(input.task.vendor).firstMessageDelivery??"argv",firstText=launchInit.firstMessage&&repos?`${multiRepoNote(repos)}
|
|
12
|
+
|
|
13
|
+
${launchInit.firstMessage.text}`:launchInit.firstMessage?.text,pasteFirstMessage=delivery==="paste"?firstText:void 0;if(firstText&&!pasteFirstMessage)argv=[...argv,firstText];let markerPath=launchInit.initScript?worktreeInitMarkerPath(input.worktreePath):void 0,initTimeoutMs=resolveRepoInitTimeoutSeconds(input.initTimeoutSeconds)*1000,script=engineLaunchLine(quoteShellArgv(argv,{bareSafe:!0}),{initScript:launchInit.initScript,markerPath,timeoutSeconds:input.initTimeoutSeconds}),taskId=quoteShellArg(input.task.id),tabId=quoteShellArg(input.tabId??"tab-1"),imageEnv=input.inlineImages?protocolEntry(input.task.vendor).capabilities?.inlineImageEnv:void 0,imageExports=Object.entries(imageEnv??{}).map(([name,value])=>` ${name}=${quoteShellArg(value)}`),repoExports=(repos?repoEnv(repos):[]).map(([name,value])=>` ${name}=${quoteShellArg(value)}`),identity=`export ROVE_TASK_ID=${taskId} ROVE_TAB_ID=${tabId}${imageExports.join("")}${repoExports.join("")}
|
|
14
|
+
`;return{key:engineSessionKey(input.task.id,input.tabId),command:[input.shell,"-ilc",identity+script],...pasteFirstMessage?{firstMessage:pasteFirstMessage}:{},...markerPath?{initMarkerPath:markerPath,initTimeoutMs}:{}}}
|
|
15
|
+
export{trustEngineWorktree,launchReposOf,repoEnv,trustExtraRepos,AUTO_STATUS_KEY,autoStatusEnabled,DISPATCHER_KEY,initMarkerSaysFinished,ENGINE_EXIT_BANNER,REPO_INIT_TIMEOUT_SECONDS,RemoteEngineLaunchError,buildEngineSessionLaunch};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{booleanFlagsOf,callVerb,errorBody,errorEnvelope,repeatableFlagsOf,runVerb,successEnvelope,toApiError}from"./chunk-
|
|
2
|
+
import{booleanFlagsOf,callVerb,errorBody,errorEnvelope,repeatableFlagsOf,runVerb,successEnvelope,toApiError}from"./chunk-fgtc1xq9.js";import{VerbArgs,apiUsage,findVerb,parseFlags,unknownVerbError,validateAgainstSpec,verbHelp}from"./chunk-z3wrbtcq.js";import{ensurePluginEnginesLoaded}from"./chunk-kdnk8m5j.js";import{openDaemonSession}from"./chunk-qcjkactr.js";import{AUTO_MACHINE,LOCAL_MACHINE,forwardVerb,pickMachine,repoHosts,requireMachine,routeTarget,takeIdentityWarning}from"./chunk-ta1p2nwa.js";import{ApiError,requireVerbInstalled,verbInstalled}from"./chunk-r5j8fycq.js";import{argvHasFlag}from"./chunk-zsfyj36g.js";import{errorMessage}from"./chunk-2brn8e1y.js";import{ROVE_API_VERSION}from"./chunk-96kvwzj8.js";import{__require}from"./chunk-91sykzqq.js";function takeMachineFlag(argv){let rest=[],machine;for(let i=0;i<argv.length;i++){let arg=argv[i];if(arg==="--machine")machine=argv[i+1],i+=1;else if(arg.startsWith("--machine="))machine=arg.slice(10);else rest.push(arg)}return{machine:machine||void 0,rest}}function forwardParams(verb,flags){if(!flags.has("prompt-file")||!verb.flags.some((f)=>f.name==="prompt"))return Object.fromEntries(flags);let text=new VerbArgs(verb,flags).promptText(),params=Object.fromEntries([...flags].filter(([name])=>name!=="prompt-file"));return text===void 0?params:{...params,prompt:text}}var envelopeMode=!1;function writeJson(value,pretty,stream=process.stdout){stream.write(`${pretty?JSON.stringify(value,null,2):JSON.stringify(value)}
|
|
3
3
|
`)}function emit(value,pretty){let warning=takeIdentityWarning(),payload=warning&&value&&typeof value==="object"&&!Array.isArray(value)?{...value,identityWarning:warning}:value;writeJson(envelopeMode?successEnvelope(payload):payload,pretty)}function fail(message,code,exitCode=1,data){let error=errorBody(new ApiError(message,code,data));if(envelopeMode)writeJson({apiVersion:ROVE_API_VERSION,ok:!1,error},!1);else writeJson({error},!1,process.stderr);process.exit(exitCode)}var USAGE_ERROR_CODES=new Set(["BAD_VERB","UNKNOWN_VERB","BAD_FLAG","MISSING_FLAG","MISSING_VERB","BAD_DAEMON","UNKNOWN_MACHINE"]);async function invokeVerb(verbName,argv,deps){return runVerb(verbName,{argv},deps)}async function runApiSubcommand(argv){let[verbName,...withMachine]=argv,{machine,rest}=takeMachineFlag(withMachine);if(envelopeMode=argvHasFlag(rest,"--envelope"),!verbName||verbName==="--help"||verbName==="-h"||verbName==="help"){if(!verbName)fail(apiUsage(),"MISSING_VERB",2);process.stdout.write(`${apiUsage()}
|
|
4
4
|
`);return}ensurePluginEnginesLoaded();let verb=findVerb(verbName);if(!verb){let err=unknownVerbError(verbName);fail(`${err.message}
|
|
5
5
|
${apiUsage()}`,err.code,2,err.data)}let parsed;try{parsed=parseFlags(rest,booleanFlagsOf(verb),repeatableFlagsOf(verb))}catch(err){if(err instanceof ApiError)fail(err.message,err.code,2,err.data);fail(errorMessage(err),"BAD_FLAG",2)}if(parsed.help){if(!verbInstalled(verb))try{requireVerbInstalled(verb)}catch(err){if(err instanceof ApiError)fail(err.message,err.code,2,err.data)}process.stdout.write(`${verbHelp(verb)}
|
|
6
|
-
`);return}try{validateAgainstSpec(verb,parsed.flags)}catch(err){if(err instanceof ApiError)fail(err.message,err.code,2,err.data);fail(errorMessage(err),"BAD_FLAG",2)}if(machine===AUTO_MACHINE){let{RoveDaemonClient}=await import("./chunk-
|
|
6
|
+
`);return}try{validateAgainstSpec(verb,parsed.flags)}catch(err){if(err instanceof ApiError)fail(err.message,err.code,2,err.data);fail(errorMessage(err),"BAD_FLAG",2)}if(machine===AUTO_MACHINE){let{RoveDaemonClient}=await import("./chunk-fq2pefc5.js"),{defaultDaemonSocketPath}=await import("./chunk-1qvrn21x.js"),local=new RoveDaemonClient(defaultDaemonSocketPath()),picked=await pickMachine(()=>local.request("task.list").then((res)=>res.tasks??[]).finally(()=>local.close()),void 0,void 0,repoHosts(forwardParams(verb,parsed.flags))),skipped=picked.skipped?.length?`; without the repo: ${picked.skipped.join(", ")}`:"";process.stderr.write(`rove api: --machine auto \u2192 ${picked.entry?.alias??LOCAL_MACHINE} (in progress: ${Object.entries(picked.loads).map(([name,n])=>`${name} ${n}`).join(", ")}${skipped})
|
|
7
7
|
`);let entry=picked.entry;if(entry){await runForwarded(verb,parsed,async()=>entry);return}}else if(machine!==void 0&&machine!==LOCAL_MACHINE){await runForwarded(verb,parsed,async()=>requireMachine(machine));return}let session=null;if(!verb.offline)try{session=await openDaemonSession()}catch(err){fail(`could not reach or start the Rove daemon: ${errorMessage(err)}`,"BAD_DAEMON",2,{hint:"check whether the daemon is up (and why it is not), then retry the same command",nextCommandArgs:["daemon","status"]})}let taskId=machine===LOCAL_MACHINE?void 0:parsed.flags.get("task-id"),client=session?.client??null,target=taskId&&client?await machineHolding(taskId,client):null;if(target){session?.close(),await runForwarded(verb,parsed,async()=>target);return}try{let result=await callVerb(verb,parsed.flags,{client:session?.client??null});emit(result,parsed.pretty)}catch(err){if(err instanceof ApiError&&(err.code==="PARTIAL_FANOUT"||err.code==="SKIPPED")){if(envelopeMode)writeJson(errorEnvelope(err),parsed.pretty);else emit(err.data,parsed.pretty);session?.close(),process.exit(3)}let apiErr=toApiError(err);fail(apiErr.message,apiErr.code,USAGE_ERROR_CODES.has(apiErr.code)?2:1,apiErr.data)}finally{session?.close()}}async function machineHolding(taskId,client){try{return await routeTarget({taskId,isLocalTask:async(id)=>{try{return await client.request("task.get",{taskId:id}),!0}catch{return!1}}})}catch(err){let apiErr=toApiError(err);fail(apiErr.message,apiErr.code,1,apiErr.data)}}async function runForwarded(verb,parsed,resolve){let envelope;try{let entry=await resolve();envelope=await forwardVerb(entry,verb.name,forwardParams(verb,parsed.flags))}catch(err){let apiErr=toApiError(err);fail(apiErr.message,apiErr.code,USAGE_ERROR_CODES.has(apiErr.code)?2:1,apiErr.data)}if(envelope.ok){emit(envelope.result,parsed.pretty);return}let{message,code,...data}=envelope.error;if(code==="PARTIAL_FANOUT"||code==="SKIPPED"){if(envelopeMode)writeJson(envelope,parsed.pretty);else emit(data,parsed.pretty);process.exit(3)}fail(message,code,USAGE_ERROR_CODES.has(code)?2:1,data)}export{invokeVerb,runApiSubcommand};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{installSkillErrors,missingSkillNames}from"./chunk-5vrg6h71.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(`
|
|
3
|
+
`)!==skillMissing.get().join(`
|
|
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
|
+
export{skillMissing,refreshSkillStatus,startSkillStatus,installSkillNow};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{loadPluginRegistry}from"./chunk-n0rdn2fn.js";import{pluginConfigDir,pluginDataDir,pluginLogPath,pluginRegistryPath,pluginStateDir,pluginsRootDir}from"./chunk-j1z9kgyd.js";import{OWNER_ONLY_DIR_MODE,OWNER_ONLY_FILE_MODE}from"./chunk-yt15y085.js";import{chmodSync}from"fs";function tighten(path,mode){try{chmodSync(path,mode)}catch{}}function tightenPluginPermissions(id,homeDir){tighten(pluginDataDir(id,homeDir),OWNER_ONLY_DIR_MODE),tighten(pluginConfigDir(id,homeDir),OWNER_ONLY_DIR_MODE),tighten(pluginStateDir(id,homeDir),OWNER_ONLY_DIR_MODE),tighten(`${pluginConfigDir(id,homeDir)}/.env`,OWNER_ONLY_FILE_MODE),tighten(pluginLogPath(id,homeDir),OWNER_ONLY_FILE_MODE)}function tightenInstalledPluginPermissions(homeDir){tighten(pluginsRootDir(homeDir),OWNER_ONLY_DIR_MODE),tighten(pluginRegistryPath(homeDir),OWNER_ONLY_FILE_MODE);for(let entry of loadPluginRegistry(homeDir).plugins)tightenPluginPermissions(entry.id,homeDir)}var STATUS_PRIORITY={busy:0,running:1,"needs-input":2,attention:3,unseen:4,idle:5},ACTIVITY_PRIORITY={running:STATUS_PRIORITY.running,dead:STATUS_PRIORITY.attention,error:STATUS_PRIORITY.attention,rate_limited:STATUS_PRIORITY.attention,permission_needed:STATUS_PRIORITY["needs-input"],turn_complete:STATUS_PRIORITY.unseen,idle:STATUS_PRIORITY.idle};function activityPriority(state){return ACTIVITY_PRIORITY[state]}var ATTENTION_STATES=new Set(["rate_limited","error","dead"]);function tabStatus(input){let session={alive:input.session?.alive??!1,restored:input.session?.restored??!1,tracked:input.activity!==void 0||input.pending!==void 0},a=input.activity;if(session.restored)return{kind:"attention",reason:"restored",since:a?.at??0,...session};if(a&&ATTENTION_STATES.has(a.state))return{kind:"attention",reason:a.state,since:a.at,state:a.state,...session};if(a?.state==="running")return{kind:"running",since:a.at,state:a.state,...session};if(a?.state==="permission_needed"&&!(input.answeredAt!==void 0&&input.answeredAt>=a.at))return{kind:"needs-input",since:a.at,state:a.state,...session};if(input.pending&&!input.viewed&&input.pending.state==="turn_complete")return{kind:"unseen",since:input.pending.at,...a?{state:a.state}:{},...session};return{kind:"idle",since:a?.at??0,...a?{state:a.state}:{},...session}}function taskStatus(tabs,extra={}){if(extra.deletion?.failed)return{kind:"attention",reason:"delete_failed",since:extra.deletion.at};if(extra.deletion)return{kind:"busy",reason:"deleting",since:extra.deletion.at};if(extra.job)return{kind:"busy",reason:"job",since:extra.job.at};let best={kind:"idle",since:0};for(let status of[...Object.values(tabs),...extra.tabless?[extra.tabless]:[]])if(STATUS_PRIORITY[status.kind]<STATUS_PRIORITY[best.kind]||status.kind===best.kind&&status.since>best.since)best={kind:status.kind,since:status.since,...status.reason?{reason:status.reason}:{},...status.state?{state:status.state}:{}};return best}function sameTaskStatus(a,b){return a!==void 0&&JSON.stringify(a)===JSON.stringify(b)}
|
|
3
|
+
export{tightenPluginPermissions,tightenInstalledPluginPermissions,activityPriority,tabStatus,taskStatus,sameTaskStatus};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{ensurePluginEnginesLoaded,loadPluginEngines,registeredEngineIds,reloadPluginEngines}from"./chunk-kdnk8m5j.js";import"./chunk-n0rdn2fn.js";import"./chunk-j1z9kgyd.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-96kvwzj8.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{reloadPluginEngines,registeredEngineIds,loadPluginEngines,ensurePluginEnginesLoaded};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{ensureGlobalRoveHooks,readStdinText,readTextWithTimeout,runHookSubcommand}from"./chunk-2y70y8na.js";import"./chunk-17e2tgyg.js";import"./chunk-2bgmby1d.js";import"./chunk-n0rdn2fn.js";import"./chunk-j1z9kgyd.js";import"./chunk-e58kj4gm.js";import"./chunk-0a65j1zj.js";import"./chunk-bcyex84w.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-2brn8e1y.js";import"./chunk-7mwvvj46.js";import"./chunk-32j6y5d1.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-91sykzqq.js";export{runHookSubcommand,readTextWithTimeout,readStdinText,ensureGlobalRoveHooks};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{failureHint}from"./chunk-nw092jak.js";import{errorMessage}from"./chunk-2brn8e1y.js";import"./chunk-mjyhy152.js";import"./chunk-wzss4pzh.js";import"./chunk-cmp64q4j.js";import"./chunk-91sykzqq.js";function debugEnabled(env){return env.ROVE_DEBUG==="1"||env.ROVE_DEBUG==="1"}function failureSubject(cliName,argv){let verb=argv[2];return verb&&!verb.startsWith("-")&&!verb.includes("/")?`${cliName} ${verb}`:cliName}function summarizeCliGitError(message,cwd){if(!/not a git repository/i.test(message))return null;return`${cwd} is not a git repository \u2014 run this inside one, or pass a repo path.`}function formatCliFailure(err,opts){let subject=failureSubject(opts.cliName,opts.argv);if(debugEnabled(opts.env))return`${subject}: ${String(err instanceof Error?err.stack??err:err)}
|
|
3
|
+
${failureHint(err,opts.cliName)}`;let raw=errorMessage(err),git=summarizeCliGitError(raw,opts.cwd);return`${subject}: ${git??`${raw}
|
|
4
|
+
${failureHint(err,opts.cliName)}`}`}export{summarizeCliGitError,formatCliFailure,failureSubject};
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{preferredReleaseChannel,rememberReleaseChannel}from"./chunk-
|
|
2
|
+
import{preferredReleaseChannel,rememberReleaseChannel}from"./chunk-m4z6kepz.js";import{updaterShell,updaterShellFailureHint}from"./chunk-xte4phd1.js";import"./chunk-tn9gtf18.js";import{BREAKING_VERSIONS,CURRENT_VERSION,DEFAULT_RELEASE_CHANNEL,RELEASE_CHANNELS,UPDATE_COMMAND,UPDATE_SCRIPT_URL,breakingVersionsCrossed,channelOf,checkLatestVersion,fetchReleaseSummaries,recommendedGlobalInstallCommand,updateCommandFor}from"./chunk-9ckvdy0j.js";import"./chunk-32j6y5d1.js";import"./chunk-bejhca6z.js";import"./chunk-br8r72bf.js";import"./chunk-yt15y085.js";import"./chunk-z1nj22va.js";import{ROVE_PRODUCT_NAME}from"./chunk-zt7wfnva.js";import"./chunk-eqdbfgq5.js";import"./chunk-f8gg8cqh.js";import"./chunk-nc46gddg.js";import{__require}from"./chunk-91sykzqq.js";import{spawnSync}from"child_process";var CLI_NAME=ROVE_PRODUCT_NAME;function updatePlan(target){let shell=updateCommandFor(target);return{command:updaterShell(),args:["-c",shell],display:shell}}var VERSION_SHAPE=/^\d+\.\d+\.\d+(-[0-9A-Za-z.-]+)?$/;function isReleaseChannel(value){return RELEASE_CHANNELS.includes(value)}var CHANNEL_FLAGS={"--nightly":"nightly","--next":"next","--stable":"latest","--latest":"latest",stable:"latest"};function parseUpdateArgs(args){let dryRun=!1,list=!1,version,channel;for(let i=0;i<args.length;i+=1){let arg=args[i];if(arg===void 0)continue;if(arg==="--help"||arg==="-h"||arg==="help")return{help:!0,dryRun,list,version,channel};if(arg==="dry-run"||arg==="--dry-run"){dryRun=!0;continue}if(arg==="list"||arg==="--list"){list=!0;continue}if(arg==="--channel"||arg.startsWith("--channel=")){let value=(arg.startsWith("--channel=")?arg.slice(10):void 0)??args[++i];if(value===void 0||!isReleaseChannel(value))process.stderr.write(`${CLI_NAME} update: --channel expects one of ${RELEASE_CHANNELS.join(", ")}${value===void 0?"":` (got "${value}")`}
|
|
3
3
|
|
|
4
4
|
`),printUsage(process.stderr),process.exit(2);channel=value;continue}let flagged=CHANNEL_FLAGS[arg];if(channel===void 0&&flagged!==void 0){channel=flagged;continue}if(channel===void 0&&isReleaseChannel(arg)){channel=arg;continue}if(version===void 0&&VERSION_SHAPE.test(arg)){version=arg;continue}process.stderr.write(`${CLI_NAME} update: unknown argument "${arg}"
|
|
5
5
|
|
|
6
|
-
`),printUsage(process.stderr),process.exit(2)}return{help:!1,dryRun,list,version,channel}}function printUsage(out){out.write([`Usage: ${CLI_NAME} update [version|channel|list|dry-run]`,"","Runs Rove's GitHub-hosted update script. With [version] (e.g.","0.7.90) the script installs that exact release instead of the","head of your channel.","","Verbs (--flag spellings also accepted):"," list Browse recent versions \u2014 a TUI page with release notes"," when interactive, plain text when piped"," dry-run Print the command without running it","","Flags:"," --nightly Install the nightly preview and stay on it"," --stable Go back to stable releases and stay there"," --channel <name> The same, by channel name. The bare name works"," too: `update
|
|
6
|
+
`),printUsage(process.stderr),process.exit(2)}return{help:!1,dryRun,list,version,channel}}function printUsage(out){out.write([`Usage: ${CLI_NAME} update [version|channel|list|dry-run]`,"","Runs Rove's GitHub-hosted update script. With [version] (e.g.","0.7.90) the script installs that exact release instead of the","head of your channel.","","Verbs (--flag spellings also accepted):"," list Browse recent versions \u2014 a TUI page with release notes"," when interactive, plain text when piped"," dry-run Print the command without running it","","Flags:"," --next Install the newest build of main and stay on it"," --nightly Install the nightly preview and stay on it"," --stable Go back to stable releases and stay there"," --channel <name> The same, by channel name. The bare name works"," too: `update next`","","Channels:"," latest Stable releases (default; also spelled `stable`)"," next Every merge to main \u2014 newest, gated by the fast checks only"," nightly Automated daily cut from main, behind the full suite","",`Running: ${channelOf()} build. Following: ${preferredReleaseChannel()}`,"","A channel you pick is remembered (state.json `update.channel`, also in","Settings \u2192 General), so a bare `update` and the update check follow it.","","Default command:",` ${UPDATE_COMMAND}`,"","Script URL:",` ${UPDATE_SCRIPT_URL}`,"","Manual fallback:",` ${recommendedGlobalInstallCommand()}`,"","Examples:",` ${CLI_NAME} update`,` ${CLI_NAME} update 0.7.90`,` ${CLI_NAME} update --nightly`,` ${CLI_NAME} update --stable`,` ${CLI_NAME} update list`,` ${CLI_NAME} update dry-run`,""].join(`
|
|
7
7
|
`))}async function printVersionList(io){let releases=await fetchReleaseSummaries(20);if(releases.length===0)io.stderr.write(`${CLI_NAME} update: could not fetch the release list (offline or rate-limited). Check your connection, then retry ${CLI_NAME} update list.
|
|
8
8
|
`),io.exit(1);for(let release of releases){let markers=[release.version===CURRENT_VERSION?"(current)":"",BREAKING_VERSIONS.includes(release.version)?`(breaking \u2014 needs \`${CLI_NAME} reset\`)`:""].filter(Boolean).join(" ");io.stdout.write(`${release.version}${markers?` ${markers}`:""}
|
|
9
9
|
`)}io.stdout.write(`
|
|
10
10
|
install one with: ${CLI_NAME} update <version>
|
|
11
11
|
`)}async function warnBreakingCrossings(target,channel,io){if(BREAKING_VERSIONS.length===0)return;let resolved=target??(await checkLatestVersion({force:!0,channel}))?.latest;if(!resolved)return;let crossed=breakingVersionsCrossed(CURRENT_VERSION,resolved);if(crossed.length===0)return;io.stderr.write([`warning: ${CURRENT_VERSION} -> ${resolved} crosses breaking version(s): ${crossed.join(", ")}.`,`After this update, Rove will refuse to start until you run \`${CLI_NAME} reset\``,"(worktrees are never touched; add --hard only to also wipe the task index).",""].join(`
|
|
12
12
|
`))}var FOLLOW_UP_NOTE=["",`${CLI_NAME}: installed. Two background processes are still running the old build:`,` daemon \u2192 \`${CLI_NAME} daemon restart\` (safe; never touches live sessions)`,` pty host \u2192 only \`${CLI_NAME} reset\` replaces it, and that ends every live`," terminal and engine session \u2014 do it when you can afford to.",`Run \`${CLI_NAME} doctor\` to see which of the two is actually stale.`,""].join(`
|
|
13
|
-
`);async function runUpdateSubcommand(args,deps){let io={spawn:deps?.spawn??spawnSync,stdout:deps?.stdout??process.stdout,stderr:deps?.stderr??process.stderr,exit:deps?.exit??((code)=>process.exit(code)),channel:deps?.channel??{get:()=>preferredReleaseChannel(),remember:rememberReleaseChannel}},parsed=parseUpdateArgs(args);if(parsed.help){printUsage(io.stdout);return}if(parsed.list){if(deps===void 0&&process.stdout.isTTY){let{startVersionsHost}=await import("./chunk-
|
|
13
|
+
`);async function runUpdateSubcommand(args,deps){let io={spawn:deps?.spawn??spawnSync,stdout:deps?.stdout??process.stdout,stderr:deps?.stderr??process.stderr,exit:deps?.exit??((code)=>process.exit(code)),channel:deps?.channel??{get:()=>preferredReleaseChannel(),remember:rememberReleaseChannel}},parsed=parseUpdateArgs(args);if(parsed.help){printUsage(io.stdout);return}if(parsed.list){if(deps===void 0&&process.stdout.isTTY){let{startVersionsHost}=await import("./chunk-d552cvb2.js");await startVersionsHost();return}await printVersionList(io);return}let channel=parsed.channel??io.channel.get(),target=parsed.version??(channel===DEFAULT_RELEASE_CHANNEL?void 0:channel),plan=updatePlan(target),switching=parsed.version===void 0&&channel!==channelOf();if(io.stdout.write(`${CLI_NAME} ${CURRENT_VERSION} -> ${target??channel}
|
|
14
14
|
`),switching)io.stdout.write(`switching channel: ${channelOf()} -> ${channel}
|
|
15
15
|
`);if(io.stdout.write(`running: ${plan.display}
|
|
16
16
|
`),await warnBreakingCrossings(parsed.version,channel,io),parsed.dryRun)return;let result=io.spawn(plan.command,plan.args,{stdio:"inherit"});if(result.error){io.stderr.write(`${CLI_NAME} update: failed to run ${plan.command}: ${result.error.message}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{JsonHookAdapter,editJsonSettings,hasRoveActivityHooks,removeRoveHooks,vendorConfigHome,vendorWriteHomeDeps}from"./chunk-8qkyd589.js";import{isObject}from"./chunk-7ghwdjdc.js";import{ROVE_PRODUCT_NAME}from"./chunk-zt7wfnva.js";import{__require}from"./chunk-91sykzqq.js";import{existsSync,readFileSync}from"fs";import{join as join2}from"path";import{join}from"path";var CLAUDE_HOOK_EVENT_MAP=[{event:"SessionStart",verb:"session-start"},{event:"UserPromptSubmit",verb:"turn-start"},{event:"Stop",verb:"turn-complete"},{event:"StopFailure",verb:"turn-failed"},{event:"Notification",matcher:"permission_prompt",verb:"awaiting-input"},{event:"Notification",matcher:"elicitation_dialog",verb:"awaiting-input"},{event:"SessionEnd",verb:"session-end"},{event:"PreCompact",verb:"pre-compact"},{event:"PostCompact",verb:"post-compact"},{event:"SubagentStart",verb:"subagent-start"},{event:"SubagentStop",verb:"subagent-stop"},{event:"PreToolUse",verb:"tool-pre"},{event:"PostToolUse",verb:"tool-post"},{event:"PostToolUseFailure",verb:"tool-failed"}],ROVE_HOOK_EVENTS=[...new Set(CLAUDE_HOOK_EVENT_MAP.map((e)=>e.event))];function failureFromErrorType(errorType){if(typeof errorType!=="string")return"other";if(errorType==="rate_limit"||errorType==="overloaded")return"rate_limit";if(errorType==="billing_error")return"billing";if(errorType==="server_error")return"transient";return"other"}function claudeSettingsPath(){return join(vendorConfigHome("claude"),"settings.json")}var WORKTREE_SYNC_VERB="worktree-created";function mergeWorktreeSyncHook(current,command){let{hooks:rawHooks,...restSettings}=current,{WorktreeCreate,...otherHooks}=isObject(rawHooks)?rawHooks:{},prior=Array.isArray(WorktreeCreate)?WorktreeCreate:[],kept=removeRoveHooks(prior,[WORKTREE_SYNC_VERB]);if(command!==null)kept.push({hooks:[{type:"command",command}]});let nextHooks={...otherHooks};if(kept.length>0)nextHooks.WorktreeCreate=kept;return Object.keys(nextHooks).length>0?{...restSettings,hooks:nextHooks}:{...restSettings}}class ClaudeHookAdapter extends JsonHookAdapter{vendor="claude";eventMap=CLAUDE_HOOK_EVENT_MAP;globalSettingsPath(){return claudeSettingsPath()}activityDetailFromPayload(kind,payload){if(kind==="turn-failed")return{failure:failureFromErrorType(payload.error_type)};if(kind==="awaiting-input")return{waiting:payload.notification_type==="elicitation_dialog"?"input":"permission"};if(kind==="tool-pre"||kind==="tool-post"||kind==="tool-failed")return{tool:{...typeof payload.tool_name==="string"?{name:payload.tool_name}:{},...typeof payload.tool_use_id==="string"?{id:payload.tool_use_id}:{}}};if(kind==="pre-compact"||kind==="post-compact")return{compact:{trigger:payload.trigger==="manual"?"manual":"auto"}};if(kind==="subagent-start"||kind==="subagent-stop")return{subagent:{...typeof payload.agent_type==="string"?{type:payload.agent_type}:{},...typeof payload.agent_id==="string"?{id:payload.agent_id}:{}}};return}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}:{}}}isUnattendedSession(env){return env.CLAUDE_CODE_SESSION_ATTENDED==="0"}async externallyManagedHooks(){let{isRovePluginEnabled,detectLegacyInstalls,migrationHint}=await import("./chunk-g4p5znv1.js");if(!isRovePluginEnabled())return;let notice=migrationHint(detectLegacyInstalls(),ROVE_PRODUCT_NAME);return notice?{notice}:{}}supportsWorktreeSync(){return!0}async removeWorktreeSyncHook(settingsFilePath){await editJsonSettings(settingsFilePath,(cur)=>mergeWorktreeSyncHook(cur,null))}}var PLUGIN_NAME="rove";function readSettings(path){try{let parsed=JSON.parse(readFileSync(path,"utf8"));return isObject(parsed)?parsed:null}catch{return null}}function isRovePluginEnabled(settingsFilePath=claudeSettingsPath()){let settings=readSettings(settingsFilePath);if(!settings||!isObject(settings.enabledPlugins))return!1;return Object.entries(settings.enabledPlugins).some(([key,on])=>on===!0&&key.split("@")[0]===PLUGIN_NAME)}function detectLegacyInstalls(opts={}){let settingsFilePath=opts.settingsFilePath??claudeSettingsPath(),settings=readSettings(settingsFilePath),legacyHooks=settings!==null&&(hasRoveActivityHooks(settings,CLAUDE_HOOK_EVENT_MAP)||settingsHasWorktreeWatch(settings)),skillDir=join2(vendorConfigHome("claude",vendorWriteHomeDeps(opts.home)),"skills","rove"),legacySkillDirs=existsSync(join2(skillDir,"SKILL.md"))?[skillDir]:[];return{legacyHooks,legacySkillDirs}}function settingsHasWorktreeWatch(settings){let hooks=isObject(settings.hooks)?settings.hooks:{};return Object.values(hooks).some((groups)=>Array.isArray(groups)&&groups.some((g)=>isObject(g)&&Array.isArray(g.hooks)&&g.hooks.some((h)=>isObject(h)&&typeof h.command==="string"&&h.command.includes("worktree-created")&&!h.command.includes("CLAUDE_PLUGIN_ROOT"))))}function migrationHint(findings,cliName){if(!findings.legacyHooks&&findings.legacySkillDirs.length===0)return null;let lines=[`${cliName}: the Rove Claude Code plugin is enabled, but legacy installs remain:`];if(findings.legacyHooks)lines.push(" \u2022 ~/.claude/settings.json still has the settings-managed Rove hooks (every event fires TWICE).",` Run \`${cliName} hook cleanup\` to remove them (only Rove's own entries are touched).`);for(let dir of findings.legacySkillDirs)lines.push(` \u2022 legacy skill copy at ${dir} (the plugin bundles the skill \u2014 two copies double-register).`," Remove that directory to keep the plugin's copy only.");return lines.push(" Reading this inside a session? Just ask your agent to run the cleanup for you."),`${lines.join(`
|
|
3
|
+
`)}
|
|
4
|
+
`}
|
|
5
|
+
export{isRovePluginEnabled,detectLegacyInstalls,migrationHint,ClaudeHookAdapter};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{ulid}from"./chunk-qkehg2c1.js";import{acquireWithRetry,mergeTasksWithDisk,readDiskIndex,recoverIndexFromDisk}from"./chunk-
|
|
2
|
+
import{ulid}from"./chunk-qkehg2c1.js";import{acquireWithRetry,mergeTasksWithDisk,readDiskIndex,recoverIndexFromDisk}from"./chunk-hz1x3hak.js";import{DEFAULT_TASK_VENDOR,toTaskId}from"./chunk-xy8be792.js";import{release}from"./chunk-bejhca6z.js";import{ROVE_STATE_DIR_BASENAME}from"./chunk-zt7wfnva.js";import{preRenameStateDir}from"./chunk-f8gg8cqh.js";import{readRoveHomeDirEnv}from"./chunk-nc46gddg.js";import{mkdir,open,rename,unlink}from"fs/promises";import{homedir}from"os";import{dirname,join}from"path";var CURRENT_VERSION=3;class TaskIndexStore{homeDir;roveDir;path;legacyPath;lockPath;cache={version:CURRENT_VERSION,tasks:[]};loaded=!1;listeners=new Set;saveChain=Promise.resolve();dirtyIds=new Set;removedIds=new Map;constructor(options={}){this.homeDir=options.homeDir??readRoveHomeDirEnv()??homedir(),this.roveDir=join(this.homeDir,ROVE_STATE_DIR_BASENAME),this.path=join(this.roveDir,"tasks.json"),this.legacyPath=join(preRenameStateDir(this.homeDir),"tasks.json"),this.lockPath=`${this.path}.lock`}subscribe(listener){if(this.listeners.add(listener),this.loaded)try{listener(this.cache.tasks.slice())}catch(err){console.error("[rove TaskIndexStore] listener threw on subscribe:",err)}return()=>{this.listeners.delete(listener)}}get filePath(){return this.path}get stateDir(){return this.roveDir}async load(){return this.dirtyIds.clear(),this.removedIds.clear(),this.cache=await recoverIndexFromDisk(this.path,this.legacyPath),this.loaded=!0,this.notifyListeners(),this.snapshot()}async save(){this.assertLoaded();let next=this.saveChain.then(()=>this.doSave());return this.saveChain=next.catch(()=>{}),next}async saveOrRollback(id,undo){try{await this.save()}catch(err){if(undo())this.dirtyIds.delete(id),this.notifyListeners();throw err}}async doSave(){await mkdir(dirname(this.path),{recursive:!0});let dirty=new Set(this.dirtyIds),removed=new Map(this.removedIds),lockToken=await acquireWithRetry(this.lockPath),cacheChanged=!1;try{let disk=await readDiskIndex(this.path,this.legacyPath),merged=mergeTasksWithDisk(this.cache.tasks,disk.tasks,dirty,removed,disk.removed),payload={version:CURRENT_VERSION,tasks:merged.tasks,...merged.removed.length>0?{removed:merged.removed}:{}},json=`${JSON.stringify(payload)}
|
|
3
3
|
`,tmpPath=`${this.path}.${process.pid}.${ulid()}.tmp`;try{let handle=await open(tmpPath,"w",384);try{await handle.writeFile(json,"utf8"),await handle.sync()}finally{await handle.close()}await rename(tmpPath,this.path)}catch(err){throw await unlink(tmpPath).catch(()=>{}),err}for(let id of dirty)this.dirtyIds.delete(id);for(let id of removed.keys())this.removedIds.delete(id);let present=new Set(this.cache.tasks.map((t)=>t.id));for(let task of merged.tasks){if(present.has(task.id))continue;this.cache.tasks.push(task),cacheChanged=!0}let tombstoned=new Set(merged.removed.map((t)=>t.id));if(tombstoned.size>0)for(let i=this.cache.tasks.length-1;i>=0;i--){let entry=this.cache.tasks[i];if(!entry||!tombstoned.has(entry.id))continue;this.cache.tasks.splice(i,1),cacheChanged=!0}}finally{await release(this.lockPath,lockToken).catch((err)=>{console.error("[rove TaskIndexStore] index lock release failed:",err)})}if(cacheChanged)this.notifyListeners()}get(id){return this.assertLoaded(),this.cache.tasks.find((t)=>t.id===id)}list(){return this.assertLoaded(),this.cache.tasks.slice()}async create(partial){this.assertLoaded();let now=new Date().toISOString(),task={vendor:partial.vendor??DEFAULT_TASK_VENDOR,...partial,id:toTaskId(ulid()),createdAt:now,updatedAt:now};return this.cache.tasks.push(task),this.dirtyIds.add(task.id),await this.saveOrRollback(task.id,()=>{let at=this.cache.tasks.indexOf(task);if(at<0)return!1;return this.cache.tasks.splice(at,1),!0}),this.notifyListeners(),task}async update(id,patch){this.assertLoaded();let idx=this.cache.tasks.findIndex((t)=>t.id===id);if(idx<0)throw Error(`task not found: ${id}`);let existing=this.cache.tasks[idx];if(!existing)throw Error(`task not found: ${id}`);let{id:_id,createdAt:_createdAt,...mutable}=patch,next={...existing,...mutable,id:existing.id,createdAt:existing.createdAt,updatedAt:new Date().toISOString()};return this.cache.tasks[idx]=next,this.dirtyIds.add(String(id)),await this.saveOrRollback(String(id),()=>{let at=this.cache.tasks.indexOf(next);if(at<0)return!1;return this.cache.tasks[at]=existing,!0}),this.notifyListeners(),next}async move(id,delta,withinIds){this.assertLoaded();let task=this.cache.tasks.find((t)=>t.id===id);if(!task)throw Error(`task not found: ${id}`);let ids=withinIds?.length?withinIds:this.cache.tasks.map((t)=>t.id),pos=ids.indexOf(String(id));if(pos<0)throw Error(`task not movable in current group: ${id}`);let targetId=ids[pos+delta];if(!targetId)return task;let fromIdx=this.cache.tasks.findIndex((t)=>t.id===id),toIdx=this.cache.tasks.findIndex((t)=>t.id===targetId);if(fromIdx<0||toIdx<0||fromIdx===toIdx)return task;let[moved]=this.cache.tasks.splice(fromIdx,1);if(!moved)return task;let adjustedToIdx=fromIdx<toIdx?toIdx-1:toIdx,insertAt=delta>0?adjustedToIdx+1:adjustedToIdx,next={...moved,updatedAt:new Date().toISOString()};return this.cache.tasks.splice(insertAt,0,next),this.dirtyIds.add(String(id)),await this.saveOrRollback(String(id),()=>{let at=this.cache.tasks.indexOf(next);if(at<0)return!1;return this.cache.tasks.splice(at,1),this.cache.tasks.splice(Math.min(fromIdx,this.cache.tasks.length),0,moved),!0}),this.notifyListeners(),next}async moveToFront(id,withinIds){this.assertLoaded();let task=this.cache.tasks.find((t)=>t.id===id);if(!task)throw Error(`task not found: ${id}`);if(!withinIds.includes(String(id)))throw Error(`task not movable in current group: ${id}`);if(withinIds[0]===String(id))return task;let fromIdx=this.cache.tasks.indexOf(task),toIdx=this.cache.tasks.findIndex((t)=>t.id===withinIds[0]),next={...task,updatedAt:new Date().toISOString()};return this.cache.tasks.splice(fromIdx,1),this.cache.tasks.splice(toIdx,0,next),this.dirtyIds.add(String(id)),await this.saveOrRollback(String(id),()=>{let at=this.cache.tasks.indexOf(next);if(at<0)return!1;return this.cache.tasks.splice(at,1),this.cache.tasks.splice(Math.min(fromIdx,this.cache.tasks.length),0,task),!0}),this.notifyListeners(),next}async remove(id){this.assertLoaded();let idx=this.cache.tasks.findIndex((t)=>t.id===id),removed=this.cache.tasks[idx];if(idx<0||!removed)return!1;return this.cache.tasks.splice(idx,1),this.dirtyIds.delete(String(id)),this.removedIds.set(String(id),new Date().toISOString()),await this.saveOrRollback(String(id),()=>{if(this.cache.tasks.some((t)=>t.id===removed.id))return!1;return this.removedIds.delete(String(id)),this.cache.tasks.splice(Math.min(idx,this.cache.tasks.length),0,removed),!0}),this.notifyListeners(),!0}async _unlinkForTests(){try{await unlink(this.path)}catch(err){if(err.code!=="ENOENT")throw err}this.cache={version:CURRENT_VERSION,tasks:[]},this.loaded=!1,this.dirtyIds.clear(),this.removedIds.clear()}assertLoaded(){if(!this.loaded)throw Error("TaskIndexStore: call load() before any other method")}snapshot(){return{version:CURRENT_VERSION,tasks:this.cache.tasks.slice()}}notifyListeners(){if(this.listeners.size===0)return;let snapshot=this.cache.tasks.slice();for(let listener of this.listeners)try{listener(snapshot)}catch(err){console.error("[rove TaskIndexStore] listener threw on notify:",err)}}}
|
|
4
4
|
export{TaskIndexStore};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{quoteShellArgv}from"./chunk-7kysxgbq.js";import{acquireWithRetry}from"./chunk-hz1x3hak.js";import{isObject}from"./chunk-7ghwdjdc.js";import{acquireSync,release,releaseSync}from"./chunk-bejhca6z.js";import{roveStateDir}from"./chunk-z1nj22va.js";import{ROVE_PRODUCT_NAME}from"./chunk-zt7wfnva.js";import{fileURLToPath}from"url";function roveCliInvocation(){let cliName=ROVE_PRODUCT_NAME;if(import.meta.url.endsWith(".js"))return[cliName];let entry=fileURLToPath(new URL(`./${"rove.ts"}`,import.meta.url));return[process.execPath,"--conditions=browser",entry]}function roveHookInvocation(){if(import.meta.url.endsWith(".js"))return[ROVE_PRODUCT_NAME];if(Bun.which(ROVE_PRODUCT_NAME))return[ROVE_PRODUCT_NAME];return roveCliInvocation()}var ROVE_HOOK_VERSION=1;function roveHookArgs(vendor){return["--engine",vendor,"--hook-version",String(ROVE_HOOK_VERSION)]}var GATED_TOOL_VERBS=new Set(["tool-pre","tool-post","tool-failed"]);function parseHookSettings(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,groups]of Object.entries(parsed.hooks)){if(!Array.isArray(groups))return{ok:!1,reason:`"hooks.${event}" is not an array`};let bad=groups.findIndex((group)=>!isObject(group)||!Array.isArray(group.hooks));if(bad>=0)return{ok:!1,reason:`"hooks.${event}[${bad}]" is not an object with a "hooks" array`}}return{ok:!0,doc:parsed}}var HOOK_WORD=String.raw`(?:'(?:[^']|'\\'')*'|"[^"$\x60\\]*"|[A-Za-z0-9_./:=+-]+)`,HOOK_ARGV=new RegExp(`^${HOOK_WORD}(?:[ ]+${HOOK_WORD})*$`),ROVE_HOOK_FLAGS={"--engine":/^[a-z][a-z0-9-]*$/,"--hook-version":/^\d+$/};function isRoveHook(hook,verbs){if(!isObject(hook)||typeof hook.command!=="string")return!1;if(hook.type!==void 0&&hook.type!=="command")return!1;let command=hook.command.replace(/^[ \t]+|[ \t]+$/g,"");if(HOOK_ARGV.exec(command)?.[0]!==command)return!1;let argv=(command.match(new RegExp(HOOK_WORD,"g"))??[]).map((word)=>{if(word.startsWith("'"))return word.slice(1,-1).replaceAll("'\\''","'");if(word.startsWith('"'))return word.slice(1,-1);return word}),executable=argv[0]?.split("/").at(-1),offset=1;if(executable==="bun"||executable==="node"){if(argv[offset]==="--conditions=browser")offset++;let entry=argv[offset]??"";if(!/(?:^|\/)(?:src|dist)\/cli\/(?:rove|rove)\.(?:ts|js)$/.test(entry))return!1;offset++}else if(executable!=="rove"&&executable!=="rove")return!1;if(argv[offset]!=="hook"||!verbs.includes(argv[offset+1]))return!1;let rest=argv.slice(offset+2);for(let i=0;i<rest.length;i+=2){let value=rest[i+1],pattern=ROVE_HOOK_FLAGS[rest[i]??""];if(!pattern||value===void 0||!pattern.test(value))return!1}return!0}function removeRoveHooks(groups,verbs){return groups.flatMap((group)=>{if(!isObject(group)||!Array.isArray(group.hooks))return[group];let kept=group.hooks.filter((hook)=>!isRoveHook(hook,verbs));if(kept.length===group.hooks.length)return[group];return kept.length>0?[{...group,hooks:kept}]:[]})}function hasRoveActivityHooks(current,eventMap){let verbs=eventMap.map((spec)=>spec.verb),hooks=isObject(current.hooks)?current.hooks:{};return Object.values(hooks).some((groups)=>Array.isArray(groups)&&groups.some((group)=>isObject(group)&&Array.isArray(group.hooks)&&group.hooks.some((hook)=>isRoveHook(hook,verbs))))}function hookCommandQuoting(platform=process.platform){return{bareSafe:!0,windows:platform==="win32"}}function buildActivityHooks(eventMap,inv=roveHookInvocation(),opts={}){let out={},quoting=hookCommandQuoting();for(let spec of eventMap){if(opts.buildFilter&&!opts.buildFilter(spec))continue;let{event,matcher,verb}=spec,group={hooks:[{type:"command",command:quoteShellArgv([...inv,"hook",verb,...opts.extraArgs??[]],quoting)}]};if(matcher)group.matcher=matcher;let previous=out[event],groups=Array.isArray(previous)?previous:[];groups.push(group),out[event]=groups}return out}function mergeActivityHooks(current,install,eventMap,inv=roveHookInvocation(),opts={}){let verbs=eventMap.map((spec)=>spec.verb),{hooks:rawHooks,...restSettings}=current,hooks=isObject(rawHooks)?{...rawHooks}:{},built=install?buildActivityHooks(eventMap,inv,opts):{};for(let{event}of eventMap){let groups=hooks[event],prior=Array.isArray(groups)?groups:[],kept=removeRoveHooks(prior,verbs),additions=built[event];if(install&&Array.isArray(additions))kept.push(...additions);if(kept.length>0)hooks[event]=kept;else delete hooks[event]}return Object.keys(hooks).length>0?{...restSettings,hooks}:{...restSettings}}var RETIRED_WATCH_EVENT="PostToolUse";function removeWorktreeWatchHook(current){let{hooks:rawHooks,...restSettings}=current,hooks=isObject(rawHooks)?{...rawHooks}:{},groups=hooks[RETIRED_WATCH_EVENT],prior=Array.isArray(groups)?groups:[],kept=removeRoveHooks(prior,["worktree-created"]);if(kept.length>0)hooks[RETIRED_WATCH_EVENT]=kept;else delete hooks[RETIRED_WATCH_EVENT];return Object.keys(hooks).length>0?{...restSettings,hooks}:{...restSettings}}import{existsSync}from"fs";import{homedir}from"os";import path from"path";var VENDOR_HOMES={claude:{envVar:"CLAUDE_CONFIG_DIR",dirName:".claude"},codex:{envVar:"CODEX_HOME",dirName:".codex"},copilot:{envVar:"COPILOT_HOME",dirName:".copilot"},kimi:{envVar:"KIMI_CODE_HOME",dirName:".kimi-code"}},AGENT_DIR_VENDORS={pi:{envVar:"PI_CODING_AGENT_DIR",dirName:".pi"},omp:{envVar:"PI_CODING_AGENT_DIR",dirName:".omp"}},defaultVendorHomeDeps={env:(name)=>process.env[name],home:()=>homedir()};function vendorWriteHomeDeps(home){return home===void 0?defaultVendorHomeDeps:{env:()=>{return},home:()=>home}}function vendorConfigHome(vendor,deps=defaultVendorHomeDeps){let{envVar,dirName}=VENDOR_HOMES[vendor],override=deps.env(envVar)?.trim();if(override)return override;return path.join(deps.home(),dirName)}function vendorAgentDir(vendor,deps=defaultVendorHomeDeps){let{envVar,dirName}=AGENT_DIR_VENDORS[vendor],override=deps.env(envVar)?.trim();if(override)return override;return path.join(deps.home(),dirName,"agent")}function depsOf(env,home){return{env,home:()=>home}}function claudeGlobalConfigPath(env,home){let override=env("CLAUDE_CONFIG_DIR")?.trim();if(override)return path.join(override,".claude.json");return path.join(home,".claude.json")}function codexAuthPath(env,home){return path.join(vendorConfigHome("codex",depsOf(env,home)),"auth.json")}function copilotConfigPath(env,home){return path.join(vendorConfigHome("copilot",depsOf(env,home)),"config.json")}function bobHome(home=homedir()){return path.join(home,".bob")}function bobTrustPath(home){return path.join(bobHome(home),"trustedFolders.json")}function bobDbPath(home){return path.join(bobHome(home),"db","bob.db")}function bobAuthSecretsPath(home){return path.join(bobHome(home),"settings","auth-secrets.json")}function kimiCredentialsPath(env,home){return path.join(vendorConfigHome("kimi",depsOf(env,home)),"credentials","kimi-code.json")}function skillsDirUnder(root,sub="skills"){return existsSync(root)?path.join(root,sub):null}function xdgConfigHome(home=homedir()){return process.env.XDG_CONFIG_HOME?.trim()||path.join(home,".config")}import{constants,closeSync,fstatSync,openSync,readSync}from"fs";import{open}from"fs/promises";var MAX_ENGINE_FILE_BYTES=104857600,MAX_JSONL_LINE_CHARS=8388608,READ_CHUNK_BYTES=65536,READ_FLAGS=constants.O_RDONLY|constants.O_NONBLOCK;async function readTextFileIfRegular(p,maxBytes=MAX_ENGINE_FILE_BYTES){let file=await open(p,READ_FLAGS);try{let info=await file.stat();if(!info.isFile()||info.size>maxBytes)return null;let chunks=[],total=0;while(total<=maxBytes){let buffer=Buffer.allocUnsafe(Math.min(READ_CHUNK_BYTES,maxBytes+1-total)),{bytesRead}=await file.read(buffer);if(bytesRead===0)return Buffer.concat(chunks,total).toString("utf8");chunks.push(buffer.subarray(0,bytesRead)),total+=bytesRead}return null}finally{await file.close()}}async function readTextFileBounded(p,maxBytes=MAX_ENGINE_FILE_BYTES){return await readTextFileIfRegular(p,maxBytes)??""}async function readFirstLineBounded(p,maxBytes=MAX_JSONL_LINE_CHARS){let file=await open(p,READ_FLAGS);try{if(!(await file.stat()).isFile())return"";let chunks=[],total=0,start=0,nonblank=!1;while(total<=maxBytes){let buffer=Buffer.allocUnsafe(Math.min(16384,maxBytes+1-total)),{bytesRead}=await file.read(buffer);if(!bytesRead)return Buffer.concat(chunks,total).subarray(start).toString("utf8");chunks.push(buffer.subarray(0,bytesRead));let segment=0;for(let i=0;i<bytesRead;i++){if(buffer[i]!==10)continue;nonblank||=buffer.subarray(segment,i).toString("utf8").trim().length>0;let end=total+i;if(end>maxBytes)return"";if(nonblank)return Buffer.concat(chunks,total+bytesRead).subarray(start,end).toString("utf8");start=end+1,segment=i+1}nonblank||=buffer.subarray(segment,bytesRead).toString("utf8").trim().length>0,total+=bytesRead}return""}finally{await file.close()}}function readTextFileSyncBounded(p,maxBytes=MAX_ENGINE_FILE_BYTES){try{return readTextFileIfRegularSync(p,maxBytes)}catch(err){if(err instanceof Error&&"code"in err&&err.code==="ENOENT")return null;throw err}}function readTextFileIfRegularSync(p,maxBytes=MAX_ENGINE_FILE_BYTES){let fd=openSync(p,READ_FLAGS);try{let info=fstatSync(fd);if(!info.isFile()||info.size>maxBytes)return null;let chunks=[],total=0;while(total<=maxBytes){let buffer=Buffer.allocUnsafe(Math.min(READ_CHUNK_BYTES,maxBytes+1-total)),bytesRead=readSync(fd,buffer);if(!bytesRead)return Buffer.concat(chunks,total).toString("utf8");chunks.push(buffer.subarray(0,bytesRead)),total+=bytesRead}return null}finally{closeSync(fd)}}function isJsonlLineWithinBound(line,maxChars=MAX_JSONL_LINE_CHARS){return line.length<=maxChars}import{createHash,randomBytes}from"crypto";import{mkdirSync,renameSync,unlinkSync,writeFileSync}from"fs";import{mkdir,rename,unlink,writeFile}from"fs/promises";import{dirname,join}from"path";var MAX_SHARED_CONFIG_BYTES=8388608;function stagingPath(file){return`${file}.rove-${process.pid}-${randomBytes(6).toString("hex")}.tmp`}function sharedConfigLockPath(file){return join(roveStateDir(),`shared-config-${createHash("sha256").update(file).digest("hex").slice(0,16)}.lock`)}var MAX_ATTEMPTS=5;function readSharedConfigSync(file){try{let raw=readTextFileIfRegularSync(file,MAX_SHARED_CONFIG_BYTES);if(raw===null)throw Error(`Refusing non-regular or oversized config: ${file}`);return raw}catch(err){if(err instanceof Error&&"code"in err&&err.code==="ENOENT")return;throw err}}async function readRaw(file){try{let raw=await readTextFileIfRegular(file,MAX_SHARED_CONFIG_BYTES);if(raw===null)throw Error(`Refusing non-regular or oversized config: ${file}`);return raw}catch(err){if(err instanceof Error&&"code"in err&&err.code==="ENOENT")return;throw err}}function updateSharedJsonSync(file,load,build){let lockPath=sharedConfigLockPath(file),lockToken=acquireSync(lockPath);try{for(let attempt=0;attempt<MAX_ATTEMPTS;attempt++){let before=readSharedConfigSync(file),doc=load(before);if(!doc)return;let text=build(doc);if(text===void 0)return;let tmp=stagingPath(file);try{if(mkdirSync(dirname(file),{recursive:!0}),writeFileSync(tmp,text,{mode:384,flag:"wx"}),readSharedConfigSync(file)===before){renameSync(tmp,file);return}}finally{try{unlinkSync(tmp)}catch{}}}throw Error(`gave up updating ${file} after ${MAX_ATTEMPTS} concurrent writes`)}finally{releaseSync(lockPath,lockToken)}}async function updateSharedJson(file,load,build){let lockPath=sharedConfigLockPath(file),lockToken=await acquireWithRetry(lockPath);try{for(let attempt=0;attempt<MAX_ATTEMPTS;attempt++){let before=await readRaw(file),doc=load(before);if(!doc)return;let text=build(doc);if(text===void 0)return;let tmp=stagingPath(file);try{if(await mkdir(dirname(file),{recursive:!0}),await writeFile(tmp,text,{mode:384,flag:"wx"}),await readRaw(file)===before){await rename(tmp,file);return}}finally{await unlink(tmp).catch(()=>{})}}throw Error(`gave up updating ${file} after ${MAX_ATTEMPTS} concurrent writes`)}finally{await release(lockPath,lockToken)}}async function editJsonSettings(settingsFilePath,transform,parse=parseHookSettings){let rejected;try{await updateSharedJson(settingsFilePath,(raw)=>{let parsed=parse(raw);if(parsed.ok)return parsed.doc;rejected=parsed.reason;return},(current)=>{let next=transform(current),json=JSON.stringify(next,null,2);return json===JSON.stringify(current,null,2)?void 0:`${json}
|
|
3
|
+
`})}catch(err){return{ok:!1,file:settingsFilePath,reason:err instanceof Error?err.message:String(err)}}if(rejected!==void 0)return{ok:!1,file:settingsFilePath,reason:rejected};return{ok:!0}}class JsonHookAdapter{supportsHooks(){return!0}activityDetailFromPayload(_kind,_payload){return}sessionFromPayload(_payload){return}supportsWorktreeSync(){return!1}async removeWorktreeSyncHook(_settingsFilePath){}gatedVerbs(){return GATED_TOOL_VERBS}async installActivityHooks(settingsFilePath,opts={}){let gated=this.gatedVerbs(),outcome=await editJsonSettings(settingsFilePath,(cur)=>mergeActivityHooks(cur,!0,this.eventMap,void 0,{extraArgs:roveHookArgs(this.vendor),buildFilter:(spec)=>opts.toolEvents===!0||!gated.has(spec.verb)}));if(!outcome.ok&&!opts.quiet)process.stderr.write(`[rove hooks] ${this.vendor}: skipped ${outcome.file}: ${outcome.reason}
|
|
4
|
+
`);return outcome}async removeActivityHooks(settingsFilePath){await editJsonSettings(settingsFilePath,(cur)=>mergeActivityHooks(cur,!1,this.eventMap))}async removeWorktreeWatchHook(settingsFilePath){await editJsonSettings(settingsFilePath,removeWorktreeWatchHook)}hookConfigRefusal(raw){let parsed=parseHookSettings(raw);return parsed.ok?void 0:parsed.reason}}
|
|
5
|
+
export{roveCliInvocation,roveHookInvocation,ROVE_HOOK_VERSION,roveHookArgs,GATED_TOOL_VERBS,isRoveHook,removeRoveHooks,hasRoveActivityHooks,hookCommandQuoting,readTextFileIfRegular,readTextFileBounded,readFirstLineBounded,readTextFileSyncBounded,isJsonlLineWithinBound,readSharedConfigSync,updateSharedJsonSync,updateSharedJson,editJsonSettings,JsonHookAdapter,vendorWriteHomeDeps,vendorConfigHome,vendorAgentDir,claudeGlobalConfigPath,codexAuthPath,copilotConfigPath,bobHome,bobTrustPath,bobDbPath,bobAuthSecretsPath,kimiCredentialsPath,skillsDirUnder,xdgConfigHome};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{isDev}from"./chunk-z1nj22va.js";import{fileURLToPath}from"url";var package_default={$schema:"https://json.schemastore.org/package.json",name:"@sma1lboy/rove",version:"0.9.276",description:"Rove \u2014 the agent multiplexer for your terminal. Run coding agents on parallel tasks with isolated worktrees and persistent sessions.",keywords:["terminal","tui","cli","multiplexer","ai-agents","coding-agent","ai-coding-assistant","agentic-ai","parallel-agents","git-worktree","claude-code","codex","llm","developer-tools"],type:"module",packageManager:"bun@1.3.13",bin:{rove:"dist/cli/rove.js"},files:["dist/cli","dist/completions","dist/web","dist/web-ui","dist/skills","dist/*.wav","README.md","LICENSE"],publishConfig:{access:"public"},repository:{type:"git",url:"git+https://github.com/Sma1lboy/rove.git"},homepage:"https://rove.run",bugs:{url:"https://github.com/Sma1lboy/rove/issues"},engines:{bun:">=1.3.11"},scripts:{dev:"ROVE_DEV=1 bun --conditions=browser ./src/cli/rove.ts","dev:mock":"ROVE_DEV=1 bun ./src/tui-react/mock/host.tsx","dev:sandbox":"bun run scripts/dev-sandbox.ts run","dev:sandbox:reset":"bun run scripts/dev-sandbox.ts reset",build:"bun run scripts/build.ts","build:rubric":"bun run scripts/build-tier-rubric.ts",compile:"bun run scripts/compile.ts",typecheck:"tsc --noEmit","check-i18n":"bun run scripts/check-i18n.ts",test:"bun run test:fast && bun run test:socket","perf:golden":"bun scripts/perf-golden.ts","pty:soak":"bun scripts/pty-soak.ts","test:fast":"vitest run --passWithNoTests --minWorkers=1 --maxWorkers=8","test:socket":"ROVE_INCLUDE_SOCKET=1 vitest run test/daemon --pool forks --minWorkers=1 --maxWorkers=4 --passWithNoTests","test:socket:coverage":"ROVE_INCLUDE_SOCKET=1 ROVE_COVERAGE_DAEMON=1 vitest run test/daemon --coverage --pool forks --minWorkers=1 --maxWorkers=4 --passWithNoTests","test:behavior":"ROVE_INCLUDE_BEHAVIOR=1 vitest run test/behavior --pool forks --minWorkers=1 --maxWorkers=1 --retry=2 --passWithNoTests","test:render":"bun scripts/render-track.mjs",coverage:"vitest run --coverage --passWithNoTests",bench:"vitest bench --run",lint:"biome check .",knip:"knip-bun",postinstall:"bun run scripts/check-preview-deps.ts || true",prepublishOnly:"bun run typecheck && bun run build","plugin-sandbox":"bun run scripts/plugin-sandbox.ts"},"//":"biome.json + bunfig.toml live at the monorepo root since they apply repo-wide; bun.lock also lives at root (workspace-shared).",dependencies:{"@ansi-tools/parser":"^1.0.15","@opentui/core":"0.4.3","@opentui/react":"0.4.3","@xterm/addon-serialize":"^0.14.0","@xterm/addon-unicode11":"^0.9.0","@xterm/headless":"^6.0.0",react:"^19.2.8","smol-toml":"^1.7.1",ws:"^8.21.3"},optionalDependencies:{"node-pty":"^1.1.0"},devDependencies:{"@biomejs/biome":"1.9.4","@sma1lboy/rove-daemon":"0.7.23","@tsconfig/bun":"1.0.11","@types/bun":"1.3.14","@types/node":"25.6.2","@types/react":"^19.2.0","@vitest/coverage-v8":"2.1.9",knip:"^6.14.2","react-devtools-core":"^7.0.1","rove-bridge":"0.0.37","rove-weixin":"0.0.37",typescript:"5.8.2",vitest:"2.1.9"},trustedDependencies:[]};var CURRENT_VERSION=package_default.version,PACKAGE_NAME=package_default.name;function repoSlug(){let url=package_default.repository?.url;if(!url)return null;let m=url.match(/github\.com[:/]([^/]+)\/([^/.]+)/);if(!m||!m[1]||!m[2])return null;return`${m[1]}/${m[2]}`}var UPDATE_SCRIPT_URL="https://raw.githubusercontent.com/Sma1lboy/rove/main/scripts/update.sh",UPDATE_COMMAND=`curl -fsSL ${UPDATE_SCRIPT_URL} | sh`;function updateCommandFor(target){return target===void 0||target===DEFAULT_RELEASE_CHANNEL?UPDATE_COMMAND:`${UPDATE_COMMAND} -s -- ${target}`}function owningNpmPrefix(modulePath=fileURLToPath(import.meta.url)){let at=modulePath.indexOf("/lib/node_modules/");if(at<=0)return null;return modulePath.slice(0,at)}function recommendedGlobalInstallCommand(prefix=owningNpmPrefix()){let target=`${PACKAGE_NAME}@latest`;return prefix===null?`npm install -g ${target}`:`npm install -g --prefix ${prefix} ${target}`}var BREAKING_VERSIONS=[];function breakingVersionsCrossed(from,to,breaking=BREAKING_VERSIONS){let[lo,hi]=compareSemver(from,to)<=0?[from,to]:[to,from];return breaking.filter((b)=>compareSemver(b,lo)>0&&compareSemver(b,hi)<=0)}var FETCH_TIMEOUT_MS=3000,PACKUMENT_TIMEOUT_MS=15000,RELEASE_CHANNELS=["latest","next","nightly"],DEFAULT_RELEASE_CHANNEL="latest";function channelOf(version=CURRENT_VERSION){let tag=prereleaseOf(version)?.split(".")[0];return tag==="nightly"||tag==="next"?tag:DEFAULT_RELEASE_CHANNEL}async function fetchLatestFromRegistry(packageName,channel){let ctrl=new AbortController,timer=setTimeout(()=>ctrl.abort(),FETCH_TIMEOUT_MS);try{let encoded=packageName.replace("/","%2F"),res=await fetch(`https://registry.npmjs.org/${encoded}/${channel}`,{signal:ctrl.signal,headers:{accept:"application/json"}});if(!res.ok)return null;let body=await res.json();if(typeof body.version!=="string")return null;return body.version}catch{return null}finally{clearTimeout(timer)}}async function fetchPublishedAt(packageName,version){let ctrl=new AbortController,timer=setTimeout(()=>ctrl.abort(),PACKUMENT_TIMEOUT_MS);try{let encoded=packageName.replace("/","%2F"),res=await fetch(`https://registry.npmjs.org/${encoded}`,{signal:ctrl.signal,headers:{accept:"application/json"}});if(!res.ok)return null;let stamp=(await res.json()).time?.[version],ms=typeof stamp==="string"?Date.parse(stamp):Number.NaN;return Number.isFinite(ms)?ms:null}catch{return null}finally{clearTimeout(timer)}}function isNewerSemver(latest,current){let core=compareSemver(latest,current);if(core!==0)return core>0;return comparePrerelease(prereleaseOf(latest),prereleaseOf(current))>0}function prereleaseOf(version){let dash=version.indexOf("-");return dash===-1?void 0:version.slice(dash+1)||void 0}function comparePrerelease(a,b){if(a===b)return 0;if(a===void 0)return 1;if(b===void 0)return-1;let aParts=a.split("."),bParts=b.split(".");for(let i=0;i<Math.max(aParts.length,bParts.length);i++){let av=aParts[i],bv=bParts[i];if(av===void 0)return-1;if(bv===void 0)return 1;if(av===bv)continue;let an=/^\d+$/.test(av)?Number.parseInt(av,10):null,bn=/^\d+$/.test(bv)?Number.parseInt(bv,10):null;if(an!==null&&bn!==null)return an>bn?1:-1;if(an!==null)return-1;if(bn!==null)return 1;return av>bv?1:-1}return 0}function compareSemver(aVersion,bVersion){let norm=(v)=>v.split("-")[0]??v,a=norm(aVersion).split(".").map((s)=>Number.parseInt(s,10)),b=norm(bVersion).split(".").map((s)=>Number.parseInt(s,10));for(let i=0;i<3;i++){let av=a[i]??0,bv=b[i]??0;if(Number.isNaN(av)||Number.isNaN(bv))return 0;if(av>bv)return 1;if(av<bv)return-1}return 0}async function checkLatestVersion(opts={}){let channel=opts.channel??channelOf(),fake=process.env.ROVE_FAKE_UPDATE;if(fake)return{current:CURRENT_VERSION,latest:fake,hasUpdate:isNewerSemver(fake,CURRENT_VERSION),channel};if(isDev()&&!opts.force)return null;let latest=await fetchLatestFromRegistry(PACKAGE_NAME,channel);if(!latest)return null;let hasUpdate=isNewerSemver(latest,CURRENT_VERSION),minAgeMs=(opts.minAgeHours??0)*3600000;if(hasUpdate&&minAgeMs>0){let publishedAt=await fetchPublishedAt(PACKAGE_NAME,latest),now=(opts.now??Date.now)();if(publishedAt!==null&&now-publishedAt<minAgeMs)hasUpdate=!1}return{current:CURRENT_VERSION,latest,hasUpdate,channel}}function versionFromTagName(tagName){if(typeof tagName!=="string")return null;return tagName.match(/^v(\d+\.\d+\.\d+)$/)?.[1]??null}var ZH_NOTES_ASSET="release-notes.zh.md";async function notesBody(release,locale,signal){if(locale!=="zh"||!Array.isArray(release.assets))return release.body;let asset=release.assets.find((a)=>a.name===ZH_NOTES_ASSET);if(typeof asset?.browser_download_url!=="string")return release.body;try{let res=await fetch(asset.browser_download_url,{signal}),text=res.ok?await res.text():"";return text.trim()?text:release.body}catch{return release.body}}async function fetchReleaseNotes(version,locale="en"){let slug=repoSlug();if(!slug)return null;let tag=`v${version}`,ctrl=new AbortController,timer=setTimeout(()=>ctrl.abort(),FETCH_TIMEOUT_MS);try{let res=await fetch(`https://api.github.com/repos/${slug}/releases/tags/${tag}`,{signal:ctrl.signal,headers:{accept:"application/vnd.github+json","x-github-api-version":"2022-11-28"}});if(!res.ok)return null;let body=await res.json();if(typeof body.body!=="string"||typeof body.html_url!=="string")return null;return{body:await notesBody({...body,body:body.body},locale,ctrl.signal),url:body.html_url,version}}catch{return null}finally{clearTimeout(timer)}}async function fetchReleaseNotesRange(args){let slug=repoSlug();if(!slug)return[];let limit=args.limit??100,ctrl=new AbortController,timer=setTimeout(()=>ctrl.abort(),FETCH_TIMEOUT_MS);try{let res=await fetch(`https://api.github.com/repos/${slug}/releases?per_page=${limit}`,{signal:ctrl.signal,headers:{accept:"application/vnd.github+json","x-github-api-version":"2022-11-28"}});if(!res.ok)return[];let body=await res.json();if(!Array.isArray(body))return[];let inRange=body.flatMap((release)=>{let version=versionFromTagName(release.tag_name);if(!version||typeof release.html_url!=="string"||typeof release.body!=="string")return[];if(compareSemver(version,args.current)<=0)return[];if(compareSemver(version,args.latest)>0)return[];return[{version,url:release.html_url,release:{...release,body:release.body}}]});return await Promise.all(inRange.map(async({version,url,release})=>({version,url,body:await notesBody(release,args.locale??"en",ctrl.signal)})))}catch{return[]}finally{clearTimeout(timer)}}async function fetchReleaseSummaries(limit=12){let slug=repoSlug();if(!slug)return[];let ctrl=new AbortController,timer=setTimeout(()=>ctrl.abort(),FETCH_TIMEOUT_MS);try{let res=await fetch(`https://api.github.com/repos/${slug}/releases?per_page=${limit}`,{signal:ctrl.signal,headers:{accept:"application/vnd.github+json","x-github-api-version":"2022-11-28"}});if(!res.ok)return[];let body=await res.json();if(!Array.isArray(body))return[];return body.map((release)=>{let version=versionFromTagName(release.tag_name);if(!version||typeof release.html_url!=="string")return null;return{version,url:release.html_url}}).filter((release)=>release!==null)}catch{return[]}finally{clearTimeout(timer)}}function releasePageUrl(version){let slug=repoSlug();if(!slug)return null;return`https://github.com/${slug}/releases/tag/v${version}`}
|
|
3
|
+
export{package_default,CURRENT_VERSION,PACKAGE_NAME,repoSlug,UPDATE_SCRIPT_URL,UPDATE_COMMAND,updateCommandFor,owningNpmPrefix,recommendedGlobalInstallCommand,BREAKING_VERSIONS,breakingVersionsCrossed,RELEASE_CHANNELS,DEFAULT_RELEASE_CHANNEL,channelOf,isNewerSemver,compareSemver,checkLatestVersion,ZH_NOTES_ASSET,fetchReleaseNotes,fetchReleaseNotesRange,fetchReleaseSummaries,releasePageUrl};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{launchTui,trackWelcomeWrite}from"./chunk-
|
|
2
|
+
import{launchTui,trackWelcomeWrite}from"./chunk-mxx0y791.js";import"./chunk-91sykzqq.js";export{trackWelcomeWrite,launchTui};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{getCustomEngineIds,getDisabledEngineIds,getPersistedString,setPersistedString}from"./chunk-rfp0ayra.js";import{DEFAULT_TASK_VENDOR}from"./chunk-xy8be792.js";import{BUILTIN_VENDORS,isBuiltinVendor}from"./chunk-h2m7em1e.js";var REPO_KEY_PREFIX="lastActiveVendor.";function validVendor(value,customIds){let v=value?.trim();if(!v)return;if(getDisabledEngineIds().includes(v))return;if(isBuiltinVendor(v)||customIds.includes(v))return v;return}function firstEnabledVendor(){let disabled=new Set(getDisabledEngineIds());return[...BUILTIN_VENDORS,...getCustomEngineIds()].find((id)=>!disabled.has(id))??DEFAULT_TASK_VENDOR}function getRepoLastActiveVendor(repo){return validVendor(getPersistedString(REPO_KEY_PREFIX+repo),getCustomEngineIds())}function setRepoLastActiveVendor(repo,vendor){setPersistedString(REPO_KEY_PREFIX+repo,vendor)}function getGlobalDefaultVendor(){let customIds=getCustomEngineIds();return validVendor(getPersistedString("defaultVendor"),customIds)??validVendor(getPersistedString("lastSelectedVendor"),customIds)}function setGlobalDefaultVendor(vendor){setPersistedString("defaultVendor",vendor)}function resolvePreferredVendor(repo){return(repo?getRepoLastActiveVendor(repo):void 0)??getGlobalDefaultVendor()??firstEnabledVendor()}
|
|
3
3
|
export{getRepoLastActiveVendor,setRepoLastActiveVendor,getGlobalDefaultVendor,setGlobalDefaultVendor,resolvePreferredVendor};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{API_VERBS,VERBS,VERB_ALIASES,VERB_GROUPS,findVerb,unknownVerbError}from"./chunk-z3wrbtcq.js";import"./chunk-zpwvjt14.js";import"./chunk-kdnk8m5j.js";import"./chunk-qcjkactr.js";import"./chunk-rjfdzjhj.js";import"./chunk-r2bb8b11.js";import"./chunk-agvtzads.js";import"./chunk-pm91e38v.js";import"./chunk-2xsxcdp6.js";import"./chunk-17e2tgyg.js";import"./chunk-1vxtd8rh.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-tt58819p.js";import"./chunk-ta1p2nwa.js";import"./chunk-vytrhm50.js";import"./chunk-vp29jgbt.js";import"./chunk-gq36nzg8.js";import"./chunk-sq6zj3fb.js";import"./chunk-qkehg2c1.js";import"./chunk-shtm72c0.js";import"./chunk-j1qy79fd.js";import"./chunk-z43e08kw.js";import"./chunk-w77s2df8.js";import"./chunk-mqfvzdpr.js";import"./chunk-cf3vpsm5.js";import"./chunk-rxqdw6s5.js";import"./chunk-kxp04jnp.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-etfh8f4z.js";import"./chunk-9rj2fx6v.js";import"./chunk-rfp0ayra.js";import"./chunk-t7j8g9f6.js";import"./chunk-dmzg9zdc.js";import"./chunk-40dgv828.js";import"./chunk-kg9kmwt9.js";import"./chunk-6xppe9bj.js";import"./chunk-9ckvdy0j.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{unknownVerbError,findVerb,VERB_GROUPS,VERB_ALIASES,VERBS,API_VERBS};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{stampOrigin}from"./chunk-
|
|
2
|
+
import{stampOrigin}from"./chunk-qs359899.js";import{createStateCell}from"./chunk-cmp64q4j.js";var NO_LIVE={activity:new Map,changes:new Map,tokens:new Map};function decodeMachines(payload){let p=payload;if(!p||!Array.isArray(p.machines)||!Array.isArray(p.tasks)||!p.live||typeof p.live!=="object")return null;let map=(value)=>new Map(value&&typeof value==="object"?Object.entries(value):[]);return{machines:p.machines,tasks:p.tasks,live:{activity:map(p.live.activity),changes:map(p.live.changes),tokens:map(p.live.tokens)}}}class MachineFeed{local;machinesAcc=createStateCell([],"machines.status");remoteTasksAcc=createStateCell(null,"machines.remoteTasks");tasksAcc;merged=null;liveAcc=createStateCell(NO_LIVE,"machines.live");stops;constructor(local){this.local=local;this.tasksAcc=this.mergedTasks();let raw=local.rawChannelSignal("machines"),take=()=>{let next=decodeMachines(raw.get());if(!next)return;this.machinesAcc.set(next.machines),this.liveAcc.set(next.live),this.remoteTasksAcc.set(next.machines.length===0?null:next.tasks)};this.stops=[raw.subscribe(take)],take()}machinesSignal(){return this.machinesAcc}tasksSignal(){return this.tasksAcc}liveSignal(){return this.liveAcc}mergedTasks(){let localTasks=this.local.tasksSignal(),get=()=>{let local=localTasks.get(),remote=this.remoteTasksAcc.get();if(remote===null)return local;if(this.merged?.local!==local||this.merged.remote!==remote){let value=[...local.map((task)=>stampOrigin(task,"local","local")),...remote];this.merged={local,remote,value}}return this.merged.value},state=get;return state.get=get,state.subscribe=(listener)=>{let stopLocal=localTasks.subscribe(listener),stopRemote=this.remoteTasksAcc.subscribe(listener);return()=>{stopLocal(),stopRemote()}},state}dispose(){for(let stop of this.stops)stop()}}
|
|
3
3
|
export{decodeMachines,MachineFeed};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{getPersistedString}from"./chunk-rfp0ayra.js";import{recordSpawn}from"./chunk-40dgv828.js";import{readOnlyGitProcessEnv}from"./chunk-6xppe9bj.js";import{quoteShellArg}from"./chunk-7kysxgbq.js";import{pathSyntax,pathWithin}from"./chunk-pn5ygqn6.js";var EDITOR_KINDS=["auto","vim","nvim","nano","emacs","custom"],AUTO_EDITOR_CANDIDATES=["nvim","vim","emacs","nano"],EDITOR_KIND_KEY="editor.kind",EDITOR_CUSTOM_KEY="editor.customCommand",DEFAULT_EDITOR_KIND="auto";function normalizeEditorKind(value){return EDITOR_KINDS.includes(value)?value:"auto"}var FILE_PLACEHOLDER="{file}",LINE_PLACEHOLDER="{line}",PLUS_LINE_EDITORS=new Set(["vi","vim","nvim","nano","emacs","emacsclient","micro","kak","mg","joe"]),SUFFIX_LINE_EDITORS=new Set(["hx","helix"]);function firstToken(cmd){return cmd.trim().split(/\s+/)[0]??""}function buildEditorCommand(kind,customCommand,absPath,envEditor,line){if(kind==="vim"||kind==="nvim"||kind==="nano"||kind==="emacs")return plainEditorCommand(kind,absPath,line);let tmpl=(customCommand.trim()||(envEditor??"").trim()).trim();if(!tmpl)return null;let bin=firstToken(tmpl);if(!bin)return null;let hasLine=tmpl.includes(LINE_PLACEHOLDER),autoPlusLine=!hasLine&&line!==void 0&&PLUS_LINE_EDITORS.has(bin.split("/").pop()??bin),target=hasLine||autoPlusLine?{arg:quoteShellArg(absPath),atLine:!0}:fileArg(bin,absPath,line),withLine=(autoPlusLine?`${bin} +${line}${tmpl.slice(bin.length)}`:tmpl).split(LINE_PLACEHOLDER).join(String(line??1)),command=withLine.includes(FILE_PLACEHOLDER)?withLine.split(FILE_PLACEHOLDER).join(target.arg):`${withLine} ${target.arg}`;return line===void 0?{bin,command}:{bin,command,atLine:target.atLine}}function plainEditorCommand(bin,absPath,line){let target=fileArg(bin,absPath,line),command=`${bin} ${target.arg}`;return line===void 0?{bin,command}:{bin,command,atLine:target.atLine}}function fileArg(bin,absPath,line){let file=quoteShellArg(absPath);if(line===void 0)return{arg:file,atLine:!1};let name=bin.split("/").pop()??bin;if(PLUS_LINE_EDITORS.has(name))return{arg:`+${line} ${file}`,atLine:!0};if(SUFFIX_LINE_EDITORS.has(name))return{arg:`${file}:${line}`,atLine:!0};return{arg:file,atLine:!1}}function buildNvimDiffCommand(bin,absPath,relPath){let file=quoteShellArg(absPath);return["f=$(mktemp 2>/dev/null)",`if [ -n "$f" ] && git show ${quoteShellArg(`HEAD:./${relPath}`)} > "$f" 2>/dev/null; then`,` ${bin} -d "$f" ${file} -c 'setlocal nomodifiable' -c 'wincmd l'; r=$?`,"else",` ${bin} ${file}; r=$?`,"fi",'rm -f "$f" 2>/dev/null; exit $r'].join(`
|
|
3
3
|
`)}function relativeToWorktree(worktree,absPath){return pathWithin(worktree,absPath)||null}async function resolveEditorCommand(absPath,line){let kind=normalizeEditorKind(getPersistedString(EDITOR_KIND_KEY)),custom=getPersistedString(EDITOR_CUSTOM_KEY)??"",env=(process.env.VISUAL??process.env.EDITOR??"").trim();if(kind!=="auto")return buildEditorCommand(kind,custom,absPath,env,line);if(env)return buildEditorCommand("custom","",absPath,env,line);for(let bin of AUTO_EDITOR_CANDIDATES)if(await binaryAvailable(bin))return plainEditorCommand(bin,absPath,line);return null}async function binaryAvailable(bin){try{return await Bun.spawn(["sh","-c",`command -v ${quoteShellArg(bin)} >/dev/null 2>&1`],{stdin:"ignore",stdout:"ignore",stderr:"ignore"}).exited===0}catch{return!1}}async function fileHasDiff(worktree,relPath){try{return recordSpawn("tui.fileHasDiff",["git","diff","--quiet","HEAD","--",relPath],worktree),await Bun.spawn(["git","diff","--quiet","HEAD","--",relPath],{cwd:worktree,stdin:"ignore",stdout:"ignore",stderr:"ignore",env:readOnlyGitProcessEnv()}).exited===1}catch{return!1}}async function resolveEditorLaunch(worktree,absPath,line){let resolved=await resolveEditorCommand(absPath,line);if(!resolved)return null;if(!await binaryAvailable(resolved.bin))return null;let command=await maybeDiffCommand(resolved,worktree,absPath),label=editorWindowLabel(absPath);return resolved.atLine===void 0?{command,label}:{command,label,atLine:resolved.atLine}}async function maybeDiffCommand(resolved,worktree,absPath){let{bin,command}=resolved;if(bin!=="nvim"&&bin!=="vim")return command;if(command!==`${bin} ${quoteShellArg(absPath)}`)return command;let rel=relativeToWorktree(worktree,absPath);if(!rel)return command;if(!await fileHasDiff(worktree,rel))return command;return buildNvimDiffCommand(bin,absPath,rel)}function editorWindowLabel(absPath){let base=pathSyntax(absPath).basename(absPath).trim();return base.length>0?base:"edit"}
|
|
4
4
|
export{EDITOR_KINDS,EDITOR_KIND_KEY,EDITOR_CUSTOM_KEY,DEFAULT_EDITOR_KIND,normalizeEditorKind,resolveEditorCommand,binaryAvailable,resolveEditorLaunch};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{openDaemonSession,resolveActiveTaskId}from"./chunk-qcjkactr.js";import"./chunk-e58kj4gm.js";import"./chunk-0a65j1zj.js";import"./chunk-bcyex84w.js";import"./chunk-qzzmd63x.js";import"./chunk-96kvwzj8.js";import"./chunk-br8r72bf.js";import"./chunk-yt15y085.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{resolveActiveTaskId,openDaemonSession};
|
|
@@ -6,6 +6,6 @@ ${EXPORT_USAGE}
|
|
|
6
6
|
`),process.exit(2)}function parseFormat(args){let format="json";for(let i=0;i<args.length;i++){let a=args[i];if(a==="--json")format="json";else if(a==="--csv")format="csv";else if(a==="--format"){let v=args[++i];if(v===void 0)usageError("--format requires a value (json, csv, or table)");format=coerceFormat(v)}else if(a.startsWith("--format="))format=coerceFormat(a.slice(9));else usageError(`unexpected argument "${a}"`)}return format}function coerceFormat(value){if(value==="json"||value==="csv"||value==="table")return value;usageError(`unknown format "${value}" (expected json, csv, or table)`)}function csvCell(value){if(/[",\r\n]/.test(value))return`"${value.replace(/"/g,'""')}"`;return value}function renderCsv(rows){let lines=[COLUMNS.join(",")];for(let row of rows)lines.push(COLUMNS.map((c)=>csvCell(row[c])).join(","));return lines.join(`
|
|
7
7
|
`)}function padCell(cell,width){return cell+" ".repeat(Math.max(0,width-displayWidth(cell)))}function renderTable(rows){let widths={};for(let c of COLUMNS)widths[c]=Math.max(displayWidth(c),...rows.map((r)=>displayWidth(r[c])));let line=(cells)=>COLUMNS.map((c)=>padCell(cells[c],widths[c])).join(" ").trimEnd(),header={};for(let c of COLUMNS)header[c]=c;return[line(header),...rows.map(line)].join(`
|
|
8
8
|
`)}function renderExport(tasks,format){let rows=tasks.map(toRow);if(format==="json")return JSON.stringify(rows,null,2);if(format==="csv")return renderCsv(rows);return renderTable(rows)}async function runExportSubcommand(args){if(args.includes("--help")||args.includes("-h")||args.includes("help")){process.stdout.write(`${EXPORT_USAGE}
|
|
9
|
-
`);return}let format=parseFormat(args),{TaskIndexStore}=await import("./chunk-
|
|
9
|
+
`);return}let format=parseFormat(args),{TaskIndexStore}=await import("./chunk-pfagrkt6.js"),store=new TaskIndexStore;await store.load();let tasks=store.list();if(tasks.length===0&&format==="table"){process.stdout.write(`no tasks
|
|
10
10
|
`);return}process.stdout.write(`${renderExport(tasks,format)}
|
|
11
11
|
`)}export{runExportSubcommand,renderExport};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{vendorFromArgv}from"./chunk-qvnr8c18.js";import{engineEntry}from"./chunk-edrxs4cy.js";import{isContribEngine}from"./chunk-03rbg95q.js";import{roveCliInvocation}from"./chunk-e01321zn.js";import{BUILTIN_VENDORS,coerceVendorId,isBuiltinVendor}from"./chunk-h2m7em1e.js";import{getCustomEngineIds,getPersistedString}from"./chunk-rfp0ayra.js";function engineCommandKey(vendor){return`engineCommand.${vendor}`}function engineNameKey(vendor){return`engineName.${vendor}`}function engineDisplayName(vendor){return getPersistedString(engineNameKey(vendor))?.trim()||engineEntry(vendor).displayName}function humanizeSlug(id){return id.split(/[-_]+/).filter((word)=>word.length>0).map((word)=>word.charAt(0).toUpperCase()+word.slice(1)).join(" ")}function engineRenamedFrom(vendor,override){let name=override.trim(),base=engineEntry(vendor).displayName;if(!name||name===base||name===humanizeSlug(vendor))return;return base}function defaultEngineCommand(vendor){return engineEntry(coerceVendorId(vendor)).defaultCommand}function parseEngineCommand(command){let out=[],token="",hasToken=!1,quote=null;for(let ch of command){if(quote){if(ch===quote)quote=null;else token+=ch;continue}if(ch==='"'||ch==="'"){quote=ch,hasToken=!0;continue}if(/\s/.test(ch)){if(hasToken)out.push(token),token="",hasToken=!1;continue}token+=ch,hasToken=!0}if(hasToken)out.push(token);return out}function interactiveEngineCommand(vendor,effort,model){let v=coerceVendorId(vendor),override=getPersistedString(engineCommandKey(v))?.trim(),base=(()=>{if(override){let argv=parseEngineCommand(override);if(argv.length>0)return argv}return defaultEngineCommand(v)})();return withEngineTerminalTitle(withEngineModel(withEngineEffort(base,v,effort),v,model),v)}function withEngineTerminalTitle(argv,vendor){let args=engineEntry(coerceVendorId(vendor)).terminalTitle?.launchArgs;return args&&args.length>0?[...argv,...args]:argv}function withEngineEffort(argv,vendor,effort){let trimmed=effort?.trim();if(!trimmed)return argv;let entry=engineEntry(coerceVendorId(vendor));if(!entry.effortLevels?.includes(trimmed))return argv;return entry.effortArgv?.(argv,trimmed)??argv}function withEngineModel(argv,vendor,model){let trimmed=model?.trim();if(!trimmed)return argv;return engineEntry(coerceVendorId(vendor)).modelArgv?.(argv,trimmed)??argv}function roveApiInvocation(){let quote=(a)=>/^[A-Za-z0-9_/.:=-]+$/.test(a)?a:`'${a.replace(/'/g,"'\\''")}'`;try{return[...roveCliInvocation(),"api"].map(quote).join(" ")}catch{return"rove api"}}import{randomUUID}from"crypto";function hasFlag(argv,flag){return argv.some((a)=>a===flag||a.startsWith(`${flag}=`))}function controlsOwnSession(identity,argv){return(identity?.sessionControlFlags??[]).some((flag)=>hasFlag(argv,flag))}function pinSessionArgv(identity,argv,sessionId){if(!identity?.pinFlag)return argv;if(controlsOwnSession(identity,argv))return argv;return[...argv,identity.pinFlag,sessionId]}function acceptsPinnedSession(identity,argv){return!!identity?.pinFlag&&!controlsOwnSession(identity,argv)}function resumeSessionArgv(identity,base,sessionId){if(!sessionId||!identity?.resumeArgv)return null;if(controlsOwnSession(identity,base))return null;return identity.resumeArgv(base,sessionId)}function pickUnclaimedSessionId(ids,claimed){for(let i=ids.length-1;i>=0;i--){let id=ids[i];if(id&&!claimed.has(id))return id}return null}function forkSessionArgvFor(identity,base,sourceId,newId){if(!sourceId||!identity?.forkArgv)return null;if(controlsOwnSession(identity,base))return null;return identity.forkArgv(base,sourceId,newId)}function acceptsSessionFork(identity){return!!identity?.forkArgv}var GENERIC_PROTOCOL="generic",ENGINE_PROTOCOLS=BUILTIN_VENDORS;function engineProtocolKey(id){return`engineProtocol.${id}`}function getEngineProtocol(id){if(isBuiltinVendor(id)||isContribEngine(id))return id;let raw=getPersistedString(engineProtocolKey(id))?.trim();return raw&&ENGINE_PROTOCOLS.includes(raw)?raw:void 0}function isPresetId(id){return isBuiltinVendor(id)||isContribEngine(id)||getCustomEngineIds().includes(id)}function listPresetIds(){return[...BUILTIN_VENDORS,...getCustomEngineIds()]}function describePreset(id){let command=getPersistedString(engineCommandKey(id))?.trim()||defaultEngineCommand(id).join(" ");return{id,name:engineDisplayName(id),command,protocol:getEngineProtocol(id)??GENERIC_PROTOCOL,builtin:isBuiltinVendor(id)}}function listEnginePresets(){return listPresetIds().map(describePreset)}function resolveCommandProtocol(command){let trimmed=command?.trim();if(!trimmed)return GENERIC_PROTOCOL;if(isPresetId(trimmed))return getEngineProtocol(trimmed)??GENERIC_PROTOCOL;let fromArgv=vendorFromArgv(trimmed);if(fromArgv)return fromArgv;let argv0=parseEngineCommand(trimmed)[0];if(argv0)for(let id of getCustomEngineIds()){let preset=getPersistedString(engineCommandKey(id))?.trim();if(preset&&parseEngineCommand(preset)[0]===argv0)return getEngineProtocol(id)??GENERIC_PROTOCOL}return GENERIC_PROTOCOL}function engineLaunchArgv(spec){let command=spec.command?.trim();if(!command)return interactiveEngineCommand(spec.vendor,spec.effort,spec.model);let vendor=(isPresetId(command)?getEngineProtocol(command):void 0)??resolveCommandProtocol(command),base=isPresetId(command)?presetBaseArgv(command):(()=>{let argv=parseEngineCommand(command);return argv.length>0?argv:null})();if(!base)return interactiveEngineCommand(spec.vendor,spec.effort,spec.model);return withEngineTerminalTitle(withEngineModel(withEngineEffort(base,vendor,spec.effort),vendor,spec.model),vendor)}function presetBaseArgv(id){let override=getPersistedString(engineCommandKey(id))?.trim();if(override){let argv=parseEngineCommand(override);if(argv.length>0)return argv}return defaultEngineCommand(id)}function sessionProtocol(vendor){let id=vendor?.trim();if(!id)return"claude";return getEngineProtocol(id)??id}function protocolEntry(vendor){return engineEntry(sessionProtocol(vendor))}function withPinnedSessionId(argv,vendor,newId=randomUUID){let identity=engineEntry(sessionProtocol(vendor)).sessionIdentity;if(!acceptsPinnedSession(identity,argv))return{argv,sessionId:null};let sessionId=newId();return{argv:pinSessionArgv(identity,argv,sessionId),sessionId}}function engineResumeArgv(base,vendor,sessionId){return resumeSessionArgv(engineEntry(sessionProtocol(vendor)).sessionIdentity,base,sessionId)}function engineCanFork(vendor){return acceptsSessionFork(engineEntry(sessionProtocol(vendor)).sessionIdentity)}function engineForkArgv(base,vendor,sourceId,newId){return forkSessionArgvFor(engineEntry(sessionProtocol(vendor)).sessionIdentity,base,sourceId,newId)}var ID_RE=/^tab-(\d+)$/;function tabOrdinalOf(id){let match=ID_RE.exec(id);return match?Number(match[1]):null}var sameValue=(a,b)=>a===b||JSON.stringify(a)===JSON.stringify(b);function insertAfter(tabs,row,after){if(after===null)return[row,...tabs];let i=after===void 0?-1:tabs.findIndex((t)=>t.id===after);return i<0?[...tabs,row]:[...tabs.slice(0,i+1),row,...tabs.slice(i+1)]}function applyTabOps(current,ops,tombstones=new Set){let state=current,changed=!1,opened=[],set=(next)=>{state=next,changed=!0};for(let op of ops)switch(op.op){case"seed":{if(state===null||state.tabs.length===0){let floor=Math.max(op.state.nextOrdinal,maxOrdinal(op.state)+1,state?.nextOrdinal??0);set({...op.state,nextOrdinal:floor})}break}case"forget":{if(state!==null)set(null);break}case"open":{let base=state??{tabs:[],nextOrdinal:1},wanted=op.row.id;if(wanted!==void 0&&(base.tabs.some((t)=>t.id===wanted)||tombstones.has(wanted))){opened.push(null);break}let ordinal=wanted!==void 0?tabOrdinalOf(wanted)??op.row.ordinal??base.nextOrdinal:base.nextOrdinal,id=wanted??`tab-${ordinal}`,row={...op.row,id,ordinal};set({...base,tabs:insertAfter(base.tabs,row,op.after),nextOrdinal:Math.max(base.nextOrdinal,ordinal+1)}),opened.push(id);break}case"patch":{if(!state)break;let i=state.tabs.findIndex((t)=>t.id===op.id),row=state.tabs[i];if(!row)break;let next={...row},rowChanged=!1;for(let[key,value]of Object.entries(op.set??{})){if(key==="id"||key==="ordinal"||sameValue(next[key],value))continue;next[key]=value,rowChanged=!0}for(let key of op.unset??[]){if(key==="id"||key==="ordinal"||key==="kind"||!(key in next))continue;delete next[key],rowChanged=!0}if(!rowChanged)break;let tabs=[...state.tabs];tabs[i]=next,set({...state,tabs});break}case"close":{if(!state||!state.tabs.some((t)=>t.id===op.id))break;tombstones.add(op.id);let tabs=state.tabs.filter((t)=>t.id!==op.id),reopen=tabs.length===0&&op.reopenAs!==void 0?{reopenAs:op.reopenAs}:{},{activeId,...rest}=state;set({...rest,tabs,...activeId!==void 0&&activeId!==op.id?{activeId}:{},...reopen});break}case"order":{if(!state)break;let byId=new Map(state.tabs.map((t)=>[t.id,t])),tabs=[...op.ids.flatMap((id)=>{let row=byId.get(id);if(!row)return[];return byId.delete(id),[row]}),...state.tabs.filter((t)=>byId.has(t.id))];if(tabs.every((t,i)=>t===state?.tabs[i]))break;set({...state,tabs});break}case"focus":{if(!state||state.activeId===op.id||!state.tabs.some((t)=>t.id===op.id))break;set({...state,activeId:op.id});break}case"meta":{if(!state||sameValue(state.reopenAs,op.reopenAs))break;let{reopenAs:_drop,...rest}=state;set(op.reopenAs===void 0?rest:{...rest,reopenAs:op.reopenAs});break}}return{state,changed,opened}}function maxOrdinal(state){return state.tabs.reduce((max,tab)=>Math.max(max,tab.ordinal),0)}function reserveOrdinals(state,count){let base=state??{tabs:[],nextOrdinal:1},from=Math.max(base.nextOrdinal,maxOrdinal(base)+1);return{state:{...base,nextOrdinal:from+count},from}}function releaseOrdinals(state,from,to){if(!state||state.nextOrdinal!==to||from>=to)return state;let floor=Math.max(from,maxOrdinal(state)+1);return floor<state.nextOrdinal?{...state,nextOrdinal:floor}:state}function diffTabs(prev,next){if(prev===null)return[{op:"seed",state:next}];let ops=[],prevById=new Map(prev.tabs.map((t)=>[t.id,t])),nextIds=new Set(next.tabs.map((t)=>t.id));for(let row of prev.tabs){let reopen=next.tabs.length===0&&next.reopenAs!==void 0?{reopenAs:next.reopenAs}:{};if(!nextIds.has(row.id))ops.push({op:"close",id:row.id,...reopen})}next.tabs.forEach((row,i)=>{let before=prevById.get(row.id);if(!before){ops.push({op:"open",row,after:i===0?null:next.tabs[i-1]?.id??null});return}if(before===row)return;let set={},unset=[];for(let[key,value]of Object.entries(row))if(key!=="id"&&key!=="ordinal"&&!sameValue(before[key],value))set[key]=value;for(let key of Object.keys(before))if(!(key in row))unset.push(key);if(Object.keys(set).length>0||unset.length>0)ops.push({op:"patch",id:row.id,...Object.keys(set).length>0?{set}:{},...unset.length>0?{unset}:{}})});let kept=next.tabs.filter((t)=>prevById.has(t.id)).map((t)=>t.id),prevKept=prev.tabs.filter((t)=>nextIds.has(t.id)).map((t)=>t.id);if(kept.some((id,i)=>id!==prevKept[i]))ops.push({op:"order",ids:next.tabs.map((t)=>t.id)});if(!sameValue(prev.reopenAs,next.reopenAs)&&next.tabs.length>0)ops.push({op:"meta",reopenAs:next.reopenAs});return ops}
|
|
2
|
+
import{vendorFromArgv}from"./chunk-vvqwgcge.js";import{engineEntry}from"./chunk-x83xbzjd.js";import{isContribEngine}from"./chunk-hzz020xx.js";import{getCustomEngineIds,getPersistedString}from"./chunk-rfp0ayra.js";import{roveCliInvocation}from"./chunk-8qkyd589.js";import{BUILTIN_VENDORS,coerceVendorId,isBuiltinVendor}from"./chunk-h2m7em1e.js";function engineCommandKey(vendor){return`engineCommand.${vendor}`}function engineNameKey(vendor){return`engineName.${vendor}`}function engineDisplayName(vendor){return getPersistedString(engineNameKey(vendor))?.trim()||engineEntry(vendor).displayName}function humanizeSlug(id){return id.split(/[-_]+/).filter((word)=>word.length>0).map((word)=>word.charAt(0).toUpperCase()+word.slice(1)).join(" ")}function engineRenamedFrom(vendor,override){let name=override.trim(),base=engineEntry(vendor).displayName;if(!name||name===base||name===humanizeSlug(vendor))return;return base}function defaultEngineCommand(vendor){return engineEntry(coerceVendorId(vendor)).defaultCommand}function parseEngineCommand(command){let out=[],token="",hasToken=!1,quote=null;for(let ch of command){if(quote){if(ch===quote)quote=null;else token+=ch;continue}if(ch==='"'||ch==="'"){quote=ch,hasToken=!0;continue}if(/\s/.test(ch)){if(hasToken)out.push(token),token="",hasToken=!1;continue}token+=ch,hasToken=!0}if(hasToken)out.push(token);return out}function interactiveEngineCommand(vendor,effort,model){let v=coerceVendorId(vendor),override=getPersistedString(engineCommandKey(v))?.trim(),base=(()=>{if(override){let argv=parseEngineCommand(override);if(argv.length>0)return argv}return defaultEngineCommand(v)})();return withEngineHostedArgs(withEngineModel(withEngineEffort(base,v,effort),v,model),v)}function withEngineHostedArgs(argv,vendor){let entry=engineEntry(coerceVendorId(vendor)),args=entry.terminalTitle?.launchArgs,titled=args&&args.length>0?[...argv,...args]:argv;return entry.hostedStartArgv?.(titled)??titled}function withEngineEffort(argv,vendor,effort){let trimmed=effort?.trim();if(!trimmed)return argv;let entry=engineEntry(coerceVendorId(vendor));if(!entry.effortLevels?.includes(trimmed))return argv;return entry.effortArgv?.(argv,trimmed)??argv}function withEngineModel(argv,vendor,model){let trimmed=model?.trim();if(!trimmed)return argv;return engineEntry(coerceVendorId(vendor)).modelArgv?.(argv,trimmed)??argv}function roveApiInvocation(){let quote=(a)=>/^[A-Za-z0-9_/.:=-]+$/.test(a)?a:`'${a.replace(/'/g,"'\\''")}'`;try{return[...roveCliInvocation(),"api"].map(quote).join(" ")}catch{return"rove api"}}import{randomUUID}from"crypto";function hasFlag(argv,flag){return argv.some((a)=>a===flag||a.startsWith(`${flag}=`))}function controlsOwnSession(identity,argv){return(identity?.sessionControlFlags??[]).some((flag)=>hasFlag(argv,flag))}function pinSessionArgv(identity,argv,sessionId){if(!identity?.pinFlag)return argv;if(controlsOwnSession(identity,argv))return argv;return[...argv,identity.pinFlag,sessionId]}function acceptsPinnedSession(identity,argv){return!!identity?.pinFlag&&!controlsOwnSession(identity,argv)}function resumeSessionArgv(identity,base,sessionId){if(!sessionId||!identity?.resumeArgv)return null;if(controlsOwnSession(identity,base))return null;return identity.resumeArgv(base,sessionId)}function pickUnclaimedSessionId(ids,claimed){for(let i=ids.length-1;i>=0;i--){let id=ids[i];if(id&&!claimed.has(id))return id}return null}function forkSessionArgvFor(identity,base,sourceId,newId){if(!sourceId||!identity?.forkArgv)return null;if(controlsOwnSession(identity,base))return null;return identity.forkArgv(base,sourceId,newId)}function acceptsSessionFork(identity){return!!identity?.forkArgv}var GENERIC_PROTOCOL="generic",ENGINE_PROTOCOLS=BUILTIN_VENDORS;function engineProtocolKey(id){return`engineProtocol.${id}`}function getEngineProtocol(id){if(isBuiltinVendor(id)||isContribEngine(id))return id;let raw=getPersistedString(engineProtocolKey(id))?.trim();return raw&&ENGINE_PROTOCOLS.includes(raw)?raw:void 0}function isPresetId(id){return isBuiltinVendor(id)||isContribEngine(id)||getCustomEngineIds().includes(id)}function listPresetIds(){return[...new Set([...BUILTIN_VENDORS,...getCustomEngineIds()])]}function describePreset(id){let command=getPersistedString(engineCommandKey(id))?.trim()||defaultEngineCommand(id).join(" ");return{id,name:engineDisplayName(id),command,protocol:getEngineProtocol(id)??GENERIC_PROTOCOL,builtin:isBuiltinVendor(id)}}function listEnginePresets(){return listPresetIds().map(describePreset)}function resolveCommandProtocol(command){let trimmed=command?.trim();if(!trimmed)return GENERIC_PROTOCOL;if(isPresetId(trimmed))return getEngineProtocol(trimmed)??GENERIC_PROTOCOL;let fromArgv=vendorFromArgv(trimmed);if(fromArgv)return fromArgv;let argv0=parseEngineCommand(trimmed)[0];if(argv0)for(let id of getCustomEngineIds()){let preset=getPersistedString(engineCommandKey(id))?.trim();if(preset&&parseEngineCommand(preset)[0]===argv0)return getEngineProtocol(id)??GENERIC_PROTOCOL}return GENERIC_PROTOCOL}function engineLaunchArgv(spec){let command=spec.command?.trim();if(!command)return interactiveEngineCommand(spec.vendor,spec.effort,spec.model);let vendor=(isPresetId(command)?getEngineProtocol(command):void 0)??resolveCommandProtocol(command),base=isPresetId(command)?presetBaseArgv(command):(()=>{let argv=parseEngineCommand(command);return argv.length>0?argv:null})();if(!base)return interactiveEngineCommand(spec.vendor,spec.effort,spec.model);return withEngineHostedArgs(withEngineModel(withEngineEffort(base,vendor,spec.effort),vendor,spec.model),vendor)}function presetBaseArgv(id){let override=getPersistedString(engineCommandKey(id))?.trim();if(override){let argv=parseEngineCommand(override);if(argv.length>0)return argv}return defaultEngineCommand(id)}function sessionProtocol(vendor){let id=vendor?.trim();if(!id)return"claude";return getEngineProtocol(id)??id}function protocolEntry(vendor){return engineEntry(sessionProtocol(vendor))}function withPinnedSessionId(argv,vendor,newId=randomUUID){let identity=engineEntry(sessionProtocol(vendor)).sessionIdentity;if(!acceptsPinnedSession(identity,argv))return{argv,sessionId:null};let sessionId=newId();return{argv:pinSessionArgv(identity,argv,sessionId),sessionId}}function engineResumeArgv(base,vendor,sessionId){return resumeSessionArgv(engineEntry(sessionProtocol(vendor)).sessionIdentity,base,sessionId)}function engineCanFork(vendor){return acceptsSessionFork(engineEntry(sessionProtocol(vendor)).sessionIdentity)}function engineForkArgv(base,vendor,sourceId,newId){return forkSessionArgvFor(engineEntry(sessionProtocol(vendor)).sessionIdentity,base,sourceId,newId)}var ID_RE=/^tab-(\d+)$/;function tabOrdinalOf(id){let match=ID_RE.exec(id);return match?Number(match[1]):null}var sameValue=(a,b)=>a===b||JSON.stringify(a)===JSON.stringify(b);function insertAfter(tabs,row,after){if(after===null)return[row,...tabs];let i=after===void 0?-1:tabs.findIndex((t)=>t.id===after);return i<0?[...tabs,row]:[...tabs.slice(0,i+1),row,...tabs.slice(i+1)]}function applyTabOps(current,ops,tombstones=new Set){let state=current,changed=!1,opened=[],set=(next)=>{state=next,changed=!0};for(let op of ops)switch(op.op){case"seed":{if(state===null||state.tabs.length===0){let floor=Math.max(op.state.nextOrdinal,maxOrdinal(op.state)+1,state?.nextOrdinal??0);set({...op.state,nextOrdinal:floor})}break}case"forget":{if(state!==null)set(null);break}case"open":{let base=state??{tabs:[],nextOrdinal:1},wanted=op.row.id;if(wanted!==void 0&&(base.tabs.some((t)=>t.id===wanted)||tombstones.has(wanted))){opened.push(null);break}let ordinal=wanted!==void 0?tabOrdinalOf(wanted)??op.row.ordinal??base.nextOrdinal:base.nextOrdinal,id=wanted??`tab-${ordinal}`,row={...op.row,id,ordinal};set({...base,tabs:insertAfter(base.tabs,row,op.after),nextOrdinal:Math.max(base.nextOrdinal,ordinal+1)}),opened.push(id);break}case"patch":{if(!state)break;let i=state.tabs.findIndex((t)=>t.id===op.id),row=state.tabs[i];if(!row)break;let next={...row},rowChanged=!1;for(let[key,value]of Object.entries(op.set??{})){if(key==="id"||key==="ordinal"||sameValue(next[key],value))continue;next[key]=value,rowChanged=!0}for(let key of op.unset??[]){if(key==="id"||key==="ordinal"||key==="kind"||!(key in next))continue;delete next[key],rowChanged=!0}if(!rowChanged)break;let tabs=[...state.tabs];tabs[i]=next,set({...state,tabs});break}case"close":{if(!state||!state.tabs.some((t)=>t.id===op.id))break;tombstones.add(op.id);let tabs=state.tabs.filter((t)=>t.id!==op.id),reopen=tabs.length===0&&op.reopenAs!==void 0?{reopenAs:op.reopenAs}:{},{activeId,...rest}=state;set({...rest,tabs,...activeId!==void 0&&activeId!==op.id?{activeId}:{},...reopen});break}case"order":{if(!state)break;let byId=new Map(state.tabs.map((t)=>[t.id,t])),tabs=[...op.ids.flatMap((id)=>{let row=byId.get(id);if(!row)return[];return byId.delete(id),[row]}),...state.tabs.filter((t)=>byId.has(t.id))];if(tabs.every((t,i)=>t===state?.tabs[i]))break;set({...state,tabs});break}case"focus":{if(!state||state.activeId===op.id||!state.tabs.some((t)=>t.id===op.id))break;set({...state,activeId:op.id});break}case"meta":{if(!state||sameValue(state.reopenAs,op.reopenAs))break;let{reopenAs:_drop,...rest}=state;set(op.reopenAs===void 0?rest:{...rest,reopenAs:op.reopenAs});break}}return{state,changed,opened}}function maxOrdinal(state){return state.tabs.reduce((max,tab)=>Math.max(max,tab.ordinal),0)}function reserveOrdinals(state,count){let base=state??{tabs:[],nextOrdinal:1},from=Math.max(base.nextOrdinal,maxOrdinal(base)+1);return{state:{...base,nextOrdinal:from+count},from}}function releaseOrdinals(state,from,to){if(!state||state.nextOrdinal!==to||from>=to)return state;let floor=Math.max(from,maxOrdinal(state)+1);return floor<state.nextOrdinal?{...state,nextOrdinal:floor}:state}function diffTabs(prev,next){if(prev===null)return[{op:"seed",state:next}];let ops=[],prevById=new Map(prev.tabs.map((t)=>[t.id,t])),nextIds=new Set(next.tabs.map((t)=>t.id));for(let row of prev.tabs){let reopen=next.tabs.length===0&&next.reopenAs!==void 0?{reopenAs:next.reopenAs}:{};if(!nextIds.has(row.id))ops.push({op:"close",id:row.id,...reopen})}next.tabs.forEach((row,i)=>{let before=prevById.get(row.id);if(!before){ops.push({op:"open",row,after:i===0?null:next.tabs[i-1]?.id??null});return}if(before===row)return;let set={},unset=[];for(let[key,value]of Object.entries(row))if(key!=="id"&&key!=="ordinal"&&!sameValue(before[key],value))set[key]=value;for(let key of Object.keys(before))if(!(key in row))unset.push(key);if(Object.keys(set).length>0||unset.length>0)ops.push({op:"patch",id:row.id,...Object.keys(set).length>0?{set}:{},...unset.length>0?{unset}:{}})});let kept=next.tabs.filter((t)=>prevById.has(t.id)).map((t)=>t.id),prevKept=prev.tabs.filter((t)=>nextIds.has(t.id)).map((t)=>t.id);if(kept.some((id,i)=>id!==prevKept[i]))ops.push({op:"order",ids:next.tabs.map((t)=>t.id)});if(!sameValue(prev.reopenAs,next.reopenAs)&&next.tabs.length>0)ops.push({op:"meta",reopenAs:next.reopenAs});return ops}
|
|
3
3
|
export{engineCommandKey,engineNameKey,engineDisplayName,humanizeSlug,engineRenamedFrom,defaultEngineCommand,interactiveEngineCommand,roveApiInvocation,pickUnclaimedSessionId,GENERIC_PROTOCOL,ENGINE_PROTOCOLS,engineProtocolKey,getEngineProtocol,listPresetIds,describePreset,listEnginePresets,resolveCommandProtocol,engineLaunchArgv,sessionProtocol,protocolEntry,withPinnedSessionId,engineResumeArgv,engineCanFork,engineForkArgv,applyTabOps,reserveOrdinals,releaseOrdinals,diffTabs};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import{processCwd}from"./chunk-3n0y9vpj.js";import"./chunk-91sykzqq.js";import{readFileSync,readdirSync,readlinkSync}from"fs";function parseLsofListeners(output){let rows=[],pid=0,command="";for(let line of output.split(`
|
|
3
|
-
`)){let tag=line[0],value=line.slice(1);if(tag==="p")pid=Number.parseInt(value,10),command="";else if(tag==="c")command=value;else if(tag==="n"&&pid>0){let sep=value.lastIndexOf(":"),port=Number.parseInt(value.slice(sep+1),10);if(sep<0||!Number.isInteger(port)||port<=0)continue;rows.push({port,host:value.slice(0,sep).replace(/^\[|\]$/g,""),pid,command})}}return rows}function
|
|
3
|
+
`)){let tag=line[0],value=line.slice(1);if(tag==="p")pid=Number.parseInt(value,10),command="";else if(tag==="c")command=value;else if(tag==="n"&&pid>0){let sep=value.lastIndexOf(":"),port=Number.parseInt(value.slice(sep+1),10);if(sep<0||!Number.isInteger(port)||port<=0)continue;rows.push({port,host:value.slice(0,sep).replace(/^\[|\]$/g,""),pid,command})}}return rows}function procBytes(hex){let bytes=[];for(let w=0;w<hex.length;w+=8)for(let i of[6,4,2,0])bytes.push(Number.parseInt(hex.slice(w+i,w+i+2),16));return bytes}function procAddress(hex){let bytes=procBytes(hex);if(bytes.length===4)return bytes.join(".");let groups=Array.from({length:8},(_,g)=>(bytes[g*2]??0)<<8|(bytes[g*2+1]??0));if(groups.slice(0,5).every((g)=>g===0)&&groups[5]===65535)return`::ffff:${bytes.slice(12).join(".")}`;let best={at:-1,len:1};for(let i=0;i<8;){let j=i;while(j<8&&groups[j]===0)j++;if(j-i>best.len)best={at:i,len:j-i};i=j===i?i+1:j}let hexOf=(gs)=>gs.map((g)=>g.toString(16)).join(":");if(best.at<0)return hexOf(groups);return`${hexOf(groups.slice(0,best.at))}::${hexOf(groups.slice(best.at+best.len))}`}function parseProcNetTcp(table){let out=new Map;for(let line of table.split(`
|
|
4
4
|
`).slice(1)){let cols=line.trim().split(/\s+/);if(cols.length<10||cols[3]!=="0A")continue;let[addr,portHex]=(cols[1]??"").split(":");if(!addr||!portHex)continue;out.set(cols[9]??"",{host:procAddress(addr),port:Number.parseInt(portHex,16)})}return out}function readProcListeners(){let byInode=new Map,readAny=!1;for(let table of["/proc/net/tcp","/proc/net/tcp6"])try{for(let[inode,row]of parseProcNetTcp(readFileSync(table,"utf8")))byInode.set(inode,row);readAny=!0}catch{}if(!readAny)return null;let rows=[];if(byInode.size===0)return rows;for(let entry of readdirSync("/proc")){let pid=Number(entry);if(!Number.isInteger(pid)||pid<=0)continue;let fds;try{fds=readdirSync(`/proc/${pid}/fd`)}catch{continue}let command=null;for(let fd of fds){let link;try{link=readlinkSync(`/proc/${pid}/fd/${fd}`)}catch{continue}let inode=/^socket:\[(\d+)\]$/.exec(link)?.[1],sock=inode?byInode.get(inode):void 0;if(!sock)continue;if(command===null)try{command=readFileSync(`/proc/${pid}/comm`,"utf8").trim()}catch{command=""}rows.push({...sock,pid,command})}}return rows}async function readLsofListeners(){try{let proc=Bun.spawn(["lsof","-nP","-iTCP","-sTCP:LISTEN","-Fpcn"],{stdout:"pipe",stderr:"ignore"}),out=await new Response(proc.stdout).text(),code=await proc.exited;return code===0||code===1?parseLsofListeners(out):null}catch{return null}}function dedupeListeners(rows){let seen=new Map;for(let row of rows){let key=`${row.pid}:${row.port}`;if(!seen.has(key))seen.set(key,row)}return[...seen.values()].sort((a,b)=>a.port-b.port||a.pid-b.pid)}async function scanListeningPorts(){let raw=process.platform==="linux"?readProcListeners():await readLsofListeners();if(!raw)return null;let rows=dedupeListeners(raw),cwds=new Map;for(let pid of new Set(rows.map((r)=>r.pid)))cwds.set(pid,await processCwd(pid));return rows.map((r)=>({...r,cwd:cwds.get(r.pid)??null}))}export{scanListeningPorts,parseProcNetTcp,parseLsofListeners,dedupeListeners};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{bundleWithBun,childProbeCommand,ensurePtyHostReachable,hasFrozenPtySessions,listPtyHostSessions,liveChildCount,ptyHostHasLiveSessions,resolveNodeBinary,resolveNodePtyHostSpawn,runChildProbe,sweepPtyHostSessions}from"./chunk-z43e08kw.js";import"./chunk-w77s2df8.js";import"./chunk-mqfvzdpr.js";import"./chunk-rxqdw6s5.js";import"./chunk-g9ba25q5.js";import"./chunk-e58kj4gm.js";import"./chunk-0a65j1zj.js";import"./chunk-bcyex84w.js";import"./chunk-qzzmd63x.js";import"./chunk-96kvwzj8.js";import"./chunk-br8r72bf.js";import"./chunk-yt15y085.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{sweepPtyHostSessions,runChildProbe,resolveNodePtyHostSpawn,resolveNodeBinary,ptyHostHasLiveSessions,liveChildCount,listPtyHostSessions,hasFrozenPtySessions,ensurePtyHostReachable,childProbeCommand,bundleWithBun};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{RoveDaemonClient}from"./chunk-
|
|
2
|
+
import{RoveDaemonClient}from"./chunk-qzzmd63x.js";import{defaultDaemonSocketPath,defaultPtyHostSocketPath}from"./chunk-eqdbfgq5.js";import{spawn}from"child_process";import{existsSync}from"fs";import{join}from"path";var LAUNCH_CMD_ENV="ROVE_LAUNCH_CMD",LAUNCH_LOG_ENV="ROVE_LAUNCH_LOG",WIN_DETACHED_LAUNCHER_PS=`
|
|
3
3
|
$ErrorActionPreference = 'Stop'
|
|
4
4
|
$cmd = $env:${LAUNCH_CMD_ENV}
|
|
5
5
|
$log = $env:${LAUNCH_LOG_ENV}
|