@qitqode/qitqode-android-arm64 0.1.28 → 0.1.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundle/{chunk-pdzpfkt0.js → chunk-07g7cybt.js} +1 -1
- package/bundle/{chunk-emtebxvs.js → chunk-0ch32p4c.js} +1 -1
- package/bundle/{chunk-yhk7d1j0.js → chunk-0df4kede.js} +1 -1
- package/bundle/{chunk-3j9hedmx.js → chunk-0fmbz83g.js} +1 -1
- package/bundle/chunk-0jgsp4c2.js +2 -0
- package/bundle/chunk-1ngtxja9.js +2 -0
- package/bundle/{chunk-61zpnwv6.js → chunk-27dgtm8r.js} +1 -1
- package/bundle/{chunk-rmr38x2f.js → chunk-2ec6ps8r.js} +1 -1
- package/bundle/{chunk-1t6bvbgy.js → chunk-2gerf08b.js} +1 -1
- package/bundle/{chunk-04h4afhf.js → chunk-2y90ad1v.js} +1 -1
- package/bundle/{chunk-hxgs0d4t.js → chunk-3f4zht9e.js} +1 -1
- package/bundle/{chunk-f2tdfry8.js → chunk-3g1yz39h.js} +1 -1
- package/bundle/chunk-3n1324bt.js +2 -0
- package/bundle/{chunk-xvfpzmrf.js → chunk-3pxnp6jb.js} +1 -1
- package/bundle/{chunk-ebrt1me3.js → chunk-3szwfy7w.js} +1 -1
- package/bundle/{chunk-37s5hwtc.js → chunk-426dt7be.js} +1 -1
- package/bundle/{chunk-x1rx6fm7.js → chunk-42f7p0hq.js} +1 -1
- package/bundle/{chunk-4sk0rmw3.js → chunk-4p5e5tsz.js} +1 -1
- package/bundle/{chunk-13hz1kvh.js → chunk-4pjm21a5.js} +1 -1
- package/bundle/chunk-4xh1qm90.js +2 -0
- package/bundle/{chunk-ebcv65e3.js → chunk-58x5seqn.js} +1 -1
- package/bundle/{chunk-smt14yjb.js → chunk-5v4py9p2.js} +1 -1
- package/bundle/{chunk-qvxvc2c2.js → chunk-5xe6x2rt.js} +1 -1
- package/bundle/{chunk-h602h2gx.js → chunk-618tmyx9.js} +1 -1
- package/bundle/{chunk-k2tamnfv.js → chunk-76wrw0cs.js} +1 -1
- package/bundle/chunk-8qkhddq3.js +8 -0
- package/bundle/{chunk-zw0yh3dv.js → chunk-9amwe0ed.js} +1 -1
- package/bundle/{chunk-hk698g9e.js → chunk-a0v55ywn.js} +1 -1
- package/bundle/{chunk-3dvd1bb6.js → chunk-b3rpzkcb.js} +1 -1
- package/bundle/{chunk-anjg3mwn.js → chunk-b8bytvka.js} +1 -1
- package/bundle/{chunk-x9s04nze.js → chunk-bn15mzd7.js} +1 -1
- package/bundle/{chunk-df6a167w.js → chunk-bpbptx89.js} +1 -1
- package/bundle/{chunk-066eeq5q.js → chunk-bt6yw07v.js} +1 -1
- package/bundle/{chunk-xrxyrr00.js → chunk-bzgj60w4.js} +1 -1
- package/bundle/{chunk-92d9469t.js → chunk-d0nkvp57.js} +1 -1
- package/bundle/{chunk-5g8108nf.js → chunk-dcvatax2.js} +1 -1
- package/bundle/{chunk-612f97vv.js → chunk-ddnpx1yx.js} +2 -2
- package/bundle/chunk-dxe29jj6.js +2 -0
- package/bundle/{chunk-jr907144.js → chunk-eercqt72.js} +1 -1
- package/bundle/{chunk-kb6w3wbd.js → chunk-efxd6b2k.js} +1 -1
- package/bundle/{chunk-qc1w4b12.js → chunk-ejjea8hh.js} +1 -1
- package/bundle/{chunk-hnb8v476.js → chunk-eneawsj8.js} +1 -1
- package/bundle/{chunk-g16zb3y1.js → chunk-ezja6njs.js} +1 -1
- package/bundle/{chunk-bkbngcvc.js → chunk-feyphhxd.js} +1 -1
- package/bundle/{chunk-z37aqajx.js → chunk-fjgyrsbw.js} +1 -1
- package/bundle/chunk-fnnch1e9.js +2 -0
- package/bundle/{chunk-cmbxrgyx.js → chunk-fqw4y7x0.js} +1 -1
- package/bundle/{chunk-2abdrqrx.js → chunk-ft93f33g.js} +1 -1
- package/bundle/{chunk-5syxjhg3.js → chunk-gj3hzx3d.js} +1 -1
- package/bundle/{chunk-457y2816.js → chunk-h6rv626m.js} +1 -1
- package/bundle/chunk-hw1dmx28.js +2 -0
- package/bundle/{chunk-t2tgz0rc.js → chunk-hwbyqezq.js} +1 -1
- package/bundle/{chunk-scsf8r98.js → chunk-hxpgs78j.js} +1 -1
- package/bundle/{chunk-n0mygdfp.js → chunk-hxz2rdjq.js} +1 -1
- package/bundle/{chunk-48fvrggx.js → chunk-j5ymkhry.js} +1 -1
- package/bundle/{chunk-1etdhr36.js → chunk-jvqbvgjy.js} +1 -1
- package/bundle/{chunk-dafbntks.js → chunk-k8ss3135.js} +130 -130
- package/bundle/{chunk-3fx5jda0.js → chunk-mj4bepvj.js} +1 -1
- package/bundle/{chunk-gj7y56y6.js → chunk-mrw279k3.js} +1 -1
- package/bundle/chunk-my6sz5d6.js +2 -0
- package/bundle/{chunk-e0152ayv.js → chunk-n26yf3he.js} +1 -1
- package/bundle/{chunk-z6dnv8g5.js → chunk-ngytjdg2.js} +1 -1
- package/bundle/{chunk-k3epfxmq.js → chunk-nrc3bj9p.js} +1 -1
- package/bundle/{chunk-8tc8x27z.js → chunk-pvpy9kq1.js} +4 -4
- package/bundle/{chunk-krhkrca9.js → chunk-qt80mhdn.js} +1 -1
- package/bundle/{chunk-s1cnzvb2.js → chunk-qtw5nrr4.js} +1 -1
- package/bundle/{chunk-w9vh7rhg.js → chunk-rc9ex3vt.js} +1 -1
- package/bundle/{chunk-kfsn9c7m.js → chunk-s9672vvv.js} +1 -1
- package/bundle/{chunk-dpkynwgm.js → chunk-shpq6es1.js} +1 -1
- package/bundle/{chunk-fzna6jdj.js → chunk-sn4nez18.js} +1 -1
- package/bundle/{chunk-4yawrap2.js → chunk-svvgv1s0.js} +1 -1
- package/bundle/{chunk-yc1jk3rm.js → chunk-ta3k9syc.js} +1 -1
- package/bundle/chunk-tge53d52.js +3 -0
- package/bundle/{chunk-cydewa1c.js → chunk-tk5afan4.js} +1 -1
- package/bundle/{chunk-cwqd48xt.js → chunk-vcmrrt8b.js} +1 -1
- package/bundle/{chunk-wrfvqp2w.js → chunk-vcrn3v70.js} +1 -1
- package/bundle/{chunk-0nj8axbw.js → chunk-wfs4pcwa.js} +2 -2
- package/bundle/{chunk-t22jbw8x.js → chunk-wgpsmxqx.js} +1 -1
- package/bundle/{chunk-jx27xrk1.js → chunk-whcg14sc.js} +1 -1
- package/bundle/{chunk-k7g3h9tn.js → chunk-wpajh5s5.js} +1 -1
- package/bundle/chunk-xd3xc1vv.js +3 -0
- package/bundle/{chunk-1m2e2w1q.js → chunk-xm08fc2q.js} +1 -1
- package/bundle/{chunk-288hw03f.js → chunk-yn6sbycg.js} +1 -1
- package/bundle/{chunk-x7ers083.js → chunk-yy526n9c.js} +1 -1
- package/bundle/{chunk-8815p61h.js → chunk-yzc53n88.js} +1 -1
- package/bundle/{chunk-my7mn79h.js → chunk-yzjc15vp.js} +1 -1
- package/bundle/{chunk-24xc0dvv.js → chunk-z8r65yw3.js} +1 -1
- package/bundle/{chunk-va316nee.js → chunk-zfd70p01.js} +1 -1
- package/bundle/{chunk-pxtqqmkc.js → chunk-zv6pjtz1.js} +1 -1
- package/bundle/{chunk-d7qscj5p.js → chunk-zz36xg2n.js} +1 -1
- package/bundle/index.js +3 -3
- package/bundle/worker.js +1 -1
- package/package.json +1 -1
- package/bundle/chunk-6q87abbr.js +0 -2
- package/bundle/chunk-a7cxf56j.js +0 -2
- package/bundle/chunk-btneef3z.js +0 -2
- package/bundle/chunk-erg0ske8.js +0 -2
- package/bundle/chunk-fff3151r.js +0 -2
- package/bundle/chunk-k5q52wdq.js +0 -2
- package/bundle/chunk-m8yv4sd2.js +0 -3
- package/bundle/chunk-xxbqhg9n.js +0 -3
- package/bundle/chunk-y88xh6w3.js +0 -8
- package/bundle/chunk-z4z8hk7e.js +0 -2
- package/bundle/chunk-zqv7fx25.js +0 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{$h as L5,Bh as vV,Dh as G$,Fh as iJ,Gh as dV,Hh as Q$,Jh as _0,Kh as p4,Lh as q5,Mh as P$,Nh as G1,Oh as _4,Ph as v4,Qh as K7,Rh as mV,Sh as GJ,Th as r9,Uh as W0,Vh as h2,Wh as N5,Xh as x5,Yh as w5,Zh as b5,_h as P6,ai as m5,ih as J8,jh as fV,kh as V8,lh as c$,mh as EV,nh as zQ,oh as j$,ph as y$,qh as RJ,rh as CJ,sh as t4,th as YQ,uh as j1,wh as C5,yh as w6,zh as y1}from"./chunk-
|
|
2
|
+
import{$h as L5,Bh as vV,Dh as G$,Fh as iJ,Gh as dV,Hh as Q$,Jh as _0,Kh as p4,Lh as q5,Mh as P$,Nh as G1,Oh as _4,Ph as v4,Qh as K7,Rh as mV,Sh as GJ,Th as r9,Uh as W0,Vh as h2,Wh as N5,Xh as x5,Yh as w5,Zh as b5,_h as P6,ai as m5,ih as J8,jh as fV,kh as V8,lh as c$,mh as EV,nh as zQ,oh as j$,ph as y$,qh as RJ,rh as CJ,sh as t4,th as YQ,uh as j1,wh as C5,yh as w6,zh as y1}from"./chunk-wfs4pcwa.js";import{bi as GY}from"./chunk-p68rwmhc.js";import{Vi as U7}from"./chunk-a1pw9r6f.js";import{$j as d8,$k as i9,Ak as D5,Al as E2,Bk as uZ,Bl as v0,Ck as pZ,Cl as J2,Dk as y5,Dl as V2,Hk as S3,Ik as k3,Nk as O5,Wk as F5,Xj as u,Xk as O2,Zk as P5,_k as z5,bk as h9,ek as u4,fk as yZ,ik as B8,jk as A1,kk as F2,kl as hY,lk as x2,ll as A6,mk as Q2,ml as M2,nl as p8,ok as s6,ol as K2,pk as J$,pl as p2,rl as P2,sl as cV,tk as yJ,tl as p,uk as OJ,ul as xQ,wl as U2,xk as z0,xl as n9,yk as $1,yl as U6,zk as t0,zl as O7}from"./chunk-pvpy9kq1.js";import{Fl as lV}from"./chunk-wpajh5s5.js";import{Ql as e4,Tl as QV,Ul as DZ,Vl as k0,_l as z1,bm as a2,cm as l$,dm as D8,em as R$,fm as j5,im as IJ,jm as U$,lm as S2,mm as v,nm as FV,om as P0,pm as cZ}from"./chunk-2ec6ps8r.js";import{rm as i1,sm as n1,tm as s1,wm as hJ,xm as D2}from"./chunk-gj3hzx3d.js";import{An as K1,Bn as X0,Cn as t1,Dn as M4,Gn as G0,In as kY,On as TY,Pn as gY,Rn as vQ,co as dQ,do as E8}from"./chunk-nj4d554m.js";import{mp as hV}from"./chunk-fqw4y7x0.js";import{Gp as lJ}from"./chunk-nt4e3em9.js";import{Jp as I$,Yp as $0}from"./chunk-a0v55ywn.js";import{Zp as cJ}from"./chunk-v965rsr8.js";import{Tq as W$,Uq as cY,dr as t$,er as RX}from"./chunk-yq3m8190.js";import{Gr as FY,Hr as JY}from"./chunk-btz9jvec.js";import{$r as B6}from"./chunk-m02zt1a3.js";import{ds as I0,is as gV,js as u5}from"./chunk-sn4nez18.js";import{ls as E0,ms as a4,ps as r4}from"./chunk-42f7p0hq.js";import{Bs as H$,Cs as NJ,Is as KZ,Js as xJ}from"./chunk-4qqkqrn9.js";import{qt as w2}from"./chunk-12bssxd4.js";import{st as M7}from"./chunk-z8r65yw3.js";import{Dt as O6,Ot as V5,bu as H6,gu as MV,ju as _6,ou as q$,pu as L0,tt as w1,xt as J5,yu as s}from"./chunk-3szwfy7w.js";import{Bu as O$,Du as q4,Hu as QJ,Ku as gJ,Nu as LV,Ou as n2,Su as V$,zu as k5}from"./chunk-whxjkz9a.js";import{Tu as P3}from"./chunk-89v6dgpp.js";import{Uu as q}from"./chunk-k309zez0.js";import{$u as R7,Vu as XX,Xu as x,Yu as lX,Zu as z2,_u as A2,av as cX,bv as m2,cv as c,dv as o,ev as i2,fv as _2,gv as C7,hv as S7,iv as T2,jv as R0,kv as i,lv as l2,mv as YX,nv as k7,ov as oX,pv as uX,qv as y2}from"./chunk-09kba1hg.js";import{Nv as G9,rv as mX}from"./chunk-t12xrrfr.js";import{HA as L7,wA as s4}from"./chunk-phxrg7aw.js";import{AP as TJ,BF as u2,HG as H8,IF as k2,NG as UJ,OO as K5,PI as Y,PO as G5,QO as H5,RC as B5,RO as m4,TO as E5,UC as Y0,UG as AJ,VO as l4,YF as d2,YO as v5,ZD as Z2,ZG as MJ,cK as i8,hP as c9,jE as F6,jP as d5,kI as HZ,kP as c4,mG as _,oH as _J,oI as jZ,oP as c2,pO as c0,tD as W5,uF as G2,yK as AX}from"./chunk-snm5q21k.js";import{$P as J9,bQ as L2,dQ as K$,eQ as mY,fQ as lY}from"./chunk-aztre27e.js";var y0={};L2(y0,{layer:()=>lZ,defaultLayer:()=>YB,SessionStatus:()=>y0,Service:()=>X6,Info:()=>mZ,Event:()=>y7});var mZ=q.union([q.object({type:q.literal("idle")}),q.object({type:q.literal("retry"),attempt:q.number(),message:q.string(),next:q.number()}),q.object({type:q.literal("busy"),message:q.string().optional()})]).meta({ref:"SessionStatus"}),y7={Status:D2.define("session.status",q.object({sessionID:F2.zod,status:mZ})),Idle:D2.define("session.idle",q.object({sessionID:F2.zod}))};class X6 extends Z2.Service()("@qitqode/SessionStatus"){}var lZ=_.effect(X6,Y.gen(function*(){let $=yield*u.Service,Z=yield*v.make(Y.fn("SessionStatus.state")(()=>Y.succeed(new Map))),X=Y.fn("SessionStatus.get")(function*(V){return(yield*v.get(Z)).get(V)??{type:"idle"}}),Q=Y.fn("SessionStatus.list")(function*(){return new Map(yield*v.get(Z))}),J=Y.fn("SessionStatus.set")(function*(V,B){let D=yield*v.get(Z);if(yield*$.publish(y7.Status,{sessionID:V,status:B}),B.type==="idle"){yield*$.publish(y7.Idle,{sessionID:V}),D.delete(V);return}D.set(V,B)});return X6.of({get:X,list:Q,set:J})})),YB=lZ.pipe(_.provide(u.layer));var O0={};L2(O0,{layer:()=>oZ,defaultLayer:()=>QB,SessionRunState:()=>O0,Service:()=>Q6});class Q6 extends Z2.Service()("@qitqode/SessionRunState"){}var Y6=($,Z)=>`${$}:${Z}`,oZ=_.effect(Q6,Y.gen(function*(){let $=yield*y0.Service,Z=E0.create({service:"SessionRunState"}),X=yield*v.make(Y.fn("SessionRunState.state")(function*(){let W=yield*d2.Scope,K=new Map;return yield*Y.addFinalizer(Y.fnUntraced(function*(){yield*Y.forEach(K.values(),(j)=>j.cancel,{concurrency:8,discard:!0}),K.clear()})),{runners:K,scope:W}})),Q=Y.fn("SessionRunState.runner")(function*(W,K,j){let G=Y6(W,K),z=yield*v.get(X),O=z.runners.get(G);if(O)return O;let P=K==="main",w=cZ.make(z.scope,{label:G,onReentryWarn:(L)=>Z.warn("runner-reentry",L),onIdle:P?Y.gen(function*(){z.runners.delete(G),yield*$.set(W,{type:"idle"})}):Y.sync(()=>{z.runners.delete(G)}),onBusy:P?$.set(W,{type:"busy"}):Y.void,onInterrupt:j,busy:()=>{throw new O7(W)}});return z.runners.set(G,w),w}),J=Y.fn("SessionRunState.assertNotBusy")(function*(W){if((yield*v.get(X)).runners.get(Y6(W,"main"))?.busy)throw new O7(W)}),V=Y.fn("SessionRunState.cancel")(function*(W){let K=Y6(W,"main"),G=(yield*v.get(X)).runners.get(K);if(!G||!G.busy){yield*$.set(W,{type:"idle"});return}yield*G.cancel}),B=Y.fn("SessionRunState.cancelActor")(function*(W,K){let j=Y6(W,K),z=(yield*v.get(X)).runners.get(j);if(!z||!z.busy)return;yield*z.cancel}),D=Y.fn("SessionRunState.ensureRunning")(function*(W,K,j,G){return yield*(yield*Q(W,K,j)).ensureRunning(G)}),H=Y.fn("SessionRunState.startShell")(function*(W,K,j){return yield*(yield*Q(W,"main",K)).startShell(j)});return Q6.of({assertNotBusy:J,cancel:V,cancelActor:B,ensureRunning:D,startShell:H})})),QB=oZ.pipe(_.provide(y0.defaultLayer));var F0={};L2(F0,{parseVerdictFromCompletion:()=>BB,layer:()=>iZ,defaultLayer:()=>VB,Verdict:()=>r$,Service:()=>V6,Goal:()=>F0,Event:()=>P7});var r$=q.object({ok:q.boolean(),impossible:q.boolean().optional(),reason:q.string()}),P7={Updated:D2.define("session.goal",q.object({sessionID:F2.zod,goal:q.object({condition:q.string()}).optional(),lastVerdict:r$.extend({attempt:q.number(),messageID:q.string().optional(),error:q.boolean().optional()}).optional()}))},J6=`You are evaluating a stop-condition hook in QitQode. Read the conversation transcript carefully, then judge whether the user-provided condition is satisfied.
|
|
3
3
|
|
|
4
4
|
Your response must be a JSON object with one of these shapes:
|
|
5
5
|
- {"ok": true, "reason": "<quote evidence from the transcript that satisfies the condition>"}
|
|
@@ -508,7 +508,7 @@ If you repeat the same output again, the session will be terminated.
|
|
|
508
508
|
`)})});function hQ($){if(!$.lastFinished)return;let Z=[];for(let J=$.msgs.length-1;J>=0&&Z.length<t9;J--){let V=$.msgs[J];if(V.info.role!=="assistant"||!V.info.finish)continue;let B=f8(V.parts);if(B===void 0)break;Z.push(B)}if(!(Z.length===t9&&Z.every((J)=>J===Z[0])))return;let Q=$.msgs.findLast((J)=>J.info.role==="user");if(!Q||Q.parts.some((J)=>J.type==="text"&&J.text?.includes("repeating the same action")))return;Q.parts.push({id:Q2.ascending(),messageID:Q.info.id,sessionID:$.sessionID,type:"text",synthetic:!0,text:["<system-reminder>",`Your last ${t9} steps have been identical \u2014 you appear to be`,"repeating the same action without making progress. Stop and reconsider:","the current approach is not working. Try a different strategy, use a","different tool, or if you are blocked, explain the blocker to the user","instead of repeating the same step again.","</system-reminder>"].join(`
|
|
509
509
|
`)})}var e9=s.create({service:"auto-dream"}),$Z=86400000,eK=7,$G=30,mQ=1e4,ZZ="Auto Dream",XZ="Auto Distill",fQ=0,EQ=0,lQ=["Run one automatic dream memory consolidation pass for the current project.","","Use the memory files as the working index and the raw qitqode trajectory database as the source of truth.","Use bash for read-only SQLite and filesystem inspection. Do not modify the database.","Consolidate only durable, verified information into project memory."].join(`
|
|
510
510
|
`),cQ=["Run one automatic distill pass for the current project.","","Review the past month of sessions and identify repeated manual workflows worth packaging.","Use the raw qitqode trajectory database as the source of truth and memory files to spot cross-session patterns.","Inventory existing skills, agents, and commands first so you reuse or extend instead of duplicating.","Use bash for read-only SQLite and filesystem inspection. Do not modify the database.","Produce a compact shortlist, then create only the high-confidence missing assets."].join(`
|
|
511
|
-
`);function oQ($){return Y.gen(function*(){if(!$.enabled)return!1;let Z=$.intervalDays*$Z,X=yield*Y.sync(()=>a2.use((V)=>V.select({time_created:k0.time_created}).from(k0).where(G0(k0.title,$.title)).orderBy(E8(k0.time_created)).limit(1).get())),Q=Date.now(),J=X?Q-X.time_created:1/0;if(!X){let V=yield*Y.sync(()=>a2.use((B)=>B.select({time_created:k0.time_created}).from(k0).where(vQ(k0.parent_id)).orderBy(dQ(k0.time_created)).limit(1).get()));if(!V||Q-V.time_created<Z)return e9.info(`auto-${$.label} skipped \u2014 project too young`,{projectAge:V?Math.round((Q-V.time_created)/$Z)+"d":"empty",interval:$.intervalDays+"d"}),!1}if(J<Z)return e9.info(`auto-${$.label} skipped \u2014 last run too recent`,{lastRunAgo:Math.round(J/$Z)+"d",interval:$.intervalDays+"d"}),!1;return e9.info(`auto-${$.label} triggering`,{lastRun:X?new Date(X.time_created).toISOString():"never",interval:$.intervalDays+"d"}),!0})}function uQ($){let Z=$.dream?.auto!==!1;if(!Z)return Y.succeed(!1);let X=Date.now();if(X-fQ<mQ)return Y.succeed(!1);fQ=X;let Q=$.dream?.interval_days??eK;return oQ({enabled:Z,intervalDays:Q,title:ZZ,label:"dream"})}function pQ($){let Z=$.distill?.auto!==!1;if(!Z)return Y.succeed(!1);let X=Date.now();if(X-EQ<mQ)return Y.succeed(!1);EQ=X;let Q=$.distill?.interval_days??$G;return oQ({enabled:Z,intervalDays:Q,title:XZ,label:"distill"})}var iQ=Y.fnUntraced(function*($){let Z=yield*$.config.get(),X=yield*uQ(Z).pipe(Y.catch(()=>Y.succeed(!1))),Q=yield*pQ(Z).pipe(Y.catch(()=>Y.succeed(!1))),J={providerID:$.lastUser.model.providerID,modelID:$.lastUser.model.modelID};if(!X&&!Q)return;let{AppRuntime:V}=yield*Y.promise(()=>import("./chunk-457y2816.js"));if(X)V.runPromise(E2.use((B)=>Y.gen(function*(){let D=yield*B.create({title:ZZ});yield*(yield*$.promptServiceTag).prompt({sessionID:D.id,agent:"dream",model:J,parts:[{type:"text",text:lQ}]})}))).catch((B)=>$.log.error("auto-dream prompt failed",{error:String(B)}));if(Q)V.runPromise(E2.use((B)=>Y.gen(function*(){let D=yield*B.create({title:XZ});yield*(yield*$.promptServiceTag).prompt({sessionID:D.id,agent:"distill",model:J,parts:[{type:"text",text:cQ}]})}))).catch((B)=>$.log.error("auto-distill prompt failed",{error:String(B)}))});var XG=($)=>$.pipe(Y.catchDefect((Z)=>Z instanceof $0.BackendAuthRejectedError?Y.succeed(void 0):Y.die(Z))),YZ=($)=>XG(Y.promise(()=>$0.resolvePrompt($))).pipe(Y.map((Z)=>Z??"")),nQ=Y.gen(function*(){let $=yield*YZ("session/build-switch"),Z=yield*YZ("session/max-steps"),X=yield*YZ("session/compose");return{buildSwitch:$,maxSteps:Z,promptCompose:X}});var sQ=E0.create({service:"session.prompt"}),YG=s.create({service:"session.prompt"});function aQ($,Z,X,Q){return Y.gen(function*(){let{bus:J,status:V,sessions:B,agents:D,provider:H,processor:W,prune:K,checkpoint:j,compaction:G,config:z,plugin:O,permission:P,fsys:w,registry:L,scope:F,instruction:U,state:y,goal:S,taskGateState:I,taskRegistry:M,revert:f,summary:b,sys:k,llm:h,actorRegistry:N,inbox:A}=yield*S4,R=yield*nQ,C=R.buildSwitch,T=R.maxSteps,l=R.promptCompose,d=(t,N2,j2)=>DQ(H,J,t,N2,j2),g=(t,N2)=>OQ(B,t,N2),E=a9(B),m=1024,e=new class extends Set{add(t){if(super.add(t),this.size>1024){let N2=this.values().next().value;if(N2!==void 0)this.delete(N2)}return this}},n=(t)=>o9({getOps:$,...t}),a=qQ({agents:D,provider:H,llm:h,sessions:B,elog:sQ}),H2=NQ({sessions:B,fsys:w,buildSwitch:C,promptCompose:l});return{runLoop:Y.fn("SessionPrompt.run")(function*(t,N2,j2){let g0=yield*v.context,R2=sQ.with({sessionID:t}),X2,q2=0,b2=yield*B.get(t),r2,w0,D0=N2??"main",p0=GQ({sessionID:t,agentID:D0,task_id:j2,plugin:O,bus:J,prune:K,scope:F}),{cancellation:h0,agentMetrics:M$,publishAgentRequest:i0,schedulePrune:n0}=p0,N1=KQ({sessionID:t,agentID:D0,task_id:j2,session:b2,cancellation:h0,plugin:O});return yield*Y.gen(function*(){yield*p0.before;let s0=(t2,Y2)=>g4(sY(t2,Y2,p.parts(Y2.id))),s$=!1,K8=kQ({sessionID:t,bus:J,appendSyntheticUserTurn:E,slog:R2}),f0=SQ({sessionID:t,sessions:B,bus:J,appendSyntheticUserTurn:E,slog:R2}),{autoContinueOutputLength:G8,autoContinueInvalidOutput:_Z,autoRetryStructuredOutput:oV,handleTextRepeat:uV,writeContentFilterError:IZ,writeModelError:RZ}=f0,CZ=FQ({sessionID:t,agentID:N2,agents:D,taskGateState:I,taskRegistry:M,appendSyntheticUserTurn:E,slog:R2}),SZ=PQ({sessionID:t,agentID:N2,session:b2,goal:S,bus:J,appendSyntheticUserTurn:E,slog:R2});while(!0){if(!N2||N2==="main")yield*V.set(t,{type:"busy"});yield*A.drain(t,N2??"main").pipe(Y.ignore),yield*R2.info("loop",{step:q2});let t2=yield*p.filterCompactedEffect(t,{contextFrom:b2.contextFrom,contextWatermark:b2.contextWatermark,agentID:N2??"main"}),Y2,TZ,a0,H7,b0,gZ=[];for(let W2=t2.length-1;W2>=0;W2--){let K0=t2[W2];if(!Y2&&K0.info.role==="user")Y2=K0.info,TZ=K0;if(!a0&&K0.info.role==="assistant")a0=K0.info,H7=K0;if(!b0&&K0.info.role==="assistant"&&K0.info.finish)b0=K0.info;if(Y2&&b0)break;if(!b0){let $6=K0.parts.filter((a$)=>a$.type==="subtask");gZ.push(...$6)}}if(!Y2)throw Error("No user message found in stream. This should never happen.");yield*TQ({sessionID:t,msgs:t2,checkpoint:j,config:z});let nV=H7?.parts.some((W2)=>W2.type==="tool"&&!W2.metadata?.providerExecuted)??!1;if(a0?.finish==="length"&&!nV&&Y2.id<a0.id&&(yield*G8({lastUser:Y2,assistant:a0})))continue;if(a0){let W2=d9({phase:"existing-assistant",lastUser:Y2,assistant:a0,parts:H7?.parts??[]});if(W2.type==="filtered"){yield*IZ({assistant:a0}),yield*R2.info("exiting loop",{classification:W2.type});break}if(W2.type==="failed"){yield*RZ({assistant:a0,reason:W2.reason}),yield*R2.info("exiting loop",{classification:W2.type,reason:W2.reason});break}if(W2.type==="think-only"||W2.type==="invalid"){let K0=W2.type==="invalid"?W2.reason:"think-only";if(yield*_Z({lastUser:Y2,assistant:a0,reason:K0}))continue;yield*R2.info("exiting loop",{classification:W2.type});break}if(W2.type==="final"&&W2.degraded)yield*R2.warn("degraded final on abnormal finish",{finish:a0.finish});if(W2.type!=="continue"){if(yield*CZ(Y2))continue;if(yield*SZ(Y2))continue;yield*R2.info("exiting loop",{classification:W2.type});break}}if(q2++,q2===1)yield*a({session:b2,modelID:Y2.model.modelID,providerID:Y2.model.providerID,history:t2}).pipe(Y.ignore,Y.forkIn(F));if(q2===1&&!b2.parentID)yield*iQ({config:z,lastUser:Y2,promptServiceTag:Q,log:YG});let r0=yield*d(Y2.model.providerID,Y2.model.modelID,t);w0=r0,r2=b0;let hZ=gZ.pop();if(hZ?.type==="subtask"){yield*n({task:hZ,model:r0,lastUser:Y2,sessionID:t,session:b2,msgs:t2});continue}let fZ=TZ;if(fZ?.parts.some((W2)=>W2.type==="compaction")){let W2=fZ.parts.find((a$)=>a$.type==="compaction"),K0=yield*B.messages({sessionID:t,agentID:Y2.agentID??"main"});if((yield*G.process({parentID:Y2.id,messages:K0,sessionID:t,auto:W2?.auto??!1,overflow:W2?.overflow,agentID:Y2.agentID}))==="stop")break;continue}yield*gQ({sessionID:t,msgs:t2,lastFinished:b0,model:r0,config:z}),hQ({sessionID:t,msgs:t2,lastFinished:b0});let _$=yield*D.get(Y2.agent),j7=_$?.native===!0&&_$?.hidden===!0;if(!s$&&!j7&&b0&&b0.tokens){let W2=yield*$();yield*K.fireCheckpoints({sessionID:t,model:r0,tokens:b0.tokens,promptOps:W2,agentID:Y2.agentID}).pipe(Y.ignore)}if(!s$&&b0&&b0.tokens){if(yield*BQ({config:z,checkpoint:j,compaction:G,prune:K},{sessionID:t,lastFinished:b0,lastUser:Y2,model:r0,msgs:t2,isBoundedComputation:j7})){s$=!0;continue}}if(s$=!1,!_$)throw yield*m9(D,J,Y2.agent,t);let sV=_$.steps??1/0,aV=q2>=sV;t2=yield*H2({messages:t2,agent:_$,session:b2});let EZ=E4({sessionID:t,parentID:Y2.id,agentID:Y2.agentID,agent:_$.name,variant:Y2.model.variant,cwd:g0.directory,root:g0.worktree,modelID:r0.id,providerID:r0.providerID});yield*B.updateMessage(EZ);let e2=yield*W.create({assistantMessage:EZ,sessionID:t,model:r0,agentMetrics:M$}),rV=yield*Y.gen(function*(){let W2={value:X2},K0=yield*aY({sessionID:t,resolvedAgentID:D0,step:q2,task_id:j2,lastUser:Y2,lastFinished:b0,msgs:t2,agent:_$,session:b2,model:r0,handle:e2,structured:W2,resolveTools:Z,createStructuredOutputTool:X,summary:b,scope:F,plugin:O}),{tools:$6,format:a$,query:tV}=K0,{cancelledByPlugin:eV,withUserQueryPost:$B}=rY({sessionID:t,agentID:D0,step:q2,lastUser:Y2,msgs:t2,query:tV,handle:e2,plugin:O,sessions:B,cancellation:h0,trajectoryForStep:s0}),ZB=Y.fnUntraced(function*(Z6){if(Z6==="continue"&&(yield*G8({lastUser:Y2,assistant:e2.message})))return"continue";if(Z6==="text-repeat"){if(yield*uV({lastUser:Y2}))return"continue";return"break"}if(W2.value!==void 0)return X2=W2.value,e2.message.structured=W2.value,e2.message.finish=e2.message.finish??"stop",yield*B.updateMessage(e2.message),"break";let B$=d9({phase:"after-process",lastUser:Y2,assistant:e2.message,parts:p.parts(e2.message.id),processResult:Z6});if(B$.type==="filtered")return yield*IZ({assistant:e2.message}),"break";if(B$.type==="failed")return yield*RZ({assistant:e2.message,reason:B$.reason}),"break";if(B$.type!=="continue"&&!e2.message.error&&a$.type==="json_schema"){if(yield*oV({lastUser:Y2,assistant:e2.message}))return"continue";return"break"}if((B$.type==="think-only"||B$.type==="invalid")&&a$.type!=="json_schema"){let XB=B$.type==="invalid"?B$.reason:"think-only";if(yield*_Z({lastUser:Y2,assistant:e2.message,reason:XB}))return"continue";return"break"}if(B$.type==="final"&&B$.degraded)yield*R2.warn("degraded final on abnormal finish",{finish:e2.message.finish});if(Z6==="stop")return"break";return}),D7=yield*QQ({sessionID:t,lastUser:Y2,agent:_$,session:b2,model:r0,msgs:t2,tools:$6,format:a$,handle:e2,isLastStep:aV,task_id:j2,instructionsNotified:e,maxStepsText:T,actorRegistry:N,bus:J,config:z,instruction:U,llm:h,registry:L,status:V,sys:k,cancelledByPlugin:eV,withUserQueryPost:$B,slog:R2});if(D7.kind==="break")return"break";let dZ=yield*ZB(D7.result);if(dZ)return dZ;if(D7.result==="overflow")yield*WQ({config:z,checkpoint:j,compaction:G,prune:K},{sessionID:t,lastUser:Y2,model:r0,msgs:t2,isBoundedComputation:j7});return"continue"}).pipe(Y.ensuring(U.clear(e2.message.id))),vZ=yield*K8.check({lastUser:Y2,completedParts:p.parts(e2.message.id)});if(vZ==="terminate")break;if(vZ==="recovered")continue;if(rV==="break"){if(yield*CZ(Y2))continue;if(yield*SZ(Y2))continue;break}continue}let pV=yield*$();if(w0&&r2)yield*n0({model:w0,lastFinished:r2,promptOps:pV});let e8=yield*g(t,N2),iV=e8.info.role==="assistant"&&!!e8.info.error,kZ=yield*B.findMessage(t,(t2)=>t2.info.role==="user",{agentID:"*"});return yield*i0(iV?"error":"completed",Y0.isSome(kZ)?kZ.value.info.agent:e8.info.agent),e8}).pipe((s0)=>l9(t,J,s0),Y.onExit(N1),Y.orDie)}),lastAssistant:g}})}import rQ from"path";var QG=new TextEncoder,QZ=new TextDecoder,JG=($)=>`
|
|
511
|
+
`);function oQ($){return Y.gen(function*(){if(!$.enabled)return!1;let Z=$.intervalDays*$Z,X=yield*Y.sync(()=>a2.use((V)=>V.select({time_created:k0.time_created}).from(k0).where(G0(k0.title,$.title)).orderBy(E8(k0.time_created)).limit(1).get())),Q=Date.now(),J=X?Q-X.time_created:1/0;if(!X){let V=yield*Y.sync(()=>a2.use((B)=>B.select({time_created:k0.time_created}).from(k0).where(vQ(k0.parent_id)).orderBy(dQ(k0.time_created)).limit(1).get()));if(!V||Q-V.time_created<Z)return e9.info(`auto-${$.label} skipped \u2014 project too young`,{projectAge:V?Math.round((Q-V.time_created)/$Z)+"d":"empty",interval:$.intervalDays+"d"}),!1}if(J<Z)return e9.info(`auto-${$.label} skipped \u2014 last run too recent`,{lastRunAgo:Math.round(J/$Z)+"d",interval:$.intervalDays+"d"}),!1;return e9.info(`auto-${$.label} triggering`,{lastRun:X?new Date(X.time_created).toISOString():"never",interval:$.intervalDays+"d"}),!0})}function uQ($){let Z=$.dream?.auto!==!1;if(!Z)return Y.succeed(!1);let X=Date.now();if(X-fQ<mQ)return Y.succeed(!1);fQ=X;let Q=$.dream?.interval_days??eK;return oQ({enabled:Z,intervalDays:Q,title:ZZ,label:"dream"})}function pQ($){let Z=$.distill?.auto!==!1;if(!Z)return Y.succeed(!1);let X=Date.now();if(X-EQ<mQ)return Y.succeed(!1);EQ=X;let Q=$.distill?.interval_days??$G;return oQ({enabled:Z,intervalDays:Q,title:XZ,label:"distill"})}var iQ=Y.fnUntraced(function*($){let Z=yield*$.config.get(),X=yield*uQ(Z).pipe(Y.catch(()=>Y.succeed(!1))),Q=yield*pQ(Z).pipe(Y.catch(()=>Y.succeed(!1))),J={providerID:$.lastUser.model.providerID,modelID:$.lastUser.model.modelID};if(!X&&!Q)return;let{AppRuntime:V}=yield*Y.promise(()=>import("./chunk-h6rv626m.js"));if(X)V.runPromise(E2.use((B)=>Y.gen(function*(){let D=yield*B.create({title:ZZ});yield*(yield*$.promptServiceTag).prompt({sessionID:D.id,agent:"dream",model:J,parts:[{type:"text",text:lQ}]})}))).catch((B)=>$.log.error("auto-dream prompt failed",{error:String(B)}));if(Q)V.runPromise(E2.use((B)=>Y.gen(function*(){let D=yield*B.create({title:XZ});yield*(yield*$.promptServiceTag).prompt({sessionID:D.id,agent:"distill",model:J,parts:[{type:"text",text:cQ}]})}))).catch((B)=>$.log.error("auto-distill prompt failed",{error:String(B)}))});var XG=($)=>$.pipe(Y.catchDefect((Z)=>Z instanceof $0.BackendAuthRejectedError?Y.succeed(void 0):Y.die(Z))),YZ=($)=>XG(Y.promise(()=>$0.resolvePrompt($))).pipe(Y.map((Z)=>Z??"")),nQ=Y.gen(function*(){let $=yield*YZ("session/build-switch"),Z=yield*YZ("session/max-steps"),X=yield*YZ("session/compose");return{buildSwitch:$,maxSteps:Z,promptCompose:X}});var sQ=E0.create({service:"session.prompt"}),YG=s.create({service:"session.prompt"});function aQ($,Z,X,Q){return Y.gen(function*(){let{bus:J,status:V,sessions:B,agents:D,provider:H,processor:W,prune:K,checkpoint:j,compaction:G,config:z,plugin:O,permission:P,fsys:w,registry:L,scope:F,instruction:U,state:y,goal:S,taskGateState:I,taskRegistry:M,revert:f,summary:b,sys:k,llm:h,actorRegistry:N,inbox:A}=yield*S4,R=yield*nQ,C=R.buildSwitch,T=R.maxSteps,l=R.promptCompose,d=(t,N2,j2)=>DQ(H,J,t,N2,j2),g=(t,N2)=>OQ(B,t,N2),E=a9(B),m=1024,e=new class extends Set{add(t){if(super.add(t),this.size>1024){let N2=this.values().next().value;if(N2!==void 0)this.delete(N2)}return this}},n=(t)=>o9({getOps:$,...t}),a=qQ({agents:D,provider:H,llm:h,sessions:B,elog:sQ}),H2=NQ({sessions:B,fsys:w,buildSwitch:C,promptCompose:l});return{runLoop:Y.fn("SessionPrompt.run")(function*(t,N2,j2){let g0=yield*v.context,R2=sQ.with({sessionID:t}),X2,q2=0,b2=yield*B.get(t),r2,w0,D0=N2??"main",p0=GQ({sessionID:t,agentID:D0,task_id:j2,plugin:O,bus:J,prune:K,scope:F}),{cancellation:h0,agentMetrics:M$,publishAgentRequest:i0,schedulePrune:n0}=p0,N1=KQ({sessionID:t,agentID:D0,task_id:j2,session:b2,cancellation:h0,plugin:O});return yield*Y.gen(function*(){yield*p0.before;let s0=(t2,Y2)=>g4(sY(t2,Y2,p.parts(Y2.id))),s$=!1,K8=kQ({sessionID:t,bus:J,appendSyntheticUserTurn:E,slog:R2}),f0=SQ({sessionID:t,sessions:B,bus:J,appendSyntheticUserTurn:E,slog:R2}),{autoContinueOutputLength:G8,autoContinueInvalidOutput:_Z,autoRetryStructuredOutput:oV,handleTextRepeat:uV,writeContentFilterError:IZ,writeModelError:RZ}=f0,CZ=FQ({sessionID:t,agentID:N2,agents:D,taskGateState:I,taskRegistry:M,appendSyntheticUserTurn:E,slog:R2}),SZ=PQ({sessionID:t,agentID:N2,session:b2,goal:S,bus:J,appendSyntheticUserTurn:E,slog:R2});while(!0){if(!N2||N2==="main")yield*V.set(t,{type:"busy"});yield*A.drain(t,N2??"main").pipe(Y.ignore),yield*R2.info("loop",{step:q2});let t2=yield*p.filterCompactedEffect(t,{contextFrom:b2.contextFrom,contextWatermark:b2.contextWatermark,agentID:N2??"main"}),Y2,TZ,a0,H7,b0,gZ=[];for(let W2=t2.length-1;W2>=0;W2--){let K0=t2[W2];if(!Y2&&K0.info.role==="user")Y2=K0.info,TZ=K0;if(!a0&&K0.info.role==="assistant")a0=K0.info,H7=K0;if(!b0&&K0.info.role==="assistant"&&K0.info.finish)b0=K0.info;if(Y2&&b0)break;if(!b0){let $6=K0.parts.filter((a$)=>a$.type==="subtask");gZ.push(...$6)}}if(!Y2)throw Error("No user message found in stream. This should never happen.");yield*TQ({sessionID:t,msgs:t2,checkpoint:j,config:z});let nV=H7?.parts.some((W2)=>W2.type==="tool"&&!W2.metadata?.providerExecuted)??!1;if(a0?.finish==="length"&&!nV&&Y2.id<a0.id&&(yield*G8({lastUser:Y2,assistant:a0})))continue;if(a0){let W2=d9({phase:"existing-assistant",lastUser:Y2,assistant:a0,parts:H7?.parts??[]});if(W2.type==="filtered"){yield*IZ({assistant:a0}),yield*R2.info("exiting loop",{classification:W2.type});break}if(W2.type==="failed"){yield*RZ({assistant:a0,reason:W2.reason}),yield*R2.info("exiting loop",{classification:W2.type,reason:W2.reason});break}if(W2.type==="think-only"||W2.type==="invalid"){let K0=W2.type==="invalid"?W2.reason:"think-only";if(yield*_Z({lastUser:Y2,assistant:a0,reason:K0}))continue;yield*R2.info("exiting loop",{classification:W2.type});break}if(W2.type==="final"&&W2.degraded)yield*R2.warn("degraded final on abnormal finish",{finish:a0.finish});if(W2.type!=="continue"){if(yield*CZ(Y2))continue;if(yield*SZ(Y2))continue;yield*R2.info("exiting loop",{classification:W2.type});break}}if(q2++,q2===1)yield*a({session:b2,modelID:Y2.model.modelID,providerID:Y2.model.providerID,history:t2}).pipe(Y.ignore,Y.forkIn(F));if(q2===1&&!b2.parentID)yield*iQ({config:z,lastUser:Y2,promptServiceTag:Q,log:YG});let r0=yield*d(Y2.model.providerID,Y2.model.modelID,t);w0=r0,r2=b0;let hZ=gZ.pop();if(hZ?.type==="subtask"){yield*n({task:hZ,model:r0,lastUser:Y2,sessionID:t,session:b2,msgs:t2});continue}let fZ=TZ;if(fZ?.parts.some((W2)=>W2.type==="compaction")){let W2=fZ.parts.find((a$)=>a$.type==="compaction"),K0=yield*B.messages({sessionID:t,agentID:Y2.agentID??"main"});if((yield*G.process({parentID:Y2.id,messages:K0,sessionID:t,auto:W2?.auto??!1,overflow:W2?.overflow,agentID:Y2.agentID}))==="stop")break;continue}yield*gQ({sessionID:t,msgs:t2,lastFinished:b0,model:r0,config:z}),hQ({sessionID:t,msgs:t2,lastFinished:b0});let _$=yield*D.get(Y2.agent),j7=_$?.native===!0&&_$?.hidden===!0;if(!s$&&!j7&&b0&&b0.tokens){let W2=yield*$();yield*K.fireCheckpoints({sessionID:t,model:r0,tokens:b0.tokens,promptOps:W2,agentID:Y2.agentID}).pipe(Y.ignore)}if(!s$&&b0&&b0.tokens){if(yield*BQ({config:z,checkpoint:j,compaction:G,prune:K},{sessionID:t,lastFinished:b0,lastUser:Y2,model:r0,msgs:t2,isBoundedComputation:j7})){s$=!0;continue}}if(s$=!1,!_$)throw yield*m9(D,J,Y2.agent,t);let sV=_$.steps??1/0,aV=q2>=sV;t2=yield*H2({messages:t2,agent:_$,session:b2});let EZ=E4({sessionID:t,parentID:Y2.id,agentID:Y2.agentID,agent:_$.name,variant:Y2.model.variant,cwd:g0.directory,root:g0.worktree,modelID:r0.id,providerID:r0.providerID});yield*B.updateMessage(EZ);let e2=yield*W.create({assistantMessage:EZ,sessionID:t,model:r0,agentMetrics:M$}),rV=yield*Y.gen(function*(){let W2={value:X2},K0=yield*aY({sessionID:t,resolvedAgentID:D0,step:q2,task_id:j2,lastUser:Y2,lastFinished:b0,msgs:t2,agent:_$,session:b2,model:r0,handle:e2,structured:W2,resolveTools:Z,createStructuredOutputTool:X,summary:b,scope:F,plugin:O}),{tools:$6,format:a$,query:tV}=K0,{cancelledByPlugin:eV,withUserQueryPost:$B}=rY({sessionID:t,agentID:D0,step:q2,lastUser:Y2,msgs:t2,query:tV,handle:e2,plugin:O,sessions:B,cancellation:h0,trajectoryForStep:s0}),ZB=Y.fnUntraced(function*(Z6){if(Z6==="continue"&&(yield*G8({lastUser:Y2,assistant:e2.message})))return"continue";if(Z6==="text-repeat"){if(yield*uV({lastUser:Y2}))return"continue";return"break"}if(W2.value!==void 0)return X2=W2.value,e2.message.structured=W2.value,e2.message.finish=e2.message.finish??"stop",yield*B.updateMessage(e2.message),"break";let B$=d9({phase:"after-process",lastUser:Y2,assistant:e2.message,parts:p.parts(e2.message.id),processResult:Z6});if(B$.type==="filtered")return yield*IZ({assistant:e2.message}),"break";if(B$.type==="failed")return yield*RZ({assistant:e2.message,reason:B$.reason}),"break";if(B$.type!=="continue"&&!e2.message.error&&a$.type==="json_schema"){if(yield*oV({lastUser:Y2,assistant:e2.message}))return"continue";return"break"}if((B$.type==="think-only"||B$.type==="invalid")&&a$.type!=="json_schema"){let XB=B$.type==="invalid"?B$.reason:"think-only";if(yield*_Z({lastUser:Y2,assistant:e2.message,reason:XB}))return"continue";return"break"}if(B$.type==="final"&&B$.degraded)yield*R2.warn("degraded final on abnormal finish",{finish:e2.message.finish});if(Z6==="stop")return"break";return}),D7=yield*QQ({sessionID:t,lastUser:Y2,agent:_$,session:b2,model:r0,msgs:t2,tools:$6,format:a$,handle:e2,isLastStep:aV,task_id:j2,instructionsNotified:e,maxStepsText:T,actorRegistry:N,bus:J,config:z,instruction:U,llm:h,registry:L,status:V,sys:k,cancelledByPlugin:eV,withUserQueryPost:$B,slog:R2});if(D7.kind==="break")return"break";let dZ=yield*ZB(D7.result);if(dZ)return dZ;if(D7.result==="overflow")yield*WQ({config:z,checkpoint:j,compaction:G,prune:K},{sessionID:t,lastUser:Y2,model:r0,msgs:t2,isBoundedComputation:j7});return"continue"}).pipe(Y.ensuring(U.clear(e2.message.id))),vZ=yield*K8.check({lastUser:Y2,completedParts:p.parts(e2.message.id)});if(vZ==="terminate")break;if(vZ==="recovered")continue;if(rV==="break"){if(yield*CZ(Y2))continue;if(yield*SZ(Y2))continue;break}continue}let pV=yield*$();if(w0&&r2)yield*n0({model:w0,lastFinished:r2,promptOps:pV});let e8=yield*g(t,N2),iV=e8.info.role==="assistant"&&!!e8.info.error,kZ=yield*B.findMessage(t,(t2)=>t2.info.role==="user",{agentID:"*"});return yield*i0(iV?"error":"completed",Y0.isSome(kZ)?kZ.value.info.agent:e8.info.agent),e8}).pipe((s0)=>l9(t,J,s0),Y.onExit(N1),Y.orDie)}),lastAssistant:g}})}import rQ from"path";var QG=new TextEncoder,QZ=new TextDecoder,JG=($)=>`
|
|
512
512
|
|
|
513
513
|
[... QitQode truncated ${$} bytes of shell output ...]
|
|
514
514
|
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{n as a,o as b}from"./chunk-k8ss3135.js";import"./chunk-whcg14sc.js";import"./chunk-mrw279k3.js";import"./chunk-c8k32724.js";import"./chunk-3g1yz39h.js";import"./chunk-s6bar2f9.js";import"./chunk-yt3f3j35.js";import"./chunk-b3rpzkcb.js";import"./chunk-d6r4xwtg.js";import"./chunk-fjgyrsbw.js";import"./chunk-bzgj60w4.js";import"./chunk-kdcnder5.js";import"./chunk-27yxgy03.js";import"./chunk-ngchsw2g.js";import"./chunk-2vepzgek.js";import"./chunk-hxz2rdjq.js";import"./chunk-7ppd2phw.js";import"./chunk-2y90ad1v.js";import"./chunk-yzjc15vp.js";import"./chunk-wfs4pcwa.js";import"./chunk-p68rwmhc.js";import"./chunk-pvpy9kq1.js";import"./chunk-wpajh5s5.js";import"./chunk-2ec6ps8r.js";import"./chunk-gj3hzx3d.js";import"./chunk-nj4d554m.js";import"./chunk-2gerf08b.js";import"./chunk-fqw4y7x0.js";import"./chunk-a1p2f16h.js";import"./chunk-nt4e3em9.js";import"./chunk-a0v55ywn.js";import"./chunk-v965rsr8.js";import"./chunk-1sgby720.js";import"./chunk-dcvatax2.js";import"./chunk-4tbwha3m.js";import"./chunk-m612agnk.js";import"./chunk-yq3m8190.js";import"./chunk-btz9jvec.js";import"./chunk-cqtkxwd8.js";import"./chunk-fkgv2hqd.js";import"./chunk-zyhdxggp.js";import"./chunk-q6ztpfcs.js";import"./chunk-jm1ptn8n.js";import"./chunk-c5e6sk9c.js";import"./chunk-m02zt1a3.js";import"./chunk-vg2fmyje.js";import"./chunk-sn4nez18.js";import"./chunk-42f7p0hq.js";import"./chunk-4qqkqrn9.js";import"./chunk-j6emx6jn.js";import"./chunk-be216spx.js";import"./chunk-12bssxd4.js";import"./chunk-z8r65yw3.js";import"./chunk-3szwfy7w.js";import"./chunk-whxjkz9a.js";import"./chunk-89v6dgpp.js";import"./chunk-k309zez0.js";import"./chunk-09kba1hg.js";import"./chunk-t12xrrfr.js";import"./chunk-phxrg7aw.js";import"./chunk-snm5q21k.js";import"./chunk-xpc2zgj7.js";import"./chunk-qjjch1zt.js";import"./chunk-aztre27e.js";export{b as tui,a as rendererConfig};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Rd as b}from"./chunk-yajd975f.js";import{Vf as t}from"./chunk-7ppd2phw.js";import{hh as u}from"./chunk-
|
|
2
|
+
import{Rd as b}from"./chunk-yajd975f.js";import{Vf as t}from"./chunk-7ppd2phw.js";import{hh as u}from"./chunk-ddnpx1yx.js";import"./chunk-wfs4pcwa.js";import"./chunk-p68rwmhc.js";import"./chunk-0a0vat1h.js";import"./chunk-z8v2tsz2.js";import"./chunk-j8efst22.js";import"./chunk-a1pw9r6f.js";import"./chunk-d5bxan80.js";import{rl as y,yk as m}from"./chunk-pvpy9kq1.js";import{Pl as v}from"./chunk-wpajh5s5.js";import{lm as a}from"./chunk-2ec6ps8r.js";import"./chunk-gj3hzx3d.js";import"./chunk-nj4d554m.js";import"./chunk-2gerf08b.js";import"./chunk-fqw4y7x0.js";import"./chunk-a1p2f16h.js";import"./chunk-nt4e3em9.js";import"./chunk-a0v55ywn.js";import"./chunk-v965rsr8.js";import"./chunk-1sgby720.js";import"./chunk-dcvatax2.js";import"./chunk-4tbwha3m.js";import"./chunk-m612agnk.js";import"./chunk-yq3m8190.js";import"./chunk-btz9jvec.js";import"./chunk-cqtkxwd8.js";import"./chunk-fkgv2hqd.js";import"./chunk-zyhdxggp.js";import"./chunk-q6ztpfcs.js";import"./chunk-jm1ptn8n.js";import"./chunk-c5e6sk9c.js";import"./chunk-m02zt1a3.js";import"./chunk-vg2fmyje.js";import"./chunk-sn4nez18.js";import"./chunk-42f7p0hq.js";import"./chunk-4qqkqrn9.js";import"./chunk-j6emx6jn.js";import"./chunk-be216spx.js";import"./chunk-12bssxd4.js";import"./chunk-z8r65yw3.js";import"./chunk-3szwfy7w.js";import"./chunk-whxjkz9a.js";import"./chunk-89v6dgpp.js";import"./chunk-k309zez0.js";import"./chunk-09kba1hg.js";import"./chunk-t12xrrfr.js";import"./chunk-phxrg7aw.js";import{PI as s}from"./chunk-snm5q21k.js";import"./chunk-xpc2zgj7.js";import"./chunk-qjjch1zt.js";import"./chunk-aztre27e.js";import{EOL as f}from"os";var M=b({command:"models [provider]",describe:"list all available models",builder:(r)=>{return r.positional("provider",{describe:"provider ID to filter models by",type:"string",array:!1}).option("verbose",{describe:"use more verbose model output (includes metadata like costs)",type:"boolean"}).option("refresh",{describe:"refresh the models cache from models.dev",type:"boolean"})},handler:async(r)=>{if(r.refresh)await v.refresh(!0),t.println(t.Style.TEXT_SUCCESS_BOLD+"Models cache refreshed"+t.Style.TEXT_NORMAL);await a.provide({directory:process.cwd(),async fn(){await u.runPromise(s.gen(function*(){let n=yield*(yield*y.Service).list(),l=(e,o)=>{let i=n[e],d=Object.entries(i.models).sort(([c],[p])=>c.localeCompare(p));for(let[c,p]of d)if(process.stdout.write(`${e}/${c}`),process.stdout.write(f),o)process.stdout.write(JSON.stringify(p,null,2)),process.stdout.write(f)};if(r.provider){let e=m.make(r.provider);if(!n[e]){yield*s.sync(()=>t.error(`Provider not found: ${r.provider}`));return}yield*s.sync(()=>l(e,r.verbose));return}let h=Object.keys(n).sort((e,o)=>{let i=e.startsWith("opencode"),d=o.startsWith("opencode");if(i&&!d)return-1;if(!i&&d)return 1;return e.localeCompare(o)});yield*s.sync(()=>{for(let e of h)l(m.make(e),r.verbose)})}))}})}});export{M as ModelsCommand};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Ed as j}from"./chunk-
|
|
2
|
+
import{Ed as j}from"./chunk-07g7cybt.js";import{Rd as Q}from"./chunk-yajd975f.js";import{Vf as M}from"./chunk-7ppd2phw.js";import{og as N}from"./chunk-bpbptx89.js";import{hh as $}from"./chunk-ddnpx1yx.js";import"./chunk-wfs4pcwa.js";import"./chunk-p68rwmhc.js";import"./chunk-0a0vat1h.js";import"./chunk-z8v2tsz2.js";import"./chunk-j8efst22.js";import"./chunk-a1pw9r6f.js";import"./chunk-d5bxan80.js";import{Cl as X,kk as J}from"./chunk-pvpy9kq1.js";import"./chunk-wpajh5s5.js";import"./chunk-2ec6ps8r.js";import"./chunk-gj3hzx3d.js";import"./chunk-nj4d554m.js";import"./chunk-2gerf08b.js";import"./chunk-fqw4y7x0.js";import"./chunk-a1p2f16h.js";import"./chunk-nt4e3em9.js";import"./chunk-a0v55ywn.js";import"./chunk-v965rsr8.js";import"./chunk-1sgby720.js";import{bq as _}from"./chunk-dcvatax2.js";import"./chunk-4tbwha3m.js";import"./chunk-m612agnk.js";import"./chunk-yq3m8190.js";import"./chunk-btz9jvec.js";import"./chunk-cqtkxwd8.js";import"./chunk-fkgv2hqd.js";import"./chunk-zyhdxggp.js";import"./chunk-q6ztpfcs.js";import"./chunk-jm1ptn8n.js";import"./chunk-c5e6sk9c.js";import"./chunk-m02zt1a3.js";import"./chunk-vg2fmyje.js";import"./chunk-sn4nez18.js";import"./chunk-42f7p0hq.js";import"./chunk-4qqkqrn9.js";import"./chunk-j6emx6jn.js";import"./chunk-be216spx.js";import"./chunk-12bssxd4.js";import"./chunk-z8r65yw3.js";import{fu as Y,pu as Z}from"./chunk-3szwfy7w.js";import{Hu as E,Su as V}from"./chunk-whxjkz9a.js";import"./chunk-89v6dgpp.js";import"./chunk-k309zez0.js";import"./chunk-09kba1hg.js";import"./chunk-t12xrrfr.js";import"./chunk-phxrg7aw.js";import"./chunk-snm5q21k.js";import"./chunk-xpc2zgj7.js";import"./chunk-qjjch1zt.js";import"./chunk-aztre27e.js";import{EOL as L}from"os";import k from"path";function P(){let q=["-R","-S"];if(process.platform!=="win32")return["less",...q];let z=_("less");if(z){if(V.stat(z)?.size)return[z,...q]}if(Z.QITQODE_GIT_BASH_PATH){let G=k.join(Z.QITQODE_GIT_BASH_PATH,"..","..","usr","bin","less.exe");if(V.stat(G)?.size)return[G,...q]}let B=_("git");if(B){let G=k.join(B,"..","..","usr","bin","less.exe");if(V.stat(G)?.size)return[G,...q]}return["cmd","/c","more"]}var g=Q({command:"session",describe:"manage sessions",builder:(q)=>q.command(T).command(D).command(v).demandCommand(),async handler(){}}),v=Q({command:"import-claude",describe:"import Claude Code sessions (~/.claude/projects) into qitqode",builder:(q)=>q.option("force",{describe:"re-sync every session, ignoring the mtime cache",type:"boolean",default:!1}),handler:async(q)=>{let z=await N.run({force:q.force});M.println(`Claude import: scanned ${z.scanned}, imported ${z.imported}, resynced ${z.resynced}, skipped ${z.skipped}`+(z.errors.length?`, errors ${z.errors.length}`:""));for(let B of z.errors)M.error(B)}}),D=Q({command:"delete <sessionID>",describe:"delete a session",builder:(q)=>{return q.positional("sessionID",{describe:"session ID to delete",type:"string",demandOption:!0})},handler:async(q)=>{await j(process.cwd(),async()=>{let z=J.make(q.sessionID);try{await $.runPromise(X.Service.use((B)=>B.get(z)))}catch{M.error(`Session not found: ${q.sessionID}`),process.exit(1)}await $.runPromise(X.Service.use((B)=>B.remove(z))),M.println(M.Style.TEXT_SUCCESS_BOLD+`Session ${q.sessionID} deleted`+M.Style.TEXT_NORMAL)})}}),T=Q({command:"list",describe:"list sessions",builder:(q)=>{return q.option("max-count",{alias:"n",describe:"limit to N most recent sessions",type:"number"}).option("format",{describe:"output format",type:"string",choices:["table","json"],default:"table"})},handler:async(q)=>{await j(process.cwd(),async()=>{let z=[...X.list({roots:!0,limit:q.maxCount})];if(z.length===0)return;let B;if(q.format==="json")B=f(z);else B=b(z);if(process.stdout.isTTY&&!q.maxCount&&q.format==="table"){let H=E.spawn(P(),{stdin:"pipe",stdout:"inherit",stderr:"inherit"});if(!H.stdin){console.log(B);return}H.stdin.write(B),H.stdin.end(),await H.exited}else console.log(B)})}});function b(q){let z=[],B=Math.max(20,...q.map((K)=>K.id.length)),G=Math.max(25,...q.map((K)=>K.title.length)),H=`Session ID${" ".repeat(B-10)} Title${" ".repeat(G-5)} Updated`;z.push(H),z.push("\u2500".repeat(H.length));for(let K of q){let A=Y.truncate(K.title,G),R=Y.todayTimeOrDateTime(K.time.updated),w=`${K.id.padEnd(B)} ${A.padEnd(G)} ${R}`;z.push(w)}return z.join(L)}function f(q){let z=q.map((B)=>({id:B.id,title:B.title,updated:B.time.updated,created:B.time.created,projectId:B.projectID,directory:B.directory}));return JSON.stringify(z,null,2)}export{T as SessionListCommand,v as SessionImportClaudeCommand,D as SessionDeleteCommand,g as SessionCommand};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{h as S}from"./chunk-
|
|
2
|
+
import{h as S}from"./chunk-vcmrrt8b.js";import"./chunk-s6bar2f9.js";import{Rd as $}from"./chunk-yajd975f.js";import{Vf as v}from"./chunk-7ppd2phw.js";import"./chunk-yzjc15vp.js";import{hh as L}from"./chunk-ddnpx1yx.js";import"./chunk-wfs4pcwa.js";import"./chunk-p68rwmhc.js";import"./chunk-0a0vat1h.js";import"./chunk-z8v2tsz2.js";import"./chunk-j8efst22.js";import"./chunk-a1pw9r6f.js";import"./chunk-d5bxan80.js";import"./chunk-pvpy9kq1.js";import"./chunk-wpajh5s5.js";import"./chunk-2ec6ps8r.js";import"./chunk-gj3hzx3d.js";import"./chunk-nj4d554m.js";import"./chunk-2gerf08b.js";import"./chunk-fqw4y7x0.js";import"./chunk-a1p2f16h.js";import"./chunk-nt4e3em9.js";import{Qp as g,Rp as y,Sp as B,Yp as N}from"./chunk-a0v55ywn.js";import"./chunk-v965rsr8.js";import"./chunk-1sgby720.js";import"./chunk-dcvatax2.js";import"./chunk-4tbwha3m.js";import"./chunk-m612agnk.js";import"./chunk-yq3m8190.js";import"./chunk-btz9jvec.js";import"./chunk-cqtkxwd8.js";import"./chunk-fkgv2hqd.js";import"./chunk-zyhdxggp.js";import"./chunk-q6ztpfcs.js";import"./chunk-jm1ptn8n.js";import"./chunk-c5e6sk9c.js";import"./chunk-m02zt1a3.js";import"./chunk-vg2fmyje.js";import"./chunk-sn4nez18.js";import"./chunk-42f7p0hq.js";import"./chunk-4qqkqrn9.js";import"./chunk-j6emx6jn.js";import"./chunk-be216spx.js";import"./chunk-12bssxd4.js";import{st as q}from"./chunk-z8r65yw3.js";import"./chunk-3szwfy7w.js";import"./chunk-whxjkz9a.js";import"./chunk-89v6dgpp.js";import"./chunk-k309zez0.js";import"./chunk-09kba1hg.js";import"./chunk-t12xrrfr.js";import"./chunk-phxrg7aw.js";import{PI as z}from"./chunk-snm5q21k.js";import"./chunk-xpc2zgj7.js";import"./chunk-qjjch1zt.js";import"./chunk-aztre27e.js";import j from"fs/promises";import P from"path";function F(x){return z.promise(async()=>{try{return{ok:!0,value:await x()}}catch(D){return{ok:!1,err:D}}})}function A(x){if(x instanceof g)return"Not signed in. Run `qitqode auth login` first.";if(x instanceof y)return x.message+q.copy().insufficientBalanceCliSuffix;if(x instanceof B)return x.message;return"Request failed: "+(x instanceof Error?x.message:String(x))}var w=(x)=>z.gen(function*(){if((yield*S())==="revoked")return;let D=yield*z.promise(async()=>{try{return{ok:!0,content:await j.readFile(P.resolve(x),"utf8")}}catch(V){let K=V;return{ok:!1,message:`Cannot read '${x}': ${K.message??String(K)}`}}});if(!D.ok){yield*z.sync(()=>v.println(v.Style.TEXT_DANGER+D.message+v.Style.TEXT_NORMAL));return}let O=[],T=D.content.split(`
|
|
3
3
|
`);for(let V=0;V<T.length;V++){let K=T[V];if(!K||!K.trim())continue;let G=V+1,H;try{H=JSON.parse(K)}catch{yield*z.sync(()=>v.println(v.Style.TEXT_DANGER+`Error: line ${G} is not valid JSON.`+v.Style.TEXT_NORMAL));return}if(typeof H!=="object"||H===null||Array.isArray(H)){yield*z.sync(()=>v.println(v.Style.TEXT_DANGER+`Error: line ${G} must be a JSON object (got ${H===null?"null":Array.isArray(H)?"array":typeof H}).`+v.Style.TEXT_NORMAL));return}let J=H;if(typeof J.prompt!=="string"||!J.prompt.trim()){yield*z.sync(()=>v.println(v.Style.TEXT_DANGER+`Error: line ${G} must have a non-empty string 'prompt' field.`+v.Style.TEXT_NORMAL));return}let W={prompt:J.prompt};if(typeof J.options==="object"&&J.options!==null&&!Array.isArray(J.options))W.options=J.options;O.push(W)}if(O.length===0){yield*z.sync(()=>v.println(v.Style.TEXT_WARNING+"No prompts found in the file."+v.Style.TEXT_NORMAL));return}yield*z.sync(()=>v.println(v.Style.TEXT_DIM+`Submitting ${O.length} request${O.length===1?"":"s"}\u2026`+v.Style.TEXT_NORMAL));let Q=yield*F(()=>N.resolveSubmitBatch({requests:O}));if(!Q.ok){yield*z.sync(()=>v.println(v.Style.TEXT_DANGER+A(Q.err)+v.Style.TEXT_NORMAL));return}let{batchId:X,status:Y,createdAt:Z,totalCount:_}=Q.value;process.stdout.write(X+`
|
|
4
4
|
`),yield*z.sync(()=>{if(v.println(v.Style.TEXT_SUCCESS+"Batch submitted."+v.Style.TEXT_NORMAL),v.println(" ID: "+v.Style.TEXT_HIGHLIGHT_BOLD+X+v.Style.TEXT_NORMAL),Y)v.println(" Status: "+Y);if(_!==void 0)v.println(" Requests: "+_);if(Z)v.println(" Created: "+v.Style.TEXT_DIM+new Date(Z).toLocaleString()+v.Style.TEXT_NORMAL);v.println(`
|
|
5
5
|
`+v.Style.TEXT_DIM+`Run \`qitqode batch status ${X}\` to check progress.`+v.Style.TEXT_NORMAL)})}).pipe(z.withSpan("batch.submit")),k=(x,D)=>z.gen(function*(){if((yield*S())==="revoked")return;let O=yield*F(()=>N.resolveRetrieveBatch({batchId:x}));if(!O.ok){yield*z.sync(()=>v.println(v.Style.TEXT_DANGER+A(O.err)+v.Style.TEXT_NORMAL));return}let{status:T,results:Q,completedCount:X,totalCount:Y,createdAt:Z,completedAt:_}=O.value,V=T==="completed"?v.Style.TEXT_SUCCESS:T==="failed"?v.Style.TEXT_DANGER:v.Style.TEXT_WARNING;if(yield*z.sync(()=>{v.println(" ID: "+v.Style.TEXT_HIGHLIGHT_BOLD+x+v.Style.TEXT_NORMAL),v.println(" Status: "+V+T+v.Style.TEXT_NORMAL);let K=X??Q?.length;if(Y!==void 0)v.println(" Progress: "+(K??"?")+" / "+Y);if(Z)v.println(" Created: "+v.Style.TEXT_DIM+new Date(Z).toLocaleString()+v.Style.TEXT_NORMAL);if(_)v.println(" Finished: "+v.Style.TEXT_DIM+new Date(_).toLocaleString()+v.Style.TEXT_NORMAL);if(Q&&Q.length>0){v.println(""),v.println(v.Style.TEXT_DIM+" \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"+v.Style.TEXT_NORMAL);for(let G of Q){let H=` [${G.index+1}] `;if(G.error)v.println(H+v.Style.TEXT_DANGER+G.error+v.Style.TEXT_NORMAL);else{let J=G.content??"",W=J.length>500?J.slice(0,500)+"\u2026":J;v.println(H+W)}}}else if(T!=="completed"&&T!=="failed")v.println(`
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Id as q,Jd as K,Kd as D,Nd as L,Od as N}from"./chunk-jje0srjq.js";import"./chunk-27yxgy03.js";import{Vf as B}from"./chunk-7ppd2phw.js";import{hh as G}from"./chunk-
|
|
2
|
+
import{Id as q,Jd as K,Kd as D,Nd as L,Od as N}from"./chunk-jje0srjq.js";import"./chunk-27yxgy03.js";import{Vf as B}from"./chunk-7ppd2phw.js";import{hh as G}from"./chunk-ddnpx1yx.js";import"./chunk-wfs4pcwa.js";import"./chunk-p68rwmhc.js";import"./chunk-0a0vat1h.js";import"./chunk-z8v2tsz2.js";import"./chunk-j8efst22.js";import"./chunk-a1pw9r6f.js";import"./chunk-d5bxan80.js";import"./chunk-pvpy9kq1.js";import{Fl as C}from"./chunk-wpajh5s5.js";import"./chunk-2ec6ps8r.js";import"./chunk-gj3hzx3d.js";import"./chunk-nj4d554m.js";import"./chunk-2gerf08b.js";import"./chunk-fqw4y7x0.js";import"./chunk-a1p2f16h.js";import"./chunk-nt4e3em9.js";import"./chunk-a0v55ywn.js";import"./chunk-v965rsr8.js";import"./chunk-1sgby720.js";import"./chunk-dcvatax2.js";import"./chunk-4tbwha3m.js";import"./chunk-m612agnk.js";import"./chunk-yq3m8190.js";import"./chunk-btz9jvec.js";import"./chunk-cqtkxwd8.js";import"./chunk-fkgv2hqd.js";import"./chunk-zyhdxggp.js";import"./chunk-q6ztpfcs.js";import"./chunk-jm1ptn8n.js";import"./chunk-c5e6sk9c.js";import"./chunk-m02zt1a3.js";import"./chunk-vg2fmyje.js";import"./chunk-sn4nez18.js";import"./chunk-42f7p0hq.js";import"./chunk-4qqkqrn9.js";import"./chunk-j6emx6jn.js";import"./chunk-be216spx.js";import"./chunk-12bssxd4.js";import"./chunk-z8r65yw3.js";import{tt as J}from"./chunk-3szwfy7w.js";import"./chunk-whxjkz9a.js";import"./chunk-89v6dgpp.js";import"./chunk-k309zez0.js";import"./chunk-09kba1hg.js";import"./chunk-t12xrrfr.js";import"./chunk-phxrg7aw.js";import"./chunk-snm5q21k.js";import"./chunk-xpc2zgj7.js";import"./chunk-qjjch1zt.js";import"./chunk-aztre27e.js";var X={command:"upgrade [target]",describe:"upgrade qitqode to the latest or a specific version",builder:(z)=>{return z.positional("target",{describe:"version to upgrade to, for ex '0.1.48' or 'v0.1.48'",type:"string"}).option("method",{alias:"m",describe:"installation method to use",type:"string",choices:["curl","npm","pnpm","bun","brew","choco","scoop"]})},handler:async(z)=>{B.empty(),B.println(B.logo(" ")),B.empty(),K("Upgrade");let O=await G.runPromise(C.Service.use((j)=>j.method())),E=z.method??O;if(E==="unknown"){if(q.error(`qitqode is installed to ${process.execPath} and may be managed by a package manager`),!await N({message:"Install anyways?",options:[{label:"Yes",value:!0},{label:"No",value:!1}],initialValue:!1})){D("Done");return}}q.info("Using method: "+E);let F=z.target?z.target.replace(/^v/,""):await G.runPromise(C.Service.use((j)=>j.latest()));if(J===F){q.warn(`qitqode upgrade skipped: ${F} is already installed`),D("Done");return}q.info(`From ${J} \u2192 ${F}`);let H=L();H.start("Upgrading...");let x=await G.runPromise(C.Service.use((j)=>j.upgrade(E,F))).catch((j)=>j);if(x){if(H.stop("Upgrade failed",1),x instanceof C.UpgradeFailedError)if(E==="choco"&&x.stderr.includes("not running from an elevated command shell"))q.error("Please run the terminal as Administrator and try again");else q.error(x.stderr);else if(x instanceof Error)q.error(x.message);D("Done");return}H.stop("Upgrade complete"),D("Done")}};export{X as UpgradeCommand};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{tt as X}from"./chunk-
|
|
2
|
+
import{tt as X}from"./chunk-3szwfy7w.js";function D(j){return j.parserConfiguration({"populate--":!0}).scriptName("qitqode").wrap(100).help("help","show help").alias("help","h").version("version","show version number",X).alias("version","v").option("print-logs",{describe:"print logs to stderr",type:"boolean"}).option("log-level",{describe:"log level",type:"string",choices:["DEBUG","INFO","WARN","ERROR"]}).option("pure",{describe:"run without external plugins",type:"boolean"})}var H={port:{type:"number",describe:"port to listen on",default:0},hostname:{type:"string",describe:"hostname to listen on",default:"127.0.0.1"},mdns:{type:"boolean",describe:"enable mDNS service discovery (defaults hostname to 0.0.0.0)",default:!1},"mdns-domain":{type:"string",describe:"custom domain name for mDNS service (default: qitqode.local)",default:"qitqode.local"},cors:{type:"string",array:!0,describe:"additional domains to allow for CORS",default:[]},"no-auth":{type:"boolean",describe:"allow starting without authentication on non-loopback addresses (DANGEROUS)",default:!1}};function u(j){return j.options(H)}function F(j,z=process.argv){return z.some((B)=>B===j||B.startsWith(`${j}=`))}function P(j,z=process.argv){return F("--port",z)||F("--hostname",z)||F("--mdns",z)||!!j.mdns||j.port!==0||j.hostname!=="127.0.0.1"}function _(j,z,B=process.argv){let J=F("--port",B),Z=F("--hostname",B),$=F("--mdns",B),q=F("--mdns-domain",B),K=$?j.mdns:z?.server?.mdns??j.mdns,M=q?j["mdns-domain"]:z?.server?.mdnsDomain??j["mdns-domain"],N=J?j.port:z?.server?.port??j.port,U=Z?j.hostname:K&&!z?.server?.hostname?"0.0.0.0":z?.server?.hostname??j.hostname,V=z?.server?.cors??[],Y=Array.isArray(j.cors)?j.cors:j.cors?[j.cors]:[],b=[...V,...Y],A=j["no-auth"];return{hostname:U,port:N,mdns:K,mdnsDomain:M,cors:b,noAuth:A}}var k={model:{type:"string",alias:["m"],describe:"model to use in the format of provider/model"},continue:{alias:["c"],describe:"continue the last session",type:"boolean"},session:{alias:["s"],type:"string",describe:"session id to continue"},fork:{type:"boolean",describe:"fork the session when continuing (use with --continue or --session)"},prompt:{type:"string",describe:"prompt to use"},agent:{type:"string",describe:"agent to use"},dark:{type:"boolean",describe:"start in dark theme (overrides saved theme preference for this launch)"},light:{type:"boolean",describe:"start in light theme (overrides saved theme preference for this launch)"},monochrome:{type:"boolean",describe:"start in monochrome accessible rendering \u2014 no color, plain terminal, screen-reader friendly"},headless:{type:"boolean",describe:"headless permissionless mode for AI subagent use \u2014 auto-approves all tool permissions, implies --never-ask"},fullauto:{type:"boolean",describe:"full-auto mode for the interactive TUI \u2014 never asks: starts in build mode, auto-decides questions and auto-approves every tool permission that is not explicitly denied by your config (dangerous!)"},"api-key":{type:"string",describe:"Qortex API key for non-interactive authentication in headless mode (can also be set via $QLEX_API_KEY)"},sso:{type:"boolean",describe:"sign in via SSO device-code flow before starting a headless session \u2014 prints a URL and code, waits for browser approval (requires --headless)"},free:{type:"boolean",describe:"start in Free tier (no cost) \u2014 shorthand for the Free model tier"},default:{type:"boolean",describe:"start in Default tier \u2014 shorthand for the Default model tier"},fast:{type:"boolean",describe:"start in Fast tier \u2014 shorthand for the Fast model tier"},economy:{type:"boolean",describe:"start in Economy tier \u2014 shorthand for the Economy model tier"},power:{type:"boolean",describe:"start in Power tier \u2014 shorthand for the Power model tier"},orchestrated:{type:"boolean",describe:"start in Orchestrated tier \u2014 shorthand for the Orchestrated model tier"}},L=36,W="\x1B[38;5;214m",I="\x1B[0;2m",Q="\x1B[0m";function G(j,z){let B=Math.round(j/100*L),J=`${"\u25A0".repeat(B)}${"\uFF65".repeat(L-B)}`;return`\r${W}${J} ${j.toString().padStart(3)}%${Q} ${I}${z}${Q}`}
|
|
3
3
|
export{D as Mf,H as Nf,u as Of,P as Pf,_ as Qf,k as Rf,G as Sf};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{a,b,c,d,e,f,g}from"./chunk-
|
|
2
|
+
import{a,b,c,d,e,f,g}from"./chunk-jvqbvgjy.js";import"./chunk-vcmrrt8b.js";import"./chunk-c01z3cvg.js";import"./chunk-3g1yz39h.js";import"./chunk-s6bar2f9.js";import"./chunk-jje0srjq.js";import"./chunk-27yxgy03.js";import"./chunk-yajd975f.js";import"./chunk-7ppd2phw.js";import"./chunk-yzjc15vp.js";import"./chunk-ddnpx1yx.js";import"./chunk-wfs4pcwa.js";import"./chunk-p68rwmhc.js";import"./chunk-0a0vat1h.js";import"./chunk-z8v2tsz2.js";import"./chunk-j8efst22.js";import"./chunk-a1pw9r6f.js";import"./chunk-d5bxan80.js";import"./chunk-pvpy9kq1.js";import"./chunk-wpajh5s5.js";import"./chunk-2ec6ps8r.js";import"./chunk-gj3hzx3d.js";import"./chunk-nj4d554m.js";import"./chunk-2gerf08b.js";import"./chunk-fqw4y7x0.js";import"./chunk-a1p2f16h.js";import"./chunk-nt4e3em9.js";import"./chunk-a0v55ywn.js";import"./chunk-v965rsr8.js";import"./chunk-1sgby720.js";import"./chunk-dcvatax2.js";import"./chunk-4tbwha3m.js";import"./chunk-m612agnk.js";import"./chunk-yq3m8190.js";import"./chunk-btz9jvec.js";import"./chunk-cqtkxwd8.js";import"./chunk-fkgv2hqd.js";import"./chunk-zyhdxggp.js";import"./chunk-q6ztpfcs.js";import"./chunk-jm1ptn8n.js";import"./chunk-c5e6sk9c.js";import"./chunk-m02zt1a3.js";import"./chunk-vg2fmyje.js";import"./chunk-sn4nez18.js";import"./chunk-42f7p0hq.js";import"./chunk-4qqkqrn9.js";import"./chunk-j6emx6jn.js";import"./chunk-be216spx.js";import"./chunk-12bssxd4.js";import"./chunk-z8r65yw3.js";import"./chunk-3szwfy7w.js";import"./chunk-whxjkz9a.js";import"./chunk-89v6dgpp.js";import"./chunk-k309zez0.js";import"./chunk-09kba1hg.js";import"./chunk-t12xrrfr.js";import"./chunk-phxrg7aw.js";import"./chunk-snm5q21k.js";import"./chunk-xpc2zgj7.js";import"./chunk-qjjch1zt.js";import"./chunk-aztre27e.js";export{f as statusEffect,a as resolveApiKeyFlag,e as logoutEffect,d as loginEffect,c as interactiveLogin,b as apiKeyLoginEffect,g as AuthCommand};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{aq as J}from"./chunk-1sgby720.js";import{Eu as H,Fu as I,Gu as N,Qu as Q}from"./chunk-whxjkz9a.js";import{dQ as L}from"./chunk-aztre27e.js";import{platform as R,release as U}from"os";import{tmpdir as V}from"os";import X from"path";import Y from"fs/promises";var Z=J(async()=>{let{which:D}=await import("./chunk-
|
|
2
|
+
import{aq as J}from"./chunk-1sgby720.js";import{Eu as H,Fu as I,Gu as N,Qu as Q}from"./chunk-whxjkz9a.js";import{dQ as L}from"./chunk-aztre27e.js";import{platform as R,release as U}from"os";import{tmpdir as V}from"os";import X from"path";import Y from"fs/promises";var Z=J(async()=>{let{which:D}=await import("./chunk-3f4zht9e.js");return D}),T=J(async()=>{let{default:D}=await import("./chunk-h0rpmne5.js");return D});function _(D){if(!process.stdout.isTTY)return;let A=`\x1B]52;c;${Buffer.from(D).toString("base64")}\x07`,E=process.env.TMUX||process.env.STY?`\x1BPtmux;\x1B${A}\x1B\\`:A;process.stdout.write(E)}async function $(){let D=R();if(D==="darwin"){let k=X.join(V(),"qitqode-clipboard.png");try{return await I(["osascript","-e",'set imageData to the clipboard as "PNGf"',"-e",`set fileRef to open for access POSIX file "${k}" with write permission`,"-e","set eof fileRef to 0","-e","write imageData to fileRef","-e","close access fileRef"],{nothrow:!0}),{data:(await Q(k)).toString("base64"),mime:"image/png"}}catch{}finally{await Y.rm(k,{force:!0}).catch(()=>{})}}if(D==="win32"||U().includes("WSL")){let E=await N(["powershell.exe","-NonInteractive","-NoProfile","-command","Add-Type -AssemblyName System.Windows.Forms; $img = [System.Windows.Forms.Clipboard]::GetImage(); if ($img) { $ms = New-Object System.IO.MemoryStream; $img.Save($ms, [System.Drawing.Imaging.ImageFormat]::Png); [System.Convert]::ToBase64String($ms.ToArray()) }"],{nothrow:!0});if(E.text){let K=Buffer.from(E.text.trim(),"base64");if(K.length>0)return{data:K.toString("base64"),mime:"image/png"}}}if(D==="linux"){let k=await I(["wl-paste","-t","image/png"],{nothrow:!0});if(k.stdout.byteLength>0)return{data:Buffer.from(k.stdout).toString("base64"),mime:"image/png"};let E=await I(["xclip","-selection","clipboard","-t","image/png","-o"],{nothrow:!0});if(E.stdout.byteLength>0)return{data:Buffer.from(E.stdout).toString("base64"),mime:"image/png"}}let A=await(await T()).read().catch(()=>{});if(A)return{data:A,mime:"text/plain"}}var j=J(async()=>{let D=R(),G=await Z();if(D==="darwin"&&G("osascript"))return console.log("clipboard: using osascript"),async(A)=>{let k=A.replace(/\\/g,"\\\\").replace(/"/g,"\\\"");await I(["osascript","-e",`set the clipboard to "${k}"`],{nothrow:!0})};if(D==="linux"){if(process.env.WAYLAND_DISPLAY&&G("wl-copy"))return console.log("clipboard: using wl-copy"),async(A)=>{let k=H(["wl-copy"],{stdin:"pipe",stdout:"ignore",stderr:"ignore"});if(!k.stdin)return;k.stdin.write(A),k.stdin.end(),await k.exited.catch(()=>{})};if(G("xclip"))return console.log("clipboard: using xclip"),async(A)=>{let k=H(["xclip","-selection","clipboard"],{stdin:"pipe",stdout:"ignore",stderr:"ignore"});if(!k.stdin)return;k.stdin.write(A),k.stdin.end(),await k.exited.catch(()=>{})};if(G("xsel"))return console.log("clipboard: using xsel"),async(A)=>{let k=H(["xsel","--clipboard","--input"],{stdin:"pipe",stdout:"ignore",stderr:"ignore"});if(!k.stdin)return;k.stdin.write(A),k.stdin.end(),await k.exited.catch(()=>{})}}if(D==="win32")return console.log("clipboard: using powershell"),async(A)=>{let k=H(["powershell.exe","-NonInteractive","-NoProfile","-Command","[Console]::InputEncoding = [System.Text.Encoding]::UTF8; Set-Clipboard -Value ([Console]::In.ReadToEnd())"],{stdin:"pipe",stdout:"ignore",stderr:"ignore"});if(!k.stdin)return;k.stdin.write(A),k.stdin.end(),await k.exited.catch(()=>{})};return console.log("clipboard: no native support"),async(A)=>{await(await T()).write(A).catch(()=>{})}});async function v(D){_(D),await(await j())(D)}
|
|
3
3
|
export{$ as ud,v as vd};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{$f as d,Yf as a,Zf as b,_f as c,ag as e}from"./chunk-yn6sbycg.js";import"./chunk-bpbptx89.js";import"./chunk-2y90ad1v.js";import"./chunk-yzjc15vp.js";import"./chunk-4amgp4yd.js";import"./chunk-nfg7nt13.js";import"./chunk-scnz207s.js";import"./chunk-b8bytvka.js";import"./chunk-ddnpx1yx.js";import"./chunk-wfs4pcwa.js";import"./chunk-p68rwmhc.js";import"./chunk-0a0vat1h.js";import"./chunk-z8v2tsz2.js";import"./chunk-j8efst22.js";import"./chunk-a1pw9r6f.js";import"./chunk-d5bxan80.js";import"./chunk-pvpy9kq1.js";import"./chunk-wpajh5s5.js";import"./chunk-2ec6ps8r.js";import"./chunk-gj3hzx3d.js";import"./chunk-nj4d554m.js";import"./chunk-2gerf08b.js";import"./chunk-fqw4y7x0.js";import"./chunk-a1p2f16h.js";import"./chunk-nt4e3em9.js";import"./chunk-a0v55ywn.js";import"./chunk-v965rsr8.js";import"./chunk-1sgby720.js";import"./chunk-dcvatax2.js";import"./chunk-4tbwha3m.js";import"./chunk-m612agnk.js";import"./chunk-yq3m8190.js";import"./chunk-btz9jvec.js";import"./chunk-cqtkxwd8.js";import"./chunk-fkgv2hqd.js";import"./chunk-zyhdxggp.js";import"./chunk-q6ztpfcs.js";import"./chunk-jm1ptn8n.js";import"./chunk-c5e6sk9c.js";import"./chunk-m02zt1a3.js";import"./chunk-vg2fmyje.js";import"./chunk-sn4nez18.js";import"./chunk-42f7p0hq.js";import"./chunk-4qqkqrn9.js";import"./chunk-j6emx6jn.js";import"./chunk-be216spx.js";import"./chunk-12bssxd4.js";import"./chunk-z8r65yw3.js";import"./chunk-3szwfy7w.js";import"./chunk-whxjkz9a.js";import"./chunk-89v6dgpp.js";import"./chunk-k309zez0.js";import"./chunk-09kba1hg.js";import"./chunk-t12xrrfr.js";import"./chunk-phxrg7aw.js";import"./chunk-snm5q21k.js";import"./chunk-xpc2zgj7.js";import"./chunk-qjjch1zt.js";import"./chunk-aztre27e.js";export{c as url,b as openapi,d as listen,e as Server,a as Default};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Fp as a0}from"./chunk-a1p2f16h.js";import{ns as f0,ps as l0}from"./chunk-x1rx6fm7.js";import{nt as o0}from"./chunk-j6emx6jn.js";import{qt as T0}from"./chunk-12bssxd4.js";import{ku as C0,mu as s,ou as H0,pu as r,yt as P0}from"./chunk-ebrt1me3.js";import{Iu as n0,Ou as f,Su as S,zu as a}from"./chunk-whxjkz9a.js";import{Uu as p}from"./chunk-k309zez0.js";import{wA as u0}from"./chunk-phxrg7aw.js";import{CI as N0,HG as C,PI as J,UC as L,ZD as R0,mG as g,pO as w,wP as s0,xB as p0}from"./chunk-snm5q21k.js";import{$P as X0,bQ as i0,dQ as _2}from"./chunk-aztre27e.js";function h0(Z,Q){let z,$=()=>z??=u0.make(g.provideMerge(Q,f0.layer),{memoMap:l0});return{runSync:(X)=>$().runSync(Z.use(X)),runPromiseExit:(X,Y)=>$().runPromiseExit(Z.use(X),Y),runPromise:(X,Y)=>$().runPromise(Z.use(X),Y),runFork:(X)=>$().runFork(Z.use(X)),runCallback:(X)=>$().runCallback(Z.use(X))}}var Y0={};i0(Y0,{which:()=>w2,sanitize:()=>t0,outdated:()=>K2,layer:()=>e0,install:()=>N2,defaultLayer:()=>Z2,add:()=>F2,Service:()=>z0,Npm:()=>Y0,InstallFailedError:()=>V0});var r0=X0(o0(),1),b0=X0(a0(),1);import k from"path";import I0 from"path";import A2 from"os";import{randomUUID as D2}from"crypto";var B0;((Q0)=>{class Z extends w.TaggedErrorClass()("LockTimeoutError",{key:w.String}){}Q0.LockTimeoutError=Z;class Q extends w.TaggedErrorClass()("LockCompromisedError",{detail:w.String}){}Q0.LockCompromisedError=Q;class z extends w.TaggedErrorClass()("ReleaseError",{detail:w.String,cause:w.optional(w.Defect)}){get message(){return this.detail}}class $ extends w.TaggedErrorClass()("NotAcquired",{}){}let X=60000,Y=300000,U=100,G=2000,W=Math.max(100,Math.floor(X/3)),I=C.exponential(U,1.7).pipe(C.either(C.spaced(G)),C.jittered,C.while((j)=>j.elapsed<Y)),H=w.fromJsonString(w.Struct({token:w.String,pid:w.Number,hostname:w.String,createdAt:w.String})),q=w.decodeUnknownSync(H),R=w.encodeSync(H);class N extends R0.Service()("EffectFlock"){}Q0.Service=N;function A(){return performance.timeOrigin+performance.now()}let O=(j)=>L.getOrElse(j.mtime,()=>new Date(0)).getTime(),K=(j)=>j.reason._tag==="NotFound"||j.reason._tag==="Unknown";Q0.layer=g.effect(N,J.gen(function*(){let j=yield*s.Service,_=yield*f.Service,V=I0.join(j.state,"locks"),B=A2.hostname(),M=new Set,m=(D)=>_.stat(D).pipe(J.catchIf(K,()=>J.void),J.orDie),l=(D)=>_.remove(D,{recursive:!0}).pipe(J.ignore),d=(D)=>_.makeDirectory(D,{mode:448}).pipe(J.as(!0),J.catchIf((T)=>T.reason._tag==="AlreadyExists",()=>J.succeed(!1)),J.orDie),M0=(D,T,E,P)=>_.writeFileString(D,T,{flag:"wx"}).pipe(J.catch(()=>J.gen(function*(){return yield*l(E),yield*new Q({detail:P})}))),w0=J.fnUntraced(function*(D){let T=yield*m(D);if(T&&A()-O(T)>X)yield*l(D);return!1}),Z0=J.fnUntraced(function*(D){if(M.has(D))return;yield*_.makeDirectory(D,{recursive:!0}).pipe(J.orDie),M.add(D)}),F=J.fnUntraced(function*(D,T,E){let P=A(),h=yield*m(T);if(h)return P-O(h)>X;let $0=yield*m(E);if($0)return P-O($0)>X;let q0=yield*m(D);if(!q0)return!1;return P-O(q0)>X}),b=(D,T)=>J.gen(function*(){let E=D2(),P=I0.join(D,"meta.json"),h=I0.join(D,"heartbeat");if(!(yield*d(D))){if(!(yield*F(D,h,P)))return yield*new $;let O0=D+".breaker";if(!(yield*_.makeDirectory(O0,{mode:448}).pipe(J.as(!0),J.catchIf((V2)=>V2.reason._tag==="AlreadyExists",()=>w0(O0)),J.catchIf(K,()=>J.succeed(!1)),J.orDie)))return yield*new $;if(!(yield*J.gen(function*(){if(!(yield*F(D,h,P)))return!1;return yield*l(D),yield*d(D)}).pipe(J.ensuring(l(O0)))))return yield*new $}yield*M0(h,"",D,"heartbeat already existed");let q0=R({token:E,pid:process.pid,hostname:B,createdAt:new Date().toISOString()});return yield*M0(P,q0,D,"meta.json already existed"),{token:E,metaPath:P,heartbeatPath:h,lockDir:D}}).pipe(J.withSpan("EffectFlock.tryAcquire",{attributes:{key:T}})),U0=(D,T)=>b(D,T).pipe(J.retry({while:(E)=>E._tag==="NotAcquired",schedule:I}),J.catchTag("NotAcquired",()=>J.fail(new Z({key:T})))),i=(D)=>J.gen(function*(){let T=yield*_.readFileString(D.metaPath).pipe(J.catch((P)=>{if(K(P))return J.die(new z({detail:"metadata missing"}));return J.die(P)}));if((yield*J.try({try:()=>q(T),catch:(P)=>new z({detail:"metadata invalid",cause:P})}).pipe(J.orDie)).token!==D.token)return yield*J.die(new z({detail:"token mismatch"}));yield*l(D.lockDir)}),k0=J.fn("EffectFlock.acquire")(function*(D,T){let E=T??V;yield*Z0(E);let P=I0.join(E,C0.fast(D)+".lock"),h=yield*J.acquireRelease(U0(P,D),($0)=>i($0));yield*_.utimes(h.heartbeatPath,new Date,new Date).pipe(J.ignore,J.repeat(C.spaced(W)),J.forkScoped)}),B2=p0.dual((D)=>J.isEffect(D[0]),(D,T,E)=>J.scoped(J.gen(function*(){return yield*k0(T,E),yield*D})));return N.of({acquire:k0,withLock:B2})})),Q0.defaultLayer=Q0.layer.pipe(g.provide(f.defaultLayer),g.provide(s.layer))})(B0||={});class V0 extends w.TaggedErrorClass()("NpmInstallFailedError",{add:w.Array(w.String).pipe(w.optional),dir:w.String,cause:w.optional(w.Defect)}){}class z0 extends R0.Service()("@qitqode/Npm"){}var c0=process.platform==="win32"?new Set(["<",">",":",'"',"|","?","*"]):void 0;function t0(Z){if(!c0)return Z;return Array.from(Z,(Q)=>c0.has(Q)||Q.charCodeAt(0)<32?"_":Q).join("")}var d0=(Z,Q)=>{let z;try{let $=typeof Bun<"u"?import.meta.resolve(Z,Q):import.meta.resolve(Q);z=L.some($)}catch{z=L.none()}return{directory:Q,entrypoint:z}},e0=g.effect(z0,J.gen(function*(){let Z=yield*f.Service,Q=yield*s.Service,z=yield*s0.FileSystem,$=yield*B0.Service,X=(H)=>k.join(Q.cache,"packages",t0(H)),Y=(H)=>J.gen(function*(){yield*$.acquire(`npm-install:${H.dir}`);let{Arborist:q}=yield*J.promise(()=>import("./chunk-yp0a8q29.js").then((m)=>X0(m.default,1))),R=new q({path:H.dir,binLinks:!0,progress:!1,savePrefix:"",ignoreScripts:!0});return yield*J.tryPromise({try:()=>R.reify({add:H?.add||[],save:!0,saveType:"prod"}),catch:(N)=>new V0({cause:N,add:H?.add,dir:H.dir})})}).pipe(J.withSpan("Npm.reify",{attributes:H})),U=J.fn("Npm.outdated")(function*(H,q){let R=yield*J.tryPromise({try:()=>fetch(`https://registry.npmjs.org/${H}`),catch:()=>{return}}).pipe(J.orElseSucceed(()=>{return}));if(!R||!R.ok)return!1;let A=(yield*J.tryPromise({try:()=>R.json(),catch:()=>{return}}).pipe(J.orElseSucceed(()=>{return})))?.["dist-tags"]?.latest;if(!A)return!1;if(/[\s^~*xX<>|=]/.test(q))return!b0.default.satisfies(A,q);return b0.default.lt(q,A)}),G=J.fn("Npm.add")(function*(H){let q=X(H),R=(()=>{try{return r0.default(H).name??H}catch{return H}})();if(yield*Z.existsSafe(q))return d0(R,k.join(q,"node_modules",R));let A=(yield*Y({dir:q,add:[H]})).edgesOut.values().next().value?.to;if(!A)return yield*new V0({add:[H],dir:q});return d0(A.name,A.path)},J.scoped),W=J.fn("Npm.install")(function*(H,q){if(!(yield*Z.access(H,{writable:!0}).pipe(J.as(!0),J.orElseSucceed(()=>!1))))return;let N=q?.add.map((A)=>[A.name,A.version].filter(Boolean).join("@"))??[];if(yield*J.gen(function*(){if(!(yield*Z.existsSafe(k.join(H,"node_modules"))))return yield*Y({add:N,dir:H}),!0;return!1}).pipe(J.withSpan("Npm.checkNodeModules")))return;yield*J.gen(function*(){let A=yield*Z.readJson(k.join(H,"package.json")).pipe(J.orElseSucceed(()=>({}))),O=yield*Z.readJson(k.join(H,"package-lock.json")).pipe(J.orElseSucceed(()=>({}))),K=A,y=O,v=new Set([...Object.keys(K?.dependencies||{}),...Object.keys(K?.devDependencies||{}),...Object.keys(K?.peerDependencies||{}),...Object.keys(K?.optionalDependencies||{}),...(q?.add||[]).map((V)=>V.name)]),j=y?.packages?.[""]||{},_=new Set([...Object.keys(j?.dependencies||{}),...Object.keys(j?.devDependencies||{}),...Object.keys(j?.peerDependencies||{}),...Object.keys(j?.optionalDependencies||{})]);for(let V of v)if(!_.has(V)){yield*Y({dir:H,add:N});return}}).pipe(J.withSpan("Npm.checkDirty"));return},J.scoped),I=J.fn("Npm.which")(function*(H){let q=X(H),R=k.join(q,"node_modules",".bin"),N=J.fnUntraced(function*(){let A=yield*z.readDirectory(R).pipe(J.catch(()=>J.succeed([])));if(A.length===0)return L.none();if(A.length===1)return L.some(A[0]);let O=yield*Z.readJson(k.join(q,"node_modules",H,"package.json")).pipe(J.option);if(L.isSome(O)){let K=O.value;if(K?.bin){let y=H.startsWith("@")?H.split("/")[1]:H,v=K.bin;if(typeof v==="string")return L.some(y);let j=Object.keys(v);if(j.length===1)return L.some(j[0]);return v[y]?L.some(y):L.some(j[0])}}return L.some(A[0])});return yield*J.gen(function*(){let A=yield*N();if(L.isSome(A))return L.some(k.join(R,A.value));yield*z.remove(k.join(q,"package-lock.json")).pipe(J.orElseSucceed(()=>{})),yield*G(H);let O=yield*N();if(L.isNone(O))return L.none();return L.some(k.join(R,O.value))}).pipe(J.scoped,J.orElseSucceed(()=>L.none()))});return z0.of({add:G,install:W,outdated:U,which:I})})),Z2=e0.pipe(g.provide(B0.layer),g.provide(f.layer),g.provide(s.layer),g.provide(n0.layer)),{runPromise:A0}=h0(z0,Z2);async function N2(...Z){return A0((Q)=>Q.install(...Z))}async function F2(...Z){let Q=await A0((z)=>z.add(...Z));return{directory:Q.directory,entrypoint:L.getOrUndefined(Q.entrypoint)}}async function K2(...Z){return A0((Q)=>Q.outdated(...Z))}async function w2(...Z){let Q=await A0((z)=>z.which(...Z));return L.getOrUndefined(Q)}var Q2=X0(o0(),1),D0=X0(a0(),1);import u from"path";import{fileURLToPath as _0,pathToFileURL as n}from"url";var O2=["opencode-openai-codex-auth","opencode-copilot-auth"];function _Z(Z){return O2.some((Q)=>Z.includes(Q))}function z2(Z){try{return Q2.default(Z)}catch{}}function NZ(Z){let Q=z2(Z);if(Q?.type==="alias"&&!Q.name){let z=Q.subSpec;if(z?.name){let $=!z.rawSpec||z.rawSpec==="*"?"latest":z.rawSpec;return{pkg:z.name,version:$}}}if(!Q?.name)return{pkg:Z,version:""};if(Q.raw===Q.name)return{pkg:Q.name,version:"latest"};return{pkg:Q.name,version:Q.rawSpec}}var b2=["index.ts","index.tsx","index.js","index.mjs","index.cjs"];function X2(Z){if(J2(Z))return"file";return"npm"}function L2(Z,Q){if(Z.startsWith("file://"))return _0(Z);if(u.isAbsolute(Z))return Z;return u.resolve(Q,Z)}function Y2(Z){return u.isAbsolute(Z)||/^[A-Za-z]:[\\/]/.test(Z)}function T2(Z){if(typeof Z==="string")return Z;if(!a(Z))return;for(let Q of["import","default"]){let z=Z[Q];if(typeof z==="string")return z}return}function y2(Z){let Q=Z.json.main;if(typeof Q!=="string")return;let z=Q.trim();if(!z)return;return z}function H2(Z,Q,z,$){let X=L2(Q,$.dir),Y=S.resolve($.dir),U=S.resolve(X);if(!S.contains(Y,U))throw Error(`Plugin ${Z} resolved ${z} entry outside plugin directory`);return U}function $2(Z,Q,z,$){return n(H2(Z,Q,z,$)).href}function P2(Z,Q,z){let $=z.json.exports;if(a($)){let Y=T2($[`./${Q}`]);if(Y)return $2(Z,Y,Q,z)}if(Q!=="server")return;let X=y2(z);if(!X)return;return $2(Z,X,Q,z)}function S2(Z){if(Z.startsWith("file://"))return _0(Z);if(u.isAbsolute(Z))return Z}async function L0(Z){for(let Q of b2){let z=u.join(Z,Q);if(await S.exists(z))return z}}async function m2(Z){let Q=S2(Z);if(!Q)return;if(!(await S.statAsync(Q))?.isDirectory())return;return Q}async function E2(Z,Q,z,$){let X=X2(Z),Y=$??(X==="npm"?await o(Q):await o(Q).catch(()=>{return}));if(!Y)return Q;let U=P2(Z,z,Y);if(U)return U;let G=await m2(Q);if(z==="tui"){if(X==="file"&&G){let W=await L0(G);if(W)return n(W).href}if(X==="npm")return;if(G)return;return Q}if(G&&a(Y.json.exports)){if(X==="file"){let W=await L0(G);if(W)return n(W).href}return}return Q}function J2(Z){return Z.startsWith("file://")||Z.startsWith(".")||Y2(Z)}async function v2(Z){let Q=Z.startsWith("file://")?_0(Z):Z,z=u.isAbsolute(Q)||/^[A-Za-z]:[\\/]/.test(Q)?Q:u.resolve(Q);if(!(await S.statAsync(z))?.isDirectory()){if(Z.startsWith("file://"))return Z;return n(z).href}if(await S.exists(u.join(z,"package.json")))return n(z).href;let X=await L0(z);if(X)return n(X).href;throw Error(`Plugin directory ${z} is missing package.json or index file`)}async function FZ(Z,Q,z){if(!D0.default.valid(Q)||D0.default.major(Q)===0)return;let $=z??await o(Z).catch(()=>{return});if(!$)return;let X=$.json.engines;if(!a(X))return;let Y=X.qitqode??X.opencode;if(typeof Y!=="string")return;if(!D0.default.satisfies(Q,Y))throw Error(`Plugin requires qitqode ${Y} but running ${Q}`)}async function KZ(Z){if(J2(Z))return v2(Z);let Q=z2(Z),z=Q?.name&&Q.raw===Q.name?`${Q.name}@latest`:Z;return(await Y0.add(z)).directory}async function o(Z){let Q=Z.startsWith("file://")?_0(Z):Z,$=(await S.statAsync(Q))?.isDirectory()?Q:u.dirname(Q),X=u.join($,"package.json"),Y=await S.readJson(X);return{dir:$,pkg:X,json:Y}}async function wZ(Z,Q,z){let $=X2(Z),X=$==="npm"?await o(Q):await o(Q).catch(()=>{return}),Y=await E2(Z,Q,z,X);return{spec:Z,source:$,target:Q,pkg:X,entry:Y}}function OZ(Z,Q){let z=Q.json["oc-themes"];if(z===void 0)return[];if(!Array.isArray(z))throw TypeError(`Plugin ${Z} has invalid oc-themes field`);let $=z.map((X)=>{if(typeof X!=="string")throw TypeError(`Plugin ${Z} has invalid oc-themes entry`);let Y=X.trim();if(!Y)throw TypeError(`Plugin ${Z} has empty oc-themes entry`);if(Y.startsWith("file://")||Y2(Y))throw TypeError(`Plugin ${Z} oc-themes entry must be relative: ${X}`);return H2(Z,Y,"oc-themes",Q)});return Array.from(new Set($))}function bZ(Z,Q){if(Z===void 0)return;if(typeof Z!=="string")throw TypeError(`Plugin ${Q} has invalid id type ${typeof Z}`);let z=Z.trim();if(!z)throw TypeError(`Plugin ${Q} has an empty id`);return z}function LZ(Z,Q,z,$="strict"){let X=Z.default;if(!a(X)){if($==="detect")return;throw TypeError(`Plugin ${Q} must default export an object with ${z}()`)}if($==="detect"&&!("id"in X)&&!("server"in X)&&!("tui"in X))return;let Y="server"in X?X.server:void 0,U="tui"in X?X.tui:void 0;if(Y!==void 0&&typeof Y!=="function")throw TypeError(`Plugin ${Q} has invalid server export`);if(U!==void 0&&typeof U!=="function")throw TypeError(`Plugin ${Q} has invalid tui export`);if(Y!==void 0&&U!==void 0)throw TypeError(`Plugin ${Q} must default export either server() or tui(), not both`);if(z==="server"&&Y===void 0)throw TypeError(`Plugin ${Q} must default export an object with server()`);if(z==="tui"&&U===void 0)throw TypeError(`Plugin ${Q} must default export an object with tui()`);return X}async function TZ(Z,Q,z,$,X){if(Z==="file"){if($)return $;throw TypeError(`Path plugin ${Q} must export id`)}if($)return $;let Y=X??await o(z);if(typeof Y.json.name!=="string"||!Y.json.name.trim())throw TypeError(`Plugin package ${Y.pkg} is missing name`);return Y.json.name.trim()}var S0={};i0(S0,{readFile:()=>l2,files:()=>g2,fileInDirectory:()=>f2,directories:()=>k2,claudeCommandDirectories:()=>u2,ConfigPaths:()=>S0});import y0 from"path";var W2=T0.create("ConfigJsonError",p.object({path:p.string(),message:p.string().optional()})),mZ=T0.create("ConfigInvalidError",p.object({path:p.string(),issues:p.custom().optional(),message:p.string().optional()}));var g2=N0("ConfigPaths.projectFiles")(function*(Z,Q,z){return(yield*(yield*f.Service).up({targets:[`${Z}.jsonc`,`${Z}.json`],start:Q,stop:z})).toReversed()}),k2=N0("ConfigPaths.directories")(function*(Z,Q){let z=yield*f.Service;return P0([H0.Path.config,...!r.QITQODE_DISABLE_PROJECT_CONFIG?yield*z.up({targets:[".qitqode"],start:Z,stop:Q}):[],...yield*z.up({targets:[".qitqode"],start:H0.Path.home,stop:H0.Path.home}),...r.QITQODE_CONFIG_DIR?[r.QITQODE_CONFIG_DIR]:[]])}),u2=N0("ConfigPaths.claudeCommandDirectories")(function*(Z,Q){if(r.QITQODE_DISABLE_CLAUDE_CODE_COMMANDS)return[];let z=yield*f.Service;return P0([y0.join(H0.Path.home,".claude"),...!r.QITQODE_DISABLE_PROJECT_CONFIG?yield*z.up({targets:[".claude"],start:Z,stop:Q}):[]])});function f2(Z,Q){return[y0.join(Z,`${Q}.json`),y0.join(Z,`${Q}.jsonc`)]}async function l2(Z){return S.readText(Z).catch((Q)=>{if(Q.code==="ENOENT")return;throw new W2({path:Z},{cause:Q})})}function W0(Z,Q=!1){let z=Z.length,$=0,X="",Y=0,U=16,G=0,W=0,I=0,H=0,q=0;function R(j,_){let V=0,B=0;while(V<j||!_){let M=Z.charCodeAt($);if(M>=48&&M<=57)B=B*16+M-48;else if(M>=65&&M<=70)B=B*16+M-65+10;else if(M>=97&&M<=102)B=B*16+M-97+10;else break;$++,V++}if(V<j)B=-1;return B}function N(j){$=j,X="",Y=0,U=16,q=0}function A(){let j=$;if(Z.charCodeAt($)===48)$++;else{$++;while($<Z.length&&t(Z.charCodeAt($)))$++}if($<Z.length&&Z.charCodeAt($)===46)if($++,$<Z.length&&t(Z.charCodeAt($))){$++;while($<Z.length&&t(Z.charCodeAt($)))$++}else return q=3,Z.substring(j,$);let _=$;if($<Z.length&&(Z.charCodeAt($)===69||Z.charCodeAt($)===101)){if($++,$<Z.length&&Z.charCodeAt($)===43||Z.charCodeAt($)===45)$++;if($<Z.length&&t(Z.charCodeAt($))){$++;while($<Z.length&&t(Z.charCodeAt($)))$++;_=$}else q=3}return Z.substring(j,_)}function O(){let j="",_=$;while(!0){if($>=z){j+=Z.substring(_,$),q=2;break}let V=Z.charCodeAt($);if(V===34){j+=Z.substring(_,$),$++;break}if(V===92){if(j+=Z.substring(_,$),$++,$>=z){q=2;break}switch(Z.charCodeAt($++)){case 34:j+='"';break;case 92:j+="\\";break;case 47:j+="/";break;case 98:j+="\b";break;case 102:j+="\f";break;case 110:j+=`
|
|
2
|
+
import{Fp as a0}from"./chunk-a1p2f16h.js";import{ns as f0,ps as l0}from"./chunk-42f7p0hq.js";import{nt as o0}from"./chunk-j6emx6jn.js";import{qt as T0}from"./chunk-12bssxd4.js";import{ku as C0,mu as s,ou as H0,pu as r,yt as P0}from"./chunk-3szwfy7w.js";import{Iu as n0,Ou as f,Su as S,zu as a}from"./chunk-whxjkz9a.js";import{Uu as p}from"./chunk-k309zez0.js";import{wA as u0}from"./chunk-phxrg7aw.js";import{CI as N0,HG as C,PI as J,UC as L,ZD as R0,mG as g,pO as w,wP as s0,xB as p0}from"./chunk-snm5q21k.js";import{$P as X0,bQ as i0,dQ as _2}from"./chunk-aztre27e.js";function h0(Z,Q){let z,$=()=>z??=u0.make(g.provideMerge(Q,f0.layer),{memoMap:l0});return{runSync:(X)=>$().runSync(Z.use(X)),runPromiseExit:(X,Y)=>$().runPromiseExit(Z.use(X),Y),runPromise:(X,Y)=>$().runPromise(Z.use(X),Y),runFork:(X)=>$().runFork(Z.use(X)),runCallback:(X)=>$().runCallback(Z.use(X))}}var Y0={};i0(Y0,{which:()=>w2,sanitize:()=>t0,outdated:()=>K2,layer:()=>e0,install:()=>N2,defaultLayer:()=>Z2,add:()=>F2,Service:()=>z0,Npm:()=>Y0,InstallFailedError:()=>V0});var r0=X0(o0(),1),b0=X0(a0(),1);import k from"path";import I0 from"path";import A2 from"os";import{randomUUID as D2}from"crypto";var B0;((Q0)=>{class Z extends w.TaggedErrorClass()("LockTimeoutError",{key:w.String}){}Q0.LockTimeoutError=Z;class Q extends w.TaggedErrorClass()("LockCompromisedError",{detail:w.String}){}Q0.LockCompromisedError=Q;class z extends w.TaggedErrorClass()("ReleaseError",{detail:w.String,cause:w.optional(w.Defect)}){get message(){return this.detail}}class $ extends w.TaggedErrorClass()("NotAcquired",{}){}let X=60000,Y=300000,U=100,G=2000,W=Math.max(100,Math.floor(X/3)),I=C.exponential(U,1.7).pipe(C.either(C.spaced(G)),C.jittered,C.while((j)=>j.elapsed<Y)),H=w.fromJsonString(w.Struct({token:w.String,pid:w.Number,hostname:w.String,createdAt:w.String})),q=w.decodeUnknownSync(H),R=w.encodeSync(H);class N extends R0.Service()("EffectFlock"){}Q0.Service=N;function A(){return performance.timeOrigin+performance.now()}let O=(j)=>L.getOrElse(j.mtime,()=>new Date(0)).getTime(),K=(j)=>j.reason._tag==="NotFound"||j.reason._tag==="Unknown";Q0.layer=g.effect(N,J.gen(function*(){let j=yield*s.Service,_=yield*f.Service,V=I0.join(j.state,"locks"),B=A2.hostname(),M=new Set,m=(D)=>_.stat(D).pipe(J.catchIf(K,()=>J.void),J.orDie),l=(D)=>_.remove(D,{recursive:!0}).pipe(J.ignore),d=(D)=>_.makeDirectory(D,{mode:448}).pipe(J.as(!0),J.catchIf((T)=>T.reason._tag==="AlreadyExists",()=>J.succeed(!1)),J.orDie),M0=(D,T,E,P)=>_.writeFileString(D,T,{flag:"wx"}).pipe(J.catch(()=>J.gen(function*(){return yield*l(E),yield*new Q({detail:P})}))),w0=J.fnUntraced(function*(D){let T=yield*m(D);if(T&&A()-O(T)>X)yield*l(D);return!1}),Z0=J.fnUntraced(function*(D){if(M.has(D))return;yield*_.makeDirectory(D,{recursive:!0}).pipe(J.orDie),M.add(D)}),F=J.fnUntraced(function*(D,T,E){let P=A(),h=yield*m(T);if(h)return P-O(h)>X;let $0=yield*m(E);if($0)return P-O($0)>X;let q0=yield*m(D);if(!q0)return!1;return P-O(q0)>X}),b=(D,T)=>J.gen(function*(){let E=D2(),P=I0.join(D,"meta.json"),h=I0.join(D,"heartbeat");if(!(yield*d(D))){if(!(yield*F(D,h,P)))return yield*new $;let O0=D+".breaker";if(!(yield*_.makeDirectory(O0,{mode:448}).pipe(J.as(!0),J.catchIf((V2)=>V2.reason._tag==="AlreadyExists",()=>w0(O0)),J.catchIf(K,()=>J.succeed(!1)),J.orDie)))return yield*new $;if(!(yield*J.gen(function*(){if(!(yield*F(D,h,P)))return!1;return yield*l(D),yield*d(D)}).pipe(J.ensuring(l(O0)))))return yield*new $}yield*M0(h,"",D,"heartbeat already existed");let q0=R({token:E,pid:process.pid,hostname:B,createdAt:new Date().toISOString()});return yield*M0(P,q0,D,"meta.json already existed"),{token:E,metaPath:P,heartbeatPath:h,lockDir:D}}).pipe(J.withSpan("EffectFlock.tryAcquire",{attributes:{key:T}})),U0=(D,T)=>b(D,T).pipe(J.retry({while:(E)=>E._tag==="NotAcquired",schedule:I}),J.catchTag("NotAcquired",()=>J.fail(new Z({key:T})))),i=(D)=>J.gen(function*(){let T=yield*_.readFileString(D.metaPath).pipe(J.catch((P)=>{if(K(P))return J.die(new z({detail:"metadata missing"}));return J.die(P)}));if((yield*J.try({try:()=>q(T),catch:(P)=>new z({detail:"metadata invalid",cause:P})}).pipe(J.orDie)).token!==D.token)return yield*J.die(new z({detail:"token mismatch"}));yield*l(D.lockDir)}),k0=J.fn("EffectFlock.acquire")(function*(D,T){let E=T??V;yield*Z0(E);let P=I0.join(E,C0.fast(D)+".lock"),h=yield*J.acquireRelease(U0(P,D),($0)=>i($0));yield*_.utimes(h.heartbeatPath,new Date,new Date).pipe(J.ignore,J.repeat(C.spaced(W)),J.forkScoped)}),B2=p0.dual((D)=>J.isEffect(D[0]),(D,T,E)=>J.scoped(J.gen(function*(){return yield*k0(T,E),yield*D})));return N.of({acquire:k0,withLock:B2})})),Q0.defaultLayer=Q0.layer.pipe(g.provide(f.defaultLayer),g.provide(s.layer))})(B0||={});class V0 extends w.TaggedErrorClass()("NpmInstallFailedError",{add:w.Array(w.String).pipe(w.optional),dir:w.String,cause:w.optional(w.Defect)}){}class z0 extends R0.Service()("@qitqode/Npm"){}var c0=process.platform==="win32"?new Set(["<",">",":",'"',"|","?","*"]):void 0;function t0(Z){if(!c0)return Z;return Array.from(Z,(Q)=>c0.has(Q)||Q.charCodeAt(0)<32?"_":Q).join("")}var d0=(Z,Q)=>{let z;try{let $=typeof Bun<"u"?import.meta.resolve(Z,Q):import.meta.resolve(Q);z=L.some($)}catch{z=L.none()}return{directory:Q,entrypoint:z}},e0=g.effect(z0,J.gen(function*(){let Z=yield*f.Service,Q=yield*s.Service,z=yield*s0.FileSystem,$=yield*B0.Service,X=(H)=>k.join(Q.cache,"packages",t0(H)),Y=(H)=>J.gen(function*(){yield*$.acquire(`npm-install:${H.dir}`);let{Arborist:q}=yield*J.promise(()=>import("./chunk-yp0a8q29.js").then((m)=>X0(m.default,1))),R=new q({path:H.dir,binLinks:!0,progress:!1,savePrefix:"",ignoreScripts:!0});return yield*J.tryPromise({try:()=>R.reify({add:H?.add||[],save:!0,saveType:"prod"}),catch:(N)=>new V0({cause:N,add:H?.add,dir:H.dir})})}).pipe(J.withSpan("Npm.reify",{attributes:H})),U=J.fn("Npm.outdated")(function*(H,q){let R=yield*J.tryPromise({try:()=>fetch(`https://registry.npmjs.org/${H}`),catch:()=>{return}}).pipe(J.orElseSucceed(()=>{return}));if(!R||!R.ok)return!1;let A=(yield*J.tryPromise({try:()=>R.json(),catch:()=>{return}}).pipe(J.orElseSucceed(()=>{return})))?.["dist-tags"]?.latest;if(!A)return!1;if(/[\s^~*xX<>|=]/.test(q))return!b0.default.satisfies(A,q);return b0.default.lt(q,A)}),G=J.fn("Npm.add")(function*(H){let q=X(H),R=(()=>{try{return r0.default(H).name??H}catch{return H}})();if(yield*Z.existsSafe(q))return d0(R,k.join(q,"node_modules",R));let A=(yield*Y({dir:q,add:[H]})).edgesOut.values().next().value?.to;if(!A)return yield*new V0({add:[H],dir:q});return d0(A.name,A.path)},J.scoped),W=J.fn("Npm.install")(function*(H,q){if(!(yield*Z.access(H,{writable:!0}).pipe(J.as(!0),J.orElseSucceed(()=>!1))))return;let N=q?.add.map((A)=>[A.name,A.version].filter(Boolean).join("@"))??[];if(yield*J.gen(function*(){if(!(yield*Z.existsSafe(k.join(H,"node_modules"))))return yield*Y({add:N,dir:H}),!0;return!1}).pipe(J.withSpan("Npm.checkNodeModules")))return;yield*J.gen(function*(){let A=yield*Z.readJson(k.join(H,"package.json")).pipe(J.orElseSucceed(()=>({}))),O=yield*Z.readJson(k.join(H,"package-lock.json")).pipe(J.orElseSucceed(()=>({}))),K=A,y=O,v=new Set([...Object.keys(K?.dependencies||{}),...Object.keys(K?.devDependencies||{}),...Object.keys(K?.peerDependencies||{}),...Object.keys(K?.optionalDependencies||{}),...(q?.add||[]).map((V)=>V.name)]),j=y?.packages?.[""]||{},_=new Set([...Object.keys(j?.dependencies||{}),...Object.keys(j?.devDependencies||{}),...Object.keys(j?.peerDependencies||{}),...Object.keys(j?.optionalDependencies||{})]);for(let V of v)if(!_.has(V)){yield*Y({dir:H,add:N});return}}).pipe(J.withSpan("Npm.checkDirty"));return},J.scoped),I=J.fn("Npm.which")(function*(H){let q=X(H),R=k.join(q,"node_modules",".bin"),N=J.fnUntraced(function*(){let A=yield*z.readDirectory(R).pipe(J.catch(()=>J.succeed([])));if(A.length===0)return L.none();if(A.length===1)return L.some(A[0]);let O=yield*Z.readJson(k.join(q,"node_modules",H,"package.json")).pipe(J.option);if(L.isSome(O)){let K=O.value;if(K?.bin){let y=H.startsWith("@")?H.split("/")[1]:H,v=K.bin;if(typeof v==="string")return L.some(y);let j=Object.keys(v);if(j.length===1)return L.some(j[0]);return v[y]?L.some(y):L.some(j[0])}}return L.some(A[0])});return yield*J.gen(function*(){let A=yield*N();if(L.isSome(A))return L.some(k.join(R,A.value));yield*z.remove(k.join(q,"package-lock.json")).pipe(J.orElseSucceed(()=>{})),yield*G(H);let O=yield*N();if(L.isNone(O))return L.none();return L.some(k.join(R,O.value))}).pipe(J.scoped,J.orElseSucceed(()=>L.none()))});return z0.of({add:G,install:W,outdated:U,which:I})})),Z2=e0.pipe(g.provide(B0.layer),g.provide(f.layer),g.provide(s.layer),g.provide(n0.layer)),{runPromise:A0}=h0(z0,Z2);async function N2(...Z){return A0((Q)=>Q.install(...Z))}async function F2(...Z){let Q=await A0((z)=>z.add(...Z));return{directory:Q.directory,entrypoint:L.getOrUndefined(Q.entrypoint)}}async function K2(...Z){return A0((Q)=>Q.outdated(...Z))}async function w2(...Z){let Q=await A0((z)=>z.which(...Z));return L.getOrUndefined(Q)}var Q2=X0(o0(),1),D0=X0(a0(),1);import u from"path";import{fileURLToPath as _0,pathToFileURL as n}from"url";var O2=["opencode-openai-codex-auth","opencode-copilot-auth"];function _Z(Z){return O2.some((Q)=>Z.includes(Q))}function z2(Z){try{return Q2.default(Z)}catch{}}function NZ(Z){let Q=z2(Z);if(Q?.type==="alias"&&!Q.name){let z=Q.subSpec;if(z?.name){let $=!z.rawSpec||z.rawSpec==="*"?"latest":z.rawSpec;return{pkg:z.name,version:$}}}if(!Q?.name)return{pkg:Z,version:""};if(Q.raw===Q.name)return{pkg:Q.name,version:"latest"};return{pkg:Q.name,version:Q.rawSpec}}var b2=["index.ts","index.tsx","index.js","index.mjs","index.cjs"];function X2(Z){if(J2(Z))return"file";return"npm"}function L2(Z,Q){if(Z.startsWith("file://"))return _0(Z);if(u.isAbsolute(Z))return Z;return u.resolve(Q,Z)}function Y2(Z){return u.isAbsolute(Z)||/^[A-Za-z]:[\\/]/.test(Z)}function T2(Z){if(typeof Z==="string")return Z;if(!a(Z))return;for(let Q of["import","default"]){let z=Z[Q];if(typeof z==="string")return z}return}function y2(Z){let Q=Z.json.main;if(typeof Q!=="string")return;let z=Q.trim();if(!z)return;return z}function H2(Z,Q,z,$){let X=L2(Q,$.dir),Y=S.resolve($.dir),U=S.resolve(X);if(!S.contains(Y,U))throw Error(`Plugin ${Z} resolved ${z} entry outside plugin directory`);return U}function $2(Z,Q,z,$){return n(H2(Z,Q,z,$)).href}function P2(Z,Q,z){let $=z.json.exports;if(a($)){let Y=T2($[`./${Q}`]);if(Y)return $2(Z,Y,Q,z)}if(Q!=="server")return;let X=y2(z);if(!X)return;return $2(Z,X,Q,z)}function S2(Z){if(Z.startsWith("file://"))return _0(Z);if(u.isAbsolute(Z))return Z}async function L0(Z){for(let Q of b2){let z=u.join(Z,Q);if(await S.exists(z))return z}}async function m2(Z){let Q=S2(Z);if(!Q)return;if(!(await S.statAsync(Q))?.isDirectory())return;return Q}async function E2(Z,Q,z,$){let X=X2(Z),Y=$??(X==="npm"?await o(Q):await o(Q).catch(()=>{return}));if(!Y)return Q;let U=P2(Z,z,Y);if(U)return U;let G=await m2(Q);if(z==="tui"){if(X==="file"&&G){let W=await L0(G);if(W)return n(W).href}if(X==="npm")return;if(G)return;return Q}if(G&&a(Y.json.exports)){if(X==="file"){let W=await L0(G);if(W)return n(W).href}return}return Q}function J2(Z){return Z.startsWith("file://")||Z.startsWith(".")||Y2(Z)}async function v2(Z){let Q=Z.startsWith("file://")?_0(Z):Z,z=u.isAbsolute(Q)||/^[A-Za-z]:[\\/]/.test(Q)?Q:u.resolve(Q);if(!(await S.statAsync(z))?.isDirectory()){if(Z.startsWith("file://"))return Z;return n(z).href}if(await S.exists(u.join(z,"package.json")))return n(z).href;let X=await L0(z);if(X)return n(X).href;throw Error(`Plugin directory ${z} is missing package.json or index file`)}async function FZ(Z,Q,z){if(!D0.default.valid(Q)||D0.default.major(Q)===0)return;let $=z??await o(Z).catch(()=>{return});if(!$)return;let X=$.json.engines;if(!a(X))return;let Y=X.qitqode??X.opencode;if(typeof Y!=="string")return;if(!D0.default.satisfies(Q,Y))throw Error(`Plugin requires qitqode ${Y} but running ${Q}`)}async function KZ(Z){if(J2(Z))return v2(Z);let Q=z2(Z),z=Q?.name&&Q.raw===Q.name?`${Q.name}@latest`:Z;return(await Y0.add(z)).directory}async function o(Z){let Q=Z.startsWith("file://")?_0(Z):Z,$=(await S.statAsync(Q))?.isDirectory()?Q:u.dirname(Q),X=u.join($,"package.json"),Y=await S.readJson(X);return{dir:$,pkg:X,json:Y}}async function wZ(Z,Q,z){let $=X2(Z),X=$==="npm"?await o(Q):await o(Q).catch(()=>{return}),Y=await E2(Z,Q,z,X);return{spec:Z,source:$,target:Q,pkg:X,entry:Y}}function OZ(Z,Q){let z=Q.json["oc-themes"];if(z===void 0)return[];if(!Array.isArray(z))throw TypeError(`Plugin ${Z} has invalid oc-themes field`);let $=z.map((X)=>{if(typeof X!=="string")throw TypeError(`Plugin ${Z} has invalid oc-themes entry`);let Y=X.trim();if(!Y)throw TypeError(`Plugin ${Z} has empty oc-themes entry`);if(Y.startsWith("file://")||Y2(Y))throw TypeError(`Plugin ${Z} oc-themes entry must be relative: ${X}`);return H2(Z,Y,"oc-themes",Q)});return Array.from(new Set($))}function bZ(Z,Q){if(Z===void 0)return;if(typeof Z!=="string")throw TypeError(`Plugin ${Q} has invalid id type ${typeof Z}`);let z=Z.trim();if(!z)throw TypeError(`Plugin ${Q} has an empty id`);return z}function LZ(Z,Q,z,$="strict"){let X=Z.default;if(!a(X)){if($==="detect")return;throw TypeError(`Plugin ${Q} must default export an object with ${z}()`)}if($==="detect"&&!("id"in X)&&!("server"in X)&&!("tui"in X))return;let Y="server"in X?X.server:void 0,U="tui"in X?X.tui:void 0;if(Y!==void 0&&typeof Y!=="function")throw TypeError(`Plugin ${Q} has invalid server export`);if(U!==void 0&&typeof U!=="function")throw TypeError(`Plugin ${Q} has invalid tui export`);if(Y!==void 0&&U!==void 0)throw TypeError(`Plugin ${Q} must default export either server() or tui(), not both`);if(z==="server"&&Y===void 0)throw TypeError(`Plugin ${Q} must default export an object with server()`);if(z==="tui"&&U===void 0)throw TypeError(`Plugin ${Q} must default export an object with tui()`);return X}async function TZ(Z,Q,z,$,X){if(Z==="file"){if($)return $;throw TypeError(`Path plugin ${Q} must export id`)}if($)return $;let Y=X??await o(z);if(typeof Y.json.name!=="string"||!Y.json.name.trim())throw TypeError(`Plugin package ${Y.pkg} is missing name`);return Y.json.name.trim()}var S0={};i0(S0,{readFile:()=>l2,files:()=>g2,fileInDirectory:()=>f2,directories:()=>k2,claudeCommandDirectories:()=>u2,ConfigPaths:()=>S0});import y0 from"path";var W2=T0.create("ConfigJsonError",p.object({path:p.string(),message:p.string().optional()})),mZ=T0.create("ConfigInvalidError",p.object({path:p.string(),issues:p.custom().optional(),message:p.string().optional()}));var g2=N0("ConfigPaths.projectFiles")(function*(Z,Q,z){return(yield*(yield*f.Service).up({targets:[`${Z}.jsonc`,`${Z}.json`],start:Q,stop:z})).toReversed()}),k2=N0("ConfigPaths.directories")(function*(Z,Q){let z=yield*f.Service;return P0([H0.Path.config,...!r.QITQODE_DISABLE_PROJECT_CONFIG?yield*z.up({targets:[".qitqode"],start:Z,stop:Q}):[],...yield*z.up({targets:[".qitqode"],start:H0.Path.home,stop:H0.Path.home}),...r.QITQODE_CONFIG_DIR?[r.QITQODE_CONFIG_DIR]:[]])}),u2=N0("ConfigPaths.claudeCommandDirectories")(function*(Z,Q){if(r.QITQODE_DISABLE_CLAUDE_CODE_COMMANDS)return[];let z=yield*f.Service;return P0([y0.join(H0.Path.home,".claude"),...!r.QITQODE_DISABLE_PROJECT_CONFIG?yield*z.up({targets:[".claude"],start:Z,stop:Q}):[]])});function f2(Z,Q){return[y0.join(Z,`${Q}.json`),y0.join(Z,`${Q}.jsonc`)]}async function l2(Z){return S.readText(Z).catch((Q)=>{if(Q.code==="ENOENT")return;throw new W2({path:Z},{cause:Q})})}function W0(Z,Q=!1){let z=Z.length,$=0,X="",Y=0,U=16,G=0,W=0,I=0,H=0,q=0;function R(j,_){let V=0,B=0;while(V<j||!_){let M=Z.charCodeAt($);if(M>=48&&M<=57)B=B*16+M-48;else if(M>=65&&M<=70)B=B*16+M-65+10;else if(M>=97&&M<=102)B=B*16+M-97+10;else break;$++,V++}if(V<j)B=-1;return B}function N(j){$=j,X="",Y=0,U=16,q=0}function A(){let j=$;if(Z.charCodeAt($)===48)$++;else{$++;while($<Z.length&&t(Z.charCodeAt($)))$++}if($<Z.length&&Z.charCodeAt($)===46)if($++,$<Z.length&&t(Z.charCodeAt($))){$++;while($<Z.length&&t(Z.charCodeAt($)))$++}else return q=3,Z.substring(j,$);let _=$;if($<Z.length&&(Z.charCodeAt($)===69||Z.charCodeAt($)===101)){if($++,$<Z.length&&Z.charCodeAt($)===43||Z.charCodeAt($)===45)$++;if($<Z.length&&t(Z.charCodeAt($))){$++;while($<Z.length&&t(Z.charCodeAt($)))$++;_=$}else q=3}return Z.substring(j,_)}function O(){let j="",_=$;while(!0){if($>=z){j+=Z.substring(_,$),q=2;break}let V=Z.charCodeAt($);if(V===34){j+=Z.substring(_,$),$++;break}if(V===92){if(j+=Z.substring(_,$),$++,$>=z){q=2;break}switch(Z.charCodeAt($++)){case 34:j+='"';break;case 92:j+="\\";break;case 47:j+="/";break;case 98:j+="\b";break;case 102:j+="\f";break;case 110:j+=`
|
|
3
3
|
`;break;case 114:j+="\r";break;case 116:j+="\t";break;case 117:let M=R(4,!0);if(M>=0)j+=String.fromCharCode(M);else q=4;break;default:q=5}_=$;continue}if(V>=0&&V<=31)if(J0(V)){j+=Z.substring(_,$),q=2;break}else q=6;$++}return j}function K(){if(X="",q=0,Y=$,W=G,H=I,$>=z)return Y=z,U=17;let j=Z.charCodeAt($);if(m0(j)){do $++,X+=String.fromCharCode(j),j=Z.charCodeAt($);while(m0(j));return U=15}if(J0(j)){if($++,X+=String.fromCharCode(j),j===13&&Z.charCodeAt($)===10)$++,X+=`
|
|
4
4
|
`;return G++,I=$,U=14}switch(j){case 123:return $++,U=1;case 125:return $++,U=2;case 91:return $++,U=3;case 93:return $++,U=4;case 58:return $++,U=6;case 44:return $++,U=5;case 34:return $++,X=O(),U=10;case 47:let _=$-1;if(Z.charCodeAt($+1)===47){$+=2;while($<z){if(J0(Z.charCodeAt($)))break;$++}return X=Z.substring(_,$),U=12}if(Z.charCodeAt($+1)===42){$+=2;let V=z-1,B=!1;while($<V){let M=Z.charCodeAt($);if(M===42&&Z.charCodeAt($+1)===47){$+=2,B=!0;break}if($++,J0(M)){if(M===13&&Z.charCodeAt($)===10)$++;G++,I=$}}if(!B)$++,q=1;return X=Z.substring(_,$),U=13}return X+=String.fromCharCode(j),$++,U=16;case 45:if(X+=String.fromCharCode(j),$++,$===z||!t(Z.charCodeAt($)))return U=16;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return X+=A(),U=11;default:while($<z&&y(j))$++,j=Z.charCodeAt($);if(Y!==$){switch(X=Z.substring(Y,$),X){case"true":return U=8;case"false":return U=9;case"null":return U=7}return U=16}return X+=String.fromCharCode(j),$++,U=16}}function y(j){if(m0(j)||J0(j))return!1;switch(j){case 125:case 93:case 123:case 91:case 34:case 58:case 44:case 47:return!1}return!0}function v(){let j;do j=K();while(j>=12&&j<=15);return j}return{setPosition:N,getPosition:()=>$,scan:Q?v:K,getToken:()=>U,getTokenValue:()=>X,getTokenOffset:()=>Y,getTokenLength:()=>$-Y,getTokenStartLine:()=>W,getTokenStartCharacter:()=>Y-H,getTokenError:()=>q}}function m0(Z){return Z===32||Z===9}function J0(Z){return Z===10||Z===13}function t(Z){return Z>=48&&Z<=57}var G2;(function(Z){Z[Z.lineFeed=10]="lineFeed",Z[Z.carriageReturn=13]="carriageReturn",Z[Z.space=32]="space",Z[Z._0=48]="_0",Z[Z._1=49]="_1",Z[Z._2=50]="_2",Z[Z._3=51]="_3",Z[Z._4=52]="_4",Z[Z._5=53]="_5",Z[Z._6=54]="_6",Z[Z._7=55]="_7",Z[Z._8=56]="_8",Z[Z._9=57]="_9",Z[Z.a=97]="a",Z[Z.b=98]="b",Z[Z.c=99]="c",Z[Z.d=100]="d",Z[Z.e=101]="e",Z[Z.f=102]="f",Z[Z.g=103]="g",Z[Z.h=104]="h",Z[Z.i=105]="i",Z[Z.j=106]="j",Z[Z.k=107]="k",Z[Z.l=108]="l",Z[Z.m=109]="m",Z[Z.n=110]="n",Z[Z.o=111]="o",Z[Z.p=112]="p",Z[Z.q=113]="q",Z[Z.r=114]="r",Z[Z.s=115]="s",Z[Z.t=116]="t",Z[Z.u=117]="u",Z[Z.v=118]="v",Z[Z.w=119]="w",Z[Z.x=120]="x",Z[Z.y=121]="y",Z[Z.z=122]="z",Z[Z.A=65]="A",Z[Z.B=66]="B",Z[Z.C=67]="C",Z[Z.D=68]="D",Z[Z.E=69]="E",Z[Z.F=70]="F",Z[Z.G=71]="G",Z[Z.H=72]="H",Z[Z.I=73]="I",Z[Z.J=74]="J",Z[Z.K=75]="K",Z[Z.L=76]="L",Z[Z.M=77]="M",Z[Z.N=78]="N",Z[Z.O=79]="O",Z[Z.P=80]="P",Z[Z.Q=81]="Q",Z[Z.R=82]="R",Z[Z.S=83]="S",Z[Z.T=84]="T",Z[Z.U=85]="U",Z[Z.V=86]="V",Z[Z.W=87]="W",Z[Z.X=88]="X",Z[Z.Y=89]="Y",Z[Z.Z=90]="Z",Z[Z.asterisk=42]="asterisk",Z[Z.backslash=92]="backslash",Z[Z.closeBrace=125]="closeBrace",Z[Z.closeBracket=93]="closeBracket",Z[Z.colon=58]="colon",Z[Z.comma=44]="comma",Z[Z.dot=46]="dot",Z[Z.doubleQuote=34]="doubleQuote",Z[Z.minus=45]="minus",Z[Z.openBrace=123]="openBrace",Z[Z.openBracket=91]="openBracket",Z[Z.plus=43]="plus",Z[Z.slash=47]="slash",Z[Z.formFeed=12]="formFeed",Z[Z.tab=9]="tab"})(G2||(G2={}));var x=Array(20).fill(0).map((Z,Q)=>{return" ".repeat(Q)});var E0={" ":{"\n":Array(200).fill(0).map((Z,Q)=>{return`
|
|
5
5
|
`+" ".repeat(Q)}),"\r":Array(200).fill(0).map((Z,Q)=>{return"\r"+" ".repeat(Q)}),"\r\n":Array(200).fill(0).map((Z,Q)=>{return`\r
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Rd as q}from"./chunk-yajd975f.js";import{Vf as v}from"./chunk-7ppd2phw.js";import{hh as S}from"./chunk-
|
|
2
|
+
import{Rd as q}from"./chunk-yajd975f.js";import{Vf as v}from"./chunk-7ppd2phw.js";import{hh as S}from"./chunk-ddnpx1yx.js";import"./chunk-wfs4pcwa.js";import"./chunk-p68rwmhc.js";import"./chunk-0a0vat1h.js";import"./chunk-z8v2tsz2.js";import"./chunk-j8efst22.js";import"./chunk-a1pw9r6f.js";import"./chunk-d5bxan80.js";import"./chunk-pvpy9kq1.js";import"./chunk-wpajh5s5.js";import{cm as Q,lm as H}from"./chunk-2ec6ps8r.js";import"./chunk-gj3hzx3d.js";import"./chunk-nj4d554m.js";import"./chunk-2gerf08b.js";import"./chunk-fqw4y7x0.js";import"./chunk-a1p2f16h.js";import"./chunk-nt4e3em9.js";import"./chunk-a0v55ywn.js";import"./chunk-v965rsr8.js";import"./chunk-1sgby720.js";import"./chunk-dcvatax2.js";import"./chunk-4tbwha3m.js";import"./chunk-m612agnk.js";import"./chunk-yq3m8190.js";import"./chunk-btz9jvec.js";import"./chunk-cqtkxwd8.js";import"./chunk-fkgv2hqd.js";import"./chunk-zyhdxggp.js";import"./chunk-q6ztpfcs.js";import"./chunk-jm1ptn8n.js";import"./chunk-c5e6sk9c.js";import"./chunk-m02zt1a3.js";import"./chunk-vg2fmyje.js";import"./chunk-sn4nez18.js";import"./chunk-42f7p0hq.js";import"./chunk-4qqkqrn9.js";import"./chunk-j6emx6jn.js";import"./chunk-be216spx.js";import"./chunk-12bssxd4.js";import"./chunk-z8r65yw3.js";import"./chunk-3szwfy7w.js";import{Hu as K}from"./chunk-whxjkz9a.js";import"./chunk-89v6dgpp.js";import"./chunk-k309zez0.js";import"./chunk-09kba1hg.js";import"./chunk-t12xrrfr.js";import"./chunk-phxrg7aw.js";import"./chunk-snm5q21k.js";import"./chunk-xpc2zgj7.js";import"./chunk-qjjch1zt.js";import"./chunk-aztre27e.js";var P=q({command:"pr <number>",describe:"fetch and checkout a GitHub PR branch, then run qitqode",builder:(Y)=>Y.positional("number",{type:"number",describe:"PR number to checkout",demandOption:!0}),async handler(Y){await H.provide({directory:process.cwd(),async fn(){if(H.project.vcs!=="git")v.error("Could not find git repository. Please run this command from a git repository."),process.exit(1);let J=Y.number,Z=`pr/${J}`;if(v.println(`Fetching and checking out PR #${J}...`),(await K.run(["gh","pr","checkout",`${J}`,"--branch",Z,"--force"],{nothrow:!0})).code!==0)v.error(`Failed to checkout PR #${J}. Make sure you have gh CLI installed and authenticated.`),process.exit(1);let _=await K.text(["gh","pr","view",`${J}`,"--json","headRepository,headRepositoryOwner,isCrossRepository,headRefName,body"],{nothrow:!0}),V;if(_.code===0){let j=_.text;if(j.trim()){let z=JSON.parse(j);if(z&&z.isCrossRepository&&z.headRepository&&z.headRepositoryOwner){let L=z.headRepositoryOwner.login,W=z.headRepository.name,C=L;if(!(await S.runPromise(Q.Service.use((F)=>F.run(["remote"],{cwd:H.worktree}))).then((F)=>F.text().trim())).split(`
|
|
3
3
|
`).includes(C))await S.runPromise(Q.Service.use((F)=>F.run(["remote","add",C,`https://github.com/${L}/${W}.git`],{cwd:H.worktree}))),v.println(`Added fork remote: ${C}`);let X=z.headRefName;await S.runPromise(Q.Service.use((F)=>F.run(["branch",`--set-upstream-to=${C}/${X}`,Z],{cwd:H.worktree})))}if(z&&z.body){let L=z.body.match(/https:\/\/opncd\.ai\/s\/([a-zA-Z0-9_-]+)/);if(L){let W=L[0];v.println(`Found qitqode session: ${W}`),v.println("Importing session...");let C=await K.text(["qitqode","import",W],{nothrow:!0});if(C.code===0){let X=C.text.trim().match(/Imported session: ([a-zA-Z0-9_-]+)/);if(X)V=X[1],v.println(`Session imported: ${V}`)}}}}}v.println(`Successfully checked out PR #${J} as branch '${Z}'`),v.println(),v.println("Starting qitqode..."),v.println();let D=V?["-s",V]:[],$=await K.spawn(["qitqode",...D],{stdin:"inherit",stdout:"inherit",stderr:"inherit",cwd:process.cwd()}).exited;if($!==0)throw Error(`qitqode exited with code ${$}`)}})}});export{P as PrCommand};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import{aq as G$}from"./chunk-1sgby720.js";import{Du as eZ,Iu as U$,Ju as A$,Lu as CZ,Mu as KZ}from"./chunk-whxjkz9a.js";import{Tu as k$}from"./chunk-89v6dgpp.js";import{Uu as SZ}from"./chunk-k309zez0.js";import{BH as zZ,BI as p,CF as q$,DB as L,DF as E,DO as DZ,EB as Z$,FF as WZ,GB as ZZ,GF as z$,HO as C,IB as oZ,MD as gZ,PI as P,PO as r,SG as $Z,TG as LZ,UG as qZ,UH as xZ,UO as B$,VG as f,VH as V$,XG as jZ,ZG as J$,ZO as JZ,_G as i,aP as fZ,bH as K$,bP as iZ,eH as o,fG as D$,fP as PZ,gH as l,gP as lZ,kB as a,kG as RZ,kH as h,kP as cZ,lH as Q$,nC as kZ,nH as c,nI as EZ,oH as vZ,oP as v,qP as Y$,rC as rZ,rO as X$,sC as sZ,tJ as YZ,uO as d,vF as $$,wO as m,yH as IZ,yP as F$}from"./chunk-snm5q21k.js";import{$P as u$,bQ as BZ,dQ as h$}from"./chunk-aztre27e.js";var pZ={};BZ(pZ,{makeHandle:()=>AZ,make:()=>GZ,ProcessId:()=>UZ,ExitCode:()=>FZ,ChildProcessSpawner:()=>W});var FZ=YZ(),UZ=YZ(),hZ="~effect/ChildProcessSpawner/ChildProcessHandle",j$={[hZ]:hZ,...kZ,toJSON(){return{_id:"ChildProcessHandle",pid:this.pid}}},AZ=(Z)=>Object.assign(Object.create(j$),Z),GZ=(Z)=>{let q=(B,Q)=>Z(B).pipe(h((U)=>fZ(Q?.includeStderr===!0?U.all:U.stdout)),r),z=(B,Q)=>iZ(q(B,Q));return W.of({spawn:Z,exitCode:(B)=>xZ(o(Z(B),(Q)=>Q.exitCode)),streamString:q,streamLines:z,lines:(B,Q)=>lZ(z(B,Q)),string:(B,Q)=>cZ(q(B,Q))})};class W extends gZ()("effect/process/ChildProcessSpawner"){}var x={};BZ(x,{setEnv:()=>HZ,setCwd:()=>yZ,prefix:()=>C$,pipeTo:()=>P$,parseFdName:()=>g,make:()=>k,isStandardCommand:()=>I$,isPipedCommand:()=>E$,isCommand:()=>s,fdName:()=>NZ});var MZ="~effect/unstable/process/ChildProcess",aZ={...rZ,...sZ,[MZ]:MZ,asEffect(){return W.use((Z)=>Z.spawn(this))}},s=(Z)=>oZ(Z,MZ),I$=(Z)=>Z._tag==="StandardCommand",E$=(Z)=>Z._tag==="PipedCommand",I=(Z,q,z)=>Object.assign(Object.create(aZ),{_tag:"StandardCommand",command:Z,args:q,options:z}),e=(Z,q,z={})=>Object.assign(Object.create(aZ),{_tag:"PipedCommand",left:Z,right:q,options:z}),k=function(...q){if(OZ(q[0])){let[U,...A]=q,G=bZ(U,A);return I(G[0]??"",G.slice(1),{})}if(typeof q[0]==="object"&&!Array.isArray(q[0])&&!OZ(q[0])){let U=q[0];return function(A,...G){let b=bZ(A,G);return I(b[0]??"",b.slice(1),U)}}if(typeof q[0]==="string"&&!Array.isArray(q[1])){let[U,A={}]=q;return I(U,[],A)}let[z,B=[],Q={}]=q;return I(z,B,Q)},P$=a((Z)=>s(Z[0])&&s(Z[1]),(Z,q,z)=>e(Z,q,z??{})),C$=function(...q){if(s(q[0])&&q.length>1){let[B,...Q]=q,U=dZ(Q);return _Z(B,U)}let z=dZ(q);return(B)=>_Z(B,z)},dZ=(Z)=>{if(OZ(Z[0])){let[B,...Q]=Z,U=bZ(B,Q);return{command:U[0]??"",args:U.slice(1)}}let[q,z=[]]=Z;return{command:q,args:z}},_Z=(Z,q)=>{switch(Z._tag){case"StandardCommand":return I(q.command,[...q.args,Z.command,...Z.args],Z.options);case"PipedCommand":return e(_Z(Z.left,q),Z.right,Z.options)}},yZ=a(2,(Z,q)=>{switch(Z._tag){case"StandardCommand":return I(Z.command,Z.args,{...Z.options,cwd:q});case"PipedCommand":return e(yZ(Z.left,q),yZ(Z.right,q),Z.options)}}),HZ=a(2,(Z,q)=>{switch(Z._tag){case"StandardCommand":{let z=Z.options.env===void 0?q:{...Z.options.env,...q};return I(Z.command,Z.args,{...Z.options,env:z})}case"PipedCommand":return e(HZ(Z.left,q),HZ(Z.right,q),Z.options)}}),OZ=(Z)=>Array.isArray(Z)&&("raw"in Z)&&Array.isArray(Z.raw),g=(Z)=>{let q=/^fd(\d+)$/.exec(Z);if(q===null)return;let z=parseInt(q[1],10);return z>=3?z:void 0},NZ=(Z)=>`fd${Z}`,bZ=(Z,q)=>{let z=[];for(let[B,Q]of Z.entries())z=S$(Z,q,z,Q,B);return z},S$=(Z,q,z,B,Q)=>{let U=Z.raw[Q];if(U===void 0)throw Error(`Invalid backslash sequence: ${Z.raw[Q]}`);let{hasLeadingWhitespace:A,hasTrailingWhitespace:G,tokens:b}=w$(B,U),N=nZ(z,b,A);if(Q===q.length)return N;let S=q[Q],QZ=Array.isArray(S)?S.map((VZ)=>mZ(VZ)):[mZ(S)];return nZ(N,QZ,G)},mZ=(Z)=>{if(typeof Z==="string")return Z;return String(Z)},tZ=new Set([" ","\t","\r",`
|
|
3
3
|
`]),T$={x:3,u:5},w$=(Z,q)=>{if(q.length===0)return{tokens:[],hasLeadingWhitespace:!1,hasTrailingWhitespace:!1};let z=tZ.has(q[0]),B=[],Q=0;for(let A=0,G=0;A<Z.length;A+=1,G+=1){let b=q[G];if(tZ.has(b)){if(Q!==A)B.push(Z.slice(Q,A));Q=A+1}else if(b==="\\"){let N=q[G+1];if(N===`
|
|
4
|
-
`)A-=1,G+=1;else if(N==="u"&&q[G+2]==="{")G=q.indexOf("}",G+3);else G+=T$[N]??1}}let U=Q===Z.length;if(!U)B.push(Z.slice(Q));return{tokens:B,hasLeadingWhitespace:z,hasTrailingWhitespace:U}},nZ=(Z,q,z)=>z||Z.length===0||q.length===0?[...Z,...q]:[...Z.slice(0,-1),`${Z.at(-1)}${q.at(0)}`,...q.slice(1)];var _$=u$(k$(),1);import*as M$ from"child_process";import{PassThrough as g$}from"stream";var R=(Z)=>Z instanceof globalThis.Error?Z:new globalThis.Error(String(Z)),x$=(Z)=>{switch(Z.code){case"ENOENT":return"NotFound";case"EACCES":return"PermissionDenied";case"EEXIST":return"AlreadyExists";case"EISDIR":return"BadResource";case"ENOTDIR":return"BadResource";case"EBUSY":return"Busy";case"ELOOP":return"BadResource";default:return"Unknown"}},y$=(Z)=>{let q=[],z=[],B=(A)=>{switch(A._tag){case"StandardCommand":q.push(A);return;case"PipedCommand":B(A.left),z.push(A.options),B(A.right);return}};if(B(Z),q.length===0)throw Error("flatten produced empty commands array");let[Q,...U]=q;return{commands:[Q,...U],opts:z}},O=(Z,q,z)=>{let B=y$(z).commands.map((Q)=>`${Q.command} ${Q.args.join(" ")}`).join(" | ");return X$({_tag:x$(q),module:"ChildProcess",method:Z,pathOrDescriptor:B,syscall:q.syscall,cause:q})},f$=J$(function*(){let Z=yield*Y$,q=yield*F$,z=p(function*($){if(L($.cwd))return;return yield*Z.access($.cwd),q.resolve($.cwd)}),B=($)=>$.extendEnv?{...eZ(),...$.env}:$.env,Q=($)=>DZ($)?"pipe":$,U=($)=>d($)?"pipe":$,A=($)=>{let D={stream:"pipe",encoding:"utf-8",endOnDone:!0};if(L($.stdin))return D;if(typeof $.stdin==="string")return{...D,stream:$.stdin};if(DZ($.stdin))return{...D,stream:$.stdin};return{stream:$.stdin.stream,encoding:$.stdin.encoding??D.encoding,endOnDone:$.stdin.endOnDone??D.endOnDone}},G=($,D)=>{let J=$[D];if(L(J))return{stream:"pipe"};if(typeof J==="string")return{stream:J};if(d(J))return{stream:J};return{stream:J.stream}},b=($)=>{if(L($.additionalFds))return[];return Object.entries($.additionalFds).flatMap(([D,J])=>{let K=g(D);return L(K)?[]:[{fd:K,config:J}]}).toSorted((D,J)=>D.fd-J.fd)},N=($,D,J,K)=>{let X=(F)=>process.platform==="win32"&&F==="pipe"?"overlapped":F,Y=[X(Q($.stream)),X(U(D.stream)),X(U(J.stream))];if(K.length===0)return Y;let V=K.reduce((F,_)=>Math.max(F,_.fd),2);for(let F=3;F<=V;F++)Y[F]="ignore";for(let F of K)Y[F.fd]=X("pipe");return Y},S=p(function*($,D,J){if(J.length===0)return{getInputFd:()=>m,getOutputFd:()=>C};let K=new Map,X=new Map;for(let Y of J){let V=D.stdio[Y.fd];switch(Y.config.type){case"input":{let F=m;if(V&&"write"in V)F=CZ.fromWritable({evaluate:()=>V,onError:(_)=>O(`fromWritable(fd${Y.fd})`,R(_),$),endOnDone:!0});if(Y.config.stream)yield*EZ(PZ(Y.config.stream,F));K.set(Y.fd,F);break}case"output":{let F=C;if(V&&"read"in V){let _=new g$;V.on("error",(y)=>_.destroy(R(y))),V.pipe(_),F=KZ.fromReadable({evaluate:()=>_,onError:(y)=>O(`fromReadable(fd${Y.fd})`,R(y),$)})}if(Y.config.sink)F=JZ(F,Y.config.sink);X.set(Y.fd,F);break}}}return{getInputFd:(Y)=>K.get(Y)??m,getOutputFd:(Y)=>X.get(Y)??C}}),QZ=($,D,J)=>LZ(()=>{let K=m;if(ZZ(D.stdin))K=CZ.fromWritable({evaluate:()=>D.stdin,onError:(X)=>O("fromWritable(stdin)",R(X),$),endOnDone:J.endOnDone,encoding:J.encoding});if(DZ(J.stream))return Q$(EZ(PZ(J.stream,K)),K);return $Z(K)}),VZ=($,D,J,K)=>{let X=D.stdout?KZ.fromReadable({evaluate:()=>D.stdout,onError:(V)=>O("fromReadable(stdout)",R(V),$)}):C,Y=D.stderr?KZ.fromReadable({evaluate:()=>D.stderr,onError:(V)=>O("fromReadable(stderr)",R(V),$)}):C;if(d(J.stream))X=JZ(X,J.stream);if(d(K.stream))Y=JZ(Y,K.stream);return{stdout:X,stderr:Y,all:B$(X,Y)}},b$=($,D)=>jZ((J)=>{let K=q$(),X=_$.default($.command,$.args,D),Y=!1,V;return X.on("error",(F)=>{J(i(O("spawn",F,$)))}),X.on("exit",(...F)=>{V=F}),X.on("close",(...F)=>{if(Y)return;Y=!0,z$(K,$$(V??F))}),X.on("spawn",()=>{J($Z([X,K]))}),qZ(()=>{X.kill("SIGTERM")})}),XZ=($,D,J)=>{if(globalThis.process.platform==="win32")return jZ((K)=>{M$.exec(`taskkill /pid ${D.pid} /T /F`,{windowsHide:!0},(X)=>{if(X)return K(i(O("kill",R(X),$)));K(f)})});return K$({try:()=>{globalThis.process.kill(-D.pid,J)},catch:(K)=>O("kill",R(K),$)})},wZ=($,D,J)=>LZ(()=>{if(D.kill(J))return f;return i(O("kill",Error("Failed to kill child process"),$))}),N$=($,D,J)=>(K)=>{let X=J?.killSignal??"SIGTERM";if(L(J?.forceKillAfter))return K(D,$,X);return zZ(K(D,$,X),{duration:J.forceKillAfter,orElse:()=>K(D,$,"SIGKILL")})},W$=($,D)=>{let J=D??"stdout";switch(J){case"stdout":return $.stdout;case"stderr":return $.stderr;case"all":return $.all;default:{let K=g(J);return Z$(K)?$.getOutputFd(K):$.stdout}}},T=p(function*($){switch($._tag){case"StandardCommand":{let D=A($.options),J=G($.options,"stdout"),K=G($.options,"stderr"),X=b($.options),Y=yield*z($.options),[V,F]=yield*V$(b$($,{cwd:Y,env:B($.options),stdio:N(D,J,K,X),detached:$.options.detached??process.platform!=="win32",shell:$.options.shell,windowsHide:process.platform==="win32"}),p(function*([M,H]){let t=yield*WZ(H),n=N$(M,$,$.options);if(t){let[u]=yield*E(H);if(process.platform==="win32")return yield*f;if(u!==0&&ZZ(u))return yield*IZ(n(XZ));return yield*f}let w=(u)=>vZ(XZ($,M,u),()=>wZ($,M,u)),R$=$.options.killSignal??"SIGTERM",uZ=w(R$).pipe(l(E(H)),c),L$=$.options.forceKillAfter?zZ(uZ,{duration:$.options.forceKillAfter,orElse:()=>w("SIGKILL").pipe(l(E(H)),c)}):uZ;return yield*IZ(L$)})),_=yield*S($,V,X),y=VZ($,V,J,K),j=!0;return AZ({pid:UZ(V.pid),stdin:yield*QZ($,V,D),stdout:y.stdout,stderr:y.stderr,all:y.all,getInputFd:_.getInputFd,getOutputFd:_.getOutputFd,isRunning:h(WZ(F),(M)=>!M),exitCode:o(E(F),([M,H])=>{if(ZZ(M))return $Z(FZ(M));return i(O("exitCode",Error(`Process interrupted due to receipt of signal: '${H}'`),$))}),kill:(M)=>{let H=M?.killSignal??"SIGTERM",t=(w)=>vZ(XZ($,V,w),()=>wZ($,V,w)),n=t(H).pipe(l(E(F)),c);if(!M?.forceKillAfter)return n;return zZ(n,{duration:M.forceKillAfter,orElse:()=>t("SIGKILL").pipe(l(E(F)),c)})},unref:qZ(()=>{if(j)V.unref(),j=!1;return qZ(()=>{if(!j)V.ref(),j=!0})})})}case"PipedCommand":{let D=y$($),[J,...K]=D.commands,X=T(J);for(let Y=0;Y<K.length;Y++){let V=K[Y],F=D.opts[Y]??{},_=A(V.options),y=r(h(X,(H)=>W$(H,F.from))),j=F.to??"stdin";if(j==="stdin"){X=T(k(V.command,V.args,{...V.options,stdin:{..._,stream:y}}));continue}let M=g(j);if(L(M)){X=T(k(V.command,V.args,{...V.options,stdin:{..._,stream:y}}));continue}X=T(k(V.command,V.args,{...V.options,additionalFds:{...V.options.additionalFds,[NZ(M)]:{type:"input",stream:y}}}))}return yield*X}}});return GZ(T)}),i$=D$(W,f$),l$=i$.pipe(RZ(U$.layer),RZ(A$)),Bq=G$(async()=>{let{makeRuntime:Z}=await import("./chunk-
|
|
4
|
+
`)A-=1,G+=1;else if(N==="u"&&q[G+2]==="{")G=q.indexOf("}",G+3);else G+=T$[N]??1}}let U=Q===Z.length;if(!U)B.push(Z.slice(Q));return{tokens:B,hasLeadingWhitespace:z,hasTrailingWhitespace:U}},nZ=(Z,q,z)=>z||Z.length===0||q.length===0?[...Z,...q]:[...Z.slice(0,-1),`${Z.at(-1)}${q.at(0)}`,...q.slice(1)];var _$=u$(k$(),1);import*as M$ from"child_process";import{PassThrough as g$}from"stream";var R=(Z)=>Z instanceof globalThis.Error?Z:new globalThis.Error(String(Z)),x$=(Z)=>{switch(Z.code){case"ENOENT":return"NotFound";case"EACCES":return"PermissionDenied";case"EEXIST":return"AlreadyExists";case"EISDIR":return"BadResource";case"ENOTDIR":return"BadResource";case"EBUSY":return"Busy";case"ELOOP":return"BadResource";default:return"Unknown"}},y$=(Z)=>{let q=[],z=[],B=(A)=>{switch(A._tag){case"StandardCommand":q.push(A);return;case"PipedCommand":B(A.left),z.push(A.options),B(A.right);return}};if(B(Z),q.length===0)throw Error("flatten produced empty commands array");let[Q,...U]=q;return{commands:[Q,...U],opts:z}},O=(Z,q,z)=>{let B=y$(z).commands.map((Q)=>`${Q.command} ${Q.args.join(" ")}`).join(" | ");return X$({_tag:x$(q),module:"ChildProcess",method:Z,pathOrDescriptor:B,syscall:q.syscall,cause:q})},f$=J$(function*(){let Z=yield*Y$,q=yield*F$,z=p(function*($){if(L($.cwd))return;return yield*Z.access($.cwd),q.resolve($.cwd)}),B=($)=>$.extendEnv?{...eZ(),...$.env}:$.env,Q=($)=>DZ($)?"pipe":$,U=($)=>d($)?"pipe":$,A=($)=>{let D={stream:"pipe",encoding:"utf-8",endOnDone:!0};if(L($.stdin))return D;if(typeof $.stdin==="string")return{...D,stream:$.stdin};if(DZ($.stdin))return{...D,stream:$.stdin};return{stream:$.stdin.stream,encoding:$.stdin.encoding??D.encoding,endOnDone:$.stdin.endOnDone??D.endOnDone}},G=($,D)=>{let J=$[D];if(L(J))return{stream:"pipe"};if(typeof J==="string")return{stream:J};if(d(J))return{stream:J};return{stream:J.stream}},b=($)=>{if(L($.additionalFds))return[];return Object.entries($.additionalFds).flatMap(([D,J])=>{let K=g(D);return L(K)?[]:[{fd:K,config:J}]}).toSorted((D,J)=>D.fd-J.fd)},N=($,D,J,K)=>{let X=(F)=>process.platform==="win32"&&F==="pipe"?"overlapped":F,Y=[X(Q($.stream)),X(U(D.stream)),X(U(J.stream))];if(K.length===0)return Y;let V=K.reduce((F,_)=>Math.max(F,_.fd),2);for(let F=3;F<=V;F++)Y[F]="ignore";for(let F of K)Y[F.fd]=X("pipe");return Y},S=p(function*($,D,J){if(J.length===0)return{getInputFd:()=>m,getOutputFd:()=>C};let K=new Map,X=new Map;for(let Y of J){let V=D.stdio[Y.fd];switch(Y.config.type){case"input":{let F=m;if(V&&"write"in V)F=CZ.fromWritable({evaluate:()=>V,onError:(_)=>O(`fromWritable(fd${Y.fd})`,R(_),$),endOnDone:!0});if(Y.config.stream)yield*EZ(PZ(Y.config.stream,F));K.set(Y.fd,F);break}case"output":{let F=C;if(V&&"read"in V){let _=new g$;V.on("error",(y)=>_.destroy(R(y))),V.pipe(_),F=KZ.fromReadable({evaluate:()=>_,onError:(y)=>O(`fromReadable(fd${Y.fd})`,R(y),$)})}if(Y.config.sink)F=JZ(F,Y.config.sink);X.set(Y.fd,F);break}}}return{getInputFd:(Y)=>K.get(Y)??m,getOutputFd:(Y)=>X.get(Y)??C}}),QZ=($,D,J)=>LZ(()=>{let K=m;if(ZZ(D.stdin))K=CZ.fromWritable({evaluate:()=>D.stdin,onError:(X)=>O("fromWritable(stdin)",R(X),$),endOnDone:J.endOnDone,encoding:J.encoding});if(DZ(J.stream))return Q$(EZ(PZ(J.stream,K)),K);return $Z(K)}),VZ=($,D,J,K)=>{let X=D.stdout?KZ.fromReadable({evaluate:()=>D.stdout,onError:(V)=>O("fromReadable(stdout)",R(V),$)}):C,Y=D.stderr?KZ.fromReadable({evaluate:()=>D.stderr,onError:(V)=>O("fromReadable(stderr)",R(V),$)}):C;if(d(J.stream))X=JZ(X,J.stream);if(d(K.stream))Y=JZ(Y,K.stream);return{stdout:X,stderr:Y,all:B$(X,Y)}},b$=($,D)=>jZ((J)=>{let K=q$(),X=_$.default($.command,$.args,D),Y=!1,V;return X.on("error",(F)=>{J(i(O("spawn",F,$)))}),X.on("exit",(...F)=>{V=F}),X.on("close",(...F)=>{if(Y)return;Y=!0,z$(K,$$(V??F))}),X.on("spawn",()=>{J($Z([X,K]))}),qZ(()=>{X.kill("SIGTERM")})}),XZ=($,D,J)=>{if(globalThis.process.platform==="win32")return jZ((K)=>{M$.exec(`taskkill /pid ${D.pid} /T /F`,{windowsHide:!0},(X)=>{if(X)return K(i(O("kill",R(X),$)));K(f)})});return K$({try:()=>{globalThis.process.kill(-D.pid,J)},catch:(K)=>O("kill",R(K),$)})},wZ=($,D,J)=>LZ(()=>{if(D.kill(J))return f;return i(O("kill",Error("Failed to kill child process"),$))}),N$=($,D,J)=>(K)=>{let X=J?.killSignal??"SIGTERM";if(L(J?.forceKillAfter))return K(D,$,X);return zZ(K(D,$,X),{duration:J.forceKillAfter,orElse:()=>K(D,$,"SIGKILL")})},W$=($,D)=>{let J=D??"stdout";switch(J){case"stdout":return $.stdout;case"stderr":return $.stderr;case"all":return $.all;default:{let K=g(J);return Z$(K)?$.getOutputFd(K):$.stdout}}},T=p(function*($){switch($._tag){case"StandardCommand":{let D=A($.options),J=G($.options,"stdout"),K=G($.options,"stderr"),X=b($.options),Y=yield*z($.options),[V,F]=yield*V$(b$($,{cwd:Y,env:B($.options),stdio:N(D,J,K,X),detached:$.options.detached??process.platform!=="win32",shell:$.options.shell,windowsHide:process.platform==="win32"}),p(function*([M,H]){let t=yield*WZ(H),n=N$(M,$,$.options);if(t){let[u]=yield*E(H);if(process.platform==="win32")return yield*f;if(u!==0&&ZZ(u))return yield*IZ(n(XZ));return yield*f}let w=(u)=>vZ(XZ($,M,u),()=>wZ($,M,u)),R$=$.options.killSignal??"SIGTERM",uZ=w(R$).pipe(l(E(H)),c),L$=$.options.forceKillAfter?zZ(uZ,{duration:$.options.forceKillAfter,orElse:()=>w("SIGKILL").pipe(l(E(H)),c)}):uZ;return yield*IZ(L$)})),_=yield*S($,V,X),y=VZ($,V,J,K),j=!0;return AZ({pid:UZ(V.pid),stdin:yield*QZ($,V,D),stdout:y.stdout,stderr:y.stderr,all:y.all,getInputFd:_.getInputFd,getOutputFd:_.getOutputFd,isRunning:h(WZ(F),(M)=>!M),exitCode:o(E(F),([M,H])=>{if(ZZ(M))return $Z(FZ(M));return i(O("exitCode",Error(`Process interrupted due to receipt of signal: '${H}'`),$))}),kill:(M)=>{let H=M?.killSignal??"SIGTERM",t=(w)=>vZ(XZ($,V,w),()=>wZ($,V,w)),n=t(H).pipe(l(E(F)),c);if(!M?.forceKillAfter)return n;return zZ(n,{duration:M.forceKillAfter,orElse:()=>t("SIGKILL").pipe(l(E(F)),c)})},unref:qZ(()=>{if(j)V.unref(),j=!1;return qZ(()=>{if(!j)V.ref(),j=!0})})})}case"PipedCommand":{let D=y$($),[J,...K]=D.commands,X=T(J);for(let Y=0;Y<K.length;Y++){let V=K[Y],F=D.opts[Y]??{},_=A(V.options),y=r(h(X,(H)=>W$(H,F.from))),j=F.to??"stdin";if(j==="stdin"){X=T(k(V.command,V.args,{...V.options,stdin:{..._,stream:y}}));continue}let M=g(j);if(L(M)){X=T(k(V.command,V.args,{...V.options,stdin:{..._,stream:y}}));continue}X=T(k(V.command,V.args,{...V.options,additionalFds:{...V.options.additionalFds,[NZ(M)]:{type:"input",stream:y}}}))}return yield*X}}});return GZ(T)}),i$=D$(W,f$),l$=i$.pipe(RZ(U$.layer),RZ(A$)),Bq=G$(async()=>{let{makeRuntime:Z}=await import("./chunk-vcrn3v70.js");return Z(W,l$)});var H$=(Z,q)=>P.gen(function*(){let z=yield*Z.spawn(q),[B,Q]=yield*P.all([v.mkString(v.decodeText(z.stdout)),v.mkString(v.decodeText(z.stderr))],{concurrency:2});return{code:yield*z.exitCode,text:B,stderr:Q}}).pipe(P.scoped),Mq=H$,_q=(Z,q,z)=>H$(Z,x.make("git",q,{cwd:z?.cwd,extendEnv:!0,stdin:"ignore"}));var TZ={};BZ(TZ,{payloads:()=>p$,define:()=>c$,BusEvent:()=>TZ});var O$=new Map;function c$(Z,q){let z={type:Z,properties:q};return O$.set(Z,z),z}function p$(){return O$.entries().map(([Z,q])=>{return SZ.object({type:SZ.literal(Z),properties:q.properties}).meta({ref:`Event.${q.type}`})}).toArray()}
|
|
5
5
|
export{W as qm,pZ as rm,x as sm,l$ as tm,H$ as um,Mq as vm,_q as wm,TZ as xm};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{gh as a,hh as b}from"./chunk-
|
|
2
|
+
import{gh as a,hh as b}from"./chunk-ddnpx1yx.js";import"./chunk-wfs4pcwa.js";import"./chunk-p68rwmhc.js";import"./chunk-0a0vat1h.js";import"./chunk-z8v2tsz2.js";import"./chunk-j8efst22.js";import"./chunk-a1pw9r6f.js";import"./chunk-d5bxan80.js";import"./chunk-pvpy9kq1.js";import"./chunk-wpajh5s5.js";import"./chunk-2ec6ps8r.js";import"./chunk-gj3hzx3d.js";import"./chunk-nj4d554m.js";import"./chunk-2gerf08b.js";import"./chunk-fqw4y7x0.js";import"./chunk-a1p2f16h.js";import"./chunk-nt4e3em9.js";import"./chunk-a0v55ywn.js";import"./chunk-v965rsr8.js";import"./chunk-1sgby720.js";import"./chunk-dcvatax2.js";import"./chunk-4tbwha3m.js";import"./chunk-m612agnk.js";import"./chunk-yq3m8190.js";import"./chunk-btz9jvec.js";import"./chunk-cqtkxwd8.js";import"./chunk-fkgv2hqd.js";import"./chunk-zyhdxggp.js";import"./chunk-q6ztpfcs.js";import"./chunk-jm1ptn8n.js";import"./chunk-c5e6sk9c.js";import"./chunk-m02zt1a3.js";import"./chunk-vg2fmyje.js";import"./chunk-sn4nez18.js";import"./chunk-42f7p0hq.js";import"./chunk-4qqkqrn9.js";import"./chunk-j6emx6jn.js";import"./chunk-be216spx.js";import"./chunk-12bssxd4.js";import"./chunk-z8r65yw3.js";import"./chunk-3szwfy7w.js";import"./chunk-whxjkz9a.js";import"./chunk-89v6dgpp.js";import"./chunk-k309zez0.js";import"./chunk-09kba1hg.js";import"./chunk-t12xrrfr.js";import"./chunk-phxrg7aw.js";import"./chunk-snm5q21k.js";import"./chunk-xpc2zgj7.js";import"./chunk-qjjch1zt.js";import"./chunk-aztre27e.js";export{b as AppRuntime,a as AppLayer};
|