@sma1lboy/rove 0.9.310-next.559 → 0.9.310-next.563
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-05f48bp9.js +2 -0
- package/dist/cli/{chunk-a5q533wq.js → chunk-0697addz.js} +1 -1
- package/dist/cli/{chunk-d7s65be9.js → chunk-0efrwv4s.js} +1 -1
- package/dist/cli/{chunk-qa0vwjkr.js → chunk-0j7ek1n7.js} +1 -1
- package/dist/cli/{chunk-2bawvmhn.js → chunk-12s0srrp.js} +1 -1
- package/dist/cli/{chunk-7kb0trqk.js → chunk-1fka2rvz.js} +1 -1
- package/dist/cli/{chunk-wy3npgyx.js → chunk-1zrmesqr.js} +1 -1
- package/dist/cli/{chunk-destrr2j.js → chunk-24b23kpd.js} +1 -1
- package/dist/cli/{chunk-zz3zgg43.js → chunk-29cb0525.js} +1 -1
- package/dist/cli/{chunk-ber44awg.js → chunk-3hgv1edf.js} +1 -1
- package/dist/cli/{chunk-2rd66htw.js → chunk-3xjenrkd.js} +1 -1
- package/dist/cli/{chunk-jz47rwj0.js → chunk-4sjvrxw3.js} +1 -1
- package/dist/cli/{chunk-ez21t2kp.js → chunk-4yjj71gy.js} +1 -1
- package/dist/cli/{chunk-5tr6zt00.js → chunk-57atdjmz.js} +1 -1
- package/dist/cli/{chunk-fryx0yt6.js → chunk-58gz8k9a.js} +1 -1
- package/dist/cli/{chunk-pwazhwkg.js → chunk-5rxef858.js} +2 -2
- package/dist/cli/{chunk-qwca52vp.js → chunk-5vbere2y.js} +1 -1
- package/dist/cli/{chunk-9q7a5w4f.js → chunk-68tm9zkw.js} +1 -1
- package/dist/cli/{chunk-3qjq9q32.js → chunk-6dgr7g23.js} +2 -2
- package/dist/cli/{chunk-jtcta36e.js → chunk-6qq0s6gb.js} +1 -1
- package/dist/cli/{chunk-mmc7j6va.js → chunk-719g5sdr.js} +1 -1
- package/dist/cli/{chunk-czdwt3cm.js → chunk-77a3edhb.js} +1 -1
- package/dist/cli/{chunk-857emjfc.js → chunk-77dtskpj.js} +1 -1
- package/dist/cli/{chunk-amw651y8.js → chunk-7ab1mvwq.js} +1 -1
- package/dist/cli/{chunk-vkbk3j8c.js → chunk-7dy9dtnd.js} +1 -1
- package/dist/cli/{chunk-eag2w0yg.js → chunk-8ka3rkq0.js} +1 -1
- package/dist/cli/{chunk-pdqcahqx.js → chunk-8mb7wv6c.js} +1 -1
- package/dist/cli/{chunk-d7d52brs.js → chunk-8q6472q8.js} +1 -1
- package/dist/cli/{chunk-hdw1xdne.js → chunk-8sa08g59.js} +1 -1
- package/dist/cli/{chunk-dws8myyz.js → chunk-8w5kf8sn.js} +2 -2
- package/dist/cli/{chunk-7z6trdqn.js → chunk-9dx2q7zk.js} +1 -1
- package/dist/cli/{chunk-t6pjxd21.js → chunk-ak03m5xq.js} +1 -1
- package/dist/cli/{chunk-xmpxx125.js → chunk-amrn7zzr.js} +4 -4
- package/dist/cli/{chunk-g15q03xt.js → chunk-amsqdjsj.js} +2 -2
- package/dist/cli/{chunk-sxev8fyk.js → chunk-b43gbrar.js} +1 -1
- package/dist/cli/{chunk-t5pswmrv.js → chunk-b9cqz55n.js} +1 -1
- package/dist/cli/{chunk-2tjf67y8.js → chunk-bn8nrqde.js} +1 -1
- package/dist/cli/{chunk-hr15t62t.js → chunk-brpz7xfs.js} +1 -1
- package/dist/cli/{chunk-eg3xtzex.js → chunk-c0xxw2hd.js} +1 -1
- package/dist/cli/{chunk-sssebf3y.js → chunk-cfb6mvz5.js} +2 -2
- package/dist/cli/{chunk-c9jdd0bp.js → chunk-dfap5t5n.js} +1 -1
- package/dist/cli/{chunk-xkaz06pk.js → chunk-dteyj6sh.js} +1 -1
- package/dist/cli/{chunk-tv4frx8n.js → chunk-dy8sxc0y.js} +1 -1
- package/dist/cli/{chunk-rr12s7w2.js → chunk-ec8v99ky.js} +1 -1
- package/dist/cli/{chunk-rzt1yax7.js → chunk-ekq0jjdn.js} +1 -1
- package/dist/cli/{chunk-tpq3nh5a.js → chunk-emrnrpk4.js} +1 -1
- package/dist/cli/{chunk-0sr4xx7k.js → chunk-et8cbkct.js} +1 -1
- package/dist/cli/chunk-evf15cs5.js +3 -0
- package/dist/cli/{chunk-t3q9yefp.js → chunk-fdhs4vct.js} +1 -1
- package/dist/cli/{chunk-v6c6d046.js → chunk-fkg418zt.js} +1 -1
- package/dist/cli/{chunk-btjgh2ra.js → chunk-fmefaw8c.js} +1 -1
- package/dist/cli/{chunk-19dgqzwx.js → chunk-g2brwxbt.js} +1 -1
- package/dist/cli/{chunk-qtw5157e.js → chunk-g8w7rhdn.js} +1 -1
- package/dist/cli/{chunk-6yrghc05.js → chunk-gx0hxf04.js} +1 -1
- package/dist/cli/{chunk-jxpn0k2r.js → chunk-h97m77zg.js} +1 -1
- package/dist/cli/{chunk-8este27x.js → chunk-jc0a959d.js} +1 -1
- package/dist/cli/{chunk-8scnejbd.js → chunk-jpw1h41n.js} +6 -6
- package/dist/cli/{chunk-mq17abaa.js → chunk-jwjac2fy.js} +1 -1
- package/dist/cli/{chunk-yxc4xdk9.js → chunk-ke1hdjmc.js} +1 -1
- package/dist/cli/{chunk-2exdah0a.js → chunk-kn7vqxfv.js} +1 -1
- package/dist/cli/{chunk-7f49kec6.js → chunk-m74qxqw0.js} +1 -1
- package/dist/cli/{chunk-nwecgbgc.js → chunk-mcf87xkw.js} +1 -1
- package/dist/cli/{chunk-g9q2rv2t.js → chunk-mhzcc4gm.js} +1 -1
- package/dist/cli/{chunk-m8xjhaye.js → chunk-mwrkfav9.js} +1 -1
- package/dist/cli/{chunk-nsdr8ax7.js → chunk-na3mghmp.js} +1 -1
- package/dist/cli/{chunk-r5yv9jf4.js → chunk-nbm76why.js} +1 -1
- package/dist/cli/{chunk-kpxyk2eq.js → chunk-nw1qpmgp.js} +1 -1
- package/dist/cli/{chunk-ds884zsm.js → chunk-nynd14v2.js} +1 -1
- package/dist/cli/{chunk-38zkja6q.js → chunk-p55es0nf.js} +1 -1
- package/dist/cli/{chunk-31dz2pzc.js → chunk-ppn8jgza.js} +1 -1
- package/dist/cli/{chunk-zrakbt5x.js → chunk-pvvc91j9.js} +1 -1
- package/dist/cli/{chunk-crypnhab.js → chunk-qmgjybne.js} +1 -1
- package/dist/cli/{chunk-g0gvzjc5.js → chunk-qzc40xdm.js} +3 -3
- package/dist/cli/{chunk-n70a0qaq.js → chunk-r3dk08nv.js} +4 -4
- package/dist/cli/{chunk-g760b406.js → chunk-s6ssjw42.js} +1 -1
- package/dist/cli/{chunk-rmb5nq67.js → chunk-sd1j6njw.js} +1 -1
- package/dist/cli/{chunk-ydn9jss2.js → chunk-sy81vcaz.js} +1 -1
- package/dist/cli/{chunk-h24edpme.js → chunk-t4zxjveq.js} +1 -1
- package/dist/cli/{chunk-6dnpw13z.js → chunk-t9zfqzks.js} +1 -1
- package/dist/cli/{chunk-vdvh7880.js → chunk-tbmv79y6.js} +1 -1
- package/dist/cli/{chunk-0453a4nz.js → chunk-tfw67bs6.js} +1 -1
- package/dist/cli/{chunk-d79qqcw2.js → chunk-tz857pe4.js} +1 -1
- package/dist/cli/{chunk-apjwr0rr.js → chunk-v67f3xhm.js} +1 -1
- package/dist/cli/{chunk-gq8fe1hp.js → chunk-vh82t8c3.js} +1 -1
- package/dist/cli/{chunk-bnct1ak8.js → chunk-w7d25tpx.js} +1 -1
- package/dist/cli/{chunk-krqxpxn3.js → chunk-w95nbs2v.js} +1 -1
- package/dist/cli/{chunk-fkpszxch.js → chunk-wbjzydbg.js} +1 -1
- package/dist/cli/{chunk-p6gdash6.js → chunk-wzvantp2.js} +1 -1
- package/dist/cli/{chunk-1ryknh8k.js → chunk-x83ew1gv.js} +2 -2
- package/dist/cli/{chunk-5rsp8ncr.js → chunk-xdmamqy7.js} +1 -1
- package/dist/cli/{chunk-b6ngs04t.js → chunk-xev978d9.js} +1 -1
- package/dist/cli/{chunk-89jxe89m.js → chunk-y20ga9r1.js} +1 -1
- package/dist/cli/{chunk-6qb8qfcs.js → chunk-ygscavge.js} +1 -1
- package/dist/cli/{chunk-m3fz6saz.js → chunk-yhwebnh8.js} +1 -1
- package/dist/cli/{chunk-hb5cv8v5.js → chunk-yztcd26z.js} +1 -1
- package/dist/cli/{chunk-tk9rm3ds.js → chunk-zp4vcr3h.js} +1 -1
- package/dist/cli/{chunk-5rjxjx3a.js → chunk-zs8a30dk.js} +5 -5
- package/dist/cli/index.js +3 -3
- package/dist/cli/rove-run.js +1 -1
- package/dist/cli/rove.js +1 -1
- package/dist/web/assets/index-BVNCaVVh.css +1 -0
- package/dist/web/assets/{index-Bw0t2iIi.js → index-hwtDYCTh.js} +41 -41
- package/dist/web/assets/{term-mount-Bo7uKsdp.js → term-mount-d9tMt4Yx.js} +1 -1
- package/dist/web/index.html +2 -2
- package/dist/web/relay/index.html +2 -2
- package/dist/web/relay-client/assets/{index-Cssqb7QX.js → index-Dm7tNVrV.js} +73 -73
- package/dist/web/relay-client/assets/index-_cdTNvN7.css +1 -0
- package/dist/web/relay-client/index.html +2 -2
- package/package.json +1 -1
- package/dist/cli/chunk-34kma0kp.js +0 -3
- package/dist/cli/chunk-40chbgb9.js +0 -2
- package/dist/web/assets/index-DIrSzOs8.css +0 -1
- package/dist/web/relay-client/assets/index-zWLS0vCR.css +0 -1
- /package/dist/cli/{chunk-pvnf6nvw.js → chunk-1wdp0qh4.js} +0 -0
- /package/dist/cli/{chunk-527kk5yh.js → chunk-6qwjd3da.js} +0 -0
- /package/dist/cli/{chunk-aqz1vpx4.js → chunk-7eqzs28e.js} +0 -0
- /package/dist/cli/{chunk-0ft4n0t7.js → chunk-8rxg12aj.js} +0 -0
- /package/dist/cli/{chunk-tqr83nnm.js → chunk-aena2jzj.js} +0 -0
- /package/dist/cli/{chunk-qkehg2c1.js → chunk-f1csqde7.js} +0 -0
- /package/dist/cli/{chunk-1mp632fj.js → chunk-ksx55wt3.js} +0 -0
- /package/dist/cli/{chunk-86b3g9z0.js → chunk-wk38kegh.js} +0 -0
- /package/dist/cli/{chunk-5z8v6pak.js → chunk-wmrmwncn.js} +0 -0
- /package/dist/cli/{chunk-yvg46jh9.js → chunk-wx77yjhc.js} +0 -0
- /package/dist/cli/{chunk-ry1xwebt.js → chunk-ytrktnmv.js} +0 -0
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{INBOUND_CLASSES,INBOUND_KEY,deniedClasses,inboundClassOf,inboundRefusal,setInbound}from"./chunk-6qq0s6gb.js";import"./chunk-zs8a30dk.js";import"./chunk-8mb7wv6c.js";import"./chunk-57atdjmz.js";import"./chunk-73a9kk03.js";import"./chunk-4sjvrxw3.js";import"./chunk-w7mh9pk1.js";import"./chunk-sns4xm7n.js";import"./chunk-3p2mr8yr.js";import"./chunk-evf15cs5.js";import"./chunk-zcywdm3y.js";import"./chunk-p847wb8w.js";import"./chunk-aena2jzj.js";import"./chunk-q8ffd1pc.js";import"./chunk-rh5024pb.js";import"./chunk-d1vv8xk6.js";import"./chunk-2bgmby1d.js";import"./chunk-5mhvjytn.js";import"./chunk-jpc5yh8e.js";import"./chunk-24b23kpd.js";import"./chunk-v67f3xhm.js";import"./chunk-pcp1q3fc.js";import"./chunk-v8nbqjwc.js";import"./chunk-ws2q07kb.js";import"./chunk-5swzs64n.js";import"./chunk-mdx18vtz.js";import"./chunk-0j7ek1n7.js";import"./chunk-cfb6mvz5.js";import"./chunk-y0e28qha.js";import"./chunk-gx0hxf04.js";import"./chunk-7eqzs28e.js";import"./chunk-5x9zmxbm.js";import"./chunk-f1csqde7.js";import"./chunk-m1jbthc5.js";import"./chunk-fxpbaff2.js";import"./chunk-dmzg9zdc.js";import"./chunk-kg9kmwt9.js";import"./chunk-9k0r47z3.js";import"./chunk-brpz7xfs.js";import"./chunk-grbrh92f.js";import"./chunk-v8ms64g1.js";import"./chunk-7b2x6nkj.js";import"./chunk-8ka3rkq0.js";import"./chunk-p55es0nf.js";import"./chunk-2caxfsms.js";import"./chunk-y0skz8j9.js";import"./chunk-mqfvzdpr.js";import"./chunk-wmrmwncn.js";import"./chunk-hpay0ax8.js";import"./chunk-tteswdyf.js";import"./chunk-vpk5m2z6.js";import"./chunk-rxqdw6s5.js";import"./chunk-tn9gtf18.js";import"./chunk-vnp1k7ek.js";import"./chunk-c9c6yczz.js";import"./chunk-cw6xz64t.js";import"./chunk-drhwacg1.js";import"./chunk-wrqv141p.js";import"./chunk-5rxef858.js";import"./chunk-sy81vcaz.js";import"./chunk-bn8nrqde.js";import"./chunk-6qwjd3da.js";import"./chunk-f60hmm20.js";import"./chunk-03ab55aq.js";import"./chunk-w7zv47mp.js";import"./chunk-ve196r2v.js";import"./chunk-nr7c9q0j.js";import"./chunk-r478tzjz.js";import"./chunk-5kyajt3q.js";import"./chunk-k7tdg6kb.js";import"./chunk-1pmzr8kr.js";import"./chunk-e5jxbd98.js";import"./chunk-84q9hv7m.js";import"./chunk-96kvwzj8.js";import"./chunk-etfh8f4z.js";import"./chunk-52stxk43.js";import"./chunk-h8qg9v95.js";import"./chunk-78y80xe8.js";import"./chunk-0zs13rdq.js";import"./chunk-tm6vvy5t.js";import"./chunk-wx77yjhc.js";import"./chunk-nks2q6d9.js";import"./chunk-r4vwq5wv.js";import"./chunk-b43gbrar.js";import"./chunk-7dy9dtnd.js";import"./chunk-6hjt5an9.js";import"./chunk-ptyqj15s.js";import"./chunk-xdmamqy7.js";import"./chunk-m74qxqw0.js";import"./chunk-sckqk79z.js";import"./chunk-y8hjgmn0.js";import"./chunk-w2czjjxy.js";import"./chunk-8q0nmdh3.js";import"./chunk-pn5ygqn6.js";import"./chunk-a6z2ggxd.js";import"./chunk-8rxg12aj.js";import"./chunk-n835vmw4.js";import"./chunk-tw25g9g5.js";import"./chunk-yt15y085.js";import"./chunk-2z2jwetd.js";import"./chunk-pzbcbmm4.js";import"./chunk-4ctx6hst.js";import"./chunk-g6wb8p4p.js";import"./chunk-nc46gddg.js";import"./chunk-ksx55wt3.js";import"./chunk-91sykzqq.js";export{setInbound,inboundRefusal,inboundClassOf,deniedClasses,INBOUND_KEY,INBOUND_CLASSES};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{smallIgnoredPaths}from"./chunk-
|
|
2
|
+
import{smallIgnoredPaths}from"./chunk-1wdp0qh4.js";import{DIRTY_WORKTREE_CODE,RepoHasNoCommitsError,canonicalize,describeDirtyWorktreeWork,isRoveManagedPath,isUnderManagedWorktreesRoot,managedWorktreeRootForPath,remoteManagedRootForPath,remoteWorktreePathFor,requireAbsolute,worktreePathFor}from"./chunk-aena2jzj.js";import{parsePorcelainRows}from"./chunk-dmzg9zdc.js";import{READ_ONLY_GIT_ENV}from"./chunk-9k0r47z3.js";import{REPO_CONFIG_DIRS,readFirstNonEmptyRepoFile}from"./chunk-tteswdyf.js";import{execHostForRepo,execHostForWorktreePath}from"./chunk-cw6xz64t.js";import{getRemoteRepoConfig}from"./chunk-52stxk43.js";import{loadStateFile}from"./chunk-nks2q6d9.js";import path4 from"path";function parseDirtyPaths(stdout){return parsePorcelainRows(stdout).filter((row)=>(row.x+row.y).trim().length>0).map((row)=>row.path).filter((p)=>p.length>0)}function isDirtyOutput(stdout){return parseDirtyPaths(stdout).length>0}var METER_RE=/(\d{1,3})% \(\d+\/\d+\)/g;function checkoutProgressReader(onPercent){let tail="",last=-1;return(chunk)=>{let text=tail+chunk,end=Math.max(text.lastIndexOf("\r"),text.lastIndexOf(`
|
|
3
3
|
`));if(end<0){tail=text;return}tail=text.slice(end+1);let percent=-1;for(let match of text.slice(0,end).matchAll(METER_RE))percent=Number(match[1]);if(percent<0||percent>100||percent===last)return;last=percent,onPercent(percent)}}class CheckpointError extends Error{code;constructor(code,reason){super(`${code}: ${reason}`);this.code=code;this.name="CheckpointError"}}function checkpointRef(taskId,n){return`refs/rove/checkpoints/${taskId}/${n}`}var FALLBACK_IDENTITY={GIT_AUTHOR_NAME:"Rove",GIT_AUTHOR_EMAIL:"rove@localhost",GIT_COMMITTER_NAME:"Rove",GIT_COMMITTER_EMAIL:"rove@localhost"};function parseSubject(subject){let parts=subject.trim().split(/\s+/).slice(3),at=parts.pop()??"";return parts[0]?{at,tabId:parts[0]}:{at}}async function listCheckpoints(deps,exec,cwd,taskId){let prefix=`refs/rove/checkpoints/${taskId}/`,out=await deps.runGit(exec,["for-each-ref","--format=%(refname)%09%(objectname)%09%(tree)%09%(subject)",prefix],{cwd,allowFail:!0,readOnly:!0});if(out.exitCode!==0)return[];let records=[];for(let line of out.stdout.split(`
|
|
4
4
|
`)){let[ref,commit,tree,subject=""]=line.split("\t"),n=Number(ref?.slice(prefix.length));if(!ref||!commit||!tree||!Number.isInteger(n))continue;records.push({n,ref,commit,tree,...parseSubject(subject)})}return records.sort((a,b)=>a.n-b.n)}async function gitlinkPaths(exec,deps,cwd,tree){let out=await deps.runGit(exec,["ls-tree","-r",tree],{cwd,allowFail:!0,readOnly:!0});if(out.exitCode!==0)return[];return out.stdout.split(`
|
|
5
5
|
`).filter((line)=>line.startsWith("160000 ")).map((line)=>line.slice(line.indexOf("\t")+1)).filter((p)=>p.length>0)}async function withTempIndex(deps,exec,cwd,body){let name=`rove-ckpt-index-${process.pid}-${Math.random().toString(36).slice(2,8)}`,indexPath=(await deps.runGit(exec,["rev-parse","--git-path",name],{cwd,allowFail:!0,readOnly:!0})).stdout.trim();if(!indexPath)throw new CheckpointError("CHECKPOINT_FAILED",`${cwd} is not a git work tree`);try{return await body((args,extraEnv)=>deps.runGit(exec,args,{cwd,allowFail:!0,env:{GIT_INDEX_FILE:indexPath,...extraEnv}}),indexPath)}finally{await exec.run(["rm","-f",indexPath],{cwd}).catch(()=>{return})}}async function snapshotTree(deps,exec,cwd,head){let tree=await withTempIndex(deps,exec,cwd,async(gitIdx,indexPath)=>{let real=(await deps.runGit(exec,["rev-parse","--git-path","index"],{cwd,allowFail:!0,readOnly:!0})).stdout.trim();if(!(real!==""&&(await exec.run(["cp","-p",real,indexPath],{cwd}).catch(()=>{return}))?.exitCode===0)&&head&&(await gitIdx(["read-tree",head])).exitCode!==0)throw new CheckpointError("CHECKPOINT_FAILED","read-tree failed");if((await gitIdx(["add","-A"])).exitCode!==0)throw new CheckpointError("CHECKPOINT_FAILED","git add -A failed");let written=(await gitIdx(["write-tree"])).stdout.trim();if(!written)throw new CheckpointError("CHECKPOINT_FAILED","write-tree failed");return written});return{tree,uncaptured:await gitlinkPaths(exec,deps,cwd,tree)}}async function headCommit(deps,exec,cwd){let out=await deps.runGit(exec,["rev-parse","--verify","-q","HEAD"],{cwd,allowFail:!0,readOnly:!0});return out.exitCode===0?out.stdout.trim():""}async function takeCheckpoint(deps,exec,worktreePath,taskId,opts={}){let head=await headCommit(deps,exec,worktreePath),{tree,uncaptured}=await snapshotTree(deps,exec,worktreePath,head),existing=await listCheckpoints(deps,exec,worktreePath,taskId),latest=existing[existing.length-1];if(latest&&latest.tree===tree)return{created:!1,checkpoint:latest};let at=(opts.now??new Date).toISOString(),hasIdentity=(await deps.runGit(exec,["var","GIT_COMMITTER_IDENT"],{cwd:worktreePath,allowFail:!0,readOnly:!0})).exitCode===0;for(let n=(latest?.n??0)+1,attempt=0;attempt<5;n++,attempt++){let message=["rove checkpoint",n,opts.tabId,at].filter((p)=>p!==void 0&&p!=="").join(" "),commitArgs=head?["commit-tree",tree,"-p",head,"-m",message]:["commit-tree",tree,"-m",message],commit=await deps.runGit(exec,commitArgs,{cwd:worktreePath,allowFail:!0,...hasIdentity?{}:{env:FALLBACK_IDENTITY}}),sha=commit.stdout.trim();if(commit.exitCode!==0||!sha)throw new CheckpointError("CHECKPOINT_FAILED",`commit-tree failed: ${commit.stderr.trim()}`);let ref=checkpointRef(taskId,n);if((await deps.runGit(exec,["update-ref",ref,sha,""],{cwd:worktreePath,allowFail:!0})).exitCode===0)return await pruneCheckpoints(deps,exec,worktreePath,taskId).catch(()=>{return}),{created:!0,checkpoint:{n,ref,commit:sha,tree,at,...opts.tabId?{tabId:opts.tabId}:{}},uncaptured}}throw new CheckpointError("CHECKPOINT_FAILED",`could not allocate a checkpoint number for ${taskId}`)}async function deleteRefs(deps,exec,cwd,refs){for(let ref of refs)await deps.runGit(exec,["update-ref","-d",ref],{cwd,allowFail:!0})}async function pruneCheckpoints(deps,exec,cwd,taskId,keep=100){let all=await listCheckpoints(deps,exec,cwd,taskId),doomed=all.slice(0,Math.max(0,all.length-keep));return await deleteRefs(deps,exec,cwd,doomed.map((c)=>c.ref)),doomed.length}async function deleteTaskCheckpoints(deps,exec,cwd,taskId){let all=await listCheckpoints(deps,exec,cwd,taskId);return await deleteRefs(deps,exec,cwd,all.map((c)=>c.ref)),all.length}async function moveTaskCheckpoints(deps,exec,cwd,fromId,toId){let moved=0;for(let c of await listCheckpoints(deps,exec,cwd,fromId)){if((await deps.runGit(exec,["update-ref",checkpointRef(toId,c.n),c.commit,""],{cwd,allowFail:!0})).exitCode!==0)continue;await deleteRefs(deps,exec,cwd,[c.ref]),moved++}return moved}async function rewindTo(deps,exec,worktreePath,taskId,n,opts={}){let target=(await listCheckpoints(deps,exec,worktreePath,taskId)).find((c)=>c.n===n);if(!target)throw new CheckpointError("CHECKPOINT_NOT_FOUND",`task ${taskId} has no checkpoint ${n}`);let taken=await takeCheckpoint(deps,exec,worktreePath,taskId,{now:opts.now}),undo=taken.checkpoint,uncaptured=taken.created?taken.uncaptured:[];await withTempIndex(deps,exec,worktreePath,async(gitIdx)=>{if((await gitIdx(["read-tree",undo.tree])).exitCode!==0)throw new CheckpointError("CHECKPOINT_FAILED","read-tree (current) failed");let res=await gitIdx(["read-tree","--reset","-u",target.tree]);if(res.exitCode!==0)throw new CheckpointError("CHECKPOINT_FAILED",`read-tree failed: ${res.stderr.trim()}`)});let head=await headCommit(deps,exec,worktreePath);return await deps.runGit(exec,head?["reset","-q"]:["read-tree","--empty"],{cwd:worktreePath,allowFail:!0}),{target,undo,uncaptured}}import fs from"fs/promises";import path from"path";var WORKTREE_CLONE_IGNORED_KEY="worktree.cloneIgnored",DEFAULT_CLONE_DIRS=["node_modules",".venv","target",".build"];function isCloneIgnoredEnabled(){return loadStateFile()[WORKTREE_CLONE_IGNORED_KEY]!==!1}function parseCloneDirs(text){return text.split(/\r?\n/).map((line)=>line.replace(/#.*$/,"").trim()).filter((e)=>e.length>0&&e!=="."&&e!==".."&&!/[/\\]/.test(e)&&!e.startsWith("-"))}function resolveCloneDirs(worktreePath){let file=readFirstNonEmptyRepoFile(worktreePath,"clone-dirs");return file===void 0?DEFAULT_CLONE_DIRS:parseCloneDirs(file)}var CLONEFILEAT_PERL='my $r = syscall(462, -2, $ARGV[0], -2, $ARGV[1], 0); if ($r != 0) { print STDERR "clonefileat: $!\\n"; exit 1 }';function defaultCloneDeps(exec){return{platform:process.platform,statDev:async(p)=>(await fs.stat(p)).dev,isApfs:async(p)=>{let r=await exec.run(["/bin/df","-T","apfs",p]);return r.exitCode===0&&r.stdout.trim().split(`
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{RemoteOrchestrator}from"./chunk-
|
|
2
|
+
import{RemoteOrchestrator}from"./chunk-y20ga9r1.js";import{startTunnel}from"./chunk-gx0hxf04.js";import{discoverMachine,learnedFrom}from"./chunk-7eqzs28e.js";import{createStateCell}from"./chunk-7b2x6nkj.js";import{dedupeMachines,duplicateAliasOf,listMachines,readMachines,setMachineIdentity,updateMachine}from"./chunk-5kyajt3q.js";import{RoveDaemonClient}from"./chunk-84q9hv7m.js";import{loadStateFile}from"./chunk-nks2q6d9.js";import{logClient,logClientError}from"./chunk-y8hjgmn0.js";function discoverReason(failure){switch(failure.code){case"SSH_FAILED":return!failure.ssh||failure.ssh==="unknown"?"ssh-failed":failure.ssh;case"NO_ROVE":return"no-rove";case"NO_DAEMON":return"no-daemon";default:return"bad-status"}}var NO_LIVE={activity:new Map,changes:new Map,tokens:new Map},PEER_CHANNELS=["task.snapshot","engine-state","worktree.changes","task.tokens"];class MachineHub{slots=new Map;machinesAcc=createStateCell([],"machines.status");tasksAcc=createStateCell([],"machines.tasks");liveAcc=createStateCell(NO_LIVE,"machines.live");disposed=!1;machinesSignal(){return this.machinesAcc}tasksSignal(){return this.tasksAcc}liveSignal(){return this.liveAcc}remoteTaskIds(){let ids=new Set;for(let slot of this.slots.values())for(let task of slot.tasks)ids.add(String(task.id));return ids}sync(entries=dedupeMachines(listMachines())){if(this.disposed)return;let wanted=new Map(entries.map((entry)=>[entry.alias,entry])),fresh=[];for(let[alias,slot]of this.slots){let next=wanted.get(alias);if(next&&sameAddress(slot.entry,next))slot.entry=next;else this.drop(alias)}for(let entry of entries){if(this.slots.has(entry.alias))continue;this.slots.set(entry.alias,{entry,tasks:[]}),fresh.push(entry)}if(fresh.length===0&&wanted.size===this.slots.size&&this.machinesAcc.get().length===wanted.size)return;let known=new Map(this.machinesAcc.get().map((row)=>[row.alias,row]));this.machinesAcc.set([...this.slots.values()].map((slot)=>known.get(slot.entry.alias)??{alias:slot.entry.alias,hostLabel:slot.entry.alias,state:"connecting"})),this.republishTasks(),this.republishLive();for(let entry of fresh)this.connect(entry)}drop(alias){let slot=this.slots.get(alias);if(!slot)return;this.slots.delete(alias),slot.unsubscribe?.(),slot.orchestrator?.dispose(),slot.tunnel?.stop()}async connect(entry){let slot=this.slots.get(entry.alias);if(!slot||this.disposed)return;let found=await discoverMachine(entry.alias,entry);if(this.disposed||this.slots.get(entry.alias)!==slot)return;let sockets=found.ok?{daemon:found.status.socketPath,pty:found.status.ptySocketPath}:entry.sockets,failed=found.ok?{}:{error:found.message,reason:discoverReason(found)};if(!sockets){this.setStatus(entry.alias,{state:"offline",...failed});return}if(!found.ok)this.setStatus(entry.alias,failed);let learned=found.ok?learnedFrom(found):{};if(found.ok)updateMachine(entry.alias,learned);let tunnel=startTunnel({alias:entry.alias,config:{...entry,...learned,sockets},remoteDaemonSocket:sockets.daemon,remotePtySocket:sockets.pty});if(slot.tunnel=tunnel,tunnel.state()==="unsupported"){this.setStatus(entry.alias,{state:"unsupported",error:"SSH unix-socket forwarding is not available on Windows",reason:"no-forwarding"});return}if(tunnel.onState((state)=>{if(this.slots.get(entry.alias)!==slot)return;if(state==="online")this.openOrchestrator(entry,tunnel);else if(state==="offline"){let known=this.machinesAcc.get().find((row)=>row.alias===entry.alias)?.reason;this.setStatus(entry.alias,{state:"offline",reason:known??"lost"}),this.republishTasks()}}),tunnel.state()==="online")await this.openOrchestrator(entry,tunnel)}async openOrchestrator(entry,tunnel){let slot=this.slots.get(entry.alias);if(!slot||this.disposed||slot.orchestrator)return;let client=new RoveDaemonClient(tunnel.daemonSocketPath),orchestrator=new RemoteOrchestrator(client,{role:"gui",channels:PEER_CHANNELS,expectForeignHome:!0,onPeerIdentity:(peer)=>this.onPeerIdentity(entry.alias,peer)});slot.orchestrator=orchestrator;try{if(await orchestrator.init(),this.slots.get(entry.alias)!==slot)return}catch(err){let message=err instanceof Error?err.message:String(err);this.setStatus(entry.alias,{state:classifyHandshakeFailure(message),error:message,reason:"handshake"}),logClientError("machines",err);return}let stopTasks=orchestrator.tasksSignal().subscribe(()=>{slot.tasks=orchestrator.tasksSignal().get(),this.republishTasks()}),stopConnection=orchestrator.connectionStateSignal().subscribe(()=>{let connected=orchestrator.connectionStateSignal().get()==="online";if(this.slots.get(entry.alias)!==slot)return;this.setStatus(entry.alias,connected?{state:"online",error:void 0,reason:void 0}:{state:"offline",reason:"lost"}),this.republishTasks()}),live=[orchestrator.engineStateSignal(),orchestrator.worktreeChangesSignal(),orchestrator.rowTokensSignal()].map((signal)=>signal.subscribe(()=>this.republishLive()));slot.unsubscribe=()=>{stopTasks(),stopConnection();for(let stop of live)stop()},slot.tasks=orchestrator.tasksSignal().get(),this.setStatus(entry.alias,{state:"online",version:orchestrator.daemonVersionSignal().get()??void 0,error:void 0,reason:void 0}),this.republishTasks(),this.republishLive(),logClient("machines",`${entry.alias} online (${slot.tasks.length} tasks)`)}republishLive(){let activity=new Map,changes=new Map,tokens=new Map;for(let slot of this.slots.values()){let o=slot.orchestrator;if(!o)continue;for(let[id,state]of o.engineStateSignal().get())activity.set(id,state);for(let[path,change]of o.worktreeChangesSignal().get()??[])changes.set(path,change);for(let[id,chips]of o.rowTokensSignal().get())tokens.set(id,chips)}this.liveAcc.set({activity,changes,tokens})}onPeerIdentity(alias,peer){if(!peer.hostname&&!peer.homeDir)return;let identity={hostname:peer.hostname,homeDir:peer.homeDir,daemonPid:peer.daemonPid};setMachineIdentity(alias,identity);let duplicate=duplicateAliasOf(readMachines(loadStateFile()),alias,identity);this.setStatus(alias,{hostname:peer.hostname||void 0,version:peer.roveVersion||void 0,...duplicate?{duplicateOf:duplicate}:{}})}setStatus(alias,patch){let next=this.machinesAcc.get().map((row)=>row.alias===alias?{...row,...patch}:row);this.machinesAcc.set(next)}republishTasks(){let merged=[];for(let slot of this.slots.values()){let status=this.machinesAcc.get().find((row)=>row.alias===slot.entry.alias);if(status?.duplicateOf)continue;let hostLabel=status?.hostLabel||slot.entry.alias,stale=status?.state!=="online";for(let task of slot.tasks)merged.push(stampOrigin(task,slot.entry.alias,hostLabel,stale))}this.tasksAcc.set(merged)}dispose(){this.disposed=!0;for(let alias of[...this.slots.keys()])this.drop(alias)}}function classifyHandshakeFailure(message){return/protocol v\d/i.test(message)?"mismatch":"offline"}function sameAddress(a,b){return a.host===b.host&&a.user===b.user&&a.port===b.port&&JSON.stringify(a.auth)===JSON.stringify(b.auth)}function stampOrigin(task,machineId,hostLabel,stale=!1){return{...task,origin:{machineId,hostLabel,...stale?{stale:!0}:{}}}}
|
|
3
3
|
export{MachineHub,stampOrigin};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{RELEASE_CHANNELS,channelOf}from"./chunk-
|
|
2
|
+
import{RELEASE_CHANNELS,channelOf}from"./chunk-brpz7xfs.js";import{loadStateFile,patchStateFile}from"./chunk-nks2q6d9.js";var UPDATE_CHANNEL_KEY="update.channel",UPDATE_DELAY_KEY="update.delayHours",UPDATE_NOTIFY_KEY="update.notify";function normalizeReleaseChannel(value){return RELEASE_CHANNELS.includes(value)?value:null}function preferredReleaseChannel(state=loadStateFile()){return normalizeReleaseChannel(state[UPDATE_CHANNEL_KEY])??channelOf()}function updateNotifyEnabled(raw){return raw!==!1}function rememberReleaseChannel(channel){patchStateFile({[UPDATE_CHANNEL_KEY]:channel})}function updateDelayHours(state=loadStateFile()){let value=state[UPDATE_DELAY_KEY];return typeof value==="number"&&Number.isFinite(value)&&value>0?value:0}
|
|
3
3
|
export{UPDATE_CHANNEL_KEY,UPDATE_NOTIFY_KEY,normalizeReleaseChannel,preferredReleaseChannel,updateNotifyEnabled,rememberReleaseChannel,updateDelayHours};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{installSkillErrors,missingSkillNames}from"./chunk-
|
|
2
|
+
import{installSkillErrors,missingSkillNames}from"./chunk-c0xxw2hd.js";import{createStateCell}from"./chunk-7b2x6nkj.js";import{installedEngineIds}from"./chunk-bn8nrqde.js";var skillMissing=createStateCell([]),POLL_MS=30000,started=!1;function refreshSkillStatus(){if(!started)return;installedEngineIds().then((installed)=>{let next=missingSkillNames(installed);if(next.join(`
|
|
3
3
|
`)!==skillMissing.get().join(`
|
|
4
4
|
`))skillMissing.set(next)}).catch(()=>{})}function startSkillStatus(){if(started)return;started=!0,refreshSkillStatus(),setInterval(refreshSkillStatus,POLL_MS).unref?.()}function installSkillNow(){let error=installSkillErrors();return refreshSkillStatus(),error}
|
|
5
5
|
export{skillMissing,refreshSkillStatus,startSkillStatus,installSkillNow};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{markCliTabSession,publishCliTabSnapshot,readDaemonTabs}from"./chunk-
|
|
2
|
+
import{markCliTabSession,publishCliTabSnapshot,readDaemonTabs}from"./chunk-evf15cs5.js";import{deriveTitleFromPrompt}from"./chunk-p847wb8w.js";import{TaskDeletingError}from"./chunk-aena2jzj.js";import{awaitEngineProcess,buildEngineSessionLaunch,deliverToHostedKey,enginePresence,ensureHostedEngine,ensureHostedSessionHost,findHostedEngineKey,hostedSessionFailureLine,hostedTaskKeys,killHostedSessions,launchReposOf,listHostedSessions,openHostedSessionHost,pastePromptWhenEngineUp,trustEngineWorktree,trustExtraRepos}from"./chunk-8ka3rkq0.js";import{engineLaunchArgv,engineResumeArgv,protocolEntry,withPinnedSessionId}from"./chunk-p55es0nf.js";import{hostedKeyFor}from"./chunk-2caxfsms.js";import{resolveSessionShell}from"./chunk-tn9gtf18.js";import{taskCwd}from"./chunk-sckqk79z.js";import{DEFAULT_TASK_VENDOR}from"./chunk-w2czjjxy.js";var MAX_SESSIONS_SCANNED=8;function titleFromMessages(messages){let firstUser=messages.find((m)=>m.role==="user");if(!firstUser)return"";let text=firstUser.blocks.filter((b)=>b.type==="text").map((b)=>b.text).join(" "),title=deriveTitleFromPrompt(text);return title.length>0?Buffer.from(title,"utf8").toString("utf8"):title}async function deriveTitleFromSession(worktree,vendor=DEFAULT_TASK_VENDOR){if(!worktree)return"";let{history}=protocolEntry(vendor),ids=await history.listSessionIdsForWorktree(worktree);for(let sessionId of ids.slice(0,MAX_SESSIONS_SCANNED)){let title=titleFromMessages(await history.readHistory(sessionId));if(title)return title}return""}async function deriveTitleFromSessionId(vendor,sessionId){if(!sessionId)return"";try{return titleFromMessages(await protocolEntry(vendor).history.readHistory(sessionId))}catch{return""}}async function getTask(link,taskId){let{task}=await link.request("task.get",{taskId});return task}async function ensureTaskWorktree(link,taskId){let task=await getTask(link,taskId);if(task.deletion)throw new TaskDeletingError(taskId);let hasExtras=Boolean(task.extraRepos?.length);if(task.worktreePath&&!hasExtras){let repos=task.sharesWorkspaceOf?await launchReposOf(link,taskId):void 0;return{task,worktreePath:taskCwd(task),repos}}let{worktreePath}=await link.request("task.ensureWorktree",{taskId});if(!worktreePath)throw Error(`task ${taskId} has no worktree`);return{task,worktreePath:taskCwd({worktreePath,cwdSubpath:task.cwdSubpath}),repos:hasExtras||task.sharesWorkspaceOf?await launchReposOf(link,taskId):void 0}}async function ensureTaskSessionAdapter(link,taskId){let{task,worktreePath,repos}=await ensureTaskWorktree(link,taskId),launch=taskEngineLaunch(task,worktreePath,{kind:"repo-init"},repos),host=await ensureHostedSessionHost();try{if(!(await ensureHostedEngine(host.rpc,worktreePath,launch)).alive)throw Error(`failed to start hosted engine session for ${taskId}`);if(launch.firstMessage){let engineBin=engineLaunchArgv({command:task.command,vendor:task.vendor,effort:task.modelEffort,model:task.model})[0];await pastePromptWhenEngineUp(host.rpc,launch.key,engineBin,launch.firstMessage,{initMarkerPath:launch.initMarkerPath,initTimeoutMs:launch.initTimeoutMs}).catch(()=>!1)}}finally{host.close()}return{session:launch.key,worktreePath}}async function startTaskSessionWithPromptAdapter(link,taskId,prompt,options={}){let{task,worktreePath,repos}=await ensureTaskWorktree(link,taskId);await link.request("task.observeLanguage",{taskId,text:prompt}).catch(()=>{});let base=engineLaunchArgv({command:task.command,vendor:task.vendor,effort:task.modelEffort,model:task.model}),row=(await readDaemonTabs(link,taskId).catch(()=>{return}))?.tabs.find((tab)=>tab.id==="tab-1"),held=row?.kind==="engine"&&row.spawned&&row.sessionId?row.sessionId:null,resumeArgv=held&&!options.newConversation?engineResumeArgv(base,task.vendor,held):null,host=await ensureHostedSessionHost();try{let start=async(argv,text)=>{let launch=taskEngineLaunch(task,worktreePath,{kind:"new-task",prompt:text},repos,argv),opened=await ensureHostedEngine(host.rpc,worktreePath,launch);if(!opened.alive)return{started:!1,error:"hosted session did not open",key:launch.key};let wait={initMarkerPath:launch.initMarkerPath,initTimeoutMs:launch.initTimeoutMs},reattached=opened.created===!1&&opened.respawned!==!0,paste=launch.firstMessage??(reattached?text:void 0);if((paste?await pastePromptWhenEngineUp(host.rpc,launch.key,base[0],paste,wait):await awaitEngineProcess(host.rpc,launch.key,base[0],wait))!==null)return{started:!0,key:launch.key};if(reattached)return{started:!1,error:"NOT_DELIVERED: tab-1 was already open and the prompt could not be pasted into its engine",key:launch.key};return{started:!1,error:await startFailureReason(host.rpc,launch.key),key:launch.key}};if(resumeArgv){let resumed=await start(resumeArgv,options.resumedPrompt??prompt);if(resumed.started)return{started:!0,resumed:!0};await killHostedSessions(host.rpc,[resumed.key],{wait:!0})}let pinned=withPinnedSessionId(base,task.vendor),{key:_key,...fresh}=await start(pinned.argv,prompt);if(fresh.started)await publishCliTabSnapshot(link,taskId,pinned.sessionId),await markCliTabSession(link,taskId,"tab-1",pinned.sessionId);return fresh}finally{host.close()}}async function startFailureReason(rpc,key){let tail=await hostedSessionFailureLine(rpc,key),base="engine process never started";return tail?`engine process never started; last session output: ${tail}`:"engine process never started"}function taskEngineLaunch(task,worktreePath,promptIntent,repos,argv=engineLaunchArgv({command:task.command,vendor:task.vendor,effort:task.modelEffort,model:task.model})){return trustEngineWorktree(task.vendor,worktreePath),trustExtraRepos(task.vendor,repos),buildEngineSessionLaunch({task:{id:task.id,kind:task.kind,vendor:task.vendor,repo:task.repo,repos},worktreePath,shell:resolveSessionShell(),argv,promptIntent})}async function deliverPromptToLiveEngineAdapter(task,prompt){let host=await openHostedSessionHost();if(!host)return!1;try{let sessions=await listHostedSessions(host.rpc),engineArgv=engineLaunchArgv({command:task.command,vendor:task.vendor}),key=findHostedEngineKey(sessions,task.id,engineArgv[0],task.scope);if(!key)return!1;let presence=await enginePresence(sessions.find((s)=>s.key===key)?.pid,engineArgv);if(presence.kind!=="engine")return!1;return await deliverToHostedKey(host.rpc,key,prompt,{vendor:presence.vendor})!==null}catch{return!1}finally{host.close()}}function tabIdFromHostedKey(key){return key.split("::")[1]??"tab-1"}async function deliverPromptToLiveEngineDetailedAdapter(task,prompt){let host=await openHostedSessionHost();if(!host)return{outcome:"no-session"};try{let sessions=await listHostedSessions(host.rpc),engineArgv=engineLaunchArgv({command:task.command,vendor:task.vendor}),key=findHostedEngineKey(sessions,task.id,engineArgv[0],task.scope);if(!key)return{outcome:"no-session"};let presence=await enginePresence(sessions.find((s)=>s.key===key)?.pid,engineArgv);if(presence.kind!=="engine")return{outcome:"no-engine",tabId:tabIdFromHostedKey(key)};return await deliverToHostedKey(host.rpc,key,prompt,{vendor:presence.vendor})===null?{outcome:"no-session"}:{outcome:"delivered",tabId:tabIdFromHostedKey(key)}}catch{return{outcome:"no-session"}}finally{host.close()}}async function deliverPromptToLiveEngineTabDetailedAdapter(target,prompt){let host=await openHostedSessionHost();if(!host)return{outcome:"no-session"};try{let key=hostedKeyFor(target.id,target.tabId,target.scope);if(!key)return{outcome:"no-session"};let sessions;try{sessions=await listHostedSessions(host.rpc)}catch{return{outcome:"no-session"}}let session=sessions.find((candidate)=>candidate.alive&&candidate.key===key);if(!session)return{outcome:"no-session"};let engineArgv=engineLaunchArgv({command:target.command,vendor:target.vendor}),presence=await enginePresence(session.pid,engineArgv);if(presence.kind!=="engine")return{outcome:"no-engine",tabId:target.tabId};return await deliverToHostedKey(host.rpc,key,prompt,{vendor:presence.vendor})===null?{outcome:"no-session"}:{outcome:"delivered",tabId:target.tabId}}finally{host.close()}}async function tearDownTaskSessionAdapter(taskId,scope){let host=await openHostedSessionHost();if(!host)return;try{let keys=hostedTaskKeys(await listHostedSessions(host.rpc),taskId,scope);await killHostedSessions(host.rpc,keys,{wait:!0})}catch{}finally{host.close()}}async function stopTaskEngineTabAdapter(taskId,tabId,scope){let host=await openHostedSessionHost();if(!host)return;try{let key=hostedKeyFor(taskId,tabId,scope);if(key)await killHostedSessions(host.rpc,[key],{wait:!0})}finally{host.close()}}
|
|
3
3
|
export{deriveTitleFromSession,deriveTitleFromSessionId,ensureTaskSessionAdapter,startTaskSessionWithPromptAdapter,deliverPromptToLiveEngineAdapter,deliverPromptToLiveEngineDetailedAdapter,deliverPromptToLiveEngineTabDetailedAdapter,tearDownTaskSessionAdapter,stopTaskEngineTabAdapter};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{API_VERBS,VERBS,VERB_ALIASES,VERB_GROUPS,findVerb,unknownVerbError}from"./chunk-
|
|
2
|
+
import{API_VERBS,VERBS,VERB_ALIASES,VERB_GROUPS,findVerb,unknownVerbError}from"./chunk-zs8a30dk.js";import"./chunk-8mb7wv6c.js";import"./chunk-57atdjmz.js";import"./chunk-73a9kk03.js";import"./chunk-4sjvrxw3.js";import"./chunk-w7mh9pk1.js";import"./chunk-sns4xm7n.js";import"./chunk-3p2mr8yr.js";import"./chunk-evf15cs5.js";import"./chunk-zcywdm3y.js";import"./chunk-p847wb8w.js";import"./chunk-aena2jzj.js";import"./chunk-q8ffd1pc.js";import"./chunk-rh5024pb.js";import"./chunk-d1vv8xk6.js";import"./chunk-2bgmby1d.js";import"./chunk-5mhvjytn.js";import"./chunk-jpc5yh8e.js";import"./chunk-24b23kpd.js";import"./chunk-v67f3xhm.js";import"./chunk-pcp1q3fc.js";import"./chunk-v8nbqjwc.js";import"./chunk-ws2q07kb.js";import"./chunk-5swzs64n.js";import"./chunk-mdx18vtz.js";import"./chunk-0j7ek1n7.js";import"./chunk-cfb6mvz5.js";import"./chunk-y0e28qha.js";import"./chunk-gx0hxf04.js";import"./chunk-7eqzs28e.js";import"./chunk-5x9zmxbm.js";import"./chunk-f1csqde7.js";import"./chunk-m1jbthc5.js";import"./chunk-fxpbaff2.js";import"./chunk-dmzg9zdc.js";import"./chunk-kg9kmwt9.js";import"./chunk-9k0r47z3.js";import"./chunk-brpz7xfs.js";import"./chunk-grbrh92f.js";import"./chunk-v8ms64g1.js";import"./chunk-7b2x6nkj.js";import"./chunk-8ka3rkq0.js";import"./chunk-p55es0nf.js";import"./chunk-2caxfsms.js";import"./chunk-y0skz8j9.js";import"./chunk-mqfvzdpr.js";import"./chunk-wmrmwncn.js";import"./chunk-hpay0ax8.js";import"./chunk-tteswdyf.js";import"./chunk-vpk5m2z6.js";import"./chunk-rxqdw6s5.js";import"./chunk-tn9gtf18.js";import"./chunk-vnp1k7ek.js";import"./chunk-c9c6yczz.js";import"./chunk-cw6xz64t.js";import"./chunk-drhwacg1.js";import"./chunk-wrqv141p.js";import"./chunk-5rxef858.js";import"./chunk-sy81vcaz.js";import"./chunk-bn8nrqde.js";import"./chunk-6qwjd3da.js";import"./chunk-f60hmm20.js";import"./chunk-03ab55aq.js";import"./chunk-w7zv47mp.js";import"./chunk-ve196r2v.js";import"./chunk-nr7c9q0j.js";import"./chunk-r478tzjz.js";import"./chunk-5kyajt3q.js";import"./chunk-k7tdg6kb.js";import"./chunk-1pmzr8kr.js";import"./chunk-e5jxbd98.js";import"./chunk-84q9hv7m.js";import"./chunk-96kvwzj8.js";import"./chunk-etfh8f4z.js";import"./chunk-52stxk43.js";import"./chunk-h8qg9v95.js";import"./chunk-78y80xe8.js";import"./chunk-0zs13rdq.js";import"./chunk-tm6vvy5t.js";import"./chunk-wx77yjhc.js";import"./chunk-nks2q6d9.js";import"./chunk-r4vwq5wv.js";import"./chunk-b43gbrar.js";import"./chunk-7dy9dtnd.js";import"./chunk-6hjt5an9.js";import"./chunk-ptyqj15s.js";import"./chunk-xdmamqy7.js";import"./chunk-m74qxqw0.js";import"./chunk-sckqk79z.js";import"./chunk-y8hjgmn0.js";import"./chunk-w2czjjxy.js";import"./chunk-8q0nmdh3.js";import"./chunk-pn5ygqn6.js";import"./chunk-a6z2ggxd.js";import"./chunk-8rxg12aj.js";import"./chunk-n835vmw4.js";import"./chunk-tw25g9g5.js";import"./chunk-yt15y085.js";import"./chunk-2z2jwetd.js";import"./chunk-pzbcbmm4.js";import"./chunk-4ctx6hst.js";import"./chunk-g6wb8p4p.js";import"./chunk-nc46gddg.js";import"./chunk-ksx55wt3.js";import"./chunk-91sykzqq.js";export{unknownVerbError,findVerb,VERB_GROUPS,VERB_ALIASES,VERBS,API_VERBS};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{getGlobalDefaultVendor}from"./chunk-m1jbthc5.js";import{CURRENT_VERSION,owningNpmPrefix,repoSlug}from"./chunk-
|
|
2
|
+
import{getGlobalDefaultVendor}from"./chunk-m1jbthc5.js";import{CURRENT_VERSION,owningNpmPrefix,repoSlug}from"./chunk-brpz7xfs.js";import{runAsync}from"./chunk-ve196r2v.js";import{DEFAULT_TASK_VENDOR}from"./chunk-w2czjjxy.js";import{arch,platform,release}from"os";var FEEDBACK_KINDS=["bug","idea","question"],DEFAULT_FEEDBACK_KIND="bug",KIND_LABEL={bug:"bug",idea:"enhancement",question:"question"},MAX_PREFILL_BODY=4000,GH_TIMEOUT_MS=60000;function isFeedbackKind(value){return FEEDBACK_KINDS.includes(value)}function installKind(){if(import.meta.url.includes("/$bunfs/")||import.meta.url.includes("B:\\~BUN"))return"compiled binary";return owningNpmPrefix()?"npm global":"source or bun"}function defaultEngineId(){try{return getGlobalDefaultVendor()??DEFAULT_TASK_VENDOR}catch{return DEFAULT_TASK_VENDOR}}function environmentBlock(){return["---","Reported from Rove:",`- rove: ${CURRENT_VERSION}`,`- os: ${platform()} ${release()} (${arch()})`,`- install: ${installKind()}`,`- default engine: ${defaultEngineId()}`].join(`
|
|
3
3
|
`)}function normalizeText(value,label){let trimmed=value.trim();if(!trimmed)throw Error(`${label} is required`);return trimmed}function issueCreateArgv(slug,title,kind){return["issue","create","-R",slug,"--title",title,"--label",KIND_LABEL[kind],"--body-file","-"]}function newIssueUrl(slug,title,body,kind){let prefilled=body.length>MAX_PREFILL_BODY?`${body.slice(0,MAX_PREFILL_BODY)}
|
|
4
4
|
|
|
5
5
|
[truncated]`:body,query=new URLSearchParams({title,body:prefilled,labels:KIND_LABEL[kind]});return`https://github.com/${slug}/issues/new?${query.toString()}`}var ISSUE_URL=/https:\/\/\S+\/issues\/(\d+)/;async function submitFeedback(input,deps={}){let title=normalizeText(input.title,"feedback title"),kind=input.kind??DEFAULT_FEEDBACK_KIND,body=`${normalizeText(input.body,"feedback body")}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{isEngineActivityKind}from"./chunk-zcywdm3y.js";import{loadPluginRegistry,readPluginManifest}from"./chunk-jpc5yh8e.js";import{activityHookAdapters}from"./chunk-
|
|
2
|
+
import{isEngineActivityKind}from"./chunk-zcywdm3y.js";import{loadPluginRegistry,readPluginManifest}from"./chunk-jpc5yh8e.js";import{activityHookAdapters}from"./chunk-sy81vcaz.js";import{connectIfRunning}from"./chunk-k7tdg6kb.js";import{getPersistedString,setPersistedString}from"./chunk-52stxk43.js";import{flagValue}from"./chunk-78y80xe8.js";import{readRoveEnv}from"./chunk-nc46gddg.js";import{join,resolve}from"path";var STDIN_READ_TIMEOUT_MS=500;async function readTextWithTimeout(read,timeoutMs=STDIN_READ_TIMEOUT_MS){let raceTimer;try{return await Promise.race([read(),new Promise((resolve2)=>{raceTimer=setTimeout(()=>resolve2(""),timeoutMs)})])}finally{if(raceTimer!==void 0)clearTimeout(raceTimer)}}async function readStdinText(isComplete){let bun=globalThis.Bun;if(bun)return bun.stdin.text();if(process.stdin.isTTY)return"";let chunks=[];try{for await(let chunk of process.stdin)if(chunks.push(chunk),isComplete?.(Buffer.concat(chunks).toString("utf8")))break}finally{process.stdin.destroy()}return Buffer.concat(chunks).toString("utf8")}function isCompleteJson(text){try{return JSON.parse(text),!0}catch{return!1}}async function readStdinPayload(){try{let text=await readTextWithTimeout(()=>readStdinText(isCompleteJson));if(!text.trim())return{};let parsed=JSON.parse(text);return parsed&&typeof parsed==="object"&&!Array.isArray(parsed)?parsed:{}}catch{return{}}}async function runHookSubcommand(argv){let[verb,...rest]=argv;if(verb==="setup"){await runHookSetup(rest);return}if(verb==="cleanup"){await runHookCleanup();return}try{if(!verb||!isEngineActivityKind(verb))return;let payload=await readStdinPayload(),payloadFlag=flagValue(rest,"--payload");if(payloadFlag)try{let extra=JSON.parse(payloadFlag);if(extra&&typeof extra==="object"&&!Array.isArray(extra))Object.assign(payload,extra)}catch{}let taskId=flagValue(rest,"--task-id"),envTaskId=process.env.ROVE_TASK_ID,envTabId=process.env.ROVE_TAB_ID,engine=flagValue(rest,"--engine"),adapters=activityHookAdapters().filter((a)=>!engine||a.vendor===engine);if(!taskId&&adapters.some((a)=>a.isUnattendedSession?.(process.env)===!0))return;let cwd=typeof payload.cwd==="string"&&payload.cwd?payload.cwd:void 0;for(let adapter of adapters){if(cwd)break;cwd=adapter.cwdFromPayload?.(payload)}cwd||=process.cwd();let detail;for(let adapter of adapters)if(detail=adapter.activityDetailFromPayload(verb,payload),detail)break;let session;for(let adapter of adapters)if(session=adapter.sessionFromPayload(payload),session)break;let client=await connectIfRunning();if(!client)return;try{let effectiveTaskId=taskId??envTaskId;await client.request("engine.reportEvent",{...effectiveTaskId?{taskId:effectiveTaskId}:{cwd},kind:verb,...engine?{engine}:{},...envTabId?{tabId:envTabId}:{},...detail?{detail}:{},...session?{sessionId:session.sessionId}:{},...session?.transcriptPath?{transcriptPath:session.transcriptPath}:{}})}finally{client.close()}}catch(err){if(readRoveEnv("HOOK_DEBUG"))console.error(`[rove hook] ${verb} failed:`,err instanceof Error?err.message:String(err))}}var SYNC_SETTING_KEY="externalWorktreeSync";function worktreeSyncAdapters(){return activityHookAdapters().filter((a)=>a.supportsWorktreeSync())}function globalSettingsPath(){return worktreeSyncAdapters()[0]?.globalSettingsPath()}function persistedSyncPath(stored){if(!stored||stored==="off")return;if(stored==="global")return globalSettingsPath();if(stored.startsWith("repo:"))return join(resolve(stored.slice(5)),".claude","settings.json");return stored}async function ensureGlobalRoveHooks(opts={}){try{let toolEvents=pluginsWantToolEvents();for(let a of activityHookAdapters()){let external=await a.externallyManagedHooks?.();if(external){if(external.notice)process.stderr.write(`
|
|
3
3
|
${external.notice}
|
|
4
4
|
`);continue}let enginePath=a.globalSettingsPath();if(!enginePath)continue;await a.installActivityHooks(enginePath,{toolEvents,quiet:opts.quiet}),await a.removeWorktreeWatchHook(enginePath)}await cleanupWorktreeSyncHook()}catch{}}function pluginsWantToolEvents(){try{for(let entry of loadPluginRegistry().plugins){if(!entry.enabled)continue;try{if(readPluginManifest(entry.root).manifest.events.some((e)=>e.on.startsWith("tool.")))return!0}catch{}}}catch{}return!1}async function cleanupWorktreeSyncHook(){let adapters=worktreeSyncAdapters();if(adapters.length===0)return;let stored=getPersistedString(SYNC_SETTING_KEY),paths=new Set;for(let adapter of adapters){let file=adapter.globalSettingsPath();if(file)paths.add(file)}let prev=persistedSyncPath(stored);if(prev)paths.add(prev);for(let a of adapters)for(let p of paths)await a.removeWorktreeSyncHook(p);if(stored!=="off")setPersistedString(SYNC_SETTING_KEY,"off")}async function runHookCleanup(){let claude=activityHookAdapters().find((a)=>a.vendor==="claude"),path=claude?.globalSettingsPath();if(!claude||!path){process.stdout.write(`rove hook cleanup: no Claude hook adapter \u2014 nothing to do.
|
|
5
5
|
`);return}await claude.removeActivityHooks(path),await claude.removeWorktreeWatchHook(path),process.stdout.write([`rove hook cleanup: removed Rove's settings-managed hooks from ${path}.`,"Only Rove's own entries were touched; your other hooks are intact.","The Claude Code plugin's hooks.json now carries these events (if the plugin","is not installed, the next Rove launch reinstalls the settings-managed set).",""].join(`
|
|
@@ -4,4 +4,4 @@ import{expandTilde}from"./chunk-grbrh92f.js";import{SUBCOMMAND_VERBS}from"./chun
|
|
|
4
4
|
|
|
5
5
|
${REPO_USAGE}
|
|
6
6
|
`),process.exit(2)}function readArgFile(path){try{return readFileSync(resolve(process.cwd(),expandTilde(path)),"utf8")}catch(err){usageError(`cannot read ${path}: ${errorMessage(err)}`)}}function parseRepoArgs(args){let out={};for(let i=0;i<args.length;i++){let a=args[i],need=()=>{let v=args[++i];if(v===void 0)usageError(`${a} requires a value`);return v};if(a==="--init-script")out.initScript=need();else if(a==="--init-script-file")out.initScript=readArgFile(need());else if(a==="--init-prompt")out.initPrompt=need();else if(a==="--init-prompt-file")out.initPrompt=readArgFile(need());else if(a.startsWith("-"))usageError(`unknown flag "${a}"`);else if(out.path===void 0)out.path=a;else usageError(`unexpected argument "${a}"`)}return out}function parseUnsetArgs(args){let path,clearScript=!1,clearPrompt=!1;for(let a of args)if(a==="--init-script")clearScript=!0;else if(a==="--init-prompt")clearPrompt=!0;else if(a.startsWith("-"))usageError(`unknown flag "${a}"`);else if(path===void 0)path=a;else usageError(`unexpected argument "${a}"`);if(!clearScript&&!clearPrompt)clearScript=!0,clearPrompt=!0;return{path,clearScript,clearPrompt}}async function runRepoSubcommand(args){let[verb,...rest]=args;if(verb===void 0||verb==="--help"||verb==="-h"||verb==="help"){process.stdout.write(`${REPO_USAGE}
|
|
7
|
-
`);return}if(!SUBCOMMAND_VERBS.repo.includes(verb))usageError(`unknown verb "${verb}"`);let{getRepoInitOverride,setRepoInitOverride,resolveRepoRoot}=await import("./chunk-nt2nppx6.js");if(verb==="show"){let[pathArg]=rest.filter((a)=>!a.startsWith("-")),repo=resolveRepoRoot(resolve(process.cwd(),expandTilde(pathArg??"."))),override=getRepoInitOverride(repo),{describeRepoInitSources}=await import("./chunk-
|
|
7
|
+
`);return}if(!SUBCOMMAND_VERBS.repo.includes(verb))usageError(`unknown verb "${verb}"`);let{getRepoInitOverride,setRepoInitOverride,resolveRepoRoot}=await import("./chunk-nt2nppx6.js");if(verb==="show"){let[pathArg]=rest.filter((a)=>!a.startsWith("-")),repo=resolveRepoRoot(resolve(process.cwd(),expandTilde(pathArg??"."))),override=getRepoInitOverride(repo),{describeRepoInitSources}=await import("./chunk-mhzcc4gm.js"),sources=describeRepoInitSources(repo);console.log(`repo: ${repo}`);for(let group of[sources.script,sources.prompt])group.forEach((source,index)=>{console.log(` ${`${source.rel}:`.padEnd(22)}${describeSource(group,index)}`)});console.log(` override initScript: ${override.initScript?quotePreview(override.initScript):"(unset)"}`),console.log(` override initPrompt: ${override.initPrompt?quotePreview(override.initPrompt):"(unset)"}`);return}if(verb==="set"){let flags=parseRepoArgs(rest);if(flags.initScript===void 0&&flags.initPrompt===void 0)usageError("set needs at least one of --init-script(-file) / --init-prompt(-file)");let repo=resolveRepoRoot(resolve(process.cwd(),expandTilde(flags.path??"."))),next=setRepoInitOverride(repo,{...flags.initScript!==void 0?{initScript:flags.initScript}:{},...flags.initPrompt!==void 0?{initPrompt:flags.initPrompt}:{}});console.log(`updated override for ${repo}`),console.log(` initScript: ${next.initScript?quotePreview(next.initScript):"(unset)"}`),console.log(` initPrompt: ${next.initPrompt?quotePreview(next.initPrompt):"(unset)"}`);return}if(verb==="unset"){let{path,clearScript,clearPrompt}=parseUnsetArgs(rest),repo=resolveRepoRoot(resolve(process.cwd(),expandTilde(path??"."))),next=setRepoInitOverride(repo,{...clearScript?{initScript:""}:{},...clearPrompt?{initPrompt:""}:{}});console.log(`cleared override for ${repo}`),console.log(` initScript: ${next.initScript?quotePreview(next.initScript):"(unset)"}`),console.log(` initPrompt: ${next.initPrompt?quotePreview(next.initPrompt):"(unset)"}`);return}usageError(`unknown verb "${verb}"`)}function describeSource(group,index){let source=group[index];if(!source)return"absent";if(source.effective)return"present (wins)";if(!source.present)return"absent";return group.slice(0,index).some((earlier)=>earlier.effective)?"present (shadowed)":"present but empty (ignored)"}function quotePreview(value){let oneLine=value.replace(/\s+/g," ").trim();return oneLine.length>60?`"${oneLine.slice(0,57)}\u2026"`:`"${oneLine}"`}export{runRepoSubcommand};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{GitWorktreeManager}from"./chunk-
|
|
2
|
+
import{GitWorktreeManager}from"./chunk-0697addz.js";import"./chunk-1wdp0qh4.js";import"./chunk-aena2jzj.js";import"./chunk-fxpbaff2.js";import"./chunk-dmzg9zdc.js";import"./chunk-9k0r47z3.js";import"./chunk-tteswdyf.js";import"./chunk-cw6xz64t.js";import"./chunk-drhwacg1.js";import"./chunk-wrqv141p.js";import"./chunk-52stxk43.js";import"./chunk-h8qg9v95.js";import"./chunk-0zs13rdq.js";import"./chunk-tm6vvy5t.js";import"./chunk-nks2q6d9.js";import"./chunk-ptyqj15s.js";import"./chunk-pn5ygqn6.js";import"./chunk-n835vmw4.js";import"./chunk-tw25g9g5.js";import"./chunk-yt15y085.js";import"./chunk-2z2jwetd.js";import"./chunk-pzbcbmm4.js";import"./chunk-4ctx6hst.js";import"./chunk-g6wb8p4p.js";import"./chunk-nc46gddg.js";import"./chunk-91sykzqq.js";export{GitWorktreeManager};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{interactiveEngineCommand,listPresetIds}from"./chunk-
|
|
2
|
+
import{interactiveEngineCommand,listPresetIds}from"./chunk-p55es0nf.js";import{resolveSessionShell}from"./chunk-tn9gtf18.js";import{engineEntry}from"./chunk-sy81vcaz.js";import{installedEngineIds}from"./chunk-bn8nrqde.js";import{spawn,spawnSync}from"child_process";import{statSync}from"fs";import path from"path";function whichOnPath(bin){let bunWhich=globalThis.Bun?.which;if(bunWhich)return bunWhich(bin);let out=spawnSync(process.platform==="win32"?"where":"which",[bin],{encoding:"utf8"});if(out.status!==0)return null;return out.stdout.split(`
|
|
3
3
|
`).map((l)=>l.trim()).find(Boolean)??null}var LOGIN_PROBE_MS=5000,MARK="__rove_which__";function whichInLoginShell(bin){return new Promise((resolve)=>{let out="",child;try{let quoted=`'${bin.replaceAll("'","'\\''")}'`;child=spawn(resolveSessionShell(),["-ilc",`printf '\\n${MARK}%s\\n' "$(command -v ${quoted})"`],{stdio:["ignore","pipe","ignore"],detached:!0})}catch{return resolve(null)}let timer=setTimeout(()=>child.kill("SIGKILL"),LOGIN_PROBE_MS);child.stdout?.on("data",(b)=>{out+=b.toString()}),child.on("error",()=>{clearTimeout(timer),resolve(null)}),child.on("close",()=>{clearTimeout(timer);let line=out.split(`
|
|
4
4
|
`).find((l)=>l.startsWith(MARK));resolve(line?.slice(MARK.length).trim()||null)})})}var defaultDeps={which:(bin)=>whichOnPath(bin)??(process.platform==="win32"?null:whichInLoginShell(bin)),command:(vendor)=>interactiveEngineCommand(vendor)};async function probeLaunchBinary(argv,which){let bin=argv[0]?.trim();if(!bin)return{found:!1,error:"no launch command"};if(bin.includes(path.sep)||bin.startsWith(".")){try{if(statSync(bin).isFile())return{found:!0,path:bin}}catch{}return{found:!1,error:`not found at ${bin}`}}let found=await which(bin);return found?{found:!0,path:found}:{found:!1,error:"not found on PATH"}}async function detectEngineStatus(vendor,over={}){let deps={...defaultDeps,...over},detector=engineEntry(vendor).detectAccount;if(!detector)return{vendor,binary:await probeLaunchBinary(deps.command(vendor),deps.which),account:null};let status=await detector(deps.accountDeps),binary=status.binary.found?status.binary:await probeLaunchBinary(deps.command(vendor),deps.which);return{vendor,binary,account:status.account,accountError:status.accountError}}function detectEngineStatuses(vendors,over={}){return Promise.all(vendors.map((v)=>detectEngineStatus(v,over)))}function describeAccount(account){if(account===null)return"login not detectable";switch(account.kind){case"oauth":return"email"in account?`logged in (${account.email}${account.organization?`, ${account.organization}`:""})`:"logged in";case"chatgpt":return`logged in (${account.email}${account.plan?`, ${account.plan}`:""})`;case"apikey":return"API key";case"token":return`token (${account.source})`;default:return"no account"}}function engineUsable(status){return status.binary.found&&status.account?.kind!=="none"}async function probeableEngineIds(){return[...new Set([...listPresetIds(),...await installedEngineIds()])]}function summarizeEngines(statuses){let usable=[],signedOut=[];for(let status of statuses)if(engineUsable(status))usable.push(status.vendor);else if(status.binary.found)signedOut.push(status.vendor);return{usable,signedOut}}import{spawn as spawn2}from"child_process";import path2 from"path";var VERSION_PROBE_MS=3000,MAX_OUTPUT=4096;function parseVersionOutput(output){return/\b\d+(?:\.\d+)+(?:-[0-9A-Za-z.]+)?\b/.exec(output)?.[0]??null}var runVersionCommand=(bin,args)=>new Promise((resolve)=>{let out="",child;try{child=spawn2(bin,[...args],{stdio:["ignore","pipe","ignore"]})}catch{return resolve(null)}let timer=setTimeout(()=>child.kill("SIGKILL"),VERSION_PROBE_MS);child.stdout?.on("data",(b)=>{if(out.length<MAX_OUTPUT)out+=b.toString()}),child.on("error",()=>{clearTimeout(timer),resolve(null)}),child.on("close",(code)=>{clearTimeout(timer),resolve(code===0?out:null)})});async function readEngineVersion(vendor,binary,run=runVersionCommand){if(!binary.found)return null;let entry=engineEntry(vendor),own=entry.defaultCommand[0];if(!entry.versionArgs||!own)return null;if(path2.basename(binary.path)!==path2.basename(own))return null;let output=await run(binary.path,entry.versionArgs).catch(()=>null);return output===null?null:parseVersionOutput(output)}function withEngineVersions(statuses,run=runVersionCommand){return Promise.all(statuses.map(async(status)=>{let version=await readEngineVersion(status.vendor,status.binary,run);return version?{...status,version}:status}))}
|
|
5
5
|
export{detectEngineStatus,detectEngineStatuses,describeAccount,probeableEngineIds,summarizeEngines,readEngineVersion,withEngineVersions};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{ulid}from"./chunk-
|
|
2
|
+
import{ulid}from"./chunk-f1csqde7.js";import{acquireWithRetry,mergeTasksWithDisk,readDiskIndex,recoverIndexFromDisk}from"./chunk-m74qxqw0.js";import{DEFAULT_TASK_VENDOR,toTaskId}from"./chunk-w2czjjxy.js";import{release}from"./chunk-n835vmw4.js";import{ROVE_STATE_DIR_BASENAME}from"./chunk-4ctx6hst.js";import{preRenameStateDir}from"./chunk-g6wb8p4p.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 moveBlock(ids,anchorId,side){this.assertLoaded();let lifted=new Set(ids);if(lifted.has(anchorId))throw Error(`cannot move a block beside itself: ${anchorId}`);let prior=this.cache.tasks.slice(),block=prior.filter((t)=>lifted.has(t.id)),rest=prior.filter((t)=>!lifted.has(t.id)),anchor=rest.findIndex((t)=>t.id===anchorId);if(anchor<0)throw Error(`task not found: ${anchorId}`);if(block.length===0)return;let at=side==="after"?anchor+1:anchor,next=[...rest.slice(0,at),...block,...rest.slice(at)];this.cache.tasks.splice(0,this.cache.tasks.length,...next);try{await this.save()}catch(err){if(this.cache.tasks.length===next.length&&this.cache.tasks.every((t,i)=>t===next[i]))this.cache.tasks.splice(0,this.cache.tasks.length,...prior),this.notifyListeners();throw err}this.notifyListeners()}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};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{loadPluginRegistry,readPluginManifest}from"./chunk-jpc5yh8e.js";import{CONTRIB_ENGINE_IDS,clearPluginEngines,listModelLines,registerPluginEngine,resetAvailableVendorsCache}from"./chunk-
|
|
2
|
+
import{loadPluginRegistry,readPluginManifest}from"./chunk-jpc5yh8e.js";import{CONTRIB_ENGINE_IDS,clearPluginEngines,listModelLines,registerPluginEngine,resetAvailableVendorsCache}from"./chunk-bn8nrqde.js";import{getCustomEngineIds}from"./chunk-52stxk43.js";import{bypassFlag}from"./chunk-78y80xe8.js";function pluginModelCapabilities(engine){let flag=engine.modelFlag,[bin,...args]=engine.modelsCommand??[];return{...flag?{modelArgv:(base,model)=>[...base,flag,model]}:{},...bin?{listModels:listModelLines(bin,args)}:{}}}function loadPluginEngines(homeDir){let registered=[];try{for(let entry of loadPluginRegistry(homeDir).plugins){if(!entry.enabled)continue;try{let{manifest}=readPluginManifest(entry.root);for(let engine of manifest.engines){let identity={shortName:engine.identity?.shortName??engine.name};if(registerPluginEngine(engine.id,{displayName:engine.name,defaultCommand:engine.command,...engine.processNames?{processNames:engine.processNames}:{},screenManifest:{rules:engine.rules},identity,...engine.firstMessageDelivery?{firstMessageDelivery:engine.firstMessageDelivery}:{},...pluginModelCapabilities(engine),...engine.permissionBypassFlag?{permissionBypass:bypassFlag(engine.permissionBypassFlag)}:{}}))registered.push(engine.id);else console.warn(`[rove] plugin ${entry.id}: engine id \`${engine.id}\` shadows a built-in or shipped engine \u2014 skipped`)}}catch{}}}catch{}return registered}function reloadPluginEngines(homeDir){clearPluginEngines();let registered=loadPluginEngines(homeDir);return loadedOnce=registered,resetAvailableVendorsCache(),registered}var loadedOnce;function ensurePluginEnginesLoaded(){return loadedOnce??=loadPluginEngines(),loadedOnce}function registeredEngineIds(){return[...new Set([...CONTRIB_ENGINE_IDS,...getCustomEngineIds(),...ensurePluginEnginesLoaded()])]}
|
|
3
3
|
export{loadPluginEngines,reloadPluginEngines,ensurePluginEnginesLoaded,registeredEngineIds};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{ensurePluginEnginesLoaded,loadPluginEngines,registeredEngineIds,reloadPluginEngines}from"./chunk-
|
|
2
|
+
import{ensurePluginEnginesLoaded,loadPluginEngines,registeredEngineIds,reloadPluginEngines}from"./chunk-57atdjmz.js";import"./chunk-jpc5yh8e.js";import"./chunk-ws2q07kb.js";import"./chunk-bn8nrqde.js";import"./chunk-w7zv47mp.js";import"./chunk-96kvwzj8.js";import"./chunk-52stxk43.js";import"./chunk-h8qg9v95.js";import"./chunk-78y80xe8.js";import"./chunk-0zs13rdq.js";import"./chunk-tm6vvy5t.js";import"./chunk-nks2q6d9.js";import"./chunk-7dy9dtnd.js";import"./chunk-6hjt5an9.js";import"./chunk-ptyqj15s.js";import"./chunk-xdmamqy7.js";import"./chunk-m74qxqw0.js";import"./chunk-sckqk79z.js";import"./chunk-y8hjgmn0.js";import"./chunk-w2czjjxy.js";import"./chunk-8q0nmdh3.js";import"./chunk-pn5ygqn6.js";import"./chunk-a6z2ggxd.js";import"./chunk-8rxg12aj.js";import"./chunk-n835vmw4.js";import"./chunk-tw25g9g5.js";import"./chunk-yt15y085.js";import"./chunk-2z2jwetd.js";import"./chunk-pzbcbmm4.js";import"./chunk-4ctx6hst.js";import"./chunk-g6wb8p4p.js";import"./chunk-nc46gddg.js";import"./chunk-91sykzqq.js";export{reloadPluginEngines,registeredEngineIds,loadPluginEngines,ensurePluginEnginesLoaded};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{engineEntry,identifiableEngineIds}from"./chunk-
|
|
3
|
-
`)){let m=/^\s*(\d+)\s+(\d+)\s+(\S.*)$/.exec(line);if(m)rows.push({pid:Number(m[1]),ppid:Number(m[2]),args:m[3]})}return rows}function childrenIndex(rows){let kids=new Map;for(let row of rows){let list=kids.get(row.ppid);if(list)list.push(row);else kids.set(row.ppid,[row])}return kids}function hasAncestor(rows,pid,ancestorPid){let parents=new Map(rows.map((r)=>[r.pid,r.ppid])),cur=pid;for(let hops=0;hops<=rows.length;hops++){if(cur===ancestorPid)return!0;let next=parents.get(cur);if(next===void 0||next<=1)return!1;cur=next}return!1}function customEngineBinaries(){let state=loadStateFile(),ids=state.customEngineIds,out=new Map;if(!Array.isArray(ids))return out;for(let id of ids){if(typeof id!=="string"||id.trim().length===0)continue;let command=state[`engineCommand.${id}`],argv=typeof command==="string"&&command.trim().length>0?command.trim().split(/\s+/):[id],name=executableNameFromArgv(argv);if(name)out.set(name,id)}return out}function findDescendant(rows,rootPid,pick){let kids=childrenIndex(rows),queue=[...kids.get(rootPid)??[]],visited=new Set;while(queue.length>0){let row=queue.shift();if(!row)break;if(visited.has(row.pid))continue;visited.add(row.pid);let hit=pick(row);if(hit!==null)return hit;queue.push(...kids.get(row.pid)??[])}return null}function walkDescendants(rows,rootPid,identify){return findDescendant(rows,rootPid,(row)=>{let vendor=identify(row.args);return vendor?{vendor,argv:row.args,pid:row.pid}:null})}function foregroundEngineIn(rows,rootPid){let builtin=walkDescendants(rows,rootPid,vendorFromArgv);if(builtin)return builtin;let custom=customEngineBinaries();if(custom.size===0)return null;return walkDescendants(rows,rootPid,(args)=>custom.get(executableNameFromArgv(args.trim().split(/\s+/))??"")??null)}function engineProcessIn(rows,rootPid,extraLaunch){if(foregroundEngineIn(rows,rootPid))return!0;let expected=extraLaunch?executableNameFromArgv(typeof extraLaunch==="string"?[extraLaunch]:extraLaunch):null;if(!expected)return!1;return findDescendant(rows,rootPid,(row)=>executableNameFromArgv(row.args.trim().split(/\s+/))===expected?!0:null)===!0}var PS_PROBE_TIMEOUT_MS=5000,bunPsSpawn=()=>{recordSpawn("engine.foregroundWalk",["ps","-A","-o","pid=,ppid=,args="]);let proc=Bun.spawn(["ps","-A","-o","pid=,ppid=,args="],{stdout:"pipe",stderr:"ignore"});return{text:new Response(proc.stdout).text(),kill:()=>proc.kill()}};async function psSnapshotWith(spawn,timeoutMs=PS_PROBE_TIMEOUT_MS){let proc=spawn(),timer;try{let text=await Promise.race([proc.text,new Promise((_resolve,reject)=>{timer=setTimeout(()=>{try{proc.kill()}catch{}reject(new PsProbeUnavailableError(`ps did not answer within ${timeoutMs}ms`))},timeoutMs)})]);if(parsePsSnapshot(text).length===0)throw new PsProbeUnavailableError("ps returned no usable rows");return text}finally{if(timer)clearTimeout(timer)}}function shareInflight(run){let inflight=null;return()=>{return inflight??=run().finally(()=>{inflight=null}),inflight}}var sharedPs=shareInflight(()=>psSnapshotWith(bunPsSpawn)),psSnapshot=async(anchors)=>{if(process.platform!=="win32")return sharedPs();let{defaultWinProcessProbe,winProcessSnapshot}=await import("./chunk-
|
|
2
|
+
import{engineEntry,identifiableEngineIds}from"./chunk-sy81vcaz.js";import{recordSpawn}from"./chunk-h8qg9v95.js";import{loadStateFile}from"./chunk-nks2q6d9.js";import{PsProbeUnavailableError}from"./chunk-ksx55wt3.js";import{__require}from"./chunk-91sykzqq.js";import{basename}from"path";var WRAPPERS=new Set(["node","bun","npx","deno","sh","zsh","bash","env","script"]);function binaryName(token){return basename(token).replace(/\.(exe|js|mjs|cjs)$/,"")}function executableNameFromArgv(argv){for(let token of argv.slice(0,8)){if(/^[A-Za-z_][A-Za-z0-9_]*=/.test(token))continue;let name=binaryName(token);if(WRAPPERS.has(name))continue;return name||null}return null}function vendorFromArgv(commandLine){let name=executableNameFromArgv(commandLine.trim().split(/\s+/));if(!name)return null;return identifiableEngineIds().find((v)=>{let entry=engineEntry(v);return entry.defaultCommand[0]===name||entry.processNames?.includes(name)===!0})??null}function parsePsSnapshot(text){let rows=[];for(let line of text.split(`
|
|
3
|
+
`)){let m=/^\s*(\d+)\s+(\d+)\s+(\S.*)$/.exec(line);if(m)rows.push({pid:Number(m[1]),ppid:Number(m[2]),args:m[3]})}return rows}function childrenIndex(rows){let kids=new Map;for(let row of rows){let list=kids.get(row.ppid);if(list)list.push(row);else kids.set(row.ppid,[row])}return kids}function hasAncestor(rows,pid,ancestorPid){let parents=new Map(rows.map((r)=>[r.pid,r.ppid])),cur=pid;for(let hops=0;hops<=rows.length;hops++){if(cur===ancestorPid)return!0;let next=parents.get(cur);if(next===void 0||next<=1)return!1;cur=next}return!1}function customEngineBinaries(){let state=loadStateFile(),ids=state.customEngineIds,out=new Map;if(!Array.isArray(ids))return out;for(let id of ids){if(typeof id!=="string"||id.trim().length===0)continue;let command=state[`engineCommand.${id}`],argv=typeof command==="string"&&command.trim().length>0?command.trim().split(/\s+/):[id],name=executableNameFromArgv(argv);if(name)out.set(name,id)}return out}function findDescendant(rows,rootPid,pick){let kids=childrenIndex(rows),queue=[...kids.get(rootPid)??[]],visited=new Set;while(queue.length>0){let row=queue.shift();if(!row)break;if(visited.has(row.pid))continue;visited.add(row.pid);let hit=pick(row);if(hit!==null)return hit;queue.push(...kids.get(row.pid)??[])}return null}function walkDescendants(rows,rootPid,identify){return findDescendant(rows,rootPid,(row)=>{let vendor=identify(row.args);return vendor?{vendor,argv:row.args,pid:row.pid}:null})}function foregroundEngineIn(rows,rootPid){let builtin=walkDescendants(rows,rootPid,vendorFromArgv);if(builtin)return builtin;let custom=customEngineBinaries();if(custom.size===0)return null;return walkDescendants(rows,rootPid,(args)=>custom.get(executableNameFromArgv(args.trim().split(/\s+/))??"")??null)}function engineProcessIn(rows,rootPid,extraLaunch){if(foregroundEngineIn(rows,rootPid))return!0;let expected=extraLaunch?executableNameFromArgv(typeof extraLaunch==="string"?[extraLaunch]:extraLaunch):null;if(!expected)return!1;return findDescendant(rows,rootPid,(row)=>executableNameFromArgv(row.args.trim().split(/\s+/))===expected?!0:null)===!0}var PS_PROBE_TIMEOUT_MS=5000,bunPsSpawn=()=>{recordSpawn("engine.foregroundWalk",["ps","-A","-o","pid=,ppid=,args="]);let proc=Bun.spawn(["ps","-A","-o","pid=,ppid=,args="],{stdout:"pipe",stderr:"ignore"});return{text:new Response(proc.stdout).text(),kill:()=>proc.kill()}};async function psSnapshotWith(spawn,timeoutMs=PS_PROBE_TIMEOUT_MS){let proc=spawn(),timer;try{let text=await Promise.race([proc.text,new Promise((_resolve,reject)=>{timer=setTimeout(()=>{try{proc.kill()}catch{}reject(new PsProbeUnavailableError(`ps did not answer within ${timeoutMs}ms`))},timeoutMs)})]);if(parsePsSnapshot(text).length===0)throw new PsProbeUnavailableError("ps returned no usable rows");return text}finally{if(timer)clearTimeout(timer)}}function shareInflight(run){let inflight=null;return()=>{return inflight??=run().finally(()=>{inflight=null}),inflight}}var sharedPs=shareInflight(()=>psSnapshotWith(bunPsSpawn)),psSnapshot=async(anchors)=>{if(process.platform!=="win32")return sharedPs();let{defaultWinProcessProbe,winProcessSnapshot}=await import("./chunk-dy8sxc0y.js");return winProcessSnapshot(anchors??[],defaultWinProcessProbe())};async function foregroundEngine(rootPid,snapshot=psSnapshot){try{return foregroundEngineIn(parsePsSnapshot(await snapshot([rootPid])),rootPid)}catch{return null}}
|
|
4
4
|
export{vendorFromArgv,parsePsSnapshot,hasAncestor,foregroundEngineIn,engineProcessIn,PS_PROBE_TIMEOUT_MS,psSnapshotWith,shareInflight,psSnapshot,foregroundEngine};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{REPEAT_SEP,VerbArgs,defaultApiRuntime,findVerb,parseFlags,unknownVerbError,validateAgainstSpec}from"./chunk-
|
|
2
|
+
import{REPEAT_SEP,VerbArgs,defaultApiRuntime,findVerb,parseFlags,unknownVerbError,validateAgainstSpec}from"./chunk-zs8a30dk.js";import{ensurePluginEnginesLoaded}from"./chunk-57atdjmz.js";import{REPO_HAS_NO_COMMITS_CODE,REPO_HAS_NO_COMMITS_HINT}from"./chunk-aena2jzj.js";import{cliCaller,requireVerbInstalled,splitDaemonCode}from"./chunk-pcp1q3fc.js";import{ApiError}from"./chunk-5x9zmxbm.js";import{ROVE_API_VERSION}from"./chunk-96kvwzj8.js";import{errorMessage}from"./chunk-0zs13rdq.js";var DAEMON_UNREACHABLE_MESSAGE="the rove daemon is not answering (restarting or stopped); nothing was changed, try again in a moment";function isDaemonUnreachable(err){if(!err||typeof err!=="object"||!("code"in err))return!1;if(err.code==="DAEMON_UNREACHABLE")return!0;return"syscall"in err&&err.syscall==="connect"&&(err.code==="ENOENT"||err.code==="ECONNREFUSED")}function toApiError(err){if(err instanceof ApiError)return err;if(isDaemonUnreachable(err))return new ApiError(DAEMON_UNREACHABLE_MESSAGE,"DAEMON_UNREACHABLE");let message=errorMessage(err);if(/task not found/i.test(message))return new ApiError(message,"TASK_NOT_FOUND",{hint:"that task id does not exist (deleted or mistyped) \u2014 list live tasks and retry with a real id",nextCommandArgs:["api","list"]});if(/unknown daemon request:/i.test(message))return versionSkewError(message);let coded=splitDaemonCode(message);if(coded?.code===REPO_HAS_NO_COMMITS_CODE)return new ApiError(coded.rest,coded.code,{hint:REPO_HAS_NO_COMMITS_HINT});if(coded)return new ApiError(coded.rest,coded.code);return new ApiError(message,"RPC_ERROR")}function versionSkewError(message){return new ApiError(message,"DAEMON_VERSION_SKEW",{hint:"the running daemon is a different build than this CLI, so it does not serve this verb \u2014 restart the daemon to pick up this build, then retry (if the verb is gone for good, `rove api schema` lists what this daemon actually serves)",nextCommandArgs:["daemon","restart"]})}function errorBody(err){return{message:err.message,code:err.code,...err.data}}function successEnvelope(result){return{apiVersion:ROVE_API_VERSION,ok:!0,result}}function errorEnvelope(err){return{apiVersion:ROVE_API_VERSION,ok:!1,error:errorBody(toApiError(err))}}function flagText(name,spec,value){let type=spec?.type;if(typeof value==="string")return value;if(spec?.repeatable&&Array.isArray(value)&&value.every((item)=>typeof item==="string"))return value.join(REPEAT_SEP);if(typeof value==="boolean"&&(type==="bool"||type===void 0))return String(value);if(typeof value==="number"&&(type==="int"||type==="uint"||type===void 0))return String(value);if(Array.isArray(value)&&(type==="csv"||type===void 0)){if(!value.every((item)=>typeof item==="string"&&!item.includes(",")))throw new ApiError(`param ${name} must be a list of strings without ","`,"BAD_FLAG");return value.join(",")}throw new ApiError(`param ${name} does not fit its ${type} flag`,"BAD_FLAG")}function paramsToFlags(verb,params){let flags=new Map;for(let[name,value]of Object.entries(params))flags.set(name,flagText(name,verb.flags.find((f)=>f.name===name),value));return flags}function booleanFlagsOf(verb){return new Set(verb.flags.filter((f)=>f.type==="bool").map((f)=>f.name))}function repeatableFlagsOf(verb){return new Set(verb.flags.filter((f)=>f.repeatable).map((f)=>f.name))}async function callVerb(verb,flags,deps){requireVerbInstalled(verb);let caller=deps.caller??cliCaller();try{return await verb.handler({args:new VerbArgs(verb,flags,caller),caller,client:deps.client,runtime:deps.runtime??defaultApiRuntime})}catch(err){throw toApiError(err)}}async function runVerb(verbName,input,deps){ensurePluginEnginesLoaded();let verb=findVerb(verbName);if(!verb)throw unknownVerbError(verbName);if(verb.cliOnly&&!(deps.caller??cliCaller()).cli)throw new ApiError(`"${verbName}" streams over stdout/stdin, so only \`rove api\` can run it`,"CLI_ONLY_VERB",{hint:"run it as a CLI command on the machine whose daemon you are talking to"});let flags="argv"in input?parseFlags(input.argv,booleanFlagsOf(verb),repeatableFlagsOf(verb)).flags:paramsToFlags(verb,input.params);return validateAgainstSpec(verb,flags),callVerb(verb,flags,deps)}async function executeVerb(verbName,input,deps){try{return successEnvelope(await runVerb(verbName,input,deps))}catch(err){return errorEnvelope(err)}}function argvToParams(verbName,argv){let verb=findVerb(verbName);if(!verb)throw unknownVerbError(verbName);let{flags}=parseFlags(argv,booleanFlagsOf(verb),repeatableFlagsOf(verb));return Object.fromEntries(flags)}
|
|
3
3
|
export{DAEMON_UNREACHABLE_MESSAGE,isDaemonUnreachable,toApiError,errorBody,successEnvelope,errorEnvelope,paramsToFlags,booleanFlagsOf,repeatableFlagsOf,callVerb,runVerb,executeVerb,argvToParams};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{PR_VIEW_TIMEOUT_MS,checkFrame,failingCheckTargets,ghText,isLoopbackHost,makeGhPrUrlRunner,makeGhPrViewRunner,readFailingChecks}from"./chunk-yprn97vs.js";import{countCronBetween,isValidCron,latestCronAtOrBefore,nextCronAfter}from"./chunk-a4hsqj1b.js";import{activityPriority,sameTaskStatus,tabStatus,taskStatus,tightenInstalledPluginPermissions}from"./chunk-2d0yz3mg.js";import{ClientWriter,LineReceiver,objectPayload,optionalActivityDetail,optionalBoolean,optionalNumber,optionalString,optionalVendor,requireNumber,requireString,statusActivity}from"./chunk-rmnm3f9n.js";import{DEFAULT_STATE_DEBOUNCE_MS,startStateWatcher}from"./chunk-cpgnm1xr.js";import{startFileWatchTrigger}from"./chunk-r3s2t9af.js";import{parseDaemonStopReason}from"./chunk-6xr1prk6.js";import{canonicalEngineTab,ownEngineTabs}from"./chunk-q8ffd1pc.js";import{IssuesStore,applyTabOps,defaultIssuesStorePath,releaseOrdinals,reserveOrdinals,resolveRepoRoot}from"./chunk-rh5024pb.js";import{buildPluginEnv}from"./chunk-d1vv8xk6.js";import{STICKY_STATES,activityStillWorking,reduceActivity,resolveEngineStateTtlMs}from"./chunk-2bgmby1d.js";import{serialized,writeJsonAtomic,writeTextAtomic}from"./chunk-5mhvjytn.js";import{currentPluginPlatform,loadPluginRegistry,pluginManifestPath,readPluginManifest,supportsPlatform}from"./chunk-jpc5yh8e.js";import{isBuiltinModInstalled,requireBuiltinMod}from"./chunk-v8nbqjwc.js";import{pluginConfigDir,pluginLogPath,pluginRegistryPath,pluginStateDir}from"./chunk-ws2q07kb.js";import{RowTokenStore,isRowTokenTone}from"./chunk-mdx18vtz.js";import{DISPATCH_PROMPT_HEAD_CHARS,DispatchLedger,matchTaskByCwd,readMachineLoad,resolvePtyOwner,tasksAtWorktreePath}from"./chunk-y0e28qha.js";import{ENGINE_EXIT_BANNER,engineExitCodeFromTail,plainTail,readPtyExitRecords,readPtyExitStore,recordEngineExit,wrapperBannerCodeFromTail}from"./chunk-eaav6ajz.js";import{parsePorcelainRows}from"./chunk-dmzg9zdc.js";import{worktreeFingerprint}from"./chunk-kg9kmwt9.js";import{aliasKey,aliasedKeys,hasFrozenPtySessions,listPtyHostSessions,ptyHostHasLiveSessions,ptyScopeFor,sweepPtyHostSessions,teardownScope}from"./chunk-2caxfsms.js";import{logDaemonError,logDaemonInfo}from"./chunk-rxqdw6s5.js";import{resolveLoginShell}from"./chunk-tn9gtf18.js";import{computeNextAllowedAt,maybeStartScheduledRun}from"./chunk-f60hmm20.js";import{linkedWorkspace,repoIdOf}from"./chunk-nr7c9q0j.js";import{probeDaemonSocket}from"./chunk-k7tdg6kb.js";import{detachOptions}from"./chunk-e5jxbd98.js";import{CHANNEL_NAMES,DAEMON_PROTOCOL_VERSION,DELIVERY_EVIDENCE_MAX_CHARS,DELIVERY_EVIDENCE_MAX_ITEMS,DELIVERY_NEXT_MAX_CHARS,DELIVERY_OUTCOMES,DELIVERY_PROMPT_HEAD_CHARS,DELIVERY_STALL_MS,DELIVERY_SUMMARY_MAX_CHARS,GATE_CONTEXT_MAX,GATE_OPTIONS_MAX,GATE_QUESTION_MAX,MAX_DELIVERIES_PER_TASK,MIN_COMPATIBLE_PROTOCOL_VERSION,ROUTINE_RESPONSE_MAX_CHARS,RoveDaemonClient,attentionInboxItemKey,automationRunNeedsAttention,deliveryFooter,frameToLine,isAttentionInboxState,isProtocolCompatible,isRoutineInboxState,normalizeChannelFilter,parseSkipVerdict}from"./chunk-84q9hv7m.js";import{MOD_INPUT_MAX,MOD_PANE_ID_PATTERN,MOD_TITLE_MAX,ROVE_API_VERSION,validateModTree}from"./chunk-96kvwzj8.js";import{AUTO_FIX_MAX,autoFixDecision}from"./chunk-
|
|
2
|
+
import{PR_VIEW_TIMEOUT_MS,checkFrame,failingCheckTargets,ghText,isLoopbackHost,makeGhPrUrlRunner,makeGhPrViewRunner,readFailingChecks}from"./chunk-yprn97vs.js";import{countCronBetween,isValidCron,latestCronAtOrBefore,nextCronAfter}from"./chunk-a4hsqj1b.js";import{activityPriority,sameTaskStatus,tabStatus,taskStatus,tightenInstalledPluginPermissions}from"./chunk-2d0yz3mg.js";import{ClientWriter,LineReceiver,objectPayload,optionalActivityDetail,optionalBoolean,optionalNumber,optionalString,optionalVendor,requireNumber,requireString,statusActivity}from"./chunk-rmnm3f9n.js";import{DEFAULT_STATE_DEBOUNCE_MS,startStateWatcher}from"./chunk-cpgnm1xr.js";import{startFileWatchTrigger}from"./chunk-r3s2t9af.js";import{parseDaemonStopReason}from"./chunk-6xr1prk6.js";import{canonicalEngineTab,ownEngineTabs}from"./chunk-q8ffd1pc.js";import{IssuesStore,applyTabOps,defaultIssuesStorePath,releaseOrdinals,reserveOrdinals,resolveRepoRoot}from"./chunk-rh5024pb.js";import{buildPluginEnv}from"./chunk-d1vv8xk6.js";import{STICKY_STATES,activityStillWorking,reduceActivity,resolveEngineStateTtlMs}from"./chunk-2bgmby1d.js";import{serialized,writeJsonAtomic,writeTextAtomic}from"./chunk-5mhvjytn.js";import{currentPluginPlatform,loadPluginRegistry,pluginManifestPath,readPluginManifest,supportsPlatform}from"./chunk-jpc5yh8e.js";import{isBuiltinModInstalled,requireBuiltinMod}from"./chunk-v8nbqjwc.js";import{pluginConfigDir,pluginLogPath,pluginRegistryPath,pluginStateDir}from"./chunk-ws2q07kb.js";import{RowTokenStore,isRowTokenTone}from"./chunk-mdx18vtz.js";import{DISPATCH_PROMPT_HEAD_CHARS,DispatchLedger,matchTaskByCwd,readMachineLoad,resolvePtyOwner,tasksAtWorktreePath}from"./chunk-y0e28qha.js";import{ENGINE_EXIT_BANNER,engineExitCodeFromTail,plainTail,readPtyExitRecords,readPtyExitStore,recordEngineExit,wrapperBannerCodeFromTail}from"./chunk-eaav6ajz.js";import{parsePorcelainRows}from"./chunk-dmzg9zdc.js";import{worktreeFingerprint}from"./chunk-kg9kmwt9.js";import{aliasKey,aliasedKeys,hasFrozenPtySessions,listPtyHostSessions,ptyHostHasLiveSessions,ptyScopeFor,sweepPtyHostSessions,teardownScope}from"./chunk-2caxfsms.js";import{logDaemonError,logDaemonInfo}from"./chunk-rxqdw6s5.js";import{resolveLoginShell}from"./chunk-tn9gtf18.js";import{computeNextAllowedAt,maybeStartScheduledRun}from"./chunk-f60hmm20.js";import{linkedWorkspace,repoIdOf}from"./chunk-nr7c9q0j.js";import{probeDaemonSocket}from"./chunk-k7tdg6kb.js";import{detachOptions}from"./chunk-e5jxbd98.js";import{CHANNEL_NAMES,DAEMON_PROTOCOL_VERSION,DELIVERY_EVIDENCE_MAX_CHARS,DELIVERY_EVIDENCE_MAX_ITEMS,DELIVERY_NEXT_MAX_CHARS,DELIVERY_OUTCOMES,DELIVERY_PROMPT_HEAD_CHARS,DELIVERY_STALL_MS,DELIVERY_SUMMARY_MAX_CHARS,GATE_CONTEXT_MAX,GATE_OPTIONS_MAX,GATE_QUESTION_MAX,MAX_DELIVERIES_PER_TASK,MIN_COMPATIBLE_PROTOCOL_VERSION,ROUTINE_RESPONSE_MAX_CHARS,RoveDaemonClient,attentionInboxItemKey,automationRunNeedsAttention,deliveryFooter,frameToLine,isAttentionInboxState,isProtocolCompatible,isRoutineInboxState,normalizeChannelFilter,parseSkipVerdict}from"./chunk-84q9hv7m.js";import{MOD_INPUT_MAX,MOD_PANE_ID_PATTERN,MOD_TITLE_MAX,ROVE_API_VERSION,validateModTree}from"./chunk-96kvwzj8.js";import{AUTO_FIX_MAX,autoFixDecision}from"./chunk-m74qxqw0.js";import{TodoRefusedError,canonicalPrUrl,deletionTargets,lineageRootId,parseTodoOps,pickRepos,subtreeIds,taskCwd,withOwnedCheckouts,workspaceCapabilities,workspaceOwnerId}from"./chunk-sckqk79z.js";import{rotateLogIfNeeded}from"./chunk-y8hjgmn0.js";import{samePath}from"./chunk-pn5ygqn6.js";import{createSocketOwnershipGuard,isProcessAlive,listenOnUnixSocket}from"./chunk-tw25g9g5.js";import{OWNER_ONLY_DIR_MODE,OWNER_ONLY_FILE_MODE,ensureOwnerOnlyStateDir}from"./chunk-yt15y085.js";import{defaultDaemonPidPath,defaultDaemonSocketPath,defaultDeliveriesPath,defaultPtyExitsPath,defaultPtyHostSocketPath,defaultRowTokensPath,endpointPathFor,resolveDaemonHomeDir}from"./chunk-2z2jwetd.js";import{defaultKeybindingsPath,defaultUiPrefsStatePath,resolveProductHomeDir}from"./chunk-pzbcbmm4.js";import{ROVE_STATE_DIR_BASENAME,readRoveEnv,readRoveHomeDirEnv}from"./chunk-nc46gddg.js";import{__require}from"./chunk-91sykzqq.js";import{mkdir as mkdir2,unlink as unlink2}from"fs/promises";import{createServer}from"net";import{dirname as dirname2}from"path";import{statSync}from"fs";import{resolve}from"path";var WATCHED_FIELDS=["title","branch","worktreePath","status","pinned","vendor","command","modelEffort","model","tier","linkedWorkItem","scratch"];function same(a,b){if(a===b)return!0;if(a==null||b==null)return a==null&&b==null;if(typeof a==="object"||typeof b==="object")return JSON.stringify(a)===JSON.stringify(b);return!1}function samePr(a,b){let strip=(v)=>{if(v==null||typeof v!=="object"||Array.isArray(v))return v;let{lastCheckedAt:_a,lastError:_b,...rest}=v;return rest};return same(strip(a),strip(b))}function diffTask(prev,next){let fields=[],from={},to={};for(let field of WATCHED_FIELDS){let a=prev[field],b=next[field];if(same(a,b))continue;if(fields.push(field),a!==void 0)from[field]=a;if(b!==void 0)to[field]=b}let prChanged=!samePr(prev.prStatus,next.prStatus);if(fields.length===0&&!prChanged)return null;return{fields,from,to,prChanged,worktreeCreated:next.kind==="task"&&!prev.worktreePath&&!!next.worktreePath}}function bornWithWorktree(task){return task.kind==="task"&&!!task.worktreePath}function lifecycleEventFor(kind,detail){switch(kind){case"session-start":return"session.start";case"session-end":return"session.end";case"turn-start":return"turn.prompt";case"turn-complete":return"turn.complete";case"turn-failed":return"turn.failed";case"turn-interrupted":return"turn.interrupted";case"awaiting-input":return detail?.waiting==="input"?"attention.question":"attention.permission";case"tool-pre":return"tool.pre";case"tool-post":return"tool.post";case"tool-failed":return"tool.failed";case"pre-compact":return"context.pre-compact";case"post-compact":return"context.post-compact";case"subagent-start":return"subagent.start";case"subagent-stop":return"subagent.stop";default:return}}var AGENT_EVENT_BY_STATE={turn_complete:"agent.turn-complete",permission_needed:"agent.permission-needed",rate_limited:"agent.rate-limited",error:"agent.error",running:"agent.running",idle:"agent.idle"};function taskContext(task){if(!task)return;let{id,title,repo,branch,worktreePath,vendor,status}=task;return{id,title,repo,branch,worktreePath,vendor,status}}class PluginEventReducer{tasks;agentState=new Map;limitedSince=new Map;tabbed=new Set;now;constructor(now=Date.now){this.now=now}contextFor(taskId){return taskContext(this.tasks?.get(taskId))}reduce(event){switch(event.channel){case"task.snapshot":return this.reduceTasks(event.payload.tasks);case"engine-state":return this.reduceEngine(event.payload);default:return[]}}reduceTasks(tasks){let next=new Map(tasks.map((t)=>[t.id,t])),prev=this.tasks;if(this.tasks=next,!prev)return[];let at=this.now(),out=[];for(let[id,task]of next){let before=prev.get(id);if(!before){if(out.push({event:"task.created",taskId:id,task:taskContext(task),at}),bornWithWorktree(task))out.push({event:"worktree.created",taskId:id,task:taskContext(task),at});continue}let diff=diffTask(before,task);if(!diff)continue;let ctx=taskContext(task);if(diff.fields.length>0)out.push({event:"task.changed",taskId:id,task:ctx,detail:{fields:diff.fields,from:diff.from,to:diff.to},at});if(diff.prChanged)out.push({event:"task.pr-changed",taskId:id,task:ctx,detail:{...before.prStatus!==void 0?{from:before.prStatus}:{},...task.prStatus!==void 0?{to:task.prStatus}:{}},at});if(diff.worktreeCreated)out.push({event:"worktree.created",taskId:id,task:ctx,at})}for(let[id,task]of prev)if(!next.has(id))out.push({event:"task.deleted",taskId:id,task:taskContext(task),at});return out}reduceEngine(payload){let key=`${payload.taskId}\x00${payload.tabId??""}`,prev=this.agentState.get(key);if(this.agentState.set(key,payload.state),prev===payload.state)return[];let event=AGENT_EVENT_BY_STATE[payload.state];if(!event)return[];let at=this.now(),base={taskId:payload.taskId,task:taskContext(this.tasks?.get(payload.taskId)),...payload.tabId?{tabId:payload.tabId}:{},at},out=[{event,...base}],recovered=this.trackRateLimit(key,payload,at);if(recovered!==void 0)out.push({event:"agent.rate-limit-recovered",...base,detail:{limitedAt:new Date(recovered).toISOString(),limitedForMs:at-recovered}});return out}trackRateLimit(key,payload,at){if(payload.tabId)this.tabbed.add(payload.taskId);else if(this.tabbed.has(payload.taskId))return;if(payload.state==="rate_limited"){if(!this.limitedSince.has(key))this.limitedSince.set(key,at);return}if(payload.state!=="turn_complete")return;let since=this.limitedSince.get(key);if(since===void 0)return;return this.limitedSince.delete(key),since}}import{execFile,spawn}from"child_process";import{appendFileSync,mkdirSync}from"fs";var OUTPUT_CAP=8192,PLUGIN_LOG_CAP_BYTES=4194304,SHUTDOWN_GRACE_MS=3000,HOOK_TIMEOUT_MS=30000,HOOK_SLOW_MS=2000;function hookTimeoutMs(spec,kind){return spec.timeoutMs??(kind==="shutdown"?SHUTDOWN_GRACE_MS:HOOK_TIMEOUT_MS)}function appendPluginLogRecord(pluginId,homeDir,record){try{let logPath=pluginLogPath(pluginId,homeDir);rotateLogIfNeeded(logPath,PLUGIN_LOG_CAP_BYTES),appendFileSync(logPath,`${JSON.stringify(record)}
|
|
3
3
|
`,{mode:OWNER_ONLY_FILE_MODE})}catch{}}async function runPluginHook(opts){let{pluginId,spec,kind,label,homeDir}=opts,timeoutMs=hookTimeoutMs(spec,kind),startedAt=Date.now();try{mkdirSync(pluginConfigDir(pluginId,homeDir),{recursive:!0,mode:OWNER_ONLY_DIR_MODE}),mkdirSync(pluginStateDir(pluginId,homeDir),{recursive:!0,mode:OWNER_ONLY_DIR_MODE})}catch(err){appendPluginLogRecord(pluginId,homeDir,{at:startedAt,kind,label,command:spec.command,exitCode:null,durationMs:Date.now()-startedAt,spawnError:String(err)}),opts.log?.(`plugin ${pluginId} ${label}: ${String(err)}`);return}let exitCode=null,stdout="",stderr="",spawnError,timedOut=!1;if(await new Promise((resolve)=>{let[cmd,...args]=spec.command,child=spawn(cmd,args,{cwd:opts.pluginRoot,env:buildPluginEnv({homeDir,socketPath:opts.socketPath,binPath:opts.binPath,pluginId,pluginRoot:opts.pluginRoot,extra:opts.extraEnv}),stdio:["ignore","pipe","pipe"],...detachOptions(opts.platform)}),kill=()=>{try{if(child.pid&&(opts.platform??process.platform)==="win32")execFile("taskkill",["/pid",String(child.pid),"/T","/F"],{windowsHide:!0},(err)=>{if(err)child.kill("SIGKILL")});else if(child.pid)process.kill(-child.pid,"SIGKILL");else child.kill("SIGKILL")}catch{child.kill("SIGKILL")}},deadline=setTimeout(()=>{timedOut=!0,kill()},timeoutMs);deadline.unref?.();let slow=setTimeout(()=>{appendPluginLogRecord(pluginId,homeDir,{at:startedAt,kind,label,command:spec.command,phase:"running",runningMs:Date.now()-startedAt,timeoutMs})},Math.min(HOOK_SLOW_MS,Math.floor(timeoutMs/2)));slow.unref?.(),opts.inFlight?.add(kill);let finish=()=>{clearTimeout(deadline),clearTimeout(slow),opts.inFlight?.delete(kill),resolve()};child.stdout.on("data",(chunk)=>{if(stdout.length<OUTPUT_CAP)stdout+=chunk.toString().slice(0,OUTPUT_CAP-stdout.length)}),child.stderr.on("data",(chunk)=>{if(stderr.length<OUTPUT_CAP)stderr+=chunk.toString().slice(0,OUTPUT_CAP-stderr.length)}),child.on("error",(err)=>{spawnError=String(err),finish()}),child.on("close",(code)=>{exitCode=code,finish()})}),appendPluginLogRecord(pluginId,homeDir,{at:startedAt,kind,label,command:spec.command,exitCode,durationMs:Date.now()-startedAt,...timedOut?{timedOut:!0,timeoutMs}:{},...stdout?{stdout}:{},...stderr?{stderr}:{},...spawnError?{spawnError}:{}}),timedOut)opts.log?.(`plugin ${pluginId} ${label}: killed after ${timeoutMs}ms (hook did not exit)`);else if(spawnError||exitCode!==null&&exitCode!==0)opts.log?.(`plugin ${pluginId} ${label}: ${spawnError??`exit ${exitCode}`}`)}import{execFile as execFile2,spawn as spawn2}from"child_process";import{mkdirSync as mkdirSync2}from"fs";var MOD_MAX_PANES=8,MAX_LINE_BYTES=524288,RESTART_MIN_MS=1000,RESTART_MAX_MS=30000,HEALTHY_RUN_MS=60000;function treeHasControl(node,type,key){if(node.type===type)return node.key===key;if(node.type==="box")return node.children.some((child)=>treeHasControl(child,type,key));return!1}class ModHost{opts;mods=new Map;stopped=!1;constructor(opts){this.opts=opts}sync(specs){if(this.stopped)return;let next=new Map(specs.map((s)=>[s.pluginId,s]));for(let[id,running]of this.mods){let spec=next.get(id);if(!spec||spec.root!==running.spec.root||spec.stamp!==running.spec.stamp||!sameCommand(spec.mod,running.spec.mod))this.retire(id)}for(let spec of specs)if(!this.mods.has(spec.pluginId))this.launch(spec);this.publish()}press(pluginId,paneId,key){return this.forward(pluginId,paneId,"button",key,{type:"press",pane:paneId,key})}submit(pluginId,paneId,key,value){if(value.length>MOD_INPUT_MAX)return"too-long";return this.forward(pluginId,paneId,"input",key,{type:"submit",pane:paneId,key,value})}deliver(pluginIds,event){for(let running of this.mods.values()){if(!pluginIds.has(running.spec.pluginId)||!running.events.has(event.event))continue;if(running.child?.stdin?.writable)running.child.stdin.write(`${JSON.stringify({type:"event",event})}
|
|
4
4
|
`)}}forward(pluginId,paneId,type,key,msg){let running=this.mods.get(pluginId);if(!running?.child?.stdin?.writable)return"no-mod";let pane=running.panes.get(paneId);if(!pane)return"no-pane";if(!treeHasControl(pane.tree,type,key))return"no-key";return running.child.stdin.write(`${JSON.stringify(msg)}
|
|
5
5
|
`),"sent"}panes(){return[...this.mods.values()].flatMap((m)=>[...m.panes.values()])}stop(){if(this.stopped)return;this.stopped=!0;for(let id of[...this.mods.keys()])this.retire(id)}publish(){this.opts.publish(this.panes())}retire(pluginId){let running=this.mods.get(pluginId);if(!running)return;if(this.mods.delete(pluginId),running.restartTimer)clearTimeout(running.restartTimer);if(running.child)killGroup(running.child,this.opts.platform);running.child=null}launch(spec){let running={spec,child:null,startedAt:0,backoffMs:RESTART_MIN_MS,restartTimer:void 0,panes:new Map,events:new Set};this.mods.set(spec.pluginId,running),this.spawnChild(running)}record(running,record){appendPluginLogRecord(running.spec.pluginId,this.opts.homeDir,{at:Date.now(),kind:"mod",...record})}spawnChild(running){let{pluginId,root,mod}=running.spec,[cmd,...args]=mod.command,child;try{mkdirSync2(pluginConfigDir(pluginId,this.opts.homeDir),{recursive:!0,mode:OWNER_ONLY_DIR_MODE}),mkdirSync2(pluginStateDir(pluginId,this.opts.homeDir),{recursive:!0,mode:OWNER_ONLY_DIR_MODE}),child=spawn2(cmd,args,{cwd:root,env:buildPluginEnv({homeDir:this.opts.homeDir,socketPath:this.opts.socketPath,binPath:this.opts.binPath,pluginId,pluginRoot:root,extra:{ROVE_PLUGIN_EVENT:"mod"}}),stdio:["pipe","pipe","pipe"],...detachOptions(this.opts.platform)})}catch(err){this.record(running,{spawnError:String(err)}),this.scheduleRestart(running);return}running.child=child,running.events=new Set,running.startedAt=Date.now(),this.record(running,{phase:"started",command:mod.command}),child.stdin?.on("error",()=>{}),readLines(child,"stdout",(line)=>this.onLine(running,child,line)),readLines(child,"stderr",(line)=>this.record(running,{stderr:line.slice(0,2048)})),child.on("error",(err)=>this.record(running,{spawnError:String(err)})),child.on("close",(code,signal)=>{if(running.child!==child)return;if(running.child=null,this.record(running,{phase:"exited",exitCode:code,...signal?{signal}:{}}),this.opts.log?.(`mod ${pluginId} exited (${signal??`exit ${code}`})`),running.panes.size>0)running.panes.clear(),this.publish();if(Date.now()-running.startedAt>=HEALTHY_RUN_MS)running.backoffMs=RESTART_MIN_MS;this.scheduleRestart(running)})}scheduleRestart(running){if(this.stopped||this.mods.get(running.spec.pluginId)!==running)return;let delay=running.backoffMs;running.backoffMs=Math.min(running.backoffMs*2,RESTART_MAX_MS),running.restartTimer=setTimeout(()=>{if(running.restartTimer=void 0,this.stopped||this.mods.get(running.spec.pluginId)!==running)return;this.spawnChild(running)},delay),running.restartTimer.unref?.()}onLine(running,child,line){if(running.child!==child||line.trim()==="")return;let msg;try{msg=JSON.parse(line)}catch{this.record(running,{refused:"stdout line is not JSON",line:line.slice(0,200)});return}let refused=this.apply(running,msg);if(refused)this.record(running,{refused})}apply(running,msg){if(msg.type==="subscribe"){if(!Array.isArray(msg.events)||!msg.events.every((e)=>typeof e==="string"))return"subscribe needs events: string[]";return running.events=new Set(msg.events),null}if(typeof msg.id!=="string"||!MOD_PANE_ID_PATTERN.test(msg.id))return"bad pane id";if(msg.type==="close"){if(running.panes.delete(msg.id))this.publish();return null}if(msg.type!=="pane")return`unknown message type ${JSON.stringify(msg.type)}`;if(typeof msg.title!=="string"||msg.title.length===0||msg.title.length>MOD_TITLE_MAX)return`pane ${msg.id}: title must be 1-${MOD_TITLE_MAX} chars`;if(!running.panes.has(msg.id)&&running.panes.size>=MOD_MAX_PANES)return`pane ${msg.id}: more than ${MOD_MAX_PANES} panes`;let tree=validateModTree(msg.tree);if(!tree.ok)return`pane ${msg.id}: ${tree.error}`;return running.panes.set(msg.id,{plugin:running.spec.pluginId,id:msg.id,title:msg.title,tree:tree.tree}),this.publish(),null}}function sameCommand(a,b){return a.command.length===b.command.length&&a.command.every((part,i)=>part===b.command[i])}function killGroup(child,platform=process.platform){try{if(child.pid&&platform==="win32")execFile2("taskkill",["/pid",String(child.pid),"/T","/F"],{windowsHide:!0},(err)=>{if(err)child.kill("SIGTERM")});else if(child.pid)process.kill(-child.pid,"SIGTERM");else child.kill("SIGTERM")}catch{child.kill("SIGTERM")}}function readLines(child,stream,onLine){let buf="";child[stream]?.on("data",(chunk)=>{buf+=chunk.toString();let nl=buf.indexOf(`
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{failureHint}from"./chunk-ryfvgfan.js";import{PluginCliError,installPlugin,linkPlugin}from"./chunk-
|
|
2
|
+
import{failureHint}from"./chunk-ryfvgfan.js";import{PluginCliError,installPlugin,linkPlugin}from"./chunk-yztcd26z.js";import{resolvePluginBinPath}from"./chunk-0q4phwxr.js";import{buildPaneArgv}from"./chunk-73a9kk03.js";import{buildPluginEnv}from"./chunk-d1vv8xk6.js";import{currentPluginPlatform,loadPluginRegistry,qualifiedActionId,readPluginManifest,removePluginEntry,savePluginRegistry,supportsPlatform}from"./chunk-jpc5yh8e.js";import{BUILTIN_MODS,installedBuiltinMods,isBuiltinModId,setBuiltinModInstalled}from"./chunk-v8nbqjwc.js";import{pluginCheckoutDir,pluginConfigDir,pluginLogPath}from"./chunk-ws2q07kb.js";import"./chunk-brpz7xfs.js";import{SUBCOMMAND_VERBS}from"./chunk-ypvnrqg4.js";import"./chunk-v8ms64g1.js";import"./chunk-7b2x6nkj.js";import"./chunk-tn9gtf18.js";import"./chunk-w7zv47mp.js";import"./chunk-96kvwzj8.js";import{flagValue}from"./chunk-78y80xe8.js";import{errorMessage}from"./chunk-0zs13rdq.js";import"./chunk-r4vwq5wv.js";import"./chunk-yt15y085.js";import{defaultDaemonSocketPath}from"./chunk-2z2jwetd.js";import"./chunk-pzbcbmm4.js";import{ROVE_PRODUCT_NAME}from"./chunk-4ctx6hst.js";import"./chunk-g6wb8p4p.js";import"./chunk-nc46gddg.js";import{__require}from"./chunk-91sykzqq.js";import{spawnSync}from"child_process";import{readFileSync,rmSync}from"fs";function builtinModRows(homeDir){let installed=new Set(installedBuiltinMods(homeDir));return BUILTIN_MODS.map((mod)=>`${mod.id} first-party ${installed.has(mod.id)?"installed":"not installed"} (${mod.description})`)}function setBuiltinMod(id,install,homeDir){let was=installedBuiltinMods(homeDir).includes(id);if(setBuiltinModInstalled(id,install,homeDir),install)return was?`${id} is already installed`:`installed ${id}`;return was?`uninstalled ${id} (its data stays on disk; reinstall picks it up)`:`${id} is not installed`}var CLI_NAME=ROVE_PRODUCT_NAME;function printUsage(out){out.write([`usage: ${CLI_NAME} plugin <command>`,""," install <owner/repo[/subdir]> [--yes] [--ref <rev>] clone from GitHub, preview, build, register"," install kanban | issues install a first-party mod (uninstall keeps its data)"," link <dir> register a local plugin directory (dev)"," list first-party mods, installed + linked plugins"," search [query] browse the marketplace (GitHub topic rove-plugin)"," outdated check GitHub-installed plugins against upstream"," update <id\u2026> | --all [--yes] reinstall stale plugins from GitHub"," enable <id> | disable <id> toggle a plugin without unregistering it"," unlink <id> unregister a linked plugin (files untouched)"," uninstall <id-or-spec> unregister + remove the managed checkout"," config-dir <id> print the plugin's config directory"," log <id> [-n <count>] tail the plugin's command-run log"," action list [--plugin <id>] declared actions"," action invoke <plugin-id.action-id> run an action now"," pane open <plugin-id.pane-id> [--task <task-id>] open a plugin pane as a terminal tab (JSON:"," clients \u2014 0 = no attached UI performed the split)","","Marketplace: https://github.com/topics/rove-plugin",""].join(`
|
|
3
3
|
`))}function loadAll(){return loadPluginRegistry().plugins.map((entry)=>{try{return{entry,manifest:readPluginManifest(entry.root).manifest}}catch{return{entry,manifest:void 0}}})}function requireEntry(id){let entry=loadPluginRegistry().plugins.find((p)=>p.id===id);if(!entry)throw new PluginCliError(`no plugin registered as \`${id}\`; see \`${CLI_NAME} plugin list\``);return entry}function listPlugins(){for(let row of builtinModRows())console.log(row);let all=loadAll();if(all.length===0){console.log(`no other plugins installed. Try: ${CLI_NAME} plugin install <owner/repo> \u2014 browse the \`rove-plugin\` GitHub topic.`);return}for(let{entry,manifest}of all){let state=entry.enabled?"enabled":"disabled",kind=entry.source.kind==="link"?`linked ${entry.root}`:entry.source.spec,broken=manifest?"":" [manifest unreadable]";console.log(`${entry.id} v${entry.version} ${state} (${kind})${broken}`)}}function setEnabled(id,enabled){let entry=requireEntry(id),registry=loadPluginRegistry();savePluginRegistry({plugins:registry.plugins.map((p)=>p.id===id?{...entry,enabled}:p)}),console.log(`${enabled?"enabled":"disabled"} ${id}`)}function unlink(id){let entry=requireEntry(id);if(entry.source.kind!=="link")throw new PluginCliError(`\`${id}\` is a GitHub install; use uninstall`);savePluginRegistry(removePluginEntry(loadPluginRegistry(),id)),console.log(`unlinked ${id} (files untouched at ${entry.root})`)}function uninstall(idOrSpec){let registry=loadPluginRegistry(),entry=registry.plugins.find((p)=>p.id===idOrSpec||p.source.kind==="github"&&p.source.spec===idOrSpec);if(!entry)throw new PluginCliError(`no plugin registered as \`${idOrSpec}\``);if(entry.source.kind==="link")throw new PluginCliError(`\`${entry.id}\` is linked; use unlink`);savePluginRegistry(removePluginEntry(registry,entry.id)),rmSync(pluginCheckoutDir(entry.id),{recursive:!0,force:!0}),console.log(`uninstalled ${entry.id} (config/state kept under ~/.rove/plugins/${entry.id}/)`)}function listActions(pluginFilter){for(let{entry,manifest}of loadAll()){if(!manifest||pluginFilter&&entry.id!==pluginFilter)continue;for(let action of manifest.actions)console.log(`${qualifiedActionId(entry.id,action.id)} ${action.title}`)}}function findByLongestPluginPrefix(qualified,options,findItem){for(let{entry,manifest}of loadAll().filter(({entry:entry2,manifest:manifest2})=>Boolean(manifest2&&(!options.enabledOnly||entry2.enabled)&&qualified.startsWith(`${entry2.id}.`))).sort((a,b)=>b.entry.id.length-a.entry.id.length)){let item=findItem(manifest,qualified.slice(entry.id.length+1));if(item!==void 0)return{entry,manifest,item}}return}function assertPlatformSupported(label,item,manifest){if(supportsPlatform(item,manifest,currentPluginPlatform()))return;let declared=(item.platforms??manifest.platforms??[]).join(", ");throw new PluginCliError(`\`${label}\` is not supported on this platform (declares ${declared})`)}function invokeAction(qualified,extraArgs){let hit=findByLongestPluginPrefix(qualified,{enabledOnly:!0},(manifest,actionId)=>manifest.actions.find((a)=>a.id===actionId));if(!hit)throw new PluginCliError(`no action \`${qualified}\`; see \`${CLI_NAME} plugin action list\``);assertPlatformSupported(qualified,hit.item,hit.manifest);let action=hit.item,[cmd,...args]=[...action.command,...extraArgs],res=spawnSync(cmd,args,{cwd:hit.entry.root,stdio:"inherit",env:buildPluginEnv({socketPath:defaultDaemonSocketPath(),binPath:resolvePluginBinPath(),pluginId:hit.entry.id,pluginRoot:hit.entry.root,extra:{ROVE_PLUGIN_ACTION_ID:action.id,ROVE_PLUGIN_INVOKE_CWD:process.cwd()}})});process.exit(res.status??1)}function resolvePaneQualified(qualified){let hit=findByLongestPluginPrefix(qualified,{enabledOnly:!1},(manifest,entrypoint)=>manifest.panes.find((p)=>p.id===entrypoint));if(!hit)throw new PluginCliError(`no pane \`${qualified}\`; see \`${CLI_NAME} plugin list\``);return{pluginId:hit.entry.id,entrypoint:hit.item.id}}async function openPane(pluginId,entrypoint,taskFlag){let loaded=loadAll().find(({entry})=>entry.id===pluginId);if(!loaded?.manifest)throw new PluginCliError(`no plugin \`${pluginId}\` (or its manifest is unreadable)`);if(!loaded.entry.enabled)throw new PluginCliError(`\`${pluginId}\` is disabled`);let pane=loaded.manifest.panes.find((p)=>p.id===entrypoint);if(!pane)throw new PluginCliError(`no pane \`${entrypoint}\` in \`${pluginId}\`; declare it under [[panes]]`);assertPlatformSupported(`${pluginId}.${pane.id}`,pane,loaded.manifest);let{openDaemonSession,resolveActiveTaskId}=await import("./chunk-31abr2dy.js"),session=await openDaemonSession({mode:"start"});try{let taskId=taskFlag??await resolveActiveTaskId(session.client);if(!taskId)throw new PluginCliError("no active task; pass --task <id>");let argv=buildPaneArgv(loaded.entry.id,loaded.entry.root,pane,{socketPath:defaultDaemonSocketPath(),binPath:resolvePluginBinPath(),taskId}),reply=await session.client.request("tab.open",{taskId,argv,title:pane.title,placement:pane.placement});console.log(JSON.stringify({...reply,ok:!0,pane:`${pluginId}.${pane.id}`,taskId,title:pane.title}))}finally{session.close()}}function tailLog(id,count){requireEntry(id);let text;try{text=readFileSync(pluginLogPath(id),"utf8")}catch{console.log("(no runs logged yet)");return}let lines=text.trimEnd().split(`
|
|
4
|
-
`);for(let line of lines.slice(-count))console.log(line)}async function runPluginSubcommand(rest){let[command,...args]=rest;if(command!==void 0&&!SUBCOMMAND_VERBS.plugin.includes(command)){let isHelp=command==="help"||command==="--help"||command==="-h";if(printUsage(isHelp?process.stdout:process.stderr),!isHelp)process.exit(2);return}try{switch(command){case"install":{let spec=args.find((a)=>!a.startsWith("-"));if(!spec)throw new PluginCliError("install needs <owner/repo[/subdir]>");if(isBuiltinModId(spec)){console.log(setBuiltinMod(spec,!0));return}await installPlugin(spec,{yes:args.includes("--yes"),ref:flagValue(args,"--ref")});return}case"link":{if(!args[0])throw new PluginCliError("link needs a directory");linkPlugin(args[0]);return}case"list":listPlugins();return;case"search":{let{searchMarketplace}=await import("./chunk-8rpqycn5.js");await searchMarketplace(args.find((a)=>!a.startsWith("-")));return}case"outdated":{let{printOutdated}=await import("./chunk-
|
|
4
|
+
`);for(let line of lines.slice(-count))console.log(line)}async function runPluginSubcommand(rest){let[command,...args]=rest;if(command!==void 0&&!SUBCOMMAND_VERBS.plugin.includes(command)){let isHelp=command==="help"||command==="--help"||command==="-h";if(printUsage(isHelp?process.stdout:process.stderr),!isHelp)process.exit(2);return}try{switch(command){case"install":{let spec=args.find((a)=>!a.startsWith("-"));if(!spec)throw new PluginCliError("install needs <owner/repo[/subdir]>");if(isBuiltinModId(spec)){console.log(setBuiltinMod(spec,!0));return}await installPlugin(spec,{yes:args.includes("--yes"),ref:flagValue(args,"--ref")});return}case"link":{if(!args[0])throw new PluginCliError("link needs a directory");linkPlugin(args[0]);return}case"list":listPlugins();return;case"search":{let{searchMarketplace}=await import("./chunk-8rpqycn5.js");await searchMarketplace(args.find((a)=>!a.startsWith("-")));return}case"outdated":{let{printOutdated}=await import("./chunk-emrnrpk4.js");printOutdated();return}case"update":{let{updatePlugins}=await import("./chunk-emrnrpk4.js");await updatePlugins(args.filter((a)=>!a.startsWith("-")),{all:args.includes("--all"),yes:args.includes("--yes")});return}case"enable":case"disable":{if(!args[0])throw new PluginCliError(`${command} needs a plugin id`);if(isBuiltinModId(args[0]))console.log(setBuiltinMod(args[0],command==="enable"));else setEnabled(args[0],command==="enable");return}case"unlink":{if(!args[0])throw new PluginCliError("unlink needs a plugin id");unlink(args[0]);return}case"uninstall":{if(!args[0])throw new PluginCliError("uninstall needs a plugin id or owner/repo spec");if(isBuiltinModId(args[0]))console.log(setBuiltinMod(args[0],!1));else uninstall(args[0]);return}case"config-dir":{if(!args[0])throw new PluginCliError("config-dir needs a plugin id");requireEntry(args[0]),console.log(pluginConfigDir(args[0]));return}case"log":{if(!args[0])throw new PluginCliError("log needs a plugin id");tailLog(args[0],Number.parseInt(flagValue(args,"-n")??"20",10)||20);return}case"pane":{let[sub,...paneArgs]=args;if(sub==="open"){let positional=paneArgs.find((a)=>!a.startsWith("-")&&a!==flagValue(paneArgs,"--task")),pluginId=flagValue(paneArgs,"--plugin"),entrypoint=flagValue(paneArgs,"--entrypoint");if(!pluginId||!entrypoint){if(!positional)throw new PluginCliError("pane open needs <plugin-id.pane-id> (or --plugin <id> --entrypoint <pane-id>) [--task <task-id>]");({pluginId,entrypoint}=resolvePaneQualified(positional))}await openPane(pluginId,entrypoint,flagValue(paneArgs,"--task"));return}printUsage(process.stderr),process.exit(2);return}case"action":{let[sub,...actionArgs]=args;if(sub==="list"){listActions(flagValue(actionArgs,"--plugin"));return}if(sub==="invoke"){if(!actionArgs[0])throw new PluginCliError("action invoke needs <plugin-id.action-id>");invokeAction(actionArgs[0],actionArgs.slice(1));return}printUsage(process.stderr),process.exit(2);return}default:{let isHelp=command===void 0||command==="help"||command==="--help"||command==="-h";if(printUsage(isHelp?process.stdout:process.stderr),!isHelp)process.exit(2);return}}}catch(err){if(err instanceof PluginCliError)console.error(`${CLI_NAME} plugin: ${err.message}
|
|
5
5
|
Run ${CLI_NAME} plugin --help for usage.`),process.exit(1);console.error(`${CLI_NAME} plugin: ${errorMessage(err)}
|
|
6
6
|
${failureHint(err,CLI_NAME)}`),process.exit(1)}}export{runPluginSubcommand};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{findVerb}from"./chunk-
|
|
2
|
+
import{findVerb}from"./chunk-zs8a30dk.js";import{VERB_GROUP_IDS}from"./chunk-pcp1q3fc.js";import{loadStateFile,updateStateFile}from"./chunk-nks2q6d9.js";var INBOUND_KEY="machineInbound",INBOUND_CLASSES=[...VERB_GROUP_IDS,"land","credentials"],LAND_VERBS=new Set(["land","publish"]),CREDENTIAL_VERBS={"github-login":!0,"github-logout":!0,"github-sync":!0,"github-apply":!0};function inboundClassOf(verb){if(LAND_VERBS.has(verb))return"land";if(Object.hasOwn(CREDENTIAL_VERBS,verb))return"credentials";return findVerb(verb)?.group??null}function deniedClasses(state=loadStateFile()){let raw=state[INBOUND_KEY],deny=raw&&typeof raw==="object"?raw.deny:void 0;return Array.isArray(deny)?deny.filter((c)=>typeof c==="string"):[]}function inboundRefusal(verb,state){let cls=inboundClassOf(verb);return cls&&deniedClasses(state).includes(cls)?cls:null}function setInbound(cls,allow){let next=[];return updateStateFile((state)=>{let current=new Set(deniedClasses(state));if(allow)current.delete(cls);else current.add(cls);return next=[...current].sort(),state[INBOUND_KEY]={deny:next},!0}),next}
|
|
3
3
|
export{INBOUND_KEY,INBOUND_CLASSES,inboundClassOf,deniedClasses,inboundRefusal,setInbound};
|
|
@@ -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-vh82t8c3.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,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{ROVE_PRODUCT_NAME}from"./chunk-4ctx6hst.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{webServiceCommand}=await import("./chunk-
|
|
2
|
+
import{ROVE_PRODUCT_NAME}from"./chunk-4ctx6hst.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{webServiceCommand}=await import("./chunk-ppn8jgza.js");try{if(await webServiceCommand(args))return}catch(err){console.error(`${ROVE_PRODUCT_NAME} --web: ${err instanceof Error?err.message:String(err)}`),process.exit(2)}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-qzc40xdm.js");await runBridge(args,{name:`${ROVE_PRODUCT_NAME} --web`,web:{root}})}export{runWebSubcommand};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{connectIfRunning}from"./chunk-k7tdg6kb.js";import"./chunk-1pmzr8kr.js";import"./chunk-e5jxbd98.js";import"./chunk-84q9hv7m.js";import"./chunk-96kvwzj8.js";import"./chunk-y8hjgmn0.js";import"./chunk-pn5ygqn6.js";import"./chunk-tw25g9g5.js";import"./chunk-yt15y085.js";import"./chunk-2z2jwetd.js";import"./chunk-g6wb8p4p.js";import"./chunk-nc46gddg.js";import{__require}from"./chunk-91sykzqq.js";async function openLocalOrchestrator(){let{TaskIndexStore}=await import("./chunk-
|
|
2
|
+
import{connectIfRunning}from"./chunk-k7tdg6kb.js";import"./chunk-1pmzr8kr.js";import"./chunk-e5jxbd98.js";import"./chunk-84q9hv7m.js";import"./chunk-96kvwzj8.js";import"./chunk-y8hjgmn0.js";import"./chunk-pn5ygqn6.js";import"./chunk-tw25g9g5.js";import"./chunk-yt15y085.js";import"./chunk-2z2jwetd.js";import"./chunk-g6wb8p4p.js";import"./chunk-nc46gddg.js";import{__require}from"./chunk-91sykzqq.js";async function openLocalOrchestrator(){let{TaskIndexStore}=await import("./chunk-vh82t8c3.js"),{GitWorktreeManager}=await import("./chunk-3xjenrkd.js"),{Orchestrator}=await import("./chunk-nw1qpmgp.js"),store=new TaskIndexStore;return await store.load(),new Orchestrator({store,worktrees:new GitWorktreeManager})}async function withDaemonOrLocal(bridge){let client=await connectIfRunning();if(client)try{return await bridge.daemon(client)}finally{client.close()}let orch=await openLocalOrchestrator();return bridge.local(orch)}export{withDaemonOrLocal,openLocalOrchestrator};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{detectLegacyInstalls,isRovePluginEnabled,migrationHint}from"./chunk-
|
|
2
|
+
import{detectLegacyInstalls,isRovePluginEnabled,migrationHint}from"./chunk-b43gbrar.js";import"./chunk-7dy9dtnd.js";import"./chunk-6hjt5an9.js";import"./chunk-ptyqj15s.js";import"./chunk-xdmamqy7.js";import"./chunk-m74qxqw0.js";import"./chunk-sckqk79z.js";import"./chunk-y8hjgmn0.js";import"./chunk-w2czjjxy.js";import"./chunk-8q0nmdh3.js";import"./chunk-pn5ygqn6.js";import"./chunk-a6z2ggxd.js";import"./chunk-8rxg12aj.js";import"./chunk-n835vmw4.js";import"./chunk-tw25g9g5.js";import"./chunk-yt15y085.js";import"./chunk-2z2jwetd.js";import"./chunk-pzbcbmm4.js";import"./chunk-4ctx6hst.js";import"./chunk-g6wb8p4p.js";import"./chunk-nc46gddg.js";import"./chunk-91sykzqq.js";export{migrationHint,isRovePluginEnabled,detectLegacyInstalls};
|