rovecode 0.4.0-beta.2 → 0.4.0-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (189) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/README.md +13 -0
  3. package/dist/cli/app-j6gn14w3.js +2 -0
  4. package/dist/cli/{ask-user-p8hq4xgj.js → ask-user-cwstt8fz.js} +1 -1
  5. package/dist/cli/auth-login-9bbp9915.js +2 -0
  6. package/dist/cli/{bench-xv3ypwev.js → bench-16zqdms5.js} +1 -1
  7. package/dist/cli/catalog-1xchffa4.js +2 -0
  8. package/dist/cli/cli-1n1zb64f.js +2 -0
  9. package/dist/cli/client-2t9gjkck.js +2 -0
  10. package/dist/cli/{commands-3p7e4xxs.js → commands-exafvm2b.js} +1 -1
  11. package/dist/cli/connect-6zde0kn3.js +2 -0
  12. package/dist/cli/{context-cmd-eqxmxhzq.js → context-cmd-5t43wgqt.js} +1 -1
  13. package/dist/cli/context-report-kt01pw8y.js +2 -0
  14. package/dist/cli/{count-remote-mby98cd0.js → count-remote-ap7x3vh6.js} +1 -1
  15. package/dist/cli/{design-122y0axd.js → design-ne5zszyh.js} +1 -1
  16. package/dist/cli/dispatch-2r5myxye.js +2 -0
  17. package/dist/cli/doctor-ws4fh4tn.js +3 -0
  18. package/dist/cli/{executor-ftvg6tsy.js → executor-bdrjn634.js} +1 -1
  19. package/dist/cli/export-1mxb9g5p.js +2 -0
  20. package/dist/cli/{files-cez9a96p.js → files-g104xghh.js} +1 -1
  21. package/dist/cli/gauntlet-07xrjpj7.js +2 -0
  22. package/dist/cli/{gauntlet-runner-r515m7kk.js → gauntlet-runner-xvy64436.js} +1 -1
  23. package/dist/cli/{gauntlet-wave3-bnkjk2v2.js → gauntlet-wave3-jm91yt5w.js} +1 -1
  24. package/dist/cli/{gauntlet-wave4-acs9s60q.js → gauntlet-wave4-r13py7p1.js} +1 -1
  25. package/dist/cli/hashline-znvrat11.js +2 -0
  26. package/dist/cli/http-xafw6fsh.js +143 -0
  27. package/dist/cli/{index-z5qt1s76.js → index-1sgjm25y.js} +1 -1
  28. package/dist/cli/init-g2m0tn4m.js +51 -0
  29. package/dist/cli/install-avaqjjqq.js +2 -0
  30. package/dist/cli/loop-mmpfft01.js +2 -0
  31. package/dist/cli/{main-a3f51n0x.js → main-0904f6ps.js} +1 -1
  32. package/dist/cli/{main-f33fc5je.js → main-0ab9fc26.js} +2 -2
  33. package/dist/cli/{main-n6qrdbmy.js → main-0mtcdbs7.js} +2 -2
  34. package/dist/cli/main-0z1w2zsg.js +3 -0
  35. package/dist/cli/{main-rvetps99.js → main-1dchs7xv.js} +2 -2
  36. package/dist/cli/{main-rpg7h8mb.js → main-1ereejm1.js} +2 -2
  37. package/dist/cli/{main-6vjeds42.js → main-1k1kw6b5.js} +2 -2
  38. package/dist/cli/{main-hrrvcfan.js → main-27y4sm2k.js} +2 -2
  39. package/dist/cli/{main-8c1tbazx.js → main-2wwjex5j.js} +2 -2
  40. package/dist/cli/main-2yfck9b5.js +3 -0
  41. package/dist/cli/main-2zmzgkwh.js +3 -0
  42. package/dist/cli/{main-xt9zc3n6.js → main-351pz3z7.js} +1 -1
  43. package/dist/cli/{main-kba6zeyd.js → main-3gjqfh7a.js} +1 -1
  44. package/dist/cli/{main-s4bb0jav.js → main-3nf3kgve.js} +1 -1
  45. package/dist/cli/{main-2z3dek0b.js → main-3pjrb2hd.js} +1 -1
  46. package/dist/cli/{main-qj2djy17.js → main-3rxcvgna.js} +3 -3
  47. package/dist/cli/{main-9a9rnh47.js → main-4b3jgy66.js} +1 -1
  48. package/dist/cli/{main-6dtqmbt6.js → main-4wndhjdc.js} +1 -1
  49. package/dist/cli/{main-9ht36z12.js → main-4xcmvxnk.js} +2 -2
  50. package/dist/cli/{main-vp2dfb7s.js → main-5tbz0wbz.js} +2 -2
  51. package/dist/cli/{main-wpkyraxh.js → main-5ywnwthm.js} +2 -2
  52. package/dist/cli/{main-yrjt2sqt.js → main-6b62vkz0.js} +2 -2
  53. package/dist/cli/{main-2zgsknth.js → main-6dnk69vp.js} +1 -1
  54. package/dist/cli/{main-nvc3yjay.js → main-6genrmhs.js} +2 -2
  55. package/dist/cli/{main-rsy72qmw.js → main-73g7eff4.js} +2 -2
  56. package/dist/cli/{main-jak598k9.js → main-7c5thhjd.js} +1 -1
  57. package/dist/cli/{main-y5c82rxr.js → main-7rn6bqje.js} +1 -1
  58. package/dist/cli/{main-4p4e2w7x.js → main-80haw7qk.js} +2 -2
  59. package/dist/cli/{main-01pv9206.js → main-875s60s2.js} +2 -2
  60. package/dist/cli/{main-ywbxshqc.js → main-8kjxbpw4.js} +1 -1
  61. package/dist/cli/{main-1ztz6fkj.js → main-90ds1z4e.js} +1 -1
  62. package/dist/cli/{main-mjt2p7aj.js → main-9etavkew.js} +1 -1
  63. package/dist/cli/main-a9njrkk1.js +3 -0
  64. package/dist/cli/{main-fvnpq46y.js → main-aecrjq2d.js} +2 -2
  65. package/dist/cli/{main-23q7cmww.js → main-ck9asesq.js} +2 -2
  66. package/dist/cli/{main-wqt32p5x.js → main-cta9racd.js} +2 -2
  67. package/dist/cli/{main-wm997zjx.js → main-ddv7j2ag.js} +1 -1
  68. package/dist/cli/{main-ntqef02r.js → main-dfreez27.js} +1 -1
  69. package/dist/cli/{main-m8vm17zq.js → main-f7rw7des.js} +1 -1
  70. package/dist/cli/{main-rebtt91r.js → main-ggcn7rd7.js} +2 -2
  71. package/dist/cli/{main-gbbty4d4.js → main-gzkmycnv.js} +1 -1
  72. package/dist/cli/{main-vxnwe5xx.js → main-hq51jg8v.js} +2 -2
  73. package/dist/cli/{main-vqbr22sz.js → main-jft389w9.js} +2 -2
  74. package/dist/cli/{main-qvarybsp.js → main-k1eqkg83.js} +2 -2
  75. package/dist/cli/{main-2wyax8k9.js → main-k2y8a2aw.js} +2 -2
  76. package/dist/cli/main-kcpbykxz.js +4 -0
  77. package/dist/cli/{main-45rn3trk.js → main-kd488vje.js} +1 -1
  78. package/dist/cli/main-kh32yvgk.js +5 -0
  79. package/dist/cli/{main-z13755t8.js → main-kqxnqjnv.js} +4 -4
  80. package/dist/cli/{main-b8zq261k.js → main-kyn0xnsg.js} +2 -2
  81. package/dist/cli/{main-evgz4mp5.js → main-m1kk6fp5.js} +1 -1
  82. package/dist/cli/{main-5py0rkmc.js → main-mv40pcr2.js} +1 -1
  83. package/dist/cli/{main-vhrrq337.js → main-n0t3973w.js} +1 -1
  84. package/dist/cli/{main-s9v8k74e.js → main-pknhvrmj.js} +2 -2
  85. package/dist/cli/{main-kwwsz6rq.js → main-pn1w7a7j.js} +2 -2
  86. package/dist/cli/{main-6h9x282m.js → main-prxxs70n.js} +2 -2
  87. package/dist/cli/{main-2rzbexn2.js → main-q3vsesf9.js} +1 -1
  88. package/dist/cli/{main-gth53dnt.js → main-rdgdw24b.js} +7 -7
  89. package/dist/cli/{main-4y0tnfpa.js → main-rfth4tbm.js} +1 -1
  90. package/dist/cli/{main-wk2csfnj.js → main-rg0wn0xf.js} +2 -2
  91. package/dist/cli/{main-xx2z3zh5.js → main-sdmxhtv8.js} +1 -1
  92. package/dist/cli/{main-mg9b20ac.js → main-skbp13js.js} +1 -1
  93. package/dist/cli/{main-xfekqh9m.js → main-t4xnd213.js} +1 -1
  94. package/dist/cli/{main-7kt6r53y.js → main-vqak588n.js} +2 -2
  95. package/dist/cli/{main-hqbz10aw.js → main-w2n1303f.js} +1 -1
  96. package/dist/cli/{main-na7wse0x.js → main-wbrdspr2.js} +2 -2
  97. package/dist/cli/{main-a2yfvcy9.js → main-wsrg79c1.js} +2 -2
  98. package/dist/cli/{main-hzwtsb2m.js → main-x4r0fne4.js} +2 -2
  99. package/dist/cli/{main-78gq4bt9.js → main-xea2f3tn.js} +1 -1
  100. package/dist/cli/{main-v8y60bb2.js → main-xg704a3c.js} +1 -1
  101. package/dist/cli/{main-p0cfn6nr.js → main-xvnrabfp.js} +2 -2
  102. package/dist/cli/{main-45ejth3a.js → main-xy53xf0r.js} +2 -2
  103. package/dist/cli/{main-x9ct6y1a.js → main-y1fqy60y.js} +2 -2
  104. package/dist/cli/{main-j7ttv0sd.js → main-yn8cd281.js} +4 -4
  105. package/dist/cli/{main-zc7pyrbj.js → main-yr0ksc0h.js} +1 -1
  106. package/dist/cli/{main-tkgarpjj.js → main-z2ex2vyf.js} +2 -2
  107. package/dist/cli/{main-mgb9ccnx.js → main-z3aayzvq.js} +1 -1
  108. package/dist/cli/{main-tjvwmscs.js → main-zaqh35jg.js} +2 -2
  109. package/dist/cli/{main-edxc3yzt.js → main-zc2e8e46.js} +2 -2
  110. package/dist/cli/{main-bxtvnf6d.js → main-zzrfw6cf.js} +2 -2
  111. package/dist/cli/main.js +5 -4
  112. package/dist/cli/{market-cmd-bm5xvn9f.js → market-cmd-e14kmx9n.js} +2 -2
  113. package/dist/cli/{mcp-login-bthtfpt7.js → mcp-login-wq7ktdek.js} +1 -1
  114. package/dist/cli/mcp-market-cmd-9mg3jecy.js +2 -0
  115. package/dist/cli/{notify-54v5z9dz.js → notify-b7qc0cjb.js} +1 -1
  116. package/dist/cli/{oauth-g5gme95c.js → oauth-z8whcgfx.js} +1 -1
  117. package/dist/cli/{output-satndjap.js → output-b3ewj3ps.js} +1 -1
  118. package/dist/cli/{profiles-sfhpbq3m.js → profiles-6mr5he5e.js} +1 -1
  119. package/dist/cli/{provider-config-hv3xtdt4.js → provider-config-g7j42q8x.js} +1 -1
  120. package/dist/cli/provider-jr1y8vvm.js +2 -0
  121. package/dist/cli/registry-s8yk86g0.js +2 -0
  122. package/dist/cli/{registry-fh0hdnyn.js → registry-t6p8d4mn.js} +1 -1
  123. package/dist/cli/{repl-t4z03mqq.js → repl-bajwe1mh.js} +1 -1
  124. package/dist/cli/{resume-fqt4chg8.js → resume-rwn9nz7y.js} +1 -1
  125. package/dist/cli/run-flags-nah7ndpt.js +2 -0
  126. package/dist/cli/runtime-n7gafzhb.js +2 -0
  127. package/dist/cli/{sandbox-config-g4qxd7y5.js → sandbox-config-emdy18x4.js} +1 -1
  128. package/dist/cli/{server-r0b6bksk.js → server-b0nvs2bn.js} +1 -1
  129. package/dist/cli/session-arg-y75wd4kj.js +2 -0
  130. package/dist/cli/session-j62evmjq.js +2 -0
  131. package/dist/cli/{sessions-cmd-adw7svfn.js → sessions-cmd-tsnwz0ns.js} +1 -1
  132. package/dist/cli/{settings-y9rzcqx8.js → settings-df10wfez.js} +1 -1
  133. package/dist/cli/{setup-jmbr11j0.js → setup-jzvv72fg.js} +1 -1
  134. package/dist/cli/{sextant-smoke-tcth0vea.js → sextant-smoke-37m81ke6.js} +1 -1
  135. package/dist/cli/{skills-cmd-zbdy99v6.js → skills-cmd-gjxnxnhx.js} +1 -1
  136. package/dist/cli/smoke-p7748apt.js +8 -0
  137. package/dist/cli/{start-chat-p01cdks3.js → start-chat-s4st3mm0.js} +3 -3
  138. package/dist/cli/stream-gmeyewds.js +2 -0
  139. package/dist/cli/task-gh0kkp3n.js +2 -0
  140. package/dist/cli/tasks-z1kfpe8e.js +2 -0
  141. package/dist/cli/{thinking-a5ngvqyh.js → thinking-0eqkrz6t.js} +1 -1
  142. package/dist/cli/{todo-1wxpcecx.js → todo-5brcrt9m.js} +1 -1
  143. package/dist/cli/{tools-x1tj4fxm.js → tools-7pzm0vj9.js} +1 -1
  144. package/dist/cli/{tools-2ftsya7w.js → tools-s635p6s8.js} +1 -1
  145. package/dist/cli/trust-cmd-cjav8zgm.js +2 -0
  146. package/dist/cli/{update-check-ygt3vd7m.js → update-check-pt31bm2f.js} +1 -1
  147. package/dist/cli/{update-cmd-v23qhr8c.js → update-cmd-tk131s9t.js} +1 -1
  148. package/dist/cli/{voice-g1gtck92.js → voice-56nabd8d.js} +1 -1
  149. package/dist/cli/{webfetch-0nnrjgb5.js → webfetch-xd8q596m.js} +1 -1
  150. package/dist/cli/{websearch-f0vr2p7d.js → websearch-5hkf98k1.js} +1 -1
  151. package/dist/cli/workflow-cmd-cy3cvzjp.js +4 -0
  152. package/dist/cli/{workspace-9rq1w4ta.js → workspace-q10g5z3e.js} +1 -1
  153. package/dist/lib/index.js +44 -44
  154. package/dist/lib/plugins.js +54 -5
  155. package/dist/lib/public-api.js +15 -15
  156. package/dist/lib/sdk.js +360 -0
  157. package/package.json +3 -2
  158. package/dist/cli/app-dybnr56b.js +0 -2
  159. package/dist/cli/auth-login-ewpgw5sm.js +0 -2
  160. package/dist/cli/catalog-737wb2s0.js +0 -2
  161. package/dist/cli/cli-arhg40m0.js +0 -2
  162. package/dist/cli/client-cf2pxx8q.js +0 -2
  163. package/dist/cli/connect-3q93d7cb.js +0 -2
  164. package/dist/cli/context-report-hbw9zfes.js +0 -2
  165. package/dist/cli/dispatch-b4egzvvh.js +0 -2
  166. package/dist/cli/doctor-x4jkv72e.js +0 -3
  167. package/dist/cli/export-pdgdhkch.js +0 -2
  168. package/dist/cli/gauntlet-r3xxaszc.js +0 -2
  169. package/dist/cli/hashline-ewg5hbe3.js +0 -2
  170. package/dist/cli/http-n0kehsk8.js +0 -5
  171. package/dist/cli/install-80mp63kx.js +0 -2
  172. package/dist/cli/loop-12twjcat.js +0 -2
  173. package/dist/cli/main-7jd5vh3x.js +0 -4
  174. package/dist/cli/main-mg4f96e1.js +0 -3
  175. package/dist/cli/main-wgph00xf.js +0 -5
  176. package/dist/cli/main-ys6zj3yr.js +0 -3
  177. package/dist/cli/mcp-market-cmd-mbeshfyd.js +0 -2
  178. package/dist/cli/provider-kwzq6g84.js +0 -2
  179. package/dist/cli/registry-y1y8e94r.js +0 -2
  180. package/dist/cli/run-flags-rysbag9t.js +0 -2
  181. package/dist/cli/runtime-j19fjbsa.js +0 -2
  182. package/dist/cli/session-arg-txmn5g4x.js +0 -2
  183. package/dist/cli/session-ed250d9j.js +0 -2
  184. package/dist/cli/smoke-1bg937kx.js +0 -8
  185. package/dist/cli/stream-4wmyaypz.js +0 -2
  186. package/dist/cli/task-eg4s093s.js +0 -2
  187. package/dist/cli/tasks-12v9rr9k.js +0 -2
  188. package/dist/cli/trust-cmd-hccxehzb.js +0 -2
  189. package/dist/rovecode.exe +0 -4
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{Am as V,Bm as z,Cm as G,Dm as P,Em as A,Fm as k,Gm as I,Hm as _,Im as b,Jm as t,zm as S}from"./main-mjt2p7aj.js";function H(Q,q,$="login cancelled"){return new Promise((Y,Z)=>{if(q.aborted){Z(Error($));return}let W=()=>{clearTimeout(K),Z(Error($))},K=setTimeout(()=>{q.removeEventListener("abort",W),Y()},Q);q.addEventListener("abort",W,{once:!0})})}async function y(Q){let q=Q.now??Date.now,$=Q.sleep??H,Y=typeof Q.expiresInSeconds==="number"?q()+Q.expiresInSeconds*1000:Number.POSITIVE_INFINITY,Z=Math.max(1000,Math.floor((Q.intervalSeconds??5)*1000)),W=0;if(Q.waitBeforeFirstPoll){let K=Y-q();if(K>0)await $(Math.min(Z,K),Q.signal)}while(q()<Y){if(Q.signal.aborted)throw Error("login cancelled");let K=await Q.poll();if(K.status==="complete")return K.value;if(K.status==="failed")throw Error(K.message);if(K.status==="slow_down")W+=1,Z=typeof K.intervalSeconds==="number"&&Number.isFinite(K.intervalSeconds)&&K.intervalSeconds>0?Math.max(1000,Math.floor(K.intervalSeconds*1000)):Math.max(1000,Z+5000);let X=Y-q();if(X<=0)break;await $(Math.min(Z,X),Q.signal)}throw Error(W>0?"device flow timed out after one or more slow_down responses (often clock drift in a WSL/VM \u2014 sync the clock and retry)":"device flow timed out")}P();var T={deviceCodeUrl:"https://github.com/login/device/code",accessTokenUrl:"https://github.com/login/oauth/access_token",copilotTokenUrl:"https://api.github.com/copilot_internal/v2/token"},N=atob("SXYxLmI1MDdhMDhjODdlY2ZlOTg="),L="GitHubCopilotChat/0.35.0",j={"User-Agent":L,"Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},O="https://api.individual.githubcopilot.com",E=300000,C="gpt-4o";function v(Q){let q=/proxy-ep=([^;]+)/.exec(Q);if(!q||!q[1])return null;return`https://${q[1].replace(/^proxy\./,"api.")}`}async function f(Q,q,$,Y,Z){let W=await G(Q,q,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/x-www-form-urlencoded","User-Agent":L},body:new URLSearchParams($).toString()},Y);if(!W.ok)throw await V(Z,W);return z(W,Z)}async function u(Q,q,$){let Y=await f(q,Q.deviceCodeUrl,{client_id:N,scope:"read:user"},$,"GitHub device code request"),{device_code:Z,user_code:W,verification_uri:K,interval:X,expires_in:J}=Y;if(typeof Z!=="string"||typeof W!=="string"||typeof K!=="string"||X!==void 0&&typeof X!=="number"||typeof J!=="number")throw Error("GitHub device code response is missing fields");let x;try{x=new URL(K)}catch{throw Error("GitHub device code response carries an untrusted verification_uri")}if(x.protocol!=="https:"&&x.protocol!=="http:")throw Error("GitHub device code response carries an untrusted verification_uri");return{deviceCode:Z,userCode:W,verificationUri:x.href,interval:X,expiresIn:J}}function g(Q,q,$,Y){return y({intervalSeconds:q.interval,expiresInSeconds:q.expiresIn,waitBeforeFirstPoll:!0,signal:Y,sleep:$.sleep,now:$.now,poll:async()=>{let Z=await f($,Q.accessTokenUrl,{client_id:N,device_code:q.deviceCode,grant_type:"urn:ietf:params:oauth:grant-type:device_code"},Y,"GitHub device token poll");if(typeof Z.access_token==="string"&&Z.access_token.length>0)return{status:"complete",value:Z.access_token};if(typeof Z.error==="string"){if(Z.error==="authorization_pending")return{status:"pending"};if(Z.error==="slow_down")return{status:"slow_down",intervalSeconds:typeof Z.interval==="number"?Z.interval:void 0};return{status:"failed",message:`GitHub device flow failed: ${Z.error}${typeof Z.error_description==="string"?` \u2014 ${Z.error_description.slice(0,160)}`:""}`}}return{status:"failed",message:"GitHub device token response is missing fields"}}})}async function M(Q,q,$,Y){let Z=await G($,Q.copilotTokenUrl,{headers:{Accept:"application/json",Authorization:`Bearer ${q}`,...j}},Y);if(!Z.ok)throw await V("Copilot token exchange",Z);let W=await z(Z,"Copilot token exchange"),{token:K,expires_at:X}=W;if(typeof K!=="string"||K.length===0||typeof X!=="number")throw Error("Copilot token response is missing fields");return{type:"oauth",access:K,refresh:q,expires:X*1000-E}}function R(Q=T){return{id:"github-copilot",label:"GitHub Copilot (device code)",defaultModel:C,async login(q,$){let Y=await u(Q,$,q.signal);q.notify({type:"device_code",userCode:Y.userCode,verificationUri:Y.verificationUri,intervalSeconds:Y.interval??5,expiresInSeconds:Y.expiresIn});let Z=await g(Q,Y,$,q.signal);return q.notify({type:"progress",message:"authorized \u2014 exchanging for a Copilot token"}),M(Q,Z,$,q.signal)},refresh(q,$,Y){return M(Q,q.refresh,Y,$)},toAuth(q){return{apiKey:q.access,baseUrl:Q.chatBaseUrl??v(q.access)??O,headers:{...j}}}}}P();var B="https://auth.openai.com",h={deviceUserCodeUrl:`${B}/api/accounts/deviceauth/usercode`,deviceTokenUrl:`${B}/api/accounts/deviceauth/token`,tokenUrl:`${B}/oauth/token`,deviceVerificationUri:`${B}/codex/device`,deviceRedirectUri:`${B}/deviceauth/callback`,responsesBaseUrl:"https://chatgpt.com/backend-api/codex"},l={"OpenAI-Beta":"responses=experimental",originator:"rovecode"},F="app_EMoamEEZ73f0CkXaXp7hrann",D=900,c="https://api.openai.com/auth";function p(Q){try{let q=Q.split(".");if(q.length!==3||!q[1])return;let $=q[1].replace(/-/g,"+").replace(/_/g,"/"),Z=JSON.parse(atob($+"=".repeat((4-$.length%4)%4)))[c],W=typeof Z==="object"&&Z!==null?Z.chatgpt_account_id:void 0;return typeof W==="string"&&W.length>0?W:void 0}catch{return}}async function a(Q,q,$){if(!Q.ok)throw await V(q,Q);let Y=await z(Q,q),{access_token:Z,refresh_token:W,expires_in:K}=Y;if(typeof Z!=="string"||Z.length===0||typeof W!=="string"||typeof K!=="number")throw Error(`${q}: response is missing fields`);let X=p(Z);return{type:"oauth",access:Z,refresh:W,expires:$()+K*1000,...X!==void 0?{accountId:X}:{}}}async function d(Q,q,$){let Y=await G(q,Q.deviceUserCodeUrl,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:F})},$);if(Y.status===404)throw Error("OpenAI device code login is not enabled for this server (HTTP 404)");if(!Y.ok)throw await V("OpenAI device code request",Y);let Z=await z(Y,"OpenAI device code request"),{device_auth_id:W,user_code:K,interval:X}=Z,J=typeof X==="string"?Number(X.trim()):X;if(typeof W!=="string"||!W||typeof K!=="string"||!K||typeof J!=="number"||!Number.isFinite(J)||J<0)throw Error("OpenAI device code response is missing fields");return{deviceAuthId:W,userCode:K,intervalSeconds:J}}function r(Q,q,$,Y){return y({intervalSeconds:q.intervalSeconds,expiresInSeconds:D,signal:Y,sleep:$.sleep,now:$.now,poll:async()=>{let Z=await G($,Q.deviceTokenUrl,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({device_auth_id:q.deviceAuthId,user_code:q.userCode})},Y);if(Z.ok){let K=await z(Z,"OpenAI device token poll"),{authorization_code:X,code_verifier:J}=K;if(typeof X!=="string"||!X||typeof J!=="string"||!J)return{status:"failed",message:"OpenAI device token response is missing fields"};return{status:"complete",value:{authorizationCode:X,codeVerifier:J}}}if(Z.status===403||Z.status===404)return{status:"pending"};let W;try{let K=await Z.json();W=typeof K?.error==="object"?K.error?.code:K?.error}catch{}if(W==="deviceauth_authorization_pending")return{status:"pending"};if(W==="slow_down")return{status:"slow_down"};return{status:"failed",message:`OpenAI device authorization failed (HTTP ${Z.status})${typeof W==="string"?`: ${W.slice(0,80)}`:""}`}}})}async function U(Q,q,$,Y,Z){let W=await G($,Q.tokenUrl,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams(q).toString()},Y);return a(W,Z,$.now)}function m(Q=h){return{id:"openai",label:"OpenAI / ChatGPT (device code)",async login(q,$){let Y=await d(Q,$,q.signal);q.notify({type:"device_code",userCode:Y.userCode,verificationUri:Q.deviceVerificationUri,intervalSeconds:Y.intervalSeconds,expiresInSeconds:D});let Z=await r(Q,Y,$,q.signal);return q.notify({type:"progress",message:"authorized \u2014 exchanging the authorization code"}),U(Q,{grant_type:"authorization_code",client_id:F,code:Z.authorizationCode,code_verifier:Z.codeVerifier,redirect_uri:Q.deviceRedirectUri},$,q.signal,"OpenAI token exchange")},refresh(q,$,Y){return U(Q,{grant_type:"refresh_token",refresh_token:q.refresh,client_id:F},Y,$,"OpenAI token refresh")},toAuth(q){return{apiKey:q.access,baseUrl:Q.responsesBaseUrl,wire:"responses",headers:{...q.accountId?{"chatgpt-account-id":q.accountId}:{},...l}}}}}P();I();t();I();var n={authorizeUrl:"https://openrouter.ai/auth",keysUrl:"https://openrouter.ai/api/v1/auth/keys",chatBaseUrl:"https://openrouter.ai/api/v1"},Gq=A("OpenRouter");async function i(Q,q,$,Y,Z){let W=await G(Y,Q.keysUrl,{method:"POST",headers:{accept:"application/json","content-type":"application/json"},body:JSON.stringify({code:q,code_verifier:$,code_challenge_method:"S256"})},Z);if(!W.ok)throw await V("OpenRouter key exchange",W);let K=await z(W,"OpenRouter key exchange");if(typeof K.key!=="string"||K.key.length===0)throw Error("OpenRouter key exchange: response carries no key");return K.key}async function o(Q,q,$){if(q.signal.aborted)throw S();let{verifier:Y,challenge:Z}=await _(),W=b(),K=k({nonce:W,signal:q.signal,what:"OpenRouter",retryHint:"Run rovecode auth login openrouter again.",onCode:async(J)=>({type:"oauth",access:await i(Q,J,Y,$,q.signal),refresh:"",expires:Number.MAX_SAFE_INTEGER})}),X=new URL(Q.authorizeUrl);X.search=new URLSearchParams({callback_url:K.callbackUrl,code_challenge:Z,code_challenge_method:"S256"}).toString();try{return q.notify({type:"auth_url",url:X.toString(),callbackUrl:K.callbackUrl}),await K.result}finally{K.stop()}}function w(Q=n){return{id:"openrouter",label:"OpenRouter (PKCE, browser + loopback callback)",login:(q,$)=>o(Q,q,$),async refresh(q){return q},toAuth(q){return{apiKey:q.access,baseUrl:Q.chatBaseUrl}}}}var Fq=["github-copilot","openrouter","openai"],Mq={anthropic:"Anthropic OAuth (the Claude subscription login) is an owner decision, not a port \u2014 third-party harnesses that used it were cut off in the Jan-2026 crackdown (research/round3_landscape.md:64-66); use `rovecode auth set anthropic` with an API key."};function s(){return[R(),w(),m()]}function Nq(Q){return s().find((q)=>q.id===Q)}function Lq(){return{fetch:(Q,q)=>fetch(Q,q),now:()=>Date.now(),sleep:(Q,q)=>H(Q,q)}}
3
- export{Fq as Fi,Mq as Gi,s as Hi,Nq as Ii,Lq as Ji};
2
+ import{Hj as S,Ij as V,Jj as z,Kj as G,Lj as P,Mj as A,Nj as k,Oj as I,Pj as _,Qj as b,Rj as t}from"./main-9etavkew.js";function H(Q,q,$="login cancelled"){return new Promise((Y,Z)=>{if(q.aborted){Z(Error($));return}let W=()=>{clearTimeout(K),Z(Error($))},K=setTimeout(()=>{q.removeEventListener("abort",W),Y()},Q);q.addEventListener("abort",W,{once:!0})})}async function y(Q){let q=Q.now??Date.now,$=Q.sleep??H,Y=typeof Q.expiresInSeconds==="number"?q()+Q.expiresInSeconds*1000:Number.POSITIVE_INFINITY,Z=Math.max(1000,Math.floor((Q.intervalSeconds??5)*1000)),W=0;if(Q.waitBeforeFirstPoll){let K=Y-q();if(K>0)await $(Math.min(Z,K),Q.signal)}while(q()<Y){if(Q.signal.aborted)throw Error("login cancelled");let K=await Q.poll();if(K.status==="complete")return K.value;if(K.status==="failed")throw Error(K.message);if(K.status==="slow_down")W+=1,Z=typeof K.intervalSeconds==="number"&&Number.isFinite(K.intervalSeconds)&&K.intervalSeconds>0?Math.max(1000,Math.floor(K.intervalSeconds*1000)):Math.max(1000,Z+5000);let X=Y-q();if(X<=0)break;await $(Math.min(Z,X),Q.signal)}throw Error(W>0?"device flow timed out after one or more slow_down responses (often clock drift in a WSL/VM \u2014 sync the clock and retry)":"device flow timed out")}P();var T={deviceCodeUrl:"https://github.com/login/device/code",accessTokenUrl:"https://github.com/login/oauth/access_token",copilotTokenUrl:"https://api.github.com/copilot_internal/v2/token"},N=atob("SXYxLmI1MDdhMDhjODdlY2ZlOTg="),L="GitHubCopilotChat/0.35.0",j={"User-Agent":L,"Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},O="https://api.individual.githubcopilot.com",E=300000,C="gpt-4o";function v(Q){let q=/proxy-ep=([^;]+)/.exec(Q);if(!q||!q[1])return null;return`https://${q[1].replace(/^proxy\./,"api.")}`}async function f(Q,q,$,Y,Z){let W=await G(Q,q,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/x-www-form-urlencoded","User-Agent":L},body:new URLSearchParams($).toString()},Y);if(!W.ok)throw await V(Z,W);return z(W,Z)}async function u(Q,q,$){let Y=await f(q,Q.deviceCodeUrl,{client_id:N,scope:"read:user"},$,"GitHub device code request"),{device_code:Z,user_code:W,verification_uri:K,interval:X,expires_in:J}=Y;if(typeof Z!=="string"||typeof W!=="string"||typeof K!=="string"||X!==void 0&&typeof X!=="number"||typeof J!=="number")throw Error("GitHub device code response is missing fields");let x;try{x=new URL(K)}catch{throw Error("GitHub device code response carries an untrusted verification_uri")}if(x.protocol!=="https:"&&x.protocol!=="http:")throw Error("GitHub device code response carries an untrusted verification_uri");return{deviceCode:Z,userCode:W,verificationUri:x.href,interval:X,expiresIn:J}}function g(Q,q,$,Y){return y({intervalSeconds:q.interval,expiresInSeconds:q.expiresIn,waitBeforeFirstPoll:!0,signal:Y,sleep:$.sleep,now:$.now,poll:async()=>{let Z=await f($,Q.accessTokenUrl,{client_id:N,device_code:q.deviceCode,grant_type:"urn:ietf:params:oauth:grant-type:device_code"},Y,"GitHub device token poll");if(typeof Z.access_token==="string"&&Z.access_token.length>0)return{status:"complete",value:Z.access_token};if(typeof Z.error==="string"){if(Z.error==="authorization_pending")return{status:"pending"};if(Z.error==="slow_down")return{status:"slow_down",intervalSeconds:typeof Z.interval==="number"?Z.interval:void 0};return{status:"failed",message:`GitHub device flow failed: ${Z.error}${typeof Z.error_description==="string"?` \u2014 ${Z.error_description.slice(0,160)}`:""}`}}return{status:"failed",message:"GitHub device token response is missing fields"}}})}async function M(Q,q,$,Y){let Z=await G($,Q.copilotTokenUrl,{headers:{Accept:"application/json",Authorization:`Bearer ${q}`,...j}},Y);if(!Z.ok)throw await V("Copilot token exchange",Z);let W=await z(Z,"Copilot token exchange"),{token:K,expires_at:X}=W;if(typeof K!=="string"||K.length===0||typeof X!=="number")throw Error("Copilot token response is missing fields");return{type:"oauth",access:K,refresh:q,expires:X*1000-E}}function R(Q=T){return{id:"github-copilot",label:"GitHub Copilot (device code)",defaultModel:C,async login(q,$){let Y=await u(Q,$,q.signal);q.notify({type:"device_code",userCode:Y.userCode,verificationUri:Y.verificationUri,intervalSeconds:Y.interval??5,expiresInSeconds:Y.expiresIn});let Z=await g(Q,Y,$,q.signal);return q.notify({type:"progress",message:"authorized \u2014 exchanging for a Copilot token"}),M(Q,Z,$,q.signal)},refresh(q,$,Y){return M(Q,q.refresh,Y,$)},toAuth(q){return{apiKey:q.access,baseUrl:Q.chatBaseUrl??v(q.access)??O,headers:{...j}}}}}P();var B="https://auth.openai.com",h={deviceUserCodeUrl:`${B}/api/accounts/deviceauth/usercode`,deviceTokenUrl:`${B}/api/accounts/deviceauth/token`,tokenUrl:`${B}/oauth/token`,deviceVerificationUri:`${B}/codex/device`,deviceRedirectUri:`${B}/deviceauth/callback`,responsesBaseUrl:"https://chatgpt.com/backend-api/codex"},l={"OpenAI-Beta":"responses=experimental",originator:"rovecode"},F="app_EMoamEEZ73f0CkXaXp7hrann",D=900,c="https://api.openai.com/auth";function p(Q){try{let q=Q.split(".");if(q.length!==3||!q[1])return;let $=q[1].replace(/-/g,"+").replace(/_/g,"/"),Z=JSON.parse(atob($+"=".repeat((4-$.length%4)%4)))[c],W=typeof Z==="object"&&Z!==null?Z.chatgpt_account_id:void 0;return typeof W==="string"&&W.length>0?W:void 0}catch{return}}async function a(Q,q,$){if(!Q.ok)throw await V(q,Q);let Y=await z(Q,q),{access_token:Z,refresh_token:W,expires_in:K}=Y;if(typeof Z!=="string"||Z.length===0||typeof W!=="string"||typeof K!=="number")throw Error(`${q}: response is missing fields`);let X=p(Z);return{type:"oauth",access:Z,refresh:W,expires:$()+K*1000,...X!==void 0?{accountId:X}:{}}}async function d(Q,q,$){let Y=await G(q,Q.deviceUserCodeUrl,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:F})},$);if(Y.status===404)throw Error("OpenAI device code login is not enabled for this server (HTTP 404)");if(!Y.ok)throw await V("OpenAI device code request",Y);let Z=await z(Y,"OpenAI device code request"),{device_auth_id:W,user_code:K,interval:X}=Z,J=typeof X==="string"?Number(X.trim()):X;if(typeof W!=="string"||!W||typeof K!=="string"||!K||typeof J!=="number"||!Number.isFinite(J)||J<0)throw Error("OpenAI device code response is missing fields");return{deviceAuthId:W,userCode:K,intervalSeconds:J}}function r(Q,q,$,Y){return y({intervalSeconds:q.intervalSeconds,expiresInSeconds:D,signal:Y,sleep:$.sleep,now:$.now,poll:async()=>{let Z=await G($,Q.deviceTokenUrl,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({device_auth_id:q.deviceAuthId,user_code:q.userCode})},Y);if(Z.ok){let K=await z(Z,"OpenAI device token poll"),{authorization_code:X,code_verifier:J}=K;if(typeof X!=="string"||!X||typeof J!=="string"||!J)return{status:"failed",message:"OpenAI device token response is missing fields"};return{status:"complete",value:{authorizationCode:X,codeVerifier:J}}}if(Z.status===403||Z.status===404)return{status:"pending"};let W;try{let K=await Z.json();W=typeof K?.error==="object"?K.error?.code:K?.error}catch{}if(W==="deviceauth_authorization_pending")return{status:"pending"};if(W==="slow_down")return{status:"slow_down"};return{status:"failed",message:`OpenAI device authorization failed (HTTP ${Z.status})${typeof W==="string"?`: ${W.slice(0,80)}`:""}`}}})}async function U(Q,q,$,Y,Z){let W=await G($,Q.tokenUrl,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams(q).toString()},Y);return a(W,Z,$.now)}function m(Q=h){return{id:"openai",label:"OpenAI / ChatGPT (device code)",async login(q,$){let Y=await d(Q,$,q.signal);q.notify({type:"device_code",userCode:Y.userCode,verificationUri:Q.deviceVerificationUri,intervalSeconds:Y.intervalSeconds,expiresInSeconds:D});let Z=await r(Q,Y,$,q.signal);return q.notify({type:"progress",message:"authorized \u2014 exchanging the authorization code"}),U(Q,{grant_type:"authorization_code",client_id:F,code:Z.authorizationCode,code_verifier:Z.codeVerifier,redirect_uri:Q.deviceRedirectUri},$,q.signal,"OpenAI token exchange")},refresh(q,$,Y){return U(Q,{grant_type:"refresh_token",refresh_token:q.refresh,client_id:F},Y,$,"OpenAI token refresh")},toAuth(q){return{apiKey:q.access,baseUrl:Q.responsesBaseUrl,wire:"responses",headers:{...q.accountId?{"chatgpt-account-id":q.accountId}:{},...l}}}}}P();I();t();I();var n={authorizeUrl:"https://openrouter.ai/auth",keysUrl:"https://openrouter.ai/api/v1/auth/keys",chatBaseUrl:"https://openrouter.ai/api/v1"},Gq=A("OpenRouter");async function i(Q,q,$,Y,Z){let W=await G(Y,Q.keysUrl,{method:"POST",headers:{accept:"application/json","content-type":"application/json"},body:JSON.stringify({code:q,code_verifier:$,code_challenge_method:"S256"})},Z);if(!W.ok)throw await V("OpenRouter key exchange",W);let K=await z(W,"OpenRouter key exchange");if(typeof K.key!=="string"||K.key.length===0)throw Error("OpenRouter key exchange: response carries no key");return K.key}async function o(Q,q,$){if(q.signal.aborted)throw S();let{verifier:Y,challenge:Z}=await _(),W=b(),K=k({nonce:W,signal:q.signal,what:"OpenRouter",retryHint:"Run rovecode auth login openrouter again.",onCode:async(J)=>({type:"oauth",access:await i(Q,J,Y,$,q.signal),refresh:"",expires:Number.MAX_SAFE_INTEGER})}),X=new URL(Q.authorizeUrl);X.search=new URLSearchParams({callback_url:K.callbackUrl,code_challenge:Z,code_challenge_method:"S256"}).toString();try{return q.notify({type:"auth_url",url:X.toString(),callbackUrl:K.callbackUrl}),await K.result}finally{K.stop()}}function w(Q=n){return{id:"openrouter",label:"OpenRouter (PKCE, browser + loopback callback)",login:(q,$)=>o(Q,q,$),async refresh(q){return q},toAuth(q){return{apiKey:q.access,baseUrl:Q.chatBaseUrl}}}}var Fq=["github-copilot","openrouter","openai"],Mq={anthropic:"Anthropic OAuth (the Claude subscription login) is an owner decision, not a port \u2014 third-party harnesses that used it were cut off in the Jan-2026 crackdown (research/round3_landscape.md:64-66); use `rovecode auth set anthropic` with an API key."};function s(){return[R(),w(),m()]}function Nq(Q){return s().find((q)=>q.id===Q)}function Lq(){return{fetch:(Q,q)=>fetch(Q,q),now:()=>Date.now(),sleep:(Q,q)=>H(Q,q)}}
3
+ export{Fq as hj,Mq as ij,s as jj,Nq as kj,Lq as lj};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{om as A,vm as I}from"./main-y5c82rxr.js";import{nn as q,pn as v,qn as z,tn as H}from"./main-nqveez48.js";import{wn as G}from"./main-qsevpgsv.js";import{existsSync as J}from"fs";function W(B){let b=A(B);return[b.harvest,b.project].filter((E)=>J(E))}var R,U,V;var K=G(()=>{H();I();R=q,U=v,V=z});
3
- export{R as Ad,U as Bd,V as Cd,W as Dd,K as Ed};
2
+ import{Fm as I,ym as A}from"./main-7rn6bqje.js";import{nn as q,pn as v,qn as z,tn as H}from"./main-nqveez48.js";import{wn as G}from"./main-qsevpgsv.js";import{existsSync as J}from"fs";function W(B){let b=A(B);return[b.harvest,b.project].filter((E)=>J(E))}var R,U,V;var K=G(()=>{H();I();R=q,U=v,V=z});
3
+ export{R as Sd,U as Td,V as Ud,W as Vd,K as Wd};
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- import{Tl as A,Ul as C,Vl as K}from"./main-vhrrq337.js";import{$m as R,Lm as Z}from"./main-2yeveeve.js";import{on as G,sn as Y,tn as H}from"./main-nqveez48.js";import{wn as b}from"./main-qsevpgsv.js";import{mkdirSync as M,readFileSync as T,writeFileSync as N}from"fs";import{dirname as F,join as x}from"path";function X(J,q){return J==="user"?x(Z(),z):x(q,".rovecode",z)}function E(J){if(typeof J!=="object"||J===null||Array.isArray(J))return{};let q=J,B={};if(typeof q.permission==="string"&&D.includes(q.permission))B.permission=q.permission;if(typeof q.effort==="string"&&A.includes(q.effort))B.effort=q.effort;if(typeof q.bell==="boolean")B.bell=q.bell;if(typeof q.autoUpdate==="boolean")B.autoUpdate=q.autoUpdate;if(typeof q.notify==="string"&&["auto","bell","osc9","osc777"].includes(q.notify))B.notify=q.notify;if(q.notify_when==="unfocused"||q.notify_when==="always")B.notify_when=q.notify_when;if(typeof q.notify_command==="string"&&q.notify_command.trim()!==""&&q.notify_command.length<=2000)B.notify_command=q.notify_command;if(q.verify===!1)B.verify=!1;else if(typeof q.verify==="string"&&q.verify.trim()!==""&&q.verify.length<=500)B.verify=q.verify.trim();else if(Array.isArray(q.verify)){let Q=q.verify.filter((U)=>typeof U==="string"&&U.trim()!==""&&U.length<=500).map((U)=>U.trim()).slice(0,8);if(Q.length>0)B.verify=Q}if(typeof q.lsp==="string"&&q.lsp.trim()!==""&&q.lsp.length<=2000)B.lsp=q.lsp;return B}function V(J){try{return E(JSON.parse(T(J,"utf8")))}catch{return{}}}function g(J){return V(J)}function I(J){return j.filter((q)=>J[q]!==void 0&&!(q==="verify"&&J.verify===!1))}function L(J,q=Z()){let B=X("project",J),Q=V(B),U=I(Q);if(U.length===0||G(q,B))return{user:V(X("user",J)),project:Q,projectPath:B,dropped:[]};let W={...Q};for(let _ of U)delete W[_];return{user:V(X("user",J)),project:W,projectPath:B,dropped:U}}function $(J){let q=L(J);return{...q.user,...q.project}}function S(J,q=Z()){let B=L(J,q);if(B.dropped.length===0)return[];let Q=B.dropped.join(", ");return[Y(B.projectPath,`its ${Q} key${B.dropped.length===1?" is":"s are"} ignored (a repo file would decide what we run)`)]}function u(J,q,B,Q){let U=X(B,Q),W={...V(U),[J]:q};return M(F(U),{recursive:!0}),N(U,JSON.stringify(W,null,2)+`
2
+ import{nm as A,om as C,pm as K}from"./main-n0t3973w.js";import{$m as R,Lm as Z}from"./main-2yeveeve.js";import{on as G,sn as Y,tn as H}from"./main-nqveez48.js";import{wn as b}from"./main-qsevpgsv.js";import{mkdirSync as M,readFileSync as T,writeFileSync as N}from"fs";import{dirname as F,join as x}from"path";function X(J,q){return J==="user"?x(Z(),z):x(q,".rovecode",z)}function E(J){if(typeof J!=="object"||J===null||Array.isArray(J))return{};let q=J,B={};if(typeof q.permission==="string"&&D.includes(q.permission))B.permission=q.permission;if(typeof q.effort==="string"&&A.includes(q.effort))B.effort=q.effort;if(typeof q.bell==="boolean")B.bell=q.bell;if(typeof q.autoUpdate==="boolean")B.autoUpdate=q.autoUpdate;if(typeof q.notify==="string"&&["auto","bell","osc9","osc777"].includes(q.notify))B.notify=q.notify;if(q.notify_when==="unfocused"||q.notify_when==="always")B.notify_when=q.notify_when;if(typeof q.notify_command==="string"&&q.notify_command.trim()!==""&&q.notify_command.length<=2000)B.notify_command=q.notify_command;if(q.verify===!1)B.verify=!1;else if(typeof q.verify==="string"&&q.verify.trim()!==""&&q.verify.length<=500)B.verify=q.verify.trim();else if(Array.isArray(q.verify)){let Q=q.verify.filter((U)=>typeof U==="string"&&U.trim()!==""&&U.length<=500).map((U)=>U.trim()).slice(0,8);if(Q.length>0)B.verify=Q}if(typeof q.lsp==="string"&&q.lsp.trim()!==""&&q.lsp.length<=2000)B.lsp=q.lsp;return B}function V(J){try{return E(JSON.parse(T(J,"utf8")))}catch{return{}}}function g(J){return V(J)}function I(J){return j.filter((q)=>J[q]!==void 0&&!(q==="verify"&&J.verify===!1))}function L(J,q=Z()){let B=X("project",J),Q=V(B),U=I(Q);if(U.length===0||G(q,B))return{user:V(X("user",J)),project:Q,projectPath:B,dropped:[]};let W={...Q};for(let _ of U)delete W[_];return{user:V(X("user",J)),project:W,projectPath:B,dropped:U}}function $(J){let q=L(J);return{...q.user,...q.project}}function S(J,q=Z()){let B=L(J,q);if(B.dropped.length===0)return[];let Q=B.dropped.join(", ");return[Y(B.projectPath,`its ${Q} key${B.dropped.length===1?" is":"s are"} ignored (a repo file would decide what we run)`)]}function u(J,q,B,Q){let U=X(B,Q),W={...V(U),[J]:q};return M(F(U),{recursive:!0}),N(U,JSON.stringify(W,null,2)+`
3
3
  `),U}function l(J,q,B){if(q!==void 0)return q;let Q=(B.ROVECODE_PERMISSION??"").trim().toLowerCase();if(D.includes(Q))return Q;if(B.ROVECODE_YOLO==="1")return"auto";if(B.ROVECODE_ACCEPT_EDITS==="1")return"accept-edits";return $(J).permission??"ask"}function p(J,q,B={}){if(q!==void 0)return q;let Q=C(B.ROVECODE_EFFORT);if(Q!==void 0)return Q;return $(J).effort??"auto"}function v(J,q={}){if(q.ROVECODE_AUTO_UPDATE==="1")return!0;return $(J).autoUpdate===!0}var j,z="settings.json",D;var O=b(()=>{R();H();K();j=["verify","lsp","notify_command"];D=["ask","accept-edits","auto"]});
4
- export{j as Il,X as Jl,g as Kl,L as Ll,$ as Ml,S as Nl,u as Ol,l as Pl,p as Ql,v as Rl,O as Sl};
4
+ export{j as cm,X as dm,g as em,L as fm,$ as gm,S as hm,u as im,l as jm,p as km,v as lm,O as mm};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
2
  import{wn as $,xn as y}from"./main-qsevpgsv.js";import{breakdownTokens as E}from"tokenlens/helpers";function F(){if(V===null)V=y("gpt-tokenizer/encoding/o200k_base");return V}function m(j){if(j.length===0)return 0;return F().countTokens(j)}function A(j){if(j.length===0)return 0;return V===null?null:V.countTokens(j)}function K(j){return typeof j==="number"&&Number.isFinite(j)&&j>0?j:0}function Y(j){return typeof j==="object"&&j!==null&&!Array.isArray(j)}function Z(j){if(!Y(j))return 0;for(let q of["prompt_tokens_details","input_tokens_details"]){let B=j[q];if(Y(B))return K(B.cached_tokens)}return 0}function N(j){let q=E(j),B=K(q.cacheReads)||Z(j),D=K(q.cacheWrites),G=K(q.input);if(Y(j)&&(typeof j.prompt_tokens==="number"||Z(j)>0&&j.cache_read_input_tokens===void 0))G=Math.max(0,G-B);return{input:G,output:K(q.output),cacheRead:B,cacheWrite:D}}function C(j,q){let B=q.promptBase+q.promptAbove,D=B>0?q.promptAbove/B:0,G=q.above??q.base,H=(P)=>D<=0?[[P,q.base]]:D>=1?[[P,G]]:[[P*(1-D),q.base],[P*D,G]],Q=0;for(let[P,X]of[...H(j.input).map(([J,U])=>[J,U.inputPerMTok]),...H(j.cacheRead).map(([J,U])=>[J,U.cacheReadPerMTok]),...H(j.cacheWrite).map(([J,U])=>[J,U.cacheWritePerMTok]),[j.output,q.request.outputPerMTok]]){let J=K(P);if(J===0)continue;if(typeof X!=="number"||!Number.isFinite(X))return;Q+=J/1e6*X}return Q}function I(j,q){let B=[[j.input,q.inputPerMTok],[j.output,q.outputPerMTok],[j.cacheRead,q.cacheReadPerMTok],[j.cacheWrite,q.cacheWritePerMTok]],D=0;for(let[G,H]of B){let Q=K(G);if(Q===0)continue;if(typeof H!=="number"||!Number.isFinite(H))return;D+=Q/1e6*H}return D}function S(j,q){if(!Number.isFinite(q)||q<=0)return{fraction:1,nearLimit:!0};let B=K(j)/q;return{fraction:B,nearLimit:B>=L}}var V=null,L=0.8;var O=()=>{};
3
- export{m as sj,A as tj,N as uj,C as vj,I as wj,S as xj,O as yj};
3
+ export{m as Sj,A as Tj,N as Uj,C as Vj,I as Wj,S as Xj,O as Yj};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{ue as t,ve as n,we as VZ,xe as Uz}from"./main-2z3dek0b.js";import{Dh as NZ,xh as Tz,yh as jz}from"./main-ntqef02r.js";import{Nh as tz,Oh as rZ,Ph as zZ,Qh as ZZ,Rh as oZ,Th as Nz,fi as W0}from"./main-kba6zeyd.js";import{kk as Sz,lk as OZ}from"./main-gbbty4d4.js";import{Hk as Iz,Jk as Lz,Qk as UZ}from"./main-qj2djy17.js";import{ll as Rz,ml as CZ}from"./main-6dtqmbt6.js";import{wn as T}from"./main-qsevpgsv.js";import{randomUUID as _z}from"crypto";import{cpSync as qz,mkdirSync as PZ,mkdtempSync as qZ,rmSync as Mz}from"fs";import{tmpdir as MZ}from"os";import{join as m}from"path";function Jz(z,Z){if((z.spawns??"subtasks")==="none")return{ok:!1,reason:`agent '${z.name}' spawn policy is 'none'`};if(Z.depth>=Z.maxDepth)return{ok:!1,reason:`depth cap ${Z.maxDepth} reached (current ${Z.depth})`};return{ok:!0}}function l(z,Z,$){let Q=Bun.spawnSync(["git",...z],{cwd:Z,stdin:$===void 0?"ignore":new Blob([$]),stdout:"pipe",stderr:"pipe"});return{code:Q.exitCode??-1,out:Q.stdout.toString()}}async function r(z,Z){if(Z.prefer==="none")return{dir:z,kind:"none",diff:async()=>"",cleanup:async()=>{}};let $=_z().slice(0,8);if(Z.prefer==="worktree"){let V=m(z,".rovecode","worktrees",$);if(l(["worktree","add","--detach",V],z).code===0)return{dir:V,kind:"worktree",diff:async()=>{return l(["add","-A","-N"],V),l(["diff","HEAD"],V).out},cleanup:async()=>{l(["worktree","remove","--force",V],z)}}}let Q=qZ(m(MZ(),"rovecode-iso-"));try{PZ(m(Q,"baseline")),qz(z,m(Q,"baseline"),{recursive:!0}),qz(z,m(Q,"work"),{recursive:!0})}catch{return Mz(Q,{recursive:!0,force:!0}),{dir:z,kind:"none",diff:async()=>"",cleanup:async()=>{}}}return{dir:m(Q,"work"),kind:"copy",diff:async()=>{let V=l(["diff","--no-index","baseline","work"],Q);return V.code<=1?V.out.replace(/^([-+]{3} [ab]\/)(baseline|work)\//gm,"$1").replace(/^(diff --git a\/)(?:baseline|work)\/(\S+ b\/)(?:baseline|work)\/(\S+)/gm,"$1$2$3"):""},cleanup:async()=>{Mz(Q,{recursive:!0,force:!0})}}}async function Dz(z,Z,$=0,Q){let V=(K)=>({agent:Z.agent,ok:!1,summary:K,usage:{input:0,output:0}}),W=z.defs.get(Z.agent);if(!W)return V(`unknown agent '${Z.agent}'`);let Y=Jz(W,{depth:$,maxDepth:o,parentSessionId:""});if(!Y.ok)return V(Y.reason??"spawn refused");let J=Z.isolated?await r(z.rootDir,{prefer:"worktree"}):await r(z.rootDir,{prefer:"none"});try{let K=new Rz(z.sessionsDir,_z()),X=new Iz,B=z.registryFactory(W,J.dir,{depth:$,steering:X,signal:Q,dir:J.dir,...Z.parentTools?{parentTools:Z.parentTools}:{}}),P=Tz(W.mode??"act",z.baseConfig.permissionRules),j={...z.baseConfig,permissionRules:IZ(P,J.dir,J.kind!=="none")},F=B.list().map((C)=>C.schema),I=W.model&&z.toolPrompt?z.toolPrompt(W.model,F):"",O=[W.mode==="plan"?jz():"",I?`# Tool calling
2
+ import{Ue as t,Ve as n,We as VZ,Xe as Uz}from"./main-3pjrb2hd.js";import{hf as Tz,if as jz,nf as NZ}from"./main-dfreez27.js";import{$h as tz,ai as rZ,bi as zZ,ci as ZZ,di as oZ,fi as Nz,ti as W0}from"./main-3gjqfh7a.js";import{Kk as Sz,Lk as OZ}from"./main-gzkmycnv.js";import{fl as Iz,hl as Lz,ol as UZ}from"./main-3rxcvgna.js";import{Ll as Rz,Ml as CZ}from"./main-4wndhjdc.js";import{wn as T}from"./main-qsevpgsv.js";import{randomUUID as _z}from"crypto";import{cpSync as qz,mkdirSync as PZ,mkdtempSync as qZ,rmSync as Mz}from"fs";import{tmpdir as MZ}from"os";import{join as m}from"path";function Jz(z,Z){if((z.spawns??"subtasks")==="none")return{ok:!1,reason:`agent '${z.name}' spawn policy is 'none'`};if(Z.depth>=Z.maxDepth)return{ok:!1,reason:`depth cap ${Z.maxDepth} reached (current ${Z.depth})`};return{ok:!0}}function l(z,Z,$){let Q=Bun.spawnSync(["git",...z],{cwd:Z,stdin:$===void 0?"ignore":new Blob([$]),stdout:"pipe",stderr:"pipe"});return{code:Q.exitCode??-1,out:Q.stdout.toString()}}async function r(z,Z){if(Z.prefer==="none")return{dir:z,kind:"none",diff:async()=>"",cleanup:async()=>{}};let $=_z().slice(0,8);if(Z.prefer==="worktree"){let V=m(z,".rovecode","worktrees",$);if(l(["worktree","add","--detach",V],z).code===0)return{dir:V,kind:"worktree",diff:async()=>{return l(["add","-A","-N"],V),l(["diff","HEAD"],V).out},cleanup:async()=>{l(["worktree","remove","--force",V],z)}}}let Q=qZ(m(MZ(),"rovecode-iso-"));try{PZ(m(Q,"baseline")),qz(z,m(Q,"baseline"),{recursive:!0}),qz(z,m(Q,"work"),{recursive:!0})}catch{return Mz(Q,{recursive:!0,force:!0}),{dir:z,kind:"none",diff:async()=>"",cleanup:async()=>{}}}return{dir:m(Q,"work"),kind:"copy",diff:async()=>{let V=l(["diff","--no-index","baseline","work"],Q);return V.code<=1?V.out.replace(/^([-+]{3} [ab]\/)(baseline|work)\//gm,"$1").replace(/^(diff --git a\/)(?:baseline|work)\/(\S+ b\/)(?:baseline|work)\/(\S+)/gm,"$1$2$3"):""},cleanup:async()=>{Mz(Q,{recursive:!0,force:!0})}}}async function Dz(z,Z,$=0,Q){let V=(K)=>({agent:Z.agent,ok:!1,summary:K,usage:{input:0,output:0}}),W=z.defs.get(Z.agent);if(!W)return V(`unknown agent '${Z.agent}'`);let Y=Jz(W,{depth:$,maxDepth:o,parentSessionId:""});if(!Y.ok)return V(Y.reason??"spawn refused");let J=Z.isolated?await r(z.rootDir,{prefer:"worktree"}):await r(z.rootDir,{prefer:"none"});try{let K=new Rz(z.sessionsDir,_z()),X=new Iz,B=z.registryFactory(W,J.dir,{depth:$,steering:X,signal:Q,dir:J.dir,...Z.parentTools?{parentTools:Z.parentTools}:{}}),P=Tz(W.mode??"act",z.baseConfig.permissionRules),j={...z.baseConfig,permissionRules:IZ(P,J.dir,J.kind!=="none")},F=B.list().map((C)=>C.schema),I=W.model&&z.toolPrompt?z.toolPrompt(W.model,F):"",O=[W.mode==="plan"?jz():"",I?`# Tool calling
3
3
  ${I}`:""].filter((C)=>C!==""),S=O.length>0?{...W,systemPrompt:(C)=>[typeof W.systemPrompt==="function"?W.systemPrompt(C):W.systemPrompt,...O].join(`
4
4
 
5
5
  `)}:W,M;for await(let C of Lz(S,Z.goal,Z.vars??{},j,{stream:z.stream,registry:B,store:K,guard:new Sz,tools:F,cwd:J.dir,signal:Q,hooks:z.hooks},X,$+1))if(C.type==="run_end")M={status:C.status,summary:C.summary};let E=0,w=0;for(let C of K.messages())if(C.usage)E+=C.usage.input,w+=C.usage.output;let R=J.kind==="none"?void 0:await J.diff(),N=M?.status==="done",_=RZ(K),D=N?_||"(no output)":`${M?.summary??"child run ended without run_end"}${_?`
@@ -8,7 +8,7 @@ patch-apply-failed`;return{agent:Z.agent,ok:N,summary:D.slice(0,4000),usage:{inp
8
8
  `).map((Q)=>Q.trim()).find((Q)=>Q!=="")??"";return $.length>Z?$.slice(0,Z-1)+"\u2026":$}function Xz(z){if(typeof z==="string")return z;return g(z).map((Z)=>k(Z)&&Z.type==="text"?H(Z.text)??"":"").filter(Boolean).join(`
9
9
  `)}function A(z,Z){let $=G(z);if(!$)return;let Q=q($.input_tokens)??q($.prompt_tokens)??q($.input),V=q($.output_tokens)??q($.completion_tokens)??q($.output);if(Q===void 0&&V===void 0)return;let W=G($.cache),Y=q($.cache_read_input_tokens)??q($.cached_input_tokens)??q(W?.read),J=q($.cache_creation_input_tokens)??q(W?.write),K=G(Z)??$,X=q(K.total_cost_usd)??q(K.cost_usd)??q(K.cost),B={input:Q??0,output:V??0};if(Y!==void 0)B.cacheRead=Y;if(J!==void 0)B.cacheWrite=J;if(X!==void 0)B.costUsd=X;return B}function e(z,Z){if(!z)return{...Z};let $={input:z.input+Z.input,output:z.output+Z.output},Q=(z.cacheRead??0)+(Z.cacheRead??0),V=(z.cacheWrite??0)+(Z.cacheWrite??0);if(z.cacheRead!==void 0||Z.cacheRead!==void 0)$.cacheRead=Q;if(z.cacheWrite!==void 0||Z.cacheWrite!==void 0)$.cacheWrite=V;if(z.costUsd!==void 0||Z.costUsd!==void 0)$.costUsd=(z.costUsd??0)+(Z.costUsd??0);return $}function yz(z){switch(z.kind){case"log":return U(z.text,200);case"edit":return`${z.op} ${z.path}${z.wrote===!0?" (ok)":""}`;case"bash":{let Z=z.exitCode!==void 0?` \u2192 exit ${z.exitCode}`:"",$=z.output?` \xB7 ${U(z.output,80)}`:"";return`$ ${U(z.command,100)}${Z}${$}`}case"tool":return`tool ${z.name}${z.detail?`: ${z.detail}`:""}`;case"ask":return`ask: ${U(z.text,160)}`;case"progress":return`progress: ${U(z.text,160)}`;case"done":return`done: ${U(z.summary,160)||"(no output)"}`;case"fail":return`fail: ${U(z.error,160)||"(no reason)"}`;case"usage":{let Z=z.usage.costUsd!==void 0?` \xB7 $${z.usage.costUsd.toFixed(4)}`:"";return`usage: ${z.usage.input} in \xB7 ${z.usage.output} out${Z}`}}}function Bz(z){let Z=z.toLowerCase();if(/^(bash|shell|command|run_command|run_shell_command|execute)$/.test(Z))return"bash";if(/^(write|write_file|create_file|notebookedit)$/.test(Z))return"write";if(/^(edit|multiedit|edit_file|replace|str_replace|patch|apply_patch)$/.test(Z))return"edit";return"other"}function Fz(z){return H(z?.file_path)??H(z?.filePath)??H(z?.path)??H(z?.file)??"?"}function d(z,Z,$,Q,V={}){let W=V.callId!==void 0&&V.callId!==""?{callId:V.callId}:{},Y=Fz(Z);switch(Bz(z)){case"bash":{let J={kind:"bash",command:H(Z?.command)??H(Z?.cmd)??"?",...W};if($!==void 0)J.output=$;if(Q!==void 0)J.exitCode=Q;return J}case"write":return{kind:"edit",path:Y,op:"write",...W,...V.wrote?{wrote:!0}:{}};case"edit":return{kind:"edit",path:Y,op:"edit",...W,...V.wrote?{wrote:!0}:{}};default:return{kind:"tool",name:z,...W,...$?{detail:U($,120)}:{}}}}var k=(z)=>typeof z==="object"&&z!==null&&!Array.isArray(z),H=(z)=>typeof z==="string"?z:void 0,q=(z)=>typeof z==="number"&&Number.isFinite(z)?z:void 0,G=(z)=>k(z)?z:void 0,g=(z)=>Array.isArray(z)?z:[];var h=()=>{};function kz(z,Z,$){let Q=Az(Z),V=[...Z.bare===!1?[]:["--bare"],"-p",z,"--output-format","stream-json","--verbose","--permission-mode","acceptEdits"];if(Q.length>0)V.push("--allowedTools",Q.join(","));if(Z.model)V.push("--model",Z.model);if($)V.push("--resume",$);return{bin:"claude",args:V,cwd:Z.cwd}}function jZ(z,Z){let $=[];for(let Q of g(G(z.message)?.content)){if(!k(Q))continue;if(Q.type==="text"){let V=(H(Q.text)??"").trim();if(V)Z.lastText=V,$.push({kind:"log",text:V})}else if(Q.type==="tool_use"){let V=H(Q.name)??"tool",W=H(Q.id),Y=G(Q.input);if(W)Cz(Z)[W]={name:V,path:Fz(Y)};$.push(d(V,Y,void 0,void 0,W?{callId:W}:{}))}}return $}function _Z(z,Z){let $=[];for(let Q of g(G(z.message)?.content)){if(!k(Q)||Q.type!=="tool_result")continue;let V=H(Q.tool_use_id)??"",W=Cz(Z)[V],Y=W?.name??"tool";delete Cz(Z)[V];let J=U(Xz(Q.content),120),K=Q.is_error===!0,X=Bz(Y);if(!K&&W!==void 0&&(X==="edit"||X==="write")&&W.path!=="?"){$.push({kind:"edit",path:W.path,op:X==="write"?"write":"edit",wrote:!0,...V?{callId:V}:{}});continue}$.push({kind:"log",text:`${Y} ${K?"error":"result"}${J?`: ${J}`:""}`})}return $}var SZ,Az=(z)=>[...z.allowlist??SZ],TZ=(z)=>z.bare!==!1?"bare":z.oauthToken===!0?"oauth token":"cli login",Cz=(z)=>z.scratch.tools??={},Ez;var wz=T(()=>{h();SZ=["Read","Edit","Write"];Ez={id:"claude",interruptFirst:!0,command:(z,Z)=>kz(z.goal,Z,Z.resume),resume:(z,Z,$)=>kz(Z,$,z),permissionSummary:(z)=>`permission-mode acceptEdits \xB7 allow: ${Az(z).join(",")||"none"} \xB7 ${TZ(z)} \xB7 worktree`,parse(z,Z){let $=f(z),Q=$?H($.type):void 0;if(!$||!Q)return Z.garbage++,[];let V=H($.session_id);if(V)Z.sessionId=V;switch(Q){case"system":{let W=H($.subtype)??"?";if(W==="hook_started"||W==="hook_response")return[{kind:"log",text:`hook ${H($.hook_name)??"?"} ${W==="hook_started"?"started":H($.outcome)??"responded"}`}];if(W!=="init")return[{kind:"log",text:`system ${W}`}];return[{kind:"log",text:`init \xB7 model ${H($.model)??"?"} \xB7 ${g($.tools).length} tools${V?` \xB7 session ${V}`:""}`}]}case"assistant":if($.is_api_error_message===!0)return[{kind:"log",text:`api error: ${U(Xz(G($.message)?.content),160)||H($.error)||"?"}${H($.error)?` (${H($.error)})`:""}`}];return jZ($,Z);case"user":return _Z($,Z);case"result":{let W=[],Y=A($.usage,$);if(Y)W.push({kind:"usage",usage:Y});let J=H($.result)??"",K=Z.sessionId?{sessionId:Z.sessionId}:{};if($.is_error===!0)W.push({kind:"fail",error:J||`result ${H($.subtype)??"error"}`,...K});else W.push({kind:"done",summary:J||Z.lastText||"",...K});return W}default:return[]}}}});import{tmpdir as DZ}from"os";import{join as yZ}from"path";function kZ(z){if(z.lastMessageFile)return z.lastMessageFile;let Z=0;for(let $ of z.cwd)Z=Z*31+$.charCodeAt(0)>>>0;return yZ(DZ(),`rovecode-codex-last-${Z.toString(16)}.md`)}function xz(z,Z,$){let Q=["-a","never","exec"];if($)Q.push("resume",$);if(Q.push("--json","--sandbox",Z.sandbox??gz,"-C",Z.cwd,"-o",kZ(Z),"--skip-git-repo-check"),Z.model)Q.push("-m",Z.model);return Q.push(z),{bin:"codex",args:Q,cwd:Z.cwd}}function EZ(z,Z,$){let Q=H(Z.type)??"",V=z==="item.completed";switch(Q){case"agent_message":{let W=(H(Z.text)??"").trim();if(!V||!W)return[];return $.lastText=W,[{kind:"log",text:W}]}case"reasoning":{let W=(H(Z.text)??"").trim();return V&&W?[{kind:"log",text:`thinking: ${U(W,160)}`}]:[]}case"command_execution":{let W=H(Z.command)??"?",Y=H(Z.id),J=Y!==void 0?{callId:Y}:{};if(z==="item.started")return[{kind:"bash",command:W,...J}];if(!V)return[];let K={kind:"bash",command:W,...J},X=q(Z.exit_code);if(X!==void 0)K.exitCode=X;let B=U(H(Z.aggregated_output),120);if(B)K.output=B;return[K]}case"file_change":{if(!V)return[];let W=H(Z.id);return g(Z.changes).filter(k).map((Y)=>({kind:"edit",path:H(Y.path)??"?",op:AZ[H(Y.kind)??""]??"edit",wrote:!0,...W!==void 0?{callId:W}:{}}))}case"todo_list":{let W=g(Z.items).filter(k),Y=W.filter((K)=>K.completed===!0).length,J=W.find((K)=>K.completed!==!0);return[{kind:"progress",text:`plan ${Y}/${W.length}${J?` \xB7 ${U(H(J.text),100)}`:" \xB7 complete"}`}]}case"mcp_tool_call":return V?[{kind:"log",text:`mcp ${H(Z.server)??"?"}.${H(Z.tool)??"?"} ${H(Z.status)??"completed"}`}]:[];case"web_search":return V?[{kind:"log",text:`search: ${U(H(Z.query),120)}`}]:[];default:return[]}}var gz="workspace-write",AZ,fz;var hz=T(()=>{h();AZ={add:"write",create:"write",update:"edit",modify:"edit",delete:"delete",remove:"delete"};fz={id:"codex",interruptFirst:!1,command:(z,Z)=>xz(z.goal,Z,Z.resume),resume:(z,Z,$)=>xz(Z,$,z),permissionSummary:(z)=>`sandbox ${z.sandbox??gz} \xB7 approval never \xB7 worktree`,parse(z,Z){let $=f(z),Q=$?H($.type):void 0;if(!$||!Q)return Z.garbage++,[];let V=()=>Z.sessionId?{sessionId:Z.sessionId}:{};switch(Q){case"thread.started":{let W=H($.thread_id);if(W)Z.sessionId=W;return[{kind:"log",text:`thread ${W??"?"}`}]}case"item.started":case"item.updated":case"item.completed":{let W=G($.item);return W?EZ(Q,W,Z):[]}case"turn.completed":{let W=[],Y=A($.usage);if(Y)W.push({kind:"usage",usage:Y});return W.push({kind:"done",summary:Z.lastText??"",...V()}),W}case"turn.failed":return[{kind:"fail",error:H(G($.error)?.message)??H($.error)??"turn failed",...V()}];case"error":return[{kind:"fail",error:H($.message)??H(G($.error)?.message)??"error",...V()}];default:return[]}}}});function bz(z,Z,$){let Q=["run",z,"--format","json","--dir",Z.cwd];if($)Q.push("-s",$);if(Z.attach)Q.push("--attach",Z.attach);if(Z.model)Q.push("-m",Z.model);return{bin:"opencode",args:Q,cwd:Z.cwd}}function vz(z,Z){let $=H(z.sessionID)??H(z.sessionId);if($)Z.sessionId=$;let Q=H(z.type);switch(Q){case"text":case"reasoning":{let V=(H(z.text)??"").trim(),W=G(z.time);if(!V||W&&W.end===void 0)return[];let Y=H(z.id)??V;if(mz(Z)[Y]===V)return[];if(mz(Z)[Y]=V,Q==="reasoning")return[{kind:"log",text:`thinking: ${U(V,160)}`}];return Z.lastText=V,[{kind:"log",text:V}]}case"tool":{let V=G(z.state),W=H(V?.status),Y=H(z.tool)??"tool";if(W==="error")return[{kind:"log",text:`tool ${Y} error: ${U(H(V?.error)??H(V?.output),120)}`}];if(W!=="completed")return[];let J=q(G(V?.metadata)?.exit),K=H(z.callID)??H(z.id);return[d(Y,G(V?.input),U(H(V?.output),120)||void 0,J,{wrote:!0,...K!==void 0?{callId:K}:{}})]}case"step-finish":case"step_finish":{let V=A(z.tokens,z),W=V?[{kind:"usage",usage:V}]:[],Y=H(z.reason);if(Y==="stop")W.push({kind:"done",summary:Z.lastText??"",...s(Z)});else if(Y==="error"||Y==="length"||Y==="content-filter")W.push({kind:"fail",error:`step finished: ${Y}`,...s(Z)});return W}default:return[]}}var wZ,mz=(z)=>z.scratch.parts??={},s=(z)=>z.sessionId?{sessionId:z.sessionId}:{},uz;var cz=T(()=>{h();wZ=new Set(["step_start","step-start","text","reasoning","tool_use","tool","step_finish","step-finish"]);uz={id:"opencode",interruptFirst:!0,command:(z,Z)=>bz(z.goal,Z,Z.resume),resume:(z,Z,$)=>bz(Z,$,z),permissionSummary:(z)=>`permissions per opencode config (asks surface as lane events)${z.attach?` \xB7 attach ${z.attach}`:""} \xB7 worktree`,parse(z,Z){let $=f(z),Q=$?H($.type):void 0;if(!$||!Q)return Z.garbage++,[];let V=G($.properties)??$,W=H(V.sessionID)??H(V.sessionId)??H(G(V.info)?.sessionID);if(W)Z.sessionId=W;if(wZ.has(Q)){let Y=G($.part);return Y?vz(Y,Z):[]}if(Q.startsWith("message.part.")){let Y=G(V.part)??G($.part);return Y?vz(Y,Z):[]}if(Q.startsWith("permission."))return[{kind:"ask",text:H(V.title)??H(G(V.permission)?.title)??H(V.type)??"permission"}];switch(Q){case"message.updated":{let Y=G(V.info),J=A(Y?.tokens,Y);return J&&H(Y?.role)!=="user"?[{kind:"usage",usage:J}]:[]}case"session.idle":return[{kind:"done",summary:Z.lastText??"",...s(Z)}];case"session.error":case"error":{let Y=G(V.error)??G($.error);return[{kind:"fail",error:H(G(Y?.data)?.message)??H(Y?.message)??H(V.message)??H(Y?.name)??"error",...s(Z)}]}default:return[]}}}});function lz(z,Z,$){let Q=["-p",z,"--output-format","stream-json","--print-timeout",gZ(Z.timeoutMs)];if(Z.allowAll===!0)Q.push("--dangerously-skip-permissions");if(Z.model)Q.push("--model",Z.model);if($)Q.push("--conversation",$);return{bin:"agy",args:Q,cwd:Z.cwd}}function dz(z,Z,$){let Q=(H(z.scratch.text)??"")+Z,V=[],W=(Y)=>{let J=Y.trim();if(J)z.lastText=J,V.push({kind:"log",text:J})};for(let Y=Q.indexOf(`
10
10
  `);Y>=0;Y=Q.indexOf(`
11
- `))W(Q.slice(0,Y)),Q=Q.slice(Y+1);if($)W(Q),Q="";return z.scratch.text=Q,V}function fZ(z,Z){let $=H(z.text_delta)??H(G(z.step)?.text_delta);if($!==void 0)return dz(Z,$,!1);let Q=G(z.step)??z,V=G(Q.tool)??G(Q.tool_call),W=H(V?.name)??H(Q.tool_name)??H(Q.name),Y=H(z.step_type)??H(Q.step_type)??"";if(!W||!/tool/.test(Y)&&!V)return[];let J=G(V?.args)??G(V?.input)??G(Q.tool_input)??G(Q.args)??G(Q.input),K=H(V?.output)??H(Q.tool_output)??H(Q.output);return[d(W,J,K?U(K,120):void 0)]}var xZ,gZ=(z)=>`${Math.max(1,Math.ceil(z/60000))}m`,nz;var pz=T(()=>{h();xZ="agy reported SUCCESS but the lane's worktree has no changes \u2014 a tool that needed approval was probably soft-denied (agy exits 0); "+"re-run with an explicit allow-all (--dangerously-skip-permissions) or grant it in ~/.gemini/antigravity-cli/settings.json permissions.allow";nz={id:"agy",interruptFirst:!1,emptyDiffNote:xZ,command:(z,Z)=>lz(z.goal,Z,Z.resume),resume:(z,Z,$)=>lz(Z,$,z),permissionSummary:(z)=>z.allowAll===!0?"--dangerously-skip-permissions (every tool auto-approved) \xB7 worktree":"soft-deny (tools needing approval are refused, exit 0 \u2014 diff is cross-checked) \xB7 worktree",parse(z,Z){let $=f(z),Q=$?H($.type):void 0;if(!$||!Q)return Z.garbage++,[];let V=H($.conversation_id)??H($.session_id)??H($.conversationId);if(V)Z.sessionId=V;let W=()=>Z.sessionId?{sessionId:Z.sessionId}:{};switch(Q){case"init":return[{kind:"log",text:`init \xB7 model ${H($.model)??"?"}${Z.sessionId?` \xB7 conversation ${Z.sessionId}`:""}`}];case"step_update":return fZ($,Z);case"result":{let Y=dz(Z,"",!0),J=A($.usage??$.stats??G($.metadata)?.usage,$);if(J)Y.push({kind:"usage",usage:J});let K=H($.status)??"?",X=(H($.response)??"").trim();if(K==="SUCCESS")Y.push({kind:"done",summary:X||Z.lastText||"",...W()});else Y.push({kind:"fail",error:X||(H($.error)??H($.message)??`result ${K}`),...W()});return Y}case"error":return[{kind:"fail",error:H($.message)??H(G($.error)?.message)??"error",...W()}];default:return[]}}}});import{existsSync as az}from"fs";import{delimiter as hZ,join as bZ}from"path";function oz(z){let Z=new Set;for(let $ of(z??"").split(",")){let Q=$.trim().toLowerCase();if(n(Q))Z.add(Q)}return Z}function nZ(z,Z,$){if(z.includes("/")||z.includes("\\"))return az(z);if(Z==="")return!0;let Q=process.platform==="win32"?($.PATHEXT??".COM;.EXE;.BAT;.CMD").split(";").map((V)=>V.trim()).filter(Boolean):[""];for(let V of Z.split(hZ)){if(V==="")continue;for(let W of Q)if(az(bZ(V,z+W)))return!0}return!1}function Oz(z,Z=process.env,$=dZ){let Q=cZ(Z);if(!Q.has(z)){let W=Q.size?[...Q].join(","):"none";return`external lane '${z}' is not in ${iz} (currently allowed: ${W}) \u2014 add it, or unset ${iz} to allow all of ${t.join(",")}`}let V=lZ(z,Z);if(!$(V,Z))return`external lane '${z}' needs the '${V}' CLI, which is not on PATH \u2014 install it, or start a different lane (${t.filter((W)=>W!==z).join(", ")})`;return null}function ez(z,Z=process.env,$={}){return`${c(z,Z,$)} \u2014 started; it works in its own worktree and its diff comes back as a patch`}function pZ(z=process.env){let Z=Number(v("LANE_TIMEOUT_MS",z)??"");return Number.isInteger(Z)&&Z>=1000?Z:uZ}function Zz(z,Z,$=process.env,Q={}){let V={cwd:Z,timeoutMs:pZ($)},W=(v(vZ(z),$)??"").trim();if(W)V.model=W;if(z==="claude"){let Y=v("LANE_CLAUDE_ALLOW",$);if(Y!==void 0)V.allowlist=Y.split(",").map((K)=>K.trim()).filter(Boolean);let J=v("LANE_CLAUDE_BARE",$);if(V.bare=J==="1"?!0:J==="0"?!1:($.ANTHROPIC_API_KEY??"")!=="",($[mZ]??"")!=="")V.oauthToken=!0}if(z==="codex"){let Y=v("LANE_CODEX_SANDBOX",$);V.sandbox=Y==="read-only"?"read-only":"workspace-write"}if(z==="agy"&&oz(v("LANES_ALLOW_ALL",$)).has("agy"))V.allowAll=!0;return{...V,...Q,cwd:Z}}function c(z,Z=process.env,$={}){return`spawn ${z} lane \xB7 ${zz[z].permissionSummary(Zz(z,"<worktree>",Z,$))}`}function Z1(z,Z=process.env){if(!k(z)||z.action!=="start"||!n(z.agent))return null;return c(z.agent,Z)}var zz,u=(z)=>`ROVECODE_${z}`,v=(z,Z=process.env)=>Z[u(z)],iz,o0,e0,s0,mZ="CLAUDE_CODE_OAUTH_TOKEN",vZ=(z)=>`LANE_${z.toUpperCase()}_MODEL`,t0,z1,uZ=900000,cZ=(z=process.env)=>{let Z=v("LANES_ALLOW",z);return Z===void 0?new Set(t):oz(Z)},lZ=(z,Z=process.env)=>zz[z].command({goal:"probe"},Zz(z,".",Z)).bin,rz,dZ=(z,Z)=>{let $=Z.PATH??Z.Path??"",Q=`${process.platform}|${z}|${$}`,V=rz.get(Q);if(V!==void 0)return V;let W=nZ(z,$,Z);return rz.set(Q,W),W};var $z=T(()=>{h();Uz();wz();hz();cz();pz();zz={claude:Ez,codex:fz,opencode:uz,agy:nz},iz=u("LANES_ALLOW"),o0=u("LANES_ALLOW_ALL"),e0=u("LANE_CLAUDE_ALLOW"),s0=u("LANE_CLAUDE_BARE"),t0=u("LANE_CODEX_SANDBOX"),z1=u("LANE_TIMEOUT_MS");rz=new Map});class Vz{calls=new Set;anonymousCalls=0;files=new Set;filesTotal=0;usage;add(z){switch(z.kind){case"edit":if(this.countCall(z.callId),z.wrote===!0&&!this.files.has(z.path)){if(this.filesTotal+=1,this.files.size<Qz)this.files.add(z.path)}return;case"bash":case"tool":this.countCall(z.callId);return;case"usage":this.usage=e(this.usage,z.usage);return;default:return}}countCall(z){if(z===void 0||z==="")this.anonymousCalls+=1;else this.calls.add(z)}snapshot(){return{toolCalls:this.calls.size+this.anonymousCalls,filesWritten:[...this.files].sort(),filesWrittenTotal:this.filesTotal,...this.usage?{usage:{...this.usage}}:{}}}withFiles(z){let Z=[...new Set(z)].sort();return{...this.snapshot(),filesWritten:Z.slice(0,Qz),filesWrittenTotal:Z.length}}}function Wz(z){let Z=new Set;for(let $ of z.split(/\r?\n/)){if(!$.startsWith("diff --git "))continue;let Q=$.slice(11),V=aZ(Q);if(V===null)continue;let[W,Y]=V,J=Y==="/dev/null"?W:Y;if(J!==""&&J!=="/dev/null")Z.add(J)}return[...Z].sort()}function aZ(z){if(z.startsWith('"')){let $=iZ(z);if($===-1)return null;let Q=sz(z.slice(0,$+1)),V=z.slice($+1).trimStart(),W=V.startsWith('"')?sz(V):V;return[p(Q),p(W)]}let Z=z.indexOf(" b/");if(Z===-1){let $=z.indexOf(" ");return $===-1?null:[p(z.slice(0,$)),p(z.slice($+1))]}return[p(z.slice(0,Z)),p(z.slice(Z+1))]}var Qz=100,iZ=(z)=>{for(let Z=1;Z<z.length;Z++){if(z[Z]==="\\"){Z++;continue}if(z[Z]==='"')return Z}return-1},sz=(z)=>{return(z.startsWith('"')?z.slice(1,z.lastIndexOf('"')):z).replace(/\\(.)/g,"$1")},p=(z)=>/^[ab]\//.test(z)?z.slice(2):z;var Yz=T(()=>{h()});function Z0(z,Z){let $={};for(let[Q,V]of Object.entries(z)){if(V===void 0)continue;let W=Q.toUpperCase();if(!z0.includes(W)&&(sZ.includes(W)||W.startsWith(tZ)))continue;$[Q]=V}return{...$,...Z??{}}}async function*$0(z){let Z=new TextDecoder,$="",Q=!1;try{for(;;){let V=await z.read();if(V.done)break;$+=Z.decode(V.value,{stream:!0});for(let W=$.indexOf(`
11
+ `))W(Q.slice(0,Y)),Q=Q.slice(Y+1);if($)W(Q),Q="";return z.scratch.text=Q,V}function fZ(z,Z){let $=H(z.text_delta)??H(G(z.step)?.text_delta);if($!==void 0)return dz(Z,$,!1);let Q=G(z.step)??z,V=G(Q.tool)??G(Q.tool_call),W=H(V?.name)??H(Q.tool_name)??H(Q.name),Y=H(z.step_type)??H(Q.step_type)??"";if(!W||!/tool/.test(Y)&&!V)return[];let J=G(V?.args)??G(V?.input)??G(Q.tool_input)??G(Q.args)??G(Q.input),K=H(V?.output)??H(Q.tool_output)??H(Q.output);return[d(W,J,K?U(K,120):void 0)]}var xZ,gZ=(z)=>`${Math.max(1,Math.ceil(z/60000))}m`,nz;var az=T(()=>{h();xZ="agy reported SUCCESS but the lane's worktree has no changes \u2014 a tool that needed approval was probably soft-denied (agy exits 0); "+"re-run with an explicit allow-all (--dangerously-skip-permissions) or grant it in ~/.gemini/antigravity-cli/settings.json permissions.allow";nz={id:"agy",interruptFirst:!1,emptyDiffNote:xZ,command:(z,Z)=>lz(z.goal,Z,Z.resume),resume:(z,Z,$)=>lz(Z,$,z),permissionSummary:(z)=>z.allowAll===!0?"--dangerously-skip-permissions (every tool auto-approved) \xB7 worktree":"soft-deny (tools needing approval are refused, exit 0 \u2014 diff is cross-checked) \xB7 worktree",parse(z,Z){let $=f(z),Q=$?H($.type):void 0;if(!$||!Q)return Z.garbage++,[];let V=H($.conversation_id)??H($.session_id)??H($.conversationId);if(V)Z.sessionId=V;let W=()=>Z.sessionId?{sessionId:Z.sessionId}:{};switch(Q){case"init":return[{kind:"log",text:`init \xB7 model ${H($.model)??"?"}${Z.sessionId?` \xB7 conversation ${Z.sessionId}`:""}`}];case"step_update":return fZ($,Z);case"result":{let Y=dz(Z,"",!0),J=A($.usage??$.stats??G($.metadata)?.usage,$);if(J)Y.push({kind:"usage",usage:J});let K=H($.status)??"?",X=(H($.response)??"").trim();if(K==="SUCCESS")Y.push({kind:"done",summary:X||Z.lastText||"",...W()});else Y.push({kind:"fail",error:X||(H($.error)??H($.message)??`result ${K}`),...W()});return Y}case"error":return[{kind:"fail",error:H($.message)??H(G($.error)?.message)??"error",...W()}];default:return[]}}}});import{existsSync as pz}from"fs";import{delimiter as hZ,join as bZ}from"path";function oz(z){let Z=new Set;for(let $ of(z??"").split(",")){let Q=$.trim().toLowerCase();if(n(Q))Z.add(Q)}return Z}function nZ(z,Z,$){if(z.includes("/")||z.includes("\\"))return pz(z);if(Z==="")return!0;let Q=process.platform==="win32"?($.PATHEXT??".COM;.EXE;.BAT;.CMD").split(";").map((V)=>V.trim()).filter(Boolean):[""];for(let V of Z.split(hZ)){if(V==="")continue;for(let W of Q)if(pz(bZ(V,z+W)))return!0}return!1}function Oz(z,Z=process.env,$=dZ){let Q=cZ(Z);if(!Q.has(z)){let W=Q.size?[...Q].join(","):"none";return`external lane '${z}' is not in ${iz} (currently allowed: ${W}) \u2014 add it, or unset ${iz} to allow all of ${t.join(",")}`}let V=lZ(z,Z);if(!$(V,Z))return`external lane '${z}' needs the '${V}' CLI, which is not on PATH \u2014 install it, or start a different lane (${t.filter((W)=>W!==z).join(", ")})`;return null}function ez(z,Z=process.env,$={}){return`${c(z,Z,$)} \u2014 started; it works in its own worktree and its diff comes back as a patch`}function aZ(z=process.env){let Z=Number(v("LANE_TIMEOUT_MS",z)??"");return Number.isInteger(Z)&&Z>=1000?Z:uZ}function Zz(z,Z,$=process.env,Q={}){let V={cwd:Z,timeoutMs:aZ($)},W=(v(vZ(z),$)??"").trim();if(W)V.model=W;if(z==="claude"){let Y=v("LANE_CLAUDE_ALLOW",$);if(Y!==void 0)V.allowlist=Y.split(",").map((K)=>K.trim()).filter(Boolean);let J=v("LANE_CLAUDE_BARE",$);if(V.bare=J==="1"?!0:J==="0"?!1:($.ANTHROPIC_API_KEY??"")!=="",($[mZ]??"")!=="")V.oauthToken=!0}if(z==="codex"){let Y=v("LANE_CODEX_SANDBOX",$);V.sandbox=Y==="read-only"?"read-only":"workspace-write"}if(z==="agy"&&oz(v("LANES_ALLOW_ALL",$)).has("agy"))V.allowAll=!0;return{...V,...Q,cwd:Z}}function c(z,Z=process.env,$={}){return`spawn ${z} lane \xB7 ${zz[z].permissionSummary(Zz(z,"<worktree>",Z,$))}`}function Z1(z,Z=process.env){if(!k(z)||z.action!=="start"||!n(z.agent))return null;return c(z.agent,Z)}var zz,u=(z)=>`ROVECODE_${z}`,v=(z,Z=process.env)=>Z[u(z)],iz,o0,e0,s0,mZ="CLAUDE_CODE_OAUTH_TOKEN",vZ=(z)=>`LANE_${z.toUpperCase()}_MODEL`,t0,z1,uZ=900000,cZ=(z=process.env)=>{let Z=v("LANES_ALLOW",z);return Z===void 0?new Set(t):oz(Z)},lZ=(z,Z=process.env)=>zz[z].command({goal:"probe"},Zz(z,".",Z)).bin,rz,dZ=(z,Z)=>{let $=Z.PATH??Z.Path??"",Q=`${process.platform}|${z}|${$}`,V=rz.get(Q);if(V!==void 0)return V;let W=nZ(z,$,Z);return rz.set(Q,W),W};var $z=T(()=>{h();Uz();wz();hz();cz();az();zz={claude:Ez,codex:fz,opencode:uz,agy:nz},iz=u("LANES_ALLOW"),o0=u("LANES_ALLOW_ALL"),e0=u("LANE_CLAUDE_ALLOW"),s0=u("LANE_CLAUDE_BARE"),t0=u("LANE_CODEX_SANDBOX"),z1=u("LANE_TIMEOUT_MS");rz=new Map});class Vz{calls=new Set;anonymousCalls=0;files=new Set;filesTotal=0;usage;add(z){switch(z.kind){case"edit":if(this.countCall(z.callId),z.wrote===!0&&!this.files.has(z.path)){if(this.filesTotal+=1,this.files.size<Qz)this.files.add(z.path)}return;case"bash":case"tool":this.countCall(z.callId);return;case"usage":this.usage=e(this.usage,z.usage);return;default:return}}countCall(z){if(z===void 0||z==="")this.anonymousCalls+=1;else this.calls.add(z)}snapshot(){return{toolCalls:this.calls.size+this.anonymousCalls,filesWritten:[...this.files].sort(),filesWrittenTotal:this.filesTotal,...this.usage?{usage:{...this.usage}}:{}}}withFiles(z){let Z=[...new Set(z)].sort();return{...this.snapshot(),filesWritten:Z.slice(0,Qz),filesWrittenTotal:Z.length}}}function Wz(z){let Z=new Set;for(let $ of z.split(/\r?\n/)){if(!$.startsWith("diff --git "))continue;let Q=$.slice(11),V=pZ(Q);if(V===null)continue;let[W,Y]=V,J=Y==="/dev/null"?W:Y;if(J!==""&&J!=="/dev/null")Z.add(J)}return[...Z].sort()}function pZ(z){if(z.startsWith('"')){let $=iZ(z);if($===-1)return null;let Q=sz(z.slice(0,$+1)),V=z.slice($+1).trimStart(),W=V.startsWith('"')?sz(V):V;return[a(Q),a(W)]}let Z=z.indexOf(" b/");if(Z===-1){let $=z.indexOf(" ");return $===-1?null:[a(z.slice(0,$)),a(z.slice($+1))]}return[a(z.slice(0,Z)),a(z.slice(Z+1))]}var Qz=100,iZ=(z)=>{for(let Z=1;Z<z.length;Z++){if(z[Z]==="\\"){Z++;continue}if(z[Z]==='"')return Z}return-1},sz=(z)=>{return(z.startsWith('"')?z.slice(1,z.lastIndexOf('"')):z).replace(/\\(.)/g,"$1")},a=(z)=>/^[ab]\//.test(z)?z.slice(2):z;var Yz=T(()=>{h()});function Z0(z,Z){let $={};for(let[Q,V]of Object.entries(z)){if(V===void 0)continue;let W=Q.toUpperCase();if(!z0.includes(W)&&(sZ.includes(W)||W.startsWith(tZ)))continue;$[Q]=V}return{...$,...Z??{}}}async function*$0(z){let Z=new TextDecoder,$="",Q=!1;try{for(;;){let V=await z.read();if(V.done)break;$+=Z.decode(V.value,{stream:!0});for(let W=$.indexOf(`
12
12
  `);W>=0;W=$.indexOf(`
13
13
  `)){let Y=$.slice(0,W);if($=$.slice(W+1),Q){Q=!1;continue}if(Y.endsWith("\r"))Y=Y.slice(0,-1);yield Y.length>Hz?Y.slice(0,Hz):Y}if($.length>Hz)yield $.slice(0,Hz),$="",Q=!0}if($+=Z.decode(),$&&!Q)yield $}catch{}}function V0(z={}){let Z=z.platform??process.platform,$=z.spawn??Q0,Q=z.kill,V=z.createJob??tz,W=Z==="win32";return(Y)=>{let J=$([Y.bin,...Y.args],{cwd:Y.cwd,env:Z0(process.env,Y.env),stdin:Y.stdin!==void 0?new Blob([Y.stdin]):"ignore",stdout:"pipe",stderr:"pipe",...zZ(Z)}),K=W?V():null;if(K&&!K.assign(J.pid))K=null;let X=!1,B=null,P="";(async()=>{let F=J.stderr.getReader(),I=new TextDecoder;for(let O=await F.read();!O.done;O=await F.read())P=(P+I.decode(O.value,{stream:!0})).slice(-eZ)})().catch(()=>{});let j=J.exited.then((F)=>X?143:F).finally(()=>{if(X)K?.terminate();else K?.release()});return{pid:J.pid,exited:j,lines:()=>$0(B=J.stdout.getReader()),interrupt(){if(W||J.exitCode!==null)return!1;try{return J.kill("SIGINT"),!0}catch{return!1}},kill(){if(X)return;if(X=!0,W){if(K?.terminate(),J.exitCode===null)try{$(["taskkill","/T","/F","/PID",String(J.pid)],{stdout:"ignore",stderr:"ignore"})}catch{}}else{ZZ(J.pid,"SIGTERM",Q);try{J.kill("SIGTERM")}catch{}}},abandon(){B?.cancel().catch(()=>{})},stderrTail:()=>P.trim()}}}var Hz=1048576,eZ=2000,sZ,tZ="CLAUDE_CODE_",z0,Q0=(z,Z)=>Bun.spawn(z,Z),$Z;var QZ=T(()=>{oZ();rZ();sZ=["CLAUDECODE"],z0=["CLAUDE_CODE_OAUTH_TOKEN","CLAUDE_CODE_USE_BEDROCK","CLAUDE_CODE_USE_VERTEX","CLAUDE_CODE_USE_FOUNDRY","CLAUDE_CODE_SIMPLE","CLAUDE_CODE_SAFE_MODE","CLAUDE_CODE_MAX_OUTPUT_TOKENS","CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC"];$Z=V0()});class WZ{cap;lines=[];constructor(z){this.cap=z}push(z){if(this.lines.push(z),this.lines.length>this.cap)this.lines.splice(0,this.lines.length-this.cap)}tail(z=this.cap){return this.lines.slice(-z)}get length(){return this.lines.length}}async function YZ(z,Z,$,Q={}){if(Q.signal?.aborted)return{status:"cancelled",summary:"",error:"cancelled",exitCode:null,log:[],garbage:0,progress:new Vz().snapshot()};let V=$.resume&&z.resume?z.resume($.resume,Z.goal,$):z.command(Z,$),W=new WZ(Y0),Y=new Vz,J=VZ(),K;try{K=(Q.spawn??$Z)(V)}catch(N){return{status:"failed",summary:"",error:`spawn failed: ${V.bin}: ${J0(N)}`,exitCode:null,log:[],garbage:0,progress:Y.snapshot()}}let X,B,P,j=!1,F=!1,I=!1,O=new Set,S=(N,_)=>{let D=setTimeout(()=>{O.delete(D),N()},_);O.add(D)},M=(N)=>{Q.steps?.push(N)},E=()=>{M("kill"),K.kill(),S(()=>{M("abandon"),K.abandon()},Nz)},w=()=>{if(I)return;if(I=!0,z.interruptFirst&&K.interrupt())M("interrupt"),S(E,Q.graceMs??H0);else E()},R=()=>{F=!0,w()};try{Q.signal?.addEventListener("abort",R,{once:!0}),S(()=>{j=!0,w()},Math.max(0,$.timeoutMs));for await(let b of K.lines()){let x=b.trimEnd();if(!x)continue;let i;try{i=z.parse(x,J)}catch{J.garbage++;continue}for(let y of i){if(W.push(yz(y)),Y.add(y),y.kind==="done")X=y;else if(y.kind==="fail")B=y;else if(y.kind==="usage")P=e(P,y.usage);Q.onEvent?.(y,W.tail(3),Y.snapshot())}}let N,_=await Promise.race([K.exited,new Promise((b)=>{N=setTimeout(()=>b(null),Nz)})]);clearTimeout(N);let D=X?.sessionId??B?.sessionId??J.sessionId,L={exitCode:_,log:W.tail(),garbage:J.garbage,progress:Y.snapshot(),...P?{usage:P}:{},...D?{sessionId:D}:{}};if(F)return{...L,status:"cancelled",summary:"",error:"cancelled"};if(j)return{...L,status:"failed",summary:"",error:`timed out after ${$.timeoutMs}ms`};if(B)return{...L,status:"failed",summary:"",error:B.error};if(X)return{...L,status:"done",summary:X.summary||J.lastText||""};let C=K.stderrTail();if(_!==0)return{...L,status:"failed",summary:"",error:`${V.bin} exited with code ${_??"?"} without a result${C?`: ${C.slice(-300)}`:""}`};return{...L,status:"failed",summary:"",error:`${V.bin} exited 0 without a result event${C?`: ${C.slice(-300)}`:""}`}}finally{Q.signal?.removeEventListener("abort",R);for(let N of O)clearTimeout(N)}}var Y0=200,H0=3000,J0=(z)=>z instanceof Error?z.message:String(z);var HZ=T(()=>{W0();h();Yz();QZ();Uz()});function G0(z){return{filesWritten:z.slice(0,Qz),filesWrittenTotal:z.length}}async function GZ(z,Z,$,Q,V,W){let Y=zz[Z],J=z.env??process.env,K=c(Z,J),X=(F)=>({agent:Z,ok:!1,usage:{input:0,output:0},permissions:K,summary:F}),B=await(z.isolate??r)(Q,{prefer:"worktree"}),P,j;try{if(B.kind==="none")return X("isolation unavailable \u2014 an external lane never runs in the parent tree");if(V.aborted)return X("cancelled before the lane started");let F=Zz(Z,B.dir,J,z.timeoutMs!==void 0?{timeoutMs:z.timeoutMs}:{}),I=0,O,S=!1,M,E=(x)=>{I=Date.now(),O=void 0,W(x.join(`
14
14
  `),M)},w=z.silentMs??K0;j=setTimeout(()=>{if(!S)W(`no output from ${Z} after ${JZ(w)} \u2014 still waiting (lane timeout ${JZ(F.timeoutMs)})`)},w);let R=await YZ(Y,{goal:$},F,{spawn:z.spawn,signal:V,graceMs:z.graceMs,onEvent:(x,i,y)=>{S=!0,M=y;let Pz=Date.now()-I;if(Pz>=KZ){E(i);return}if(O=i,P===void 0)P=setTimeout(()=>{if(P=void 0,O)E(O)},KZ-Pz)}}),N=await B.diff(),_=R.usage??{input:0,output:0},D={...R.progress,...G0(Wz(N))},L={agent:Z,usage:_,permissions:K,patch:N,exitCode:R.exitCode,...R.sessionId?{sessionId:R.sessionId}:{},...F.model?{model:F.model}:{}};if(R.status!=="done"){let x=R.log.slice(-3).join(`
@@ -16,10 +16,10 @@ patch-apply-failed`;return{agent:Z.agent,ok:N,summary:D.slice(0,4000),usage:{inp
16
16
  last output: ${x}`:""}`}}let C=R.summary||"(no output)";if(N.trim()===""&&Y.emptyDiffNote)C+=`
17
17
  note: ${Y.emptyDiffNote}`;if(B.kind==="copy")C+=`
18
18
  [isolation: copy \u2014 ${Q} is not a git repo]`;let b=(z.apply??Kz)(N,Q);if(!b)C+=`
19
- patch-apply-failed`;return{...L,applied:b,progress:{...D,applied:b},ok:!0,summary:C.slice(0,4000)}}finally{clearTimeout(P),clearTimeout(j),await B.cleanup()}}var K0=30000,JZ=(z)=>z>=1000?`${Math.round(z/1000)}s`:`${z}ms`,KZ=250;var XZ=T(()=>{Gz();$z();Yz();HZ();$z();Uz()});function B0(z=process.env){let Z=Number(z.ROVECODE_TASKS_MAX??"");return Number.isInteger(Z)&&Z>=1?Z:X0}function a(z,Z=200){let $=(z??"").split(`
20
- `).find((Q)=>Q.trim()!=="")?.trim()??"";return $.length>Z?$.slice(0,Z-1)+"\u2026":$||"(no output)"}function FZ(z){let Z=`task ${z.id} (${z.label})`;if(z.status==="done")return`${Z} finished: ${a(z.summary)} \u2014 call task_status result ${z.id} for details`;if(z.status==="failed")return`${Z} failed: ${a(z.error)} \u2014 call task_status result ${z.id} for details`;return`${Z} cancelled`}function T1(z,Z=Date.now()){if(z.length===0)return"(no background tasks)";let $=z.slice(-50).map((Q)=>{let V=Q.finishedAt??Z,W=Q.startedAt!==void 0?` ${Math.max(0,Math.round((V-Q.startedAt)/1000))}s`:"",Y=Q.status==="failed"?` \u2014 ${a(Q.error,80)}`:Q.status==="done"?` \u2014 ${a(Q.summary,80)}`:"";return`${Q.id.padEnd(4)} ${Q.status.padEnd(9)}${W.padEnd(6)} ${Q.label}${Y}`});return(z.length>50?`(showing 50 of ${z.length})
19
+ patch-apply-failed`;return{...L,applied:b,progress:{...D,applied:b},ok:!0,summary:C.slice(0,4000)}}finally{clearTimeout(P),clearTimeout(j),await B.cleanup()}}var K0=30000,JZ=(z)=>z>=1000?`${Math.round(z/1000)}s`:`${z}ms`,KZ=250;var XZ=T(()=>{Gz();$z();Yz();HZ();$z();Uz()});function B0(z=process.env){let Z=Number(z.ROVECODE_TASKS_MAX??"");return Number.isInteger(Z)&&Z>=1?Z:X0}function p(z,Z=200){let $=(z??"").split(`
20
+ `).find((Q)=>Q.trim()!=="")?.trim()??"";return $.length>Z?$.slice(0,Z-1)+"\u2026":$||"(no output)"}function FZ(z){let Z=`task ${z.id} (${z.label})`;if(z.status==="done")return`${Z} finished: ${p(z.summary)} \u2014 call task_status result ${z.id} for details`;if(z.status==="failed")return`${Z} failed: ${p(z.error)} \u2014 call task_status result ${z.id} for details`;return`${Z} cancelled`}function T1(z,Z=Date.now()){if(z.length===0)return"(no background tasks)";let $=z.slice(-50).map((Q)=>{let V=Q.finishedAt??Z,W=Q.startedAt!==void 0?` ${Math.max(0,Math.round((V-Q.startedAt)/1000))}s`:"",Y=Q.status==="failed"?` \u2014 ${p(Q.error,80)}`:Q.status==="done"?` \u2014 ${p(Q.summary,80)}`:"";return`${Q.id.padEnd(4)} ${Q.status.padEnd(9)}${W.padEnd(6)} ${Q.label}${Y}`});return(z.length>50?`(showing 50 of ${z.length})
21
21
  `:"")+$.join(`
22
- `)}function U0(z,Z){let $=(z??"").replace(/\s+/g," ").trim();return $.length>Z?$.slice(0,Z-1)+"\u2026":$}function N0(z,Z=z){let $=new Set(z.map((J)=>J.id)),Q=new Map;for(let J of Z)for(let K of J.files??[])Q.set(K,[...Q.get(K)??[],J.id]);let V=[...Q].filter(([,J])=>J.length>1&&J.some((K)=>$.has(K))).map(([J,K])=>({path:J,tasks:K})).sort((J,K)=>J.path.localeCompare(K.path)),W=(J)=>z.reduce((K,X)=>K+(X.status===J?1:0),0),Y=z.find((J)=>J.batchLabel!==void 0)?.batchLabel;return{batch:z[0]?.batch??"",...Y!==void 0?{label:Y}:{},tasks:z,done:W("done"),failed:W("failed"),cancelled:W("cancelled"),collisions:V}}function P0(z){let Z=[];if(z.failed>0)Z.push(`${z.failed} FAILED`);if(z.cancelled>0)Z.push(`${z.cancelled} cancelled`);if(z.done>0)Z.push(`${z.done} done`);let $=z.tasks.length,V=[`batch ${z.batch}${z.label!==void 0?` (${z.label})`:""}: ${$} agent${$===1?"":"s"} \u2014 ${Z.join(", ")}`];for(let W of z.collisions)V.push(`COLLISION: ${W.path} \u2014 ${O0(W.tasks)} both changed this file`);for(let W of z.tasks){let Y=W.startedAt!==void 0&&W.finishedAt!==void 0?` ${Math.max(0,Math.round((W.finishedAt-W.startedAt)/1000))}s`:"",J=W.status==="failed"?"FAILED":W.status,K=W.files!==void 0&&W.files.length>0?` [${W.files.length} file${W.files.length===1?"":"s"}]`:"",X=W.status==="done"?a(W.summary,80):W.status==="failed"?a(W.error,80):"";V.push(` ${W.id} ${W.agent}${Y} ${J}${K}${X!==""?` \u2014 ${X}`:""}`)}return V.push("call task_status result <id> for any of them"),V.join(`
23
- `)}class q0{opts;maxConcurrent;maxDepth;tasks=new Map;queue=[];listeners=new Set;run;sink=null;runSignal=null;batch=null;running=0;seq=0;runSeq=0;constructor(z){this.opts=z;this.maxConcurrent=Math.max(1,Math.floor(z.maxConcurrent??B0())),this.maxDepth=Math.min(z.maxDepth??o,o),this.run=z.run??Dz}get lanes(){return this.opts.lanes??{}}attach(z){this.sink=z}bindRun(z,Z){this.runSignal=z;let $=U0(Z?.label,C0);this.batch={id:Z?.id?.trim()||`r${++this.runSeq}`,...$!==""?{label:$}:{}}}start(z,Z={}){let $=this.opts.deps();if(!$)return{ok:!1,reason:"no provider configured"};let Q=n(z.agent)?z.agent:null,V=Q?Oz(Q,this.lanes.env):null;if(V)return{ok:!1,reason:V};let W=Q?{name:Q,systemPrompt:"",tools:[]}:$.defs.get(z.agent);if(!W)return{ok:!1,reason:`unknown agent '${z.agent}'`};let Y=Z.owner??this.runSignal??void 0;if(Y?.aborted)return{ok:!1,reason:"parent run aborted"};let J=(Z.parentDepth??0)+1,K=Jz(W,{depth:J,maxDepth:this.maxDepth,parentSessionId:Z.caller??""});if(!K.ok)return{ok:!1,reason:K.reason??"spawn refused"};let X=$.baseConfig.permissionRules.some((M)=>M.effect==="prompt")?"gated":"open",B=`t${++this.seq}`,P=()=>{},j=new Promise((M)=>{P=M}),F=z.goal.replace(/\s+/g," ").trim(),I=Z.caller!==void 0?this.tasks.get(Z.caller)?.info:void 0,O=I?.batch!==void 0?{id:I.batch,...I.batchLabel!==void 0?{label:I.batchLabel}:{}}:this.batch,S={info:{id:B,label:(Z.label??"").trim()||(F.length>40?F.slice(0,39)+"\u2026":F||"(no goal)"),agent:z.agent,goal:F.length>200?F.slice(0,199)+"\u2026":F,isolated:Q!==null||z.isolated===!0,depth:J,status:"queued",createdAt:Date.now(),...Q?{kind:"external",permissions:c(Q,this.lanes.env)}:{},...O?{batch:O.id,...O.label!==void 0?{batchLabel:O.label}:{}}:{}},req:Z.parentTools?{...z,parentTools:Z.parentTools}:z,deps:$,...Q?{lane:Q}:{},...Z.parentDir!==void 0?{parentDir:Z.parentDir}:{},ac:new AbortController,notify:Z.notify,done:j,resolveDone:P,settled:!1,reported:!1};if(Y){let M=()=>{this.cancel(B)};Y.addEventListener("abort",M,{once:!0}),S.unbind=()=>Y.removeEventListener("abort",M)}return this.tasks.set(B,S),this.queue.push(B),this.emit(S),this.pump(),{ok:!0,id:B,childPolicy:X}}status(z){let Z=this.tasks.get(z);return Z?{...Z.info}:void 0}list(){return[...this.tasks.values()].map((z)=>({...z.info}))}counts(){let z={queued:0,running:0,done:0,failed:0,cancelled:0};for(let Z of this.tasks.values())z[Z.info.status]++;return z}async result(z,Z={}){let $=this.tasks.get(z);if(!$)return;if($.settled)return{...$.info};if($.info.status==="queued"&&Z.caller!==void 0&&this.tasks.get(Z.caller)?.info.status==="running")this.dequeue(z),this.launch($);return await M0($.done,Z.timeoutMs,Z.signal),{...$.info}}cancel(z){let Z=this.tasks.get(z);if(!Z)return;if(BZ(Z.info.status))return{...Z.info};if(Z.info.status==="queued")this.dequeue(z),Z.info.status="cancelled",Z.info.error="cancelled",this.settle(Z);else Z.info.status="cancelled",Z.info.error="cancelled",Z.ac.abort();return{...Z.info}}cancelAll(){let z=0;for(let Z of this.tasks.values())if(!BZ(Z.info.status))this.cancel(Z.info.id),z++;return z}async drain(z){let Z=Date.now()+z;while(this.running>0||this.queue.length>0){if(Date.now()>=Z)return!1;await new Promise(($)=>setTimeout($,10))}return!0}subscribe(z){return this.listeners.add(z),()=>{this.listeners.delete(z)}}dequeue(z){let Z=this.queue.indexOf(z);if(Z>=0)this.queue.splice(Z,1)}pump(){while(this.running<this.maxConcurrent&&this.queue.length>0){let z=this.tasks.get(this.queue.shift());if(z&&z.info.status==="queued")this.launch(z)}}launch(z){if(z.info.status="running",z.info.startedAt=Date.now(),this.running++,this.emit(z),z.lane)(z.notify??this.sink)?.push(`task ${z.info.id} (${z.info.label}): ${ez(z.lane,this.lanes.env)}`);let Z={...z.deps,registryFactory:(Q,V,W)=>z.deps.registryFactory(Q,V,W?{...W,taskId:z.info.id}:void 0)};(z.lane?GZ(this.lanes,z.lane,z.req.goal,z.parentDir??z.deps.rootDir,z.ac.signal,(Q,V)=>this.progress(z,Q,V)):this.run(Z,z.req,z.info.depth,z.ac.signal)).then((Q)=>this.finish(z,Q),(Q)=>this.finish(z,void 0,Q)).finally(()=>{this.running--,this.pump()})}progress(z,Z,$){if(z.info.status!=="running")return;if(z.info.summary=Z,$){if(z.info.progress=$,$.usage)z.info.usage=$.usage}this.emit(z)}finish(z,Z,$){let Q=z.info;if(Z&&"permissions"in Z){if(Z.sessionId)Q.laneSession=Z.sessionId;if(Q.laneExit=Z.exitCode,Z.model)Q.laneModel=Z.model;if(Z.progress)Q.progress=Z.progress}if(Q.status==="cancelled"){if(Z)Q.usage=Z.usage}else if(Z===void 0)Q.status="failed",Q.error=`child runner threw: ${$ instanceof Error?$.message:String($)}`;else if(!Z.ok)Q.status="failed",Q.error=Z.summary,Q.usage=Z.usage;else if(Q.status="done",Q.summary=Z.summary,Q.usage=Z.usage,Z.patch!==void 0){Q.patchLines=Z.patch.trim()===""?0:Z.patch.split(`
22
+ `)}function U0(z,Z){let $=(z??"").replace(/\s+/g," ").trim();return $.length>Z?$.slice(0,Z-1)+"\u2026":$}function N0(z,Z=z){let $=new Set(z.map((J)=>J.id)),Q=new Map;for(let J of Z)for(let K of J.files??[])Q.set(K,[...Q.get(K)??[],J.id]);let V=[...Q].filter(([,J])=>J.length>1&&J.some((K)=>$.has(K))).map(([J,K])=>({path:J,tasks:K})).sort((J,K)=>J.path.localeCompare(K.path)),W=(J)=>z.reduce((K,X)=>K+(X.status===J?1:0),0),Y=z.find((J)=>J.batchLabel!==void 0)?.batchLabel;return{batch:z[0]?.batch??"",...Y!==void 0?{label:Y}:{},tasks:z,done:W("done"),failed:W("failed"),cancelled:W("cancelled"),collisions:V}}function P0(z){let Z=[];if(z.failed>0)Z.push(`${z.failed} FAILED`);if(z.cancelled>0)Z.push(`${z.cancelled} cancelled`);if(z.done>0)Z.push(`${z.done} done`);let $=z.tasks.length,V=[`batch ${z.batch}${z.label!==void 0?` (${z.label})`:""}: ${$} agent${$===1?"":"s"} \u2014 ${Z.join(", ")}`];for(let W of z.collisions)V.push(`COLLISION: ${W.path} \u2014 ${O0(W.tasks)} both changed this file`);for(let W of z.tasks){let Y=W.startedAt!==void 0&&W.finishedAt!==void 0?` ${Math.max(0,Math.round((W.finishedAt-W.startedAt)/1000))}s`:"",J=W.status==="failed"?"FAILED":W.status,K=W.files!==void 0&&W.files.length>0?` [${W.files.length} file${W.files.length===1?"":"s"}]`:"",X=W.status==="done"?p(W.summary,80):W.status==="failed"?p(W.error,80):"";V.push(` ${W.id} ${W.agent}${Y} ${J}${K}${X!==""?` \u2014 ${X}`:""}`)}return V.push("call task_status result <id> for any of them"),V.join(`
23
+ `)}class q0{opts;maxConcurrent;maxDepth;tasks=new Map;queue=[];listeners=new Set;run;sink=null;runSignal=null;batch=null;running=0;seq=0;runSeq=0;constructor(z){this.opts=z;this.maxConcurrent=Math.max(1,Math.floor(z.maxConcurrent??B0())),this.maxDepth=Math.min(z.maxDepth??o,o),this.run=z.run??Dz}get lanes(){return this.opts.lanes??{}}attach(z){this.sink=z}bindRun(z,Z){this.runSignal=z;let $=U0(Z?.label,C0);this.batch={id:Z?.id?.trim()||`r${++this.runSeq}`,...$!==""?{label:$}:{}}}start(z,Z={}){let $=this.opts.deps();if(!$)return{ok:!1,reason:"no provider configured"};let Q=n(z.agent)?z.agent:null,V=Q?Oz(Q,this.lanes.env):null;if(V)return{ok:!1,reason:V};let W=Q?{name:Q,systemPrompt:"",tools:[]}:$.defs.get(z.agent);if(!W)return{ok:!1,reason:`unknown agent '${z.agent}'`};let Y=Z.owner??this.runSignal??void 0;if(Y?.aborted)return{ok:!1,reason:"parent run aborted"};let J=(Z.parentDepth??0)+1,K=Jz(W,{depth:J,maxDepth:this.maxDepth,parentSessionId:Z.caller??""});if(!K.ok)return{ok:!1,reason:K.reason??"spawn refused"};let X=$.baseConfig.permissionRules.some((M)=>M.effect==="prompt")?"gated":"open",B=`t${++this.seq}`,P=()=>{},j=new Promise((M)=>{P=M}),F=z.goal.replace(/\s+/g," ").trim(),I=Z.caller!==void 0?this.tasks.get(Z.caller)?.info:void 0,O=I?.batch!==void 0?{id:I.batch,...I.batchLabel!==void 0?{label:I.batchLabel}:{}}:this.batch,S={info:{id:B,label:(Z.label??"").trim()||(F.length>40?F.slice(0,39)+"\u2026":F||"(no goal)"),agent:z.agent,goal:F.length>200?F.slice(0,199)+"\u2026":F,isolated:Q!==null||z.isolated===!0,depth:J,status:"queued",createdAt:Date.now(),...Z.caller!==void 0?{parent:Z.caller}:{},...Q?{kind:"external",permissions:c(Q,this.lanes.env)}:{},...O?{batch:O.id,...O.label!==void 0?{batchLabel:O.label}:{}}:{}},req:Z.parentTools?{...z,parentTools:Z.parentTools}:z,deps:$,...Q?{lane:Q}:{},...Z.parentDir!==void 0?{parentDir:Z.parentDir}:{},ac:new AbortController,notify:Z.notify,done:j,resolveDone:P,settled:!1,reported:!1};if(Y){let M=()=>{this.cancel(B)};Y.addEventListener("abort",M,{once:!0}),S.unbind=()=>Y.removeEventListener("abort",M)}return this.tasks.set(B,S),this.queue.push(B),this.emit(S),this.pump(),{ok:!0,id:B,childPolicy:X}}status(z){let Z=this.tasks.get(z);return Z?{...Z.info}:void 0}list(){return[...this.tasks.values()].map((z)=>({...z.info}))}counts(){let z={queued:0,running:0,done:0,failed:0,cancelled:0};for(let Z of this.tasks.values())z[Z.info.status]++;return z}async result(z,Z={}){let $=this.tasks.get(z);if(!$)return;if($.settled)return{...$.info};if($.info.status==="queued"&&Z.caller!==void 0&&this.tasks.get(Z.caller)?.info.status==="running")this.dequeue(z),this.launch($);return await M0($.done,Z.timeoutMs,Z.signal),{...$.info}}cancel(z){let Z=this.tasks.get(z);if(!Z)return;if(BZ(Z.info.status))return{...Z.info};if(Z.info.status==="queued")this.dequeue(z),Z.info.status="cancelled",Z.info.error="cancelled",this.settle(Z);else Z.info.status="cancelled",Z.info.error="cancelled",Z.ac.abort();return{...Z.info}}cancelAll(){let z=0;for(let Z of this.tasks.values())if(!BZ(Z.info.status))this.cancel(Z.info.id),z++;return z}async drain(z){let Z=Date.now()+z;while(this.running>0||this.queue.length>0){if(Date.now()>=Z)return!1;await new Promise(($)=>setTimeout($,10))}return!0}subscribe(z){return this.listeners.add(z),()=>{this.listeners.delete(z)}}dequeue(z){let Z=this.queue.indexOf(z);if(Z>=0)this.queue.splice(Z,1)}pump(){while(this.running<this.maxConcurrent&&this.queue.length>0){let z=this.tasks.get(this.queue.shift());if(z&&z.info.status==="queued")this.launch(z)}}launch(z){if(z.info.status="running",z.info.startedAt=Date.now(),this.running++,this.emit(z),z.lane)(z.notify??this.sink)?.push(`task ${z.info.id} (${z.info.label}): ${ez(z.lane,this.lanes.env)}`);let Z={...z.deps,registryFactory:(Q,V,W)=>z.deps.registryFactory(Q,V,W?{...W,taskId:z.info.id}:void 0)};(z.lane?GZ(this.lanes,z.lane,z.req.goal,z.parentDir??z.deps.rootDir,z.ac.signal,(Q,V)=>this.progress(z,Q,V)):this.run(Z,z.req,z.info.depth,z.ac.signal)).then((Q)=>this.finish(z,Q),(Q)=>this.finish(z,void 0,Q)).finally(()=>{this.running--,this.pump()})}progress(z,Z,$){if(z.info.status!=="running")return;if(z.info.summary=Z,$){if(z.info.progress=$,$.usage)z.info.usage=$.usage}this.emit(z)}finish(z,Z,$){let Q=z.info;if(Z&&"permissions"in Z){if(Z.sessionId)Q.laneSession=Z.sessionId;if(Q.laneExit=Z.exitCode,Z.model)Q.laneModel=Z.model;if(Z.progress)Q.progress=Z.progress}if(Q.status==="cancelled"){if(Z)Q.usage=Z.usage}else if(Z===void 0)Q.status="failed",Q.error=`child runner threw: ${$ instanceof Error?$.message:String($)}`;else if(!Z.ok)Q.status="failed",Q.error=Z.summary,Q.usage=Z.usage;else if(Q.status="done",Q.summary=Z.summary,Q.usage=Z.usage,Z.patch!==void 0){Q.patchLines=Z.patch.trim()===""?0:Z.patch.split(`
24
24
  `).length;let V=Q.progress?.applied??Z.applied??!0,W=Q.progress?.filesWritten??Wz(Z.patch);if(V&&W.length>0)Q.files=W}this.settle(z)}settle(z){z.settled=!0,z.unbind?.(),z.info.finishedAt=Date.now();let Z=this.noteFor(z);if(Z!==null)(z.notify??this.sink)?.push(Z);z.resolveDone(),this.emit(z)}noteFor(z){let Z=z.info.batch;if(Z===void 0)return z.reported=!0,FZ(z.info);let $=z.notify??this.sink,Q=[...this.tasks.values()].filter((Y)=>Y.info.batch===Z&&(Y.notify??this.sink)===$);if(Q.some((Y)=>!Y.settled))return null;let V=Q.filter((Y)=>!Y.reported);for(let Y of V)Y.reported=!0;let W=N0(V.map((Y)=>({...Y.info})),Q.map((Y)=>({...Y.info})));if(W.tasks.length<=1&&W.collisions.length===0)return FZ(z.info);return P0(W)}emit(z){for(let Z of this.listeners)try{Z({...z.info})}catch{}}}function M0(z,Z,$){return new Promise((Q)=>{let V,W=!1,Y=()=>{if(W)return;if(W=!0,V!==void 0)clearTimeout(V);$?.removeEventListener("abort",Y),Q()};if($?.aborted){Y();return}if(Z!==void 0)V=setTimeout(Y,Math.max(0,Z));$?.addEventListener("abort",Y,{once:!0}),z.then(Y,Y)})}var X0=3,F0,BZ=(z)=>F0.has(z),C0=60,O0=(z)=>z.length<=1?z[0]??"":`${z.slice(0,-1).join(", ")} and ${z[z.length-1]}`;var R0=T(()=>{Gz();XZ();Yz();$z();F0=new Set(["done","failed","cancelled"])});
25
- export{k as fe,h as ge,iz as he,Z1 as ie,$z as je,X0 as ke,B0 as le,BZ as me,FZ as ne,T1 as oe,C0 as pe,N0 as qe,P0 as re,q0 as se,R0 as te};
25
+ export{k as Fe,h as Ge,iz as He,Z1 as Ie,$z as Je,X0 as Ke,B0 as Le,BZ as Me,FZ as Ne,T1 as Oe,C0 as Pe,N0 as Qe,P0 as Re,q0 as Se,R0 as Te};
@@ -13,4 +13,4 @@ ${q} content \u2014 concise, factual, only what you verified in the files:
13
13
  - For a non-code directory: what it holds, the key files and how the contents are meant to be used.
14
14
 
15
15
  ${F?`Edit ${q} in place; do not create a second file.`:"Write the complete file with the write tool as well-formatted Markdown; do not touch other files."} Keep it under about 150 lines.`}function $(z,F){let D=/^\/(\S+)(?:\s+([\s\S]*))?$/.exec(z.trim());if(!D)return;let H=Object.hasOwn(J,D[1].toLowerCase())?J[D[1].toLowerCase()]:void 0;return H?H(F,(D[2]??"").trim()):void 0}var q="AGENTS.md",J;var X=K(()=>{J={init:(z)=>W(z)}});
16
- export{q as jh,$ as kh,X as lh};
16
+ export{q as ad,$ as bd,X as cd};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{pm as Z,vm as D}from"./main-y5c82rxr.js";import{wn as $}from"./main-qsevpgsv.js";function K(q,y="mcp output"){if(q.length<=V)return q;return`${q.slice(0,V)}
2
+ import{Fm as D,zm as Z}from"./main-7rn6bqje.js";import{wn as $}from"./main-qsevpgsv.js";function K(q,y="mcp output"){if(q.length<=V)return q;return`${q.slice(0,V)}
3
3
  [${y} truncated: showing ${V} of ${q.length} chars]`}function E(q,y){let z=[];if(Array.isArray(q))for(let B of q){if(!Z(B))continue;if(B.type==="text"&&typeof B.text==="string")z.push(B.text);else if(typeof B.type==="string")z.push(`[${B.type} content]`)}if(z.length===0&&y!==void 0)try{z.push(JSON.stringify(y))}catch{}return K(z.join(`
4
4
  `))}function R(q){let y=new AbortController;if(q===void 0)return{signal:y.signal,dispose:()=>{}};if(q.aborted)return y.abort(q.reason),{signal:y.signal,dispose:()=>{}};let z=()=>y.abort(q.reason);return q.addEventListener("abort",z,{once:!0}),{signal:y.signal,dispose:()=>q.removeEventListener("abort",z)}}async function G(q,y){let z=R(q);try{return await y(z.signal)}finally{z.dispose()}}function I(q){return typeof q==="object"&&q!==null&&q.code===-32601}function W(q){return`needs login \u2014 run \`rovecode mcp login ${q}\``}function k(q){return q.headers!==void 0&&Object.keys(q.headers).some((y)=>y.toLowerCase()==="authorization")}async function L(q,y,z){let B,H=new Promise((J,F)=>{B=setTimeout(()=>F(Error(z)),y)});try{return await Promise.race([q,H])}finally{if(B!==void 0)clearTimeout(B)}}async function O(q,y,z,B){let H=[],J=new Set,F,N=0;do{if(B?.aborted)throw Error(`${q} listing on "${y}" aborted`);let Q=await z(F);if(N+=1,H.push(...Q.items),F=typeof Q.nextCursor==="string"?Q.nextCursor:void 0,F!==void 0){if(J.has(F))throw Error(`${q} listing on "${y}" stopped: server repeated pagination cursor ${JSON.stringify(F)} (partial: ${H.length} ${q}s in ${N} pages)`);if(J.add(F),N>=Y)throw Error(`${q} listing on "${y}" stopped after ${Y} pages without a final page (partial: ${H.length} ${q}s)`)}}while(F!==void 0);return H}var Y=50,V=1e4,b;var j=$(()=>{D();b=class b extends Error{constructor(q){super(W(q));this.name="McpNeedsLoginError"}}});
5
- export{K as cm,E as dm,R as em,G as fm,I as gm,W as hm,b as im,k as jm,L as km,O as lm,j as mm};
5
+ export{K as ch,E as dh,R as eh,G as fh,I as gh,W as hh,b as ih,k as jh,L as kh,O as lh,j as mh};
@@ -1,4 +1,4 @@
1
1
  // @bun
2
2
  import{$m as _,Lm as D,Nm as V,Om as K,Ym as N}from"./main-2yeveeve.js";_();import{mkdirSync as R,readFileSync as U,statSync as k,writeFileSync as g}from"fs";import{dirname as S,join as j}from"path";var E=[{id:"kaesra",baseUrl:"https://api.example.invalid/v1",protocol:"openai",keyEnv:"KAESRA_API_KEY",defaultModel:"zai-org/glm-5.3-flash"},{id:"openai",baseUrl:"https://api.openai.com/v1",protocol:"openai",keyEnv:"OPENAI_API_KEY"},{id:"anthropic",baseUrl:"https://api.anthropic.com/v1",protocol:"anthropic",keyEnv:"ANTHROPIC_API_KEY",defaultModel:"claude-opus-5"},{id:"deepseek",baseUrl:"https://api.deepseek.com/v1",protocol:"openai",keyEnv:"DEEPSEEK_API_KEY"},{id:"groq",baseUrl:"https://api.groq.com/openai/v1",protocol:"openai",keyEnv:"GROQ_API_KEY"},{id:"openrouter",baseUrl:"https://openrouter.ai/api/v1",protocol:"openai",keyEnv:"OPENROUTER_API_KEY"},{id:"ollama",baseUrl:"http://127.0.0.1:11434/v1",protocol:"openai",keyEnv:"OLLAMA_API_KEY"},{id:"lmstudio",baseUrl:"http://127.0.0.1:1234/v1",protocol:"openai",keyEnv:"LMSTUDIO_API_KEY"},{id:"together",baseUrl:"https://api.together.xyz/v1",protocol:"openai",keyEnv:"TOGETHER_API_KEY"},{id:"mistral",baseUrl:"https://api.mistral.ai/v1",protocol:"openai",keyEnv:"MISTRAL_API_KEY"},{id:"cerebras",baseUrl:"https://api.cerebras.ai/v1",protocol:"openai",keyEnv:"CEREBRAS_API_KEY"},{id:"fireworks",baseUrl:"https://api.fireworks.ai/inference/v1",protocol:"openai",keyEnv:"FIREWORKS_API_KEY"},{id:"perplexity",baseUrl:"https://api.perplexity.ai",protocol:"openai",keyEnv:"PERPLEXITY_API_KEY"},{id:"xai",baseUrl:"https://api.x.ai/v1",protocol:"openai",keyEnv:"XAI_API_KEY"},{id:"moondream",baseUrl:"https://api.moondream.ai/v1",protocol:"openai",keyEnv:"MOONDREAM_API_KEY"},{id:"vllm",baseUrl:"http://127.0.0.1:8000/v1",protocol:"openai",keyEnv:"VLLM_API_KEY"}];function T(){return j(D(),"providers.json")}function O(q){return j(q,".rovecode","providers.json")}function t(q,G){return q==="project"?O(G):T()}var b=/^[a-z0-9][a-z0-9_.-]{0,39}$/,f=/^[A-Z_][A-Z0-9_]*$/;function x(q){return q.includes("anthropic.com")?"anthropic":"openai"}function u(q,G){if(!b.test(q))return{error:`provider id "${q}" must be a lowercase slug (a-z 0-9 _ . -), at most 40 chars`};if(typeof G!=="object"||G===null||Array.isArray(G))return{error:`provider "${q}": entry must be an object`};let z=G,W=typeof z.baseUrl==="string"?z.baseUrl.trim().replace(/\/+$/,""):"";if(!/^https?:\/\/[^\s/]+/.test(W))return{error:`provider "${q}": baseUrl must be an http(s) URL`};let X=z.protocol===void 0?x(W):z.protocol;if(X!=="openai"&&X!=="anthropic")return{error:`provider "${q}": protocol must be "openai" or "anthropic"`};let J={id:q,baseUrl:W,protocol:X};if(z.keyEnv!==void 0){if(typeof z.keyEnv!=="string"||!f.test(z.keyEnv))return{error:`provider "${q}": keyEnv must be an ENV_VAR_NAME`};J.keyEnv=z.keyEnv}if(z.defaultModel!==void 0){if(typeof z.defaultModel!=="string"||z.defaultModel.trim().length===0)return{error:`provider "${q}": defaultModel must be a non-empty string`};J.defaultModel=z.defaultModel.trim()}if(z.models!==void 0){if(!Array.isArray(z.models)||!z.models.every((Q)=>typeof Q==="string"&&Q.trim().length>0))return{error:`provider "${q}": models must be a list of model ids`};J.models=z.models.map((Q)=>Q.trim())}if(z.headers!==void 0){let Q=z.headers;if(typeof Q!=="object"||Q===null||Array.isArray(Q)||!Object.values(Q).every((Y)=>typeof Y==="string"))return{error:`provider "${q}": headers must be an object of strings`};J.headers={...Q}}if(z.noKey!==void 0){if(typeof z.noKey!=="boolean")return{error:`provider "${q}": noKey must be true or false`};if(z.noKey)J.noKey=!0}return{spec:J}}function y(q){let G;try{G=U(q,"utf8")}catch{return{data:{},warnings:[]}}let z;try{z=JSON.parse(G)}catch{return{data:{},warnings:[`${q}: invalid JSON \u2014 ignored`]}}if(typeof z!=="object"||z===null||Array.isArray(z))return{data:{},warnings:[`${q}: expected an object \u2014 ignored`]};let W=z,X={},J=[];if(W.default!==void 0)if(typeof W.default==="string"&&W.default.trim().length>0)X.default=W.default.trim();else J.push(`${q}: "default" must be "provider/model" \u2014 ignored`);if(W.providers!==void 0){let Q=W.providers;if(typeof Q!=="object"||Q===null||Array.isArray(Q))J.push(`${q}: "providers" must be an object \u2014 ignored`);else{X.providers={};for(let[Y,H]of Object.entries(Q)){let $=u(Y,H);if("error"in $){J.push(`${q}: ${$.error} \u2014 ignored`);continue}let{id:L,...Z}=$.spec;X.providers[Y]=Z}}}return{data:X,warnings:J}}function d(q,G){R(S(q),{recursive:!0}),g(q,JSON.stringify(G,null,2)+`
3
3
  `)}function P(q,G,z,W){let X=q.keyEnv??N(q.id),J=W[q.id]?.key;if(J!==void 0&&J.trim().length>0)return{...q,keyEnv:X,scope:G,apiKey:J,keySource:"stored"};let Q=z[X];if(Q!==void 0&&Q.trim().length>0)return{...q,keyEnv:X,scope:G,apiKey:Q,keySource:"env"};return{...q,keyEnv:X,scope:G,apiKey:null,keySource:"none"}}function m(q){let G=q.ROVECODE_BASE_URL,z=q.ROVECODE_API_KEY??q.OPENAI_API_KEY;if(!G||!z)return null;return{id:"custom",baseUrl:G,protocol:x(G),keyEnv:"ROVECODE_API_KEY",scope:"env",apiKey:z,keySource:"inline",...q.ROVECODE_MODEL?{defaultModel:q.ROVECODE_MODEL}:{}}}function w(q){return q.apiKey!==null||q.noKey===!0}function h(q,G=process.env){let z=[],W=[],X=new Map;for(let Z of E)X.set(Z.id,{spec:Z,scope:"builtin"}),W.push(Z.id);let J,Q,Y=(Z,A)=>{let{data:M,warnings:F}=y(Z);z.push(...F);for(let[B,I]of Object.entries(M.providers??{})){let C=X.get(B);if(X.set(B,{spec:{...C?.spec??{},...I,id:B},scope:A}),C===void 0)W.push(B)}if(M.default!==void 0)J=M.default,Q=A};Y(T(),"user"),Y(O(q),"project");let H=K(),$=W.map((Z)=>{let A=X.get(Z);return P(A.spec,A.scope,G,H)}),L=m(G);if(L)$.push(L);return{providers:$,...J!==void 0?{defaultSelector:J,defaultScope:Q}:{},warnings:z}}function l(q){let G=q.trim(),z=G.indexOf("/");if(z<=0)return{provider:G};let W=G.slice(z+1).trim();return W.length>0?{provider:G.slice(0,z),model:W}:{provider:G.slice(0,z)}}function o(q){let G=q.providers.find((J)=>J.scope==="env");if(G)return{provider:G,model:G.defaultModel,via:"env-pair"};if(q.defaultSelector!==void 0){let J=l(q.defaultSelector),Q=q.providers.find((Y)=>Y.id===J.provider);if(Q&&w(Q))return{provider:Q,model:J.model??Q.defaultModel,via:"default"}}let z=q.providers.find((J)=>J.keySource==="stored");if(z)return{provider:z,model:z.defaultModel,via:"stored"};let W=q.providers.find((J)=>J.keySource==="env");if(W)return{provider:W,model:W.defaultModel,via:"env-key"};let X=q.providers.find((J)=>J.noKey===!0);if(X)return{provider:X,model:X.defaultModel,via:"no-key"};return null}class v{cwd;env;throttleMs;snap=null;stamp="";checkedAt=-1/0;listeners=new Set;constructor(q,G=process.env,z=250){this.cwd=q;this.env=G;this.throttleMs=z}sourcePaths(){return[T(),O(this.cwd),V()]}stampNow(){return this.sourcePaths().map((q)=>{try{let G=k(q);return`${G.mtimeMs}:${G.size}`}catch{return"-"}}).join("|")}snapshot(){let q=Date.now();if(this.snap!==null&&q-this.checkedAt<this.throttleMs)return this.snap;this.checkedAt=q;let G=this.stampNow();if(this.snap===null||G!==this.stamp){let z=this.snap===null;if(this.stamp=G,this.snap=h(this.cwd,this.env),!z)for(let W of this.listeners)W(this.snap)}return this.snap}invalidate(){this.checkedAt=-1/0,this.stamp=""}onChange(q){return this.listeners.add(q),()=>{this.listeners.delete(q)}}}
4
- export{E as Ri,T as Si,O as Ti,t as Ui,b as Vi,x as Wi,u as Xi,y as Yi,d as Zi,P as _i,m as $i,w as aj,h as bj,l as cj,o as dj,v as ej};
4
+ export{E as Ti,T as Ui,O as Vi,t as Wi,b as Xi,x as Yi,u as Zi,y as _i,d as $i,P as aj,m as bj,w as cj,h as dj,l as ej,o as fj,v as gj};
@@ -15,4 +15,4 @@ import{lookup as o}from"dns/promises";var p=new Set(["script","style","noscript"
15
15
  `)]:[]].filter((Y)=>Y!=="").join(`
16
16
 
17
17
  `);return{ok:L.status<400,output:u,data:{url:q.href,status:L.status,contentType:D,bytes:B.bytes.length,redirects:w,truncated:B.truncated||A}}}}finally{clearTimeout(N),G.signal.removeEventListener("abort",O)}}return{schema:{name:"web_fetch",description:`Fetch a public http(s) URL with GET and return its content as readable text. HTML is reduced to text (scripts/styles dropped, headings/paragraphs/lists kept, links as "text (href)"); JSON, XML and plain text pass through unchanged. Follows at most ${S} redirects, and only within the same host: a redirect to another host stops with that URL \u2014 fetch it directly. Only text/*, JSON, XML and XHTML responses are accepted. The body is read up to ${H} bytes and the text is capped at maxChars (default ${f}, cap ${k}); both truncations leave a marker. Times out after ${b/1000}s. Private, loopback, link-local and unresolvable hosts are refused. Output starts with a header line: final URL, HTTP status, content-type, bytes read.`,args:{type:"object",properties:{url:{type:"string",description:"absolute http:// or https:// URL to fetch"},maxChars:{type:"integer",description:`max characters of text returned (default ${f}, cap ${k})`}},required:["url"]}},kind:"network",sequential:!1,execute:(Z,G)=>$(Z??{},G)}}var wz=Nz();
18
- export{H as Ge,f as He,k as Ie,S as Je,b as Ke,t as Le,v as Me,Qz as Ne,C as Oe,Zz as Pe,Vz as Qe,Wz as Re,Nz as Se,wz as Te};
18
+ export{H as wf,f as xf,k as yf,S as zf,b as Af,t as Bf,v as Cf,Qz as Df,C as Ef,Zz as Ff,Vz as Gf,Wz as Hf,Nz as If,wz as Jf};
@@ -4,4 +4,4 @@ import{wn as M}from"./main-qsevpgsv.js";import{mkdirSync as X,readFileSync as l,
4
4
  `)}function O(z){let q=h(z);if(q.total===0||q.completed===q.total)return null;return["<plan-reminder>","Your own todo list for this task, still open \u2014 not a message from the user.",g(z),q.inProgress===0?"Nothing is in progress. Mark the next item in_progress with todo_write before you start it.":"Mark the in_progress item completed with todo_write the moment it is done, then start the next one.","Rewrite the list if the plan changed. Never mention this reminder in your reply.","</plan-reminder>"].join(`
5
5
  `)}function n(z){if(z.length===0)return"";let q=h(z);return`todos ${q.completed}/${q.total}`}function _(z){return{schema:{name:"todo_write",description:D,args:{type:"object",properties:{todos:{type:"array",description:"the complete, updated todo list (replaces the current one)",maxItems:Y,items:I}},required:["todos"]}},kind:"memory",sequential:!0,execute(q,Q){let K=F(z,Q.sessionId);if(!K)return Promise.resolve({ok:!1,output:`todo_write failed: invalid session id ${U(Q.sessionId)}`});let J=L((q&&typeof q==="object"?q:{}).todos);if(!J.ok)return Promise.resolve({ok:!1,output:`todo_write failed: ${J.error}; the list was not changed`});try{E(K,J.items)}catch(Z){return Promise.resolve({ok:!1,output:`todo_write failed: could not write ${G}: ${Z instanceof Error?Z.message:String(Z)}`})}let k=J.items.length===0?"Cleared todo list.":g(J.items);return Promise.resolve({ok:!0,output:k,data:{items:J.items}})}}}function S(z){return{schema:{name:"todo_read",description:m,args:{type:"object",properties:{}}},kind:"read",sequential:!1,execute(q,Q){let K=F(z,Q.sessionId);if(!K)return Promise.resolve({ok:!1,output:`todo_read failed: invalid session id ${U(Q.sessionId)}`});let{items:$,note:J}=A(K);if($.length===0){let k=J?`${J}
6
6
  `:"";return Promise.resolve({ok:!0,output:`${k}No todos for this session yet \u2014 use todo_write to create a list.`,data:{items:$,...J?{note:J}:{}}})}return Promise.resolve({ok:!0,output:g($),data:{items:$}})}}}function r(z){return[_(z),S(z)]}var f,u,Y=50,W=64,j=500,G="todos.json",p=1,P=200,R,D,m="Read this session's todo list as last written by todo_write: ids, content, status, priority. Use it to get the current ids before updating the list, or to check what remains. Empty until todo_write creates a list.",I;var a=M(()=>{f=["pending","in_progress","completed"],u=["high","medium","low"];R={pending:"[ ]",in_progress:"[>]",completed:"[x]"};D="Create or update this session's structured todo list (your plan). REPLACES the whole list: send every item "+`you want kept \u2014 items {id, content, status, priority?}; at most ${Y} items, ids unique and non-empty `+`(\u2264${W} chars), content non-empty (\u2264${j} chars). Statuses: pending | in_progress (exactly ONE at a time) | completed. Priority: high | medium | low (optional). An invalid list is rejected whole and nothing changes; an empty list clears the todos. Use proactively when: the task needs 3+ distinct steps; the work is non-trivial and benefits from planning; the user gives multiple tasks or asks for a todo list; new instructions arrive (capture them as todos); you start a step (mark it in_progress first) or finish one (mark it `+"completed only once the work, including verification, is actually done \u2014 never on intent; add follow-ups "+"discovered on the way). Skip it for a single straightforward task, a purely informational request, or when "+"tracking adds no value. Update in real time \u2014 don't batch completions. When in doubt, use it.",I={type:"object",properties:{id:{type:"string",description:`stable short id, unique within the list (e.g. "t1"); \u2264${W} chars`},content:{type:"string",description:`brief, specific, actionable description of the task; \u2264${j} chars`},status:{type:"string",enum:[...f],description:"pending | in_progress (exactly one at a time) | completed"},priority:{type:"string",enum:[...u],description:"optional priority"}},required:["id","content","status"]}});
7
- export{f as mf,u as nf,Y as of,W as pf,j as qf,G as rf,L as sf,A as tf,E as uf,h as vf,g as wf,O as xf,n as yf,_ as zf,S as Af,r as Bf,a as Cf};
7
+ export{f as cg,u as dg,Y as eg,W as fg,j as gg,G as hg,L as ig,A as jg,E as kg,h as lg,g as mg,O as ng,n as og,_ as pg,S as qg,r as rg,a as sg};
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- import{pm as h,qm as H,vm as C}from"./main-y5c82rxr.js";import{$m as X,Lm as z}from"./main-2yeveeve.js";import{wn as G}from"./main-qsevpgsv.js";var k=(e,...i)=>["-y",e,...i],P;var K=G(()=>{P=[{key:"filesystem",title:"Filesystem",source:"curated",publisher:"modelcontextprotocol (Anthropic)",description:"Read, write, search and move files under the directories you name.",repository:"https://github.com/modelcontextprotocol/servers",installs:[{kind:"stdio",runtime:"npx",command:"npx",args:k("@modelcontextprotocol/server-filesystem"),env:[],pending:["<directory the server may touch>"]}]},{key:"memory",title:"Memory",source:"curated",publisher:"modelcontextprotocol (Anthropic)",description:"A knowledge graph the model can remember across sessions with (entities, relations, observations).",repository:"https://github.com/modelcontextprotocol/servers",installs:[{kind:"stdio",runtime:"npx",command:"npx",args:k("@modelcontextprotocol/server-memory"),env:[],pending:[]}]},{key:"sequential-thinking",title:"Sequential Thinking",source:"curated",publisher:"modelcontextprotocol (Anthropic)",description:"A scratchpad tool for step-by-step reasoning with revisions and branches.",repository:"https://github.com/modelcontextprotocol/servers",installs:[{kind:"stdio",runtime:"npx",command:"npx",args:k("@modelcontextprotocol/server-sequential-thinking"),env:[],pending:[]}]},{key:"everything",title:"Everything (test server)",source:"curated",publisher:"modelcontextprotocol (Anthropic)",description:"Exercises every MCP feature \u2014 prompts, resources, sampling, progress. For testing a client, not for work.",repository:"https://github.com/modelcontextprotocol/servers",installs:[{kind:"stdio",runtime:"npx",command:"npx",args:k("@modelcontextprotocol/server-everything"),env:[],pending:[]}]},{key:"fetch",title:"Fetch",source:"curated",publisher:"modelcontextprotocol (Anthropic)",description:"Fetch a URL and hand the page back as markdown (Python; needs uv).",repository:"https://github.com/modelcontextprotocol/servers",installs:[{kind:"stdio",runtime:"uvx",command:"uvx",args:["mcp-server-fetch"],env:[],pending:[]}]},{key:"git",title:"Git",source:"curated",publisher:"modelcontextprotocol (Anthropic)",description:"Read and search git repositories: log, diff, show, status (Python; needs uv).",repository:"https://github.com/modelcontextprotocol/servers",installs:[{kind:"stdio",runtime:"uvx",command:"uvx",args:["mcp-server-git"],env:[],pending:[]}]},{key:"time",title:"Time",source:"curated",publisher:"modelcontextprotocol (Anthropic)",description:"Current time and timezone conversion (Python; needs uv).",repository:"https://github.com/modelcontextprotocol/servers",installs:[{kind:"stdio",runtime:"uvx",command:"uvx",args:["mcp-server-time"],env:[],pending:[]}]},{key:"github",title:"GitHub",source:"curated",publisher:"GitHub",description:"Issues, pull requests, code search and Actions on GitHub \u2014 remote with a personal access token, or the official image via docker.",repository:"https://github.com/github/github-mcp-server",installs:[{kind:"http",url:"https://api.githubcopilot.com/mcp/",headers:[{name:"Authorization",template:"Bearer {GITHUB_PAT}",required:!0,secret:!0,description:"a GitHub personal access token"}]},{kind:"stdio",runtime:"docker",command:"docker",args:["run","-i","--rm","-e","GITHUB_PERSONAL_ACCESS_TOKEN","ghcr.io/github/github-mcp-server"],env:[{name:"GITHUB_PERSONAL_ACCESS_TOKEN",required:!0,secret:!0,description:"a GitHub personal access token"}],pending:[]}]},{key:"playwright",title:"Playwright",source:"curated",publisher:"Microsoft",description:"Drive a real browser through accessibility snapshots: navigate, click, type, screenshot.",repository:"https://github.com/microsoft/playwright-mcp",installs:[{kind:"stdio",runtime:"npx",command:"npx",args:k("@playwright/mcp@latest"),env:[],pending:[]}]},{key:"context7",title:"Context7",source:"curated",publisher:"Upstash",description:"Up-to-date library documentation and code examples for the versions you actually use.",repository:"https://github.com/upstash/context7",installs:[{kind:"http",url:"https://mcp.context7.com/mcp",headers:[{name:"CONTEXT7_API_KEY",required:!1,secret:!0,description:"optional API key for higher limits"}]},{kind:"stdio",runtime:"npx",command:"npx",args:k("@upstash/context7-mcp"),env:[{name:"CONTEXT7_API_KEY",required:!1,secret:!0,description:"optional API key for higher limits"}],pending:[]}]},{key:"brave-search",title:"Brave Search",source:"curated",publisher:"Brave",description:"Web, news, image and local search through the Brave Search API.",repository:"https://github.com/brave/brave-search-mcp-server",installs:[{kind:"stdio",runtime:"npx",command:"npx",args:k("@brave/brave-search-mcp-server"),env:[{name:"BRAVE_API_KEY",required:!0,secret:!0,description:"Brave Search API key"}],pending:[]}]},{key:"firecrawl",title:"Firecrawl",source:"curated",publisher:"Firecrawl (Mendable)",description:"Scrape, crawl and extract structured data from websites.",repository:"https://github.com/mendableai/firecrawl-mcp-server",installs:[{kind:"stdio",runtime:"npx",command:"npx",args:k("firecrawl-mcp"),env:[{name:"FIRECRAWL_API_KEY",required:!0,secret:!0,description:"Firecrawl API key"}],pending:[]}]},{key:"tavily",title:"Tavily",source:"curated",publisher:"Tavily",description:"Search and extract built for agents: web search, page extraction, site crawl.",repository:"https://github.com/tavily-ai/tavily-mcp",installs:[{kind:"stdio",runtime:"npx",command:"npx",args:k("tavily-mcp"),env:[{name:"TAVILY_API_KEY",required:!0,secret:!0,description:"Tavily API key"}],pending:[]}]},{key:"exa",title:"Exa",source:"curated",publisher:"Exa",description:"Neural web search and page contents for AI; the remote works without a key at a low rate.",repository:"https://github.com/exa-labs/exa-mcp-server",installs:[{kind:"http",url:"https://mcp.exa.ai/mcp",headers:[]}]},{key:"deepwiki",title:"DeepWiki",source:"curated",publisher:"Cognition (Devin)",description:"Ask questions about any public GitHub repository, answered from its generated wiki. No key.",homepage:"https://docs.devin.ai/work-with-devin/deepwiki-mcp",installs:[{kind:"http",url:"https://mcp.deepwiki.com/mcp",headers:[]}]},{key:"cloudflare-docs",title:"Cloudflare Docs",source:"curated",publisher:"Cloudflare",description:"Search Cloudflare's developer documentation. No key.",repository:"https://github.com/cloudflare/mcp-server-cloudflare",installs:[{kind:"http",url:"https://docs.mcp.cloudflare.com/mcp",headers:[]}]}]});import{existsSync as J,mkdirSync as Z,readFileSync as $,writeFileSync as D}from"fs";import{dirname as Q,join as U}from"path";function l(e,i=y.str){if(typeof e!=="string"||e.length===0)return;let t=e.replace(/[\u0000-\u001f\u007f]/g," ");return t.length>i?t.slice(0,i-1)+"\u2026":t}function g(e,i=y.list){return Array.isArray(e)?e.slice(0,i):[]}function B(e){let i=l(e,2000);if(i===void 0)return;try{let t=new URL(i);return t.protocol==="http:"||t.protocol==="https:"?i:void 0}catch{return}}function w(e){if(!h(e))return;let i=l(e.name,128);if(i===void 0||!M.test(i))return;let t=l(e.value)??l(e.default),o={name:i,required:e.isRequired===!0,secret:e.isSecret===!0},r=l(e.description,y.desc);if(r!==void 0)o.description=r;if(t!==void 0&&!Y.test(t))o.default=t;return Y.lastIndex=0,o}function ee(e){if(!h(e))return;let i=l(e.name,64);if(i===void 0||!j.test(i))return;let t={name:i,required:e.isRequired===!0,secret:e.isSecret===!0},o=l(e.value)??l(e.default);if(o!==void 0)t.template=o;let r=l(e.description,y.desc);if(r!==void 0)t.description=r;return t}function N(e){return e.startsWith("<")&&e.endsWith(">")?e:`<${e}>`}function E(e,i){let t=[];for(let o of e){if(!h(o))continue;let r=l(o.value)??l(o.default),c=l(o.name,128),s=l(o.valueHint,64)??c??"<argument>";if(o.type==="named"){if(c===void 0)continue;if(r!==void 0)t.push(c,r);else if(o.isRequired===!0)i.push(`${c} ${N(l(o.valueHint,64)??"value")}`)}else if(r!==void 0)t.push(r);else if(o.isRequired===!0)i.push(N(s))}return t}function te(e,i){if(!h(e))return;let t=l(e.registryType,32),o=l(e.identifier,200),r=l(e.version,64);if(t===void 0||o===void 0)return;let c=h(e.transport)?l(e.transport.type,32):"stdio";if(c!==void 0&&c!=="stdio")return;let s=l(e.runtimeHint,64);if(s!==void 0&&!R.test(s)){i.push(`${o}: runtime hint "${s}" refused (not a bare command name)`);return}let p=[],n=E(g(e.runtimeArguments),p),b=E(g(e.packageArguments),p),u=g(e.environmentVariables).map(w).filter((x)=>x!==void 0),m=r!==void 0&&r!=="latest",d,a,v;switch(t){case"npm":d=s??"npx",v=d==="npx"?"npx":"other",a=[...d==="npx"&&!n.includes("-y")?["-y"]:[],...n,m?`${o}@${r}`:o,...b];break;case"pypi":d=s??"uvx",v=d==="uvx"?"uvx":"other",a=[...n,m?`${o}==${r}`:o,...b];break;case"oci":d=s??"docker",v=d==="docker"?"docker":"other",a=["run","-i","--rm",...u.flatMap((x)=>["-e",x.name]),...n,m?`${o}:${r}`:o,...b];break;default:i.push(`${o}: package type "${t}" is not something rovecode can launch`);return}return{kind:"stdio",runtime:v,command:d,args:a,env:u,pending:p}}function ie(e,i=[]){if(!h(e))return;let t=l(e.type,32),o=B(e.url);if(t!=="streamable-http"&&t!=="http"){i.push(`${o??"a remote"}: ${t==="sse"?"sse remote (legacy transport) is not something rovecode can connect to":`remote type "${t??"?"}" is not something rovecode can connect to`}`);return}if(o===void 0)return;return{kind:"http",url:o,headers:g(e.headers).map(ee).filter((r)=>r!==void 0)}}function oe(e){let i=e.split("/")[0]??e;if(i.startsWith("io.github."))return`github.com/${i.slice(10)}`;return i.split(".").reverse().join(".")}function O(e,i){if(!h(e)||!h(e.server))return;let t=e.server,o=l(t.name,200);if(o===void 0||!/^[a-z0-9][a-z0-9.-]*\/[A-Za-z0-9._-]+$/.test(o))return;let r=h(e._meta)?e._meta["io.modelcontextprotocol.registry/official"]:void 0,c=h(r)?l(r.status,32):void 0;if(c==="deleted")return;let s=[];for(let d of g(t.packages,y.packages)){let a=te(d,i);if(a)s.push(a)}for(let d of g(t.remotes,y.packages)){let a=ie(d,i);if(a)s.push(a)}let p={key:o,description:l(t.description,y.desc)??"",source:"registry",publisher:oe(o),installs:s},n=l(t.title,120),b=l(t.version,64),u=B(t.websiteUrl),m=h(t.repository)?B(t.repository.url):void 0;if(n!==void 0)p.title=n;if(b!==void 0)p.version=b;if(c!==void 0&&c!=="active")p.status=c;if(m!==void 0)p.repository=m;if(u!==void 0)p.homepage=u;return p}function re(e){if(!h(e)||!h(e.metadata))return;let i=e.metadata.nextCursor;return typeof i==="string"&&i.length>0&&i.length<=y.str?i:void 0}function pe(e,i){if(!h(e))return i.push("registry: response is not an object"),[];let t=new Set,o=[];for(let r of g(e.servers,y.servers)){let c=O(r,i);if(c&&!t.has(c.key))t.add(c.key),o.push(c)}return o}function _(e){return U(e,"cache","mcp-market.json")}function le(e){let i=_(e);if(!J(i))return{version:1,queries:{}};try{let t=JSON.parse($(i,"utf8"));if(h(t)&&t.version===1&&h(t.queries))return t}catch{}return{version:1,queries:{}}}function se(e,i){let t=Object.entries(i.queries).sort((o,r)=>r[1].at-o[1].at).slice(0,S);try{Z(Q(_(e)),{recursive:!0}),D(_(e),JSON.stringify({version:1,queries:Object.fromEntries(t)})+`
2
+ import{Am as H,Fm as C,zm as h}from"./main-7rn6bqje.js";import{$m as X,Lm as z}from"./main-2yeveeve.js";import{wn as G}from"./main-qsevpgsv.js";var k=(e,...i)=>["-y",e,...i],P;var K=G(()=>{P=[{key:"filesystem",title:"Filesystem",source:"curated",publisher:"modelcontextprotocol (Anthropic)",description:"Read, write, search and move files under the directories you name.",repository:"https://github.com/modelcontextprotocol/servers",installs:[{kind:"stdio",runtime:"npx",command:"npx",args:k("@modelcontextprotocol/server-filesystem"),env:[],pending:["<directory the server may touch>"]}]},{key:"memory",title:"Memory",source:"curated",publisher:"modelcontextprotocol (Anthropic)",description:"A knowledge graph the model can remember across sessions with (entities, relations, observations).",repository:"https://github.com/modelcontextprotocol/servers",installs:[{kind:"stdio",runtime:"npx",command:"npx",args:k("@modelcontextprotocol/server-memory"),env:[],pending:[]}]},{key:"sequential-thinking",title:"Sequential Thinking",source:"curated",publisher:"modelcontextprotocol (Anthropic)",description:"A scratchpad tool for step-by-step reasoning with revisions and branches.",repository:"https://github.com/modelcontextprotocol/servers",installs:[{kind:"stdio",runtime:"npx",command:"npx",args:k("@modelcontextprotocol/server-sequential-thinking"),env:[],pending:[]}]},{key:"everything",title:"Everything (test server)",source:"curated",publisher:"modelcontextprotocol (Anthropic)",description:"Exercises every MCP feature \u2014 prompts, resources, sampling, progress. For testing a client, not for work.",repository:"https://github.com/modelcontextprotocol/servers",installs:[{kind:"stdio",runtime:"npx",command:"npx",args:k("@modelcontextprotocol/server-everything"),env:[],pending:[]}]},{key:"fetch",title:"Fetch",source:"curated",publisher:"modelcontextprotocol (Anthropic)",description:"Fetch a URL and hand the page back as markdown (Python; needs uv).",repository:"https://github.com/modelcontextprotocol/servers",installs:[{kind:"stdio",runtime:"uvx",command:"uvx",args:["mcp-server-fetch"],env:[],pending:[]}]},{key:"git",title:"Git",source:"curated",publisher:"modelcontextprotocol (Anthropic)",description:"Read and search git repositories: log, diff, show, status (Python; needs uv).",repository:"https://github.com/modelcontextprotocol/servers",installs:[{kind:"stdio",runtime:"uvx",command:"uvx",args:["mcp-server-git"],env:[],pending:[]}]},{key:"time",title:"Time",source:"curated",publisher:"modelcontextprotocol (Anthropic)",description:"Current time and timezone conversion (Python; needs uv).",repository:"https://github.com/modelcontextprotocol/servers",installs:[{kind:"stdio",runtime:"uvx",command:"uvx",args:["mcp-server-time"],env:[],pending:[]}]},{key:"github",title:"GitHub",source:"curated",publisher:"GitHub",description:"Issues, pull requests, code search and Actions on GitHub \u2014 remote with a personal access token, or the official image via docker.",repository:"https://github.com/github/github-mcp-server",installs:[{kind:"http",url:"https://api.githubcopilot.com/mcp/",headers:[{name:"Authorization",template:"Bearer {GITHUB_PAT}",required:!0,secret:!0,description:"a GitHub personal access token"}]},{kind:"stdio",runtime:"docker",command:"docker",args:["run","-i","--rm","-e","GITHUB_PERSONAL_ACCESS_TOKEN","ghcr.io/github/github-mcp-server"],env:[{name:"GITHUB_PERSONAL_ACCESS_TOKEN",required:!0,secret:!0,description:"a GitHub personal access token"}],pending:[]}]},{key:"playwright",title:"Playwright",source:"curated",publisher:"Microsoft",description:"Drive a real browser through accessibility snapshots: navigate, click, type, screenshot.",repository:"https://github.com/microsoft/playwright-mcp",installs:[{kind:"stdio",runtime:"npx",command:"npx",args:k("@playwright/mcp@latest"),env:[],pending:[]}]},{key:"context7",title:"Context7",source:"curated",publisher:"Upstash",description:"Up-to-date library documentation and code examples for the versions you actually use.",repository:"https://github.com/upstash/context7",installs:[{kind:"http",url:"https://mcp.context7.com/mcp",headers:[{name:"CONTEXT7_API_KEY",required:!1,secret:!0,description:"optional API key for higher limits"}]},{kind:"stdio",runtime:"npx",command:"npx",args:k("@upstash/context7-mcp"),env:[{name:"CONTEXT7_API_KEY",required:!1,secret:!0,description:"optional API key for higher limits"}],pending:[]}]},{key:"brave-search",title:"Brave Search",source:"curated",publisher:"Brave",description:"Web, news, image and local search through the Brave Search API.",repository:"https://github.com/brave/brave-search-mcp-server",installs:[{kind:"stdio",runtime:"npx",command:"npx",args:k("@brave/brave-search-mcp-server"),env:[{name:"BRAVE_API_KEY",required:!0,secret:!0,description:"Brave Search API key"}],pending:[]}]},{key:"firecrawl",title:"Firecrawl",source:"curated",publisher:"Firecrawl (Mendable)",description:"Scrape, crawl and extract structured data from websites.",repository:"https://github.com/mendableai/firecrawl-mcp-server",installs:[{kind:"stdio",runtime:"npx",command:"npx",args:k("firecrawl-mcp"),env:[{name:"FIRECRAWL_API_KEY",required:!0,secret:!0,description:"Firecrawl API key"}],pending:[]}]},{key:"tavily",title:"Tavily",source:"curated",publisher:"Tavily",description:"Search and extract built for agents: web search, page extraction, site crawl.",repository:"https://github.com/tavily-ai/tavily-mcp",installs:[{kind:"stdio",runtime:"npx",command:"npx",args:k("tavily-mcp"),env:[{name:"TAVILY_API_KEY",required:!0,secret:!0,description:"Tavily API key"}],pending:[]}]},{key:"exa",title:"Exa",source:"curated",publisher:"Exa",description:"Neural web search and page contents for AI; the remote works without a key at a low rate.",repository:"https://github.com/exa-labs/exa-mcp-server",installs:[{kind:"http",url:"https://mcp.exa.ai/mcp",headers:[]}]},{key:"deepwiki",title:"DeepWiki",source:"curated",publisher:"Cognition (Devin)",description:"Ask questions about any public GitHub repository, answered from its generated wiki. No key.",homepage:"https://docs.devin.ai/work-with-devin/deepwiki-mcp",installs:[{kind:"http",url:"https://mcp.deepwiki.com/mcp",headers:[]}]},{key:"cloudflare-docs",title:"Cloudflare Docs",source:"curated",publisher:"Cloudflare",description:"Search Cloudflare's developer documentation. No key.",repository:"https://github.com/cloudflare/mcp-server-cloudflare",installs:[{kind:"http",url:"https://docs.mcp.cloudflare.com/mcp",headers:[]}]}]});import{existsSync as J,mkdirSync as Z,readFileSync as $,writeFileSync as D}from"fs";import{dirname as Q,join as U}from"path";function l(e,i=y.str){if(typeof e!=="string"||e.length===0)return;let t=e.replace(/[\u0000-\u001f\u007f]/g," ");return t.length>i?t.slice(0,i-1)+"\u2026":t}function g(e,i=y.list){return Array.isArray(e)?e.slice(0,i):[]}function B(e){let i=l(e,2000);if(i===void 0)return;try{let t=new URL(i);return t.protocol==="http:"||t.protocol==="https:"?i:void 0}catch{return}}function w(e){if(!h(e))return;let i=l(e.name,128);if(i===void 0||!M.test(i))return;let t=l(e.value)??l(e.default),o={name:i,required:e.isRequired===!0,secret:e.isSecret===!0},r=l(e.description,y.desc);if(r!==void 0)o.description=r;if(t!==void 0&&!Y.test(t))o.default=t;return Y.lastIndex=0,o}function ee(e){if(!h(e))return;let i=l(e.name,64);if(i===void 0||!j.test(i))return;let t={name:i,required:e.isRequired===!0,secret:e.isSecret===!0},o=l(e.value)??l(e.default);if(o!==void 0)t.template=o;let r=l(e.description,y.desc);if(r!==void 0)t.description=r;return t}function N(e){return e.startsWith("<")&&e.endsWith(">")?e:`<${e}>`}function E(e,i){let t=[];for(let o of e){if(!h(o))continue;let r=l(o.value)??l(o.default),c=l(o.name,128),s=l(o.valueHint,64)??c??"<argument>";if(o.type==="named"){if(c===void 0)continue;if(r!==void 0)t.push(c,r);else if(o.isRequired===!0)i.push(`${c} ${N(l(o.valueHint,64)??"value")}`)}else if(r!==void 0)t.push(r);else if(o.isRequired===!0)i.push(N(s))}return t}function te(e,i){if(!h(e))return;let t=l(e.registryType,32),o=l(e.identifier,200),r=l(e.version,64);if(t===void 0||o===void 0)return;let c=h(e.transport)?l(e.transport.type,32):"stdio";if(c!==void 0&&c!=="stdio")return;let s=l(e.runtimeHint,64);if(s!==void 0&&!R.test(s)){i.push(`${o}: runtime hint "${s}" refused (not a bare command name)`);return}let p=[],n=E(g(e.runtimeArguments),p),b=E(g(e.packageArguments),p),u=g(e.environmentVariables).map(w).filter((x)=>x!==void 0),m=r!==void 0&&r!=="latest",d,a,v;switch(t){case"npm":d=s??"npx",v=d==="npx"?"npx":"other",a=[...d==="npx"&&!n.includes("-y")?["-y"]:[],...n,m?`${o}@${r}`:o,...b];break;case"pypi":d=s??"uvx",v=d==="uvx"?"uvx":"other",a=[...n,m?`${o}==${r}`:o,...b];break;case"oci":d=s??"docker",v=d==="docker"?"docker":"other",a=["run","-i","--rm",...u.flatMap((x)=>["-e",x.name]),...n,m?`${o}:${r}`:o,...b];break;default:i.push(`${o}: package type "${t}" is not something rovecode can launch`);return}return{kind:"stdio",runtime:v,command:d,args:a,env:u,pending:p}}function ie(e,i=[]){if(!h(e))return;let t=l(e.type,32),o=B(e.url);if(t!=="streamable-http"&&t!=="http"){i.push(`${o??"a remote"}: ${t==="sse"?"sse remote (legacy transport) is not something rovecode can connect to":`remote type "${t??"?"}" is not something rovecode can connect to`}`);return}if(o===void 0)return;return{kind:"http",url:o,headers:g(e.headers).map(ee).filter((r)=>r!==void 0)}}function oe(e){let i=e.split("/")[0]??e;if(i.startsWith("io.github."))return`github.com/${i.slice(10)}`;return i.split(".").reverse().join(".")}function O(e,i){if(!h(e)||!h(e.server))return;let t=e.server,o=l(t.name,200);if(o===void 0||!/^[a-z0-9][a-z0-9.-]*\/[A-Za-z0-9._-]+$/.test(o))return;let r=h(e._meta)?e._meta["io.modelcontextprotocol.registry/official"]:void 0,c=h(r)?l(r.status,32):void 0;if(c==="deleted")return;let s=[];for(let d of g(t.packages,y.packages)){let a=te(d,i);if(a)s.push(a)}for(let d of g(t.remotes,y.packages)){let a=ie(d,i);if(a)s.push(a)}let p={key:o,description:l(t.description,y.desc)??"",source:"registry",publisher:oe(o),installs:s},n=l(t.title,120),b=l(t.version,64),u=B(t.websiteUrl),m=h(t.repository)?B(t.repository.url):void 0;if(n!==void 0)p.title=n;if(b!==void 0)p.version=b;if(c!==void 0&&c!=="active")p.status=c;if(m!==void 0)p.repository=m;if(u!==void 0)p.homepage=u;return p}function re(e){if(!h(e)||!h(e.metadata))return;let i=e.metadata.nextCursor;return typeof i==="string"&&i.length>0&&i.length<=y.str?i:void 0}function pe(e,i){if(!h(e))return i.push("registry: response is not an object"),[];let t=new Set,o=[];for(let r of g(e.servers,y.servers)){let c=O(r,i);if(c&&!t.has(c.key))t.add(c.key),o.push(c)}return o}function _(e){return U(e,"cache","mcp-market.json")}function le(e){let i=_(e);if(!J(i))return{version:1,queries:{}};try{let t=JSON.parse($(i,"utf8"));if(h(t)&&t.version===1&&h(t.queries))return t}catch{}return{version:1,queries:{}}}function se(e,i){let t=Object.entries(i.queries).sort((o,r)=>r[1].at-o[1].at).slice(0,S);try{Z(Q(_(e)),{recursive:!0}),D(_(e),JSON.stringify({version:1,queries:Object.fromEntries(t)})+`
3
3
  `)}catch{}}async function F(e,i){let t=i.fetch??fetch,o=i.registryUrl??process.env.ROVECODE_MCP_REGISTRY??T,r=await t(`${o}${e}`,{headers:{accept:"application/json"},signal:AbortSignal.timeout(L)});if(!r.ok)throw Error(`registry answered ${r.status}`);let c=await r.text();if(c.length>y.body)throw Error(`registry response too large (${c.length} bytes)`);return JSON.parse(c)}async function V(e,i,t,o){let r=t.home??z(),c=(t.now??Date.now)(),s=le(r),p=s.queries[e];if(p&&c-p.at<I)return{entries:p.entries,fromCache:!0};if(t.offline){if(p)o.push("offline: showing cached registry results");return{entries:p?.entries??[],fromCache:p!==void 0}}try{let n=await i();return s.queries[e]={at:c,entries:n},se(r,s),{entries:n,fromCache:!1}}catch(n){return o.push(`registry unreachable (${H(n)})${p?" \u2014 showing cached results":""}`),{entries:p?.entries??[],fromCache:p!==void 0}}}async function ye(e,i={}){let t=[],o=e.trim().toLowerCase(),r=i.catalog??P,c=o.split(/\s+/).filter(Boolean),s=r.filter((u)=>c.every((m)=>`${u.key} ${u.title??""} ${u.description}`.toLowerCase().includes(m)));if(o.length<2)return{entries:s,notes:t,fromCache:!1};let{entries:p,fromCache:n}=await V(`search:${o}`,async()=>{let u=[],m=[],d=new Set,a=new Set,v;for(let x=0;x<ce;x++){let W=`/servers?search=${encodeURIComponent(o)}&version=latest&limit=50${v?`&cursor=${encodeURIComponent(v)}`:""}`,q=await F(W,i);for(let A of pe(q,u)){if(d.has(A.key))continue;d.add(A.key),m.push(A)}if(m.length>=y.servers)break;let f=re(q);if(f===void 0||a.has(f))break;a.add(f),v=f}return m.slice(0,y.servers)},i,t),b=new Set(s.flatMap((u)=>[u.key,...u.repository?[u.repository]:[]]));return{entries:[...s,...p.filter((u)=>!b.has(u.key)&&!(u.repository&&b.has(u.repository)))],notes:t,fromCache:n}}async function ke(e,i={}){let t=[],o=e.trim(),c=(i.catalog??P).find((n)=>n.key===o);if(c)return{entry:c,notes:t};if(!o.includes("/"))return t.push(`"${o}" is not a curated name and not a registry name (those look like io.github.owner/repo) \u2014 try: rovecode mcp search ${o}`),{notes:t};let{entries:s}=await V(`info:${o}`,async()=>{let n=await F(`/servers/${encodeURIComponent(o)}/versions/latest`,i),b=O(n,t);return b?[b]:[]},i,t),p=s[0];if(!p&&t.length===0)t.push(`"${o}" is not in the registry`);return p?{entry:p,notes:t}:{notes:t}}function ve(e){return e.kind==="stdio"?[e.command,...e.args].join(" "):e.url}var T="https://registry.modelcontextprotocol.io/v0",I=86400000,S=40,L=20000,y,M,j,R,Y,ce=5;var ue=G(()=>{X();C();K();y={body:2097152,servers:100,str:300,desc:500,list:32,packages:8},M=/^[A-Za-z_][A-Za-z0-9_]*$/,j=/^[A-Za-z0-9-]{1,64}$/,R=/^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/,Y=/\{([A-Za-z_][A-Za-z0-9_-]*)\}/g});
4
- export{ye as yc,ke as zc,ve as Ac,ue as Bc};
4
+ export{ye as Cc,ke as Dc,ve as Ec,ue as Fc};
@@ -6,4 +6,4 @@ var _=new Set([..."{}*?[]\\~^#$`()<>"]);function K(j){let Z=R(j);if(Z===null)ret
6
6
  &|;`.includes(W))break;if(W==="'"){let B=j.indexOf("'",J+1);if(B===-1)return null;if(Q+=j.slice(J+1,B),X===0)G=!0;X++,J=B+1;continue}if(W==='"'){let B=w(j,J);if(B===null)return null;if(Q+=B.text,X===0)G=!0;X++,J=B.next;continue}let Y="";while(J<z){let B=j[J];if(B===void 0||` \r
7
7
  &|;'"`.includes(B))break;if(_.has(B))return null;Y+=B,J++}if(Y.startsWith("="))return null;if(X===0&&Y==="!")return null;Q+=Y,X++}if(X>1&&Q.length===0)return null;Z.push({kind:"word",text:Q,quotedHead:G})}return Z}function w(j,Z){let J=Z+1,z="";while(J<j.length){let $=j[J];if($===void 0)return null;if($==='"')return{text:z,next:J+1};if($==="$"||$==="`")return null;if($==="\\"){let Q=j[J+1];if(Q===void 0||Q==="$"||Q==="`"||Q==='"'||Q==="\\"||Q===`
8
8
  `)return null;z+=$+Q,J+=2;continue}z+=$,J++}return null}var N=[{pattern:["ls"],match:[["ls"],"ls -la ."]},{pattern:["pwd"],match:[["pwd"]]},{pattern:["cat"],match:["cat file.txt"]},{pattern:["head"],match:["head -n 5 CHANGELOG.md"],notMatch:[["hea","-n","1"]]},{pattern:["tail"]},{pattern:["wc"]},{pattern:["echo"]},{pattern:["which"],match:["which python3"]},{pattern:["printenv"],notMatch:[["print","-0"]]},{pattern:["grep"]},{pattern:["cd"]},{pattern:["git",["status","log","diff","show","branch"]],match:["git status",["git","log","--oneline"]],notMatch:["git stash"]},{pattern:["git","branch",["-D","-d","-m","-M","-f","--delete","--force","--move"]],decision:"prompt",justification:"deletes or rewrites branches; confirm the target",match:["git branch -D feature",["git","branch","--delete","old"]],notMatch:["git branch","git branch --list","git branch -a"]},{pattern:["git","push"],decision:"prompt",justification:"pushes publish state; confirm the remote and branch",match:["git push","git push --force-with-lease"]},{pattern:["git","push",["--force","-f"]],decision:"forbidden",justification:"history-rewriting push; use --force-with-lease after user sign-off",match:["git push --force",["git","push","-f","origin","main"]],notMatch:["git push","git push --force-with-lease"]},{pattern:["git","reset","--hard"],decision:"forbidden",justification:"destructive operation",match:[["git","reset","--hard"]],notMatch:[["git","reset","--keep"],"git reset --merge"]}];var D={allow:0,prompt:1,forbidden:2};function L(j){let Z="allow";for(let J of j)if(D[J]>D[Z])Z=J;return Z}function A(j,Z){if(Z.length<j.tokens.length)return null;for(let J=0;J<j.tokens.length;J++){let z=j.tokens[J],$=Z[J];if(z===void 0||$===void 0)return null;if(typeof z==="string"?z!==$:!z.includes($))return null}return Z.slice(0,j.tokens.length)}function V(j,Z){let J=Z[0];if(J===void 0)return[];let z=(X,G)=>(j.get(X)??[]).flatMap((W)=>{let Y=A(W,G);return Y?[{kind:"rule",decision:W.decision,matchedPrefix:Y,justification:W.justification}]:[]}),$=z(J,Z);if($.length>0)return $;if(!q(J))return[];let Q=I(J);return Q!==null&&Q!==J?z(Q,[Q,...Z.slice(1)]):[]}function M(j){if(j.justification!==void 0&&j.justification.trim()==="")throw Error("prefix_rule: justification cannot be empty");let[Z,...J]=j.pattern;if(Z===void 0)throw Error("prefix_rule: pattern cannot be empty");for(let Q of j.pattern)if(typeof Q!=="string"&&Q.length===0)throw Error("prefix_rule: pattern alternatives cannot be empty");let z=typeof Z==="string"?[Z]:[...Z],$=new Map;for(let Q of z){if(Q.length===0)throw Error("prefix_rule: pattern tokens must be non-empty strings");let X=$.get(Q)??[];X.push({tokens:[Q,...J],decision:j.decision??"allow",justification:j.justification}),$.set(Q,X)}return $}class P{rulesByProgram=new Map;constructor(j){let Z=j.map(M);for(let J of Z)for(let[z,$]of J){let Q=this.rulesByProgram.get(z)??[];Q.push(...$),this.rulesByProgram.set(z,Q)}j.forEach((J,z)=>{let $=Z[z];for(let Q of J.notMatch??[]){let X=v(Q);if(V($,X).length>0)throw Error(`prefix_rule not_match example matched its rule: ${H(X)}`)}for(let Q of J.match??[]){let X=v(Q);if(V($,X).length===0)throw Error(`prefix_rule match example did not match its rule: ${H(X)}`)}})}check(j){let Z=V(this.rulesByProgram,j);if(Z.length===0)Z=[y(j)];return Z=[...Z,...E(j)],{decision:L(Z.map((J)=>J.decision)),matchedRules:Z}}checkMany(j){let Z=j.flatMap((J)=>this.check(J).matchedRules);if(Z.length===0)return this.check([]);return{decision:L(Z.map((J)=>J.decision)),matchedRules:Z}}checkScript(j){let Z=K(j);return Z!==null&&Z.length>0?this.checkMany(Z):this.check(["bash","-c",j])}}function I(j){if(!j.includes("/")&&!j.includes("\\"))return null;let Z=j.split(/[/\\]/).pop()??"";if(Z==="")return null;let J=Z.toLowerCase();for(let z of[".exe",".cmd",".bat",".com"])if(J.endsWith(z))return J.slice(0,-z.length);return Z}function q(j){return j.startsWith("/")||j.startsWith("\\\\")||/^[A-Za-z]:[/\\]/.test(j)}function y(j){let Z=O(j);return{kind:"heuristics",decision:"prompt",command:[...j],justification:Z==="forced-rm"?"rm -f style commands are not permitted. Use a safer approach":Z==="other"?"blocked by policy":void 0}}var C=new Set(["diff","show","log"]),k=new Set(["-D","-d","-m","-M","-f","--delete","--force","--move"]);function E(j){let Z=j[0],J=Z===void 0?null:I(Z)??Z,z=j[1];if(J!=="git"||z===void 0)return[];if(z==="branch"){for(let $ of j.slice(2)){if($==="--")break;if(k.has($))return[{kind:"heuristics",decision:"prompt",command:[...j],justification:"deletes or rewrites branches; confirm the target"}]}return[]}if(!C.has(z))return[];for(let $ of j.slice(2)){if($==="--")break;if($==="--output"||$.startsWith("--output="))return[{kind:"heuristics",decision:"prompt",command:[...j],justification:"--output writes the result to a file; confirm the destination"}]}return[]}var g=8;function O(j,Z=0){if(Z>g)return"other";let J=j[0]===void 0?null:I(j[0])??j[0];if(J==="rm"&&S(j.slice(1)))return"forced-rm";if(J==="sudo")return O(j.slice(1),Z+1);if(J==="env"){let z=1;while(z<j.length){let $=j[z];if($===void 0)break;if($==="--"){z++;break}if($==="-i"||$==="--ignore-environment"||/^[^-=][^=]*=/.test($)){z++;continue}break}return O(j.slice(z),Z+1)}if(J==="trap"){let z=j[1]==="--"?2:1,$=j[z];if($===void 0||$.startsWith("-"))return null;return U($,Z+1)}if((J==="bash"||J==="sh"||J==="zsh")&&j.length===3&&(j[1]==="-c"||j[1]==="-lc")&&j[2]!==void 0)return U(j[2],Z+1);return null}function U(j,Z){let J=K(j);if(J===null)return null;for(let z of J){let $=O(z,Z);if($!==null)return $}return null}function S(j){for(let Z of j){if(Z==="--")return!1;if(Z==="--force"||Z.startsWith("-")&&!Z.startsWith("--")&&Z.includes("f"))return!0}return!1}var b=null;function T(){return b??=new P(N)}function f(j,Z=T()){let J=Z.checkScript(j);if(J.decision==="forbidden"){let z=F(J,"forbidden");return{effect:"deny",reason:z?.justification!==void 0?`\`${j}\` rejected: ${z.justification}`:z!==null?`\`${j}\` rejected: policy forbids commands starting with \`${H(z.matchedPrefix)}\``:`\`${j}\` rejected: blocked by policy`}}if(J.decision==="prompt"){let z=F(J,"prompt"),$=J.matchedRules.find((X)=>X.kind==="heuristics"&&X.justification!==void 0);return{effect:"prompt",reason:z!==null?z.justification!==void 0?`\`${j}\` requires approval: ${z.justification}`:`\`${j}\` requires approval by policy`:$?.justification}}return{effect:"allow"}}function F(j,Z){let J=null;for(let z of j.matchedRules){if(z.kind!=="rule"||z.decision!==Z)continue;if(J===null||z.matchedPrefix.length>J.matchedPrefix.length)J=z}return J}function H(j){return j.map((Z)=>/^[A-Za-z0-9@%_+=:,./-]+$/.test(Z)?Z:`'${Z.replace(/'/g,"'\\''")}'`).join(" ")}function v(j){if(typeof j!=="string")return[...j];let Z=K(j),J=Z?.[0];if(Z===null||Z.length!==1||J===void 0)throw Error(`prefix_rule example is not a single plain command: ${j}`);return J}function l(j,Z={}){let J=Z.policy??T(),z=new Set(Z.tools??["bash"]);return async($)=>{let Q=$.revisedArgs??$.args,X=z.has($.tool)&&typeof Q==="object"&&Q!==null&&typeof Q.command==="string"?String(Q.command):null;if(X===null)return j?j($):"deny";let G=f(X,J);if(G.effect==="allow")return"once";if(G.effect==="deny")return"deny";if(!j)return"deny";return j(G.reason!==void 0?{...$,reason:G.reason}:$)}}
9
- export{O as dd,T as ed,l as fd};
9
+ export{O as Jd,T as Kd,l as Ld};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Vi as O,Wi as S,aj as b}from"./main-xx2z3zh5.js";import{Mj as X,Wj as _}from"./main-ywbxshqc.js";import{$m as m,Um as h,_m as A}from"./main-2yeveeve.js";m();_();var w=3,D="usage: rovecode connect [<id> [<baseUrl>]] [--model <id>] [--key | --key-stdin | --key-env NAME | --no-key] [--protocol openai|anthropic] [--project] [--no-test]";function y(j){let z=[],q,M,P,Z="auto",Q="user",R=!0,Y=[];for(let V=0;V<j.length;V++){let B=j[V],W=()=>{let H=j[V+1];if(H===void 0||H.startsWith("-"))return;return V++,H};switch(B){case"--model":{let H=W();if(H===void 0)return{error:`--model needs a value \u2014 ${D}`};q=H;break}case"--key-env":{let H=W();if(H===void 0)return{error:`--key-env needs a value \u2014 ${D}`};P=H,Y.push(B);break}case"--protocol":{let H=W();if(H!=="openai"&&H!=="anthropic")return{error:`--protocol takes openai or anthropic \u2014 ${D}`};M=H;break}case"--key":Z="prompt",Y.push(B);break;case"--key-stdin":Z="stdin",Y.push(B);break;case"--no-key":Z="none",Y.push(B);break;case"--project":Q="project";break;case"--no-test":R=!1;break;default:if(B.startsWith("-"))return{error:`unknown flag ${B} \u2014 ${D}`};z.push(B)}}if(Y.length>1)return{error:`${Y.join(" and ")} contradict each other \u2014 pick one`};if(z.length===0)return{error:`connect needs a provider id \u2014 ${D}`};if(z.length>2)return{error:`unexpected argument "${z[2]}" \u2014 ${D}`};let $=z[0].toLowerCase();if(!O.test($))return{error:`"${$}" won't work as an id (letters, digits, - _ .)`};let L=z[1];if(L!==void 0&&!/^https?:\/\//.test(L))return{error:`"${L}" is not an http(s) URL \u2014 ${D}`};if(L===void 0&&M!==void 0)return{error:"--protocol only applies when you give a base URL"};return{id:$,...L!==void 0?{baseUrl:L}:{},...q!==void 0?{model:q}:{},...M!==void 0?{protocol:M}:{},...P!==void 0?{keyEnv:P}:{},key:Z,scope:Q,test:R}}async function x(){let j=[];for await(let z of process.stdin)j.push(z);return Buffer.concat(j).toString("utf8")}async function C(j,z){let q=z.out??console.log,M=z.secret??((J)=>A(J)),P=z.stdin??x,Z=z.save??h,Q=z.registry,R=z.probe??((J,f)=>Q.probe(J,f)),Y=z.tty??process.stdin.isTTY===!0,$=z.where==="tui",L=Q.get(j.id),V=j.key==="none"||j.keyEnv!==void 0;if(j.baseUrl!==void 0||V){let J=j.baseUrl??L?.baseUrl;if(J===void 0)return q(`\u25C6 I don't know a provider called "${j.id}".`),q(` known: ${Q.ids().join(" ")}`),q(` ${X(`rovecode connect ${j.id} <baseUrl>`)} to register your own endpoint`),2;let f=j.protocol??L?.protocol??S(J),G=j.model??L?.defaultModel,T={id:j.id,baseUrl:J,protocol:f,...j.keyEnv!==void 0?{keyEnv:j.keyEnv}:L?.keyEnv!==void 0&&j.baseUrl===void 0?{keyEnv:L.keyEnv}:{},...G!==void 0?{defaultModel:G}:{},...j.key==="none"?{noKey:!0}:{}},K=Q.add(T,j.scope);if("error"in K)return q(`\u25C6 ${K.error}`),q(` ${X("rovecode connect")} for the step-by-step version`),2;q(`\u25C6 ${K.id} registered (${K.protocol} protocol, ${K.baseUrl}${j.key==="none"?", no key":""}).`)}else if(L===void 0)return q(`\u25C6 I don't know a provider called "${j.id}".`),q(` known: ${Q.ids().join(" ")}`),q(` ${X(`rovecode connect ${j.id} <baseUrl>`)} to register your own endpoint`),2;let B=Q.get(j.id);if(B===void 0)return q(`\u25C6 ${j.id} did not survive registration \u2014 that is a bug.`),2;let W=b(B);if(!W||j.key==="prompt"||j.key==="stdin")if(j.key==="stdin"){let J=(await P()).split(`
2
+ import{Xi as O,Yi as S,cj as b}from"./main-sdmxhtv8.js";import{kk as X,uk as _}from"./main-8kjxbpw4.js";import{$m as m,Um as h,_m as A}from"./main-2yeveeve.js";m();_();var w=3,D="usage: rovecode connect [<id> [<baseUrl>]] [--model <id>] [--key | --key-stdin | --key-env NAME | --no-key] [--protocol openai|anthropic] [--project] [--no-test]";function y(j){let z=[],q,M,P,Z="auto",Q="user",R=!0,Y=[];for(let V=0;V<j.length;V++){let B=j[V],W=()=>{let H=j[V+1];if(H===void 0||H.startsWith("-"))return;return V++,H};switch(B){case"--model":{let H=W();if(H===void 0)return{error:`--model needs a value \u2014 ${D}`};q=H;break}case"--key-env":{let H=W();if(H===void 0)return{error:`--key-env needs a value \u2014 ${D}`};P=H,Y.push(B);break}case"--protocol":{let H=W();if(H!=="openai"&&H!=="anthropic")return{error:`--protocol takes openai or anthropic \u2014 ${D}`};M=H;break}case"--key":Z="prompt",Y.push(B);break;case"--key-stdin":Z="stdin",Y.push(B);break;case"--no-key":Z="none",Y.push(B);break;case"--project":Q="project";break;case"--no-test":R=!1;break;default:if(B.startsWith("-"))return{error:`unknown flag ${B} \u2014 ${D}`};z.push(B)}}if(Y.length>1)return{error:`${Y.join(" and ")} contradict each other \u2014 pick one`};if(z.length===0)return{error:`connect needs a provider id \u2014 ${D}`};if(z.length>2)return{error:`unexpected argument "${z[2]}" \u2014 ${D}`};let $=z[0].toLowerCase();if(!O.test($))return{error:`"${$}" won't work as an id (letters, digits, - _ .)`};let L=z[1];if(L!==void 0&&!/^https?:\/\//.test(L))return{error:`"${L}" is not an http(s) URL \u2014 ${D}`};if(L===void 0&&M!==void 0)return{error:"--protocol only applies when you give a base URL"};return{id:$,...L!==void 0?{baseUrl:L}:{},...q!==void 0?{model:q}:{},...M!==void 0?{protocol:M}:{},...P!==void 0?{keyEnv:P}:{},key:Z,scope:Q,test:R}}async function x(){let j=[];for await(let z of process.stdin)j.push(z);return Buffer.concat(j).toString("utf8")}async function C(j,z){let q=z.out??console.log,M=z.secret??((J)=>A(J)),P=z.stdin??x,Z=z.save??h,Q=z.registry,R=z.probe??((J,f)=>Q.probe(J,f)),Y=z.tty??process.stdin.isTTY===!0,$=z.where==="tui",L=Q.get(j.id),V=j.key==="none"||j.keyEnv!==void 0;if(j.baseUrl!==void 0||V){let J=j.baseUrl??L?.baseUrl;if(J===void 0)return q(`\u25C6 I don't know a provider called "${j.id}".`),q(` known: ${Q.ids().join(" ")}`),q(` ${X(`rovecode connect ${j.id} <baseUrl>`)} to register your own endpoint`),2;let f=j.protocol??L?.protocol??S(J),G=j.model??L?.defaultModel,T={id:j.id,baseUrl:J,protocol:f,...j.keyEnv!==void 0?{keyEnv:j.keyEnv}:L?.keyEnv!==void 0&&j.baseUrl===void 0?{keyEnv:L.keyEnv}:{},...G!==void 0?{defaultModel:G}:{},...j.key==="none"?{noKey:!0}:{}},K=Q.add(T,j.scope);if("error"in K)return q(`\u25C6 ${K.error}`),q(` ${X("rovecode connect")} for the step-by-step version`),2;q(`\u25C6 ${K.id} registered (${K.protocol} protocol, ${K.baseUrl}${j.key==="none"?", no key":""}).`)}else if(L===void 0)return q(`\u25C6 I don't know a provider called "${j.id}".`),q(` known: ${Q.ids().join(" ")}`),q(` ${X(`rovecode connect ${j.id} <baseUrl>`)} to register your own endpoint`),2;let B=Q.get(j.id);if(B===void 0)return q(`\u25C6 ${j.id} did not survive registration \u2014 that is a bug.`),2;let W=b(B);if(!W||j.key==="prompt"||j.key==="stdin")if(j.key==="stdin"){let J=(await P()).split(`
3
3
  `)[0].trim();if(J.length===0)return q("\u25C6 nothing came in on stdin \u2014 no key stored."),q(` ${X(`echo $KEY | rovecode connect ${j.id} --key-stdin`)}`),2;Z(j.id,J,B.keyEnv),q(`\u25C6 key stored for ${j.id} (hidden; ~/.rovecode/credentials.json).`),W=!0}else if(j.key==="prompt"||j.key==="auto"&&Y){let J=(await M(`${B.keyEnv} (hidden): `)).trim();if(J.length===0)return q(`\u25C6 no key stored \u2014 I can't call ${j.id} without one.`),q(` ${X(`rovecode auth set ${j.id}`)} (or set ${B.keyEnv} in your environment)`),2;Z(j.id,J,B.keyEnv),q(`\u25C6 key stored for ${j.id} (hidden; ~/.rovecode/credentials.json).`),W=!0}else if(z.deferKey!==void 0)return z.deferKey(B),w;else return q(`\u25C6 ${j.id} has no key, and there is no terminal to ask on.`),q(` ${X(`set ${B.keyEnv}, or pipe it: echo $KEY | rovecode connect ${j.id} --key-stdin`)}`),2;else q(B.noKey===!0?`\u25C6 ${j.id} needs no key (local server).`:`\u25C6 ${j.id} already has a key (${B.keySource==="stored"?"stored":`env ${B.keyEnv}`}).`);Q.refresh();let H=j.model??Q.get(j.id)?.defaultModel;if(H===void 0)return q(`\u25C6 ${j.id} is connected but has no model yet.`),q(` ${X($?`/models ${j.id}, then /model ${j.id}/<model> --save`:`rovecode model list ${j.id}, then rovecode model use ${j.id}/<model>`)}`),0;let F=!0;if(j.test){q(`\u25C6 testing ${j.id}/${H} \u2026`);let J=await R(j.id,H);F=J.ok,q(` ${J.detail}`)}let I=Q.setDefault(`${j.id}/${H}`,j.scope);if("error"in I)return q(`\u25C6 ${I.error}`),q(` ${X(`rovecode model use ${j.id}/<model>`)}`),2;if(q(`\u25C6 default \u2192 ${I.provider}/${I.model} (${$?"this session switched too":"running TUIs switch live"}).`),!F)return q(` ${X(`check the key and the URL, then ${$?"/provider":"rovecode provider"} test ${j.id} ${H}`)}`),1;return q(""),q(z.done??`Done. Try: rovecode "explain this repo"
4
4
  or open the cockpit: rovecode`),0}
5
- export{w as H,D as I,y as J,C as K};
5
+ export{w as Aa,D as Ba,y as Ca,C as Da};
@@ -1,7 +1,7 @@
1
1
  // @bun
2
- import{he as X,je as E,me as U,oe as P,te as M}from"./main-gth53dnt.js";import{ue as V,xe as b}from"./main-2z3dek0b.js";M();b();E();var y=60000,D=600000,R="You will be notified in this conversation when it finishes \u2014 do NOT poll or sleep: "+"continue other non-overlapping work or end your turn. Use `task_status result` to wait for it when you need its output.",W="In a one-shot run (`rovecode run`) background tasks do not outlive the run: collect what you need with `task_status result` before ending your turn.",Q=(j)=>({ok:!1,output:`Error: ${j}`}),G=(j,B)=>Q(`${j} ${B} requires a string \`id\` (see \`task_status list\`)`);function x(j,B){let C=j.startedAt!==void 0?Math.max(0,Math.round(((j.finishedAt??B)-j.startedAt)/1000)):0,K=j.usage?`, tokens ${j.usage.input}in/${j.usage.output}out`:"";return`task ${j.id} (${j.label}) ${j.status} \u2014 agent ${j.agent}, ${j.isolated?"isolated, ":""}${C}s${K}`}function S(j,B){let C=x(j,B);if(j.status==="done"){let K=j.patchLines!==void 0?`
2
+ import{He as X,Je as E,Me as U,Oe as P,Te as M}from"./main-rdgdw24b.js";import{Ue as V,Xe as b}from"./main-3pjrb2hd.js";M();b();E();var y=60000,D=600000,R="You will be notified in this conversation when it finishes \u2014 do NOT poll or sleep: "+"continue other non-overlapping work or end your turn. Use `task_status result` to wait for it when you need its output.",W="In a one-shot run (`rovecode run`) background tasks do not outlive the run: collect what you need with `task_status result` before ending your turn.",Q=(j)=>({ok:!1,output:`Error: ${j}`}),G=(j,B)=>Q(`${j} ${B} requires a string \`id\` (see \`task_status list\`)`);function x(j,B){let C=j.startedAt!==void 0?Math.max(0,Math.round(((j.finishedAt??B)-j.startedAt)/1000)):0,K=j.usage?`, tokens ${j.usage.input}in/${j.usage.output}out`:"";return`task ${j.id} (${j.label}) ${j.status} \u2014 agent ${j.agent}, ${j.isolated?"isolated, ":""}${C}s${K}`}function S(j,B){let C=x(j,B);if(j.status==="done"){let K=j.patchLines!==void 0?`
3
3
  [isolated: ${j.patchLines===0?"no file changes":`patch of ${j.patchLines} lines merged back`}]`:"",Y=j.kind==="external"?`
4
4
  [external ${j.agent} lane \u2014 permissions: ${j.permissions??"(unknown)"}${j.laneExit!==void 0?`; exit ${j.laneExit}`:""}${j.laneModel?`; model ${j.laneModel}`:""}]`:"";return{ok:!0,output:`${C}${Y}${K}
5
5
  ${j.summary??"(no output)"}`,data:j}}if(j.status==="failed")return{ok:!1,output:`${C}
6
6
  ${j.error??"unknown error"}`,data:j};if(j.status==="cancelled")return{ok:!1,output:C,data:j};return{ok:!0,output:`${C}. ${R}`,data:j}}function g(j){if(j===void 0||j===null)return y;let B=typeof j==="number"?j:typeof j==="string"&&j.trim()!==""?Number(j):NaN;if(!Number.isFinite(B))return{error:`task_status result: \`timeout_ms\` must be a number of milliseconds (got ${JSON.stringify(j)??String(j)})`};return Math.min(D,Math.max(0,Math.floor(B)))}function h(j,B={}){let C=B.defaultAgent??"main",K=(B.agents??[]).filter((q)=>q.name!==C),Y=(q)=>q.length>120?q.slice(0,119)+"\u2026":q,H=K.length>0?`Custom agent definitions (.rovecode/agents/<name>.md \u2014 own system prompt, model, mode and tool allow-list): ${K.map((q)=>`${q.name} \u2014 ${Y(q.description)}`).join("; ")}. `:"";return{schema:{name:"task",description:"Run subagents as background tasks. `start` launches a child agent session on `goal` and returns at once with a task id; the child works while you continue, and a note lands in this conversation when it finishes (do not poll). Read its state or output with the `task_status` tool (status/result/list "+"\u2014 never prompts); `cancel` aborts a task. Children see only `goal` (write it self-contained). "+`At most ${j.maxConcurrent} run concurrently; extra starts queue FIFO \u2014 so for independent parts of a `+"wider request, issue their starts together in one turn and they run side by side while you keep the dependent steps. `isolated` runs the child in a git worktree copy and merges its file changes back as a patch on success. "+`\`agent\` may also name an EXTERNAL agentic-CLI lane \u2014 ${V.join(" | ")} \u2014 which runs \`goal\` in that CLI `+`instead of in one of our agents. A lane always works in its own worktree, its diff merges back like any isolated child, and it runs with the flags stated on the approval card. Lanes are OFF unless ${X} lists the id. Policy: under gated rules each \`start\` needs approval and the child runs read-only (prompt-gated actions are denied for children) unless allow rules cover them; under yolo it inherits allow-all. `+H+W,args:{type:"object",properties:{action:{type:"string",enum:["start","cancel"]},goal:{type:"string",description:"start: the child's task, self-contained (it has no access to this conversation)"},agent:{type:"string",description:`start: agent definition to run (default "${C}"${K.length>0?`; custom: ${K.map((q)=>q.name).join(", ")}`:""}), or an external CLI lane: ${V.join(" | ")} (needs ${X})`},isolated:{type:"boolean",description:"start: run in an isolated worktree copy; file changes merge back as a patch when the task finishes ok"},label:{type:"string",description:"start: short label (3-5 words) shown in task lists and completion notes"},id:{type:"string",description:"cancel: task id (e.g. t1)"}},required:["action"]}},kind:"spawn",sequential:!0,async execute(q){let z=q??{},J=typeof z.id==="string"?z.id.trim():"";switch(z.action){case"start":{if(typeof z.goal!=="string"||z.goal.trim()==="")return Q("task start requires a non-empty string `goal`");let F=typeof z.agent==="string"&&z.agent.trim()!==""?z.agent.trim():C,Z=j.start({agent:F,goal:z.goal,isolated:z.isolated===!0,background:!0},{label:typeof z.label==="string"?z.label:void 0,parentDepth:B.parentDepth??0,notify:B.notify,caller:B.caller,owner:B.owner,...B.parentTools?{parentTools:B.parentTools()}:{},...B.parentDir!==void 0?{parentDir:B.parentDir}:{}});if(!Z.ok)return Q(`task refused: ${Z.reason}`);let $=j.status(Z.id),f=$.status==="running"?"running":`queued (${j.counts().running} running, bound ${j.maxConcurrent})`,I=$.kind==="external"?`External ${$.agent} lane \u2014 permissions: ${$.permissions??"(unknown)"}; its worktree patch merges back when it finishes ok.`:Z.childPolicy==="gated"?"Policy: gated \u2014 the child runs read-only (prompt-gated actions are DENIED for children) unless allow rules cover them.":"Policy: the child inherits your allow rules.";return{ok:!0,output:`task ${$.id} (${$.label}) started: ${f}. ${I} ${R}`,data:$}}case"cancel":{if(J==="")return G("task","cancel");let F=j.status(J);if(!F)return Q(`unknown task '${J}'`);if(U(F.status))return{ok:!0,output:`task ${J} already ${F.status}`,data:F};let Z=j.cancel(J);return{ok:!0,output:`task ${Z.id} (${Z.label}) cancelled`,data:Z}}default:return Q(`task requires action start|cancel (got ${JSON.stringify(z.action??null)}); status|result|list live on task_status`)}}}}function L(j,B={}){return{schema:{name:"task_status",description:"Read background tasks started with `task` (never prompts, never mutates). `status` shows one task's state; `result` waits (bounded by `timeout_ms`, default 60s) for a task to finish and returns the "+"child's final output \u2014 call it when you need the output, otherwise wait for the completion note; "+"`list` shows every task. "+W,args:{type:"object",properties:{action:{type:"string",enum:["status","result","list"]},id:{type:"string",description:"status/result: task id (e.g. t1)"},timeout_ms:{type:"integer",description:`result: max wait in ms (default ${y}, max ${D}); 0 = report the current state at once`}},required:["action"]}},kind:"read",sequential:!0,async execute(C,K){let Y=C??{},H=Date.now(),q=typeof Y.id==="string"?Y.id.trim():"";switch(Y.action){case"status":{if(q==="")return G("task_status","status");let z=j.status(q);return z?{ok:!0,output:x(z,H),data:z}:Q(`unknown task '${q}'`)}case"result":{if(q==="")return G("task_status","result");if(!j.status(q))return Q(`unknown task '${q}'`);let z=g(Y.timeout_ms);if(typeof z!=="number")return Q(z.error);let J=await j.result(q,{timeoutMs:z,signal:K.signal,caller:B.caller});if(!J)return Q(`unknown task '${q}'`);if(!U(J.status)&&K.signal.aborted)return Q(`wait for task ${q} aborted`);if(!U(J.status))return{ok:!0,output:`${x(J,Date.now())} \u2014 still running after ${Math.round(z/1000)}s. ${R}`,data:J};return S(J,Date.now())}case"list":return{ok:!0,output:P(j.list(),H),data:j.counts()};default:return Q(`task_status requires action status|result|list (got ${JSON.stringify(Y.action??null)}); start|cancel live on task`)}}}}
7
- export{y as be,D as ce,h as de,L as ee};
7
+ export{y as de,D as ee,h as fe,L as ge};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Vb as Hz,Wb as Wz,Xb as g,Yb as kz}from"./main-m8vm17zq.js";import{$b as T,_b as O,bc as b,dc as gz}from"./main-zc7pyrbj.js";import{fc as y,gc as Yz,hc as Zz,ic as $z,jc as Gz,kc as Kz,nc as Vz,oc as Lz}from"./main-45ejth3a.js";import{rc as Qz,sc as Uz,xc as Iz}from"./main-jak598k9.js";import{ud as x,xd as Bz}from"./main-f33fc5je.js";import{yd as m,zd as Cz}from"./main-2zgsknth.js";import{Ad as Jz,Ed as xz}from"./main-kwwsz6rq.js";import{Kg as i,Lg as Pz,Mg as s,Pg as t,Qg as e,Rg as zz,Vg as jz}from"./main-7jd5vh3x.js";import{sj as j,yj as _z}from"./main-2rzbexn2.js";import{om as S,tm as u,vm as Fz}from"./main-y5c82rxr.js";import{wn as R}from"./main-qsevpgsv.js";function Dz(z){return/allow.*sha1.*in.?want|not our ref|unadvertised object|Server does not allow request for unadvertised object/i.test(z)}async function f(z,J,Q,U){if(U===void 0||U.trim()===""){let V=await z(["git","clone","--depth","1","--quiet","--",J,"."],Q);return V.code===0?{ok:!0,resolvedBy:"default"}:{ok:!1,error:`git clone failed (exit ${V.code})${D(V.stderr)?`: ${D(V.stderr)}`:""}`}}if((await z(["git","clone","--depth","1","--quiet","--branch",U,"--",J,"."],Q)).code===0)return{ok:!0,resolvedBy:"branch"};let Y=await z(["git","init","--quiet"],Q);if(Y.code!==0)return{ok:!1,error:`git init failed (exit ${Y.code})${D(Y.stderr)?`: ${D(Y.stderr)}`:""}`};let $=await z(["git","fetch","--depth","1","--quiet","--",J,U],Q);if($.code!==0){if(Dz($.stderr))return{ok:!1,error:`${J} will not serve the single commit ${U} (the server has uploadpack.allowReachableSHA1InWant off) \u2014 give a branch or tag instead, or ask the host to enable it`};return{ok:!1,error:`"${U}" is not a branch or tag there, and fetching it as a commit failed (exit ${$.code})${D($.stderr)?`: ${D($.stderr)}`:""}`}}let G=await z(["git","checkout","--quiet","FETCH_HEAD"],Q);if(G.code!==0)return{ok:!1,error:`fetched ${U} but could not check it out (exit ${G.code})${D(G.stderr)?`: ${D(G.stderr)}`:""}`};return{ok:!0,resolvedBy:"commit"}}var D=(z)=>z.trim().split(`
2
+ import{m as Hz,n as Wz,o as g,p as kz}from"./main-f7rw7des.js";import{T as O,U as T,W as b,Y as gz}from"./main-yr0ksc0h.js";import{$ as Yz,_ as y,aa as Zz,ba as $z,ca as Gz,da as Kz,ga as Vz,ha as Lz}from"./main-xy53xf0r.js";import{ka as Qz,la as Uz,qa as Iz}from"./main-7c5thhjd.js";import{vd as x,yd as Bz}from"./main-0ab9fc26.js";import{Hd as m,Id as Cz}from"./main-6dnk69vp.js";import{Sd as Jz,Wd as xz}from"./main-pn1w7a7j.js";import{Eh as i,Fh as Pz,Gh as s,Jh as t,Kh as e,Lh as zz,Ph as jz}from"./main-kcpbykxz.js";import{Sj as j,Yj as _z}from"./main-q3vsesf9.js";import{Dm as u,Fm as Fz,ym as S}from"./main-7rn6bqje.js";import{wn as R}from"./main-qsevpgsv.js";function Dz(z){return/allow.*sha1.*in.?want|not our ref|unadvertised object|Server does not allow request for unadvertised object/i.test(z)}async function f(z,J,Q,U){if(U===void 0||U.trim()===""){let V=await z(["git","clone","--depth","1","--quiet","--",J,"."],Q);return V.code===0?{ok:!0,resolvedBy:"default"}:{ok:!1,error:`git clone failed (exit ${V.code})${D(V.stderr)?`: ${D(V.stderr)}`:""}`}}if((await z(["git","clone","--depth","1","--quiet","--branch",U,"--",J,"."],Q)).code===0)return{ok:!0,resolvedBy:"branch"};let Y=await z(["git","init","--quiet"],Q);if(Y.code!==0)return{ok:!1,error:`git init failed (exit ${Y.code})${D(Y.stderr)?`: ${D(Y.stderr)}`:""}`};let $=await z(["git","fetch","--depth","1","--quiet","--",J,U],Q);if($.code!==0){if(Dz($.stderr))return{ok:!1,error:`${J} will not serve the single commit ${U} (the server has uploadpack.allowReachableSHA1InWant off) \u2014 give a branch or tag instead, or ask the host to enable it`};return{ok:!1,error:`"${U}" is not a branch or tag there, and fetching it as a commit failed (exit ${$.code})${D($.stderr)?`: ${D($.stderr)}`:""}`}}let G=await z(["git","checkout","--quiet","FETCH_HEAD"],Q);if(G.code!==0)return{ok:!1,error:`fetched ${U} but could not check it out (exit ${G.code})${D(G.stderr)?`: ${D(G.stderr)}`:""}`};return{ok:!0,resolvedBy:"commit"}}var D=(z)=>z.trim().split(`
3
3
  `).at(-1)?.trim()??"";var h=()=>{};function d(z,J={}){let Q=z.install;if(Q.kind==="mcp")return{perTurn:0,tokenizer:"o200k_base",unknown:"an MCP server's tools are only known once it connects, so its context cost cannot be measured before you install it"};if(Q.kind==="skill"){let U=z.docs?.body,Z={perTurn:j(Mz(z)),tokenizer:"o200k_base"};if(J.model!==void 0)Z.scale=m(J.model);if(U!==void 0)Z.whenUsed=j(U);else Z.unknown="the SKILL.md is not carried in the catalog, so only the index line can be measured here";let Y=J.installedSkills;if(Y!==void 0&&Y+1>x)Z.overIndexLimit=!0;return Z}return{perTurn:0,tokenizer:"o200k_base",unknown:"a plugin's context cost cannot be measured from the catalog: its tools need the code loaded to read, and its commands and skills are files that are only fetched when you install it"}}function a(z){if(z===void 0)return[];let J=[];if(z.perTurn>0||z.whenUsed!==void 0){let Q=z.scale?.measured===!0?z.scale.scale:1,U=`~${c(Math.round(z.perTurn*Q))} tokens every turn`,Z=z.whenUsed!==void 0?`, ~${c(Math.round(z.whenUsed*Q))} more when the model opens it`:"";if(J.push(`${U}${Z}`),z.scale===void 0)J.push("counted with o200k_base, which is not every model's tokenizer \u2014 unscaled here because no model was named");else if(!z.scale.measured)J.push(`counted with o200k_base \u2014 ${z.scale.note}`);else if(Q===1)J.push(`counted with o200k_base \u2014 ${z.scale.note}`);else J.push(`o200k_base scaled ${Q}\xD7 for this model \u2014 ${z.scale.note}`)}if(z.overIndexLimit)J.push(`past ${x} skills the index leaves the prompt entirely and the model lists skills with a tool instead \u2014 this changes the cost of every skill you have, not just this one`);if(z.unknown!==void 0)J.push(z.unknown);return J}var Mz=(z)=>`- ${z.id}${z.version?` (v${z.version})`:""}: ${z.description}`,c=(z)=>z>=1000?`${(z/1000).toFixed(1)}k`:String(z);var p=R(()=>{Cz();_z();Bz()});import{createHash as Nz}from"crypto";import{existsSync as Rz,readdirSync as qz,readFileSync as r,statSync as l}from"fs";import{join as n,relative as Oz,sep as Tz}from"path";function bz(z){let J=[],Q=[z];while(Q.length>0){let U=Q.pop(),Z;try{Z=qz(U)}catch{continue}for(let Y of Z){if(Y===".git")continue;let $=n(U,Y),G;try{G=l($)}catch{continue}if(G.isDirectory()){Q.push($);continue}if(G.isFile())J.push(Oz(z,$).split(Tz).join("/"))}}return J.sort()}function q(z){if(!Rz(z))return;let J=Nz("sha256"),Q=0;try{if(l(z).isFile())J.update(r(z)),Q=1;else for(let U of bz(z))J.update(U),J.update("\x00"),J.update(r(n(z,U))),J.update("\x00"),Q+=1}catch{return}return{algo:"sha256",value:J.digest("hex"),files:Q}}function VJ(z,J){if(J===void 0)return{state:"not-applicable",why:"this kind of install has no folder of its own to hash"};let Q=q(J);if(z===void 0)return Q===void 0?{state:"unrecorded"}:{state:"unrecorded",now:Q};if(Q===void 0)return{state:"missing",recorded:z};return Q.value===z.value?{state:"unchanged",digest:Q}:{state:"changed",recorded:z,now:Q}}function HJ(z,J){switch(J.state){case"unchanged":return`${z} unchanged (${J.digest.files} file${J.digest.files===1?"":"s"})`;case"changed":return`${z} CHANGED since install \u2014 recorded ${J.recorded.value.slice(0,12)} (${J.recorded.files} files), now ${J.now.value.slice(0,12)} (${J.now.files} files)`;case"missing":return`${z} gone from disk, but a record remains`;case"unrecorded":return`${z} no digest recorded \u2014 installed before rovecode kept one, or by hand`;case"not-applicable":return`${z} ${J.why}`}}var o=()=>{};import{cpSync as vz,existsSync as E,lstatSync as Sz,mkdirSync as k,mkdtempSync as v,readdirSync as uz,readFileSync as F,renameSync as Xz,rmSync as C,writeFileSync as yz}from"fs";import{tmpdir as wz}from"os";import{dirname as N,join as X,sep as Az,resolve as M}from"path";function hz(z){return fz.test(z)&&z!=="."&&z!==".."}function cz(z,J){if(J.local===!0&&z.install.kind==="mcp"){let U=["npm","node"].map((Z)=>g(Hz(Z,J.prereqEnv))).filter((Z)=>Z!==void 0);return U.length===0?[]:[` requires ${U.join(" \xB7 ")}`]}let Q=g(Wz(z,J.prereqEnv));return Q===void 0?[]:[` requires ${Q}`]}function dz(z,J){let Q=0;for(let U of[X(J,"skills"),X(z,".rovecode","skills")]){if(!E(U))continue;try{for(let Z of uz(U))if(E(X(U,Z,"SKILL.md")))Q+=1}catch{}}return Q}function az(z,J){let Q=dz(J.cwd,J.home),U=d(z,{installedSkills:Q,...J.model?{model:J.model}:{}}),Z=a(U);return Z.length===0?[]:Z.map((Y,$)=>$===0?` context ${Y}`:` ${Y}`)}function pz(z,J,Q){let U=[...cz(J,Q),...az(J,Q)];if(U.length===0)return z;let Z=z.findIndex(($)=>/^ {2}(runs|connects) {3,}/.test($)),Y=Z>=0?Z:z.findIndex(($)=>/^ {2}source {3,}/.test($));return Y<0?[...z,...U]:[...z.slice(0,Y+1),...U,...z.slice(Y+1)]}function Ez(z,J){let Q=J.scope==="project"?X(J.cwd,".rovecode","skills"):X(J.home,"skills"),U=X(Q,z);if(!M(U).startsWith(M(Q)+Az))throw Error(`"${z}" is not a usable skill name`);return U}function rz(z){let J=z.status;if(J===void 0||J==="")return[];return[` ! ${J==="archived"?"archived on GitHub \u2014 the publisher has stopped maintaining it":J==="deprecated"?"marked deprecated by its publisher":`marked "${J}" by its publisher`}. It still installs; nothing here is blocked.`]}function I(z,J,Q){return[...rz(J),...pz(z,J,Q)]}function FJ(z,J){let{install:Q}=z;if(J.ref!==void 0&&z.install.kind==="plugin")return{error:"--ref is not wired for plugins yet \u2014 it would be accepted and ignored, which is worse than not having it"};if(J.ref!==void 0&&z.install.kind==="mcp")return{error:"--ref applies to something that is cloned; an MCP entry is a config line, and its package version belongs in the entry itself"};if(J.as!==void 0&&!hz(J.as))return{error:`"${J.as}" is not a usable name \u2014 letters, digits, dot, dash and underscore only, and it must not be a path`};if(Q.kind==="mcp"){let G=y(Q.entry,{scope:J.scope,cwd:J.cwd,home:J.home,...J.pick!==void 0?{pick:J.pick}:{},...J.as!==void 0?{name:J.as}:{},...J.local!==void 0?{local:J.local}:{}});if("error"in G)return G;let V={item:z,target:G.file,scope:J.scope,preview:[...I($z(G,J.scope==="project"?"env":"prompt").filter((H)=>!mz.test(H)),z,J),...z.planNote??[]],asks:G.asks.map((H)=>({...H})),pending:[...G.pending]};if(tz(J.cwd,J.home,J.scope).includes(G.name))V.replaces=`${G.name} in ${G.file}`;return V}let U=J.as??z.id;if(Q.kind==="plugin"){if(J.as!==void 0)return{error:"--as does not apply to a plugin: it installs under the name in its own manifest"};let G=X(t(J.scope,J.cwd,J.home),z.id),V=[`${z.title}${z.version?` ${z.version}`:""}`," kind plugin \u2014 a folder of CODE that rovecode loads and RUNS in this process",` source ${Q.git?`git clone --depth 1 ${Q.source}`:`copy of the folder ${Q.source}`}${Q.subfolder?` (subfolder ${Q.subfolder})`:""}`,` publisher ${z.publisher}`,...z.license?[` licence ${z.license}`]:[],...z.repository?[` repo ${z.repository}`]:[],` writes ${G}${Q.git?" (the folder is named by the plugin's manifest; this is the expected name)":""}`,J.scope==="project"?" trust installed into this repo \u2014 approving here records this exact content as trusted on this machine":" trust user scope (~/.rovecode/plugins): loaded in every project you open"," a plugin can add tools, hooks, commands, skills and MCP servers. Install one only from a publisher you trust.",...z.planNote??[]];return{item:z,target:G,scope:J.scope,preview:I(V,z,J),asks:z.env.map((K)=>({...K})),pending:[],...E(G)?{replaces:G}:{}}}let Z=Ez(U,J),Y=Q.files??[];if(Q.source===void 0&&!Y.some((G)=>G.path.replace(/\\/g,"/").toLowerCase()==="skill.md"))return{error:`${z.id} carries no SKILL.md \u2014 a skill is a folder with a SKILL.md, and rovecode would never see this one`};let $=[`${z.title}${z.version?` ${z.version}`:""}`," kind skill \u2014 instructions the model reads. Files only: nothing here is executed on install.",Q.source?` source git clone --depth 1 ${Q.source.git}${Q.source.subfolder?` (subfolder ${Q.source.subfolder})`:""}`:` source ${Y.length} file${Y.length===1?"":"s"} from rovecode's catalog`,` publisher ${z.publisher}`,...z.license?[` licence ${z.license}`]:[],...z.repository?[` repo ${z.repository}`]:[],` writes ${Z}`,...Y.slice(0,8).map((G)=>` ${G.path}`),...Y.length>8?[` \u2026 and ${Y.length-8} more`]:[],...z.planNote??[]];return{item:z,target:Z,scope:J.scope,preview:I($,z,J),asks:z.env.map((G)=>({...G})),pending:[],...E(Z)?{replaces:Z}:{}}}async function PJ(z,J,Q,U={}){let{item:Z}=z,{install:Y}=Z;try{if(Y.kind==="mcp"){let K=y(Y.entry,{scope:Q.scope,cwd:Q.cwd,home:Q.home,...Q.pick!==void 0?{pick:Q.pick}:{},...Q.as!==void 0?{name:Q.as}:{},...Q.local!==void 0?{local:Q.local}:{}});if("error"in K)return{ok:!1,error:K.error};let H,W;if(K.local){if(U.offline===!0)return{ok:!1,error:`--offline: installing ${K.local.pkg.spec} once means npm fetching it now; drop --local to write the npx line, which fetches at launch instead`};let A=await Qz(K.local.pkg,K.local.prefix,U.spawn?{spawn:U.spawn}:{});if(!A.ok)return{ok:!1,error:A.error};H=Uz(A.pkg,K.local.pkg.rest),W={name:A.pkg.name,version:A.pkg.version,prefix:K.local.prefix,bin:A.pkg.bin,...A.pkg.integrity!==void 0?{integrity:A.pkg.integrity}:{},...A.pkg.missing.length>0?{missing:A.pkg.missing}:{}}}let _=Yz(K,J,H),P=Gz(K.file,K.name,_,{...U.force===!0?{replace:!0}:{},...Q.scope==="project"?{trustHome:Q.home}:{}});O(b(Z,{scope:Q.scope,target:K.file,...W?{package:{...W,missing:W.missing??[]}}:{}}),{cwd:Q.cwd,home:Q.home,stillInstalled:L(Q.cwd,Q.home)});let B=Vz(K,_);return{ok:!0,item:Z,target:K.file,scope:Q.scope,envNames:Zz(K,_),...P.trusted!==void 0?{trusted:P.trusted}:{},...W?{package:W}:{},...B.length?{fillIn:B}:{},next:B.length?`fill in before use: ${B.join(", ")} \u2014 edit the args in ${K.file}; until then this server is skipped`:"restart rovecode to connect \u2014 MCP servers are read once per process (a session that installs from /market connects it on the spot)"}}if(U.offline===!0&&nz(Y))return{ok:!1,error:`--offline: ${Z.id} would have to be fetched (${oz(Y)}) and nothing local can stand in for it`};if(Y.kind==="plugin"){let K=await e(Y.source,{cwd:Q.cwd,home:Q.home,scope:Q.scope,...U.force===!0?{force:!0}:{},...U.spawn?{spawn:U.spawn}:{},...Y.subfolder!==void 0?{subfolder:Y.subfolder}:{},...U.cloneCache!==void 0?{cloneCache:U.cloneCache}:{}});if(!K.ok)return{ok:!1,error:K.error};return O(b(Z,{scope:Q.scope,target:K.dir,...(()=>{let H=q(K.dir);return H?{digest:H}:{}})(),...Y.git?{git:{source:Y.source}}:{}}),{cwd:Q.cwd,home:Q.home,stillInstalled:L(Q.cwd,Q.home)}),{ok:!0,item:Z,target:K.dir,scope:Q.scope,envNames:Z.env.filter((H)=>H.required).map((H)=>H.name),...Q.scope==="project"?{trusted:!0}:{},next:"restart rovecode \u2014 plugins are loaded once at startup"}}let $=z.target;if(E($)&&U.force!==!0)return{ok:!1,error:`${$} already exists (use --force to replace)`};let G,V;if(Y.source){let K=await sz(Y.source,$,U,Q.ref);if(!K.ok)return{ok:!1,error:K.error};G=K.sha,V=K.resolvedBy}else{k(N($),{recursive:!0});let K=v(X(N($),`.rovecode-skill-${Z.id}-`));try{for(let H of Y.files??[]){let W=X(K,H.path);if(!M(W).startsWith(M(K)+Az))return{ok:!1,error:`${H.path} escapes the skill's folder`};k(N(W),{recursive:!0}),yz(W,H.text)}if(E($))C($,{recursive:!0,force:!0});Xz(K,$)}finally{C(K,{recursive:!0,force:!0})}}return O(b(Z,{scope:Q.scope,target:$,...(()=>{let K=q($);return K?{digest:K}:{}})(),...Y.source?{git:{source:Y.source.git,...G!==void 0?{sha:G}:{},...Q.ref!==void 0?{ref:Q.ref}:{},...V!==void 0?{resolvedBy:V}:{}}}:{}}),{cwd:Q.cwd,home:Q.home,stillInstalled:L(Q.cwd,Q.home)}),{ok:!0,item:Z,target:$,scope:Q.scope,envNames:[],next:"restart rovecode \u2014 skills are indexed at startup"}}catch($){return{ok:!1,error:$ instanceof Error?$.message:String($)}}}function L(z,J){return(Q)=>w({kind:Q.kind,id:Q.id},z,J,Q.scope)!==void 0}function lz(z){try{let J=F(X(z,".git","HEAD"),"utf8").trim(),Q=/^ref:\s*(.+)$/.exec(J)?.[1];if(Q===void 0)return/^[0-9a-f]{40}$/i.test(J)?J:void 0;let U=X(z,".git",...Q.split("/"));if(E(U)){let Y=F(U,"utf8").trim();return/^[0-9a-f]{40}$/i.test(Y)?Y:void 0}let Z=X(z,".git","packed-refs");if(!E(Z))return;for(let Y of F(Z,"utf8").split(`
4
4
  `)){let $=/^([0-9a-f]{40})\s+(.+)$/i.exec(Y.trim());if($&&$[2]===Q)return $[1]}return}catch{return}}function nz(z){if(z.kind==="plugin")return z.git;if(z.kind==="skill")return z.source!==void 0;return!1}function oz(z){if(z.kind==="plugin")return z.source;if(z.kind==="skill")return z.source?.git??"its catalog files";return"an mcp.json entry"}function iz(z){try{return Sz(z).isSymbolicLink()}catch{return!0}}async function sz(z,J,Q,U){let Z,Y=Q.spawn??(async(K,H)=>{let W=Bun.spawn(K,{cwd:H,stdout:"ignore",stderr:"pipe",stdin:"ignore"});return{code:await W.exited,stderr:await new Response(W.stderr).text()}}),$=Q.copy??((K,H,W)=>vz(K,H,{recursive:!0,filter:W})),G=s(z.git,U),V=null;try{let K=Q.cloneCache?.get(G),H;if(K!==void 0)H=K;else{V=v(X(wz(),"rovecode-skill-"));let A=await f(Y,z.git,V,U);if(!A.ok)return{ok:!1,error:A.error};Z=A.resolvedBy,H=V}let W=z.subfolder?X(H,z.subfolder):H;if(!M(W).startsWith(M(H)))return{ok:!1,error:"subfolder escapes the clone"};if(!E(X(W,"SKILL.md")))return{ok:!1,error:`no SKILL.md in ${z.subfolder??"the repository root"} \u2014 a skill is a folder with a SKILL.md`};k(N(J),{recursive:!0});let _=v(X(N(J),".rovecode-clone-"));try{if($(W,_,(A)=>!/(?:^|[\\/])\.git(?:[\\/]|$)/.test(A)&&!iz(A)),E(J))C(J,{recursive:!0,force:!0});Xz(_,J)}finally{C(_,{recursive:!0,force:!0})}let B=(await Y(["git","rev-parse","HEAD"],H).catch(()=>({code:1,stderr:""}))).code===0?lz(H):void 0;if(V!==null&&Q.cloneCache!==void 0)Q.cloneCache.set(G,V),V=null;return{ok:!0,...B!==void 0?{sha:B}:{},...Z!==void 0?{resolvedBy:Z}:{}}}finally{if(V!==null)C(V,{recursive:!0,force:!0})}}function tz(z,J,Q){let U=S(z,J),Z=Q==="project"?U.project:U.user;if(Z===void 0||!E(Z))return[];let Y=new Proxy({},{get:()=>"set"});return u(Z,[],Y).map(($)=>$.name)}function w(z,J,Q,U){let Z=U?[U]:["project","user"];if(z.kind==="mcp"){let Y=S(J,Q),$={project:Y.project,user:Y.user};for(let G of Z){let V=$[G];if(V===void 0||!E(V))continue;let K=new Proxy({},{get:()=>"set"});if(u(V,[],K).find((W)=>W.name===z.id)){let W={path:V,scope:G};if(G==="project")W.trusted=Jz(Q,V)==="trusted";return W}}return}if(z.kind==="plugin"){let Y=i(J,{home:Q}).plugins.find((V)=>V.name===z.id&&(U===void 0||V.scope===U));if(!Y)return;let $={path:Y.dir,scope:Y.scope},G=Y.manifest?.version;if(G!==void 0){if($.version=G,z.version!==void 0&&z.version!==G)$.updateAvailable=!0}if(Y.scope==="project")$.trusted=Y.status!=="untrusted";return $}for(let Y of Z){let $=Ez(z.id,{scope:Y,cwd:J,home:Q});if(!E(X($,"SKILL.md")))continue;let G={path:$,scope:Y},V=ez(X($,"SKILL.md"));if(V!==void 0){if(G.version=V,z.version!==void 0&&z.version!==V)G.updateAvailable=!0}return G}return}function ez(z){try{let J=F(z,"utf8").slice(0,2000);return/^version:\s*(.+)$/m.exec(J)?.[1]?.trim().slice(0,64)}catch{return}}function jJ(z,J,Q){return z.map((U)=>{let Z=w(U,J,Q);return Z?{...U,installed:Z}:{...U}})}function xJ(z,J,Q,U){let Z=w(z,J,Q,U);if(Z===void 0)return{ok:!1,error:`${z.kind} "${z.id}" is not installed here${U?` in ${U} scope`:""}`};if(z.kind==="mcp"){let Y=Kz(Z.path,z.id,{trustHome:Q});if(Y)T(z.kind,z.id,Z.scope,{cwd:J,home:Q});return Y?{ok:!0,path:Z.path}:{ok:!1,error:`no server "${z.id}" in ${Z.path}`}}if(z.kind==="plugin"){let Y=zz(z.id,{cwd:J,home:Q,scope:Z.scope});if(Y.ok)T(z.kind,z.id,Z.scope,{cwd:J,home:Q});return Y.ok?{ok:!0,path:Y.dir}:{ok:!1,error:Y.error}}return C(Z.path,{recursive:!0,force:!0}),T(z.kind,z.id,Z.scope,{cwd:J,home:Q}),{ok:!0,path:Z.path}}var fz,mz;var zJ=R(()=>{Lz();Fz();xz();jz();Pz();kz();Iz();gz();h();p();o();fz=/^[a-z0-9][a-z0-9._-]{0,63}$/i;mz=/^ {2}needs {6}/});
5
- export{VJ as Jb,HJ as Kb,o as Lb,hz as Mb,Ez as Nb,FJ as Ob,PJ as Pb,nz as Qb,w as Rb,jJ as Sb,xJ as Tb,zJ as Ub};
5
+ export{VJ as a,HJ as b,o as c,hz as d,Ez as e,FJ as f,PJ as g,nz as h,w as i,jJ as j,xJ as k,zJ as l};