@qitqode/qitqode-android-arm64 0.1.20 → 0.1.21
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-xb031er5.js → chunk-0942095s.js} +1 -1
- package/bundle/{chunk-0x0a51w3.js → chunk-0czxqcg7.js} +1 -1
- package/bundle/{chunk-9a5nck3f.js → chunk-1b9ey3yh.js} +1 -1
- package/bundle/{chunk-gspdrdyq.js → chunk-21q96fet.js} +1 -1
- package/bundle/{chunk-wnjg8mmh.js → chunk-21t254fq.js} +1 -1
- package/bundle/{chunk-zfvk6zjj.js → chunk-2db8pn5k.js} +1 -1
- package/bundle/{chunk-r2waj5n2.js → chunk-3gxhdy0c.js} +1 -1
- package/bundle/{chunk-471yj527.js → chunk-3m0t96kb.js} +1 -1
- package/bundle/{chunk-dp3hqm2m.js → chunk-4tk4wppp.js} +1 -1
- package/bundle/{chunk-p77m937s.js → chunk-5k1eyz7y.js} +1 -1
- package/bundle/{chunk-c4mxtqyq.js → chunk-5rcnwm9j.js} +1 -1
- package/bundle/{chunk-k728fzrr.js → chunk-5yghd32r.js} +1 -1
- package/bundle/{chunk-q39h31te.js → chunk-651fyxmn.js} +3 -3
- package/bundle/{chunk-7myavy3p.js → chunk-6ba9fc92.js} +1 -1
- package/bundle/{chunk-w0fg8n1f.js → chunk-6dznrhs4.js} +1 -1
- package/bundle/{chunk-knwayz0m.js → chunk-6t70j1wg.js} +1 -1
- package/bundle/{chunk-3makpbng.js → chunk-767vf2ha.js} +1 -1
- package/bundle/{chunk-k6z419yx.js → chunk-76p9v2jf.js} +1 -1
- package/bundle/{chunk-1brsnwhv.js → chunk-7hxksr4h.js} +1 -1
- package/bundle/{chunk-2w154wad.js → chunk-7jefvta3.js} +1 -1
- package/bundle/{chunk-fegrrsfj.js → chunk-7skp0dmg.js} +1 -1
- package/bundle/{chunk-1qw3yh13.js → chunk-88ckmmdr.js} +3 -3
- package/bundle/{chunk-0pbpzty2.js → chunk-8fn883z8.js} +1 -1
- package/bundle/{chunk-c422awkv.js → chunk-9gfe4wtk.js} +1 -1
- package/bundle/{chunk-rdsae6k4.js → chunk-9hwsz356.js} +1 -1
- package/bundle/{chunk-3fzgbam3.js → chunk-9vvvyk10.js} +1 -1
- package/bundle/{chunk-n0y1ea17.js → chunk-atg7cn5r.js} +1 -1
- package/bundle/{chunk-qq48ffjc.js → chunk-b3721b7c.js} +1 -1
- package/bundle/{chunk-nt07vncv.js → chunk-b4r19v4g.js} +1 -1
- package/bundle/{chunk-b2ky15zx.js → chunk-bsg92mw7.js} +1 -1
- package/bundle/{chunk-skjge2wh.js → chunk-bzj7yxw6.js} +1 -1
- package/bundle/{chunk-1gj0m10e.js → chunk-c1dwcsax.js} +1 -1
- package/bundle/{chunk-ysxmk1z1.js → chunk-c4vfxy1e.js} +1 -1
- package/bundle/{chunk-v7yvnnmr.js → chunk-esjs9s9g.js} +1 -1
- package/bundle/chunk-f2q7cbah.js +2 -0
- package/bundle/{chunk-mpn5qm9j.js → chunk-fssswy6j.js} +1 -1
- package/bundle/{chunk-4pedvzse.js → chunk-ghtm9598.js} +1 -1
- package/bundle/{chunk-p41h8naw.js → chunk-gkz68a5s.js} +1 -1
- package/bundle/{chunk-gfm4vad7.js → chunk-gp6nvjb8.js} +153 -153
- package/bundle/{chunk-6tjghyx6.js → chunk-hkydp4m3.js} +1 -1
- package/bundle/{chunk-hjvje9xj.js → chunk-htdpkk8v.js} +1 -1
- package/bundle/{chunk-ghmctw8s.js → chunk-hvnhkrd3.js} +1 -1
- package/bundle/{chunk-fgqrcjsm.js → chunk-hvqgvsa5.js} +1 -1
- package/bundle/{chunk-dgbvsnqb.js → chunk-js7becx7.js} +1 -1
- package/bundle/{chunk-5549c7mb.js → chunk-jwgqpntf.js} +1 -1
- package/bundle/{chunk-7nas10jx.js → chunk-k44dj66f.js} +1 -1
- package/bundle/{chunk-9g4hz1st.js → chunk-kvs7qbga.js} +1 -1
- package/bundle/{chunk-1q2vhe78.js → chunk-m7q12naw.js} +1 -1
- package/bundle/{chunk-pskkmca2.js → chunk-mc1m6dxk.js} +1 -1
- package/bundle/{chunk-anse7bd0.js → chunk-myjbd0vk.js} +1 -1
- package/bundle/{chunk-b49rxw15.js → chunk-n499tbz0.js} +1 -1
- package/bundle/{chunk-y36ggefa.js → chunk-n5k2c708.js} +1 -1
- package/bundle/{chunk-zafrxr1q.js → chunk-n6fh34xx.js} +1 -1
- package/bundle/{chunk-6bq7rx7m.js → chunk-n7a4wpjj.js} +1 -1
- package/bundle/{chunk-vh8w0ea8.js → chunk-ns0hezdf.js} +1 -1
- package/bundle/{chunk-pn77fh9b.js → chunk-q2zk0z41.js} +1 -1
- package/bundle/{chunk-s2g5989e.js → chunk-qh76pgsk.js} +1 -1
- package/bundle/{chunk-tp7sfreh.js → chunk-qxtz0tfd.js} +1 -1
- package/bundle/{chunk-3gdqmave.js → chunk-qy1s81tv.js} +2 -2
- package/bundle/{chunk-28knamc9.js → chunk-r03jc8xm.js} +1 -1
- package/bundle/{chunk-wmqcz5rb.js → chunk-rkb592nb.js} +1 -1
- package/bundle/{chunk-w8rvjbgr.js → chunk-s811ht10.js} +1 -1
- package/bundle/{chunk-8k1q3g8s.js → chunk-sj8py6vk.js} +1 -1
- package/bundle/{chunk-dvn528qs.js → chunk-t6dymkmx.js} +1 -1
- package/bundle/{chunk-jc0wbpjq.js → chunk-th5z0zx7.js} +1 -1
- package/bundle/chunk-tnn7hm4v.js +2 -0
- package/bundle/{chunk-aej69zjj.js → chunk-v0jnnpsz.js} +1 -1
- package/bundle/{chunk-f57rqsby.js → chunk-vdt8dvqs.js} +1 -1
- package/bundle/{chunk-0fwz5r1k.js → chunk-w2f8sjc4.js} +1 -1
- package/bundle/{chunk-rmmrnx95.js → chunk-w5nwkb0s.js} +1 -1
- package/bundle/{chunk-ckhhm2m8.js → chunk-w9mdrb90.js} +1 -1
- package/bundle/{chunk-xbxgrwvy.js → chunk-y7hkykkj.js} +1 -1
- package/bundle/{chunk-ej3gmaba.js → chunk-yja3y138.js} +1 -1
- package/bundle/{chunk-k5vwx1nv.js → chunk-yt6cfsdh.js} +1 -1
- package/bundle/index.js +3 -3
- package/bundle/worker.js +1 -1
- package/package.json +1 -1
- package/bundle/chunk-7pqevqry.js +0 -2
- package/bundle/chunk-p4pc1zdd.js +0 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{a as VB,b as XB}from"./chunk-
|
|
3
|
-
`+B}async function O(B){let V=i({baseUrl:B.url,fetch:B.fetch,directory:B.directory}),X=[{permission:"question",action:"deny",pattern:"*"},{permission:"plan_enter",action:"deny",pattern:"*"},{permission:"plan_exit",action:"deny",pattern:"*"}],Y=(await V.session.create({permission:X})).data?.id;if(!Y){H.error("headless: failed to create session");return}let W=await V.event.subscribe(),$=JB({sessionID:Y,query:async()=>{return(await V.session.status()).data?.[Y]}}),A=W.stream[Symbol.asyncIterator](),b=$.completion.then(()=>"DONE");(async()=>{try{while(!0){let z=await Promise.race([A.next(),b]);if(z==="DONE")break;let S=z;if(S.done)break;let M=S.value;$.onEvent(M);let G=M.properties;if(M.type==="message.part.updated"){let J=G?.part;if(!J||J.sessionID!==Y)continue;if(J.type==="text"&&J.time?.end){let q=String(J.text??"").trim();if(q)process.stdout.write(q+K)}}if(M.type==="permission.asked"){if(!G||G.sessionID!==Y)continue;await V.permission.reply({requestID:String(G.id),reply:"once"})}if(M.type==="session.error"){if(!G||G.sessionID!==Y||!G.error)continue;let J=G.error,q=J?.data!==null&&typeof J?.data==="object"&&"message"in J.data?String(J.data.message):String(J?.name??J);H.error(q)}}}finally{$.stop(),await A.return?.(void 0).catch(()=>{})}})().catch((z)=>{console.error(z),process.exit(1)});let P=B.model?a.parseModel(B.model):void 0;await V.session.prompt({sessionID:Y,agent:B.agent,model:P,parts:[{type:"text",text:B.prompt}]}),$.markStarted(),await $.completion}var uB=s({command:"$0 [project]",describe:"start qitqode tui",builder:(B)=>p(B).positional("project",{type:"string",describe:"path to start qitqode in"}).options(g).option("never-ask",{type:"boolean",describe:"start in never-ask mode \u2014 auto-decide without asking (permissions excluded), toggle at runtime with /never-ask",default:!1}).check((V)=>{if(V.dark&&V.light)throw Error("--dark and --light are mutually exclusive");if(V.sso&&!V.headless)throw Error("--sso requires --headless");if(V.sso&&V["api-key"]!==void 0)throw Error("--sso and --api-key are mutually exclusive");let X=Object.keys(YB).filter((Z)=>V[Z]);if(X.length>1)throw Error(`${X.map((Z)=>`--${Z}`).join(" and ")} are mutually exclusive \u2014 choose one tier flag`);if(X.length===1&&V.model)throw Error(`--${X[0]} and --model are mutually exclusive \u2014 use one or the other`);return!0}),handler:async(B)=>{if(B.monochrome)process.env.QITQODE_TUI_ACCESSIBLE="1",process.env.NO_COLOR="1";let V=r();try{t();let X=BB(B);if(X){H.error(X),process.exitCode=1;return}let Z=HB(B)??B.model,Y=N(process.env.PWD??process.cwd()),W=B.project?N(k.isAbsolute(B.project)?B.project:k.join(Y,B.project)):N(process.cwd()),$=h(W);if($){if(B.project){H.error("Cannot start in "+W+": "+$),process.exitCode=1;return}let J=N(WB.homedir());if(h(J)){H.error("Cannot start in "+W+": "+$),process.exitCode=1;return}F.warn("unsafe start directory, falling back to home",{requested:W,home:J}),W=J}let A=await MB();try{process.chdir(W)}catch{H.error("Failed to change directory to "+W);return}let b=N(process.cwd()),m=c({[v]:"worker",[d]:f()}),P=new Worker(A,{env:m});P.onerror=(J)=>{F.error("thread error",{message:J.message,filename:J.filename,lineno:J.lineno,colno:J.colno,error:J.error})};let z=l(P),S=()=>{z.call("reload",void 0).catch((J)=>{F.warn("worker reload failed",{error:y(J)})})};process.on("SIGUSR2",S);let M=!1,G=async()=>{if(M)return;M=!0,process.off("SIGUSR2",S),await n(z.call("shutdown",void 0),5000).catch((J)=>{F.warn("worker shutdown failed",{error:y(J)})}),P.terminate()};try{let J=import("./chunk-
|
|
2
|
+
import{a as VB,b as XB}from"./chunk-1b9ey3yh.js";import"./chunk-6t70j1wg.js";import"./chunk-f72j5yx8.js";import{z as BB}from"./chunk-39h565hz.js";import{A as t,C as r}from"./chunk-3w60y2x5.js";import{G as e}from"./chunk-21t254fq.js";import{L as JB}from"./chunk-hnzs3ywg.js";import"./chunk-9g05wsae.js";import"./chunk-x1dfc7qd.js";import{Od as s}from"./chunk-wmmck56g.js";import{Lf as p,Mf as T,Nf as R,Of as g}from"./chunk-hkydp4m3.js";import{Sf as H}from"./chunk-ntmn6epc.js";import{zg as o}from"./chunk-q2zk0z41.js";import{qh as x}from"./chunk-88ckmmdr.js";import"./chunk-w9mdrb90.js";import{Bh as i}from"./chunk-qxtz0tfd.js";import"./chunk-q6x5bmc3.js";import"./chunk-n1m5qdf5.js";import"./chunk-zeh3mjgp.js";import"./chunk-prrrw8t8.js";import"./chunk-tz8qhbk9.js";import"./chunk-k19zvbzh.js";import{Dj as L,Vk as a,Wj as n}from"./chunk-651fyxmn.js";import"./chunk-0czxqcg7.js";import{Ol as h}from"./chunk-6ba9fc92.js";import"./chunk-7skp0dmg.js";import"./chunk-c4x99ayd.js";import"./chunk-6dznrhs4.js";import"./chunk-8fn883z8.js";import"./chunk-w8xaw2dv.js";import"./chunk-tq258v8s.js";import"./chunk-th5z0zx7.js";import"./chunk-jfy6bfvv.js";import"./chunk-v0jnnpsz.js";import"./chunk-98nh88th.js";import"./chunk-t7v8wzr9.js";import"./chunk-er5q8nhp.js";import"./chunk-cqtkxwd8.js";import"./chunk-h6htvj2y.js";import"./chunk-2qy62cv4.js";import"./chunk-t2n6fmpy.js";import"./chunk-x1naayst.js";import"./chunk-ng85b73s.js";import"./chunk-351wfvhp.js";import"./chunk-hmm1m733.js";import"./chunk-yt6cfsdh.js";import"./chunk-yja3y138.js";import"./chunk-3nc9wy1m.js";import"./chunk-r8ddb02d.js";import"./chunk-dhvwrrqx.js";import"./chunk-56cty7nr.js";import{Es as I}from"./chunk-thbjhgw0.js";import{Js as d,Ks as v,Ls as f,Ns as c,Xs as l,gt as F}from"./chunk-esjs9s9g.js";import{Dt as u,Ft as N,pt as y}from"./chunk-b5x3zghc.js";import"./chunk-t1f7jeat.js";import"./chunk-tk6gjy9d.js";import"./chunk-pkdk0ppc.js";import"./chunk-hrnx60em.js";import"./chunk-bbznk59q.js";import"./chunk-01gtn79f.js";import{$H as D}from"./chunk-meaa7wrs.js";import"./chunk-0ddhkapd.js";import"./chunk-gvj8qg7x.js";import{pP as E}from"./chunk-fa03gsff.js";import k from"path";import{fileURLToPath as $B}from"url";import{writeHeapSnapshot as zB}from"v8";import WB,{EOL as K}from"os";var YB={free:"free",default:"default",fast:"fast",economy:"economical",power:"power"};function HB(B){for(let[V,X]of Object.entries(YB))if(B[V]){let Z=I[X];if(Z)return`${Z.providerID}/${Z.modelID}`}return}function GB(B){return async(X,Z)=>{let Y=new Request(X,Z),W=Y.body?await Y.text():void 0,$=await B.call("fetch",{url:Y.url,method:Y.method,headers:Object.fromEntries(Y.headers.entries()),body:W});return new Response($.body,{status:$.status,headers:$.headers})}}function KB(B){return{subscribe:async(V)=>{return B.on("global.event",(X)=>{V(X)})}}}async function MB(){if(typeof globalThis.QITQODE_WORKER_PATH<"u")return globalThis.QITQODE_WORKER_PATH;let B=new URL("./cli/cmd/tui/worker.js",import.meta.url);if(await u($B(B)))return B;return new URL("./worker.ts",import.meta.url)}async function QB(B){let V=process.stdin.isTTY?void 0:await Bun.stdin.text();if(!B)return V;if(!V)return B;return V+`
|
|
3
|
+
`+B}async function O(B){let V=i({baseUrl:B.url,fetch:B.fetch,directory:B.directory}),X=[{permission:"question",action:"deny",pattern:"*"},{permission:"plan_enter",action:"deny",pattern:"*"},{permission:"plan_exit",action:"deny",pattern:"*"}],Y=(await V.session.create({permission:X})).data?.id;if(!Y){H.error("headless: failed to create session");return}let W=await V.event.subscribe(),$=JB({sessionID:Y,query:async()=>{return(await V.session.status()).data?.[Y]}}),A=W.stream[Symbol.asyncIterator](),b=$.completion.then(()=>"DONE");(async()=>{try{while(!0){let z=await Promise.race([A.next(),b]);if(z==="DONE")break;let S=z;if(S.done)break;let M=S.value;$.onEvent(M);let G=M.properties;if(M.type==="message.part.updated"){let J=G?.part;if(!J||J.sessionID!==Y)continue;if(J.type==="text"&&J.time?.end){let q=String(J.text??"").trim();if(q)process.stdout.write(q+K)}}if(M.type==="permission.asked"){if(!G||G.sessionID!==Y)continue;await V.permission.reply({requestID:String(G.id),reply:"once"})}if(M.type==="session.error"){if(!G||G.sessionID!==Y||!G.error)continue;let J=G.error,q=J?.data!==null&&typeof J?.data==="object"&&"message"in J.data?String(J.data.message):String(J?.name??J);H.error(q)}}}finally{$.stop(),await A.return?.(void 0).catch(()=>{})}})().catch((z)=>{console.error(z),process.exit(1)});let P=B.model?a.parseModel(B.model):void 0;await V.session.prompt({sessionID:Y,agent:B.agent,model:P,parts:[{type:"text",text:B.prompt}]}),$.markStarted(),await $.completion}var uB=s({command:"$0 [project]",describe:"start qitqode tui",builder:(B)=>p(B).positional("project",{type:"string",describe:"path to start qitqode in"}).options(g).option("never-ask",{type:"boolean",describe:"start in never-ask mode \u2014 auto-decide without asking (permissions excluded), toggle at runtime with /never-ask",default:!1}).check((V)=>{if(V.dark&&V.light)throw Error("--dark and --light are mutually exclusive");if(V.sso&&!V.headless)throw Error("--sso requires --headless");if(V.sso&&V["api-key"]!==void 0)throw Error("--sso and --api-key are mutually exclusive");let X=Object.keys(YB).filter((Z)=>V[Z]);if(X.length>1)throw Error(`${X.map((Z)=>`--${Z}`).join(" and ")} are mutually exclusive \u2014 choose one tier flag`);if(X.length===1&&V.model)throw Error(`--${X[0]} and --model are mutually exclusive \u2014 use one or the other`);return!0}),handler:async(B)=>{if(B.monochrome)process.env.QITQODE_TUI_ACCESSIBLE="1",process.env.NO_COLOR="1";let V=r();try{t();let X=BB(B);if(X){H.error(X),process.exitCode=1;return}let Z=HB(B)??B.model,Y=N(process.env.PWD??process.cwd()),W=B.project?N(k.isAbsolute(B.project)?B.project:k.join(Y,B.project)):N(process.cwd()),$=h(W);if($){if(B.project){H.error("Cannot start in "+W+": "+$),process.exitCode=1;return}let J=N(WB.homedir());if(h(J)){H.error("Cannot start in "+W+": "+$),process.exitCode=1;return}F.warn("unsafe start directory, falling back to home",{requested:W,home:J}),W=J}let A=await MB();try{process.chdir(W)}catch{H.error("Failed to change directory to "+W);return}let b=N(process.cwd()),m=c({[v]:"worker",[d]:f()}),P=new Worker(A,{env:m});P.onerror=(J)=>{F.error("thread error",{message:J.message,filename:J.filename,lineno:J.lineno,colno:J.colno,error:J.error})};let z=l(P),S=()=>{z.call("reload",void 0).catch((J)=>{F.warn("worker reload failed",{error:y(J)})})};process.on("SIGUSR2",S);let M=!1,G=async()=>{if(M)return;M=!0,process.off("SIGUSR2",S),await n(z.call("shutdown",void 0),5000).catch((J)=>{F.warn("worker shutdown failed",{error:y(J)})}),P.terminate()};try{let J=import("./chunk-f2q7cbah.js"),q=import("./chunk-y7hkykkj.js").then(({TuiConfig:C})=>C.get()),U=await QB(B.prompt),ZB=await q;if(B.headless&&T(R(B))){H.error("--headless cannot be combined with network-listener flags (--port, --hostname, --mdns)"),process.exitCode=1;return}let w=R(B),_=T(w)?{url:(await z.call("server",w)).url,fetch:void 0,events:void 0}:{url:"http://qitqode.internal",fetch:GB(z),events:KB(z)};if(setTimeout(()=>{z.call("checkUpgrade",{directory:b}).catch(()=>{})},1000).unref?.(),B.headless){if(!U){H.error("--headless requires a prompt: pass --prompt or pipe input via stdin"),process.exitCode=1;return}if(B.sso){try{let Q=await o({tryOpen:!1,onCode:(j)=>{if(process.stdout.write(K),process.stdout.write(" To sign in, open: "+j.verificationUri+K),process.stdout.write(" and enter code: "+j.userCode+K),j.verificationUriComplete)process.stdout.write(K+" Or open this link directly:"+K+" "+j.verificationUriComplete+K);process.stdout.write(K+" Waiting for approval... (ctrl+c to cancel)"+K)}});await x.runPromise(D.gen(function*(){yield*(yield*L.Service).set("forgewise",e(Q,{rotateRefreshToken:!0}))})),process.stdout.write(" Signed in as "+(Q.name||Q.email)+K)}catch(Q){H.error("SSO sign-in failed: "+y(Q)),process.exitCode=1;return}await O({url:_.url,fetch:_.fetch,prompt:U,model:Z,agent:B.agent,directory:b});return}let C=VB(typeof B["api-key"]==="string"?String(B["api-key"]):"");if(C)await x.runPromise(XB(C));else if(!await x.runPromise(D.gen(function*(){return!!(yield*(yield*L.Service).get("forgewise"))}))){H.error(`Not signed in. Use one of:
|
|
4
4
|
qode auth login (browser / device-code flow)
|
|
5
5
|
qode auth login --api-key (paste a Qlex API key)
|
|
6
6
|
--api-key <key> (inline for this run)
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Ad as c,zd as l}from"./chunk-
|
|
2
|
+
import{Ad as c,zd as l}from"./chunk-bsg92mw7.js";import{Od as i}from"./chunk-wmmck56g.js";import{Lf as a}from"./chunk-hkydp4m3.js";import{Zf as n}from"./chunk-b3721b7c.js";import"./chunk-w5nwkb0s.js";import"./chunk-jwgqpntf.js";import"./chunk-q2zk0z41.js";import"./chunk-hkqcpdmt.js";import"./chunk-nfg7nt13.js";import"./chunk-awdpkgxf.js";import"./chunk-0942095s.js";import"./chunk-88ckmmdr.js";import"./chunk-w9mdrb90.js";import"./chunk-qxtz0tfd.js";import"./chunk-q6x5bmc3.js";import"./chunk-n1m5qdf5.js";import"./chunk-zeh3mjgp.js";import"./chunk-prrrw8t8.js";import"./chunk-tz8qhbk9.js";import"./chunk-k19zvbzh.js";import"./chunk-651fyxmn.js";import"./chunk-0czxqcg7.js";import"./chunk-6ba9fc92.js";import"./chunk-7skp0dmg.js";import"./chunk-c4x99ayd.js";import"./chunk-6dznrhs4.js";import"./chunk-8fn883z8.js";import"./chunk-w8xaw2dv.js";import"./chunk-tq258v8s.js";import"./chunk-th5z0zx7.js";import"./chunk-jfy6bfvv.js";import"./chunk-v0jnnpsz.js";import"./chunk-98nh88th.js";import"./chunk-t7v8wzr9.js";import"./chunk-er5q8nhp.js";import"./chunk-cqtkxwd8.js";import"./chunk-h6htvj2y.js";import"./chunk-2qy62cv4.js";import"./chunk-t2n6fmpy.js";import"./chunk-x1naayst.js";import"./chunk-ng85b73s.js";import"./chunk-351wfvhp.js";import"./chunk-hmm1m733.js";import"./chunk-yt6cfsdh.js";import"./chunk-yja3y138.js";import"./chunk-3nc9wy1m.js";import"./chunk-r8ddb02d.js";import"./chunk-dhvwrrqx.js";import"./chunk-56cty7nr.js";import"./chunk-thbjhgw0.js";import{dt as r}from"./chunk-esjs9s9g.js";import"./chunk-b5x3zghc.js";import"./chunk-t1f7jeat.js";import"./chunk-tk6gjy9d.js";import"./chunk-pkdk0ppc.js";import"./chunk-hrnx60em.js";import"./chunk-bbznk59q.js";import"./chunk-01gtn79f.js";import"./chunk-meaa7wrs.js";import"./chunk-0ddhkapd.js";import"./chunk-gvj8qg7x.js";import"./chunk-fa03gsff.js";var E=i({command:"serve",builder:(o)=>a(o).option("auto-password",{type:"boolean",default:!1,describe:"generate a random ephemeral QITQODE_SERVER_PASSWORD for this run and print it"}),describe:"starts a headless qitqode server",handler:async(o)=>{let s=await l(o);if(o["auto-password"]&&!r.QITQODE_SERVER_PASSWORD){let t=crypto.randomUUID();process.env.QITQODE_SERVER_PASSWORD=t,console.log('Generated ephemeral server password (basic auth, username "qitqode"):'),console.log(` ${t}`)}if(c(s,r.QITQODE_SERVER_PASSWORD))console.error("ERROR: Binding to non-loopback address without QITQODE_SERVER_PASSWORD is not allowed."),console.error("Set QITQODE_SERVER_PASSWORD, pass --auto-password, or pass --no-auth to override (DANGEROUS)."),process.exit(1);if(!r.QITQODE_SERVER_PASSWORD)console.error(""),console.error("\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557"),console.error("\u2551 WARNING: server is running WITHOUT authentication. \u2551"),console.error("\u2551 \u2551"),console.error("\u2551 Any process or browser page that can reach this address can read \u2551"),console.error("\u2551 project files, run shell commands, and open terminals as you. \u2551"),console.error("\u2551 \u2551"),console.error("\u2551 Set QITQODE_SERVER_PASSWORD, or restart with --auto-password to \u2551"),console.error("\u2551 generate an ephemeral password for this run. \u2551"),console.error("\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D"),console.error("");let e=await n.listen(s);console.log(`qitqode server listening on http://${e.hostname}:${e.port}`),await new Promise(()=>{}),await e.stop()}});export{E as ServeCommand};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Wg as D,ch as E,qh as x}from"./chunk-
|
|
2
|
+
import{Wg as D,ch as E,qh as x}from"./chunk-88ckmmdr.js";import{Pl as w}from"./chunk-6ba9fc92.js";import{mt as z}from"./chunk-esjs9s9g.js";var H=z.create({service:"cli.bootstrap"});async function P(F,G){return w.provide({directory:F,init:()=>x.runPromise(D),fn:async()=>{try{return await G()}finally{await x.runPromise(E.Service.use((q)=>q.drainWriters())).catch((q)=>H.warn("checkpoint drain failed",{error:String(q)})),await w.dispose()}}})}
|
|
3
3
|
export{P as Bd};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{et as a,ft as b,gt as c,ht as d,it as e,jt as f,kt as g,lt as h}from"./chunk-
|
|
2
|
+
import{et as a,ft as b,gt as c,ht as d,it as e,jt as f,kt as g,lt as h}from"./chunk-esjs9s9g.js";import"./chunk-b5x3zghc.js";import"./chunk-t1f7jeat.js";import"./chunk-tk6gjy9d.js";import"./chunk-pkdk0ppc.js";import"./chunk-hrnx60em.js";import"./chunk-bbznk59q.js";import"./chunk-01gtn79f.js";import"./chunk-meaa7wrs.js";import"./chunk-fa03gsff.js";export{g as redactValue,e as init,f as flush,d as file,b as enabled,h as create,a as Level,c as Default};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Fo as E,Go as e,Ho as I}from"./chunk-w0fg8n1f.js";import{Jo as b,Lo as g,Mo as n,Po as i,Qo as x,cp as _0,dp as O0,ep as N,fp as Z0}from"./chunk-0pbpzty2.js";import{mp as p}from"./chunk-tq258v8s.js";import{Gs as y,Is as t,ct as T,dt as X,mt as q}from"./chunk-v7yvnnmr.js";import{Ct as d,Gt as Q,nt as s}from"./chunk-b5x3zghc.js";import{It as w}from"./chunk-tk6gjy9d.js";import{Kt as G,Pt as c}from"./chunk-pkdk0ppc.js";import{$H as B,BN as M,jD as v,oJ as a,yF as L}from"./chunk-meaa7wrs.js";import{nP as F}from"./chunk-fa03gsff.js";var h={};F(h,{waitForDependencies:()=>R0,layer:()=>$0,get:()=>C0,defaultLayer:()=>j0,TuiConfig:()=>h,Service:()=>C,Info:()=>W0});import r from"path";var D={};F(D,{Keybinds:()=>Q0,ConfigKeybinds:()=>D});var _=(O,Z)=>M.String.pipe(M.optional,M.withDecodingDefault(B.succeed(O))).annotate({description:Z}),B0=process.platform==="win32"?"ctrl+z,ctrl+-,super+z":"ctrl+-,super+z",K0=M.Struct({leader:_("ctrl+x","Leader key for keybind combinations"),app_exit:_("ctrl+c,ctrl+d,<leader>q","Exit the application"),editor_open:_("<leader>e","Open external editor"),theme_list:_("<leader>t","List available themes"),sidebar_toggle:_("<leader>b","Toggle sidebar"),scrollbar_toggle:_("none","Toggle session scrollbar"),status_view:_("<leader>s","View status"),session_export:_("<leader>x","Export session to editor"),session_new:_("<leader>n","Create a new session"),session_list:_("<leader>l","List all sessions"),session_timeline:_("<leader>g","Show session timeline"),session_fork:_("none","Fork session from message"),session_rename:_("ctrl+r","Rename session"),session_delete:_("ctrl+d","Delete session"),stash_delete:_("ctrl+d","Delete stash entry"),model_provider_list:_("ctrl+a","Open provider list from model dialog"),model_favorite_toggle:_("ctrl+f","Toggle model favorite status"),session_share:_("none","Share current session"),session_unshare:_("none","Unshare current session"),session_interrupt:_("escape","Interrupt current session"),session_compact:_("<leader>c","Compact the session"),messages_page_up:_("pageup,ctrl+alt+b","Scroll messages up by one page"),messages_page_down:_("pagedown,ctrl+alt+f","Scroll messages down by one page"),messages_line_up:_("ctrl+alt+y","Scroll messages up by one line"),messages_line_down:_("ctrl+alt+e","Scroll messages down by one line"),messages_half_page_up:_("ctrl+alt+u","Scroll messages up by half page"),messages_half_page_down:_("ctrl+alt+d","Scroll messages down by half page"),messages_first:_("ctrl+g,home","Navigate to first message"),messages_last:_("ctrl+alt+g,end","Navigate to last message"),messages_next:_("none","Navigate to next message"),messages_previous:_("none","Navigate to previous message"),messages_last_user:_("none","Navigate to last user message"),messages_copy:_("<leader>y","Copy message"),messages_undo:_("<leader>u","Undo message"),messages_redo:_("<leader>r","Redo message"),messages_toggle_conceal:_("<leader>h","Toggle code block concealment in messages"),tool_details:_("none","Toggle tool details visibility"),model_list:_("<leader>m","List available models"),model_cycle_recent:_("f2","Next recently used model"),model_cycle_recent_reverse:_("shift+f2","Previous recently used model"),model_cycle_favorite:_("none","Next favorite model"),model_cycle_favorite_reverse:_("none","Previous favorite model"),command_list:_("ctrl+p","List available commands"),agent_list:_("<leader>a","List agents"),agent_cycle:_("alt+m","Next agent"),agent_cycle_reverse:_("alt+shift+m","Previous agent"),variant_cycle:_("ctrl+t","Cycle model variants"),variant_list:_("none","List model variants"),input_clear:_("ctrl+c","Clear input field"),input_paste:_("super+v,ctrl+v","Paste from clipboard"),input_submit:_("return","Submit input"),input_newline:_("shift+return,ctrl+return,alt+return,ctrl+j","Insert newline in input"),input_move_left:_("left,ctrl+b","Move cursor left in input"),input_move_right:_("right,ctrl+f","Move cursor right in input"),input_move_up:_("up","Move cursor up in input"),input_move_down:_("down","Move cursor down in input"),input_select_left:_("shift+left","Select left in input"),input_select_right:_("shift+right","Select right in input"),input_select_up:_("shift+up","Select up in input"),input_select_down:_("shift+down","Select down in input"),input_line_home:_("ctrl+a","Move to start of line in input"),input_line_end:_("ctrl+e","Move to end of line in input"),input_select_line_home:_("ctrl+shift+a","Select to start of line in input"),input_select_line_end:_("ctrl+shift+e","Select to end of line in input"),input_visual_line_home:_("alt+a","Move to start of visual line in input"),input_visual_line_end:_("alt+e","Move to end of visual line in input"),input_select_visual_line_home:_("alt+shift+a","Select to start of visual line in input"),input_select_visual_line_end:_("alt+shift+e","Select to end of visual line in input"),input_buffer_home:_("home","Move to start of buffer in input"),input_buffer_end:_("end","Move to end of buffer in input"),input_select_buffer_home:_("shift+home","Select to start of buffer in input"),input_select_buffer_end:_("shift+end","Select to end of buffer in input"),input_delete_line:_("ctrl+shift+d","Delete line in input"),input_delete_to_line_end:_("ctrl+k","Delete to end of line in input"),input_delete_to_line_start:_("ctrl+u","Delete to start of line in input"),input_backspace:_("backspace,shift+backspace","Backspace in input"),input_delete:_("ctrl+d,delete,shift+delete","Delete character in input"),input_undo:_(B0,"Undo in input"),input_redo:_("ctrl+.,super+shift+z","Redo in input"),input_word_forward:_("alt+f,alt+right,ctrl+right","Move word forward in input"),input_word_backward:_("alt+b,alt+left,ctrl+left","Move word backward in input"),input_select_word_forward:_("alt+shift+f,alt+shift+right","Select word forward in input"),input_select_word_backward:_("alt+shift+b,alt+shift+left","Select word backward in input"),input_delete_word_forward:_("alt+d,alt+delete,ctrl+delete","Delete word forward in input"),input_delete_word_backward:_("ctrl+w,ctrl+backspace,alt+backspace","Delete word backward in input"),history_previous:_("up","Previous history item"),history_next:_("down","Next history item"),session_child_first:_("<leader>down","Go to first child session"),session_child_cycle:_("right","Go to next child session"),session_child_cycle_reverse:_("left","Go to previous child session"),session_parent:_("up","Go to parent session"),terminal_suspend:_("ctrl+z","Suspend terminal"),terminal_title_toggle:_("none","Toggle terminal title"),tips_toggle:_("<leader>h","Toggle tips on home screen"),plugin_manager:_("none","Open plugin manager dialog"),display_thinking:_("none","Toggle thinking blocks visibility")}).annotate({identifier:"KeybindsConfig"}),Q0=p(K0);var V0=w.object(Object.fromEntries(Object.keys(D.Keybinds.shape).map((O)=>[O,w.string().optional()]))).strict(),R=w.object({scroll_speed:w.number().min(0.001).optional().describe("TUI scroll speed"),scroll_acceleration:w.object({enabled:w.boolean().describe("Enable scroll acceleration")}).optional().describe("Scroll acceleration settings"),diff_style:w.enum(["auto","stacked"]).optional().describe("Control diff rendering style: 'auto' adapts to terminal width, 'stacked' always shows single column"),mouse:w.boolean().optional().describe("Enable or disable mouse capture (default: true)"),accessible:w.boolean().optional().describe("Screen-reader friendly mode: linear main-screen rendering, no mouse capture, reduced motion, no sound (default: false)"),reduce_motion:w.boolean().optional().describe("Disable spinners and other animations, showing static text instead (default: false)"),sound:w.boolean().optional().describe("Enable or disable sound cues (default: true)"),announcements:w.enum(["quiet","normal","verbose"]).optional().describe("Verbosity of accessible-mode screen-reader announcements: 'quiet' announces only turn boundaries, errors, and stops; 'normal' adds tool-start lines; 'verbose' adds tool-completion lines (default: normal). Errors are always announced.")}),P=w.object({$schema:w.string().optional(),theme:w.string().optional(),keybinds:V0.optional(),plugin:I.Spec.zod.array().optional(),plugin_enabled:w.record(w.string(),w.boolean()).optional()}).extend(R.shape).strict();var H=q.create({service:"tui.migrate"}),Y0="https://qitqode.com/tui.json",D0=P.shape.theme.optional(),l=w.record(w.string(),w.unknown()).optional(),H0=w.object({scroll_speed:R.shape.scroll_speed.catch(void 0),scroll_acceleration:R.shape.scroll_acceleration.catch(void 0),diff_style:R.shape.diff_style.catch(void 0)}).strip();async function k(O){let Z=await N0(O);for(let W of Z){let j=await Q.readText(W).catch((o)=>{H.warn("failed to read config for tui migration",{path:W,error:o});return});if(!j)continue;let V=[],K=b(j,V,{allowTrailingComma:!0});if(V.length||!K||typeof K!=="object"||Array.isArray(K))continue;let $=D0.safeParse("theme"in K?K.theme:void 0),J=l.safeParse("keybinds"in K?K.keybinds:void 0),U=l.safeParse("tui"in K?K.tui:void 0),Y={theme:$.success?$.data:void 0,keybinds:J.success?J.data:void 0,tui:U.success?U.data:void 0},m=Y.tui?J0(Y.tui):void 0;if(Y.theme===void 0&&Y.keybinds===void 0&&!m)continue;let A=r.join(r.dirname(W),"tui.json");if(await Q.exists(A))continue;let z={$schema:Y0};if(Y.theme!==void 0)z.theme=Y.theme;if(Y.keybinds!==void 0)z.keybinds=Y.keybinds;if(m)Object.assign(z,m);if(!await Q.write(A,JSON.stringify(z,null,2)).then(()=>!0).catch((o)=>{return H.warn("failed to write tui migration target",{from:W,to:A,error:o}),!1}))continue;if(!await G0(W,j)){H.warn("tui config migrated but source file was not stripped",{from:W,to:A});continue}H.info("migrated tui config",{from:W,to:A})}}function J0(O){let Z=H0.parse(O);if(Z.scroll_speed===void 0&&Z.diff_style===void 0&&Z.scroll_acceleration===void 0)return;return Z}async function G0(O,Z){let W=O+".tui-migration.bak";if(!(await Q.exists(W)?!0:await Q.write(W,Z).then(()=>!0).catch(($)=>{return H.warn("failed to backup source config during tui migration",{path:O,backup:W,error:$}),!1})))return!1;let K=["theme","keybinds","tui"].reduce(($,J)=>{let U=g($,[J],void 0,{formattingOptions:{insertSpaces:!0,tabSize:2}});if(!U.length)return $;return n($,U)},Z);return Q.write(O,K).then(()=>{return H.info("stripped tui keys from server config",{path:O,backup:W}),!0}).catch(($)=>{return H.warn("failed to strip legacy tui keys from server config",{path:O,backup:W,error:$}),!1})}async function N0(O){let Z=[...N(T.Path.config,"qitqode"),...await Q.findUp(["qitqode.json","qitqode.jsonc"],O.cwd,void 0,{rootFirst:!0})];for(let j of G(O.directories))Z.push(...N(j,"qitqode"));if(X.QITQODE_CONFIG)Z.push(X.QITQODE_CONFIG);return(await Promise.all(G(Z).map(async(j)=>{return await Q.exists(j)?j:void 0}))).filter((j)=>!!j)}var f=v.Reference("CurrentWorkingDirectory",{defaultValue:()=>process.cwd()});var u=q.create({service:"tui.config"}),W0=P;class C extends v.Service()("@qitqode/TuiConfig"){}function U0(O,Z){if(Q.contains(Z.directory,O))return"local";return"global"}function A0(O){let Z={...O};if(!("tui"in Z))return Z;if(!s(Z.tui))return delete Z.tui,Z;let W=Z.tui;return delete Z.tui,{...W,...Z}}async function M0(O,Z){if(!O.plugin)return O;for(let W=0;W<O.plugin.length;W++)O.plugin[W]=await I.resolvePluginSpec(O.plugin[W],Z);return O}async function S(O,Z,W){let j=await z0(Z);if(O.result=c(O.result,j),!j.plugin?.length)return;let V=U0(Z,W),K=I.deduplicatePluginOrigins([...O.result.plugin_origins??[],...j.plugin.map(($)=>({spec:$,scope:V,source:Z}))]);O.result.plugin=K.map(($)=>$.spec),O.result.plugin_origins=K}var I0=B.fn("TuiConfig.loadState")(function*(O){let Z=yield*O0(O.directory);yield*B.promise(()=>k({directories:Z,cwd:O.directory}));let W=X.QITQODE_DISABLE_PROJECT_CONFIG?[]:yield*_0("tui",O.directory),j={result:{}};for(let $ of N(T.Path.config,"tui"))yield*B.promise(()=>S(j,$,O)).pipe(B.orDie);if(X.QITQODE_TUI_CONFIG){let $=X.QITQODE_TUI_CONFIG;yield*B.promise(()=>S(j,$,O)).pipe(B.orDie),u.debug("loaded custom tui config",{path:$})}for(let $ of W)yield*B.promise(()=>S(j,$,O)).pipe(B.orDie);let V=G(Z).filter(($)=>$.endsWith(".qitqode")||$===X.QITQODE_CONFIG_DIR);for(let $ of V){if(!$.endsWith(".qitqode")&&$!==X.QITQODE_CONFIG_DIR)continue;for(let J of N($,"tui"))yield*B.promise(()=>S(j,J,O)).pipe(B.orDie)}let K={...j.result.keybinds??{}};if(process.platform==="win32")K.terminal_suspend="none",K.input_undo??=G(["ctrl+z",...D.Keybinds.shape.input_undo.parse(void 0).split(",")]).join(",");return j.result.keybinds=D.Keybinds.parse(K),{config:j.result,dirs:j.result.plugin?.length?V:[]}}),$0=L.effect(C,B.gen(function*(){let O=yield*f,Z=yield*x.Service,W=yield*I0({directory:O}),j=yield*B.forEach(W.dirs,($)=>Z.install($,{add:[{name:"@qitqode/plugin",version:t?void 0:y}]}).pipe(B.forkScoped),{concurrency:"unbounded"}),V=B.fn("TuiConfig.get")(()=>B.succeed(W.config)),K=B.fn("TuiConfig.waitForDependencies")(()=>B.forEach(j,a.join,{concurrency:"unbounded"}).pipe(B.ignore(),B.asVoid));return C.of({get:V,waitForDependencies:K})}).pipe(B.withSpan("TuiConfig.layer"))),j0=$0.pipe(L.provide(x.defaultLayer),L.provide(d.defaultLayer)),{runPromise:w0}=i(C,j0);async function R0(){await w0((O)=>O.waitForDependencies())}async function C0(){return w0((O)=>O.get())}async function z0(O){let Z=await Z0(O);if(!Z)return{};return P0(Z,O).catch((W)=>{return u.warn("failed to load tui config",{path:O,error:W}),{}})}async function P0(O,Z){return e.substitute({text:O,type:"path",path:Z,missing:"empty"}).then((W)=>E.jsonc(W,Z)).then((W)=>{if(!s(W))return{};return E.schema(W0,A0(W),Z)}).then((W)=>M0(W,Z)).catch((W)=>{return u.warn("invalid tui config",{path:Z,error:W}),{}})}
|
|
2
|
+
import{Fo as E,Go as e,Ho as I}from"./chunk-6dznrhs4.js";import{Jo as b,Lo as g,Mo as n,Po as i,Qo as x,cp as _0,dp as O0,ep as G,fp as Z0}from"./chunk-8fn883z8.js";import{mp as p}from"./chunk-tq258v8s.js";import{Gs as t,Is as y,ct as T,dt as X,mt as q}from"./chunk-esjs9s9g.js";import{Ct as d,Gt as Q,nt as s}from"./chunk-b5x3zghc.js";import{It as w}from"./chunk-tk6gjy9d.js";import{Kt as A,Pt as c}from"./chunk-pkdk0ppc.js";import{$H as B,BN as M,jD as v,oJ as a,yF as o}from"./chunk-meaa7wrs.js";import{nP as F}from"./chunk-fa03gsff.js";var h={};F(h,{waitForDependencies:()=>R0,layer:()=>$0,get:()=>C0,defaultLayer:()=>j0,TuiConfig:()=>h,Service:()=>C,Info:()=>W0});import r from"path";var D={};F(D,{Keybinds:()=>Q0,ConfigKeybinds:()=>D});var _=(O,Z)=>M.String.pipe(M.optional,M.withDecodingDefault(B.succeed(O))).annotate({description:Z}),B0=process.platform==="win32"?"ctrl+z,ctrl+-,super+z":"ctrl+-,super+z",K0=M.Struct({leader:_("ctrl+x","Leader key for keybind combinations"),app_exit:_("ctrl+c,ctrl+d,<leader>q","Exit the application"),editor_open:_("<leader>e","Open external editor"),theme_list:_("<leader>t","List available themes"),sidebar_toggle:_("<leader>b","Toggle sidebar"),scrollbar_toggle:_("none","Toggle session scrollbar"),status_view:_("<leader>s","View status"),session_export:_("<leader>x","Export session to editor"),session_new:_("<leader>n","Create a new session"),session_list:_("<leader>l","List all sessions"),session_timeline:_("<leader>g","Show session timeline"),session_fork:_("none","Fork session from message"),session_rename:_("ctrl+r","Rename session"),session_delete:_("ctrl+d","Delete session"),stash_delete:_("ctrl+d","Delete stash entry"),model_provider_list:_("ctrl+a","Open provider list from model dialog"),model_favorite_toggle:_("ctrl+f","Toggle model favorite status"),session_share:_("none","Share current session"),session_unshare:_("none","Unshare current session"),session_interrupt:_("escape","Interrupt current session"),session_compact:_("<leader>c","Compact the session"),messages_page_up:_("pageup,ctrl+alt+b","Scroll messages up by one page"),messages_page_down:_("pagedown,ctrl+alt+f","Scroll messages down by one page"),messages_line_up:_("ctrl+alt+y","Scroll messages up by one line"),messages_line_down:_("ctrl+alt+e","Scroll messages down by one line"),messages_half_page_up:_("ctrl+alt+u","Scroll messages up by half page"),messages_half_page_down:_("ctrl+alt+d","Scroll messages down by half page"),messages_first:_("ctrl+g,home","Navigate to first message"),messages_last:_("ctrl+alt+g,end","Navigate to last message"),messages_next:_("none","Navigate to next message"),messages_previous:_("none","Navigate to previous message"),messages_last_user:_("none","Navigate to last user message"),messages_copy:_("<leader>y","Copy message"),messages_undo:_("<leader>u","Undo message"),messages_redo:_("<leader>r","Redo message"),messages_toggle_conceal:_("<leader>h","Toggle code block concealment in messages"),tool_details:_("none","Toggle tool details visibility"),model_list:_("<leader>m","List available models"),model_cycle_recent:_("f2","Next recently used model"),model_cycle_recent_reverse:_("shift+f2","Previous recently used model"),model_cycle_favorite:_("none","Next favorite model"),model_cycle_favorite_reverse:_("none","Previous favorite model"),command_list:_("ctrl+p","List available commands"),agent_list:_("<leader>a","List agents"),agent_cycle:_("alt+m","Next agent"),agent_cycle_reverse:_("alt+shift+m","Previous agent"),variant_cycle:_("ctrl+t","Cycle model variants"),variant_list:_("none","List model variants"),input_clear:_("ctrl+c","Clear input field"),input_paste:_("super+v,ctrl+v","Paste from clipboard"),input_submit:_("return","Submit input"),input_newline:_("shift+return,ctrl+return,alt+return,ctrl+j","Insert newline in input"),input_move_left:_("left,ctrl+b","Move cursor left in input"),input_move_right:_("right,ctrl+f","Move cursor right in input"),input_move_up:_("up","Move cursor up in input"),input_move_down:_("down","Move cursor down in input"),input_select_left:_("shift+left","Select left in input"),input_select_right:_("shift+right","Select right in input"),input_select_up:_("shift+up","Select up in input"),input_select_down:_("shift+down","Select down in input"),input_line_home:_("ctrl+a","Move to start of line in input"),input_line_end:_("ctrl+e","Move to end of line in input"),input_select_line_home:_("ctrl+shift+a","Select to start of line in input"),input_select_line_end:_("ctrl+shift+e","Select to end of line in input"),input_visual_line_home:_("alt+a","Move to start of visual line in input"),input_visual_line_end:_("alt+e","Move to end of visual line in input"),input_select_visual_line_home:_("alt+shift+a","Select to start of visual line in input"),input_select_visual_line_end:_("alt+shift+e","Select to end of visual line in input"),input_buffer_home:_("home","Move to start of buffer in input"),input_buffer_end:_("end","Move to end of buffer in input"),input_select_buffer_home:_("shift+home","Select to start of buffer in input"),input_select_buffer_end:_("shift+end","Select to end of buffer in input"),input_delete_line:_("ctrl+shift+d","Delete line in input"),input_delete_to_line_end:_("ctrl+k","Delete to end of line in input"),input_delete_to_line_start:_("ctrl+u","Delete to start of line in input"),input_backspace:_("backspace,shift+backspace","Backspace in input"),input_delete:_("ctrl+d,delete,shift+delete","Delete character in input"),input_undo:_(B0,"Undo in input"),input_redo:_("ctrl+.,super+shift+z","Redo in input"),input_word_forward:_("alt+f,alt+right,ctrl+right","Move word forward in input"),input_word_backward:_("alt+b,alt+left,ctrl+left","Move word backward in input"),input_select_word_forward:_("alt+shift+f,alt+shift+right","Select word forward in input"),input_select_word_backward:_("alt+shift+b,alt+shift+left","Select word backward in input"),input_delete_word_forward:_("alt+d,alt+delete,ctrl+delete","Delete word forward in input"),input_delete_word_backward:_("ctrl+w,ctrl+backspace,alt+backspace","Delete word backward in input"),history_previous:_("up","Previous history item"),history_next:_("down","Next history item"),session_child_first:_("<leader>down","Go to first child session"),session_child_cycle:_("right","Go to next child session"),session_child_cycle_reverse:_("left","Go to previous child session"),session_parent:_("up","Go to parent session"),terminal_suspend:_("ctrl+z","Suspend terminal"),terminal_title_toggle:_("none","Toggle terminal title"),tips_toggle:_("<leader>h","Toggle tips on home screen"),plugin_manager:_("none","Open plugin manager dialog"),display_thinking:_("none","Toggle thinking blocks visibility")}).annotate({identifier:"KeybindsConfig"}),Q0=p(K0);var V0=w.object(Object.fromEntries(Object.keys(D.Keybinds.shape).map((O)=>[O,w.string().optional()]))).strict(),R=w.object({scroll_speed:w.number().min(0.001).optional().describe("TUI scroll speed"),scroll_acceleration:w.object({enabled:w.boolean().describe("Enable scroll acceleration")}).optional().describe("Scroll acceleration settings"),diff_style:w.enum(["auto","stacked"]).optional().describe("Control diff rendering style: 'auto' adapts to terminal width, 'stacked' always shows single column"),mouse:w.boolean().optional().describe("Enable or disable mouse capture (default: true on desktop, false on Android/Termux)"),accessible:w.boolean().optional().describe("Screen-reader friendly mode: linear main-screen rendering, no mouse capture, reduced motion, no sound (default: false)"),reduce_motion:w.boolean().optional().describe("Disable spinners and other animations, showing static text instead (default: false)"),sound:w.boolean().optional().describe("Enable or disable sound cues (default: true)"),announcements:w.enum(["quiet","normal","verbose"]).optional().describe("Verbosity of accessible-mode screen-reader announcements: 'quiet' announces only turn boundaries, errors, and stops; 'normal' adds tool-start lines; 'verbose' adds tool-completion lines (default: normal). Errors are always announced.")}),P=w.object({$schema:w.string().optional(),theme:w.string().optional(),keybinds:V0.optional(),plugin:I.Spec.zod.array().optional(),plugin_enabled:w.record(w.string(),w.boolean()).optional()}).extend(R.shape).strict();var H=q.create({service:"tui.migrate"}),Y0="https://qitqode.com/tui.json",D0=P.shape.theme.optional(),l=w.record(w.string(),w.unknown()).optional(),H0=w.object({scroll_speed:R.shape.scroll_speed.catch(void 0),scroll_acceleration:R.shape.scroll_acceleration.catch(void 0),diff_style:R.shape.diff_style.catch(void 0)}).strip();async function k(O){let Z=await G0(O);for(let W of Z){let j=await Q.readText(W).catch((m)=>{H.warn("failed to read config for tui migration",{path:W,error:m});return});if(!j)continue;let V=[],K=b(j,V,{allowTrailingComma:!0});if(V.length||!K||typeof K!=="object"||Array.isArray(K))continue;let $=D0.safeParse("theme"in K?K.theme:void 0),J=l.safeParse("keybinds"in K?K.keybinds:void 0),N=l.safeParse("tui"in K?K.tui:void 0),Y={theme:$.success?$.data:void 0,keybinds:J.success?J.data:void 0,tui:N.success?N.data:void 0},L=Y.tui?J0(Y.tui):void 0;if(Y.theme===void 0&&Y.keybinds===void 0&&!L)continue;let U=r.join(r.dirname(W),"tui.json");if(await Q.exists(U))continue;let z={$schema:Y0};if(Y.theme!==void 0)z.theme=Y.theme;if(Y.keybinds!==void 0)z.keybinds=Y.keybinds;if(L)Object.assign(z,L);if(!await Q.write(U,JSON.stringify(z,null,2)).then(()=>!0).catch((m)=>{return H.warn("failed to write tui migration target",{from:W,to:U,error:m}),!1}))continue;if(!await A0(W,j)){H.warn("tui config migrated but source file was not stripped",{from:W,to:U});continue}H.info("migrated tui config",{from:W,to:U})}}function J0(O){let Z=H0.parse(O);if(Z.scroll_speed===void 0&&Z.diff_style===void 0&&Z.scroll_acceleration===void 0)return;return Z}async function A0(O,Z){let W=O+".tui-migration.bak";if(!(await Q.exists(W)?!0:await Q.write(W,Z).then(()=>!0).catch(($)=>{return H.warn("failed to backup source config during tui migration",{path:O,backup:W,error:$}),!1})))return!1;let K=["theme","keybinds","tui"].reduce(($,J)=>{let N=g($,[J],void 0,{formattingOptions:{insertSpaces:!0,tabSize:2}});if(!N.length)return $;return n($,N)},Z);return Q.write(O,K).then(()=>{return H.info("stripped tui keys from server config",{path:O,backup:W}),!0}).catch(($)=>{return H.warn("failed to strip legacy tui keys from server config",{path:O,backup:W,error:$}),!1})}async function G0(O){let Z=[...G(T.Path.config,"qitqode"),...await Q.findUp(["qitqode.json","qitqode.jsonc"],O.cwd,void 0,{rootFirst:!0})];for(let j of A(O.directories))Z.push(...G(j,"qitqode"));if(X.QITQODE_CONFIG)Z.push(X.QITQODE_CONFIG);return(await Promise.all(A(Z).map(async(j)=>{return await Q.exists(j)?j:void 0}))).filter((j)=>!!j)}var f=v.Reference("CurrentWorkingDirectory",{defaultValue:()=>process.cwd()});var u=q.create({service:"tui.config"}),W0=P;class C extends v.Service()("@qitqode/TuiConfig"){}function N0(O,Z){if(Q.contains(Z.directory,O))return"local";return"global"}function U0(O){let Z={...O};if(!("tui"in Z))return Z;if(!s(Z.tui))return delete Z.tui,Z;let W=Z.tui;return delete Z.tui,{...W,...Z}}async function M0(O,Z){if(!O.plugin)return O;for(let W=0;W<O.plugin.length;W++)O.plugin[W]=await I.resolvePluginSpec(O.plugin[W],Z);return O}async function S(O,Z,W){let j=await z0(Z);if(O.result=c(O.result,j),!j.plugin?.length)return;let V=N0(Z,W),K=I.deduplicatePluginOrigins([...O.result.plugin_origins??[],...j.plugin.map(($)=>({spec:$,scope:V,source:Z}))]);O.result.plugin=K.map(($)=>$.spec),O.result.plugin_origins=K}var I0=B.fn("TuiConfig.loadState")(function*(O){let Z=yield*O0(O.directory);yield*B.promise(()=>k({directories:Z,cwd:O.directory}));let W=X.QITQODE_DISABLE_PROJECT_CONFIG?[]:yield*_0("tui",O.directory),j={result:{}};for(let $ of G(T.Path.config,"tui"))yield*B.promise(()=>S(j,$,O)).pipe(B.orDie);if(X.QITQODE_TUI_CONFIG){let $=X.QITQODE_TUI_CONFIG;yield*B.promise(()=>S(j,$,O)).pipe(B.orDie),u.debug("loaded custom tui config",{path:$})}for(let $ of W)yield*B.promise(()=>S(j,$,O)).pipe(B.orDie);let V=A(Z).filter(($)=>$.endsWith(".qitqode")||$===X.QITQODE_CONFIG_DIR);for(let $ of V){if(!$.endsWith(".qitqode")&&$!==X.QITQODE_CONFIG_DIR)continue;for(let J of G($,"tui"))yield*B.promise(()=>S(j,J,O)).pipe(B.orDie)}let K={...j.result.keybinds??{}};if(process.platform==="win32")K.terminal_suspend="none",K.input_undo??=A(["ctrl+z",...D.Keybinds.shape.input_undo.parse(void 0).split(",")]).join(",");return j.result.keybinds=D.Keybinds.parse(K),{config:j.result,dirs:j.result.plugin?.length?V:[]}}),$0=o.effect(C,B.gen(function*(){let O=yield*f,Z=yield*x.Service,W=yield*I0({directory:O}),j=yield*B.forEach(W.dirs,($)=>Z.install($,{add:[{name:"@qitqode/plugin",version:y?void 0:t}]}).pipe(B.forkScoped),{concurrency:"unbounded"}),V=B.fn("TuiConfig.get")(()=>B.succeed(W.config)),K=B.fn("TuiConfig.waitForDependencies")(()=>B.forEach(j,a.join,{concurrency:"unbounded"}).pipe(B.ignore(),B.asVoid));return C.of({get:V,waitForDependencies:K})}).pipe(B.withSpan("TuiConfig.layer"))),j0=$0.pipe(o.provide(x.defaultLayer),o.provide(d.defaultLayer)),{runPromise:w0}=i(C,j0);async function R0(){await w0((O)=>O.waitForDependencies())}async function C0(){return w0((O)=>O.get())}async function z0(O){let Z=await Z0(O);if(!Z)return{};return P0(Z,O).catch((W)=>{return u.warn("failed to load tui config",{path:O,error:W}),{}})}async function P0(O,Z){return e.substitute({text:O,type:"path",path:Z,missing:"empty"}).then((W)=>E.jsonc(W,Z)).then((W)=>{if(!s(W))return{};return E.schema(W0,U0(W),Z)}).then((W)=>M0(W,Z)).catch((W)=>{return u.warn("invalid tui config",{path:Z,error:W}),{}})}
|
|
3
3
|
export{W0 as s,C as t,$0 as u,j0 as v,R0 as w,C0 as x,h as y};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Bd as s}from"./chunk-wmqcz5rb.js";import{Od as r}from"./chunk-wmmck56g.js";import{Ig as u,Jg as g,Sg as q,fh as z,gh as B,qh as i}from"./chunk-1qw3yh13.js";import"./chunk-ckhhm2m8.js";import"./chunk-tp7sfreh.js";import"./chunk-q6x5bmc3.js";import"./chunk-n1m5qdf5.js";import"./chunk-zeh3mjgp.js";import"./chunk-prrrw8t8.js";import"./chunk-tz8qhbk9.js";import"./chunk-k19zvbzh.js";import{Ik as f,Tj as G,Uj as V,Vk as x,Xj as S,dk as $,el as K,fl as J}from"./chunk-q39h31te.js";import"./chunk-0x0a51w3.js";import{Nl as R,Pl as p}from"./chunk-7myavy3p.js";import"./chunk-fegrrsfj.js";import"./chunk-c4x99ayd.js";import"./chunk-w0fg8n1f.js";import"./chunk-0pbpzty2.js";import"./chunk-w8xaw2dv.js";import"./chunk-tq258v8s.js";import"./chunk-jc0wbpjq.js";import"./chunk-jfy6bfvv.js";import"./chunk-aej69zjj.js";import"./chunk-98nh88th.js";import"./chunk-t7v8wzr9.js";import"./chunk-er5q8nhp.js";import"./chunk-cqtkxwd8.js";import"./chunk-h6htvj2y.js";import"./chunk-2qy62cv4.js";import"./chunk-t2n6fmpy.js";import"./chunk-x1naayst.js";import"./chunk-ng85b73s.js";import"./chunk-351wfvhp.js";import"./chunk-hmm1m733.js";import"./chunk-k5vwx1nv.js";import"./chunk-ej3gmaba.js";import"./chunk-3nc9wy1m.js";import"./chunk-r8ddb02d.js";import"./chunk-dhvwrrqx.js";import"./chunk-56cty7nr.js";import"./chunk-thbjhgw0.js";import{ct as U,mt as w}from"./chunk-v7yvnnmr.js";import"./chunk-b5x3zghc.js";import"./chunk-t1f7jeat.js";import"./chunk-tk6gjy9d.js";import"./chunk-pkdk0ppc.js";import"./chunk-hrnx60em.js";import"./chunk-bbznk59q.js";import"./chunk-01gtn79f.js";import{$H as c,AO as A}from"./chunk-meaa7wrs.js";import"./chunk-0ddhkapd.js";import"./chunk-gvj8qg7x.js";import{qP as v,rP as P}from"./chunk-fa03gsff.js";import{EOL as X}from"os";var k=r({command:"config",describe:"show resolved configuration",builder:(e)=>e,async handler(){await s(process.cwd(),async()=>{let e=await i.runPromise(J.Service.use((o)=>o.get()));process.stdout.write(JSON.stringify(e,null,2)+X)})}});import{EOL as y}from"os";var Y=r({command:"search <query>",describe:"search files by query",builder:(e)=>e.positional("query",{type:"string",demandOption:!0,description:"Search query"}),async handler(e){await s(process.cwd(),async()=>{let o=await i.runPromise(g.Service.use((t)=>t.search({query:e.query})));process.stdout.write(o.join(y)+y)})}}),Z=r({command:"read <path>",describe:"read file contents as JSON",builder:(e)=>e.positional("path",{type:"string",demandOption:!0,description:"File path to read"}),async handler(e){await s(process.cwd(),async()=>{let o=await i.runPromise(g.Service.use((t)=>t.read(e.path)));process.stdout.write(JSON.stringify(o,null,2)+y)})}}),H=r({command:"status",describe:"show file status information",builder:(e)=>e,async handler(){await s(process.cwd(),async()=>{let e=await i.runPromise(g.Service.use((o)=>o.status()));process.stdout.write(JSON.stringify(e,null,2)+y)})}}),ee=r({command:"list <path>",describe:"list files in a directory",builder:(e)=>e.positional("path",{type:"string",demandOption:!0,description:"File path to list"}),async handler(e){await s(process.cwd(),async()=>{let o=await i.runPromise(g.Service.use((t)=>t.list(e.path)));process.stdout.write(JSON.stringify(o,null,2)+y)})}}),oe=r({command:"tree [dir]",describe:"show directory tree",builder:(e)=>e.positional("dir",{type:"string",description:"Directory to tree",default:process.cwd()}),async handler(e){await s(process.cwd(),async()=>{let o=await i.runPromise(u.Service.use((t)=>t.tree({cwd:e.dir,limit:200})));console.log(JSON.stringify(o,null,2))})}}),L=r({command:"file",describe:"file system debugging utilities",builder:(e)=>e.command(Z).command(H).command(ee).command(Y).command(oe).demandCommand(),async handler(){}});import{EOL as D}from"os";var E=r({command:"lsp",describe:"LSP debugging utilities",builder:(e)=>e.command(te).command(re).command(ie).demandCommand(),async handler(){}}),te=r({command:"diagnostics <file>",describe:"get diagnostics for a file",builder:(e)=>e.positional("file",{type:"string",demandOption:!0}),async handler(e){await s(process.cwd(),async()=>{let o=await i.runPromise(S.Service.use((t)=>c.gen(function*(){return yield*t.touchFile(e.file,!0),yield*c.sleep(1000),yield*t.diagnostics()})));process.stdout.write(JSON.stringify(o,null,2)+D)})}}),re=r({command:"symbols <query>",describe:"search workspace symbols",builder:(e)=>e.positional("query",{type:"string",demandOption:!0}),async handler(e){await s(process.cwd(),async()=>{let n=[];try{const o=v(n,w.Default.time("symbols"),0);let t=await i.runPromise(S.Service.use((d)=>d.workspaceSymbol(e.query)));process.stdout.write(JSON.stringify(t,null,2)+D)}catch(a){var m=a,l=1}finally{P(n,m,l)}})}}),ie=r({command:"document-symbols <uri>",describe:"get symbols from a document",builder:(e)=>e.positional("uri",{type:"string",demandOption:!0}),async handler(e){await s(process.cwd(),async()=>{let n=[];try{const o=v(n,w.Default.time("document-symbols"),0);let t=await i.runPromise(S.Service.use((d)=>d.documentSymbol(e.uri)));process.stdout.write(JSON.stringify(t,null,2)+D)}catch(a){var m=a,l=1}finally{P(n,m,l)}})}});import{EOL as C}from"os";var F=r({command:"rg",describe:"ripgrep debugging utilities",builder:(e)=>e.command(se).command(ne).command(ae).demandCommand(),async handler(){}}),se=r({command:"tree",describe:"show file tree using ripgrep",builder:(e)=>e.option("limit",{type:"number"}),async handler(e){await s(process.cwd(),async()=>{let o=await i.runPromise(u.Service.use((t)=>t.tree({cwd:p.directory,limit:e.limit})));process.stdout.write(o+C)})}}),ne=r({command:"files",describe:"list files using ripgrep",builder:(e)=>e.option("query",{type:"string",description:"Filter files by query"}).option("glob",{type:"string",description:"Glob pattern to match files"}).option("limit",{type:"number",description:"Limit number of results"}),async handler(e){await s(process.cwd(),async()=>{let o=await i.runPromise(c.gen(function*(){return yield*(yield*u.Service).files({cwd:p.directory,glob:e.glob?[e.glob]:void 0}).pipe(A.take(e.limit??1/0),A.runCollect,c.map((n)=>[...n]))}));process.stdout.write(o.join(C)+C)})}}),ae=r({command:"search <pattern>",describe:"search file contents using ripgrep",builder:(e)=>e.positional("pattern",{type:"string",demandOption:!0,description:"Search pattern"}).option("glob",{type:"array",description:"File glob patterns"}).option("limit",{type:"number",description:"Limit number of results"}),async handler(e){await s(process.cwd(),async()=>{let o=await i.runPromise(u.Service.use((t)=>t.search({cwd:p.directory,pattern:e.pattern,glob:e.glob,limit:e.limit})));process.stdout.write(JSON.stringify(o.items,null,2)+C)})}});import{EOL as me}from"os";var T=r({command:"scrap",describe:"list all known projects",builder:(e)=>e,async handler(){let e=w.Default.time("scrap"),o=await R.list();process.stdout.write(JSON.stringify(o,null,2)+me),e.stop()}});import{EOL as ce}from"os";var j=r({command:"skill",describe:"list all available skills",builder:(e)=>e,async handler(){await s(process.cwd(),async()=>{let e=await i.runPromise(c.gen(function*(){return yield*(yield*q.Service).all()}));process.stdout.write(JSON.stringify(e,null,2)+ce)})}});var M=r({command:"snapshot",describe:"snapshot debugging utilities",builder:(e)=>e.command(de).command(le).command(pe).demandCommand(),async handler(){}}),I=(e)=>s(process.cwd(),async()=>{console.log(await i.runPromise($.Service.use(e)))}),_=(e)=>e.positional("hash",{type:"string",description:"hash",demandOption:!0}),de=r({command:"track",describe:"track current snapshot state",async handler(){await I((e)=>e.track())}}),le=r({command:"patch <hash>",describe:"show patch for a snapshot hash",builder:_,async handler(e){await I((o)=>o.patch(e.hash))}}),pe=r({command:"diff <hash>",describe:"show diff for a snapshot hash",builder:_,async handler(e){await I((o)=>o.diff(e.hash))}});import{EOL as b}from"os";import{basename as ue}from"path";var Q=r({command:"agent <name>",describe:"show agent configuration details",builder:(e)=>e.positional("name",{type:"string",demandOption:!0,description:"Agent name"}).option("tool",{type:"string",description:"Tool id to execute"}).option("params",{type:"string",description:"Tool params as a JSON object"}),async handler(e){await s(process.cwd(),async()=>{let o=e.name,t=await i.runPromise(B.Service.use((d)=>d.get(o)));if(!t)process.stderr.write(`Agent ${o} not found, run '${ue(process.execPath)} agent list' to get an agent list`+b),process.exit(1);let n=await fe(t),a=await ye(t,n),m=e.tool;if(m){let d=n.find((W)=>W.id===m);if(!d)process.stderr.write(`Tool ${m} not found for agent ${o}`+b),process.exit(1);if(a[m]===!1)process.stderr.write(`Tool ${m} is disabled for agent ${o}`+b),process.exit(1);let h=ge(e.params),O=await we(t),N=await d.execute(h,O);process.stdout.write(JSON.stringify({tool:m,input:h,result:N},null,2)+b);return}let l={...t,tools:a};process.stdout.write(JSON.stringify(l,null,2)+b)})}});async function fe(e){return i.runPromise(c.gen(function*(){let o=yield*x.Service,t=yield*z.Service,n=e.model??(yield*o.defaultModel());return yield*t.tools({...n,agent:e})}))}async function ye(e,o){let t=f.disabled(o.map((a)=>a.id),e.permission),n={};for(let a of o)n[a.id]=!t.has(a.id);return n}function ge(e){if(!e)return{};let o=e.trim();if(o.length===0)return{};let t=(()=>{try{return JSON.parse(o)}catch{throw Error("Failed to parse --params. Provide a valid JSON object.")}})();if(!t||typeof t!=="object"||Array.isArray(t))throw Error("Tool params must be an object.");return t}async function we(e){let{session:o,messageID:t}=await i.runPromise(c.gen(function*(){let a=yield*K.Service,m=yield*a.create({title:`Debug tool run (${e.name})`}),l=G.ascending(),d=e.model?e.model:yield*c.gen(function*(){return yield*(yield*x.Service).defaultModel()}),h=Date.now(),O={id:l,sessionID:m.id,role:"assistant",time:{created:h},parentID:l,modelID:d.modelID,providerID:d.providerID,mode:"debug",agent:e.name,path:{cwd:p.directory,root:p.worktree},cost:0,tokens:{input:0,output:0,reasoning:0,cache:{read:0,write:0}}};return yield*a.updateMessage(O),{session:m,messageID:l}})),n=f.merge(e.permission,o.permission??[]);return{sessionID:o.id,messageID:t,callID:V.ascending(),agent:e.name,abort:new AbortController().signal,messages:[],metadata:()=>c.void,ask(a){return c.sync(()=>{for(let m of a.patterns)if(f.evaluate(a.permission,m,n).action==="deny")throw new f.DeniedError({ruleset:n})})}}}var jo=r({command:"debug",describe:"debugging and troubleshooting tools",builder:(e)=>e.command(k).command(E).command(F).command(L).command(T).command(j).command(M).command(Q).command(be).command({command:"wait",describe:"wait indefinitely (for debugging)",async handler(){await s(process.cwd(),async()=>{await new Promise((o)=>setTimeout(o,86400000))})}}).demandCommand(),async handler(){}}),be=r({command:"paths",describe:"show global paths (data, config, cache, state)",handler(){for(let[e,o]of Object.entries(U.Path))console.log(e.padEnd(10),o)}});export{jo as DebugCommand};
|
|
2
|
+
import{Bd as s}from"./chunk-rkb592nb.js";import{Od as r}from"./chunk-wmmck56g.js";import{Ig as u,Jg as g,Sg as q,fh as z,gh as B,qh as i}from"./chunk-88ckmmdr.js";import"./chunk-w9mdrb90.js";import"./chunk-qxtz0tfd.js";import"./chunk-q6x5bmc3.js";import"./chunk-n1m5qdf5.js";import"./chunk-zeh3mjgp.js";import"./chunk-prrrw8t8.js";import"./chunk-tz8qhbk9.js";import"./chunk-k19zvbzh.js";import{Ik as f,Tj as G,Uj as V,Vk as x,Xj as S,dk as $,el as K,fl as J}from"./chunk-651fyxmn.js";import"./chunk-0czxqcg7.js";import{Nl as R,Pl as p}from"./chunk-6ba9fc92.js";import"./chunk-7skp0dmg.js";import"./chunk-c4x99ayd.js";import"./chunk-6dznrhs4.js";import"./chunk-8fn883z8.js";import"./chunk-w8xaw2dv.js";import"./chunk-tq258v8s.js";import"./chunk-th5z0zx7.js";import"./chunk-jfy6bfvv.js";import"./chunk-v0jnnpsz.js";import"./chunk-98nh88th.js";import"./chunk-t7v8wzr9.js";import"./chunk-er5q8nhp.js";import"./chunk-cqtkxwd8.js";import"./chunk-h6htvj2y.js";import"./chunk-2qy62cv4.js";import"./chunk-t2n6fmpy.js";import"./chunk-x1naayst.js";import"./chunk-ng85b73s.js";import"./chunk-351wfvhp.js";import"./chunk-hmm1m733.js";import"./chunk-yt6cfsdh.js";import"./chunk-yja3y138.js";import"./chunk-3nc9wy1m.js";import"./chunk-r8ddb02d.js";import"./chunk-dhvwrrqx.js";import"./chunk-56cty7nr.js";import"./chunk-thbjhgw0.js";import{ct as U,mt as w}from"./chunk-esjs9s9g.js";import"./chunk-b5x3zghc.js";import"./chunk-t1f7jeat.js";import"./chunk-tk6gjy9d.js";import"./chunk-pkdk0ppc.js";import"./chunk-hrnx60em.js";import"./chunk-bbznk59q.js";import"./chunk-01gtn79f.js";import{$H as c,AO as A}from"./chunk-meaa7wrs.js";import"./chunk-0ddhkapd.js";import"./chunk-gvj8qg7x.js";import{qP as v,rP as P}from"./chunk-fa03gsff.js";import{EOL as X}from"os";var k=r({command:"config",describe:"show resolved configuration",builder:(e)=>e,async handler(){await s(process.cwd(),async()=>{let e=await i.runPromise(J.Service.use((o)=>o.get()));process.stdout.write(JSON.stringify(e,null,2)+X)})}});import{EOL as y}from"os";var Y=r({command:"search <query>",describe:"search files by query",builder:(e)=>e.positional("query",{type:"string",demandOption:!0,description:"Search query"}),async handler(e){await s(process.cwd(),async()=>{let o=await i.runPromise(g.Service.use((t)=>t.search({query:e.query})));process.stdout.write(o.join(y)+y)})}}),Z=r({command:"read <path>",describe:"read file contents as JSON",builder:(e)=>e.positional("path",{type:"string",demandOption:!0,description:"File path to read"}),async handler(e){await s(process.cwd(),async()=>{let o=await i.runPromise(g.Service.use((t)=>t.read(e.path)));process.stdout.write(JSON.stringify(o,null,2)+y)})}}),H=r({command:"status",describe:"show file status information",builder:(e)=>e,async handler(){await s(process.cwd(),async()=>{let e=await i.runPromise(g.Service.use((o)=>o.status()));process.stdout.write(JSON.stringify(e,null,2)+y)})}}),ee=r({command:"list <path>",describe:"list files in a directory",builder:(e)=>e.positional("path",{type:"string",demandOption:!0,description:"File path to list"}),async handler(e){await s(process.cwd(),async()=>{let o=await i.runPromise(g.Service.use((t)=>t.list(e.path)));process.stdout.write(JSON.stringify(o,null,2)+y)})}}),oe=r({command:"tree [dir]",describe:"show directory tree",builder:(e)=>e.positional("dir",{type:"string",description:"Directory to tree",default:process.cwd()}),async handler(e){await s(process.cwd(),async()=>{let o=await i.runPromise(u.Service.use((t)=>t.tree({cwd:e.dir,limit:200})));console.log(JSON.stringify(o,null,2))})}}),L=r({command:"file",describe:"file system debugging utilities",builder:(e)=>e.command(Z).command(H).command(ee).command(Y).command(oe).demandCommand(),async handler(){}});import{EOL as D}from"os";var E=r({command:"lsp",describe:"LSP debugging utilities",builder:(e)=>e.command(te).command(re).command(ie).demandCommand(),async handler(){}}),te=r({command:"diagnostics <file>",describe:"get diagnostics for a file",builder:(e)=>e.positional("file",{type:"string",demandOption:!0}),async handler(e){await s(process.cwd(),async()=>{let o=await i.runPromise(S.Service.use((t)=>c.gen(function*(){return yield*t.touchFile(e.file,!0),yield*c.sleep(1000),yield*t.diagnostics()})));process.stdout.write(JSON.stringify(o,null,2)+D)})}}),re=r({command:"symbols <query>",describe:"search workspace symbols",builder:(e)=>e.positional("query",{type:"string",demandOption:!0}),async handler(e){await s(process.cwd(),async()=>{let n=[];try{const o=v(n,w.Default.time("symbols"),0);let t=await i.runPromise(S.Service.use((d)=>d.workspaceSymbol(e.query)));process.stdout.write(JSON.stringify(t,null,2)+D)}catch(a){var m=a,l=1}finally{P(n,m,l)}})}}),ie=r({command:"document-symbols <uri>",describe:"get symbols from a document",builder:(e)=>e.positional("uri",{type:"string",demandOption:!0}),async handler(e){await s(process.cwd(),async()=>{let n=[];try{const o=v(n,w.Default.time("document-symbols"),0);let t=await i.runPromise(S.Service.use((d)=>d.documentSymbol(e.uri)));process.stdout.write(JSON.stringify(t,null,2)+D)}catch(a){var m=a,l=1}finally{P(n,m,l)}})}});import{EOL as C}from"os";var F=r({command:"rg",describe:"ripgrep debugging utilities",builder:(e)=>e.command(se).command(ne).command(ae).demandCommand(),async handler(){}}),se=r({command:"tree",describe:"show file tree using ripgrep",builder:(e)=>e.option("limit",{type:"number"}),async handler(e){await s(process.cwd(),async()=>{let o=await i.runPromise(u.Service.use((t)=>t.tree({cwd:p.directory,limit:e.limit})));process.stdout.write(o+C)})}}),ne=r({command:"files",describe:"list files using ripgrep",builder:(e)=>e.option("query",{type:"string",description:"Filter files by query"}).option("glob",{type:"string",description:"Glob pattern to match files"}).option("limit",{type:"number",description:"Limit number of results"}),async handler(e){await s(process.cwd(),async()=>{let o=await i.runPromise(c.gen(function*(){return yield*(yield*u.Service).files({cwd:p.directory,glob:e.glob?[e.glob]:void 0}).pipe(A.take(e.limit??1/0),A.runCollect,c.map((n)=>[...n]))}));process.stdout.write(o.join(C)+C)})}}),ae=r({command:"search <pattern>",describe:"search file contents using ripgrep",builder:(e)=>e.positional("pattern",{type:"string",demandOption:!0,description:"Search pattern"}).option("glob",{type:"array",description:"File glob patterns"}).option("limit",{type:"number",description:"Limit number of results"}),async handler(e){await s(process.cwd(),async()=>{let o=await i.runPromise(u.Service.use((t)=>t.search({cwd:p.directory,pattern:e.pattern,glob:e.glob,limit:e.limit})));process.stdout.write(JSON.stringify(o.items,null,2)+C)})}});import{EOL as me}from"os";var T=r({command:"scrap",describe:"list all known projects",builder:(e)=>e,async handler(){let e=w.Default.time("scrap"),o=await R.list();process.stdout.write(JSON.stringify(o,null,2)+me),e.stop()}});import{EOL as ce}from"os";var j=r({command:"skill",describe:"list all available skills",builder:(e)=>e,async handler(){await s(process.cwd(),async()=>{let e=await i.runPromise(c.gen(function*(){return yield*(yield*q.Service).all()}));process.stdout.write(JSON.stringify(e,null,2)+ce)})}});var M=r({command:"snapshot",describe:"snapshot debugging utilities",builder:(e)=>e.command(de).command(le).command(pe).demandCommand(),async handler(){}}),I=(e)=>s(process.cwd(),async()=>{console.log(await i.runPromise($.Service.use(e)))}),_=(e)=>e.positional("hash",{type:"string",description:"hash",demandOption:!0}),de=r({command:"track",describe:"track current snapshot state",async handler(){await I((e)=>e.track())}}),le=r({command:"patch <hash>",describe:"show patch for a snapshot hash",builder:_,async handler(e){await I((o)=>o.patch(e.hash))}}),pe=r({command:"diff <hash>",describe:"show diff for a snapshot hash",builder:_,async handler(e){await I((o)=>o.diff(e.hash))}});import{EOL as b}from"os";import{basename as ue}from"path";var Q=r({command:"agent <name>",describe:"show agent configuration details",builder:(e)=>e.positional("name",{type:"string",demandOption:!0,description:"Agent name"}).option("tool",{type:"string",description:"Tool id to execute"}).option("params",{type:"string",description:"Tool params as a JSON object"}),async handler(e){await s(process.cwd(),async()=>{let o=e.name,t=await i.runPromise(B.Service.use((d)=>d.get(o)));if(!t)process.stderr.write(`Agent ${o} not found, run '${ue(process.execPath)} agent list' to get an agent list`+b),process.exit(1);let n=await fe(t),a=await ye(t,n),m=e.tool;if(m){let d=n.find((W)=>W.id===m);if(!d)process.stderr.write(`Tool ${m} not found for agent ${o}`+b),process.exit(1);if(a[m]===!1)process.stderr.write(`Tool ${m} is disabled for agent ${o}`+b),process.exit(1);let h=ge(e.params),O=await we(t),N=await d.execute(h,O);process.stdout.write(JSON.stringify({tool:m,input:h,result:N},null,2)+b);return}let l={...t,tools:a};process.stdout.write(JSON.stringify(l,null,2)+b)})}});async function fe(e){return i.runPromise(c.gen(function*(){let o=yield*x.Service,t=yield*z.Service,n=e.model??(yield*o.defaultModel());return yield*t.tools({...n,agent:e})}))}async function ye(e,o){let t=f.disabled(o.map((a)=>a.id),e.permission),n={};for(let a of o)n[a.id]=!t.has(a.id);return n}function ge(e){if(!e)return{};let o=e.trim();if(o.length===0)return{};let t=(()=>{try{return JSON.parse(o)}catch{throw Error("Failed to parse --params. Provide a valid JSON object.")}})();if(!t||typeof t!=="object"||Array.isArray(t))throw Error("Tool params must be an object.");return t}async function we(e){let{session:o,messageID:t}=await i.runPromise(c.gen(function*(){let a=yield*K.Service,m=yield*a.create({title:`Debug tool run (${e.name})`}),l=G.ascending(),d=e.model?e.model:yield*c.gen(function*(){return yield*(yield*x.Service).defaultModel()}),h=Date.now(),O={id:l,sessionID:m.id,role:"assistant",time:{created:h},parentID:l,modelID:d.modelID,providerID:d.providerID,mode:"debug",agent:e.name,path:{cwd:p.directory,root:p.worktree},cost:0,tokens:{input:0,output:0,reasoning:0,cache:{read:0,write:0}}};return yield*a.updateMessage(O),{session:m,messageID:l}})),n=f.merge(e.permission,o.permission??[]);return{sessionID:o.id,messageID:t,callID:V.ascending(),agent:e.name,abort:new AbortController().signal,messages:[],metadata:()=>c.void,ask(a){return c.sync(()=>{for(let m of a.patterns)if(f.evaluate(a.permission,m,n).action==="deny")throw new f.DeniedError({ruleset:n})})}}}var jo=r({command:"debug",describe:"debugging and troubleshooting tools",builder:(e)=>e.command(k).command(E).command(F).command(L).command(T).command(j).command(M).command(Q).command(be).command({command:"wait",describe:"wait indefinitely (for debugging)",async handler(){await s(process.cwd(),async()=>{await new Promise((o)=>setTimeout(o,86400000))})}}).demandCommand(),async handler(){}}),be=r({command:"paths",describe:"show global paths (data, config, cache, state)",handler(){for(let[e,o]of Object.entries(U.Path))console.log(e.padEnd(10),o)}});export{jo as DebugCommand};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{ct as n}from"./chunk-
|
|
2
|
+
import{ct as n}from"./chunk-esjs9s9g.js";import{pP as f}from"./chunk-fa03gsff.js";function l(t){if(!t?.fetch)t={...t,fetch:(s)=>{return s.timeout=!1,fetch(s)}};if(t?.directory)t.headers={...t.headers,"x-qitqode-directory":encodeURIComponent(t.directory)};return t}import o from"path";function g(t){if(t?.type!=="api"||typeof t.key!=="string")return;let s=t.metadata?.method==="api-key"?"api-key":"sso";return{key:t.key,method:s}}async function E(){let t=o.join(n.Path.data,"auth.json");try{let{readFile:u}=await import("fs/promises"),s=await u(t,"utf8"),e=JSON.parse(s),r=g(e?.forgewise);if(r)return r}catch{}if(process.env.QITQODE_AUTH_CONTENT)try{let u=JSON.parse(process.env.QITQODE_AUTH_CONTENT);return g(u?.forgewise)}catch{}return}async function A(){let t=o.join(n.Path.data,"auth.json"),{readFile:u,writeFile:s}=await import("fs/promises"),e=await u(t,"utf8"),r=JSON.parse(e);if(!("forgewise"in r))return;delete r.forgewise,await s(t,JSON.stringify(r,null,2),"utf8")}function b(t){return t.method==="api-key"?{"x-api-key":t.key}:{authorization:`Bearer ${t.key}`}}
|
|
3
3
|
export{l as np,E as op,A as pp,b as qp};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{el as a}from"./chunk-651fyxmn.js";import"./chunk-0czxqcg7.js";import"./chunk-6ba9fc92.js";import"./chunk-7skp0dmg.js";import"./chunk-c4x99ayd.js";import"./chunk-6dznrhs4.js";import"./chunk-8fn883z8.js";import"./chunk-w8xaw2dv.js";import"./chunk-tq258v8s.js";import"./chunk-th5z0zx7.js";import"./chunk-jfy6bfvv.js";import"./chunk-v0jnnpsz.js";import"./chunk-98nh88th.js";import"./chunk-t7v8wzr9.js";import"./chunk-er5q8nhp.js";import"./chunk-cqtkxwd8.js";import"./chunk-h6htvj2y.js";import"./chunk-2qy62cv4.js";import"./chunk-t2n6fmpy.js";import"./chunk-x1naayst.js";import"./chunk-ng85b73s.js";import"./chunk-yt6cfsdh.js";import"./chunk-yja3y138.js";import"./chunk-3nc9wy1m.js";import"./chunk-r8ddb02d.js";import"./chunk-dhvwrrqx.js";import"./chunk-56cty7nr.js";import"./chunk-thbjhgw0.js";import"./chunk-esjs9s9g.js";import"./chunk-b5x3zghc.js";import"./chunk-t1f7jeat.js";import"./chunk-tk6gjy9d.js";import"./chunk-pkdk0ppc.js";import"./chunk-hrnx60em.js";import"./chunk-bbznk59q.js";import"./chunk-01gtn79f.js";import"./chunk-meaa7wrs.js";import"./chunk-gvj8qg7x.js";import"./chunk-fa03gsff.js";export{a as Session};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Bs as i}from"./chunk-dhvwrrqx.js";import{ct as o}from"./chunk-
|
|
2
|
+
import{Bs as i}from"./chunk-dhvwrrqx.js";import{ct as o}from"./chunk-esjs9s9g.js";import{lP as c}from"./chunk-fa03gsff.js";var e=c(i(),1);import p from"path";function l(n,t){let r=t?.PATH??t?.Path??process.env.PATH??process.env.Path??"",h=r?r+p.delimiter+o.Path.bin:o.Path.bin,s=e.default.sync(n,{nothrow:!0,path:h,pathExt:t?.PATHEXT??t?.PathExt??process.env.PATHEXT??process.env.PathExt});return typeof s==="string"?s:null}
|
|
3
3
|
export{l as sp};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Vf as a,Wf as b,Xf as c,Yf as d,Zf as e}from"./chunk-
|
|
2
|
+
import{Vf as a,Wf as b,Xf as c,Yf as d,Zf as e}from"./chunk-b3721b7c.js";import"./chunk-w5nwkb0s.js";import"./chunk-jwgqpntf.js";import"./chunk-q2zk0z41.js";import"./chunk-hkqcpdmt.js";import"./chunk-nfg7nt13.js";import"./chunk-awdpkgxf.js";import"./chunk-0942095s.js";import"./chunk-88ckmmdr.js";import"./chunk-w9mdrb90.js";import"./chunk-qxtz0tfd.js";import"./chunk-q6x5bmc3.js";import"./chunk-n1m5qdf5.js";import"./chunk-zeh3mjgp.js";import"./chunk-prrrw8t8.js";import"./chunk-tz8qhbk9.js";import"./chunk-k19zvbzh.js";import"./chunk-651fyxmn.js";import"./chunk-0czxqcg7.js";import"./chunk-6ba9fc92.js";import"./chunk-7skp0dmg.js";import"./chunk-c4x99ayd.js";import"./chunk-6dznrhs4.js";import"./chunk-8fn883z8.js";import"./chunk-w8xaw2dv.js";import"./chunk-tq258v8s.js";import"./chunk-th5z0zx7.js";import"./chunk-jfy6bfvv.js";import"./chunk-v0jnnpsz.js";import"./chunk-98nh88th.js";import"./chunk-t7v8wzr9.js";import"./chunk-er5q8nhp.js";import"./chunk-cqtkxwd8.js";import"./chunk-h6htvj2y.js";import"./chunk-2qy62cv4.js";import"./chunk-t2n6fmpy.js";import"./chunk-x1naayst.js";import"./chunk-ng85b73s.js";import"./chunk-351wfvhp.js";import"./chunk-hmm1m733.js";import"./chunk-yt6cfsdh.js";import"./chunk-yja3y138.js";import"./chunk-3nc9wy1m.js";import"./chunk-r8ddb02d.js";import"./chunk-dhvwrrqx.js";import"./chunk-56cty7nr.js";import"./chunk-thbjhgw0.js";import"./chunk-esjs9s9g.js";import"./chunk-b5x3zghc.js";import"./chunk-t1f7jeat.js";import"./chunk-tk6gjy9d.js";import"./chunk-pkdk0ppc.js";import"./chunk-hrnx60em.js";import"./chunk-bbznk59q.js";import"./chunk-01gtn79f.js";import"./chunk-meaa7wrs.js";import"./chunk-0ddhkapd.js";import"./chunk-gvj8qg7x.js";import"./chunk-fa03gsff.js";export{c as url,b as openapi,d as listen,e as Server,a as Default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{il as a,jl as b,kl as c,ll as d,ml as e,nl as f,ol as g,pl as h,ql as i}from"./chunk-
|
|
2
|
+
import{il as a,jl as b,kl as c,ll as d,ml as e,nl as f,ol as g,pl as h,ql as i}from"./chunk-0czxqcg7.js";import"./chunk-7skp0dmg.js";import"./chunk-w8xaw2dv.js";import"./chunk-jfy6bfvv.js";import"./chunk-3nc9wy1m.js";import"./chunk-esjs9s9g.js";import"./chunk-b5x3zghc.js";import"./chunk-t1f7jeat.js";import"./chunk-tk6gjy9d.js";import"./chunk-pkdk0ppc.js";import"./chunk-hrnx60em.js";import"./chunk-bbznk59q.js";import"./chunk-01gtn79f.js";import"./chunk-meaa7wrs.js";import"./chunk-fa03gsff.js";export{i as stopRefresh,h as startRefresh,g as refresh,d as readModelCatalogResponse,f as get,c as Provider,b as Model,a as MODEL_CATALOG_MAX_BYTES,e as Data};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Nj as s,Sj as e,Tj as j,Uj as v,ek as u,fk as f}from"./chunk-
|
|
2
|
+
import{Nj as s,Sj as e,Tj as j,Uj as v,ek as u,fk as f}from"./chunk-651fyxmn.js";import{Fl as D,Jl as b,Kl as a,Ll as t,wl as r,xl as C,yl as k,zl as m}from"./chunk-6ba9fc92.js";import{cn as x,dn as q,fn as n,gn as o,in as K,kn as c,rn as i}from"./chunk-c4x99ayd.js";import{ct as O_,mt as Q_}from"./chunk-esjs9s9g.js";import{Bt as d,Gt as g}from"./chunk-b5x3zghc.js";import{nP as S_}from"./chunk-fa03gsff.js";var l={};S_(l,{run:()=>h_,encodeDir:()=>k_,ClaudeImport:()=>l});import E_ from"path";import W_ from"path";import{access as X_,readFile as Y_}from"fs/promises";var G=n("external_import",{source:q().$type().notNull(),source_key:q().notNull(),session_id:q().$type().notNull(),source_path:q().notNull(),source_mtime:x().notNull(),time_imported:x().notNull(),message_ids:q({mode:"json"}).$type()},(N)=>[o({columns:[N.source,N.source_key]})]);function Z_(){return{scanned:0,imported:0,resynced:0,skipped:0,errors:[]}}async function L_(N){if(!N||!await g.exists(N))return{id:b.global,worktree:N||"/",vcs:null};if(!await a(N))return{id:b.global,worktree:N,vcs:null};return{id:await t(N),worktree:N,vcs:"git"}}function __(N){return N.split(`
|
|
3
3
|
`).map((_)=>_.trim()).filter(Boolean).flatMap((_)=>{try{return[JSON.parse(_)]}catch{return[]}})}function N_(N){let _=N.find((H)=>H.trim()&&!H.trim().startsWith("<"));if(!_)return;return _.trim().replace(/\s+/g," ").slice(0,100)}function R_(N,_){return D.use((H)=>H.select().from(G).where(c(K(G.source,N),K(G.source_key,_))).get())}function G_(N,_){if(!_)return{existing:void 0,existingUpdated:void 0};let H=_,O=D.use((Z)=>Z.select({updated:C.time_updated}).from(C).where(K(C.id,H.session_id)).get());if(!O)return D.use((Z)=>Z.delete(G).where(c(K(G.source,N),K(G.source_key,H.source_key))).run()),{existing:void 0,existingUpdated:void 0};return{existing:_,existingUpdated:O.updated}}function J_(N,_,H,O){N.insert(r).values({id:_.id,worktree:_.worktree,vcs:_.vcs,sandboxes:[],time_created:H,time_updated:O}).onConflictDoNothing().run()}function K_(N,_,H){if(_.message_ids?.length)for(let O=0;O<_.message_ids.length;O+=500)N.delete(k).where(i(k.id,_.message_ids.slice(O,O+500))).run();else N.delete(k).where(K(k.session_id,H)).run()}function A_(N,_,H){N.update(C).set({project_id:H.projectId,directory:H.directory,version:H.version,time_updated:Math.max(H.existingUpdated??0,H.timeUpdated)}).where(K(C.id,_)).run()}function $_(N){return async(_)=>F_({...N,force:_?.force})}async function F_(N){let _=Z_();if(!await X_(N.root).then(()=>!0).catch(()=>!1))return _;let H=await d.scan(N.pattern,{cwd:N.root,absolute:!0});for(let O of H){_.scanned++;try{let Z=W_.basename(O,".jsonl"),A=await g.statAsync(O);if(!A){_.skipped++;continue}let F=Math.floor(Number(A.mtimeMs)),Y=R_(N.source,Z);if(Y&&Y.source_mtime===F&&!N.force){_.skipped++;continue}let S=G_(N.source,Y);Y=S.existing;let T=S.existingUpdated,Q=Y?Y.session_id:e.descending(),V=N.parse(await Y_(O,"utf-8"),Q);if(!V||V.messages.length===0){_.skipped++;continue}let E=await L_(V.cwd),U=Date.now(),X=V.messages.map(($)=>$.info.id);if(D.transaction(($)=>{if(J_($,E,V.timeCreated,V.timeUpdated),Y)K_($,Y,Q),A_($,Q,{projectId:E.id,directory:V.cwd,version:V.version,existingUpdated:T,timeUpdated:V.timeUpdated});else $.insert(C).values({id:Q,project_id:E.id,slug:s.create(),directory:V.cwd,title:V.title,version:V.version,time_created:V.timeCreated,time_updated:V.timeUpdated}).run();for(let L of V.messages){let{id:B,sessionID:I,agentID:w,...z}=L.info;$.insert(k).values({id:B,session_id:Q,agent_id:"main",time_created:L.info.time.created,data:z}).onConflictDoUpdate({target:k.id,set:{data:z}}).run();for(let J of L.parts){let{id:y,sessionID:p,messageID:P,...h}=J.part;$.insert(m).values({id:y,message_id:L.info.id,session_id:Q,time_created:J.time,data:h}).onConflictDoUpdate({target:m.id,set:{data:h}}).run()}}$.insert(G).values({source:N.source,source_key:Z,session_id:Q,source_path:O,source_mtime:F,time_imported:U,message_ids:X}).onConflictDoUpdate({target:[G.source,G.source_key],set:{session_id:Q,source_path:O,source_mtime:F,time_imported:U,message_ids:X}}).run()}),Y)_.resynced++;else _.imported++}catch(Z){_.errors.push(`${O}: ${Z}`)}}if(_.imported+_.resynced>0||_.errors.length>0)N.log.info(N.logMessage,{..._,errors:_.errors.length});return _}var B_=Q_.create({service:"claude-import"});function k_(N){return N.replace(/[^a-zA-Z0-9]/g,"-")}function z_(N){if(!N)return{providerID:u.anthropic,modelID:f.make("unknown")};let _=N.indexOf("/");if(_===-1)return{providerID:u.anthropic,modelID:f.make(N)};return{providerID:u.make(N.slice(0,_)),modelID:f.make(N.slice(_+1))}}function H_(N){let _=N??{};return{input:_.input_tokens??0,output:_.output_tokens??0,reasoning:0,cache:{read:_.cache_read_input_tokens??0,write:_.cache_creation_input_tokens??0}}}function C_(N){if(typeof N==="string")return N;if(Array.isArray(N))return N.map((_)=>_&&typeof _==="object"&&("type"in _)&&_.type==="text"?_.text:JSON.stringify(_)).join(`
|
|
4
4
|
`);return N==null?"":JSON.stringify(N)}function U_(N,_){let H=__(N);if(H.length===0)return;let O,Z,A,F=0,Y,S=[],T=new Map,Q=null,V=null,E=z_(void 0),U=()=>{if(Q)S.push(Q);Q=null};for(let X of H){if(X.type!=="user"&&X.type!=="assistant")continue;let $=X.timestamp?Date.parse(X.timestamp):Date.now();if(!O&&X.cwd)O=X.cwd;if(!Z&&X.version)Z=X.version;if(A===void 0)A=$;F=Math.max(F,$);let L=X.message;if(!L)continue;if(X.type==="user"){let z=L.content,J=typeof z==="string"?[]:Array.isArray(z)?z:[];for(let W of J.filter((R)=>R?.type==="tool_result")){let R=T.get(W.tool_use_id);if(!R)continue;let M=C_(W.content);R.part.state=W.is_error?{status:"error",input:R.part.state.input??{},error:M,time:{start:R.start,end:$}}:{status:"completed",input:R.part.state.input??{},output:M,title:R.part.tool,metadata:{},time:{start:R.start,end:$}}}let y=typeof z==="string"?z.trim()?[z]:[]:J.filter((W)=>W?.type==="text"&&typeof W.text==="string"&&W.text.trim()).map((W)=>W.text),p=J.filter((W)=>W?.type==="image"&&W.source);if(y.length===0&&p.length===0)continue;U();let P=j.ascending(),h=[];for(let W of y)h.push({part:{id:v.ascending(),sessionID:_,messageID:P,type:"text",text:W},time:$});for(let W of p){let R=W.source.media_type??"image/png",M=W.source.type==="base64"?`data:${R};base64,${W.source.data}`:W.source.url??"";if(M)h.push({part:{id:v.ascending(),sessionID:_,messageID:P,type:"file",mime:R,url:M},time:$})}let V_={id:P,sessionID:_,role:"user",agent:"main",time:{created:$},model:{providerID:E.providerID,modelID:E.modelID}};if(S.push({info:V_,parts:h}),V=P,!Y)Y=N_(y);continue}let B=z_(L.model);if(E=B,!V){let z=j.ascending();S.push({info:{id:z,sessionID:_,role:"user",agent:"main",time:{created:$},model:{providerID:B.providerID,modelID:B.modelID}},parts:[]}),V=z}if(!Q||Q.info.role!=="assistant"||Q.info.parentID!==V)U(),Q={info:{id:j.ascending(),sessionID:_,role:"assistant",time:{created:$,completed:$},parentID:V,modelID:B.modelID,providerID:B.providerID,mode:"build",agent:"main",path:{cwd:O??X.cwd??"",root:O??X.cwd??""},cost:0,tokens:H_(L.usage)},parts:[]};let I=Q.info;I.time.completed=$,I.tokens=H_(L.usage);let w=Q.info.id;for(let z of Array.isArray(L.content)?L.content:[])if(z?.type==="thinking"||z?.type==="reasoning")Q.parts.push({part:{id:v.ascending(),sessionID:_,messageID:w,type:"reasoning",text:z.thinking??z.text??"",time:{start:$,end:$}},time:$});else if(z?.type==="text"&&typeof z.text==="string")Q.parts.push({part:{id:v.ascending(),sessionID:_,messageID:w,type:"text",text:z.text},time:$});else if(z?.type==="tool_use"){let J={id:v.ascending(),sessionID:_,messageID:w,type:"tool",callID:z.id,tool:z.name,state:{status:"pending",input:z.input??{},raw:JSON.stringify(z.input??{})}};Q.parts.push({part:J,time:$}),T.set(z.id,{part:J,start:$})}}return U(),{cwd:O??"",version:Z??"claude-code",title:Y??"Claude Code session",timeCreated:A??Date.now(),timeUpdated:F||A||Date.now(),messages:S}}var h_=$_({source:"cc",root:E_.join(O_.Path.home,".claude","projects"),pattern:"*/*.jsonl",log:B_,logMessage:"claude import",parse:U_});
|
|
5
5
|
export{G as _f,Z_ as $f,L_ as ag,__ as bg,N_ as cg,R_ as dg,G_ as eg,J_ as fg,K_ as gg,A_ as hg,$_ as ig,k_ as jg,h_ as kg,l as lg};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Xk as C}from"./chunk-
|
|
2
|
+
import{Xk as C}from"./chunk-651fyxmn.js";import{ul as J$}from"./chunk-6ba9fc92.js";import{$l as X$}from"./chunk-7skp0dmg.js";import{It as k}from"./chunk-tk6gjy9d.js";import{$H as j,FF as $$,GE as r,TF as f$,vD as e}from"./chunk-meaa7wrs.js";import{mP as M,nP as M$}from"./chunk-fa03gsff.js";var l=M((l$,R)=>{var z$=["||","&&",";;","|&","<(","<<<",">>",">&","<&","&",";","(",")","|","<",">"],S=/[\n\r\u2028\u2029]/,W$=/[\s#!"$&'():;<=>@\\^`|]/g;R.exports=function(J){return J.map(function($){if($==="")return"''";if($&&typeof $==="object"){if($.op==="glob"){if(typeof $.pattern!=="string")throw TypeError("glob token requires a string `pattern`");if(S.test($.pattern))throw TypeError("glob `pattern` must not contain line terminators");return $.pattern.replace(W$,"\\$&")}if(typeof $.op==="string"){if(z$.indexOf($.op)<0)throw TypeError("invalid `op` value: "+JSON.stringify($.op));return $.op.replace(/[\s\S]/g,"\\$&")}if(typeof $.comment==="string"){if(S.test($.comment))throw TypeError("`comment` must not contain line terminators");return"#"+$.comment}throw TypeError("unrecognized object token shape")}if(/["\s\\]/.test($)&&!/'/.test($))return"'"+$.replace(/(['])/g,"\\$1")+"'";if(/["'\s]/.test($))return'"'+$.replace(/(["\\$`!])/g,"\\$1")+'"';return String($).replace(/([A-Za-z]:)?([#!"$&'()*,:;<=>?@[\\\]^`{|}])/g,"$1\\$2")}).join(" ")}});var i=M((p$,E)=>{var n="(?:"+["\\|\\|","\\&\\&",";;","\\|\\&","\\<\\(","\\<\\<\\<",">>",">\\&","<\\&","[&;()|<>]"].join("|")+")",p=new RegExp("^"+n+"$"),O="|&;()<> \\t",P$='"((\\\\"|[^"])*?)"',g$="'((\\\\'|[^'])*?)'",G$=/^#$/,h="'",T='"',D="$",L="",L$=4294967296;for(x=0;x<4;x++)L+=(L$*Math.random()).toString(16);var x,U$=new RegExp("^"+L);function Q$(f,J){var $=J.lastIndex,Z=[],w;while(w=J.exec(f))if(Z.push(w),J.lastIndex===w.index)J.lastIndex+=1;return J.lastIndex=$,Z}function V$(f,J,$){var Z=typeof f==="function"?f($):f[$];if(typeof Z>"u"&&$!="")Z="";else if(typeof Z>"u")Z="$";if(typeof Z==="object")return J+L+JSON.stringify(Z)+L;return J+Z}function Y$(f,J,$){if(!$)$={};var Z=$.escape||"\\",w="(\\"+Z+`['"`+O+`]|[^\\s'"`+O+"])+",z=new RegExp(["("+n+")","("+w+"|"+P$+"|"+g$+")+"].join("|"),"g"),P=Q$(f,z);if(P.length===0)return[];if(!J)J={};var U=!1;return P.map(function(g){var X=g[0];if(!X||U)return;if(p.test(X))return{op:X};var Q=!1,y=!1,W="",F=!1,q;function A(){q+=1;var G,V,K=X.charAt(q);if(K==="{"){if(q+=1,X.charAt(q)==="}")throw Error("Bad substitution: "+X.slice(q-2,q+1));if(G=X.indexOf("}",q),G<0)throw Error("Bad substitution: "+X.slice(q));V=X.slice(q,G),q=G}else if(/[*@#?$!_-]/.test(K))V=K,q+=1;else{var B=X.slice(q);if(G=B.match(/[^\w\d_]/),!G)V=B,q=X.length;else V=B.slice(0,G.index),q+=G.index-1}return V$(J,"",V)}for(q=0;q<X.length;q++){var H=X.charAt(q);if(F=F||!Q&&(H==="*"||H==="?"),y)W+=H,y=!1;else if(Q)if(H===Q)Q=!1;else if(Q==h)W+=H;else if(H===Z)if(q+=1,H=X.charAt(q),H===T||H===Z||H===D)W+=H;else W+=Z+H;else if(H===D)W+=A();else W+=H;else if(H===T||H===h)Q=H;else if(p.test(H))return{op:X};else if(G$.test(H)){U=!0;var u={comment:f.slice(g.index+q+1)};if(W.length)return[W,u];return[u]}else if(H===Z)y=!0;else if(H===D)W+=A();else W+=H}if(F)return{op:"glob",pattern:W};return W}).reduce(function(g,X){return typeof X>"u"?g:g.concat(X)},[])}E.exports=function(J,$,Z){var w=Y$(J,$,Z);if(typeof $!=="function")return w;return w.reduce(function(z,P){if(typeof P==="object")return z.concat(P);var U=P.split(RegExp("("+L+".*?"+L+")","g"));if(U.length===1)return z.concat(U[0]);return z.concat(U.filter(Boolean).map(function(g){if(U$.test(g))return JSON.parse(g.split(L)[1]);return g}))},[])}});var y$=M((x$)=>{x$.quote=l();x$.parse=i()});var _={};M$(_,{retryable:()=>q$,policy:()=>R$,persistentRetryDelay:()=>S$,isRetryableTransientError:()=>w$,delay:()=>H$,SessionRetry:()=>_,RETRY_MAX_DELAY_NO_HEADERS:()=>N$,RETRY_MAX_DELAY:()=>b$,RETRY_INITIAL_DELAY:()=>D$,RETRY_BACKOFF_FACTOR:()=>I$,PERSISTENT_RETRY_MAX_DELAY:()=>A$,PERSISTENT_RETRY_MAX_ATTEMPTS:()=>u$,PERSISTENT_RETRY_INITIAL_DELAY:()=>j$,PERSISTENT_RETRY_BACKOFF_FACTOR:()=>_$,GO_UPSELL_MESSAGE:()=>Z$});var v=2000,d=2,m=30000,t=2147483647,F$=new Set(["ECONNRESET","EPIPE","ETIMEDOUT"]);var K$=new Set([429,500,502,503,504,529]);function o(f){if(!(f instanceof Error))return!1;let J=f.status??f.statusCode??f.response?.status;if(typeof J==="number"&&K$.has(J))return!0;let $=f.code;if(typeof $==="string"&&F$.has($))return!0;if(f.message==="SSE read timed out")return!0;return!1}function Y(f){return Math.min(f,2147483647)}function c(f,J){if(J){let $=J.data.responseHeaders;if($){let Z=$["retry-after-ms"];if(Z){let z=Number.parseFloat(Z);if(!Number.isNaN(z))return Y(z)}let w=$["retry-after"];if(w){let z=Number.parseFloat(w);if(!Number.isNaN(z))return Y(Math.ceil(z*1000));let P=Date.parse(w)-Date.now();if(!Number.isNaN(P)&&P>0)return Y(Math.ceil(P))}return Y(2000*Math.pow(2,f-1))}}return Y(Math.min(2000*Math.pow(2,f-1),30000))}var I=500,N=2,b=300000,a=10;function s(f){return Math.min(I*N**(f-1),b)}var Z$="Free usage exceeded, subscribe to Go https://opencode.ai/go",D$=v,I$=d,N$=m,b$=t,w$=o,H$=c,j$=I,_$=N,A$=b,u$=a,S$=s;function q$(f){if(C.ContextOverflowError.isInstance(f))return;if(w$(f))return f.message||"Transient network error";if(C.APIError.isInstance(f)){let w=f.data.statusCode;if(!f.data.isRetryable&&!(w!==void 0&&w>=500))return;if(f.data.responseBody?.includes("FreeUsageLimitError"))return Z$;return f.data.message.includes("Overloaded")?"Provider is overloaded":f.data.message}let J=f.data?.message;if(typeof J==="string"){let w=J.toLowerCase();if(w.includes("rate increased too quickly")||w.includes("rate limit")||w.includes("too many requests"))return J}let $=J$(()=>{try{if(typeof f.data?.message==="string")return JSON.parse(f.data.message);return JSON.parse(f.data.message)}catch{return}});if(!$||typeof $!=="object")return;let Z=typeof $.code==="string"?$.code:"";if($.type==="error"&&$.error?.type==="too_many_requests")return"Too Many Requests";if(Z.includes("exhausted")||Z.includes("unavailable"))return"Provider is overloaded";if($.type==="error"&&typeof $.error?.code==="string"&&$.error.code.includes("rate_limit"))return"Rate Limited";return}function R$(f){return f$.fromStepWithMetadata(j.succeed((J)=>{let $=f.parse(J.input),Z=q$($);if(!Z)return r.done(J.attempt);return j.gen(function*(){let w=H$(J.attempt,C.APIError.isInstance($)?$:void 0),z=yield*$$.currentTimeMillis;return yield*f.set({attempt:J.attempt,message:Z,next:z+w}),[J.attempt,e.millis(w)]})}))}var v$=X$.define("tui.instructions.loaded",k.object({files:k.array(k.string()).describe("Display labels of loaded instruction files: worktree-relative path, ~-path, or absolute")}));
|
|
3
3
|
export{v$ as rh,y$ as sh,w$ as th,j$ as uh,_$ as vh,A$ as wh,u$ as xh,S$ as yh,_ as zh};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{s as a,t as b,u as c,v as d,w as e,x as f,y as g}from"./chunk-
|
|
2
|
+
import{s as a,t as b,u as c,v as d,w as e,x as f,y as g}from"./chunk-sj8py6vk.js";import"./chunk-6dznrhs4.js";import"./chunk-8fn883z8.js";import"./chunk-w8xaw2dv.js";import"./chunk-tq258v8s.js";import"./chunk-yja3y138.js";import"./chunk-3nc9wy1m.js";import"./chunk-r8ddb02d.js";import"./chunk-56cty7nr.js";import"./chunk-esjs9s9g.js";import"./chunk-b5x3zghc.js";import"./chunk-t1f7jeat.js";import"./chunk-tk6gjy9d.js";import"./chunk-pkdk0ppc.js";import"./chunk-hrnx60em.js";import"./chunk-bbznk59q.js";import"./chunk-01gtn79f.js";import"./chunk-meaa7wrs.js";import"./chunk-fa03gsff.js";export{e as waitForDependencies,c as layer,f as get,d as defaultLayer,g as TuiConfig,b as Service,a as Info};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Dr as mJ,Er as vJ,Fr as dJ,Gr as lJ,Jr as d,Kr as l,Mr as uJ,Nr as cJ,Qr as pJ,Rr as iJ,Sr as nJ,Tr as aJ,Ur as rJ,Wr as AQ}from"./chunk-3nc9wy1m.js";import{Gs as CQ,Hs as DQ,Ms as FQ,dt as x,mt as GJ}from"./chunk-v7yvnnmr.js";import{$H as I,CH as fJ,DG as MJ,EF as b,GE as _J,GF as CJ,GG as oJ,IC as GQ,KG as RJ,MG as VJ,NH as E,PG as hJ,PL as o,QF as DJ,RF as FJ,SF as AJ,SH as yJ,TH as bJ,UO as g,VE as BQ,VO as eJ,WE as wQ,YC as $Q,YG as jJ,YO as HQ,ZB as wJ,ZE as $J,ZO as WQ,_E as UJ,_O as R,aC as HJ,cG as t,cH as NJ,dC as WJ,dF as zJ,dG as OJ,eD as f,fG as y,kD as IJ,nD as PJ,nH as kJ,nJ as gJ,oF as ZJ,qD as T,rH as LJ,sG as TJ,tB as tJ,tD as KJ,uH as SJ,yF as z,yH as xJ,yL as j,zE as qQ,zG as EJ}from"./chunk-meaa7wrs.js";import{lP as zQ,nP as u,pP as S}from"./chunk-fa03gsff.js";var IX={};u(IX,{resource:()=>BJ,layer:()=>EQ,enabled:()=>OQ,Observability:()=>WX});var p={};u(p,{make:()=>IQ,layer:()=>ZX});var VQ=AJ.pipe(FJ,DJ((J)=>{if(lJ(J)&&J.reason._tag==="StatusCodeError"&&J.reason.response.status===429){let Q=HJ(J.reason.response.headers["retry-after"]).pipe(WJ(CJ),wJ(()=>5));return t(T(Q))}return t(T(1))})),sJ=E(function*(J){let Q=yield*jJ(),X=f(Q,b),Y=f(Q,UJ),$=fJ(Q),G=KJ(IJ(J.exportInterval),PJ),B=void 0,C=nJ(f(Q,pJ)).pipe(iJ(NJ(rJ,!1)),aJ({schedule:VQ,times:3})),V=vJ({"user-agent":`effect-opentelemetry-${J.label}/0.0.0`});if(J.headers)V=dJ(mJ(J.headers),V);let r=uJ(J.url,{headers:V}),O=[],s=OJ(()=>{if(B!==void 0&&X.currentTimeMillisUnsafe()<B)return y;else if(B!==void 0)B=void 0;let h=O;if(J.maxBatchSize!=="disabled"){if(O.length===0)return y;O=[]}return C.execute(cJ(r,J.body(h))).pipe(EJ,SJ(!1))}).pipe(MJ((h)=>{if(B!==void 0)return y;return B=X.currentTimeMillisUnsafe()+60000,O=[],yJ("Disabling exporter for 60 seconds",h)}),bJ({package:"@effect/opentelemetry",module:J.label}));return yield*zJ(Y,s.pipe(RJ,kJ,VJ(J.shutdownTimeout))),yield*hJ(G).pipe(TJ(s),LJ,xJ(Y)),{push(h){if(B!==void 0)return;if(O.push(h),J.maxBatchSize!=="disabled"&&O.length>=J.maxBatchSize)gJ($(s),Y)}}});var jQ=(J)=>{let Q=J.attributes?e(Object.entries(J.attributes)):[];if(Q.push({key:"service.name",value:{stringValue:J.serviceName}}),J.serviceVersion)Q.push({key:"service.version",value:{stringValue:J.serviceVersion}});return{attributes:Q,droppedAttributesCount:0}},JQ=E(function*(J){let Q={...yield*g(o(eJ(j,j)),"OTEL_RESOURCE_ATTRIBUTES"),...J?.attributes},X=J?.serviceName??Q["service.name"]??(yield*g(j,"OTEL_SERVICE_NAME"));delete Q["service.name"];let Y=J?.serviceVersion??Q["service.version"]??(yield*g(o(j),"OTEL_SERVICE_VERSION"));return delete Q["service.version"],jQ({serviceName:X,serviceVersion:Y,attributes:Q})},oJ),QQ=(J)=>{let Q=J.attributes.find((X)=>X.key==="service.name");if(!Q||!Q.value.stringValue)throw Error("Resource does not contain a service name");return Q.value.stringValue},e=(J)=>{let Q=[];for(let[X,Y]of J)Q.push({key:X,value:m(Y)});return Q},m=(J)=>{if(Array.isArray(J))return{arrayValue:{values:J.map(m)}};switch(typeof J){case"string":return{stringValue:J};case"bigint":return{intValue:Number(J)};case"number":return Number.isInteger(J)?{intValue:J}:{doubleValue:J};case"boolean":return{boolValue:J};default:return{stringValue:tJ(J)}}};var c={};u(c,{layerProtobuf:()=>YX,layerJson:()=>XX,OtlpSerialization:()=>M});var N={Varint:0,Fixed64:1,LengthDelimited:2,Fixed32:5},k=(J,Q)=>J<<3|Q,D=(J)=>{let Q=[],X=typeof J==="bigint"?J:BigInt(J);while(X>0x7fn)Q.push(Number(X&0x7fn)|128),X>>=7n;return Q.push(Number(X)),new Uint8Array(Q)};var kQ=(J)=>{let Q=new Uint8Array(8);return new DataView(Q.buffer).setBigUint64(0,J,!0),Q},LQ=(J)=>{let Q=new Uint8Array(4);return new DataView(Q.buffer).setUint32(0,J,!0),Q},SQ=(J)=>{let Q=new Uint8Array(8);return new DataView(Q.buffer).setFloat64(0,J,!0),Q},xQ=(J)=>new TextEncoder().encode(J),fQ=(J)=>{let Q=new Uint8Array(J.length/2);for(let X=0;X<J.length;X+=2)Q[X/2]=parseInt(J.slice(X,X+2),16);return Q},Z=(...J)=>{let Q=J.reduce(($,G)=>$+G.length,0),X=new Uint8Array(Q),Y=0;for(let $ of J)X.set($,Y),Y+=$.length;return X},q=(J,Q)=>Z(D(k(J,N.Varint)),D(Q));var JJ=(J,Q)=>q(J,Q?1:0),W=(J,Q)=>Z(D(k(J,N.Fixed64)),kQ(Q)),v=(J,Q)=>Z(D(k(J,N.Fixed32)),LQ(Q)),F=(J,Q)=>Z(D(k(J,N.Fixed64)),SQ(Q)),L=(J,Q)=>Z(D(k(J,N.LengthDelimited)),D(Q.length),Q),K=(J,Q)=>L(J,xQ(Q)),U=(J,Q)=>L(J,fQ(Q)),w=(J,Q)=>L(J,Q),_=(J,Q,X)=>Z(...Q.map((Y)=>w(J,X(Y))));var H=(J,Q)=>Q!==void 0&&Q!==""?K(J,Q):new Uint8Array(0);var QJ=(J)=>{if(J.stringValue!==void 0&&J.stringValue!==null)return K(1,J.stringValue);if(J.boolValue!==void 0&&J.boolValue!==null)return JJ(2,J.boolValue);if(J.intValue!==void 0&&J.intValue!==null)return q(3,BigInt(J.intValue));if(J.doubleValue!==void 0&&J.doubleValue!==null)return F(4,J.doubleValue);if(J.arrayValue!==void 0)return w(5,bQ(J.arrayValue));if(J.kvlistValue!==void 0)return w(6,gQ(J.kvlistValue));if(J.bytesValue!==void 0)return L(7,J.bytesValue);return new Uint8Array(0)},bQ=(J)=>_(1,J.values,QJ),gQ=(J)=>_(1,J.values,P),P=(J)=>Z(K(1,J.key),w(2,QJ(J.value))),XJ=(J)=>Z(K(1,J.name),H(2,J.version),J.attributes?_(3,J.attributes,P):new Uint8Array(0),J.droppedAttributesCount?q(4,J.droppedAttributesCount):new Uint8Array(0)),YJ=(J)=>Z(_(1,J.attributes,P),J.droppedAttributesCount>0?q(2,J.droppedAttributesCount):new Uint8Array(0));var mQ=(J)=>Z(H(2,J.message),q(3,J.code)),vQ=(J)=>Z(W(1,BigInt(J.timeUnixNano)),K(2,J.name),_(3,J.attributes,P),J.droppedAttributesCount>0?q(4,J.droppedAttributesCount):new Uint8Array(0)),dQ=(J)=>Z(U(1,J.traceId),U(2,J.spanId),H(3,J.traceState),_(4,J.attributes,P),J.droppedAttributesCount>0?q(5,J.droppedAttributesCount):new Uint8Array(0),J.flags!==void 0?v(6,J.flags):new Uint8Array(0)),lQ=(J)=>Z(U(1,J.traceId),U(2,J.spanId),H(3,J.traceState),J.parentSpanId!==void 0?U(4,J.parentSpanId):new Uint8Array(0),K(5,J.name),q(6,J.kind),W(7,BigInt(J.startTimeUnixNano)),W(8,BigInt(J.endTimeUnixNano)),_(9,J.attributes,P),J.droppedAttributesCount>0?q(10,J.droppedAttributesCount):new Uint8Array(0),_(11,J.events,vQ),J.droppedEventsCount>0?q(12,J.droppedEventsCount):new Uint8Array(0),_(13,J.links,dQ),J.droppedLinksCount>0?q(14,J.droppedLinksCount):new Uint8Array(0),w(15,mQ(J.status)),J.flags!==void 0?v(16,J.flags):new Uint8Array(0)),uQ=(J)=>Z(w(1,XJ(J.scope)),_(2,J.spans,lQ),H(3,J.schemaUrl)),cQ=(J)=>Z(w(1,YJ(J.resource)),_(2,J.scopeSpans,uQ),H(3,J.schemaUrl)),XQ=(J)=>_(1,J.resourceSpans,cQ);var YQ=(J)=>Z(W(2,BigInt(J.startTimeUnixNano)),W(3,BigInt(J.timeUnixNano)),J.asDouble!==void 0?F(4,J.asDouble):new Uint8Array(0),J.asInt!==void 0?W(6,BigInt(J.asInt)):new Uint8Array(0),_(7,J.attributes,P),J.flags!==void 0?q(8,J.flags):new Uint8Array(0)),pQ=(J)=>{let Q=Z(...J.bucketCounts.map((Y)=>W(6,BigInt(Y)))),X=Z(...J.explicitBounds.map((Y)=>F(7,Y)));return Z(W(2,BigInt(J.startTimeUnixNano)),W(3,BigInt(J.timeUnixNano)),W(4,BigInt(J.count)),J.sum!==void 0?F(5,J.sum):new Uint8Array(0),Q,X,_(9,J.attributes,P),J.flags!==void 0?q(10,J.flags):new Uint8Array(0),J.min!==void 0?F(11,J.min):new Uint8Array(0),J.max!==void 0?F(12,J.max):new Uint8Array(0))},iQ=(J)=>_(1,J.dataPoints,YQ),nQ=(J)=>Z(_(1,J.dataPoints,YQ),q(2,J.aggregationTemporality),JJ(3,J.isMonotonic)),aQ=(J)=>Z(_(1,J.dataPoints,pQ),q(2,J.aggregationTemporality)),rQ=(J)=>Z(K(1,J.name),H(2,J.description),H(3,J.unit),J.gauge!==void 0?w(5,iQ(J.gauge)):new Uint8Array(0),J.sum!==void 0?w(7,nQ(J.sum)):new Uint8Array(0),J.histogram!==void 0?w(9,aQ(J.histogram)):new Uint8Array(0)),sQ=(J)=>Z(w(1,XJ(J.scope)),_(2,J.metrics,rQ),H(3,J.schemaUrl)),tQ=(J)=>Z(w(1,YJ(J.resource)),_(2,J.scopeMetrics,sQ),H(3,J.schemaUrl)),ZQ=(J)=>_(1,J.resourceMetrics,tQ);var oQ=(J)=>Z(W(1,BigInt(J.timeUnixNano)),J.severityNumber!==void 0?q(2,J.severityNumber):new Uint8Array(0),H(3,J.severityText),J.body!==void 0?w(5,QJ(J.body)):new Uint8Array(0),_(6,J.attributes,P),J.droppedAttributesCount!==void 0&&J.droppedAttributesCount>0?q(7,J.droppedAttributesCount):new Uint8Array(0),J.flags!==void 0?v(8,J.flags):new Uint8Array(0),J.traceId!==void 0&&J.traceId!==""?U(9,J.traceId):new Uint8Array(0),J.spanId!==void 0&&J.spanId!==""?U(10,J.spanId):new Uint8Array(0),J.observedTimeUnixNano!==void 0?W(11,BigInt(J.observedTimeUnixNano)):new Uint8Array(0)),eQ=(J)=>Z(w(1,XJ(J.scope)),_(2,J.logRecords,oQ),H(3,J.schemaUrl)),JX=(J)=>Z(w(1,YJ(J.resource)),_(2,J.scopeLogs,eQ),H(3,J.schemaUrl)),_Q=(J)=>_(1,J.resourceLogs,JX);class M extends $Q()("effect/observability/OtlpSerialization"){}var XX=ZJ(M,{traces:(J)=>l(J),metrics:(J)=>l(J),logs:(J)=>l(J)}),YX=ZJ(M,{traces:(J)=>d(XQ(J),"application/x-protobuf"),metrics:(J)=>d(ZQ(J),"application/x-protobuf"),logs:(J)=>d(_Q(J),"application/x-protobuf")});var IQ=E(function*(J){let Q=yield*M,X=yield*JQ(J.resource),Y={name:QQ(X)},$=yield*sJ({label:"OtlpLogger",url:J.url,headers:J.headers,maxBatchSize:J.maxBatchSize??1000,exportInterval:J.exportInterval??T(1),body:(B)=>Q.logs({resourceLogs:[{resource:X,scopeLogs:[{scope:Y,logRecords:B}]}]}),shutdownTimeout:J.shutdownTimeout??T(3)}),G={excludeLogSpans:J.excludeLogSpans??!1,clock:yield*b};return HQ((B)=>{$.push(_X(B,G))})}),ZX=(J)=>WQ([IQ(J)],{mergeWithExisting:J.mergeWithExisting??!0}),_X=(J,Q)=>{let Y=Q.clock.currentTimeNanosUnsafe().toString(),$=J.date.getTime(),G=e(Object.entries(J.fiber.getRef(BQ)));if(G.push({key:"fiberId",value:{intValue:J.fiber.id}}),!Q.excludeLogSpans)for(let[V,r]of J.fiber.getRef(wQ))G.push({key:`logSpan.${V}`,value:{stringValue:`${$-r}ms`}});if(J.cause.reasons.length>0)G.push({key:"log.error",value:{stringValue:qQ(J.cause)}});let B=GQ(J.message),C={severityNumber:$X(J.logLevel),severityText:J.logLevel,timeUnixNano:Y,observedTimeUnixNano:Y,attributes:G,body:m(B.length===1?B[0]:B),droppedAttributesCount:0};if(J.fiber.currentSpan)C.traceId=J.fiber.currentSpan.traceId,C.spanId=J.fiber.currentSpan.spanId;return C},$X=(J)=>{switch(J){case"Trace":return A.SEVERITY_NUMBER_TRACE;case"Debug":return A.SEVERITY_NUMBER_DEBUG;case"Info":return A.SEVERITY_NUMBER_INFO;case"Warn":return A.SEVERITY_NUMBER_WARN;case"Error":return A.SEVERITY_NUMBER_ERROR;case"Fatal":return A.SEVERITY_NUMBER_FATAL;default:return A.SEVERITY_NUMBER_UNSPECIFIED}},A={SEVERITY_NUMBER_UNSPECIFIED:0,SEVERITY_NUMBER_TRACE:1,SEVERITY_NUMBER_TRACE2:2,SEVERITY_NUMBER_TRACE3:3,SEVERITY_NUMBER_TRACE4:4,SEVERITY_NUMBER_DEBUG:5,SEVERITY_NUMBER_DEBUG2:6,SEVERITY_NUMBER_DEBUG3:7,SEVERITY_NUMBER_DEBUG4:8,SEVERITY_NUMBER_INFO:9,SEVERITY_NUMBER_INFO2:10,SEVERITY_NUMBER_INFO3:11,SEVERITY_NUMBER_INFO4:12,SEVERITY_NUMBER_WARN:13,SEVERITY_NUMBER_WARN2:14,SEVERITY_NUMBER_WARN3:15,SEVERITY_NUMBER_WARN4:16,SEVERITY_NUMBER_ERROR:17,SEVERITY_NUMBER_ERROR2:18,SEVERITY_NUMBER_ERROR3:19,SEVERITY_NUMBER_ERROR4:20,SEVERITY_NUMBER_FATAL:21,SEVERITY_NUMBER_FATAL2:22,SEVERITY_NUMBER_FATAL3:23,SEVERITY_NUMBER_FATAL4:24};var UQ={};u(UQ,{logger:()=>n,layer:()=>qJ,create:()=>KQ});var GX=(J)=>J==="sessionID"?"session.id":J,PQ=(J)=>Object.fromEntries(Object.entries(J??{}).filter((Q)=>Q[1]!==void 0&&Q[1]!==null).map(([Q,X])=>[GX(Q),X])),qX=(J)=>{if(Array.isArray(J))return J.map((Q)=>String(Q)).join(" ");return J===void 0?"":String(J)},i=(J,Q,X,Y)=>{let $=PQ({...Q,...Y}),G=J(X);return Object.keys($).length?I.annotateLogs(G,$):G},n=R.make((J)=>{let Q=PQ(J.fiber.getRef($J.CurrentLogAnnotations)),X=J.date.getTime();for(let[B,C]of J.fiber.getRef($J.CurrentLogSpans))Q[`logSpan.${B}`]=`${X-C}ms`;if(J.cause.reasons.length>0)Q.cause=_J.pretty(J.cause);let Y=typeof Q.service==="string"?Q.service:void 0;if(Y)delete Q.service;let $=Y?GJ.create({service:Y}):GJ.Default,G=qX(J.message);switch(J.logLevel){case"Trace":case"Debug":return $.debug(G,Q);case"Warn":return $.warn(G,Q);case"Error":case"Fatal":return $.error(G,Q);default:return $.info(G,Q)}}),qJ=R.layer([n],{mergeWithExisting:!1}),KQ=(J={})=>({debug:(Q,X)=>i((Y)=>I.logDebug(Y),J,Q,X),info:(Q,X)=>i((Y)=>I.logInfo(Y),J,Q,X),warn:(Q,X)=>i((Y)=>I.logWarning(Y),J,Q,X),error:(Q,X)=>i((Y)=>I.logError(Y),J,Q,X),with:(Q)=>KQ({...J,...Q})});var a=x.OTEL_EXPORTER_OTLP_ENDPOINT,OQ=!!a,BX=crypto.randomUUID(),TQ=x.OTEL_EXPORTER_OTLP_HEADERS?x.OTEL_EXPORTER_OTLP_HEADERS.split(",").reduce((J,Q)=>{let[X,...Y]=Q.split("=");return J[X]=Y.join("="),J},{}):void 0;function BJ(){let J=FQ("main"),Q=(()=>{let X=process.env.OTEL_RESOURCE_ATTRIBUTES;if(!X)return{};try{return Object.fromEntries(X.split(",").map((Y)=>{let $=Y.indexOf("=");if($<1)throw Error("Invalid OTEL_RESOURCE_ATTRIBUTES entry");return[decodeURIComponent(Y.slice(0,$)),decodeURIComponent(Y.slice($+1))]}))}catch{return{}}})();return{serviceName:"qitqode",serviceVersion:CQ,attributes:{...Q,"deployment.environment.name":DQ,"qitqode.client":x.QITQODE_CLIENT,"qitqode.process_role":J.processRole,"qitqode.run_id":J.runID,"service.instance.id":BX}}}function wX(){return R.layer([n,p.make({url:`${a}/v1/logs`,resource:BJ(),headers:TQ})],{mergeWithExisting:!1}).pipe(z.provide(c.layerJson),z.provide(AQ.layer))}var HX=async()=>{let J=await import("./chunk-jatba8z8.js"),Q=await import("./chunk-j1kqhxnq.js"),X=await import("./chunk-fkdbba26.js"),{AsyncLocalStorageContextManager:Y}=await import("./chunk-1eqcgkyq.js").then((m)=>zQ(m.default,1)),{context:$}=await import("./chunk-7bm1t462.js").then((m)=>zQ(m.default,1)),G=new Y;return G.enable(),$.setGlobalContextManager(G),J.layer(()=>({resource:BJ(),spanProcessor:new X.BatchSpanProcessor(new Q.OTLPTraceExporter({url:`${a}/v1/traces`,headers:TQ}))}))},EQ=!a?qJ:z.unwrap(I.gen(function*(){let J=yield*I.promise(HX);return z.mergeAll(J,wX())})),WX={enabled:OQ,layer:EQ};var aX=z.makeMemoMapUnsafe();
|
|
2
|
+
import{Dr as mJ,Er as vJ,Fr as dJ,Gr as lJ,Jr as d,Kr as l,Mr as uJ,Nr as cJ,Qr as pJ,Rr as iJ,Sr as nJ,Tr as aJ,Ur as rJ,Wr as AQ}from"./chunk-3nc9wy1m.js";import{Gs as CQ,Hs as DQ,Ms as FQ,dt as x,mt as GJ}from"./chunk-esjs9s9g.js";import{$H as I,CH as fJ,DG as MJ,EF as b,GE as _J,GF as CJ,GG as oJ,IC as GQ,KG as RJ,MG as VJ,NH as E,PG as hJ,PL as o,QF as DJ,RF as FJ,SF as AJ,SH as yJ,TH as bJ,UO as g,VE as BQ,VO as eJ,WE as wQ,YC as $Q,YG as jJ,YO as HQ,ZB as wJ,ZE as $J,ZO as WQ,_E as UJ,_O as R,aC as HJ,cG as t,cH as NJ,dC as WJ,dF as zJ,dG as OJ,eD as f,fG as y,kD as IJ,nD as PJ,nH as kJ,nJ as gJ,oF as ZJ,qD as T,rH as LJ,sG as TJ,tB as tJ,tD as KJ,uH as SJ,yF as z,yH as xJ,yL as j,zE as qQ,zG as EJ}from"./chunk-meaa7wrs.js";import{lP as zQ,nP as u,pP as S}from"./chunk-fa03gsff.js";var IX={};u(IX,{resource:()=>BJ,layer:()=>EQ,enabled:()=>OQ,Observability:()=>WX});var p={};u(p,{make:()=>IQ,layer:()=>ZX});var VQ=AJ.pipe(FJ,DJ((J)=>{if(lJ(J)&&J.reason._tag==="StatusCodeError"&&J.reason.response.status===429){let Q=HJ(J.reason.response.headers["retry-after"]).pipe(WJ(CJ),wJ(()=>5));return t(T(Q))}return t(T(1))})),sJ=E(function*(J){let Q=yield*jJ(),X=f(Q,b),Y=f(Q,UJ),$=fJ(Q),G=KJ(IJ(J.exportInterval),PJ),B=void 0,C=nJ(f(Q,pJ)).pipe(iJ(NJ(rJ,!1)),aJ({schedule:VQ,times:3})),V=vJ({"user-agent":`effect-opentelemetry-${J.label}/0.0.0`});if(J.headers)V=dJ(mJ(J.headers),V);let r=uJ(J.url,{headers:V}),O=[],s=OJ(()=>{if(B!==void 0&&X.currentTimeMillisUnsafe()<B)return y;else if(B!==void 0)B=void 0;let h=O;if(J.maxBatchSize!=="disabled"){if(O.length===0)return y;O=[]}return C.execute(cJ(r,J.body(h))).pipe(EJ,SJ(!1))}).pipe(MJ((h)=>{if(B!==void 0)return y;return B=X.currentTimeMillisUnsafe()+60000,O=[],yJ("Disabling exporter for 60 seconds",h)}),bJ({package:"@effect/opentelemetry",module:J.label}));return yield*zJ(Y,s.pipe(RJ,kJ,VJ(J.shutdownTimeout))),yield*hJ(G).pipe(TJ(s),LJ,xJ(Y)),{push(h){if(B!==void 0)return;if(O.push(h),J.maxBatchSize!=="disabled"&&O.length>=J.maxBatchSize)gJ($(s),Y)}}});var jQ=(J)=>{let Q=J.attributes?e(Object.entries(J.attributes)):[];if(Q.push({key:"service.name",value:{stringValue:J.serviceName}}),J.serviceVersion)Q.push({key:"service.version",value:{stringValue:J.serviceVersion}});return{attributes:Q,droppedAttributesCount:0}},JQ=E(function*(J){let Q={...yield*g(o(eJ(j,j)),"OTEL_RESOURCE_ATTRIBUTES"),...J?.attributes},X=J?.serviceName??Q["service.name"]??(yield*g(j,"OTEL_SERVICE_NAME"));delete Q["service.name"];let Y=J?.serviceVersion??Q["service.version"]??(yield*g(o(j),"OTEL_SERVICE_VERSION"));return delete Q["service.version"],jQ({serviceName:X,serviceVersion:Y,attributes:Q})},oJ),QQ=(J)=>{let Q=J.attributes.find((X)=>X.key==="service.name");if(!Q||!Q.value.stringValue)throw Error("Resource does not contain a service name");return Q.value.stringValue},e=(J)=>{let Q=[];for(let[X,Y]of J)Q.push({key:X,value:m(Y)});return Q},m=(J)=>{if(Array.isArray(J))return{arrayValue:{values:J.map(m)}};switch(typeof J){case"string":return{stringValue:J};case"bigint":return{intValue:Number(J)};case"number":return Number.isInteger(J)?{intValue:J}:{doubleValue:J};case"boolean":return{boolValue:J};default:return{stringValue:tJ(J)}}};var c={};u(c,{layerProtobuf:()=>YX,layerJson:()=>XX,OtlpSerialization:()=>M});var N={Varint:0,Fixed64:1,LengthDelimited:2,Fixed32:5},k=(J,Q)=>J<<3|Q,D=(J)=>{let Q=[],X=typeof J==="bigint"?J:BigInt(J);while(X>0x7fn)Q.push(Number(X&0x7fn)|128),X>>=7n;return Q.push(Number(X)),new Uint8Array(Q)};var kQ=(J)=>{let Q=new Uint8Array(8);return new DataView(Q.buffer).setBigUint64(0,J,!0),Q},LQ=(J)=>{let Q=new Uint8Array(4);return new DataView(Q.buffer).setUint32(0,J,!0),Q},SQ=(J)=>{let Q=new Uint8Array(8);return new DataView(Q.buffer).setFloat64(0,J,!0),Q},xQ=(J)=>new TextEncoder().encode(J),fQ=(J)=>{let Q=new Uint8Array(J.length/2);for(let X=0;X<J.length;X+=2)Q[X/2]=parseInt(J.slice(X,X+2),16);return Q},Z=(...J)=>{let Q=J.reduce(($,G)=>$+G.length,0),X=new Uint8Array(Q),Y=0;for(let $ of J)X.set($,Y),Y+=$.length;return X},q=(J,Q)=>Z(D(k(J,N.Varint)),D(Q));var JJ=(J,Q)=>q(J,Q?1:0),W=(J,Q)=>Z(D(k(J,N.Fixed64)),kQ(Q)),v=(J,Q)=>Z(D(k(J,N.Fixed32)),LQ(Q)),F=(J,Q)=>Z(D(k(J,N.Fixed64)),SQ(Q)),L=(J,Q)=>Z(D(k(J,N.LengthDelimited)),D(Q.length),Q),K=(J,Q)=>L(J,xQ(Q)),U=(J,Q)=>L(J,fQ(Q)),w=(J,Q)=>L(J,Q),_=(J,Q,X)=>Z(...Q.map((Y)=>w(J,X(Y))));var H=(J,Q)=>Q!==void 0&&Q!==""?K(J,Q):new Uint8Array(0);var QJ=(J)=>{if(J.stringValue!==void 0&&J.stringValue!==null)return K(1,J.stringValue);if(J.boolValue!==void 0&&J.boolValue!==null)return JJ(2,J.boolValue);if(J.intValue!==void 0&&J.intValue!==null)return q(3,BigInt(J.intValue));if(J.doubleValue!==void 0&&J.doubleValue!==null)return F(4,J.doubleValue);if(J.arrayValue!==void 0)return w(5,bQ(J.arrayValue));if(J.kvlistValue!==void 0)return w(6,gQ(J.kvlistValue));if(J.bytesValue!==void 0)return L(7,J.bytesValue);return new Uint8Array(0)},bQ=(J)=>_(1,J.values,QJ),gQ=(J)=>_(1,J.values,P),P=(J)=>Z(K(1,J.key),w(2,QJ(J.value))),XJ=(J)=>Z(K(1,J.name),H(2,J.version),J.attributes?_(3,J.attributes,P):new Uint8Array(0),J.droppedAttributesCount?q(4,J.droppedAttributesCount):new Uint8Array(0)),YJ=(J)=>Z(_(1,J.attributes,P),J.droppedAttributesCount>0?q(2,J.droppedAttributesCount):new Uint8Array(0));var mQ=(J)=>Z(H(2,J.message),q(3,J.code)),vQ=(J)=>Z(W(1,BigInt(J.timeUnixNano)),K(2,J.name),_(3,J.attributes,P),J.droppedAttributesCount>0?q(4,J.droppedAttributesCount):new Uint8Array(0)),dQ=(J)=>Z(U(1,J.traceId),U(2,J.spanId),H(3,J.traceState),_(4,J.attributes,P),J.droppedAttributesCount>0?q(5,J.droppedAttributesCount):new Uint8Array(0),J.flags!==void 0?v(6,J.flags):new Uint8Array(0)),lQ=(J)=>Z(U(1,J.traceId),U(2,J.spanId),H(3,J.traceState),J.parentSpanId!==void 0?U(4,J.parentSpanId):new Uint8Array(0),K(5,J.name),q(6,J.kind),W(7,BigInt(J.startTimeUnixNano)),W(8,BigInt(J.endTimeUnixNano)),_(9,J.attributes,P),J.droppedAttributesCount>0?q(10,J.droppedAttributesCount):new Uint8Array(0),_(11,J.events,vQ),J.droppedEventsCount>0?q(12,J.droppedEventsCount):new Uint8Array(0),_(13,J.links,dQ),J.droppedLinksCount>0?q(14,J.droppedLinksCount):new Uint8Array(0),w(15,mQ(J.status)),J.flags!==void 0?v(16,J.flags):new Uint8Array(0)),uQ=(J)=>Z(w(1,XJ(J.scope)),_(2,J.spans,lQ),H(3,J.schemaUrl)),cQ=(J)=>Z(w(1,YJ(J.resource)),_(2,J.scopeSpans,uQ),H(3,J.schemaUrl)),XQ=(J)=>_(1,J.resourceSpans,cQ);var YQ=(J)=>Z(W(2,BigInt(J.startTimeUnixNano)),W(3,BigInt(J.timeUnixNano)),J.asDouble!==void 0?F(4,J.asDouble):new Uint8Array(0),J.asInt!==void 0?W(6,BigInt(J.asInt)):new Uint8Array(0),_(7,J.attributes,P),J.flags!==void 0?q(8,J.flags):new Uint8Array(0)),pQ=(J)=>{let Q=Z(...J.bucketCounts.map((Y)=>W(6,BigInt(Y)))),X=Z(...J.explicitBounds.map((Y)=>F(7,Y)));return Z(W(2,BigInt(J.startTimeUnixNano)),W(3,BigInt(J.timeUnixNano)),W(4,BigInt(J.count)),J.sum!==void 0?F(5,J.sum):new Uint8Array(0),Q,X,_(9,J.attributes,P),J.flags!==void 0?q(10,J.flags):new Uint8Array(0),J.min!==void 0?F(11,J.min):new Uint8Array(0),J.max!==void 0?F(12,J.max):new Uint8Array(0))},iQ=(J)=>_(1,J.dataPoints,YQ),nQ=(J)=>Z(_(1,J.dataPoints,YQ),q(2,J.aggregationTemporality),JJ(3,J.isMonotonic)),aQ=(J)=>Z(_(1,J.dataPoints,pQ),q(2,J.aggregationTemporality)),rQ=(J)=>Z(K(1,J.name),H(2,J.description),H(3,J.unit),J.gauge!==void 0?w(5,iQ(J.gauge)):new Uint8Array(0),J.sum!==void 0?w(7,nQ(J.sum)):new Uint8Array(0),J.histogram!==void 0?w(9,aQ(J.histogram)):new Uint8Array(0)),sQ=(J)=>Z(w(1,XJ(J.scope)),_(2,J.metrics,rQ),H(3,J.schemaUrl)),tQ=(J)=>Z(w(1,YJ(J.resource)),_(2,J.scopeMetrics,sQ),H(3,J.schemaUrl)),ZQ=(J)=>_(1,J.resourceMetrics,tQ);var oQ=(J)=>Z(W(1,BigInt(J.timeUnixNano)),J.severityNumber!==void 0?q(2,J.severityNumber):new Uint8Array(0),H(3,J.severityText),J.body!==void 0?w(5,QJ(J.body)):new Uint8Array(0),_(6,J.attributes,P),J.droppedAttributesCount!==void 0&&J.droppedAttributesCount>0?q(7,J.droppedAttributesCount):new Uint8Array(0),J.flags!==void 0?v(8,J.flags):new Uint8Array(0),J.traceId!==void 0&&J.traceId!==""?U(9,J.traceId):new Uint8Array(0),J.spanId!==void 0&&J.spanId!==""?U(10,J.spanId):new Uint8Array(0),J.observedTimeUnixNano!==void 0?W(11,BigInt(J.observedTimeUnixNano)):new Uint8Array(0)),eQ=(J)=>Z(w(1,XJ(J.scope)),_(2,J.logRecords,oQ),H(3,J.schemaUrl)),JX=(J)=>Z(w(1,YJ(J.resource)),_(2,J.scopeLogs,eQ),H(3,J.schemaUrl)),_Q=(J)=>_(1,J.resourceLogs,JX);class M extends $Q()("effect/observability/OtlpSerialization"){}var XX=ZJ(M,{traces:(J)=>l(J),metrics:(J)=>l(J),logs:(J)=>l(J)}),YX=ZJ(M,{traces:(J)=>d(XQ(J),"application/x-protobuf"),metrics:(J)=>d(ZQ(J),"application/x-protobuf"),logs:(J)=>d(_Q(J),"application/x-protobuf")});var IQ=E(function*(J){let Q=yield*M,X=yield*JQ(J.resource),Y={name:QQ(X)},$=yield*sJ({label:"OtlpLogger",url:J.url,headers:J.headers,maxBatchSize:J.maxBatchSize??1000,exportInterval:J.exportInterval??T(1),body:(B)=>Q.logs({resourceLogs:[{resource:X,scopeLogs:[{scope:Y,logRecords:B}]}]}),shutdownTimeout:J.shutdownTimeout??T(3)}),G={excludeLogSpans:J.excludeLogSpans??!1,clock:yield*b};return HQ((B)=>{$.push(_X(B,G))})}),ZX=(J)=>WQ([IQ(J)],{mergeWithExisting:J.mergeWithExisting??!0}),_X=(J,Q)=>{let Y=Q.clock.currentTimeNanosUnsafe().toString(),$=J.date.getTime(),G=e(Object.entries(J.fiber.getRef(BQ)));if(G.push({key:"fiberId",value:{intValue:J.fiber.id}}),!Q.excludeLogSpans)for(let[V,r]of J.fiber.getRef(wQ))G.push({key:`logSpan.${V}`,value:{stringValue:`${$-r}ms`}});if(J.cause.reasons.length>0)G.push({key:"log.error",value:{stringValue:qQ(J.cause)}});let B=GQ(J.message),C={severityNumber:$X(J.logLevel),severityText:J.logLevel,timeUnixNano:Y,observedTimeUnixNano:Y,attributes:G,body:m(B.length===1?B[0]:B),droppedAttributesCount:0};if(J.fiber.currentSpan)C.traceId=J.fiber.currentSpan.traceId,C.spanId=J.fiber.currentSpan.spanId;return C},$X=(J)=>{switch(J){case"Trace":return A.SEVERITY_NUMBER_TRACE;case"Debug":return A.SEVERITY_NUMBER_DEBUG;case"Info":return A.SEVERITY_NUMBER_INFO;case"Warn":return A.SEVERITY_NUMBER_WARN;case"Error":return A.SEVERITY_NUMBER_ERROR;case"Fatal":return A.SEVERITY_NUMBER_FATAL;default:return A.SEVERITY_NUMBER_UNSPECIFIED}},A={SEVERITY_NUMBER_UNSPECIFIED:0,SEVERITY_NUMBER_TRACE:1,SEVERITY_NUMBER_TRACE2:2,SEVERITY_NUMBER_TRACE3:3,SEVERITY_NUMBER_TRACE4:4,SEVERITY_NUMBER_DEBUG:5,SEVERITY_NUMBER_DEBUG2:6,SEVERITY_NUMBER_DEBUG3:7,SEVERITY_NUMBER_DEBUG4:8,SEVERITY_NUMBER_INFO:9,SEVERITY_NUMBER_INFO2:10,SEVERITY_NUMBER_INFO3:11,SEVERITY_NUMBER_INFO4:12,SEVERITY_NUMBER_WARN:13,SEVERITY_NUMBER_WARN2:14,SEVERITY_NUMBER_WARN3:15,SEVERITY_NUMBER_WARN4:16,SEVERITY_NUMBER_ERROR:17,SEVERITY_NUMBER_ERROR2:18,SEVERITY_NUMBER_ERROR3:19,SEVERITY_NUMBER_ERROR4:20,SEVERITY_NUMBER_FATAL:21,SEVERITY_NUMBER_FATAL2:22,SEVERITY_NUMBER_FATAL3:23,SEVERITY_NUMBER_FATAL4:24};var UQ={};u(UQ,{logger:()=>n,layer:()=>qJ,create:()=>KQ});var GX=(J)=>J==="sessionID"?"session.id":J,PQ=(J)=>Object.fromEntries(Object.entries(J??{}).filter((Q)=>Q[1]!==void 0&&Q[1]!==null).map(([Q,X])=>[GX(Q),X])),qX=(J)=>{if(Array.isArray(J))return J.map((Q)=>String(Q)).join(" ");return J===void 0?"":String(J)},i=(J,Q,X,Y)=>{let $=PQ({...Q,...Y}),G=J(X);return Object.keys($).length?I.annotateLogs(G,$):G},n=R.make((J)=>{let Q=PQ(J.fiber.getRef($J.CurrentLogAnnotations)),X=J.date.getTime();for(let[B,C]of J.fiber.getRef($J.CurrentLogSpans))Q[`logSpan.${B}`]=`${X-C}ms`;if(J.cause.reasons.length>0)Q.cause=_J.pretty(J.cause);let Y=typeof Q.service==="string"?Q.service:void 0;if(Y)delete Q.service;let $=Y?GJ.create({service:Y}):GJ.Default,G=qX(J.message);switch(J.logLevel){case"Trace":case"Debug":return $.debug(G,Q);case"Warn":return $.warn(G,Q);case"Error":case"Fatal":return $.error(G,Q);default:return $.info(G,Q)}}),qJ=R.layer([n],{mergeWithExisting:!1}),KQ=(J={})=>({debug:(Q,X)=>i((Y)=>I.logDebug(Y),J,Q,X),info:(Q,X)=>i((Y)=>I.logInfo(Y),J,Q,X),warn:(Q,X)=>i((Y)=>I.logWarning(Y),J,Q,X),error:(Q,X)=>i((Y)=>I.logError(Y),J,Q,X),with:(Q)=>KQ({...J,...Q})});var a=x.OTEL_EXPORTER_OTLP_ENDPOINT,OQ=!!a,BX=crypto.randomUUID(),TQ=x.OTEL_EXPORTER_OTLP_HEADERS?x.OTEL_EXPORTER_OTLP_HEADERS.split(",").reduce((J,Q)=>{let[X,...Y]=Q.split("=");return J[X]=Y.join("="),J},{}):void 0;function BJ(){let J=FQ("main"),Q=(()=>{let X=process.env.OTEL_RESOURCE_ATTRIBUTES;if(!X)return{};try{return Object.fromEntries(X.split(",").map((Y)=>{let $=Y.indexOf("=");if($<1)throw Error("Invalid OTEL_RESOURCE_ATTRIBUTES entry");return[decodeURIComponent(Y.slice(0,$)),decodeURIComponent(Y.slice($+1))]}))}catch{return{}}})();return{serviceName:"qitqode",serviceVersion:CQ,attributes:{...Q,"deployment.environment.name":DQ,"qitqode.client":x.QITQODE_CLIENT,"qitqode.process_role":J.processRole,"qitqode.run_id":J.runID,"service.instance.id":BX}}}function wX(){return R.layer([n,p.make({url:`${a}/v1/logs`,resource:BJ(),headers:TQ})],{mergeWithExisting:!1}).pipe(z.provide(c.layerJson),z.provide(AQ.layer))}var HX=async()=>{let J=await import("./chunk-jatba8z8.js"),Q=await import("./chunk-j1kqhxnq.js"),X=await import("./chunk-fkdbba26.js"),{AsyncLocalStorageContextManager:Y}=await import("./chunk-1eqcgkyq.js").then((m)=>zQ(m.default,1)),{context:$}=await import("./chunk-7bm1t462.js").then((m)=>zQ(m.default,1)),G=new Y;return G.enable(),$.setGlobalContextManager(G),J.layer(()=>({resource:BJ(),spanProcessor:new X.BatchSpanProcessor(new Q.OTLPTraceExporter({url:`${a}/v1/traces`,headers:TQ}))}))},EQ=!a?qJ:z.unwrap(I.gen(function*(){let J=yield*I.promise(HX);return z.mergeAll(J,wX())})),WX={enabled:OQ,layer:EQ};var aX=z.makeMemoMapUnsafe();
|
|
3
3
|
export{qJ as xr,UQ as yr,EQ as zr,WX as Ar,IX as Br,aX as Cr};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Cr as B,zr as z}from"./chunk-
|
|
2
|
+
import{Cr as B,zr as z}from"./chunk-yja3y138.js";import{Us as D}from"./chunk-esjs9s9g.js";import{Iz as r}from"./chunk-01gtn79f.js";import{$H as W,jD as x,yF as R}from"./chunk-meaa7wrs.js";var w=x.Reference("~qitqode/InstanceRef",{defaultValue:()=>{return}}),C=x.Reference("~qitqode/WorkspaceRef",{defaultValue:()=>{return}});var V=D.create("instance"),y={async provide(p){return V.provide({workspaceID:p.workspaceID},()=>p.fn())},restore(p,o){return V.provide({workspaceID:p},o)},get workspaceID(){try{return V.use().workspaceID}catch{return}}};var j;function U(p){j=p}function P(){if(!j)throw new D.NotFound("instance");return j()}function H(p,o){if(!o.instance&&!o.workspace)return p;if(!o.instance)return p.pipe(W.provideService(C,o.workspace));if(!o.workspace)return p.pipe(W.provideService(w,o.instance));return p.pipe(W.provideService(w,o.instance),W.provideService(C,o.workspace))}function d(p){try{return H(p,{instance:P(),workspace:y.workspaceID})}catch(o){if(!(o instanceof D.NotFound))throw o}return p}function F(p,o){let G,I=()=>G??=r.make(R.provideMerge(o,z),{memoMap:B});return{runSync:(k)=>I().runSync(d(p.use(k))),runPromiseExit:(k,q)=>I().runPromiseExit(d(p.use(k)),q),runPromise:(k,q)=>I().runPromise(d(p.use(k)),q),runFork:(k)=>I().runFork(d(p.use(k))),runCallback:(k)=>I().runCallback(d(p.use(k)))}}
|
|
3
3
|
export{w as qr,C as rr,y as sr,U as tr,H as ur,d as vr,F as wr};
|