@sma1lboy/rove 0.9.276 → 0.9.277-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/{chunk-mkfc9a09.js → chunk-0a65j1zj.js} +1 -1
- package/dist/cli/{chunk-xb3p11g0.js → chunk-0rvydb9q.js} +1 -1
- package/dist/cli/chunk-1g6vhgfe.js +14 -0
- package/dist/cli/{chunk-eq7vey2j.js → chunk-1vxtd8rh.js} +2 -2
- package/dist/cli/chunk-1wwqf6kx.js +3 -0
- package/dist/cli/{chunk-1jjqk7sq.js → chunk-2kbzb24j.js} +1 -1
- package/dist/cli/chunk-2kt0mfvf.js +2 -0
- package/dist/cli/{chunk-mz1ffkqb.js → chunk-2vph030z.js} +3 -3
- package/dist/cli/{chunk-nr7e3e82.js → chunk-2y70y8na.js} +1 -1
- package/dist/cli/{chunk-jckx79gk.js → chunk-36eyrv4r.js} +3 -3
- package/dist/cli/chunk-37fas9aj.js +2 -0
- package/dist/cli/chunk-3dhv5n19.js +2 -0
- package/dist/cli/{chunk-zkp6nty3.js → chunk-3x5g06mw.js} +1 -1
- package/dist/cli/{chunk-c6fy8xew.js → chunk-3y0z478f.js} +1 -1
- package/dist/cli/{chunk-91tcwxph.js → chunk-4w4tpsqx.js} +1 -1
- package/dist/cli/chunk-5apxck3d.js +97 -0
- package/dist/cli/chunk-5vrg6h71.js +3 -0
- package/dist/cli/{chunk-k1pwp155.js → chunk-5xpvd182.js} +1 -1
- package/dist/cli/{chunk-8dd60adw.js → chunk-5yh5trgy.js} +1 -1
- package/dist/cli/{chunk-r7ntkd6y.js → chunk-61cn88e7.js} +1 -1
- package/dist/cli/{chunk-e3cd4qd2.js → chunk-671ak750.js} +2 -2
- package/dist/cli/{chunk-82apkcrk.js → chunk-676f3tva.js} +1 -1
- package/dist/cli/chunk-6hcyvg0m.js +3 -0
- package/dist/cli/{chunk-h2gznz46.js → chunk-6mg5zp8y.js} +1 -1
- package/dist/cli/chunk-6q4br0pt.js +2 -0
- package/dist/cli/chunk-6wfhq8xd.js +4 -0
- package/dist/cli/{chunk-3xkhcfet.js → chunk-748656h7.js} +3 -3
- package/dist/cli/{chunk-2kqxz9a4.js → chunk-7bakcyes.js} +1 -1
- package/dist/cli/{chunk-yk9b8zgn.js → chunk-7kgcy89w.js} +1 -1
- package/dist/cli/{chunk-e3t1zbv1.js → chunk-8qkyd589.js} +1 -1
- package/dist/cli/chunk-9ckvdy0j.js +3 -0
- package/dist/cli/{chunk-5e9y8aw5.js → chunk-9fdy8vne.js} +1 -1
- package/dist/cli/chunk-9x2xd1rz.js +2 -0
- package/dist/cli/{chunk-je80r59s.js → chunk-9zswhjkv.js} +1 -1
- package/dist/cli/{chunk-c7mz2aq0.js → chunk-aq4j8ar4.js} +1 -1
- package/dist/cli/{chunk-dt676ks9.js → chunk-aqwckba5.js} +1 -1
- package/dist/cli/chunk-atg13xab.js +3 -0
- package/dist/cli/{chunk-wvqn1t55.js → chunk-bagwgxsg.js} +1 -1
- package/dist/cli/{chunk-syn0tfwy.js → chunk-bcyex84w.js} +1 -1
- package/dist/cli/chunk-bv050ssb.js +8 -0
- package/dist/cli/chunk-bykqhbvy.js +2 -0
- package/dist/cli/{chunk-81thm1eb.js → chunk-ca4x8s96.js} +3 -3
- package/dist/cli/{chunk-syfs63r2.js → chunk-cakyme4s.js} +1 -1
- package/dist/cli/{chunk-63cwjceg.js → chunk-ccmke5sx.js} +1 -1
- package/dist/cli/{chunk-5nvg3ek8.js → chunk-cf3vpsm5.js} +1 -1
- package/dist/cli/{chunk-zat16a83.js → chunk-d552cvb2.js} +1 -1
- package/dist/cli/{chunk-awh7np6x.js → chunk-dsdtq087.js} +1 -1
- package/dist/cli/{chunk-d0hpes59.js → chunk-e58kj4gm.js} +1 -1
- package/dist/cli/chunk-ee314raa.js +2 -0
- package/dist/cli/{chunk-f76gzvq3.js → chunk-fgtc1xq9.js} +1 -1
- package/dist/cli/{chunk-h7vwn62z.js → chunk-fq2pefc5.js} +1 -1
- package/dist/cli/{chunk-4117kgmx.js → chunk-g4p5znv1.js} +1 -1
- package/dist/cli/{chunk-1ca2j9w6.js → chunk-g9xknhjq.js} +1 -1
- package/dist/cli/chunk-gbd5j3dv.js +2 -0
- package/dist/cli/{chunk-4xvmrg86.js → chunk-ggjmcqpt.js} +1 -1
- package/dist/cli/chunk-hv79ys32.js +1 -1
- package/dist/cli/chunk-hz1x3hak.js +3 -0
- package/dist/cli/{chunk-h64rsbrx.js → chunk-hzz020xx.js} +1 -1
- package/dist/cli/{chunk-ma21srvx.js → chunk-j1qy79fd.js} +1 -1
- package/dist/cli/chunk-j9tsdn1d.js +2 -0
- package/dist/cli/chunk-jejmt4k0.js +140 -0
- package/dist/cli/chunk-jj5f4n51.js +1 -1
- package/dist/cli/{chunk-x3n4y5sp.js → chunk-k225696b.js} +1 -1
- package/dist/cli/{chunk-d7xbm9jp.js → chunk-kag7cfbr.js} +1 -1
- package/dist/cli/{chunk-283vd9h7.js → chunk-kdnk8m5j.js} +1 -1
- package/dist/cli/{chunk-xd93fm1k.js → chunk-kxp04jnp.js} +1 -1
- package/dist/cli/chunk-m4z6kepz.js +3 -0
- package/dist/cli/{chunk-372g44dg.js → chunk-mjyhy152.js} +1 -1
- package/dist/cli/chunk-mqvkd2g1.js +2 -0
- package/dist/cli/{chunk-t4qr9sv4.js → chunk-mvtqstte.js} +1 -1
- package/dist/cli/{chunk-m2a19yt4.js → chunk-mxx0y791.js} +1 -1
- package/dist/cli/{chunk-d9643dwf.js → chunk-n2zgej1a.js} +1 -1
- package/dist/cli/{chunk-xn2f56tg.js → chunk-n94vzkbe.js} +1 -1
- package/dist/cli/{chunk-9gh8kgjs.js → chunk-njncqdwf.js} +1 -1
- package/dist/cli/{chunk-t52gzaeb.js → chunk-nw092jak.js} +1 -1
- package/dist/cli/{chunk-gafkp74h.js → chunk-pfagrkt6.js} +1 -1
- package/dist/cli/{chunk-511103e8.js → chunk-pnrftncm.js} +1 -1
- package/dist/cli/{chunk-9c3brkb3.js → chunk-pqr6td4z.js} +1 -1
- package/dist/cli/{chunk-tvdrvgen.js → chunk-qcjkactr.js} +1 -1
- package/dist/cli/{chunk-v1r83m3n.js → chunk-qs359899.js} +1 -1
- package/dist/cli/{chunk-n6marmjn.js → chunk-qzzmd63x.js} +2 -3
- package/dist/cli/{chunk-fn7ffyam.js → chunk-r2bb8b11.js} +1 -1
- package/dist/cli/chunk-rjy900p4.js +4 -0
- package/dist/cli/{chunk-b035pej7.js → chunk-rmsdybs3.js} +1 -1
- package/dist/cli/{chunk-6mtfafaw.js → chunk-rztqccs3.js} +1 -1
- package/dist/cli/chunk-s1308b3d.js +63 -0
- package/dist/cli/{chunk-ne6x6g2c.js → chunk-se00fc8v.js} +1 -1
- package/dist/cli/{chunk-zcrs4sm2.js → chunk-shtm72c0.js} +1 -1
- package/dist/cli/{chunk-gq57he03.js → chunk-t9vjj8sy.js} +1 -1
- package/dist/cli/{chunk-0d7517kk.js → chunk-ta1p2nwa.js} +1 -1
- package/dist/cli/chunk-teh40faw.js +1 -1
- package/dist/cli/{chunk-eyvw70yb.js → chunk-tnatqcy7.js} +1 -1
- package/dist/cli/{chunk-mq88bvj6.js → chunk-tt58819p.js} +1 -1
- package/dist/cli/{chunk-pdq3ya2e.js → chunk-tw9tfs1d.js} +2 -2
- package/dist/cli/chunk-v6dz59gy.js +2 -0
- package/dist/cli/chunk-v6v272b3.js +3 -0
- package/dist/cli/{chunk-hhcmzs67.js → chunk-vkv1v3xn.js} +6 -28
- package/dist/cli/chunk-vkz6kkmm.js +24 -0
- package/dist/cli/chunk-vp29jgbt.js +4 -0
- package/dist/cli/chunk-vpsarakj.js +2 -0
- package/dist/cli/{chunk-745pg3xm.js → chunk-vr2r2ncm.js} +1 -1
- package/dist/cli/{chunk-3y9xzbqh.js → chunk-vvqwgcge.js} +1 -1
- package/dist/cli/{chunk-m73x5nry.js → chunk-vwpf55cr.js} +2 -2
- package/dist/cli/{chunk-vz0f8e8q.js → chunk-vytrhm50.js} +1 -1
- package/dist/cli/{chunk-c63vgbkw.js → chunk-w7v71t7e.js} +1 -1
- package/dist/cli/{chunk-hcvp84b3.js → chunk-wfgrn8p2.js} +1 -1
- package/dist/cli/chunk-wzss4pzh.js +3 -0
- package/dist/cli/chunk-x1ghdmp1.js +1 -1
- package/dist/cli/chunk-x1jxxmtc.js +3 -0
- package/dist/cli/{chunk-d7f022eb.js → chunk-x83xbzjd.js} +3 -3
- package/dist/cli/{chunk-22rgewg0.js → chunk-x85rcep5.js} +1 -1
- package/dist/cli/{chunk-j9b285x6.js → chunk-x89zw7br.js} +1 -1
- package/dist/cli/{chunk-ccwe9n56.js → chunk-xg42e2ff.js} +1 -1
- package/dist/cli/{chunk-jfcn77n9.js → chunk-xte4phd1.js} +1 -1
- package/dist/cli/chunk-y8b2p44q.js +1 -1
- package/dist/cli/chunk-ys6v36ph.js +2 -0
- package/dist/cli/{chunk-n8t4y0bj.js → chunk-yzdrhytj.js} +1 -1
- package/dist/cli/{chunk-qna1s1r4.js → chunk-z3qz6enf.js} +1 -1
- package/dist/cli/chunk-z3wrbtcq.js +22 -0
- package/dist/cli/{chunk-cfzg8q3e.js → chunk-z43e08kw.js} +1 -1
- package/dist/cli/{chunk-ehm9abge.js → chunk-zpwvjt14.js} +7 -5
- package/dist/cli/{chunk-k235z3ct.js → chunk-zrf93zrx.js} +1 -1
- package/dist/cli/index.js +9 -12
- package/dist/cli/pty-host-node.mjs +1 -3
- package/dist/cli/rove-run.js +1 -1
- package/dist/completions/rove.bash +1 -1
- package/dist/completions/rove.fish +1 -1
- package/dist/completions/rove.zsh +1 -1
- package/dist/skills/rove/SKILL.md +4 -3
- package/dist/skills/rove/references/api-flags.md +12 -5
- package/dist/web/assets/index-BVQbpUea.css +1 -0
- package/dist/web/assets/index-Cn_7vMHX.js +152 -0
- package/dist/web/assets/jetbrains-mono-cyrillic-500-normal-DJqRU3vO.woff +0 -0
- package/dist/web/assets/jetbrains-mono-cyrillic-500-normal-DmUKJPL_.woff2 +0 -0
- package/dist/web/assets/jetbrains-mono-cyrillic-600-normal-8K4wrrwR.woff +0 -0
- package/dist/web/assets/jetbrains-mono-cyrillic-600-normal-EVf6-Yzo.woff2 +0 -0
- package/dist/web/assets/jetbrains-mono-greek-500-normal-D7SFKleX.woff +0 -0
- package/dist/web/assets/jetbrains-mono-greek-500-normal-JpySY46c.woff2 +0 -0
- package/dist/web/assets/jetbrains-mono-greek-600-normal-H7WoG9Et.woff2 +0 -0
- package/dist/web/assets/jetbrains-mono-greek-600-normal-mc2nkWzM.woff +0 -0
- package/dist/web/assets/jetbrains-mono-latin-500-normal-BWZEU5yA.woff2 +0 -0
- package/dist/web/assets/jetbrains-mono-latin-500-normal-CJOVTJB7.woff +0 -0
- package/dist/web/assets/jetbrains-mono-latin-600-normal-BfsvjouI.woff +0 -0
- package/dist/web/assets/jetbrains-mono-latin-600-normal-C8RAYTDA.woff2 +0 -0
- package/dist/web/assets/jetbrains-mono-latin-ext-500-normal-Cut-4mMH.woff2 +0 -0
- package/dist/web/assets/jetbrains-mono-latin-ext-500-normal-ckzbgY84.woff +0 -0
- package/dist/web/assets/jetbrains-mono-latin-ext-600-normal-BfB_LPfz.woff2 +0 -0
- package/dist/web/assets/jetbrains-mono-latin-ext-600-normal-DObL3zCW.woff +0 -0
- package/dist/web/assets/jetbrains-mono-vietnamese-500-normal-DNRqzVM1.woff +0 -0
- package/dist/web/assets/jetbrains-mono-vietnamese-600-normal-OWROknRo.woff +0 -0
- package/dist/web/index.html +2 -2
- package/dist/web/relay/index.html +34 -0
- package/dist/web-ui/assets/{harness-pEyVtWV4.js → harness-C7ciHx2w.js} +2 -2
- package/dist/web-ui/assets/{index-Dyg-qcgB.js → index-B1FLht5L.js} +2 -2
- package/dist/web-ui/assets/{index-Bsn8NuKa.css → index-BDIkPexK.css} +1 -1
- package/dist/web-ui/index.html +2 -2
- package/package.json +1 -1
- package/dist/cli/chunk-1eef3z5v.js +0 -3
- package/dist/cli/chunk-1n03wzx4.js +0 -3
- package/dist/cli/chunk-387w0db1.js +0 -2
- package/dist/cli/chunk-4a05fgdh.js +0 -2
- package/dist/cli/chunk-59p3h5e9.js +0 -2
- package/dist/cli/chunk-6xga1a2d.js +0 -3
- package/dist/cli/chunk-84pvn784.js +0 -2
- package/dist/cli/chunk-883fyezq.js +0 -3
- package/dist/cli/chunk-a4r45qdn.js +0 -3
- package/dist/cli/chunk-brgfsm5v.js +0 -2
- package/dist/cli/chunk-bw98jn7g.js +0 -18
- package/dist/cli/chunk-cbrt4s7m.js +0 -3
- package/dist/cli/chunk-d9e4ssy7.js +0 -12
- package/dist/cli/chunk-dgx02565.js +0 -3
- package/dist/cli/chunk-g4dtqbrj.js +0 -2
- package/dist/cli/chunk-gctqthxq.js +0 -97
- package/dist/cli/chunk-hmjg1qh3.js +0 -2
- package/dist/cli/chunk-jn10xeft.js +0 -2
- package/dist/cli/chunk-nbpq1tkx.js +0 -98
- package/dist/cli/chunk-ns35rdyk.js +0 -3
- package/dist/cli/chunk-pap7k3b4.js +0 -3
- package/dist/cli/chunk-r7kmn4js.js +0 -2
- package/dist/cli/chunk-tz373e5w.js +0 -3
- package/dist/cli/chunk-vp171as9.js +0 -65
- package/dist/cli/chunk-vtcr71fs.js +0 -8
- package/dist/cli/chunk-w7v4jzwy.js +0 -3
- package/dist/cli/chunk-xv3217yv.js +0 -2
- package/dist/cli/chunk-yhytkwpv.js +0 -2
- package/dist/web/assets/index-C5t3gibI.css +0 -1
- package/dist/web/assets/index-Djp7M6r8.js +0 -122
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{detectLegacyInstalls,isRovePluginEnabled,migrationHint}from"./chunk-
|
|
2
|
+
import{detectLegacyInstalls,isRovePluginEnabled,migrationHint}from"./chunk-7bakcyes.js";import"./chunk-8qkyd589.js";import"./chunk-7kysxgbq.js";import"./chunk-hz1x3hak.js";import"./chunk-x1jxxmtc.js";import"./chunk-xy8be792.js";import"./chunk-h2m7em1e.js";import"./chunk-7ghwdjdc.js";import"./chunk-8t7qbr1e.js";import"./chunk-bejhca6z.js";import"./chunk-br8r72bf.js";import"./chunk-yt15y085.js";import"./chunk-z1nj22va.js";import"./chunk-zt7wfnva.js";import"./chunk-0g4wc808.js";import"./chunk-pn5ygqn6.js";import"./chunk-eqdbfgq5.js";import"./chunk-f8gg8cqh.js";import"./chunk-nc46gddg.js";import"./chunk-91sykzqq.js";export{migrationHint,isRovePluginEnabled,detectLegacyInstalls};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{formatBytes}from"./chunk-my20q579.js";import{hookConfigIssues}from"./chunk-
|
|
2
|
+
import{formatBytes}from"./chunk-my20q579.js";import{hookConfigIssues}from"./chunk-x89zw7br.js";import{applyFixes,daemonRestartFix,defaultFixRuntime,engineTabsManualFix,humanOnlyFix,killOrphansManualFix,noEngineFix,reinstallManualFix,resetManualFix,skillInstallFix,spawnHelperFix}from"./chunk-3y0z478f.js";import{inspectLegacyTmux,legacyTmuxDoctorLines}from"./chunk-gkdfct7t.js";import"./chunk-s1308b3d.js";import"./chunk-1g6vhgfe.js";import"./chunk-a4hsqj1b.js";import"./chunk-6hcyvg0m.js";import{skillOverview}from"./chunk-5vrg6h71.js";import"./chunk-tq0h3vy6.js";import"./chunk-cpgnm1xr.js";import"./chunk-r3s2t9af.js";import"./chunk-6xr1prk6.js";import{describeAccount,detectEngineStatuses,probeableEngineIds,summarizeEngines}from"./chunk-r2bb8b11.js";import"./chunk-q8ffd1pc.js";import"./chunk-4hestsjp.js";import"./chunk-qgrg9a5n.js";import"./chunk-2bgmby1d.js";import"./chunk-n0rdn2fn.js";import"./chunk-5mhvjytn.js";import"./chunk-atn06ncf.js";import"./chunk-vp29jgbt.js";import"./chunk-gq36nzg8.js";import{resolveNodeBinary}from"./chunk-z43e08kw.js";import"./chunk-w77s2df8.js";import"./chunk-mqfvzdpr.js";import{formatDaemonInfo}from"./chunk-rxqdw6s5.js";import"./chunk-atg13xab.js";import"./chunk-xfgqae9t.js";import"./chunk-j1z9kgyd.js";import"./chunk-g9ba25q5.js";import"./chunk-tn9gtf18.js";import{isStaleInstallError,resolveRoveSpawn}from"./chunk-e58kj4gm.js";import"./chunk-0a65j1zj.js";import"./chunk-bcyex84w.js";import"./chunk-vvqwgcge.js";import"./chunk-x83xbzjd.js";import"./chunk-2tfnscxk.js";import"./chunk-hzz020xx.js";import"./chunk-w7zv47mp.js";import"./chunk-2w228s7t.js";import"./chunk-etfh8f4z.js";import"./chunk-rfp0ayra.js";import"./chunk-dmzg9zdc.js";import"./chunk-40dgv828.js";import"./chunk-kg9kmwt9.js";import{CURRENT_VERSION,package_default}from"./chunk-9ckvdy0j.js";import"./chunk-zsfyj36g.js";import"./chunk-2brn8e1y.js";import"./chunk-7mwvvj46.js";import"./chunk-32j6y5d1.js";import{t}from"./chunk-mjyhy152.js";import"./chunk-wzss4pzh.js";import"./chunk-cmp64q4j.js";import{RoveDaemonClient,isForeignDaemonHome}from"./chunk-qzzmd63x.js";import"./chunk-96kvwzj8.js";import"./chunk-7bakcyes.js";import"./chunk-8qkyd589.js";import"./chunk-7kysxgbq.js";import{readableLegacyIndexPath}from"./chunk-hz1x3hak.js";import"./chunk-x1jxxmtc.js";import"./chunk-xy8be792.js";import"./chunk-h2m7em1e.js";import"./chunk-7ghwdjdc.js";import"./chunk-8t7qbr1e.js";import"./chunk-bejhca6z.js";import{readPidFile}from"./chunk-br8r72bf.js";import"./chunk-yt15y085.js";import{homeDir,kvStatePath,roveStateDir}from"./chunk-z1nj22va.js";import{ROVE_PRODUCT_NAME}from"./chunk-zt7wfnva.js";import"./chunk-0g4wc808.js";import"./chunk-pn5ygqn6.js";import{defaultDaemonLogPath,defaultDaemonPidPath,defaultDaemonSocketPath,defaultPtyHostLogPath,defaultPtyHostPidPath,defaultPtyHostSocketPath}from"./chunk-eqdbfgq5.js";import{preRenameStateDir}from"./chunk-f8gg8cqh.js";import"./chunk-nc46gddg.js";import"./chunk-pxk2c2vj.js";import{__require}from"./chunk-91sykzqq.js";import{existsSync,readFileSync as readFileSync2,statSync as statSync2}from"fs";import{join as join2}from"path";var MIN_BUN_VERSION=package_default.engines.bun.match(/\d+\.\d+\.\d+/)?.[0]??"0.0.0";function parseBunVersion(raw){return raw.trim().match(/^v?(\d+\.\d+\.\d+)/)?.[1]??null}function isBunAtLeast(raw,minimum=MIN_BUN_VERSION){let found=parseBunVersion(raw),floor=parseBunVersion(minimum);if(!found||!floor)return!0;let a=found.split(".").map(Number),b=floor.split(".").map(Number);for(let i=0;i<3;i++){let av=a[i]??0,bv=b[i]??0;if(av!==bv)return av>bv}return!0}function classifyHookChannel(input){let total=0,hooked=0;for(let tabs of Object.values(input.tabs))for(let entry of Object.values(tabs))if(total++,entry.source==="hook")hooked++;if(total===0)return{kind:"no-tabs"};if(hooked===0)return{kind:"down",totalTabs:total};return{kind:"live",hookTabs:hooked,totalTabs:total}}function hookChannelDoctorLines(verdict,input,cliName){let configLines=(input.configIssues??[]).flatMap((issue)=>[` \u26A0 hook install skipped: ${issue.file}`,` ${issue.reason} \u2014 fix the file, then relaunch Rove`]);if(verdict.kind==="no-tabs")return["hooks: \u2014 no engine tabs yet (nothing to check)",...configLines];if(verdict.kind==="live")return[`hooks: \u2713 engine hook channel live (${verdict.hookTabs}/${verdict.totalTabs} tab(s) hook-sourced)`,...configLines];let out=[`hooks: \u2717 NO hook events reaching the daemon (0/${verdict.totalTabs} tab(s) hook-sourced)`," badges fall back to a ~10s poll, so activity looks seconds late",` daemon socket: ${input.socketPath}`,...configLines];return out.push(' \u2192 compare with an engine tab\'s own path: `ps eww -p <engine-pid> | tr " " "\\n" | grep DAEMON_SOCKET_PATH`',` \u2192 restart the engine tabs (they may hold a stale socket path), or run \`${cliName} daemon restart\``,` \u2192 debug one hook directly: \`ROVE_HOOK_DEBUG=1 echo '{}' | ${cliName} hook turn-start --engine claude\``),out}import{readdirSync,statSync}from"fs";import{createRequire}from"module";import{dirname,join}from"path";function installedSpawnHelpers(){let pkg;try{pkg=dirname(createRequire(import.meta.url).resolve("node-pty/package.json"))}catch{return[]}let prebuilds=join(pkg,"prebuilds"),arches;try{arches=readdirSync(prebuilds).filter((name)=>name.startsWith("darwin-"))}catch{return[]}let helpers=[];for(let arch of arches){let path=join(prebuilds,arch,"spawn-helper");try{helpers.push({path,executable:(statSync(path).mode&64)!==0})}catch{}}return helpers}function spawnHelperDoctorLines(helpers){let broken=helpers.filter((helper)=>!helper.executable).map((helper)=>helper.path);if(helpers.length===0)return{lines:["node-pty: ? no darwin spawn-helper found next to node-pty"],broken};if(broken.length===0)return{lines:[`node-pty: \u2713 spawn-helper executable (${helpers.length} arch)`],broken};return{lines:["node-pty: \u2717 spawn-helper is not executable \u2014 every node-pty PTY spawn fails",...broken.map((path)=>` ${path}`),` \u2192 chmod 755 ${broken.join(" ")}`],broken}}import{appendFileSync,readFileSync}from"fs";var PTY_MARKER="ROVE_TERMINAL_PTY=1",run=async(argv)=>{try{let proc=Bun.spawn([...argv],{stdin:"ignore",stdout:"pipe",stderr:"ignore"}),[stdout,code]=await Promise.all([new Response(proc.stdout).text().catch(()=>""),proc.exited]);return{code,stdout}}catch{return{code:127,stdout:""}}};function parsePsRows(output){let rows=[];for(let line of output.split(`
|
|
3
3
|
`)){let parts=line.trim().split(/\s+/);if(parts.length<6)continue;let[pid,ppid,pgid]=[parts[0],parts[1],parts[2]].map((value)=>Number.parseInt(value??"",10)),rssKb=Number.parseInt(parts[4]??"",10);if(!Number.isFinite(pid)||!Number.isFinite(ppid)||!Number.isFinite(pgid)||!Number.isFinite(rssKb))continue;rows.push({pid,ppid,pgid,etime:parts[3]??"",rssKb,command:parts.slice(5).join(" ")})}return rows}function pidAlive(pid,rows){return rows.some((row)=>row.pid===pid)}function orphanCandidates(rows,selfPgid,liveSessionPids){return rows.filter((row)=>row.ppid===1&&row.pgid!==selfPgid&&!liveSessionPids.has(row.pgid)&&!pidAlive(row.pgid,rows))}async function markedPids(pids,deps={}){let runProbe=deps.run??run,readEnviron=deps.readEnviron??((pid)=>readFileSync(`/proc/${pid}/environ`,"utf8")),marked=new Set;if(pids.length===0)return{marked,failed:null};if((deps.platform??process.platform)==="linux"){let refused=null;for(let pid of pids)try{if(readEnviron(pid).split("\x00").includes(PTY_MARKER))marked.add(pid)}catch(err){let code=err.code;if(code!=="ENOENT"&&code!=="ESRCH")refused??=`/proc/${pid}/environ: ${code??"unreadable"}`}return{marked,failed:refused}}let result=await runProbe(["ps","eww","-o","pid=,command=","-p",pids.join(",")]);if(result.code!==0)return{marked,failed:`ps eww exited ${result.code}`};let marker=new RegExp(`(^|\\s)${PTY_MARKER}(\\s|$)`);for(let line of result.stdout.split(`
|
|
4
4
|
`)){let pid=Number.parseInt(line.trim().split(/\s+/)[0]??"",10);if(Number.isFinite(pid)&&marker.test(line))marked.add(pid)}return{marked,failed:null}}async function ownPgid(runProbe){let result=await runProbe(["ps","-o","pgid=","-p",String(process.pid)]),pgid=Number.parseInt(result.stdout.trim(),10);return Number.isFinite(pgid)?pgid:-1}async function collectOrphans(liveSessionPids,deps={}){let runProbe=deps.run??run;if((deps.platform??process.platform)==="win32")return{orphans:[],error:null};let ps=await runProbe(["ps","-A","-o","pid=,ppid=,pgid=,etime=,rss=,command="]);if(ps.code!==0)return{orphans:[],error:`could not read the process table \u2014 ps exited ${ps.code}`};let rows=parsePsRows(ps.stdout),candidates=orphanCandidates(rows,await ownPgid(runProbe),liveSessionPids),{marked,failed}=await markedPids(candidates.map((row)=>row.pid),deps);if(failed)return{orphans:[],error:`could not read process environments \u2014 ${failed}`};return{orphans:candidates.filter((row)=>marked.has(row.pid)),error:null}}function formatMb(rssKb){return`${(rssKb/1024).toFixed(0)} MB`}function orphanDoctorLines(orphans,error,cliName,killing=!1){if(error)return[`orphans: \u2717 ${error}`];if(orphans.length===0)return["orphans: \u2713 none \u2014 no processes left behind by a dead PTY session"];let totalMb=orphans.reduce((sum,row)=>sum+row.rssKb,0)/1024,lines=[`orphans: \u26A0 ${orphans.length} process(es) outlived the PTY session that spawned them (${totalMb.toFixed(0)} MB RSS)`," each is reparented to init, carries Rove's PTY marker, and its process"," group leader is gone \u2014 no live task owns them"];for(let row of[...orphans].sort((a,b)=>b.rssKb-a.rssKb))lines.push(` pid ${row.pid} (group ${row.pgid}) up ${row.etime}, ${formatMb(row.rssKb)}: ${row.command.slice(0,90)}`);if(!killing)lines.push(` \u2192 \`${cliName} doctor --kill-orphans\` ends those process groups (SIGTERM, then SIGKILL)`," read the list first: something you backgrounded from a Rove terminal and then"," closed the tab on looks exactly like a leak, and doctor cannot tell them apart");return lines}var GROUP_EXIT_GRACE_MS=2000,GROUP_POLL_MS=100;function logOrphanKill(pgid,signal,logPath=defaultDaemonLogPath()){try{appendFileSync(logPath,formatDaemonInfo("doctor-kill-orphans",`${signal} process group ${pgid}`))}catch{}}function groupAlive(pgid){try{return process.kill(-pgid,0),!0}catch(err){return err.code!=="ESRCH"}}async function killOrphanGroups(orphans){let groups=[...new Set(orphans.map((row)=>row.pgid))];for(let pgid of groups)try{process.kill(-pgid,"SIGTERM"),logOrphanKill(pgid,"SIGTERM")}catch{}let deadline=Date.now()+GROUP_EXIT_GRACE_MS,survivors=groups.filter(groupAlive);while(survivors.length>0&&Date.now()<deadline)await new Promise((resolve)=>setTimeout(resolve,GROUP_POLL_MS)),survivors=survivors.filter(groupAlive);for(let pgid of survivors)try{process.kill(-pgid,"SIGKILL"),logOrphanKill(pgid,"SIGKILL")}catch{}return await new Promise((resolve)=>setTimeout(resolve,GROUP_POLL_MS)),{groups,survivors:survivors.filter(groupAlive)}}function multiplexerLabel(env){if(env.TMUX)return"tmux";if(env.ZELLIJ)return"zellij";if(env.STY)return"screen";return"no"}function terminalEnvLines(env){let show=(v)=>v&&v.length>0?v:"(unset)",program=env.TERM_PROGRAM?`${env.TERM_PROGRAM}${env.TERM_PROGRAM_VERSION?` v${env.TERM_PROGRAM_VERSION}`:""}`:"(unset)";return[`terminal: TERM=${show(env.TERM)} TERM_PROGRAM=${program} COLORTERM=${show(env.COLORTERM)}`,` running inside a multiplexer: ${multiplexerLabel(env)}`]}function parseKittyProbeReply(data){let kitty=data.match(/\x1b\[\?(\d+)u/);if(kitty?.[1]!==void 0)return{kind:"supported",flags:Number.parseInt(kitty[1],10)};if(/\x1b\[\?[\d;]*c/.test(data))return{kind:"unsupported"};return null}function kittyProbeLine(result){switch(result.kind){case"supported":return` kitty keyboard protocol: \u2713 answered (flags=${result.flags})`;case"unsupported":return[" kitty keyboard protocol: \u2717 not supported \u2014 legacy key path"," (ctrl+h/ctrl+j arrive as C0 backspace/linefeed bytes; the"," split chords ctrl+\\ and ctrl+= cannot be encoded at all)"].join(`
|
|
5
5
|
`);case"no-response":return" kitty keyboard protocol: ? no reply (terminal ignored both the kitty query and DA1)";case"skipped":return` kitty keyboard protocol: skipped (${result.reason})`}}async function probeKittyKeyboard(timeoutMs=300){let stdin=process.stdin;if(!stdin.isTTY||!process.stdout.isTTY)return{kind:"skipped",reason:"not an interactive terminal"};let wasRaw=stdin.isRaw===!0,buffer="";return await new Promise((resolve)=>{let done=!1,finish=(result)=>{if(done)return;if(done=!0,clearTimeout(timer),stdin.off("data",onData),stdin.pause(),!wasRaw)stdin.setRawMode(!1);resolve(result)},onData=(chunk)=>{buffer+=chunk.toString("latin1");let decided=parseKittyProbeReply(buffer);if(decided)finish(decided)},timer=setTimeout(()=>finish({kind:"no-response"}),timeoutMs);stdin.setRawMode(!0),stdin.resume(),stdin.on("data",onData),process.stdout.write("\x1B[?u\x1B[c")})}async function terminalDoctorLines(){return[...terminalEnvLines(process.env),kittyProbeLine(await probeKittyKeyboard())]}async function probeGit(){try{let proc=Bun.spawn(["git","--version"],{stdin:"ignore",stdout:"pipe",stderr:"ignore"}),text=(await new Response(proc.stdout).text()).trim();if(await proc.exited===0&&text)return{line:`git: \u2713 ${text}`,found:!0}}catch{}return{line:"git: \u2717 not found on PATH",found:!1}}function binaryLabel(binary){return binary.found?`\u2713 ${binary.path}`:`\u2717 ${binary.error}`}async function probeEngines(){let statuses=await detectEngineStatuses(await probeableEngineIds()),lines=["engines:"];for(let status of statuses){let account=describeAccount(status.account),name=`${status.vendor.padEnd(7)} `;if(lines.push(` ${name}${binaryLabel(status.binary)}${status.binary.found?` \u2014 ${account}`:""}`),status.accountError)lines.push(` \u26A0 ${status.accountError}`)}let{usable,signedOut}=summarizeEngines(statuses);return{lines,anyUsable:usable.length>0,signedOut}}var CLI_NAME=ROVE_PRODUCT_NAME;function isProcessAlive(pid){try{return process.kill(pid,0),!0}catch(err){return err.code==="EPERM"}}async function requestIfReachable(socketPath,name){let client=new RoveDaemonClient(socketPath);try{return await client.request(name,{})}catch{return null}finally{client.close()}}function fmtDuration(ms){let seconds=Math.floor(ms/1000);if(seconds<60)return`${seconds}s`;let minutes=Math.floor(seconds/60);if(minutes<60)return`${minutes}m ${seconds%60}s`;return`${Math.floor(minutes/60)}h ${minutes%60}m`}function describeFile(path){try{let stat=statSync2(path);return`present (${formatBytes(stat.size)}, modified ${stat.mtime.toISOString()})`}catch{return"absent"}}function taskCount(path){try{let parsed=JSON.parse(readFileSync2(path,"utf8"));return Array.isArray(parsed.tasks)?parsed.tasks.length:null}catch{return null}}function tailFile(path,count){try{return readFileSync2(path,"utf8").split(`
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{machineTasks}from"./chunk-ta1p2nwa.js";import{dedupeMachines,listMachines}from"./chunk-vytrhm50.js";import"./chunk-vp29jgbt.js";import"./chunk-gq36nzg8.js";import"./chunk-sq6zj3fb.js";import"./chunk-tw9tfs1d.js";import"./chunk-61cn88e7.js";import"./chunk-atg13xab.js";import"./chunk-r5j8fycq.js";import"./chunk-xfgqae9t.js";import"./chunk-j1z9kgyd.js";import"./chunk-g9ba25q5.js";import"./chunk-ggnq2vvk.js";import"./chunk-hpay0ax8.js";import"./chunk-catrr0z3.js";import"./chunk-mdc7b01e.js";import"./chunk-tn9gtf18.js";import"./chunk-895yqjjz.js";import"./chunk-sak1tphp.js";import"./chunk-y1xnjx8x.js";import"./chunk-e58kj4gm.js";import"./chunk-0a65j1zj.js";import"./chunk-bcyex84w.js";import"./chunk-vvqwgcge.js";import"./chunk-x83xbzjd.js";import"./chunk-2tfnscxk.js";import"./chunk-hzz020xx.js";import"./chunk-w7zv47mp.js";import"./chunk-rfp0ayra.js";import"./chunk-40dgv828.js";import"./chunk-zsfyj36g.js";import"./chunk-2r1fgng9.js";import"./chunk-2brn8e1y.js";import"./chunk-7mwvvj46.js";import"./chunk-32j6y5d1.js";import"./chunk-mjyhy152.js";import"./chunk-wzss4pzh.js";import"./chunk-cmp64q4j.js";import"./chunk-qzzmd63x.js";import"./chunk-96kvwzj8.js";import"./chunk-7bakcyes.js";import"./chunk-8qkyd589.js";import"./chunk-7kysxgbq.js";import"./chunk-hz1x3hak.js";import"./chunk-x1jxxmtc.js";import"./chunk-xy8be792.js";import"./chunk-h2m7em1e.js";import"./chunk-7ghwdjdc.js";import"./chunk-8t7qbr1e.js";import"./chunk-bejhca6z.js";import"./chunk-br8r72bf.js";import"./chunk-yt15y085.js";import"./chunk-z1nj22va.js";import"./chunk-zt7wfnva.js";import"./chunk-0g4wc808.js";import"./chunk-pn5ygqn6.js";import"./chunk-eqdbfgq5.js";import"./chunk-f8gg8cqh.js";import"./chunk-nc46gddg.js";import"./chunk-pxk2c2vj.js";import"./chunk-91sykzqq.js";async function mergeTaskList(local){let machines=dedupeMachines(listMachines());if(machines.length===0)return local;let tasks=(local.tasks??[]).map((task)=>({...task,origin:{machineId:"local",hostLabel:"local"}}));for(let entry of machines){let remote=await machineTasks(entry);if(!remote)continue;let hostLabel=entry.alias;for(let task of remote)tasks.push({...task,origin:{machineId:entry.alias,hostLabel}})}return{tasks}}export{mergeTaskList};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{ThemeInstallError,isThemeName,parseTheme,writeUserTheme}from"./chunk-
|
|
2
|
+
import{ThemeInstallError,isThemeName,parseTheme,writeUserTheme}from"./chunk-wfgrn8p2.js";import{BUNDLED_THEME_JSONS,userThemesDir}from"./chunk-kxp04jnp.js";import{expandTilde}from"./chunk-2r1fgng9.js";import{errorMessage}from"./chunk-2brn8e1y.js";import{SUBCOMMAND_VERBS}from"./chunk-qqr4tfhk.js";import"./chunk-7ghwdjdc.js";import"./chunk-z1nj22va.js";import{ROVE_PRODUCT_NAME}from"./chunk-zt7wfnva.js";import"./chunk-pn5ygqn6.js";import"./chunk-f8gg8cqh.js";import"./chunk-nc46gddg.js";import"./chunk-91sykzqq.js";import{existsSync,readFileSync,readdirSync,unlinkSync}from"fs";import{basename,join,resolve}from"path";var CLI_NAME=ROVE_PRODUCT_NAME,THEME_VERB_ALIASES={ls:"list",rm:"remove"},BUNDLED_NAMES=Object.keys(BUNDLED_THEME_JSONS);function fail(message){process.stderr.write(`${CLI_NAME} theme: ${message}
|
|
3
3
|
Run ${CLI_NAME} theme --help for valid names and options.
|
|
4
4
|
`),process.exit(1)}function failUsage(message){process.stderr.write(`${CLI_NAME} theme: ${message}
|
|
5
5
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{addRemoteRepo,addSavedRepo,backfillSavedReposFromProjects,getCustomEngineIds,getDisabledEngineIds,getPersistedString,getPersistedValue,getRemoteRepoConfig,getRemoteRepos,getRepoInitOverride,getSavedRepos,isGitRepo,isRemoteProjectsEnabled,isRemoteRepoKey,isValidBranchName,normalizeSavedRepos,remoteRepoKey,removeSavedRepo,resolveMainRepoRoot,resolveRepoRoot,setPersistedString,setRepoInitOverride,statePath}from"./chunk-rfp0ayra.js";import"./chunk-40dgv828.js";import"./chunk-7mwvvj46.js";import"./chunk-32j6y5d1.js";import"./chunk-bejhca6z.js";import"./chunk-
|
|
2
|
+
import{addRemoteRepo,addSavedRepo,backfillSavedReposFromProjects,getCustomEngineIds,getDisabledEngineIds,getPersistedString,getPersistedValue,getRemoteRepoConfig,getRemoteRepos,getRepoInitOverride,getSavedRepos,isGitRepo,isRemoteProjectsEnabled,isRemoteRepoKey,isValidBranchName,normalizeSavedRepos,remoteRepoKey,removeSavedRepo,resolveMainRepoRoot,resolveRepoRoot,setPersistedString,setRepoInitOverride,statePath}from"./chunk-rfp0ayra.js";import"./chunk-40dgv828.js";import"./chunk-7mwvvj46.js";import"./chunk-32j6y5d1.js";import"./chunk-bejhca6z.js";import"./chunk-br8r72bf.js";import"./chunk-yt15y085.js";import"./chunk-z1nj22va.js";import"./chunk-zt7wfnva.js";import"./chunk-pn5ygqn6.js";import"./chunk-eqdbfgq5.js";import"./chunk-f8gg8cqh.js";import"./chunk-nc46gddg.js";import"./chunk-91sykzqq.js";export{statePath,setRepoInitOverride,setPersistedString,resolveRepoRoot,resolveMainRepoRoot,removeSavedRepo,remoteRepoKey,normalizeSavedRepos,isValidBranchName,isRemoteRepoKey,isRemoteProjectsEnabled,isGitRepo,getSavedRepos,getRepoInitOverride,getRemoteRepos,getRemoteRepoConfig,getPersistedValue,getPersistedString,getDisabledEngineIds,getCustomEngineIds,backfillSavedReposFromProjects,addSavedRepo,addRemoteRepo};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{MAX_NOTES,MULTI_REPO_CAP,REPO_NAME_RE,SESSION_PR_CAP,canonicalPrUrl,coerceTodos,isWorkspaceBackendId}from"./chunk-x1jxxmtc.js";import{toTaskId}from"./chunk-xy8be792.js";import{coerceVendorId}from"./chunk-h2m7em1e.js";import{DAEMON_MIGRATION_MARKER}from"./chunk-8t7qbr1e.js";import{LockfileError,acquire}from"./chunk-bejhca6z.js";import{logClient}from"./chunk-0g4wc808.js";import{pathSyntax,samePath}from"./chunk-pn5ygqn6.js";import{defaultClientLogPath}from"./chunk-eqdbfgq5.js";import{existsSync}from"fs";import{copyFile,readFile}from"fs/promises";import{dirname,join}from"path";var AUTO_FIX_MAX=3,AT_REST={idle:!0,turn_complete:!0};function autoFixDecision(input){let{state,pr,engine}=input;if(!state||!pr)return{do:"skip"};if(pr.lifecycle!=="open"&&pr.lifecycle!=="ready_to_merge")return{do:"skip"};if(pr.checkState==="passing")return state.attempts>0||state.stopped||state.lastSha?{do:"reset"}:{do:"skip"};if(pr.checkState!=="failing"||!pr.headSha)return{do:"skip"};if(pr.headSha===state.lastSha)return{do:"skip"};if(state.stopped)return{do:"skip"};if(state.attempts>=3)return{do:"stop"};return AT_REST[engine??""]?{do:"fire"}:{do:"wait"}}function coerceAutoFix(value){if(!value||typeof value!=="object"||Array.isArray(value))return;let v=value,attempts=typeof v.attempts==="number"&&Number.isInteger(v.attempts)&&v.attempts>=0?v.attempts:0;return{attempts:Math.min(attempts,3),...typeof v.lastSha==="string"&&v.lastSha.length>0?{lastSha:v.lastSha}:{},...v.stopped===!0?{stopped:!0}:{}}}function coerceTask(value){if(!value||typeof value!=="object")return null;let v=value;if(typeof v.id!=="string"||typeof v.title!=="string"||typeof v.repo!=="string"||typeof v.branch!=="string"||typeof v.worktreePath!=="string"||typeof v.status!=="string"||typeof v.createdAt!=="string"||typeof v.updatedAt!=="string")return null;if(!isTaskStatus(v.status))return null;let kind=v.kind==="main"?"main":v.kind==="dir"?"dir":"task",scratch=kind==="dir"&&v.scratch===!0,noProject=kind==="dir"&&v.noProject===!0,healedStatus=kind==="main"&&(v.status==="in_progress"||v.status==="done")?"backlog":v.status,deletion=coerceDeletion(v.deletion),quotaResume=coerceQuotaResume(v.quotaResume),scheduledStart=coerceScheduledStart(v.scheduledStart),linkedWorkItem=coerceLinkedWorkItem(v.linkedWorkItem),dispatcher=coerceDispatcher(v.dispatcher),lineage=coerceLineage(v,kind),routine=coerceRoutine(v.routine),extraRepos=coerceExtraRepos(v.extraRepos,v.repo),workspace=coerceWorkspace(v.workspace),sessionPrs=coerceSessionPrs(v.sessionPrs),todos=coerceTodos(v.todos),autoFixCi=coerceAutoFix(v.autoFixCi),report=coerceWorkerReport(v.report);return{id:toTaskId(v.id),title:v.title,repo:v.repo,branch:v.branch,worktreePath:v.worktreePath,status:healedStatus,pinned:typeof v.pinned==="boolean"?v.pinned:!1,...v.kept===!0?{kept:!0}:{},...typeof v.notes==="string"&&v.notes.length>0?{notes:v.notes.slice(0,MAX_NOTES)}:{},...todos?{todos}:{},...autoFixCi?{autoFixCi}:{},kind,...scratch?{scratch:!0}:{},...noProject?{noProject:!0}:{},...routine?{routine}:{},vendor:coerceVendorId(typeof v.vendor==="string"?v.vendor:void 0),...typeof v.command==="string"&&v.command.trim().length>0?{command:v.command}:{},prStatus:coercePRStatus(v.prStatus),...typeof v.modelEffort==="string"&&v.modelEffort.length>0?{modelEffort:v.modelEffort}:{},...typeof v.model==="string"&&v.model.length>0?{model:v.model}:{},...typeof v.tier==="string"&&v.tier.length>0?{tier:v.tier}:{},...typeof v.groupId==="string"&&v.groupId.length>0?{groupId:v.groupId}:{},...v.observedLanguage==="zh"||v.observedLanguage==="en"?{observedLanguage:v.observedLanguage}:{},...deletion?{deletion}:{},...quotaResume?{quotaResume}:{},...scheduledStart?{scheduledStart}:{},...linkedWorkItem?{linkedWorkItem}:{},...dispatcher?{dispatcher}:{},...lineage,...v.deleteBranchPending===!0?{deleteBranchPending:!0}:{},...typeof v.prompt==="string"&&v.prompt.length>0?{prompt:v.prompt}:{},...typeof v.baseRef==="string"&&v.baseRef.trim().length>0?{baseRef:v.baseRef}:{},...typeof v.worktreeName==="string"&&v.worktreeName.trim().length>0?{worktreeName:v.worktreeName}:{},...typeof v.gitRepo==="string"&&v.gitRepo.trim().length>0?{gitRepo:v.gitRepo}:{},...extraRepos?{extraRepos}:{},...workspace?{workspace}:{},...sessionPrs?{sessionPrs}:{},...report?{report}:{},...v.requireReport===!0?{requireReport:!0}:{},...v.archived===!0?{archived:!0}:{},createdAt:v.createdAt,updatedAt:v.updatedAt}}function coerceWorkspace(value){if(!value||typeof value!=="object")return;let w=value;if(!isWorkspaceBackendId(w.backend))return;return{backend:w.backend,...typeof w.ref==="string"&&w.ref.length>0?{ref:w.ref}:{}}}function coerceExtraRepos(value,primary){if(!Array.isArray(value))return;let out=[];for(let entry of value){if(out.length>=MULTI_REPO_CAP-1)break;if(!entry||typeof entry!=="object")continue;let e=entry;if(typeof e.name!=="string"||!REPO_NAME_RE.test(e.name))continue;if(typeof e.repo!=="string"||!pathSyntax(e.repo).isAbsolute(e.repo))continue;let repo=e.repo;if(samePath(repo,primary)||out.some((o)=>o.name===e.name||samePath(o.repo,repo)))continue;out.push({name:e.name,repo,branch:typeof e.branch==="string"?e.branch:"",worktreePath:typeof e.worktreePath==="string"?e.worktreePath:"",...typeof e.baseRef==="string"&&e.baseRef.trim().length>0?{baseRef:e.baseRef}:{},...coercePRStatus(e.prStatus)?{prStatus:coercePRStatus(e.prStatus)}:{}})}return out.length>0?out:void 0}function coerceSessionPrs(value){if(!Array.isArray(value))return;let out=[];for(let entry of value){if(!entry||typeof entry!=="object")continue;let e=entry,url=typeof e.url==="string"?canonicalPrUrl(e.url):void 0;if(!url||typeof e.addedAt!=="string"||out.some((o)=>o.url===url))continue;let status=coercePRStatus(e.status);out.push({url,addedAt:e.addedAt,...status?{status}:{}})}return out.length>0?out.slice(-SESSION_PR_CAP):void 0}function coerceWorkerReport(value){if(!value||typeof value!=="object"||Array.isArray(value))return;let v=value;if(typeof v.at!=="string"||v.at.length===0)return;return{at:v.at,...typeof v.branch==="string"&&v.branch.length>0?{branch:v.branch}:{},...typeof v.pr==="number"&&Number.isFinite(v.pr)?{pr:v.pr}:{},...typeof v.summary==="string"&&v.summary.length>0?{summary:v.summary}:{}}}function coerceDispatcher(value){if(!value||typeof value!=="object"||Array.isArray(value))return;let v=value;if(typeof v.taskId!=="string"||v.taskId.length===0)return;if(typeof v.tabId!=="string"||v.tabId.length===0)return;return{taskId:v.taskId,tabId:v.tabId}}function coerceTaskRef(value,selfId){return typeof value==="string"&&value.length>0&&value!==selfId?value:void 0}function coerceCwdSubpath(value){if(typeof value!=="string"||value.length===0)return;if(/^[/\\]|^[a-z]:/i.test(value))return;return value.split(/[/\\]/).includes("..")?void 0:value}function coerceLineage(v,kind){let selfId=v.id,parentTaskId=coerceTaskRef(v.parentTaskId,selfId),sharesWorkspaceOf=kind==="main"?void 0:coerceTaskRef(v.sharesWorkspaceOf,selfId),cwdSubpath=coerceCwdSubpath(v.cwdSubpath),ptyAlias=coerceDispatcher(v.ptyAlias);return{...parentTaskId?{parentTaskId:toTaskId(parentTaskId)}:{},...sharesWorkspaceOf?{sharesWorkspaceOf:toTaskId(sharesWorkspaceOf)}:{},...cwdSubpath?{cwdSubpath}:{},...ptyAlias?{ptyAlias}:{}}}function coerceRoutine(value){if(!value||typeof value!=="object"||Array.isArray(value))return;let v=value;if(typeof v.automationId!=="string"||v.automationId.length===0)return;return{automationId:v.automationId}}function coerceQuotaResume(value){if(!value||typeof value!=="object"||Array.isArray(value))return;let v=value;if(typeof v.resumeAt!=="string"||v.resumeAt.length===0)return;if(typeof v.requestedAt!=="string"||v.requestedAt.length===0)return;return{resumeAt:v.resumeAt,requestedAt:v.requestedAt}}function coerceScheduledStart(value){if(!value||typeof value!=="object"||Array.isArray(value))return;let v=value;if(typeof v.at!=="string"||v.at.length===0)return;if(typeof v.prompt!=="string"||v.prompt.length===0)return;return{at:v.at,prompt:v.prompt}}function coerceLinkedWorkItem(value){if(!value||typeof value!=="object"||Array.isArray(value))return;let v=value;if(v.provider!=="github")return;if(v.type!=="issue"&&v.type!=="pr")return;if(typeof v.number!=="number"||!Number.isFinite(v.number))return;if(typeof v.title!=="string"||typeof v.url!=="string"||v.url.length===0)return;return{provider:v.provider,type:v.type,number:v.number,title:v.title,url:v.url}}function coerceDeletion(value){if(!value||typeof value!=="object"||Array.isArray(value))return;let v=value;if(v.phase!=="queued"&&v.phase!=="running"&&v.phase!=="error"||typeof v.force!=="boolean"||typeof v.requestedAt!=="string"||v.requestedAt.length===0||v.error!==void 0&&typeof v.error!=="string")return;return{phase:v.phase,force:v.force,...typeof v.deleteBranch==="boolean"?{deleteBranch:v.deleteBranch}:{},requestedAt:v.requestedAt,...typeof v.error==="string"?{error:v.error}:{}}}function coercePRStatus(value){if(!value||typeof value!=="object"||Array.isArray(value))return;let v=value;if(!isPRProviderId(v.provider)||!isPRLifecycleState(v.lifecycle)||!isPRCheckState(v.checkState))return;return{provider:v.provider,lifecycle:v.lifecycle,checkState:v.checkState,...typeof v.number==="number"&&Number.isFinite(v.number)?{number:v.number}:{},...typeof v.url==="string"?{url:v.url}:{},...typeof v.title==="string"?{title:v.title}:{},...typeof v.additions==="number"&&Number.isFinite(v.additions)?{additions:v.additions}:{},...typeof v.deletions==="number"&&Number.isFinite(v.deletions)?{deletions:v.deletions}:{},...typeof v.baseRef==="string"?{baseRef:v.baseRef}:{},...typeof v.reviewDecision==="string"?{reviewDecision:v.reviewDecision}:{},...typeof v.mergeable==="string"?{mergeable:v.mergeable}:{},...typeof v.headSha==="string"?{headSha:v.headSha}:{},...typeof v.lastCheckedAt==="string"?{lastCheckedAt:v.lastCheckedAt}:{},...typeof v.lastError==="string"?{lastError:v.lastError}:{}}}function isPRProviderId(v){return v==="github"||v==="gitlab"||v==="bitbucket"||v==="unknown"}function isPRLifecycleState(v){return v==="creating"||v==="open"||v==="ready_to_merge"||v==="merged"||v==="closed"||v==="unknown"}function isPRCheckState(v){return v==="none"||v==="pending"||v==="passing"||v==="failing"||v==="unknown"}function isTaskStatus(s){return s==="backlog"||s==="in_progress"||s==="in_review"||s==="done"||s==="canceled"||s==="error"}var sleep=(ms)=>new Promise((resolve)=>setTimeout(resolve,ms)),LOCK_RETRY_DELAY_MS=25,LOCK_MAX_WAIT_MS=5000;async function acquireWithRetry(lockPath){let deadline=Date.now()+LOCK_MAX_WAIT_MS;for(;;)try{return await acquire(lockPath)}catch(err){if(!(err instanceof LockfileError)||Date.now()>=deadline)throw err;await sleep(LOCK_RETRY_DELAY_MS)}}var CURRENT_VERSION=3;async function backupCorruptManifest(path,now=()=>new Date){let backupPath=`${path}.corrupt-${now().toISOString().replaceAll(":","-")}`;try{return await copyFile(path,backupPath),backupPath}catch{return null}}var SUPPORTED_VERSIONS=new Set([1,2,3]);function warnManifestRecovery(message,manifestPath){console.warn(message),logClient("tasks-index",message,manifestPath?defaultClientLogPath(dirname(dirname(manifestPath))):void 0)}async function recoverUnsupportedVersion(parsed,sourcePath){if(!parsed||typeof parsed!=="object"||Array.isArray(parsed))return!1;let version=parsed.version;if(version===void 0||SUPPORTED_VERSIONS.has(version))return!1;let backup=await backupCorruptManifest(sourcePath);return warnManifestRecovery(`[rove] tasks.json at ${sourcePath} has unsupported version=${String(version)}; recovering with empty index.${backup?` Original bytes backed up to ${backup}.`:" Backup copy failed; the stale file is left in place."}`,sourcePath),!0}function normalizeIndex(parsed,source){if(!parsed||typeof parsed!=="object"||Array.isArray(parsed))return warnManifestRecovery(`[rove] tasks.json at ${source} is not an object; recovering with empty index.`,source),{version:CURRENT_VERSION,tasks:[]};let obj=parsed,version=obj.version;if(version!==void 0&&!SUPPORTED_VERSIONS.has(version))return warnManifestRecovery(`[rove] tasks.json at ${source} has unsupported version=${String(version)}; recovering with empty index.`,source),{version:CURRENT_VERSION,tasks:[]};let rawTasks=Array.isArray(obj.tasks)?obj.tasks:[],tasks=[];for(let entry of rawTasks){let task=coerceTask(entry);if(task)tasks.push(task);else console.warn(`[rove] dropping malformed task entry from ${source}: ${JSON.stringify(entry)}`)}return{version:CURRENT_VERSION,tasks}}var TOMBSTONE_TTL_MS=2592000000;function readableLegacyIndexPath(canonicalPath,legacyPath){return existsSync(join(dirname(canonicalPath),DAEMON_MIGRATION_MARKER))?void 0:legacyPath}async function readDiskIndex(path,legacyPath){let raw,sourcePath=path;try{raw=await readFile(sourcePath,"utf8")}catch(err){if(err.code!=="ENOENT")throw err;let legacy=readableLegacyIndexPath(path,legacyPath);if(!legacy)return{tasks:[],removed:[]};sourcePath=legacy;try{raw=await readFile(sourcePath,"utf8")}catch(legacyErr){if(legacyErr.code==="ENOENT")return{tasks:[],removed:[]};throw legacyErr}}let parsed;try{parsed=JSON.parse(raw)}catch{return await backupCorruptManifest(sourcePath),{tasks:[],removed:[]}}if(await recoverUnsupportedVersion(parsed,sourcePath))return{tasks:[],removed:[]};return{tasks:normalizeIndex(parsed,sourcePath).tasks,removed:coerceTombstones(parsed)}}function coerceTombstones(parsed){if(!parsed||typeof parsed!=="object"||Array.isArray(parsed))return[];let raw=parsed.removed;if(!Array.isArray(raw))return[];let out=[];for(let entry of raw){if(!entry||typeof entry!=="object")continue;let v=entry;if(typeof v.id==="string"&&v.id.length>0&&typeof v.at==="string")out.push({id:v.id,at:v.at})}return out}function mergeTasksWithDisk(cacheTasks,diskTasks,dirty,removed,diskRemoved=[],now=Date.now()){let tombstones=new Map;for(let t of diskRemoved){let at=Date.parse(t.at);if(!Number.isFinite(at)||now-at>TOMBSTONE_TTL_MS)continue;tombstones.set(t.id,t.at)}for(let[id,at]of removed)tombstones.set(id,at);let diskById=new Map(diskTasks.map((t)=>[t.id,t])),result=[],included=new Set;for(let task of cacheTasks){if(tombstones.has(task.id))continue;if(dirty.has(task.id))result.push(task);else{let onDisk=diskById.get(task.id);if(onDisk===void 0)continue;result.push(onDisk)}included.add(task.id)}for(let task of diskTasks){if(included.has(task.id)||tombstones.has(task.id))continue;result.push(task),included.add(task.id)}return{tasks:result,removed:[...tombstones].map(([id,at])=>({id,at}))}}async function recoverIndexFromDisk(path,legacyPath){let raw,sourcePath=path;try{raw=await readFile(path,"utf8")}catch(err){if(err.code!=="ENOENT")throw err;let legacy=readableLegacyIndexPath(path,legacyPath),legacyRaw;if(legacy)try{legacyRaw=await readFile(legacy,"utf8"),sourcePath=legacy}catch(legacyErr){if(legacyErr.code!=="ENOENT")throw legacyErr}if(legacyRaw===void 0)return{version:CURRENT_VERSION,tasks:[]};raw=legacyRaw}let parsed;try{parsed=JSON.parse(raw)}catch(err){let backup=await backupCorruptManifest(sourcePath);return warnManifestRecovery(`[rove] tasks.json at ${sourcePath} is corrupted (${err.message}); recovering with empty index.${backup?` Original bytes backed up to ${backup}.`:" Backup copy failed; the stale file is left in place."}`,sourcePath),{version:CURRENT_VERSION,tasks:[]}}if(await recoverUnsupportedVersion(parsed,sourcePath))return{version:CURRENT_VERSION,tasks:[]};return normalizeIndex(parsed,sourcePath)}
|
|
3
|
+
export{AUTO_FIX_MAX,autoFixDecision,acquireWithRetry,readableLegacyIndexPath,readDiskIndex,mergeTasksWithDisk,recoverIndexFromDisk};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{getCustomEngineIds,getDisabledEngineIds}from"./chunk-rfp0ayra.js";import{errorMessage}from"./chunk-2brn8e1y.js";import{JsonHookAdapter,ROVE_HOOK_VERSION,bobAuthSecretsPath,claudeGlobalConfigPath,codexAuthPath,copilotConfigPath,editJsonSettings,hookCommandQuoting,isRoveHook,kimiCredentialsPath,readTextFileSyncBounded,roveHookArgs,roveHookInvocation,skillsDirUnder,updateSharedJson,xdgConfigHome}from"./chunk-
|
|
2
|
+
import{getCustomEngineIds,getDisabledEngineIds}from"./chunk-rfp0ayra.js";import{errorMessage}from"./chunk-2brn8e1y.js";import{JsonHookAdapter,ROVE_HOOK_VERSION,bobAuthSecretsPath,claudeGlobalConfigPath,codexAuthPath,copilotConfigPath,editJsonSettings,hookCommandQuoting,isRoveHook,kimiCredentialsPath,readTextFileSyncBounded,roveHookArgs,roveHookInvocation,skillsDirUnder,updateSharedJson,xdgConfigHome}from"./chunk-8qkyd589.js";import{quoteShellArgv}from"./chunk-7kysxgbq.js";import{isObject}from"./chunk-7ghwdjdc.js";import{__require}from"./chunk-91sykzqq.js";import{homedir as homedir9}from"os";import{join as join8}from"path";var GEMINI={rules:[{state:"blocked",any:["\u2502 apply this change","\u2502 allow execution","waiting for user confirmation"]},{state:"blocked",all:["do you want to proceed"],any:["yes"]},{state:"working",any:["esc to cancel"]}]},OPENCODE={rules:[{state:"blocked",any:["\u25B3 permission required"]},{state:"blocked",all:["esc dismiss"],any:["enter confirm","enter submit","enter toggle"]},{state:"working",any:["esc interrupt","esc to interrupt","ctrl+c to interrupt","esc again to interrupt"]},{state:"idle",any:["enter send"]}]},CURSOR={rules:[{state:"blocked",any:["press any key to log in"]},{state:"blocked",all:["proceed (y)"]},{state:"blocked",any:["run this command?","waiting for approval","skip (esc or n)","(y) (enter)"]},{state:"working",any:["esc to cancel","ctrl+c to stop"]}]},GROK={rules:[{state:"blocked",any:["\u26A0 action required","ctrl+o:yolo"]},{state:"blocked",all:["\u2503"],lineRegex:["^\\s*\u2503\\s+\\S+\\s+\\(\u25CB\\)"]},{state:"working",any:["[stop]"],lineRegex:["^\\s*[\\u2800-\\u28FF]"]}]},DROID={rules:[{state:"blocked",all:["enter to select","esc to cancel"],any:["> yes, allow","> no, cancel"]},{state:"blocked",all:["enter select","esc cancel"]},{state:"working",any:["esc to stop"]}]},AMP={rules:[{state:"blocked",any:["waiting for approval","run this command?","allow editing file:","allow creating file:","confirm tool call"]},{state:"working",lineRegex:["^\\s*\u2570\\s+\\S+\\s+(thinking|streaming|running tools|waiting)\\s+\u2500"]}]},CLINE={rules:[{state:"blocked",any:["let cline use this tool"]},{state:"blocked",all:["execute command?","yes"],any:["[act mode]","[plan mode]"]},{state:"blocked",all:["use this tool?","yes"],any:["[act mode]","[plan mode]"]}]},KIRO={rules:[{state:"blocked",all:["requires approval"],any:["yes, single permission","trust, always allow","no (tab to edit)","esc to close"]},{state:"blocked",all:["pending from subagents","tool approval"],any:["approve all pending","configure individually","exit (cancel subagents)"]},{state:"working",any:["kiro is working"]},{state:"working",all:["esc to cancel"],lineRegex:["^\\s*[\u25D4\u25D1\u25D5\u25CF]\\s+[A-Za-z]"]}]},MAKI={rules:[{state:"blocked",all:["permission required","y allow","n deny"]},{state:"blocked",all:["permission required"],any:["confirm allow","confirm deny"]},{state:"blocked",all:["permission required","enter deny","esc cancel"]},{state:"blocked",all:["plan complete","enter confirm"],any:["space toggle parallel","edit plan"]},{state:"working",bottomLines:1,lineRegex:["^( [\\u2800-\\u28FF]){1,2} \\[(BUILD|PLAN|BASH)\\]"]},{state:"idle",bottomLines:1,lineRegex:["^ \\[(BUILD|PLAN|BASH)\\]"]}]},ANTIGRAVITY={rules:[{state:"blocked",all:["requesting permission for:","do you want to proceed?"]},{state:"blocked",all:["requesting permission for:","tab amend","edit command"]},{state:"working",lineRegex:["^\\s*[\\u2800-\\u28FF]+\\s+[A-Za-z]+\\w*ing\\b"]},{state:"working",bottomLines:5,lineRegex:["\xB7\\s*[1-9][0-9]*\\s+task"]}]},DEVIN={rules:[{state:"blocked",bottomLines:8,all:["do you trust the authors of this directory?","yes, trust "]},{state:"blocked",bottomLines:8,all:["approve once","select","confirm","esc cancel"]},{state:"working",bottomLines:8,all:["running tools","esc to interrupt"]},{state:"working",bottomLines:6,all:["guide devin while it works"]},{state:"working",bottomLines:8,all:["reading shell ","timeout:"]},{state:"idle",bottomLines:8,all:["ask devin to build","features, fix bugs","your code"],lineRegex:["^\\s*\u276D Ask Devin to build"]},{state:"idle",bottomLines:6,all:["context:"],lineRegex:["^\\s*\u276D"]}]},QODERCLI={rules:[{state:"blocked",all:["waiting for user confirmation"],any:["yes","no","allow","reject"]},{state:"blocked",all:["awaiting approval"],any:["allow","reject"]},{state:"blocked",any:["permission required","allow once or always?","asking user","enter your response","review your answers:","shell awaiting input"]},{state:"working",any:["(esc to cancel,"]},{state:"working",lineRegex:["^\\s*[\\u2800-\\u28FF]\\s+.*[A-Za-z]"]}]},HERMES={rules:[{state:"blocked",bottomLines:14,any:["dangerous","approval","allow once","hermes needs your","type your answer","approve once","start a new session","keep going"],lineRegex:["enter\\s+(?:to\\s+)?(?:confirm|send)","press enter","\u2191/\u2193\\s+(?:to\\s+)?select","show full command","type 1/2/3","y/n quick","other \\(type"]},{state:"blocked",bottomLines:14,any:["sudo password","skill setup"]},{state:"blocked",bottomLines:14,all:["\uD83D\uDD11","for "]},{state:"working",bottomLines:5,any:["msg=interrupt","ctrl+c to interrupt","ctrl+c cancel"]}]},KILO={rules:[{state:"blocked",any:["\u25B3 permission required"]},{state:"blocked",all:["esc dismiss"],any:["enter confirm","enter submit","enter toggle"],lineRegex:["\u2191\u2193\\s*select","\u21C6\\s*tab"]},{state:"working",any:["esc interrupt"]}]},MASTRACODE={rules:[]};import{existsSync}from"fs";import{homedir}from"os";import{dirname,join}from"path";function parseFlatHooks(raw){if(raw===void 0)return{ok:!0,doc:{}};let parsed;try{parsed=JSON.parse(raw)}catch(err){return{ok:!1,reason:`not valid JSON (${err instanceof Error?err.message:String(err)})`}}if(!isObject(parsed))return{ok:!1,reason:"top level is not a JSON object"};if(parsed.hooks===void 0)return{ok:!0,doc:parsed};if(!isObject(parsed.hooks))return{ok:!1,reason:'"hooks" is not an object'};for(let[event,entries]of Object.entries(parsed.hooks))if(!Array.isArray(entries))return{ok:!1,reason:`"hooks.${event}" is not an array`};return{ok:!0,doc:parsed}}function mergeFlatHooks(format,current,install,inv=roveHookInvocation()){let verbs=format.eventMap.map((spec)=>spec.verb),{hooks:rawHooks,...rest}=current,hooks=isObject(rawHooks)?{...rawHooks}:{},quoting=hookCommandQuoting();for(let{event,verb}of format.eventMap){let kept=(Array.isArray(hooks[event])?hooks[event]:[]).filter((entry)=>!isRoveHook(entry,verbs));if(install){let command=quoteShellArgv([...inv,"hook",verb,...roveHookArgs(format.vendor)],quoting);kept.push(format.withType?{type:"command",command}:{command})}if(kept.length>0)hooks[event]=kept;else delete hooks[event]}return{version:1,...rest,hooks}}var CURSOR_HOOK_EVENT_MAP=[{event:"sessionStart",verb:"session-start"}],CURSOR_FORMAT={vendor:"cursor",eventMap:CURSOR_HOOK_EVENT_MAP};function cursorHooksPath(home=homedir()){let override=process.env.CURSOR_CONFIG_DIR?.trim();return join(override||join(home,".cursor"),"hooks.json")}function parseCursorHooks(raw){return parseFlatHooks(raw)}function mergeCursorHooks(current,install,inv=roveHookInvocation()){return mergeFlatHooks(CURSOR_FORMAT,current,install,inv)}class CursorHookAdapter{vendor="cursor";supportsHooks(){return!0}globalSettingsPath(){return cursorHooksPath()}activityDetailFromPayload(){return}cwdFromPayload(payload){let roots=payload.workspace_roots;return Array.isArray(roots)?firstString(...roots):void 0}sessionFromPayload(payload){let sessionId=firstString(payload.session_id,payload.conversation_id);if(!sessionId)return;let transcriptPath=firstString(payload.transcript_path);return{sessionId,...transcriptPath?{transcriptPath}:{}}}async installActivityHooks(settingsFilePath,opts={}){if(!existsSync(dirname(settingsFilePath)))return{ok:!0};let outcome=await editJsonSettings(settingsFilePath,(cur)=>mergeCursorHooks(cur,!0),parseCursorHooks);if(!outcome.ok&&!opts.quiet)process.stderr.write(`[rove hooks] cursor: skipped ${outcome.file}: ${outcome.reason}
|
|
3
3
|
`);return outcome}async removeActivityHooks(settingsFilePath){if(!existsSync(settingsFilePath))return;await editJsonSettings(settingsFilePath,(cur)=>mergeCursorHooks(cur,!1),parseCursorHooks)}hookConfigRefusal(raw){let parsed=parseCursorHooks(raw);return parsed.ok?void 0:parsed.reason}supportsWorktreeSync(){return!1}async removeWorktreeSyncHook(){}async removeWorktreeWatchHook(){}}function firstString(...values){for(let value of values)if(typeof value==="string"&&value)return value;return}import{homedir as homedir2}from"os";import{join as join2}from"path";import{existsSync as existsSync2}from"fs";import{dirname as dirname2}from"path";function sessionStartOnly(matcher){return[{event:"SessionStart",verb:"session-start",...matcher?{matcher}:{}}]}class SessionStartHookAdapter extends JsonHookAdapter{installGuardDir(settingsFilePath){return dirname2(settingsFilePath)}async installActivityHooks(settingsFilePath,opts={}){if(!existsSync2(this.installGuardDir(settingsFilePath)))return{ok:!0};return super.installActivityHooks(settingsFilePath,opts)}async removeActivityHooks(settingsFilePath){if(!existsSync2(settingsFilePath))return;await super.removeActivityHooks(settingsFilePath)}sessionFromPayload(payload){if(typeof payload.session_id!=="string"||!payload.session_id)return;return{sessionId:payload.session_id,...typeof payload.transcript_path==="string"&&payload.transcript_path?{transcriptPath:payload.transcript_path}:{}}}}var DEVIN_HOOK_EVENT_MAP=sessionStartOnly();function devinSettingsPath(home=homedir2()){let xdg=process.env.XDG_CONFIG_HOME?.trim();return join2(xdg||join2(home,".config"),"devin","config.json")}class DevinHookAdapter extends SessionStartHookAdapter{vendor="devin";eventMap=DEVIN_HOOK_EVENT_MAP;globalSettingsPath(){return devinSettingsPath()}}import{homedir as homedir3}from"os";import{join as join3}from"path";var DROID_HOOK_EVENT_MAP=sessionStartOnly();function droidSettingsPath(home=homedir3()){return join3(home,".factory","settings.json")}class DroidHookAdapter extends SessionStartHookAdapter{vendor="droid";eventMap=DROID_HOOK_EVENT_MAP;globalSettingsPath(){return droidSettingsPath()}}import{homedir as homedir4}from"os";import{dirname as dirname3,join as join4}from"path";var GROK_HOOK_EVENT_MAP=sessionStartOnly();function grokConfigDir(home=homedir4()){return process.env.GROK_HOME?.trim()||join4(home,".grok")}function grokHooksPath(home=homedir4()){return join4(grokConfigDir(home),"hooks","rove.json")}class GrokHookAdapter extends SessionStartHookAdapter{vendor="grok";eventMap=GROK_HOOK_EVENT_MAP;globalSettingsPath(){return grokHooksPath()}installGuardDir(settingsFilePath){return dirname3(dirname3(settingsFilePath))}sessionFromPayload(payload){let sessionId=firstString2(payload.session_id,payload.sessionId);if(!sessionId)return;let transcriptPath=firstString2(payload.transcript_path,payload.transcriptPath);return{sessionId,...transcriptPath?{transcriptPath}:{}}}}function firstString2(...values){for(let value of values)if(typeof value==="string"&&value)return value;return}import{existsSync as existsSync3}from"fs";import{rm}from"fs/promises";import{homedir as homedir5}from"os";import path2 from"path";import{mkdir,readFile,writeFile}from"fs/promises";import path from"path";async function writeIfChanged(file,content){try{if(await readFile(file,"utf8").catch(()=>{return})===content)return;await mkdir(path.dirname(file),{recursive:!0}),await writeFile(file,content)}catch{}}var HERMES_PLUGIN_NAME="rove-agent-state";function indentOf(line){if(!line.trim()||line.trim().startsWith("#"))return;let match=/^ */.exec(line),indent=match?match[0].length:0;return line[indent]==="\t"?void 0:indent}function keyAt(line,indent){if(indentOf(line)!==indent)return;return/^ *(["']?)([A-Za-z0-9_.-]+)\1:(?:\s|$)/.exec(line)?.[2]}function inlineValue(line){return(/^ *(["']?)[A-Za-z0-9_.-]+\1:(.*)$/.exec(line)?.[2]??"").trim()}function listItemAt(line,indent){if(indentOf(line)!==indent)return;let match=/^ *- *(.*)$/.exec(line);if(!match)return;return match[1].trim().replace(/^["']|["']$/g,"")}function join5(lines,trailingNewline){return lines.join(`
|
|
4
4
|
`)+(trailingNewline?`
|
|
5
5
|
`:"")}function setHermesPluginEnabled(content,enabled){let trailingNewline=content.endsWith(`
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{ensurePtyHostReachable}from"./chunk-cfzg8q3e.js";import{DEFAULT_TERMINAL_COLORS,parseTerminalDefaultColors}from"./chunk-mqfvzdpr.js";import{BUNDLED_THEMES,DEFAULT_THEME,readPersistedUiPrefs}from"./chunk-5nvg3ek8.js";import{loadUserThemes,parseRgbLiteral}from"./chunk-xd93fm1k.js";import{ENGINE_EXIT_BANNER,REPO_INIT_TIMEOUT_SECONDS,initMarkerSaysFinished}from"./chunk-r7ntkd6y.js";import{aliasKey,isUnderKey,unclaimedSessions}from"./chunk-g9ba25q5.js";import{engineProcessIn,foregroundEngineIn,parsePsSnapshot,psSnapshot}from"./chunk-3y9xzbqh.js";import{engineEntry}from"./chunk-d7f022eb.js";import{terminalRows}from"./chunk-etfh8f4z.js";import{RoveDaemonClient}from"./chunk-n6marmjn.js";import{BUILTIN_VENDORS}from"./chunk-h2m7em1e.js";import{LockfileError,acquire,release}from"./chunk-bejhca6z.js";import{defaultDeliveryLockDir,defaultPtyHostSocketPath}from"./chunk-eqdbfgq5.js";function normalizeHex(value){let m=/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/.exec(value);if(!m)return null;let digits=m[1];if(digits.length===3){let[r,g,b]=digits;return`#${r}${r}${g}${g}${b}${b}`.toLowerCase()}return`#${digits.slice(0,6)}`.toLowerCase()}function rgbToHex({r,g,b}){let hex=(n)=>n.toString(16).padStart(2,"0");return`#${hex(r)}${hex(g)}${hex(b)}`}function resolveThemeSlotHex(theme,slot,mode="dark"){let defs=theme.defs??{};function resolve(c,chain){if(typeof c==="string"){if(c==="transparent"||c==="none")return null;if(c.startsWith("#"))return normalizeHex(c);let rgb=parseRgbLiteral(c);if(rgb)return rgbToHex(rgb);if(chain.includes(c))return null;let next=defs[c]??theme.theme[c];if(next===void 0)return null;return resolve(next,[...chain,c])}if(!c||typeof c!=="object")return null;let variant=c[mode];return typeof variant==="string"?resolve(variant,chain):null}let value=theme.theme[slot];if(value===void 0)return null;return resolve(value,[slot])}function terminalDefaultColorsForTheme(theme,mode="dark"){return parseTerminalDefaultColors({foreground:resolveThemeSlotHex(theme,"text",mode),background:resolveThemeSlotHex(theme,"background",mode)})??DEFAULT_TERMINAL_COLORS}function readPersistedTerminalDefaultColors(){let themes={...BUNDLED_THEMES};for(let{name,theme}of loadUserThemes())themes[name]=theme;let prefs=readPersistedUiPrefs(DEFAULT_THEME,(name)=>Boolean(themes[name])),selected=themes[prefs.theme]??themes[DEFAULT_THEME];return selected?terminalDefaultColorsForTheme(selected,prefs.themeMode==="light"?"light":"dark"):DEFAULT_TERMINAL_COLORS}async function enginePresence(pid,extraLaunch,snapshot=psSnapshot){if(!pid)return{kind:"none"};try{let rows=parsePsSnapshot(await snapshot([pid])),engine=foregroundEngineIn(rows,pid);if(engine)return{kind:"engine",vendor:engine.vendor};return engineProcessIn(rows,pid,extraLaunch)?{kind:"engine",vendor:null}:{kind:"none"}}catch{return{kind:"unknown"}}}import{basename}from"path";import path from"path";var DELIVERY_LOCK_TIMEOUT_MS=5000,DELIVERY_LOCK_RETRY_MS=20;function lockFileName(key){return`${key.replace(/[^A-Za-z0-9._-]/g,"_")}.lock`}function deliveryLockPath(key,lockDir=defaultDeliveryLockDir()){return path.join(lockDir,lockFileName(key))}var sleep=(ms)=>new Promise((resolve)=>setTimeout(resolve,ms));async function withDeliveryLock(key,fn,opts={}){let lockPath=deliveryLockPath(key,opts.lockDir??defaultDeliveryLockDir()),deadline=Date.now()+(opts.timeoutMs??DELIVERY_LOCK_TIMEOUT_MS),token=null;for(;;)try{token=await acquire(lockPath);break}catch(err){if(!(err instanceof LockfileError))break;if(Date.now()>=deadline)break;await sleep(DELIVERY_LOCK_RETRY_MS)}try{return await fn()}finally{if(token!==null)await release(lockPath,token).catch(()=>{})}}var PASTE_READY_TIMEOUT_MS=15000,PASTE_READY_POLL_MS=100;function bracketedPasteActive(output){let on=output.lastIndexOf("\x1B[?2004h");if(on===-1)return!1;return on>output.lastIndexOf("\x1B[?2004l")}function encodePaste(prompt,bracketed){return bracketed?`\x1B[200~${prompt}\x1B[201~`:prompt}async function connectHostedSessionClient(socketPath){let client=new RoveDaemonClient(socketPath);try{await client.connect()}catch(error){throw client.close(),error}return{rpc:client,close:()=>client.close()}}async function openHostedSessionHost(){try{return await connectHostedSessionClient(defaultPtyHostSocketPath())}catch{return null}}async function ensureHostedSessionHost(){return connectHostedSessionClient(await ensurePtyHostReachable())}async function listHostedSessionsOrNull(rpc){try{let{sessions}=await rpc.request("pty.list",{});return sessions??[]}catch{return null}}async function listHostedSessions(rpc){return await listHostedSessionsOrNull(rpc)??[]}function isHostedTaskKey(key,taskId){return(key.split("::")[0]??key)===taskId}function hostedTaskKeys(sessions,taskId,scope){return sessions.filter((session)=>isHostedTaskKey(session.key,taskId)&&!scope?.spare.some((base)=>isUnderKey(session.key,base))||(scope?.also.some((base)=>isUnderKey(session.key,base))??!1)).map((session)=>session.key)}async function killHostedSessions(rpc,keys,opts){let payload=opts?.wait===!0?{wait:!0}:{};await Promise.all(keys.map((key)=>rpc.request("pty.kill",{key,...payload}).catch(()=>{})))}function commandHasEngineWord(command,engineBin){for(let part of command)for(let token of part.split(/\s+/)){let bare=token.replace(/^['"]+|['"]+$/g,"");if(bare&&basename(bare)===engineBin)return!0}return!1}function builtinEngineBins(){return BUILTIN_VENDORS.flatMap((vendor)=>{let entry=engineEntry(vendor);return[entry.defaultCommand[0],...entry.processNames??[]]}).filter((bin)=>Boolean(bin))}function sessionArgvNamesEngine(command,engineBin){if(!command||command.length===0)return!1;if(engineBin&&commandHasEngineWord(command,engineBin))return!0;return builtinEngineBins().some((bin)=>commandHasEngineWord(command,bin))}function tabOrder(key){let n=Number(/tab-(\d+)$/.exec(key)?.[1]);return Number.isFinite(n)?n:Number.POSITIVE_INFINITY}function findHostedEngineKey(sessions,taskId,engineBin,scope){if(scope?.alias){let key=aliasKey(scope.alias);if(sessions.some((s)=>s.alive&&s.key===key))return key}let mine=unclaimedSessions(sessions,scope).filter((s)=>s.alive&&isHostedTaskKey(s.key,taskId)).sort((a,b)=>tabOrder(a.key)-tabOrder(b.key)),tab1=mine.find((s)=>s.key===`${taskId}::tab-1`);if(tab1)return tab1.key;if(engineBin){let byCommand=mine.find((s)=>commandHasEngineWord(s.command,engineBin));if(byCommand)return byCommand.key}return mine.find((s)=>sessionArgvNamesEngine(s.command))?.key??null}var SUBMIT_DELAY_MS=150,CONFIRM_TAIL_CHARS=24,CONFIRM_TIMEOUT_MS=2000,CONFIRM_POLL_MS=100;function flatten(text){return text.replace(/\s+/g," ")}async function confirmPromptLanded(rpc,key,prompt,sinceOffset){let tail=flatten(prompt).trim().slice(-CONFIRM_TAIL_CHARS);if(tail.length===0)return!1;let deadline=Date.now()+CONFIRM_TIMEOUT_MS;for(;;){let peek=await rpc.request("pty.peek",{key,sinceOffset});if(!peek.alive)return!1;if(flatten(Buffer.from(peek.data,"base64").toString("utf8")).includes(tail))return!0;if(Date.now()>=deadline)return!1;await new Promise((resolve)=>setTimeout(resolve,CONFIRM_POLL_MS))}}async function writeAndConfirm(rpc,key,prompt,sinceOffset,opts){let ready=await awaitPasteReady(rpc,key,{timeoutMs:opts?.pasteReadyTimeoutMs}),{bytes}=await writeHostedPrompt(rpc,key,prompt,{ready,vendor:opts?.vendor}),confirmed=await confirmPromptLanded(rpc,key,prompt,sinceOffset);return{bytes,ready,confirmed}}async function writeHostedPromptIfLive(rpc,key,prompt,opts){let peek=await rpc.request("pty.peek",{key});if(!peek.alive)return null;return writeAndConfirm(rpc,key,prompt,peek.offset,opts)}async function awaitPasteReady(rpc,key,opts={}){let sleep2=opts.sleep??((ms)=>new Promise((resolve)=>setTimeout(resolve,ms))),deadline=Date.now()+(opts.timeoutMs??PASTE_READY_TIMEOUT_MS);for(;;){let peek=await rpc.request("pty.peek",{key});if(!peek.alive)return!1;if(bracketedPasteActive(Buffer.from(peek.data,"base64").toString("latin1")))return!0;if(Date.now()>=deadline)return!1;await sleep2(PASTE_READY_POLL_MS)}}async function writeHostedPrompt(rpc,key,prompt,opts){let bracketed=opts?.ready??await awaitPasteReady(rpc,key),capabilities=opts?.vendor?engineEntry(opts.vendor).capabilities:void 0,prepared=capabilities?.preparePromptSubmission?.(prompt),data=encodePaste(prepared??prompt,bracketed);return await withDeliveryLock(key,async()=>{await rpc.request("pty.write",{key,data}),await new Promise((resolve)=>setTimeout(resolve,SUBMIT_DELAY_MS)),await rpc.request("pty.write",{key,data:`${capabilities?.beforePromptSubmit??""}\r`})}),{bytes:Buffer.byteLength(data,"utf8")}}var deliverToHostedKey=writeHostedPromptIfLive;async function ensureHostedEngine(rpc,cwd,launch,defaultColors=readPersistedTerminalDefaultColors()){let result=await rpc.request("pty.open",{key:launch.key,cwd,command:launch.command,defaultColors});return await rpc.request("pty.detach",{key:launch.key}).catch(()=>{}),result}var FIRST_MESSAGE_ENGINE_TIMEOUT_MS=20000,FIRST_MESSAGE_POLL_INTERVAL_MS=500,FIRST_MESSAGE_SETTLE_MS=1500;async function awaitEngineProcess(rpc,key,engineBin,opts={}){let sleep2=opts.sleep??((ms)=>new Promise((resolve)=>setTimeout(resolve,ms))),snapshot=opts.snapshot;if(opts.initMarkerPath){let initDeadline=Date.now()+(opts.initTimeoutMs??REPO_INIT_TIMEOUT_SECONDS*1000);while(Date.now()<initDeadline){let{sessions=[]}=await rpc.request("pty.list",{});if(!sessions.find((s)=>s.key===key)?.alive)return null;if(initMarkerSaysFinished(opts.initMarkerPath))break;await sleep2(opts.intervalMs??FIRST_MESSAGE_POLL_INTERVAL_MS)}}let deadline=Date.now()+(opts.timeoutMs??FIRST_MESSAGE_ENGINE_TIMEOUT_MS);while(Date.now()<deadline){let{sessions=[]}=await rpc.request("pty.list",{}),session=sessions.find((s)=>s.key===key);if(!session?.alive)return null;if(session.pid){let presence=await enginePresence(session.pid,engineBin,snapshot);if(presence.kind==="engine")return{pid:session.pid,vendor:presence.vendor}}await sleep2(opts.intervalMs??FIRST_MESSAGE_POLL_INTERVAL_MS)}return null}async function hostedSessionFailureLine(rpc,key,limit=200){try{let peek=await rpc.request("pty.peek",{key}),lines=terminalRows(Buffer.from(peek.data,"base64").toString("utf8")).map((row)=>row.trim()).filter((row)=>row.length>0),line=lines.findLast((row)=>ENGINE_EXIT_BANNER.test(row))??lines.at(-1);return line===void 0?void 0:line.slice(0,limit)}catch{return}}async function pastePromptWhenEngineUp(rpc,key,engineBin,prompt,opts={}){let sleep2=opts.sleep??((ms)=>new Promise((resolve)=>setTimeout(resolve,ms))),engine=await awaitEngineProcess(rpc,key,engineBin,opts);if(engine!==null){if(!await awaitPasteReady(rpc,key,{timeoutMs:opts.pasteReadyTimeoutMs,sleep:sleep2}))await sleep2(opts.settleMs??FIRST_MESSAGE_SETTLE_MS);return await writeHostedPromptIfLive(rpc,key,prompt,{...opts,vendor:engine.vendor})}return null}
|
|
2
|
+
import{ensurePtyHostReachable}from"./chunk-z43e08kw.js";import{DEFAULT_TERMINAL_COLORS,parseTerminalDefaultColors}from"./chunk-mqfvzdpr.js";import{BUNDLED_THEMES,DEFAULT_THEME,readPersistedUiPrefs}from"./chunk-cf3vpsm5.js";import{loadUserThemes,parseRgbLiteral}from"./chunk-kxp04jnp.js";import{ENGINE_EXIT_BANNER,REPO_INIT_TIMEOUT_SECONDS,initMarkerSaysFinished}from"./chunk-61cn88e7.js";import{aliasKey,isUnderKey,unclaimedSessions}from"./chunk-g9ba25q5.js";import{engineProcessIn,foregroundEngineIn,parsePsSnapshot,psSnapshot}from"./chunk-vvqwgcge.js";import{engineEntry}from"./chunk-x83xbzjd.js";import{terminalRows}from"./chunk-etfh8f4z.js";import{RoveDaemonClient}from"./chunk-qzzmd63x.js";import{BUILTIN_VENDORS}from"./chunk-h2m7em1e.js";import{LockfileError,acquire,release}from"./chunk-bejhca6z.js";import{defaultDeliveryLockDir,defaultPtyHostSocketPath}from"./chunk-eqdbfgq5.js";function normalizeHex(value){let m=/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/.exec(value);if(!m)return null;let digits=m[1];if(digits.length===3){let[r,g,b]=digits;return`#${r}${r}${g}${g}${b}${b}`.toLowerCase()}return`#${digits.slice(0,6)}`.toLowerCase()}function rgbToHex({r,g,b}){let hex=(n)=>n.toString(16).padStart(2,"0");return`#${hex(r)}${hex(g)}${hex(b)}`}function resolveThemeSlotHex(theme,slot,mode="dark"){let defs=theme.defs??{};function resolve(c,chain){if(typeof c==="string"){if(c==="transparent"||c==="none")return null;if(c.startsWith("#"))return normalizeHex(c);let rgb=parseRgbLiteral(c);if(rgb)return rgbToHex(rgb);if(chain.includes(c))return null;let next=defs[c]??theme.theme[c];if(next===void 0)return null;return resolve(next,[...chain,c])}if(!c||typeof c!=="object")return null;let variant=c[mode];return typeof variant==="string"?resolve(variant,chain):null}let value=theme.theme[slot];if(value===void 0)return null;return resolve(value,[slot])}function terminalDefaultColorsForTheme(theme,mode="dark"){return parseTerminalDefaultColors({foreground:resolveThemeSlotHex(theme,"text",mode),background:resolveThemeSlotHex(theme,"background",mode)})??DEFAULT_TERMINAL_COLORS}function readPersistedTerminalDefaultColors(){let themes={...BUNDLED_THEMES};for(let{name,theme}of loadUserThemes())themes[name]=theme;let prefs=readPersistedUiPrefs(DEFAULT_THEME,(name)=>Boolean(themes[name])),selected=themes[prefs.theme]??themes[DEFAULT_THEME];return selected?terminalDefaultColorsForTheme(selected,prefs.themeMode==="light"?"light":"dark"):DEFAULT_TERMINAL_COLORS}async function enginePresence(pid,extraLaunch,snapshot=psSnapshot){if(!pid)return{kind:"none"};try{let rows=parsePsSnapshot(await snapshot([pid])),engine=foregroundEngineIn(rows,pid);if(engine)return{kind:"engine",vendor:engine.vendor};return engineProcessIn(rows,pid,extraLaunch)?{kind:"engine",vendor:null}:{kind:"none"}}catch{return{kind:"unknown"}}}import{basename}from"path";import path from"path";var DELIVERY_LOCK_TIMEOUT_MS=5000,DELIVERY_LOCK_RETRY_MS=20;function lockFileName(key){return`${key.replace(/[^A-Za-z0-9._-]/g,"_")}.lock`}function deliveryLockPath(key,lockDir=defaultDeliveryLockDir()){return path.join(lockDir,lockFileName(key))}var sleep=(ms)=>new Promise((resolve)=>setTimeout(resolve,ms));async function withDeliveryLock(key,fn,opts={}){let lockPath=deliveryLockPath(key,opts.lockDir??defaultDeliveryLockDir()),deadline=Date.now()+(opts.timeoutMs??DELIVERY_LOCK_TIMEOUT_MS),token=null;for(;;)try{token=await acquire(lockPath);break}catch(err){if(!(err instanceof LockfileError))break;if(Date.now()>=deadline)break;await sleep(DELIVERY_LOCK_RETRY_MS)}try{return await fn()}finally{if(token!==null)await release(lockPath,token).catch(()=>{})}}var PASTE_READY_TIMEOUT_MS=15000,PASTE_READY_POLL_MS=100;function bracketedPasteActive(output){let on=output.lastIndexOf("\x1B[?2004h");if(on===-1)return!1;return on>output.lastIndexOf("\x1B[?2004l")}function encodePaste(prompt,bracketed){return bracketed?`\x1B[200~${prompt}\x1B[201~`:prompt}async function connectHostedSessionClient(socketPath){let client=new RoveDaemonClient(socketPath);try{await client.connect()}catch(error){throw client.close(),error}return{rpc:client,close:()=>client.close()}}async function openHostedSessionHost(){try{return await connectHostedSessionClient(defaultPtyHostSocketPath())}catch{return null}}async function ensureHostedSessionHost(){return connectHostedSessionClient(await ensurePtyHostReachable())}async function listHostedSessionsOrNull(rpc){try{let{sessions}=await rpc.request("pty.list",{});return sessions??[]}catch{return null}}async function listHostedSessions(rpc){return await listHostedSessionsOrNull(rpc)??[]}function isHostedTaskKey(key,taskId){return(key.split("::")[0]??key)===taskId}function hostedTaskKeys(sessions,taskId,scope){return sessions.filter((session)=>isHostedTaskKey(session.key,taskId)&&!scope?.spare.some((base)=>isUnderKey(session.key,base))||(scope?.also.some((base)=>isUnderKey(session.key,base))??!1)).map((session)=>session.key)}async function killHostedSessions(rpc,keys,opts){let payload=opts?.wait===!0?{wait:!0}:{};await Promise.all(keys.map((key)=>rpc.request("pty.kill",{key,...payload}).catch(()=>{})))}function commandHasEngineWord(command,engineBin){for(let part of command)for(let token of part.split(/\s+/)){let bare=token.replace(/^['"]+|['"]+$/g,"");if(bare&&basename(bare)===engineBin)return!0}return!1}function builtinEngineBins(){return BUILTIN_VENDORS.flatMap((vendor)=>{let entry=engineEntry(vendor);return[entry.defaultCommand[0],...entry.processNames??[]]}).filter((bin)=>Boolean(bin))}function sessionArgvNamesEngine(command,engineBin){if(!command||command.length===0)return!1;if(engineBin&&commandHasEngineWord(command,engineBin))return!0;return builtinEngineBins().some((bin)=>commandHasEngineWord(command,bin))}function tabOrder(key){let n=Number(/tab-(\d+)$/.exec(key)?.[1]);return Number.isFinite(n)?n:Number.POSITIVE_INFINITY}function findHostedEngineKey(sessions,taskId,engineBin,scope){if(scope?.alias){let key=aliasKey(scope.alias);if(sessions.some((s)=>s.alive&&s.key===key))return key}let mine=unclaimedSessions(sessions,scope).filter((s)=>s.alive&&isHostedTaskKey(s.key,taskId)).sort((a,b)=>tabOrder(a.key)-tabOrder(b.key)),tab1=mine.find((s)=>s.key===`${taskId}::tab-1`);if(tab1)return tab1.key;if(engineBin){let byCommand=mine.find((s)=>commandHasEngineWord(s.command,engineBin));if(byCommand)return byCommand.key}return mine.find((s)=>sessionArgvNamesEngine(s.command))?.key??null}var SUBMIT_DELAY_MS=150,CONFIRM_TAIL_CHARS=24,CONFIRM_TIMEOUT_MS=2000,CONFIRM_POLL_MS=100;function flatten(text){return text.replace(/\s+/g," ")}async function confirmPromptLanded(rpc,key,prompt,sinceOffset){let tail=flatten(prompt).trim().slice(-CONFIRM_TAIL_CHARS);if(tail.length===0)return!1;let deadline=Date.now()+CONFIRM_TIMEOUT_MS;for(;;){let peek=await rpc.request("pty.peek",{key,sinceOffset});if(!peek.alive)return!1;if(flatten(Buffer.from(peek.data,"base64").toString("utf8")).includes(tail))return!0;if(Date.now()>=deadline)return!1;await new Promise((resolve)=>setTimeout(resolve,CONFIRM_POLL_MS))}}async function writeAndConfirm(rpc,key,prompt,sinceOffset,opts){let ready=await awaitPasteReady(rpc,key,{timeoutMs:opts?.pasteReadyTimeoutMs}),{bytes}=await writeHostedPrompt(rpc,key,prompt,{ready,vendor:opts?.vendor}),confirmed=await confirmPromptLanded(rpc,key,prompt,sinceOffset);return{bytes,ready,confirmed}}async function writeHostedPromptIfLive(rpc,key,prompt,opts){let peek=await rpc.request("pty.peek",{key});if(!peek.alive)return null;return writeAndConfirm(rpc,key,prompt,peek.offset,opts)}async function awaitPasteReady(rpc,key,opts={}){let sleep2=opts.sleep??((ms)=>new Promise((resolve)=>setTimeout(resolve,ms))),deadline=Date.now()+(opts.timeoutMs??PASTE_READY_TIMEOUT_MS);for(;;){let peek=await rpc.request("pty.peek",{key});if(!peek.alive)return!1;if(bracketedPasteActive(Buffer.from(peek.data,"base64").toString("latin1")))return!0;if(Date.now()>=deadline)return!1;await sleep2(PASTE_READY_POLL_MS)}}async function writeHostedPrompt(rpc,key,prompt,opts){let bracketed=opts?.ready??await awaitPasteReady(rpc,key),capabilities=opts?.vendor?engineEntry(opts.vendor).capabilities:void 0,prepared=capabilities?.preparePromptSubmission?.(prompt),data=encodePaste(prepared??prompt,bracketed);return await withDeliveryLock(key,async()=>{await rpc.request("pty.write",{key,data}),await new Promise((resolve)=>setTimeout(resolve,SUBMIT_DELAY_MS)),await rpc.request("pty.write",{key,data:`${capabilities?.beforePromptSubmit??""}\r`})}),{bytes:Buffer.byteLength(data,"utf8")}}var deliverToHostedKey=writeHostedPromptIfLive;async function ensureHostedEngine(rpc,cwd,launch,defaultColors=readPersistedTerminalDefaultColors()){let result=await rpc.request("pty.open",{key:launch.key,cwd,command:launch.command,defaultColors});return await rpc.request("pty.detach",{key:launch.key}).catch(()=>{}),result}var FIRST_MESSAGE_ENGINE_TIMEOUT_MS=20000,FIRST_MESSAGE_POLL_INTERVAL_MS=500,FIRST_MESSAGE_SETTLE_MS=1500;async function awaitEngineProcess(rpc,key,engineBin,opts={}){let sleep2=opts.sleep??((ms)=>new Promise((resolve)=>setTimeout(resolve,ms))),snapshot=opts.snapshot;if(opts.initMarkerPath){let initDeadline=Date.now()+(opts.initTimeoutMs??REPO_INIT_TIMEOUT_SECONDS*1000);while(Date.now()<initDeadline){let{sessions=[]}=await rpc.request("pty.list",{});if(!sessions.find((s)=>s.key===key)?.alive)return null;if(initMarkerSaysFinished(opts.initMarkerPath))break;await sleep2(opts.intervalMs??FIRST_MESSAGE_POLL_INTERVAL_MS)}}let deadline=Date.now()+(opts.timeoutMs??FIRST_MESSAGE_ENGINE_TIMEOUT_MS);while(Date.now()<deadline){let{sessions=[]}=await rpc.request("pty.list",{}),session=sessions.find((s)=>s.key===key);if(!session?.alive)return null;if(session.pid){let presence=await enginePresence(session.pid,engineBin,snapshot);if(presence.kind==="engine")return{pid:session.pid,vendor:presence.vendor}}await sleep2(opts.intervalMs??FIRST_MESSAGE_POLL_INTERVAL_MS)}return null}async function hostedSessionFailureLine(rpc,key,limit=200){try{let peek=await rpc.request("pty.peek",{key}),lines=terminalRows(Buffer.from(peek.data,"base64").toString("utf8")).map((row)=>row.trim()).filter((row)=>row.length>0),line=lines.findLast((row)=>ENGINE_EXIT_BANNER.test(row))??lines.at(-1);return line===void 0?void 0:line.slice(0,limit)}catch{return}}async function pastePromptWhenEngineUp(rpc,key,engineBin,prompt,opts={}){let sleep2=opts.sleep??((ms)=>new Promise((resolve)=>setTimeout(resolve,ms))),engine=await awaitEngineProcess(rpc,key,engineBin,opts);if(engine!==null){if(!await awaitPasteReady(rpc,key,{timeoutMs:opts.pasteReadyTimeoutMs,sleep:sleep2}))await sleep2(opts.settleMs??FIRST_MESSAGE_SETTLE_MS);return await writeHostedPromptIfLive(rpc,key,prompt,{...opts,vendor:engine.vendor})}return null}
|
|
3
3
|
export{resolveThemeSlotHex,readPersistedTerminalDefaultColors,withDeliveryLock,enginePresence,awaitEngineProcess,hostedSessionFailureLine,pastePromptWhenEngineUp,openHostedSessionHost,ensureHostedSessionHost,listHostedSessionsOrNull,listHostedSessions,isHostedTaskKey,hostedTaskKeys,killHostedSessions,sessionArgvNamesEngine,findHostedEngineKey,deliverToHostedKey,ensureHostedEngine};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{AUTO_MACHINE,LOCAL_MACHINE,forwardVerb,invokeRouted,machineDaemonSocket,machinePtySocket,machineTasks,pickMachine,repoHosts,repoWanted,requireMachine,routeTarget}from"./chunk-ta1p2nwa.js";import"./chunk-vytrhm50.js";import"./chunk-vp29jgbt.js";import"./chunk-gq36nzg8.js";import"./chunk-sq6zj3fb.js";import"./chunk-tw9tfs1d.js";import"./chunk-61cn88e7.js";import"./chunk-atg13xab.js";import"./chunk-r5j8fycq.js";import"./chunk-xfgqae9t.js";import"./chunk-j1z9kgyd.js";import"./chunk-g9ba25q5.js";import"./chunk-ggnq2vvk.js";import"./chunk-hpay0ax8.js";import"./chunk-catrr0z3.js";import"./chunk-mdc7b01e.js";import"./chunk-tn9gtf18.js";import"./chunk-895yqjjz.js";import"./chunk-sak1tphp.js";import"./chunk-y1xnjx8x.js";import"./chunk-e58kj4gm.js";import"./chunk-0a65j1zj.js";import"./chunk-bcyex84w.js";import"./chunk-vvqwgcge.js";import"./chunk-x83xbzjd.js";import"./chunk-2tfnscxk.js";import"./chunk-hzz020xx.js";import"./chunk-w7zv47mp.js";import"./chunk-rfp0ayra.js";import"./chunk-40dgv828.js";import"./chunk-zsfyj36g.js";import"./chunk-2r1fgng9.js";import"./chunk-2brn8e1y.js";import"./chunk-7mwvvj46.js";import"./chunk-32j6y5d1.js";import"./chunk-mjyhy152.js";import"./chunk-wzss4pzh.js";import"./chunk-cmp64q4j.js";import"./chunk-qzzmd63x.js";import"./chunk-96kvwzj8.js";import"./chunk-7bakcyes.js";import"./chunk-8qkyd589.js";import"./chunk-7kysxgbq.js";import"./chunk-hz1x3hak.js";import"./chunk-x1jxxmtc.js";import"./chunk-xy8be792.js";import"./chunk-h2m7em1e.js";import"./chunk-7ghwdjdc.js";import"./chunk-8t7qbr1e.js";import"./chunk-bejhca6z.js";import"./chunk-br8r72bf.js";import"./chunk-yt15y085.js";import"./chunk-z1nj22va.js";import"./chunk-zt7wfnva.js";import"./chunk-0g4wc808.js";import"./chunk-pn5ygqn6.js";import"./chunk-eqdbfgq5.js";import"./chunk-f8gg8cqh.js";import"./chunk-nc46gddg.js";import"./chunk-pxk2c2vj.js";import"./chunk-91sykzqq.js";export{routeTarget,requireMachine,repoWanted,repoHosts,pickMachine,machineTasks,machinePtySocket,machineDaemonSocket,invokeRouted,forwardVerb,LOCAL_MACHINE,AUTO_MACHINE};
|