@qitqode/qitqode-android-arm64 0.2.14 → 0.2.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/bun +2 -2
  2. package/bundle/{chunk-6wmtbebc.js → chunk-2fged9vy.js} +1 -1
  3. package/bundle/{chunk-358wdvj7.js → chunk-2pw56zpj.js} +1 -1
  4. package/bundle/{chunk-6kch0q2d.js → chunk-2tkgtasa.js} +1 -1
  5. package/bundle/{chunk-07b4pkk6.js → chunk-4b56k59w.js} +1 -1
  6. package/bundle/{chunk-47jkx37s.js → chunk-4gzggzc0.js} +1 -1
  7. package/bundle/{chunk-fpzkyzny.js → chunk-4jfnhghx.js} +1 -1
  8. package/bundle/{chunk-4hvenszg.js → chunk-4xcwnwd6.js} +1 -1
  9. package/bundle/{chunk-1mfdmm2t.js → chunk-4yd2vvh6.js} +1 -1
  10. package/bundle/{chunk-y1v7mf1a.js → chunk-5asf8f41.js} +72 -72
  11. package/bundle/chunk-5re7995e.js +2 -0
  12. package/bundle/{chunk-nrzca9yd.js → chunk-6k0y2332.js} +1 -1
  13. package/bundle/{chunk-pp10epga.js → chunk-6qwnty59.js} +1 -1
  14. package/bundle/{chunk-fd04358e.js → chunk-6zdzbmzs.js} +298 -297
  15. package/bundle/{chunk-2w79k0mh.js → chunk-76wm7tw8.js} +1 -1
  16. package/bundle/{chunk-k6gdmqff.js → chunk-7t63wz2f.js} +1 -1
  17. package/bundle/{chunk-hx13a8es.js → chunk-83n11xym.js} +1 -1
  18. package/bundle/{chunk-e8s4mp5n.js → chunk-878sb0es.js} +1 -1
  19. package/bundle/{chunk-4p9fny77.js → chunk-8mqcar7f.js} +1 -1
  20. package/bundle/{chunk-j1bv93m4.js → chunk-ae1b15bd.js} +1 -1
  21. package/bundle/{chunk-avzaqy6a.js → chunk-apneazwv.js} +1 -1
  22. package/bundle/{chunk-gnh8c49b.js → chunk-aw5yv01t.js} +1 -1
  23. package/bundle/{chunk-1gdt9q05.js → chunk-b6m5tr80.js} +1 -1
  24. package/bundle/{chunk-7xc73qb1.js → chunk-baq0wk3q.js} +1 -1
  25. package/bundle/{chunk-ffz334ab.js → chunk-c1wc4b5q.js} +1 -1
  26. package/bundle/{chunk-2ascwm7j.js → chunk-csy1v12x.js} +1 -1
  27. package/bundle/{chunk-9z7y4x7q.js → chunk-djdfpezf.js} +1 -1
  28. package/bundle/{chunk-9zsp3qkh.js → chunk-dpbm03yh.js} +1 -1
  29. package/bundle/{chunk-7a4sb6q7.js → chunk-e37gd3p2.js} +1 -1
  30. package/bundle/{chunk-bga4kqd1.js → chunk-estc7tzt.js} +1 -1
  31. package/bundle/{chunk-9gxyt2ay.js → chunk-f0x3q5dj.js} +1 -1
  32. package/bundle/{chunk-vnstr4g1.js → chunk-ffynh19k.js} +1 -1
  33. package/bundle/{chunk-y3dpyz2d.js → chunk-fgr9xshx.js} +1 -1
  34. package/bundle/{chunk-qpggztkq.js → chunk-fswt9qc0.js} +1 -1
  35. package/bundle/{chunk-2g4kxtz0.js → chunk-gww6abk3.js} +1 -1
  36. package/bundle/{chunk-qqsj69m2.js → chunk-h6b5966p.js} +1 -1
  37. package/bundle/{chunk-jvx7jtm4.js → chunk-hmm0gj34.js} +1 -1
  38. package/bundle/{chunk-8b9z8j3z.js → chunk-hmmn62jg.js} +1 -1
  39. package/bundle/{chunk-26e51217.js → chunk-j89sv999.js} +1 -1
  40. package/bundle/{chunk-05bkxat0.js → chunk-k4wfq9cn.js} +1 -1
  41. package/bundle/{chunk-n6pn4f3r.js → chunk-k8dbc1p5.js} +1 -1
  42. package/bundle/{chunk-9thgxbze.js → chunk-k9b4005p.js} +1 -1
  43. package/bundle/{chunk-9znfb8f2.js → chunk-kegvr7wt.js} +1 -1
  44. package/bundle/{chunk-00r3he5x.js → chunk-kht2kwam.js} +1 -1
  45. package/bundle/{chunk-gkf7x1yj.js → chunk-knqpyc7s.js} +1 -1
  46. package/bundle/chunk-mdxtt9wv.js +8 -0
  47. package/bundle/{chunk-8jkqyf9n.js → chunk-mnjz8nqs.js} +1 -1
  48. package/bundle/{chunk-zpjtse0z.js → chunk-mq3w4z8k.js} +2 -2
  49. package/bundle/{chunk-0ks20gz1.js → chunk-mreacz8r.js} +1 -1
  50. package/bundle/{chunk-ykvgmje9.js → chunk-n4qbnecw.js} +1 -1
  51. package/bundle/{chunk-gvf6ek9f.js → chunk-pqzx9ha6.js} +1 -1
  52. package/bundle/{chunk-kdqhwa65.js → chunk-q896qkhe.js} +1 -1
  53. package/bundle/{chunk-ngygp66y.js → chunk-qk6jh32z.js} +1 -1
  54. package/bundle/{chunk-6d4xc6br.js → chunk-rk4c0zat.js} +1 -1
  55. package/bundle/{chunk-dn0437c1.js → chunk-rt49c6js.js} +1 -1
  56. package/bundle/{chunk-34yk99ep.js → chunk-tkbjcznz.js} +1 -1
  57. package/bundle/{chunk-7s9msscb.js → chunk-vgmgg994.js} +1 -1
  58. package/bundle/{chunk-chnr7pe5.js → chunk-vsv4p060.js} +1 -1
  59. package/bundle/{chunk-vzkdzhn0.js → chunk-w0t1ajhg.js} +1 -1
  60. package/bundle/{chunk-w4fr00s7.js → chunk-wne3v1fk.js} +1 -1
  61. package/bundle/{chunk-w214dwws.js → chunk-wyavgt96.js} +1 -1
  62. package/bundle/{chunk-ae1g5y4r.js → chunk-xxck1man.js} +1 -1
  63. package/bundle/{chunk-g738e799.js → chunk-y4cz5s3h.js} +1 -1
  64. package/bundle/{chunk-583d91xq.js → chunk-yhpwceqg.js} +1 -1
  65. package/bundle/{chunk-y5ydtbpd.js → chunk-yms3bsm7.js} +1 -1
  66. package/bundle/{chunk-wmj3xndt.js → chunk-ytfq6rn9.js} +1 -1
  67. package/bundle/{chunk-qz20b42s.js → chunk-yvtkx4x4.js} +1 -1
  68. package/bundle/{chunk-jwv6fda1.js → chunk-ywj77e0m.js} +1 -1
  69. package/bundle/{chunk-y18ptwk2.js → chunk-z93n3cbm.js} +1 -1
  70. package/bundle/{chunk-6y0wgz2j.js → chunk-zbt53cb5.js} +1 -1
  71. package/bundle/{chunk-bm8azfnt.js → chunk-zhhcfqhh.js} +1 -1
  72. package/bundle/{chunk-2q78bdtj.js → chunk-zwxp07yc.js} +1 -1
  73. package/bundle/index.js +3 -3
  74. package/bundle/worker.js +1 -1
  75. package/package.json +1 -1
  76. package/bundle/chunk-1a08ffyd.js +0 -2
  77. package/bundle/chunk-jvvctqjd.js +0 -8
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{Gk as e}from"./chunk-y1v7mf1a.js";import{Gl as r}from"./chunk-dn0437c1.js";import{nu as o}from"./chunk-33mzqyyb.js";var s=o.object({id:e.zod,type:o.string(),name:o.string(),branch:o.string().nullable(),directory:o.string().nullable(),extra:o.unknown().nullable(),projectID:r.zod});
2
+ import{Gk as e}from"./chunk-5asf8f41.js";import{Gl as r}from"./chunk-rt49c6js.js";import{nu as o}from"./chunk-33mzqyyb.js";var s=o.object({id:e.zod,type:o.string(),name:o.string(),branch:o.string().nullable(),directory:o.string().nullable(),extra:o.unknown().nullable(),projectID:r.zod});
3
3
  export{s as Lg};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Bg as i,Cg as j,Dg as k,Eg as l,Fg as m,Gg as n}from"./chunk-9gxyt2ay.js";import"./chunk-qn1fhqyw.js";import{ep as a,fp as b,gp as c,hp as d,ip as e,jp as f,np as g,op as h}from"./chunk-pp10epga.js";import"./chunk-j2snkw45.js";import"./chunk-bmdqb48f.js";import"./chunk-1mfdmm2t.js";import"./chunk-fkq0v5qv.js";import"./chunk-1e75j4m1.js";import"./chunk-1a08ffyd.js";import"./chunk-8jkqyf9n.js";import"./chunk-6yshpz0z.js";import"./chunk-5dvy83ms.js";import"./chunk-ffx0cr44.js";import"./chunk-33mzqyyb.js";import"./chunk-sg9enzsp.js";import"./chunk-5q98z8ck.js";import"./chunk-wfpnv00c.js";import"./chunk-9kc2th5c.js";import"./chunk-sh03ka27.js";export{f as resolveDevicePoll,h as refreshAccessToken,g as probeToken,l as loginDevice,n as loginBrowser,m as login,b as isReplitEnv,j as isNearExpiry,c as getConfig,i as getCallbackUri,k as fetchQreditsBalance,a as checkoutApiKey,d as ForgewiseError,e as DeviceFlowUnsupportedError};
2
+ import{Bg as i,Cg as j,Dg as k,Eg as l,Fg as m,Gg as n}from"./chunk-f0x3q5dj.js";import"./chunk-qn1fhqyw.js";import{ep as a,fp as b,gp as c,hp as d,ip as e,jp as f,np as g,op as h}from"./chunk-6qwnty59.js";import"./chunk-j2snkw45.js";import"./chunk-bmdqb48f.js";import"./chunk-4yd2vvh6.js";import"./chunk-fkq0v5qv.js";import"./chunk-1e75j4m1.js";import"./chunk-5re7995e.js";import"./chunk-mnjz8nqs.js";import"./chunk-6yshpz0z.js";import"./chunk-5dvy83ms.js";import"./chunk-ffx0cr44.js";import"./chunk-33mzqyyb.js";import"./chunk-sg9enzsp.js";import"./chunk-5q98z8ck.js";import"./chunk-wfpnv00c.js";import"./chunk-9kc2th5c.js";import"./chunk-sh03ka27.js";export{f as resolveDevicePoll,h as refreshAccessToken,g as probeToken,l as loginDevice,n as loginBrowser,m as login,b as isReplitEnv,j as isNearExpiry,c as getConfig,i as getCallbackUri,k as fetchQreditsBalance,a as checkoutApiKey,d as ForgewiseError,e as DeviceFlowUnsupportedError};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{In as z2}from"./chunk-h036zy9e.js";import{Hr as i0,Jr as s0}from"./chunk-6kch0q2d.js";import{Zs as Q2}from"./chunk-2w3n0q9m.js";import{ct as E0}from"./chunk-fdmz0502.js";import{kt as x0}from"./chunk-8jkqyf9n.js";import{Gt as t}from"./chunk-6yshpz0z.js";import{Pt as e}from"./chunk-5dvy83ms.js";import{Zt as $2,du as f,hu as S,iu as a0,ku as o,mu as j0}from"./chunk-ffx0cr44.js";import{nu as p}from"./chunk-33mzqyyb.js";import{Rz as d0}from"./chunk-wfpnv00c.js";import{BC as V0,FF as g,SA as o0,VH as K0,VO as w,_F as c,fL as Z2,gI as J,nC as L}from"./chunk-9kc2th5c.js";import{uP as W0,wP as e0,yP as L2}from"./chunk-sh03ka27.js";function z0(Z,Q=!1){let z=Z.length,$=0,X="",Y=0,U=16,G=0,W=0,I=0,H=0,q=0;function R(j,_){let V=0,B=0;while(V<j||!_){let M=Z.charCodeAt($);if(M>=48&&M<=57)B=B*16+M-48;else if(M>=65&&M<=70)B=B*16+M-65+10;else if(M>=97&&M<=102)B=B*16+M-97+10;else break;$++,V++}if(V<j)B=-1;return B}function N(j){$=j,X="",Y=0,U=16,q=0}function A(){let j=$;if(Z.charCodeAt($)===48)$++;else{$++;while($<Z.length&&s(Z.charCodeAt($)))$++}if($<Z.length&&Z.charCodeAt($)===46)if($++,$<Z.length&&s(Z.charCodeAt($))){$++;while($<Z.length&&s(Z.charCodeAt($)))$++}else return q=3,Z.substring(j,$);let _=$;if($<Z.length&&(Z.charCodeAt($)===69||Z.charCodeAt($)===101)){if($++,$<Z.length&&Z.charCodeAt($)===43||Z.charCodeAt($)===45)$++;if($<Z.length&&s(Z.charCodeAt($))){$++;while($<Z.length&&s(Z.charCodeAt($)))$++;_=$}else q=3}return Z.substring(j,_)}function O(){let j="",_=$;while(!0){if($>=z){j+=Z.substring(_,$),q=2;break}let V=Z.charCodeAt($);if(V===34){j+=Z.substring(_,$),$++;break}if(V===92){if(j+=Z.substring(_,$),$++,$>=z){q=2;break}switch(Z.charCodeAt($++)){case 34:j+='"';break;case 92:j+="\\";break;case 47:j+="/";break;case 98:j+="\b";break;case 102:j+="\f";break;case 110:j+=`
2
+ import{In as z2}from"./chunk-h036zy9e.js";import{Hr as i0,Jr as s0}from"./chunk-2tkgtasa.js";import{Zs as Q2}from"./chunk-2w3n0q9m.js";import{ct as E0}from"./chunk-fdmz0502.js";import{kt as x0}from"./chunk-mnjz8nqs.js";import{Gt as t}from"./chunk-6yshpz0z.js";import{Pt as e}from"./chunk-5dvy83ms.js";import{Zt as $2,du as f,hu as S,iu as a0,ku as o,mu as j0}from"./chunk-ffx0cr44.js";import{nu as p}from"./chunk-33mzqyyb.js";import{Rz as d0}from"./chunk-wfpnv00c.js";import{BC as V0,FF as g,SA as o0,VH as K0,VO as w,_F as c,fL as Z2,gI as J,nC as L}from"./chunk-9kc2th5c.js";import{uP as W0,wP as e0,yP as L2}from"./chunk-sh03ka27.js";function z0(Z,Q=!1){let z=Z.length,$=0,X="",Y=0,U=16,G=0,W=0,I=0,H=0,q=0;function R(j,_){let V=0,B=0;while(V<j||!_){let M=Z.charCodeAt($);if(M>=48&&M<=57)B=B*16+M-48;else if(M>=65&&M<=70)B=B*16+M-65+10;else if(M>=97&&M<=102)B=B*16+M-97+10;else break;$++,V++}if(V<j)B=-1;return B}function N(j){$=j,X="",Y=0,U=16,q=0}function A(){let j=$;if(Z.charCodeAt($)===48)$++;else{$++;while($<Z.length&&s(Z.charCodeAt($)))$++}if($<Z.length&&Z.charCodeAt($)===46)if($++,$<Z.length&&s(Z.charCodeAt($))){$++;while($<Z.length&&s(Z.charCodeAt($)))$++}else return q=3,Z.substring(j,$);let _=$;if($<Z.length&&(Z.charCodeAt($)===69||Z.charCodeAt($)===101)){if($++,$<Z.length&&Z.charCodeAt($)===43||Z.charCodeAt($)===45)$++;if($<Z.length&&s(Z.charCodeAt($))){$++;while($<Z.length&&s(Z.charCodeAt($)))$++;_=$}else q=3}return Z.substring(j,_)}function O(){let j="",_=$;while(!0){if($>=z){j+=Z.substring(_,$),q=2;break}let V=Z.charCodeAt($);if(V===34){j+=Z.substring(_,$),$++;break}if(V===92){if(j+=Z.substring(_,$),$++,$>=z){q=2;break}switch(Z.charCodeAt($++)){case 34:j+='"';break;case 92:j+="\\";break;case 47:j+="/";break;case 98:j+="\b";break;case 102:j+="\f";break;case 110:j+=`
3
3
  `;break;case 114:j+="\r";break;case 116:j+="\t";break;case 117:let M=R(4,!0);if(M>=0)j+=String.fromCharCode(M);else q=4;break;default:q=5}_=$;continue}if(V>=0&&V<=31)if(Q0(V)){j+=Z.substring(_,$),q=2;break}else q=6;$++}return j}function K(){if(X="",q=0,Y=$,W=G,H=I,$>=z)return Y=z,U=17;let j=Z.charCodeAt($);if(b0(j)){do $++,X+=String.fromCharCode(j),j=Z.charCodeAt($);while(b0(j));return U=15}if(Q0(j)){if($++,X+=String.fromCharCode(j),j===13&&Z.charCodeAt($)===10)$++,X+=`
4
4
  `;return G++,I=$,U=14}switch(j){case 123:return $++,U=1;case 125:return $++,U=2;case 91:return $++,U=3;case 93:return $++,U=4;case 58:return $++,U=6;case 44:return $++,U=5;case 34:return $++,X=O(),U=10;case 47:let _=$-1;if(Z.charCodeAt($+1)===47){$+=2;while($<z){if(Q0(Z.charCodeAt($)))break;$++}return X=Z.substring(_,$),U=12}if(Z.charCodeAt($+1)===42){$+=2;let V=z-1,B=!1;while($<V){let M=Z.charCodeAt($);if(M===42&&Z.charCodeAt($+1)===47){$+=2,B=!0;break}if($++,Q0(M)){if(M===13&&Z.charCodeAt($)===10)$++;G++,I=$}}if(!B)$++,q=1;return X=Z.substring(_,$),U=13}return X+=String.fromCharCode(j),$++,U=16;case 45:if(X+=String.fromCharCode(j),$++,$===z||!s(Z.charCodeAt($)))return U=16;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return X+=A(),U=11;default:while($<z&&y(j))$++,j=Z.charCodeAt($);if(Y!==$){switch(X=Z.substring(Y,$),X){case"true":return U=8;case"false":return U=9;case"null":return U=7}return U=16}return X+=String.fromCharCode(j),$++,U=16}}function y(j){if(b0(j)||Q0(j))return!1;switch(j){case 125:case 93:case 123:case 91:case 34:case 58:case 44:case 47:return!1}return!0}function v(){let j;do j=K();while(j>=12&&j<=15);return j}return{setPosition:N,getPosition:()=>$,scan:Q?v:K,getToken:()=>U,getTokenValue:()=>X,getTokenOffset:()=>Y,getTokenLength:()=>$-Y,getTokenStartLine:()=>W,getTokenStartCharacter:()=>Y-H,getTokenError:()=>q}}function b0(Z){return Z===32||Z===9}function Q0(Z){return Z===10||Z===13}function s(Z){return Z>=48&&Z<=57}var u0;(function(Z){Z[Z.lineFeed=10]="lineFeed",Z[Z.carriageReturn=13]="carriageReturn",Z[Z.space=32]="space",Z[Z._0=48]="_0",Z[Z._1=49]="_1",Z[Z._2=50]="_2",Z[Z._3=51]="_3",Z[Z._4=52]="_4",Z[Z._5=53]="_5",Z[Z._6=54]="_6",Z[Z._7=55]="_7",Z[Z._8=56]="_8",Z[Z._9=57]="_9",Z[Z.a=97]="a",Z[Z.b=98]="b",Z[Z.c=99]="c",Z[Z.d=100]="d",Z[Z.e=101]="e",Z[Z.f=102]="f",Z[Z.g=103]="g",Z[Z.h=104]="h",Z[Z.i=105]="i",Z[Z.j=106]="j",Z[Z.k=107]="k",Z[Z.l=108]="l",Z[Z.m=109]="m",Z[Z.n=110]="n",Z[Z.o=111]="o",Z[Z.p=112]="p",Z[Z.q=113]="q",Z[Z.r=114]="r",Z[Z.s=115]="s",Z[Z.t=116]="t",Z[Z.u=117]="u",Z[Z.v=118]="v",Z[Z.w=119]="w",Z[Z.x=120]="x",Z[Z.y=121]="y",Z[Z.z=122]="z",Z[Z.A=65]="A",Z[Z.B=66]="B",Z[Z.C=67]="C",Z[Z.D=68]="D",Z[Z.E=69]="E",Z[Z.F=70]="F",Z[Z.G=71]="G",Z[Z.H=72]="H",Z[Z.I=73]="I",Z[Z.J=74]="J",Z[Z.K=75]="K",Z[Z.L=76]="L",Z[Z.M=77]="M",Z[Z.N=78]="N",Z[Z.O=79]="O",Z[Z.P=80]="P",Z[Z.Q=81]="Q",Z[Z.R=82]="R",Z[Z.S=83]="S",Z[Z.T=84]="T",Z[Z.U=85]="U",Z[Z.V=86]="V",Z[Z.W=87]="W",Z[Z.X=88]="X",Z[Z.Y=89]="Y",Z[Z.Z=90]="Z",Z[Z.asterisk=42]="asterisk",Z[Z.backslash=92]="backslash",Z[Z.closeBrace=125]="closeBrace",Z[Z.closeBracket=93]="closeBracket",Z[Z.colon=58]="colon",Z[Z.comma=44]="comma",Z[Z.dot=46]="dot",Z[Z.doubleQuote=34]="doubleQuote",Z[Z.minus=45]="minus",Z[Z.openBrace=123]="openBrace",Z[Z.openBracket=91]="openBracket",Z[Z.plus=43]="plus",Z[Z.slash=47]="slash",Z[Z.formFeed=12]="formFeed",Z[Z.tab=9]="tab"})(u0||(u0={}));var x=Array(20).fill(0).map((Z,Q)=>{return" ".repeat(Q)});var L0={" ":{"\n":Array(200).fill(0).map((Z,Q)=>{return`
5
5
  `+" ".repeat(Q)}),"\r":Array(200).fill(0).map((Z,Q)=>{return"\r"+" ".repeat(Q)}),"\r\n":Array(200).fill(0).map((Z,Q)=>{return`\r
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{ch as r}from"./chunk-fd04358e.js";import{Lj as e}from"./chunk-y1v7mf1a.js";import{Yl as t}from"./chunk-47jkx37s.js";import{Nn as l}from"./chunk-j3agzs13.js";import{nu as a}from"./chunk-33mzqyyb.js";import{VO as o}from"./chunk-9kc2th5c.js";var S={PromptAppend:t.define("tui.prompt.append",a.object({text:a.string()})),CommandExecute:t.define("tui.command.execute",a.object({command:a.union([a.enum(["session.list","session.new","session.share","session.interrupt","session.compact","session.page.up","session.page.down","session.line.up","session.line.down","session.half.page.up","session.half.page.down","session.first","session.last","prompt.clear","prompt.submit","agent.cycle"]),a.string()])})),ToastShow:t.define("tui.toast.show",a.object({title:a.string().optional(),message:a.string(),variant:a.enum(["info","success","warning","error"]),duration:a.number().default(5000).optional().describe("Duration in milliseconds")})),SessionSelect:t.define("tui.session.select",a.object({sessionID:e.zod.describe("Session ID to navigate to")})),InstructionsLoaded:r};class m extends o.Class("ConsoleState")({consoleManagedProviders:o.mutable(o.Array(o.String)),activeOrgName:o.optional(o.String),switchableOrgCount:o.Number}){static zod=l(this)}var f=m.make({consoleManagedProviders:[],activeOrgName:void 0,switchableOrgCount:0});
2
+ import{ch as r}from"./chunk-6zdzbmzs.js";import{Lj as e}from"./chunk-5asf8f41.js";import{Yl as t}from"./chunk-4gzggzc0.js";import{Nn as l}from"./chunk-j3agzs13.js";import{nu as a}from"./chunk-33mzqyyb.js";import{VO as o}from"./chunk-9kc2th5c.js";var S={PromptAppend:t.define("tui.prompt.append",a.object({text:a.string()})),CommandExecute:t.define("tui.command.execute",a.object({command:a.union([a.enum(["session.list","session.new","session.share","session.interrupt","session.compact","session.page.up","session.page.down","session.line.up","session.line.down","session.half.page.up","session.half.page.down","session.first","session.last","prompt.clear","prompt.submit","agent.cycle"]),a.string()])})),ToastShow:t.define("tui.toast.show",a.object({title:a.string().optional(),message:a.string(),variant:a.enum(["info","success","warning","error"]),duration:a.number().default(5000).optional().describe("Duration in milliseconds")})),SessionSelect:t.define("tui.session.select",a.object({sessionID:e.zod.describe("Session ID to navigate to")})),InstructionsLoaded:r};class m extends o.Class("ConsoleState")({consoleManagedProviders:o.mutable(o.Array(o.String)),activeOrgName:o.optional(o.String),switchableOrgCount:o.Number}){static zod=l(this)}var f=m.make({consoleManagedProviders:[],activeOrgName:void 0,switchableOrgCount:0});
3
3
  export{S as yg,m as zg,f as Ag};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{p as y,q as T,r as M,s as D,t as U}from"./chunk-7s9msscb.js";import{Yd as X,Zd as _,_d as $,be as v}from"./chunk-p0852vfn.js";import"./chunk-ej0yzstw.js";import{fe as j}from"./chunk-w8nj5ph5.js";import{cg as V}from"./chunk-psmwrvqs.js";import{Ml as J}from"./chunk-dn0437c1.js";import"./chunk-47jkx37s.js";import"./chunk-31a47ptm.js";import{in as F,wn as G}from"./chunk-hx13a8es.js";import"./chunk-h036zy9e.js";import"./chunk-j3agzs13.js";import"./chunk-3152y1q9.js";import"./chunk-71jmhvef.js";import"./chunk-9znfb8f2.js";import"./chunk-6kch0q2d.js";import"./chunk-6cztstry.js";import"./chunk-1mfdmm2t.js";import"./chunk-fkq0v5qv.js";import"./chunk-1e75j4m1.js";import"./chunk-2w3n0q9m.js";import"./chunk-6dd2dx69.js";import"./chunk-fdmz0502.js";import"./chunk-8jkqyf9n.js";import{Jt as Z}from"./chunk-6yshpz0z.js";import"./chunk-5dvy83ms.js";import{mu as E}from"./chunk-ffx0cr44.js";import"./chunk-33mzqyyb.js";import"./chunk-sg9enzsp.js";import"./chunk-5q98z8ck.js";import"./chunk-wfpnv00c.js";import"./chunk-9kc2th5c.js";import"./chunk-sh03ka27.js";import h from"path";var b={spinner:()=>v(),log:{error:(w)=>X.error(w),info:(w)=>X.info(w),success:(w)=>X.success(w)},resolve:(w)=>G(w),...T,global:E.Path.config};function P(w){if(!w||typeof w!=="object")return;if(!("cause"in w))return;return w.cause}function I(w,q=b){let H=w.mod,K=Boolean(w.force),W=Boolean(w.global);return async(O)=>{let R=q.spinner();R.start("Installing plugin package...");let S=await M(H,q);if(!S.ok){R.stop("Install failed",1),q.log.error(`Could not install "${H}"`);let B=y(S.error);if(B.detail)q.log.error(B.detail);if(B.missing)q.log.info("This package depends on a version that is not available in your npm registry."),q.log.info("Check npm registry/auth settings and try again.");return!1}R.stop("Plugin package ready");let L=q.spinner();L.start("Reading plugin manifest...");let z=await D(S.target);if(!z.ok){if(z.code==="manifest_read_failed")return L.stop("Manifest read failed",1),q.log.error(`Installed "${H}" but failed to read ${z.file}`),q.log.error(Z(P(z.error)??z.error)),!1;if(z.code==="manifest_no_targets")return L.stop("No plugin targets found",1),q.log.error(`"${H}" does not expose plugin entrypoints in package.json`),q.log.info('Expected one of: exports["./tui"], exports["./server"], package.json main for server, or package.json["oc-themes"] for tui themes.'),!1;return L.stop("Manifest read failed",1),!1}L.stop(`Detected ${z.targets.map((B)=>B.kind).join(" + ")} target${z.targets.length===1?"":"s"}`);let N=q.spinner();N.start("Updating plugin config...");let A=await U({spec:H,targets:z.targets,force:K,global:W,vcs:O.vcs,worktree:O.worktree,directory:O.directory,config:q.global},q);if(!A.ok){if(A.code==="invalid_json")return N.stop(`Failed updating ${A.kind} config`,1),q.log.error(`Invalid JSON in ${A.file} (${A.parse} at line ${A.line}, column ${A.col})`),q.log.info("Fix the config file and run the command again."),!1;return N.stop("Failed updating plugin config",1),q.log.error(Z(A.error)),!1}N.stop("Plugin config updated");for(let B of A.items){if(B.mode==="noop"){q.log.info(`Already configured in ${B.file}`);continue}if(B.mode==="replace"){q.log.info(`Replaced in ${B.file}`);continue}q.log.info(`Added to ${B.file}`)}return q.log.success(`Installed ${H}`),q.log.info(W?`Scope: global (${A.dir})`:`Scope: local (${A.dir})`),!0}}async function x(w,q=b,H=(K)=>V.println(K)){let K=w.vcs==="git"&&w.worktree!=="/",W=[{scope:"local",dir:h.join(K?w.worktree:w.directory,".qitqode")},{scope:"global",dir:q.global}],O=0;for(let{scope:R,dir:S}of W)for(let L of["qitqode","tui"])for(let z of q.files(S,L)){if(!await q.exists(z))continue;let N=await q.readText(z).catch(()=>{return});if(N===void 0)continue;let A=[],B=F(N,A,{allowTrailingComma:!0});if(A.length){q.log.error(`Invalid JSON in ${z} \u2014 skipped`);continue}let Y=B?.plugin;if(!Array.isArray(Y)||Y.length===0)continue;q.log.info(`${R} \xB7 ${z}`);for(let Q of Y){let C=typeof Q==="string"?Q:Array.isArray(Q)?String(Q[0]):void 0;if(!C)continue;let k=Array.isArray(Q)&&Q[1]?" (with options)":"";H(" "+C+k),O++}}if(O===0)q.log.info("No plugins configured.")}var i=j({command:"plugin <module>",aliases:["plug"],describe:"install plugin and update config",builder:(w)=>{return w.positional("module",{type:"string",describe:"npm module name"}).option("global",{alias:["g"],type:"boolean",default:!1,describe:"install in global config"}).option("force",{alias:["f"],type:"boolean",default:!1,describe:"replace existing plugin version"})},handler:async(w)=>{let q=String(w.module??"").trim();if(!q){V.error("module is required"),process.exitCode=1;return}if(q==="list"){V.empty(),_("Configured plugins"),await J.provide({directory:process.cwd(),fn:async()=>{await x({vcs:J.project.vcs,worktree:J.worktree,directory:J.directory})}}),$("Done");return}V.empty(),_(`Install plugin ${q}`);let H=I({mod:q,global:Boolean(w.global),force:Boolean(w.force)}),K=!0;if(await J.provide({directory:process.cwd(),fn:async()=>{K=await H({vcs:J.project.vcs,worktree:J.worktree,directory:J.directory})}}),$("Done"),!K)process.exitCode=1}});export{x as listPlugins,I as createPlugTask,i as PluginCommand};
2
+ import{p as y,q as T,r as M,s as D,t as U}from"./chunk-vgmgg994.js";import{Yd as X,Zd as _,_d as $,be as v}from"./chunk-p0852vfn.js";import"./chunk-ej0yzstw.js";import{fe as j}from"./chunk-w8nj5ph5.js";import{cg as V}from"./chunk-psmwrvqs.js";import{Ml as J}from"./chunk-rt49c6js.js";import"./chunk-4gzggzc0.js";import"./chunk-31a47ptm.js";import{in as F,wn as G}from"./chunk-83n11xym.js";import"./chunk-h036zy9e.js";import"./chunk-j3agzs13.js";import"./chunk-3152y1q9.js";import"./chunk-71jmhvef.js";import"./chunk-kegvr7wt.js";import"./chunk-2tkgtasa.js";import"./chunk-6cztstry.js";import"./chunk-4yd2vvh6.js";import"./chunk-fkq0v5qv.js";import"./chunk-1e75j4m1.js";import"./chunk-2w3n0q9m.js";import"./chunk-6dd2dx69.js";import"./chunk-fdmz0502.js";import"./chunk-mnjz8nqs.js";import{Jt as Z}from"./chunk-6yshpz0z.js";import"./chunk-5dvy83ms.js";import{mu as E}from"./chunk-ffx0cr44.js";import"./chunk-33mzqyyb.js";import"./chunk-sg9enzsp.js";import"./chunk-5q98z8ck.js";import"./chunk-wfpnv00c.js";import"./chunk-9kc2th5c.js";import"./chunk-sh03ka27.js";import h from"path";var b={spinner:()=>v(),log:{error:(w)=>X.error(w),info:(w)=>X.info(w),success:(w)=>X.success(w)},resolve:(w)=>G(w),...T,global:E.Path.config};function P(w){if(!w||typeof w!=="object")return;if(!("cause"in w))return;return w.cause}function I(w,q=b){let H=w.mod,K=Boolean(w.force),W=Boolean(w.global);return async(O)=>{let R=q.spinner();R.start("Installing plugin package...");let S=await M(H,q);if(!S.ok){R.stop("Install failed",1),q.log.error(`Could not install "${H}"`);let B=y(S.error);if(B.detail)q.log.error(B.detail);if(B.missing)q.log.info("This package depends on a version that is not available in your npm registry."),q.log.info("Check npm registry/auth settings and try again.");return!1}R.stop("Plugin package ready");let L=q.spinner();L.start("Reading plugin manifest...");let z=await D(S.target);if(!z.ok){if(z.code==="manifest_read_failed")return L.stop("Manifest read failed",1),q.log.error(`Installed "${H}" but failed to read ${z.file}`),q.log.error(Z(P(z.error)??z.error)),!1;if(z.code==="manifest_no_targets")return L.stop("No plugin targets found",1),q.log.error(`"${H}" does not expose plugin entrypoints in package.json`),q.log.info('Expected one of: exports["./tui"], exports["./server"], package.json main for server, or package.json["oc-themes"] for tui themes.'),!1;return L.stop("Manifest read failed",1),!1}L.stop(`Detected ${z.targets.map((B)=>B.kind).join(" + ")} target${z.targets.length===1?"":"s"}`);let N=q.spinner();N.start("Updating plugin config...");let A=await U({spec:H,targets:z.targets,force:K,global:W,vcs:O.vcs,worktree:O.worktree,directory:O.directory,config:q.global},q);if(!A.ok){if(A.code==="invalid_json")return N.stop(`Failed updating ${A.kind} config`,1),q.log.error(`Invalid JSON in ${A.file} (${A.parse} at line ${A.line}, column ${A.col})`),q.log.info("Fix the config file and run the command again."),!1;return N.stop("Failed updating plugin config",1),q.log.error(Z(A.error)),!1}N.stop("Plugin config updated");for(let B of A.items){if(B.mode==="noop"){q.log.info(`Already configured in ${B.file}`);continue}if(B.mode==="replace"){q.log.info(`Replaced in ${B.file}`);continue}q.log.info(`Added to ${B.file}`)}return q.log.success(`Installed ${H}`),q.log.info(W?`Scope: global (${A.dir})`:`Scope: local (${A.dir})`),!0}}async function x(w,q=b,H=(K)=>V.println(K)){let K=w.vcs==="git"&&w.worktree!=="/",W=[{scope:"local",dir:h.join(K?w.worktree:w.directory,".qitqode")},{scope:"global",dir:q.global}],O=0;for(let{scope:R,dir:S}of W)for(let L of["qitqode","tui"])for(let z of q.files(S,L)){if(!await q.exists(z))continue;let N=await q.readText(z).catch(()=>{return});if(N===void 0)continue;let A=[],B=F(N,A,{allowTrailingComma:!0});if(A.length){q.log.error(`Invalid JSON in ${z} \u2014 skipped`);continue}let Y=B?.plugin;if(!Array.isArray(Y)||Y.length===0)continue;q.log.info(`${R} \xB7 ${z}`);for(let Q of Y){let C=typeof Q==="string"?Q:Array.isArray(Q)?String(Q[0]):void 0;if(!C)continue;let k=Array.isArray(Q)&&Q[1]?" (with options)":"";H(" "+C+k),O++}}if(O===0)q.log.info("No plugins configured.")}var i=j({command:"plugin <module>",aliases:["plug"],describe:"install plugin and update config",builder:(w)=>{return w.positional("module",{type:"string",describe:"npm module name"}).option("global",{alias:["g"],type:"boolean",default:!1,describe:"install in global config"}).option("force",{alias:["f"],type:"boolean",default:!1,describe:"replace existing plugin version"})},handler:async(w)=>{let q=String(w.module??"").trim();if(!q){V.error("module is required"),process.exitCode=1;return}if(q==="list"){V.empty(),_("Configured plugins"),await J.provide({directory:process.cwd(),fn:async()=>{await x({vcs:J.project.vcs,worktree:J.worktree,directory:J.directory})}}),$("Done");return}V.empty(),_(`Install plugin ${q}`);let H=I({mod:q,global:Boolean(w.global),force:Boolean(w.force)}),K=!0;if(await J.provide({directory:process.cwd(),fn:async()=>{K=await H({vcs:J.project.vcs,worktree:J.worktree,directory:J.directory})}}),$("Done"),!K)process.exitCode=1}});export{x as listPlugins,I as createPlugTask,i as PluginCommand};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Zo as MJ,bp as $J,tp as kJ}from"./chunk-pp10epga.js";import{Ip as qJ}from"./chunk-crqycrs4.js";import{et as F}from"./chunk-1a08ffyd.js";import{It as LJ}from"./chunk-6yshpz0z.js";import{Pt as e,Xt as SJ}from"./chunk-5dvy83ms.js";import{ju as OJ,mu as QJ}from"./chunk-ffx0cr44.js";var cJ=0.9,mJ=256,VJ="[Earlier tool result removed to fit the request size limit]",c;function h(J){return Buffer.byteLength(JSON.stringify(J),"utf8")}function NJ(){return e.QITQODE_QLEX_MAX_REQUEST_BYTES??c}function JJ(J){let K=e.QITQODE_QLEX_MAX_REQUEST_BYTES;if(K!==void 0)return K;let Z=Math.max(1,Math.min(Math.floor(J*cJ),Math.floor(J)-1));return c=c===void 0?Z:Math.min(c,Z),c}function m(J,K){return!!J&&typeof J==="object"&&J.role===K}function DJ(J){let K=[],Z=0;while(Z<J.length){let $=Z,z=J[Z];if(Z++,m(z,"assistant")&&Array.isArray(z?.tool_calls)&&z.tool_calls.length>0)while(Z<J.length&&m(J[Z],"tool"))Z++;K.push({start:$,end:Z})}return K}function WJ(J,K){if(K.length===0)return[];let Z=-1;for(let $=K.length-1;$>=0;$--){let z=K[$],X=!1;for(let Y=z.start;Y<z.end;Y++)if(m(J[Y],"user"))X=!0;if(X){Z=$;break}}return K.filter(($,z)=>{if(z===K.length-1)return!1;if(z===Z)return!1;if($.start===0&&m(J[0],"system"))return!1;return!0})}function KJ(J,K){let Z=h(J),$={toolResultsElided:0,unitsDropped:0},z=()=>({body:J,bytes:Z,originalBytes:Z,reduced:!1,actions:$});if(!J||typeof J!=="object")return z();let X=J.messages;if(!Array.isArray(X))return z();let Y=X.map((j)=>j&&typeof j==="object"?{...j}:j),H=()=>({...J,messages:Y}),V=()=>h(H())<=K;{let j=Y;for(let N of WJ(j,DJ(j))){let L=!1;for(let O=N.start;O<N.end;O++){let k=j[O];if(!m(k,"tool"))continue;let w=k?.content;if(typeof w!=="string"||w.length<mJ)continue;if(w===VJ)continue;j[O]={...k,content:VJ},$.toolResultsElided++,L=!0}if(L&&V())break}}if(!V())for(;;){let j=Y,L=WJ(j,DJ(j))[0];if(!L)break;if(Y=[...j.slice(0,L.start),...j.slice(L.end)],$.unitsDropped++,V())break}let U=H(),P=h(U);return{body:U,bytes:P,originalBytes:Z,reduced:P<Z&&P<=K,actions:$}}import y from"fs/promises";import EJ from"path";import{randomUUID as dJ}from"crypto";var E=SJ({service:"provider.qlex"}),iJ=F.streamUrl(),lJ=F.omniqueryBaseUrl()+"/runOrchestrated",rJ=new Set(["rate_limited","transient","stream_truncated","stream_failed"]);function d(J,K){return K!==!1&&rJ.has(J)}function a(J){return typeof J==="string"&&/^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/.test(J)?J:void 0}function x(J,K){let Z=J;if(K.status!==void 0)Z.status=K.status;if(K.upstreamCode!==void 0)Z.upstreamCode=K.upstreamCode;let $=a(K.requestId);if($!==void 0)Z.requestId=$;if(Z.category=K.category,Z.retryable=d(K.category,K.retryable),K.outputBudgetRecoveryAvailable!==void 0)Z.outputBudgetRecoveryAvailable=K.outputBudgetRecoveryAvailable;if(K.outputBudgetRecoveryTokens!==void 0)Z.outputBudgetRecoveryTokens=K.outputBudgetRecoveryTokens}function b(J,K){return{...J,...K}}class wJ extends Error{name="QlexNotLoggedInError";constructor(J){super(F.copy().notLoggedIn);x(this,b({category:"invalid_credentials",retryable:!1},J))}}class RJ extends Error{name="QlexInsufficientBalanceError";constructor(J,K){super(F.copy().insufficientBalance(J));x(this,b({status:402,category:"billing",retryable:!1},K))}}class CJ extends Error{name="QlexRateLimitError";constructor(J){super(F.copy().rateLimit);x(this,b({status:429,category:"rate_limited",retryable:!0},J))}}class AJ extends Error{name="QlexInvalidCredentialsError";constructor(J,K){super(F.copy().invalidCredentials(J));x(this,b({status:401,category:"invalid_credentials",retryable:!1},K))}}class TJ extends Error{name="QlexRequestRejectedError";constructor(J,K,Z){super(F.copy().requestRejected(J,K));x(this,b({status:400,category:"request_rejected",retryable:!1},Z))}}class t extends Error{name="QlexRequestTooLargeError";stage;constructor(J="irreducible",K,Z){super(J==="after-reduction"?F.copy().requestTooLargeAfterReduction(K):F.copy().requestTooLargeIrreducible(K));this.stage=J,x(this,b({status:413,category:"request_too_large",retryable:!1},Z))}}class BJ extends Error{name="QlexRequestNotSentError";constructor(J,K){super(F.copy().requestNotSent(J));x(this,b({category:"request_rejected",retryable:!1},K))}}class u extends Error{name="QlexGatewayError";constructor(J,K){super(F.copy().gatewayUnavailable(J));x(this,b({category:"gateway_routing",retryable:!1},K))}}var oJ=60000,sJ=320000;function aK(J){return F.sanitizeUpstreamError(J)}class v extends Error{name="QlexStreamError";constructor(J,K,Z){let $=b({category:"unknown",retryable:!1},K);super($.category==="output_budget_exhausted"?F.copy().outputBudgetExhausted():$.category==="empty_output"?F.copy().emptyOutput():$.category==="stream_truncated"?F.copy().streamCutOff(Z):$.category==="stream_failed"?F.copy().streamFailedAfterRetries(Z):F.copy().streamFailed(J));x(this,$),LJ(this)}}var aJ=[{match:/\b(unauthori[sz]ed|forbidden|invalid[ _-]?(api[ _-]?key|token|credential)|expired[ _-]?token|authentication[ _-]?(failed|error)|401|403)\b/i,category:"invalid_credentials",retryable:!1},{match:/(output (?:token )?budget|maximum output tokens|max_tokens|finish[_ -]?reason.{0,20}(length|budget)|reasoning.{0,20}(budget|tokens))/i,category:"output_budget_exhausted",retryable:!1},{match:/\b(no visible output|empty output|produced no (?:visible )?(?:text|output)|nothing to display)\b/i,category:"empty_output",retryable:!1},{match:/\b(insufficient[ _-]?(credits?|qredits?|balance|funds)|payment[ _-]?required|quota[ _-]?exceeded|out[ _-]?of[ _-]?(credits?|qredits?)|402)\b/i,category:"billing",retryable:!1},{match:/\b(rate[ _-]?limit(ed|s)?|too[ _-]?many[ _-]?requests|429)\b/i,category:"rate_limited",retryable:!0},{match:/(unexpected end of (json|input|stream|data)|premature (close|end)|socket hang ?up|socket connection was closed unexpectedly|incomplete (response|output|json|message)|truncated|stream (ended|closed|terminated) (early|unexpectedly|prematurely)|\bECONNRESET\b|\bEPIPE\b)/i,category:"stream_truncated",retryable:!0},{match:/\b(overloaded|at capacity|service[ _-]?unavailable|temporarily[ _-]?unavailable|bad[ _-]?gateway|gateway[ _-]?time(d[ _-]?out|out)|timed[ _-]?out|502|503|504)\b/i,category:"transient",retryable:!0}],tJ={ERR_EMPTY_RESULT:{category:"empty_output",retryable:!1},ERR_TRUNCATED_OUTPUT:{category:"stream_truncated",retryable:!0},ERR_STREAM:{category:"stream_failed",retryable:!0}},eJ=/^\s*(ERR_[A-Z0-9_]+)\b(?:\s*(?:[\u2014\u2013:-]\s*)?)?/i,JK=/\b(req_[A-Za-z0-9][A-Za-z0-9_-]*)\b/;function GJ(J){let K=J??"",Z=eJ.exec(K),$=Z?K.slice(Z[0].length):K,z=IJ($),X=Z?.[1]?.toUpperCase()??z.upstreamCode,Y=z.requestId??a(JK.exec(K)?.[1]),H=z.retryable;if(X!==void 0){let V=tJ[X];if(V!==void 0)return{...V,upstreamCode:X,retryable:d(V.category,H??V.retryable),...Y?{requestId:Y}:{}}}for(let V of aJ)if(V.match.test($))return{category:V.category,retryable:d(V.category,H??V.retryable),...X?{upstreamCode:X}:{},...Y?{requestId:Y}:{}};return{category:"unknown",retryable:d("unknown",H),...X?{upstreamCode:X}:{},...Y?{requestId:Y}:{}}}function KK(J){return MJ(J)}function IJ(J){try{let K=JSON.parse(J);if(!K||typeof K!=="object"||Array.isArray(K))return{};let Z=K,$=Z.error&&typeof Z.error==="object"&&!Array.isArray(Z.error)?Z.error:void 0,z=Z.details&&typeof Z.details==="object"&&!Array.isArray(Z.details)?Z.details:void 0,X=[Z.requestId,$?.requestId,z?.requestId].map(a).find((V)=>V!==void 0),Y=Z.retryable===!1||$?.retryable===!1?!1:Z.retryable===!0||$?.retryable===!0?!0:void 0,H=$?.code??Z.code;return{...X!==void 0?{requestId:X}:{},...Y!==void 0?{retryable:Y}:{},...typeof H==="string"&&/^[A-Z][A-Z0-9_]{0,63}$/i.test(H)?{upstreamCode:H.toUpperCase()}:{}}}catch{return{}}}function xJ(J,K){let Z,$,z,X=!1;try{let N=JSON.parse(K);if(N&&typeof N==="object"){let L=N.error&&typeof N.error==="object"?N.error:void 0;if(typeof L?.code==="string")Z=L.code;else if(typeof N.code==="string")Z=N.code;if(typeof L?.message==="string")$=L.message;else if(typeof N.message==="string")$=N.message;if(typeof N.details?.field==="string")z=N.details.field}}catch(N){X=/^\s*[\[{]/.test(K)&&(ZK(K)||/unexpected end|end of json|unterminated string/i.test(String(N)))}let Y=Z?.toUpperCase()??"",{requestId:H,retryable:V}=IJ(K),U=(()=>{if(X)return"stream_truncated";if(J===402)return"billing";if(J===413)return"request_too_large";if(J===429)return"rate_limited";if(J===401||J===403)return Y==="ERR_GATEWAY_REQUIRED"||KK(K)?"gateway_routing":"invalid_credentials";if(Y.includes("CONFIG"))return"configuration";if(J>=500)return"transient";if(J>=400)return"request_rejected";return"unknown"})(),P=d(U,V),j={status:J,category:U,retryable:P};if(Z!==void 0)j.upstreamCode=Z;if($!==void 0)j.upstreamMessage=$;if(z!==void 0)j.field=z;if(H!==void 0)j.requestId=H;return j}function ZK(J){let K=0,Z=!1,$=!1;for(let z of J){if(Z){if($)$=!1;else if(z==="\\")$=!0;else if(z==='"')Z=!1;continue}if(z==='"')Z=!0;else if(z==="{"||z==="[")K++;else if(z==="}"||z==="]")K--;if(K<0)return!1}return Z||K>0}function $K(J){let K=F.tierBudgetFacts(J.tier),Z=J.advisory,$=Z?.tierOutputLimit??K?.output;if(J.requestedTotal!==void 0)return{total:$===void 0?J.requestedTotal:Math.min(J.requestedTotal,$)};if(!Z&&!K)return{};let z=Z?.reasoningReserveTokens??K?.reasoningReserve??0,X=Z?.visibleOutputFloorTokens??K?.visibleOutputFloor??0,Y=Z?.recommendedTotalTokens??Z?.tierRecommendedStepTokens??K?.recommendedTotal??K?.recommendedStep??$,H=Z?.viableTotalFloorTokens??K?.viableTotalFloor??z+X,V=Y===void 0?H:Math.max(Y,H),U=Z?.reasoningReported??K?.reasoning;return{total:$===void 0?V:Math.min(V,$),reasoningBudget:U&&z>0?Math.min(z,V):void 0}}var zK=new Set(["coding","agent","research","review","chat"]);function XK(J){if(J===void 0)return;if(typeof J==="string"&&zK.has(J))return J;throw Error(`invalid Qortex posture: ${String(J)}`)}function YK(J){if(J===void 0)return;let K=Array.isArray(J)?J:[J];if(K.every((Z)=>typeof Z==="string"&&/^[^/\s]+\/[^/\s]+$/.test(Z)))return Array.isArray(J)?K:J;throw Error(`invalid Qortex directive registry key: ${String(J)}`)}function s(J){if(typeof J==="string")return J;if(Array.isArray(J))return J.map((K)=>{if(typeof K==="string")return K;if(K&&typeof K==="object"){let Z=K;if(typeof Z.text==="string")return Z.text;if(typeof Z.content==="string")return Z.content}return""}).join("");if(J===void 0||J===null)return"";return String(J)}var HK="[Tool call]",VK="[Tool returned no output]";function bJ(J){if(!Array.isArray(J))return{messages:J,dropped:[]};let K=[];return{messages:J.flatMap(($,z)=>{if(!$||typeof $!=="object")return K.push({index:z,role:typeof $,reason:"not-an-object"}),[];let X=$,Y=s(X.content);if(Y.trim().length>0)return[{...X,content:Y}];if(X.role==="assistant"&&Array.isArray(X.tool_calls)&&X.tool_calls.length>0)return[{...X,content:HK}];if(X.role==="tool"&&typeof X.tool_call_id==="string"&&X.tool_call_id.trim().length>0)return[{...X,content:VK}];return K.push({index:z,role:typeof X.role==="string"?X.role:"unknown",reason:"empty-content"}),[]}),dropped:K}}function DK(J){return bJ(J).messages}function WK(J){if(!Array.isArray(J))return!1;return J.some((K)=>!!K&&typeof K==="object"&&K.role==="user")}function NK(J){if(!Array.isArray(J))return!1;return J.some((K)=>{if(!K||typeof K!=="object")return!1;let Z=K;if(Z.role!=="user")return!1;return s(Z.content).trim().length>0})}function GK(J){if(!Array.isArray(J))return J;let K=(X)=>!!X&&typeof X==="object"&&X.role==="system",Z=0;while(Z<J.length&&K(J[Z]))Z++;if(Z<=1)return J;let $=J.slice(0,Z),z=$.map((X)=>typeof X.content==="string"?X.content:String(X.content??"")).filter((X)=>X.length>0).join(`
2
+ import{Zo as MJ,bp as $J,tp as kJ}from"./chunk-6qwnty59.js";import{Ip as qJ}from"./chunk-crqycrs4.js";import{et as F}from"./chunk-5re7995e.js";import{It as LJ}from"./chunk-6yshpz0z.js";import{Pt as e,Xt as SJ}from"./chunk-5dvy83ms.js";import{ju as OJ,mu as QJ}from"./chunk-ffx0cr44.js";var cJ=0.9,mJ=256,VJ="[Earlier tool result removed to fit the request size limit]",c;function h(J){return Buffer.byteLength(JSON.stringify(J),"utf8")}function NJ(){return e.QITQODE_QLEX_MAX_REQUEST_BYTES??c}function JJ(J){let K=e.QITQODE_QLEX_MAX_REQUEST_BYTES;if(K!==void 0)return K;let Z=Math.max(1,Math.min(Math.floor(J*cJ),Math.floor(J)-1));return c=c===void 0?Z:Math.min(c,Z),c}function m(J,K){return!!J&&typeof J==="object"&&J.role===K}function DJ(J){let K=[],Z=0;while(Z<J.length){let $=Z,z=J[Z];if(Z++,m(z,"assistant")&&Array.isArray(z?.tool_calls)&&z.tool_calls.length>0)while(Z<J.length&&m(J[Z],"tool"))Z++;K.push({start:$,end:Z})}return K}function WJ(J,K){if(K.length===0)return[];let Z=-1;for(let $=K.length-1;$>=0;$--){let z=K[$],X=!1;for(let Y=z.start;Y<z.end;Y++)if(m(J[Y],"user"))X=!0;if(X){Z=$;break}}return K.filter(($,z)=>{if(z===K.length-1)return!1;if(z===Z)return!1;if($.start===0&&m(J[0],"system"))return!1;return!0})}function KJ(J,K){let Z=h(J),$={toolResultsElided:0,unitsDropped:0},z=()=>({body:J,bytes:Z,originalBytes:Z,reduced:!1,actions:$});if(!J||typeof J!=="object")return z();let X=J.messages;if(!Array.isArray(X))return z();let Y=X.map((j)=>j&&typeof j==="object"?{...j}:j),H=()=>({...J,messages:Y}),V=()=>h(H())<=K;{let j=Y;for(let N of WJ(j,DJ(j))){let L=!1;for(let O=N.start;O<N.end;O++){let k=j[O];if(!m(k,"tool"))continue;let w=k?.content;if(typeof w!=="string"||w.length<mJ)continue;if(w===VJ)continue;j[O]={...k,content:VJ},$.toolResultsElided++,L=!0}if(L&&V())break}}if(!V())for(;;){let j=Y,L=WJ(j,DJ(j))[0];if(!L)break;if(Y=[...j.slice(0,L.start),...j.slice(L.end)],$.unitsDropped++,V())break}let U=H(),P=h(U);return{body:U,bytes:P,originalBytes:Z,reduced:P<Z&&P<=K,actions:$}}import y from"fs/promises";import EJ from"path";import{randomUUID as dJ}from"crypto";var E=SJ({service:"provider.qlex"}),iJ=F.streamUrl(),lJ=F.omniqueryBaseUrl()+"/runOrchestrated",rJ=new Set(["rate_limited","transient","stream_truncated","stream_failed"]);function d(J,K){return K!==!1&&rJ.has(J)}function a(J){return typeof J==="string"&&/^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/.test(J)?J:void 0}function x(J,K){let Z=J;if(K.status!==void 0)Z.status=K.status;if(K.upstreamCode!==void 0)Z.upstreamCode=K.upstreamCode;let $=a(K.requestId);if($!==void 0)Z.requestId=$;if(Z.category=K.category,Z.retryable=d(K.category,K.retryable),K.outputBudgetRecoveryAvailable!==void 0)Z.outputBudgetRecoveryAvailable=K.outputBudgetRecoveryAvailable;if(K.outputBudgetRecoveryTokens!==void 0)Z.outputBudgetRecoveryTokens=K.outputBudgetRecoveryTokens}function b(J,K){return{...J,...K}}class wJ extends Error{name="QlexNotLoggedInError";constructor(J){super(F.copy().notLoggedIn);x(this,b({category:"invalid_credentials",retryable:!1},J))}}class RJ extends Error{name="QlexInsufficientBalanceError";constructor(J,K){super(F.copy().insufficientBalance(J));x(this,b({status:402,category:"billing",retryable:!1},K))}}class CJ extends Error{name="QlexRateLimitError";constructor(J){super(F.copy().rateLimit);x(this,b({status:429,category:"rate_limited",retryable:!0},J))}}class AJ extends Error{name="QlexInvalidCredentialsError";constructor(J,K){super(F.copy().invalidCredentials(J));x(this,b({status:401,category:"invalid_credentials",retryable:!1},K))}}class TJ extends Error{name="QlexRequestRejectedError";constructor(J,K,Z){super(F.copy().requestRejected(J,K));x(this,b({status:400,category:"request_rejected",retryable:!1},Z))}}class t extends Error{name="QlexRequestTooLargeError";stage;constructor(J="irreducible",K,Z){super(J==="after-reduction"?F.copy().requestTooLargeAfterReduction(K):F.copy().requestTooLargeIrreducible(K));this.stage=J,x(this,b({status:413,category:"request_too_large",retryable:!1},Z))}}class BJ extends Error{name="QlexRequestNotSentError";constructor(J,K){super(F.copy().requestNotSent(J));x(this,b({category:"request_rejected",retryable:!1},K))}}class u extends Error{name="QlexGatewayError";constructor(J,K){super(F.copy().gatewayUnavailable(J));x(this,b({category:"gateway_routing",retryable:!1},K))}}var oJ=60000,sJ=320000;function aK(J){return F.sanitizeUpstreamError(J)}class v extends Error{name="QlexStreamError";constructor(J,K,Z){let $=b({category:"unknown",retryable:!1},K);super($.category==="output_budget_exhausted"?F.copy().outputBudgetExhausted():$.category==="empty_output"?F.copy().emptyOutput():$.category==="stream_truncated"?F.copy().streamCutOff(Z):$.category==="stream_failed"?F.copy().streamFailedAfterRetries(Z):F.copy().streamFailed(J));x(this,$),LJ(this)}}var aJ=[{match:/\b(unauthori[sz]ed|forbidden|invalid[ _-]?(api[ _-]?key|token|credential)|expired[ _-]?token|authentication[ _-]?(failed|error)|401|403)\b/i,category:"invalid_credentials",retryable:!1},{match:/(output (?:token )?budget|maximum output tokens|max_tokens|finish[_ -]?reason.{0,20}(length|budget)|reasoning.{0,20}(budget|tokens))/i,category:"output_budget_exhausted",retryable:!1},{match:/\b(no visible output|empty output|produced no (?:visible )?(?:text|output)|nothing to display)\b/i,category:"empty_output",retryable:!1},{match:/\b(insufficient[ _-]?(credits?|qredits?|balance|funds)|payment[ _-]?required|quota[ _-]?exceeded|out[ _-]?of[ _-]?(credits?|qredits?)|402)\b/i,category:"billing",retryable:!1},{match:/\b(rate[ _-]?limit(ed|s)?|too[ _-]?many[ _-]?requests|429)\b/i,category:"rate_limited",retryable:!0},{match:/(unexpected end of (json|input|stream|data)|premature (close|end)|socket hang ?up|socket connection was closed unexpectedly|incomplete (response|output|json|message)|truncated|stream (ended|closed|terminated) (early|unexpectedly|prematurely)|\bECONNRESET\b|\bEPIPE\b)/i,category:"stream_truncated",retryable:!0},{match:/\b(overloaded|at capacity|service[ _-]?unavailable|temporarily[ _-]?unavailable|bad[ _-]?gateway|gateway[ _-]?time(d[ _-]?out|out)|timed[ _-]?out|502|503|504)\b/i,category:"transient",retryable:!0}],tJ={ERR_EMPTY_RESULT:{category:"empty_output",retryable:!1},ERR_TRUNCATED_OUTPUT:{category:"stream_truncated",retryable:!0},ERR_STREAM:{category:"stream_failed",retryable:!0}},eJ=/^\s*(ERR_[A-Z0-9_]+)\b(?:\s*(?:[\u2014\u2013:-]\s*)?)?/i,JK=/\b(req_[A-Za-z0-9][A-Za-z0-9_-]*)\b/;function GJ(J){let K=J??"",Z=eJ.exec(K),$=Z?K.slice(Z[0].length):K,z=IJ($),X=Z?.[1]?.toUpperCase()??z.upstreamCode,Y=z.requestId??a(JK.exec(K)?.[1]),H=z.retryable;if(X!==void 0){let V=tJ[X];if(V!==void 0)return{...V,upstreamCode:X,retryable:d(V.category,H??V.retryable),...Y?{requestId:Y}:{}}}for(let V of aJ)if(V.match.test($))return{category:V.category,retryable:d(V.category,H??V.retryable),...X?{upstreamCode:X}:{},...Y?{requestId:Y}:{}};return{category:"unknown",retryable:d("unknown",H),...X?{upstreamCode:X}:{},...Y?{requestId:Y}:{}}}function KK(J){return MJ(J)}function IJ(J){try{let K=JSON.parse(J);if(!K||typeof K!=="object"||Array.isArray(K))return{};let Z=K,$=Z.error&&typeof Z.error==="object"&&!Array.isArray(Z.error)?Z.error:void 0,z=Z.details&&typeof Z.details==="object"&&!Array.isArray(Z.details)?Z.details:void 0,X=[Z.requestId,$?.requestId,z?.requestId].map(a).find((V)=>V!==void 0),Y=Z.retryable===!1||$?.retryable===!1?!1:Z.retryable===!0||$?.retryable===!0?!0:void 0,H=$?.code??Z.code;return{...X!==void 0?{requestId:X}:{},...Y!==void 0?{retryable:Y}:{},...typeof H==="string"&&/^[A-Z][A-Z0-9_]{0,63}$/i.test(H)?{upstreamCode:H.toUpperCase()}:{}}}catch{return{}}}function xJ(J,K){let Z,$,z,X=!1;try{let N=JSON.parse(K);if(N&&typeof N==="object"){let L=N.error&&typeof N.error==="object"?N.error:void 0;if(typeof L?.code==="string")Z=L.code;else if(typeof N.code==="string")Z=N.code;if(typeof L?.message==="string")$=L.message;else if(typeof N.message==="string")$=N.message;if(typeof N.details?.field==="string")z=N.details.field}}catch(N){X=/^\s*[\[{]/.test(K)&&(ZK(K)||/unexpected end|end of json|unterminated string/i.test(String(N)))}let Y=Z?.toUpperCase()??"",{requestId:H,retryable:V}=IJ(K),U=(()=>{if(X)return"stream_truncated";if(J===402)return"billing";if(J===413)return"request_too_large";if(J===429)return"rate_limited";if(J===401||J===403)return Y==="ERR_GATEWAY_REQUIRED"||KK(K)?"gateway_routing":"invalid_credentials";if(Y.includes("CONFIG"))return"configuration";if(J>=500)return"transient";if(J>=400)return"request_rejected";return"unknown"})(),P=d(U,V),j={status:J,category:U,retryable:P};if(Z!==void 0)j.upstreamCode=Z;if($!==void 0)j.upstreamMessage=$;if(z!==void 0)j.field=z;if(H!==void 0)j.requestId=H;return j}function ZK(J){let K=0,Z=!1,$=!1;for(let z of J){if(Z){if($)$=!1;else if(z==="\\")$=!0;else if(z==='"')Z=!1;continue}if(z==='"')Z=!0;else if(z==="{"||z==="[")K++;else if(z==="}"||z==="]")K--;if(K<0)return!1}return Z||K>0}function $K(J){let K=F.tierBudgetFacts(J.tier),Z=J.advisory,$=Z?.tierOutputLimit??K?.output;if(J.requestedTotal!==void 0)return{total:$===void 0?J.requestedTotal:Math.min(J.requestedTotal,$)};if(!Z&&!K)return{};let z=Z?.reasoningReserveTokens??K?.reasoningReserve??0,X=Z?.visibleOutputFloorTokens??K?.visibleOutputFloor??0,Y=Z?.recommendedTotalTokens??Z?.tierRecommendedStepTokens??K?.recommendedTotal??K?.recommendedStep??$,H=Z?.viableTotalFloorTokens??K?.viableTotalFloor??z+X,V=Y===void 0?H:Math.max(Y,H),U=Z?.reasoningReported??K?.reasoning;return{total:$===void 0?V:Math.min(V,$),reasoningBudget:U&&z>0?Math.min(z,V):void 0}}var zK=new Set(["coding","agent","research","review","chat"]);function XK(J){if(J===void 0)return;if(typeof J==="string"&&zK.has(J))return J;throw Error(`invalid Qortex posture: ${String(J)}`)}function YK(J){if(J===void 0)return;let K=Array.isArray(J)?J:[J];if(K.every((Z)=>typeof Z==="string"&&/^[^/\s]+\/[^/\s]+$/.test(Z)))return Array.isArray(J)?K:J;throw Error(`invalid Qortex directive registry key: ${String(J)}`)}function s(J){if(typeof J==="string")return J;if(Array.isArray(J))return J.map((K)=>{if(typeof K==="string")return K;if(K&&typeof K==="object"){let Z=K;if(typeof Z.text==="string")return Z.text;if(typeof Z.content==="string")return Z.content}return""}).join("");if(J===void 0||J===null)return"";return String(J)}var HK="[Tool call]",VK="[Tool returned no output]";function bJ(J){if(!Array.isArray(J))return{messages:J,dropped:[]};let K=[];return{messages:J.flatMap(($,z)=>{if(!$||typeof $!=="object")return K.push({index:z,role:typeof $,reason:"not-an-object"}),[];let X=$,Y=s(X.content);if(Y.trim().length>0)return[{...X,content:Y}];if(X.role==="assistant"&&Array.isArray(X.tool_calls)&&X.tool_calls.length>0)return[{...X,content:HK}];if(X.role==="tool"&&typeof X.tool_call_id==="string"&&X.tool_call_id.trim().length>0)return[{...X,content:VK}];return K.push({index:z,role:typeof X.role==="string"?X.role:"unknown",reason:"empty-content"}),[]}),dropped:K}}function DK(J){return bJ(J).messages}function WK(J){if(!Array.isArray(J))return!1;return J.some((K)=>!!K&&typeof K==="object"&&K.role==="user")}function NK(J){if(!Array.isArray(J))return!1;return J.some((K)=>{if(!K||typeof K!=="object")return!1;let Z=K;if(Z.role!=="user")return!1;return s(Z.content).trim().length>0})}function GK(J){if(!Array.isArray(J))return J;let K=(X)=>!!X&&typeof X==="object"&&X.role==="system",Z=0;while(Z<J.length&&K(J[Z]))Z++;if(Z<=1)return J;let $=J.slice(0,Z),z=$.map((X)=>typeof X.content==="string"?X.content:String(X.content??"")).filter((X)=>X.length>0).join(`
3
3
 
4
4
  `);return[{...$[0],role:"system",content:z},...J.slice(Z)]}var n="<tool_call>",r="</tool_call>";function jK(J){if(!Array.isArray(J)||J.length===0)return;let K=J.map((Z)=>{try{return JSON.stringify(Z)}catch{return}}).filter((Z)=>Z!==void 0);if(K.length===0)return;return["# Tools","","You may call one or more functions to assist with the user query.","","You are provided with function signatures within <tools></tools> XML tags:","<tools>",...K,"</tools>","","For each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:","<tool_call>",'{"name": <function-name>, "arguments": <args-json-object>}',"</tool_call>","","Function results will be provided within <tool_response></tool_response> XML tags. Do not write <tool_response> blocks yourself.","Only use the functions declared above. Never invent function names, and never write out a function-call-like block in any other format."].join(`
5
5
  `)}var UK=3;function XJ(J){let K=J;for(let Z=0;Z<UK;Z++){if(K!==null&&typeof K==="object")return K;if(typeof K!=="string")return;try{K=JSON.parse(K)}catch{return}}return}function PK(J){let K=J?.tool_calls;if(!Array.isArray(K))return;for(let Z of K){let $=Z?.function;if(!$)continue;E.debug("tool call ingress",{tool:typeof $.name==="string"?$.name:"?",source:"native",args:YJ($.arguments)})}}function YJ(J,K=300){let Z;try{Z=typeof J==="string"?J:JSON.stringify(J)??String(J)}catch{Z="<unrenderable>"}return Z.length<=K?Z:`${Z.slice(0,K)}\u2026 (${Z.length} chars total)`}function _K(J){let K=J.function??{},Z=typeof K.name==="string"?K.name:"",$=K.arguments===void 0?{}:XJ(K.arguments);if($===void 0)E.warn("dropping unrecoverable tool-call arguments while re-encoding history",{tool:Z,raw:YJ(K.arguments)});return`${n}
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{fl as a,gl as b,hl as c,il as d,jl as e,kl as f,ll as g,ml as h,nl as i}from"./chunk-358wdvj7.js";import"./chunk-47jkx37s.js";import"./chunk-h036zy9e.js";import"./chunk-3152y1q9.js";import"./chunk-6cztstry.js";import"./chunk-1mfdmm2t.js";import"./chunk-fkq0v5qv.js";import"./chunk-1e75j4m1.js";import"./chunk-8jkqyf9n.js";import"./chunk-6yshpz0z.js";import"./chunk-5dvy83ms.js";import"./chunk-ffx0cr44.js";import"./chunk-33mzqyyb.js";import"./chunk-sg9enzsp.js";import"./chunk-5q98z8ck.js";import"./chunk-wfpnv00c.js";import"./chunk-9kc2th5c.js";import"./chunk-sh03ka27.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};
2
+ import{fl as a,gl as b,hl as c,il as d,jl as e,kl as f,ll as g,ml as h,nl as i}from"./chunk-2pw56zpj.js";import"./chunk-4gzggzc0.js";import"./chunk-h036zy9e.js";import"./chunk-3152y1q9.js";import"./chunk-6cztstry.js";import"./chunk-4yd2vvh6.js";import"./chunk-fkq0v5qv.js";import"./chunk-1e75j4m1.js";import"./chunk-mnjz8nqs.js";import"./chunk-6yshpz0z.js";import"./chunk-5dvy83ms.js";import"./chunk-ffx0cr44.js";import"./chunk-33mzqyyb.js";import"./chunk-sg9enzsp.js";import"./chunk-5q98z8ck.js";import"./chunk-wfpnv00c.js";import"./chunk-9kc2th5c.js";import"./chunk-sh03ka27.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,2 +1,2 @@
1
1
  // @bun
2
- import{a,b,c,d,e,f,g}from"./chunk-6d4xc6br.js";import"./chunk-6y0wgz2j.js";import"./chunk-rn3je2hv.js";import"./chunk-9z7y4x7q.js";import"./chunk-p0852vfn.js";import"./chunk-ej0yzstw.js";import"./chunk-w8nj5ph5.js";import"./chunk-psmwrvqs.js";import"./chunk-9gxyt2ay.js";import"./chunk-fd04358e.js";import"./chunk-qn1fhqyw.js";import"./chunk-674pexjx.js";import"./chunk-zjyaze0d.js";import"./chunk-xdcwx384.js";import"./chunk-rd08wx37.js";import"./chunk-fp2xgnjn.js";import"./chunk-y1v7mf1a.js";import"./chunk-358wdvj7.js";import"./chunk-dn0437c1.js";import"./chunk-47jkx37s.js";import"./chunk-31a47ptm.js";import"./chunk-jwv6fda1.js";import"./chunk-hx13a8es.js";import"./chunk-h036zy9e.js";import"./chunk-j3agzs13.js";import"./chunk-3152y1q9.js";import"./chunk-71jmhvef.js";import"./chunk-qrztx1b4.js";import"./chunk-j1bv93m4.js";import"./chunk-pp10epga.js";import"./chunk-crqycrs4.js";import"./chunk-1bq15kf0.js";import"./chunk-pdcxmr6x.js";import"./chunk-cqtkxwd8.js";import"./chunk-a1mbach4.js";import"./chunk-m6967jtv.js";import"./chunk-j2snkw45.js";import"./chunk-bmdqb48f.js";import"./chunk-3cs1qf8x.js";import"./chunk-4xqwt6dr.js";import"./chunk-g77kddrs.js";import"./chunk-9znfb8f2.js";import"./chunk-6kch0q2d.js";import"./chunk-6cztstry.js";import"./chunk-1mfdmm2t.js";import"./chunk-fkq0v5qv.js";import"./chunk-1e75j4m1.js";import"./chunk-2w3n0q9m.js";import"./chunk-6dd2dx69.js";import"./chunk-fdmz0502.js";import"./chunk-1a08ffyd.js";import"./chunk-8jkqyf9n.js";import"./chunk-6yshpz0z.js";import"./chunk-5dvy83ms.js";import"./chunk-ffx0cr44.js";import"./chunk-33mzqyyb.js";import"./chunk-sg9enzsp.js";import"./chunk-5q98z8ck.js";import"./chunk-wfpnv00c.js";import"./chunk-9kc2th5c.js";import"./chunk-hf39qx6t.js";import"./chunk-x0de4z05.js";import"./chunk-sh03ka27.js";export{f as statusEffect,a as resolveApiKeyFlag,e as logoutEffect,d as loginEffect,c as interactiveLogin,b as apiKeyLoginEffect,g as AuthCommand};
2
+ import{a,b,c,d,e,f,g}from"./chunk-rk4c0zat.js";import"./chunk-zbt53cb5.js";import"./chunk-rn3je2hv.js";import"./chunk-djdfpezf.js";import"./chunk-p0852vfn.js";import"./chunk-ej0yzstw.js";import"./chunk-w8nj5ph5.js";import"./chunk-psmwrvqs.js";import"./chunk-f0x3q5dj.js";import"./chunk-6zdzbmzs.js";import"./chunk-qn1fhqyw.js";import"./chunk-674pexjx.js";import"./chunk-zjyaze0d.js";import"./chunk-xdcwx384.js";import"./chunk-rd08wx37.js";import"./chunk-fp2xgnjn.js";import"./chunk-5asf8f41.js";import"./chunk-2pw56zpj.js";import"./chunk-rt49c6js.js";import"./chunk-4gzggzc0.js";import"./chunk-31a47ptm.js";import"./chunk-ywj77e0m.js";import"./chunk-83n11xym.js";import"./chunk-h036zy9e.js";import"./chunk-j3agzs13.js";import"./chunk-3152y1q9.js";import"./chunk-71jmhvef.js";import"./chunk-qrztx1b4.js";import"./chunk-ae1b15bd.js";import"./chunk-6qwnty59.js";import"./chunk-crqycrs4.js";import"./chunk-1bq15kf0.js";import"./chunk-pdcxmr6x.js";import"./chunk-cqtkxwd8.js";import"./chunk-a1mbach4.js";import"./chunk-m6967jtv.js";import"./chunk-j2snkw45.js";import"./chunk-bmdqb48f.js";import"./chunk-3cs1qf8x.js";import"./chunk-4xqwt6dr.js";import"./chunk-g77kddrs.js";import"./chunk-kegvr7wt.js";import"./chunk-2tkgtasa.js";import"./chunk-6cztstry.js";import"./chunk-4yd2vvh6.js";import"./chunk-fkq0v5qv.js";import"./chunk-1e75j4m1.js";import"./chunk-2w3n0q9m.js";import"./chunk-6dd2dx69.js";import"./chunk-fdmz0502.js";import"./chunk-5re7995e.js";import"./chunk-mnjz8nqs.js";import"./chunk-6yshpz0z.js";import"./chunk-5dvy83ms.js";import"./chunk-ffx0cr44.js";import"./chunk-33mzqyyb.js";import"./chunk-sg9enzsp.js";import"./chunk-5q98z8ck.js";import"./chunk-wfpnv00c.js";import"./chunk-9kc2th5c.js";import"./chunk-hf39qx6t.js";import"./chunk-x0de4z05.js";import"./chunk-sh03ka27.js";export{f as statusEffect,a as resolveApiKeyFlag,e as logoutEffect,d as loginEffect,c as interactiveLogin,b as apiKeyLoginEffect,g as AuthCommand};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Ud as y}from"./chunk-fpzkyzny.js";import{fe as L}from"./chunk-w8nj5ph5.js";import{Ah as w,Zg as N}from"./chunk-fd04358e.js";import"./chunk-qn1fhqyw.js";import"./chunk-674pexjx.js";import"./chunk-zjyaze0d.js";import"./chunk-xdcwx384.js";import"./chunk-rd08wx37.js";import"./chunk-fp2xgnjn.js";import{Uk as q,bl as v}from"./chunk-y1v7mf1a.js";import"./chunk-358wdvj7.js";import{Cl as k,Ml as O,ul as V,vl as A,wl as E}from"./chunk-dn0437c1.js";import"./chunk-47jkx37s.js";import"./chunk-31a47ptm.js";import"./chunk-jwv6fda1.js";import"./chunk-hx13a8es.js";import"./chunk-h036zy9e.js";import"./chunk-j3agzs13.js";import"./chunk-3152y1q9.js";import"./chunk-71jmhvef.js";import"./chunk-qrztx1b4.js";import"./chunk-j1bv93m4.js";import"./chunk-pp10epga.js";import"./chunk-crqycrs4.js";import"./chunk-1bq15kf0.js";import"./chunk-pdcxmr6x.js";import"./chunk-cqtkxwd8.js";import"./chunk-a1mbach4.js";import"./chunk-m6967jtv.js";import"./chunk-j2snkw45.js";import"./chunk-bmdqb48f.js";import"./chunk-3cs1qf8x.js";import"./chunk-4xqwt6dr.js";import"./chunk-g77kddrs.js";import"./chunk-9znfb8f2.js";import"./chunk-6kch0q2d.js";import"./chunk-6cztstry.js";import"./chunk-1mfdmm2t.js";import"./chunk-fkq0v5qv.js";import"./chunk-1e75j4m1.js";import"./chunk-2w3n0q9m.js";import"./chunk-6dd2dx69.js";import"./chunk-fdmz0502.js";import"./chunk-1a08ffyd.js";import"./chunk-8jkqyf9n.js";import"./chunk-6yshpz0z.js";import"./chunk-5dvy83ms.js";import{hu as P}from"./chunk-ffx0cr44.js";import"./chunk-33mzqyyb.js";import"./chunk-sg9enzsp.js";import"./chunk-5q98z8ck.js";import"./chunk-wfpnv00c.js";import"./chunk-9kc2th5c.js";import"./chunk-hf39qx6t.js";import"./chunk-x0de4z05.js";import"./chunk-sh03ka27.js";import{EOL as X}from"os";function U(C){let G=C.match(/^https?:\/\/[^/]+\/share\/([a-zA-Z0-9_-]+)$/);return G?G[1]:null}function M(C,G){try{return new URL(C).origin===new URL(G).origin}catch{return!1}}function S(C){let G=C.find((z)=>z.type==="session");if(!G)return null;let Z=new Map,Q=new Map;for(let z of C)if(z.type==="message")Z.set(z.data.id,z.data);else if(z.type==="part"){if(!Q.has(z.data.messageID))Q.set(z.data.messageID,[]);Q.get(z.data.messageID).push(z.data)}if(Z.size===0)return null;return{info:G.data,messages:Array.from(Z.values()).map((z)=>({info:z,parts:Q.get(z.id)??[]}))}}var m=L({command:"import <file>",describe:"import session data from JSON file or URL",builder:(C)=>{return C.positional("file",{describe:"path to JSON file or share URL",type:"string",demandOption:!0})},handler:async(C)=>{await y(process.cwd(),async()=>{let G;if(C.file.startsWith("http://")||C.file.startsWith("https://")){let J=U(C.file);if(!J){let Y=await w.runPromise(N.Service.use((R)=>R.url()));process.stdout.write(`Invalid URL format. Expected: ${Y}/share/<slug>`),process.stdout.write(X);return}let _=new URL(C.file).origin,$=await w.runPromise(N.Service.use((Y)=>Y.request())),j=M(C.file,$.baseUrl)?$.headers:{},W=$.api.data(J),K=await fetch(`${_}${W}`,{headers:j});if(!K.ok&&W!==`/api/share/${J}/data`)K=await fetch(`${_}/api/share/${J}/data`,{headers:j});if(!K.ok){process.stdout.write(`Failed to fetch share data: ${K.statusText}`),process.stdout.write(X);return}let H=await K.json(),B=S(H);if(!B){process.stdout.write(`Share not found or empty: ${J}`),process.stdout.write(X);return}G=B}else if(G=await P.readJson(C.file).catch(()=>{return}),!G){process.stdout.write(`File not found: ${C.file}`),process.stdout.write(X);return}if(!G){process.stdout.write("Failed to read session data"),process.stdout.write(X);return}let Q=v.Info.parse({...G.info,projectID:O.project.id}),z=v.toRow(Q);k.use((J)=>J.insert(V).values(z).onConflictDoUpdate({target:V.id,set:{project_id:z.project_id}}).run());for(let J of G.messages){let F=q.Info.parse(J.info),{id:_,sessionID:$,...j}=F;k.use((W)=>W.insert(A).values({id:_,session_id:z.id,time_created:F.time?.created??Date.now(),data:j}).onConflictDoNothing().run());for(let W of J.parts){let K=q.Part.parse(W),{id:H,sessionID:B,messageID:Y,...R}=K;k.use((T)=>T.insert(E).values({id:H,message_id:Y,session_id:z.id,data:R}).onConflictDoNothing().run())}}process.stdout.write(`Imported session: ${G.info.id}`),process.stdout.write(X)})}});export{S as transformShareData,M as shouldAttachShareAuthHeaders,U as parseShareUrl,m as ImportCommand};
2
+ import{Ud as y}from"./chunk-4jfnhghx.js";import{fe as L}from"./chunk-w8nj5ph5.js";import{Ah as w,Zg as N}from"./chunk-6zdzbmzs.js";import"./chunk-qn1fhqyw.js";import"./chunk-674pexjx.js";import"./chunk-zjyaze0d.js";import"./chunk-xdcwx384.js";import"./chunk-rd08wx37.js";import"./chunk-fp2xgnjn.js";import{Uk as q,bl as v}from"./chunk-5asf8f41.js";import"./chunk-2pw56zpj.js";import{Cl as k,Ml as O,ul as V,vl as A,wl as E}from"./chunk-rt49c6js.js";import"./chunk-4gzggzc0.js";import"./chunk-31a47ptm.js";import"./chunk-ywj77e0m.js";import"./chunk-83n11xym.js";import"./chunk-h036zy9e.js";import"./chunk-j3agzs13.js";import"./chunk-3152y1q9.js";import"./chunk-71jmhvef.js";import"./chunk-qrztx1b4.js";import"./chunk-ae1b15bd.js";import"./chunk-6qwnty59.js";import"./chunk-crqycrs4.js";import"./chunk-1bq15kf0.js";import"./chunk-pdcxmr6x.js";import"./chunk-cqtkxwd8.js";import"./chunk-a1mbach4.js";import"./chunk-m6967jtv.js";import"./chunk-j2snkw45.js";import"./chunk-bmdqb48f.js";import"./chunk-3cs1qf8x.js";import"./chunk-4xqwt6dr.js";import"./chunk-g77kddrs.js";import"./chunk-kegvr7wt.js";import"./chunk-2tkgtasa.js";import"./chunk-6cztstry.js";import"./chunk-4yd2vvh6.js";import"./chunk-fkq0v5qv.js";import"./chunk-1e75j4m1.js";import"./chunk-2w3n0q9m.js";import"./chunk-6dd2dx69.js";import"./chunk-fdmz0502.js";import"./chunk-5re7995e.js";import"./chunk-mnjz8nqs.js";import"./chunk-6yshpz0z.js";import"./chunk-5dvy83ms.js";import{hu as P}from"./chunk-ffx0cr44.js";import"./chunk-33mzqyyb.js";import"./chunk-sg9enzsp.js";import"./chunk-5q98z8ck.js";import"./chunk-wfpnv00c.js";import"./chunk-9kc2th5c.js";import"./chunk-hf39qx6t.js";import"./chunk-x0de4z05.js";import"./chunk-sh03ka27.js";import{EOL as X}from"os";function U(C){let G=C.match(/^https?:\/\/[^/]+\/share\/([a-zA-Z0-9_-]+)$/);return G?G[1]:null}function M(C,G){try{return new URL(C).origin===new URL(G).origin}catch{return!1}}function S(C){let G=C.find((z)=>z.type==="session");if(!G)return null;let Z=new Map,Q=new Map;for(let z of C)if(z.type==="message")Z.set(z.data.id,z.data);else if(z.type==="part"){if(!Q.has(z.data.messageID))Q.set(z.data.messageID,[]);Q.get(z.data.messageID).push(z.data)}if(Z.size===0)return null;return{info:G.data,messages:Array.from(Z.values()).map((z)=>({info:z,parts:Q.get(z.id)??[]}))}}var m=L({command:"import <file>",describe:"import session data from JSON file or URL",builder:(C)=>{return C.positional("file",{describe:"path to JSON file or share URL",type:"string",demandOption:!0})},handler:async(C)=>{await y(process.cwd(),async()=>{let G;if(C.file.startsWith("http://")||C.file.startsWith("https://")){let J=U(C.file);if(!J){let Y=await w.runPromise(N.Service.use((R)=>R.url()));process.stdout.write(`Invalid URL format. Expected: ${Y}/share/<slug>`),process.stdout.write(X);return}let _=new URL(C.file).origin,$=await w.runPromise(N.Service.use((Y)=>Y.request())),j=M(C.file,$.baseUrl)?$.headers:{},W=$.api.data(J),K=await fetch(`${_}${W}`,{headers:j});if(!K.ok&&W!==`/api/share/${J}/data`)K=await fetch(`${_}/api/share/${J}/data`,{headers:j});if(!K.ok){process.stdout.write(`Failed to fetch share data: ${K.statusText}`),process.stdout.write(X);return}let H=await K.json(),B=S(H);if(!B){process.stdout.write(`Share not found or empty: ${J}`),process.stdout.write(X);return}G=B}else if(G=await P.readJson(C.file).catch(()=>{return}),!G){process.stdout.write(`File not found: ${C.file}`),process.stdout.write(X);return}if(!G){process.stdout.write("Failed to read session data"),process.stdout.write(X);return}let Q=v.Info.parse({...G.info,projectID:O.project.id}),z=v.toRow(Q);k.use((J)=>J.insert(V).values(z).onConflictDoUpdate({target:V.id,set:{project_id:z.project_id}}).run());for(let J of G.messages){let F=q.Info.parse(J.info),{id:_,sessionID:$,...j}=F;k.use((W)=>W.insert(A).values({id:_,session_id:z.id,time_created:F.time?.created??Date.now(),data:j}).onConflictDoNothing().run());for(let W of J.parts){let K=q.Part.parse(W),{id:H,sessionID:B,messageID:Y,...R}=K;k.use((T)=>T.insert(E).values({id:H,message_id:Y,session_id:z.id,data:R}).onConflictDoNothing().run())}}process.stdout.write(`Imported session: ${G.info.id}`),process.stdout.write(X)})}});export{S as transformShareData,M as shouldAttachShareAuthHeaders,U as parseShareUrl,m as ImportCommand};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Br as a,Cr as b,Dr as c}from"./chunk-9znfb8f2.js";import"./chunk-6kch0q2d.js";import"./chunk-6cztstry.js";import"./chunk-1mfdmm2t.js";import"./chunk-fkq0v5qv.js";import"./chunk-1e75j4m1.js";import"./chunk-8jkqyf9n.js";import"./chunk-6yshpz0z.js";import"./chunk-5dvy83ms.js";import"./chunk-ffx0cr44.js";import"./chunk-33mzqyyb.js";import"./chunk-sg9enzsp.js";import"./chunk-5q98z8ck.js";import"./chunk-wfpnv00c.js";import"./chunk-9kc2th5c.js";import"./chunk-sh03ka27.js";export{c as makeRuntime,a as attachWith,b as attach};
2
+ import{Br as a,Cr as b,Dr as c}from"./chunk-kegvr7wt.js";import"./chunk-2tkgtasa.js";import"./chunk-6cztstry.js";import"./chunk-4yd2vvh6.js";import"./chunk-fkq0v5qv.js";import"./chunk-1e75j4m1.js";import"./chunk-mnjz8nqs.js";import"./chunk-6yshpz0z.js";import"./chunk-5dvy83ms.js";import"./chunk-ffx0cr44.js";import"./chunk-33mzqyyb.js";import"./chunk-sg9enzsp.js";import"./chunk-5q98z8ck.js";import"./chunk-wfpnv00c.js";import"./chunk-9kc2th5c.js";import"./chunk-sh03ka27.js";export{c as makeRuntime,a as attachWith,b as attach};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Q as b,R as y,S as k,T as S,U as D,V as x}from"./chunk-ykvgmje9.js";import{Ud as m}from"./chunk-fpzkyzny.js";import{Vd as f,Wd as w,Zd as h}from"./chunk-p0852vfn.js";import"./chunk-ej0yzstw.js";import{fe as u}from"./chunk-w8nj5ph5.js";import{cg as a}from"./chunk-psmwrvqs.js";import"./chunk-fd04358e.js";import"./chunk-qn1fhqyw.js";import"./chunk-674pexjx.js";import"./chunk-zjyaze0d.js";import"./chunk-xdcwx384.js";import"./chunk-rd08wx37.js";import"./chunk-fp2xgnjn.js";import{Lj as p,bl as l}from"./chunk-y1v7mf1a.js";import"./chunk-358wdvj7.js";import"./chunk-dn0437c1.js";import"./chunk-47jkx37s.js";import"./chunk-31a47ptm.js";import"./chunk-jwv6fda1.js";import"./chunk-hx13a8es.js";import"./chunk-h036zy9e.js";import"./chunk-j3agzs13.js";import"./chunk-3152y1q9.js";import"./chunk-71jmhvef.js";import"./chunk-qrztx1b4.js";import"./chunk-j1bv93m4.js";import"./chunk-pp10epga.js";import"./chunk-crqycrs4.js";import"./chunk-1bq15kf0.js";import"./chunk-pdcxmr6x.js";import"./chunk-cqtkxwd8.js";import"./chunk-a1mbach4.js";import"./chunk-m6967jtv.js";import"./chunk-j2snkw45.js";import"./chunk-bmdqb48f.js";import"./chunk-3cs1qf8x.js";import"./chunk-4xqwt6dr.js";import"./chunk-g77kddrs.js";import"./chunk-9znfb8f2.js";import"./chunk-6kch0q2d.js";import"./chunk-6cztstry.js";import"./chunk-1mfdmm2t.js";import"./chunk-fkq0v5qv.js";import"./chunk-1e75j4m1.js";import"./chunk-2w3n0q9m.js";import"./chunk-6dd2dx69.js";import"./chunk-fdmz0502.js";import"./chunk-1a08ffyd.js";import"./chunk-8jkqyf9n.js";import"./chunk-6yshpz0z.js";import"./chunk-5dvy83ms.js";import"./chunk-ffx0cr44.js";import"./chunk-33mzqyyb.js";import"./chunk-sg9enzsp.js";import"./chunk-5q98z8ck.js";import"./chunk-wfpnv00c.js";import"./chunk-9kc2th5c.js";import"./chunk-hf39qx6t.js";import"./chunk-x0de4z05.js";import"./chunk-sh03ka27.js";import{EOL as c}from"os";async function I(){a.empty(),h("Export session",{output:process.stderr});let t=[...l.list()];if(t.length===0)return;let o=await w({message:"Select session to export",maxItems:10,options:t.map((e)=>({label:e.title,value:e.id,hint:`${new Date(e.time.updated).toLocaleString()} \u2022 ${e.id.slice(-8)}`})),output:process.stderr});if(f(o))throw new a.CancelledError;return p.make(o)}var z=u({command:"export [sessionID]",describe:"export a complete session transcript as JSON or Markdown",builder:(t)=>t.positional("sessionID",{describe:"session id to export",type:"string"}).option("latest",{describe:"export the most recently updated session without prompting",type:"boolean",default:!1}).option("format",{alias:"f",describe:"output format (JSON defaults to stdout; Markdown defaults to a file in the project root)",choices:["json","markdown"],default:"json"}).option("output",{alias:"o",describe:"destination path, resolved from the current project root",type:"string"}).option("thinking",{describe:"include persisted assistant reasoning in Markdown",type:"boolean",default:!1}).option("tool-details",{describe:"include diagnostic tool inputs, outputs, and errors in Markdown",type:"boolean",default:!0}).option("assistant-metadata",{describe:"include agent, model, and duration metadata in Markdown",type:"boolean",default:!0}).option("sanitize",{describe:"redact sensitive transcript and file data",type:"boolean",default:!1}),handler:async(t)=>{await m(process.cwd(),async()=>{if(t.sessionID&&t.latest)throw Error("Use either a session ID or --latest, not both");let o=t.sessionID?p.make(t.sessionID):void 0;if(!o&&(t.latest||!process.stderr.isTTY))o=y()?.id;if(!o)o=await I();if(!o)throw Error("No sessions found in the current project");let e;try{e=await b(o)}catch{throw Error(`Session not found: ${o}`)}let r=t.sanitize?D(e):e,n=t.format,d=n==="json"?JSON.stringify(r,null,2)+c:x(r.info,r.messages,{thinking:t.thinking,toolDetails:t.toolDetails,assistantMetadata:t.assistantMetadata}),i=t.output??(n==="markdown"?k(r.info.id,n):void 0);if(!i){process.stdout.write(d);return}try{let s=await S(process.cwd(),i,d);process.stderr.write(`Session transcript written to ${s}${c}`)}catch(s){let E=s instanceof Error?s.message:String(s);throw Error(`Unable to write session transcript to ${i}: ${E}`)}})}});export{z as ExportCommand};
2
+ import{Q as b,R as y,S as k,T as S,U as D,V as x}from"./chunk-n4qbnecw.js";import{Ud as m}from"./chunk-4jfnhghx.js";import{Vd as f,Wd as w,Zd as h}from"./chunk-p0852vfn.js";import"./chunk-ej0yzstw.js";import{fe as u}from"./chunk-w8nj5ph5.js";import{cg as a}from"./chunk-psmwrvqs.js";import"./chunk-6zdzbmzs.js";import"./chunk-qn1fhqyw.js";import"./chunk-674pexjx.js";import"./chunk-zjyaze0d.js";import"./chunk-xdcwx384.js";import"./chunk-rd08wx37.js";import"./chunk-fp2xgnjn.js";import{Lj as p,bl as l}from"./chunk-5asf8f41.js";import"./chunk-2pw56zpj.js";import"./chunk-rt49c6js.js";import"./chunk-4gzggzc0.js";import"./chunk-31a47ptm.js";import"./chunk-ywj77e0m.js";import"./chunk-83n11xym.js";import"./chunk-h036zy9e.js";import"./chunk-j3agzs13.js";import"./chunk-3152y1q9.js";import"./chunk-71jmhvef.js";import"./chunk-qrztx1b4.js";import"./chunk-ae1b15bd.js";import"./chunk-6qwnty59.js";import"./chunk-crqycrs4.js";import"./chunk-1bq15kf0.js";import"./chunk-pdcxmr6x.js";import"./chunk-cqtkxwd8.js";import"./chunk-a1mbach4.js";import"./chunk-m6967jtv.js";import"./chunk-j2snkw45.js";import"./chunk-bmdqb48f.js";import"./chunk-3cs1qf8x.js";import"./chunk-4xqwt6dr.js";import"./chunk-g77kddrs.js";import"./chunk-kegvr7wt.js";import"./chunk-2tkgtasa.js";import"./chunk-6cztstry.js";import"./chunk-4yd2vvh6.js";import"./chunk-fkq0v5qv.js";import"./chunk-1e75j4m1.js";import"./chunk-2w3n0q9m.js";import"./chunk-6dd2dx69.js";import"./chunk-fdmz0502.js";import"./chunk-5re7995e.js";import"./chunk-mnjz8nqs.js";import"./chunk-6yshpz0z.js";import"./chunk-5dvy83ms.js";import"./chunk-ffx0cr44.js";import"./chunk-33mzqyyb.js";import"./chunk-sg9enzsp.js";import"./chunk-5q98z8ck.js";import"./chunk-wfpnv00c.js";import"./chunk-9kc2th5c.js";import"./chunk-hf39qx6t.js";import"./chunk-x0de4z05.js";import"./chunk-sh03ka27.js";import{EOL as c}from"os";async function I(){a.empty(),h("Export session",{output:process.stderr});let t=[...l.list()];if(t.length===0)return;let o=await w({message:"Select session to export",maxItems:10,options:t.map((e)=>({label:e.title,value:e.id,hint:`${new Date(e.time.updated).toLocaleString()} \u2022 ${e.id.slice(-8)}`})),output:process.stderr});if(f(o))throw new a.CancelledError;return p.make(o)}var z=u({command:"export [sessionID]",describe:"export a complete session transcript as JSON or Markdown",builder:(t)=>t.positional("sessionID",{describe:"session id to export",type:"string"}).option("latest",{describe:"export the most recently updated session without prompting",type:"boolean",default:!1}).option("format",{alias:"f",describe:"output format (JSON defaults to stdout; Markdown defaults to a file in the project root)",choices:["json","markdown"],default:"json"}).option("output",{alias:"o",describe:"destination path, resolved from the current project root",type:"string"}).option("thinking",{describe:"include persisted assistant reasoning in Markdown",type:"boolean",default:!1}).option("tool-details",{describe:"include diagnostic tool inputs, outputs, and errors in Markdown",type:"boolean",default:!0}).option("assistant-metadata",{describe:"include agent, model, and duration metadata in Markdown",type:"boolean",default:!0}).option("sanitize",{describe:"redact sensitive transcript and file data",type:"boolean",default:!1}),handler:async(t)=>{await m(process.cwd(),async()=>{if(t.sessionID&&t.latest)throw Error("Use either a session ID or --latest, not both");let o=t.sessionID?p.make(t.sessionID):void 0;if(!o&&(t.latest||!process.stderr.isTTY))o=y()?.id;if(!o)o=await I();if(!o)throw Error("No sessions found in the current project");let e;try{e=await b(o)}catch{throw Error(`Session not found: ${o}`)}let r=t.sanitize?D(e):e,n=t.format,d=n==="json"?JSON.stringify(r,null,2)+c:x(r.info,r.messages,{thinking:t.thinking,toolDetails:t.toolDetails,assistantMetadata:t.assistantMetadata}),i=t.output??(n==="markdown"?k(r.info.id,n):void 0);if(!i){process.stdout.write(d);return}try{let s=await S(process.cwd(),i,d);process.stderr.write(`Session transcript written to ${s}${c}`)}catch(s){let E=s instanceof Error?s.message:String(s);throw Error(`Unable to write session transcript to ${i}: ${E}`)}})}});export{z as ExportCommand};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Ud as d}from"./chunk-fpzkyzny.js";import{fe as f}from"./chunk-w8nj5ph5.js";import{cg as e}from"./chunk-psmwrvqs.js";import{Ah as l}from"./chunk-fd04358e.js";import"./chunk-qn1fhqyw.js";import"./chunk-674pexjx.js";import"./chunk-zjyaze0d.js";import"./chunk-xdcwx384.js";import"./chunk-rd08wx37.js";import"./chunk-fp2xgnjn.js";import{Lj as m,bl as u}from"./chunk-y1v7mf1a.js";import"./chunk-358wdvj7.js";import"./chunk-dn0437c1.js";import"./chunk-47jkx37s.js";import"./chunk-31a47ptm.js";import"./chunk-jwv6fda1.js";import"./chunk-hx13a8es.js";import"./chunk-h036zy9e.js";import"./chunk-j3agzs13.js";import"./chunk-3152y1q9.js";import"./chunk-71jmhvef.js";import"./chunk-qrztx1b4.js";import"./chunk-j1bv93m4.js";import"./chunk-pp10epga.js";import"./chunk-crqycrs4.js";import"./chunk-1bq15kf0.js";import"./chunk-pdcxmr6x.js";import"./chunk-cqtkxwd8.js";import"./chunk-a1mbach4.js";import"./chunk-m6967jtv.js";import"./chunk-j2snkw45.js";import"./chunk-bmdqb48f.js";import"./chunk-3cs1qf8x.js";import"./chunk-4xqwt6dr.js";import"./chunk-g77kddrs.js";import"./chunk-9znfb8f2.js";import"./chunk-6kch0q2d.js";import"./chunk-6cztstry.js";import"./chunk-1mfdmm2t.js";import"./chunk-fkq0v5qv.js";import"./chunk-1e75j4m1.js";import"./chunk-2w3n0q9m.js";import"./chunk-6dd2dx69.js";import"./chunk-fdmz0502.js";import"./chunk-1a08ffyd.js";import"./chunk-8jkqyf9n.js";import"./chunk-6yshpz0z.js";import"./chunk-5dvy83ms.js";import"./chunk-ffx0cr44.js";import"./chunk-33mzqyyb.js";import"./chunk-sg9enzsp.js";import"./chunk-5q98z8ck.js";import"./chunk-wfpnv00c.js";import"./chunk-9kc2th5c.js";import"./chunk-hf39qx6t.js";import"./chunk-x0de4z05.js";import"./chunk-sh03ka27.js";var v=f({command:"usage [sessionID]",describe:"show per-turn token/cost breakdown for a session (debug/verification tool)",builder:(o)=>{return o.positional("sessionID",{describe:"session ID to inspect (default: most recently updated session)",type:"string"}).option("format",{describe:"output format",type:"string",choices:["table","json"],default:"table"}).option("limit",{describe:"number of most recent turns to show (default: all)",type:"number"})},handler:async(o)=>{await d(process.cwd(),async()=>{let a=o.sessionID?m.make(o.sessionID):[...u.list({roots:!1,limit:1})][0]?.id;if(!a)e.error("No sessions found"),process.exit(1);let p=(await l.runPromise(u.Service.use((s)=>s.messages({sessionID:a,agentID:"*"})))).filter((s)=>s.info.role==="assistant").map((s)=>{let t=s.info,c=s.parts.filter((n)=>n.type==="step-finish");return{messageID:t.id,provider:t.providerID,model:t.modelID,finish:t.finish,cost:t.cost??0,tokens:t.tokens??{input:0,output:0,reasoning:0,cache:{read:0,write:0}},steps:c.map((n)=>({cost:n.cost,tokens:n.tokens}))}}),r=o.limit?p.slice(-o.limit):p;if(r.length===0){e.println("No assistant turns found for this session");return}if(o.format==="json"){console.log(JSON.stringify({sessionID:a,turns:r},null,2));return}e.println(`Session ${a} \u2014 ${r.length} turn(s)`),e.println("");for(let s of r){let t=s.tokens,c=t.input+t.cache.read+t.cache.write,n=t.output+t.reasoning;if(e.println(`${s.messageID} ${s.provider}/${s.model} finish=${s.finish??"-"}`),e.println(` tokens input=${t.input} cache.read=${t.cache.read} cache.write=${t.cache.write} output=${t.output} reasoning=${t.reasoning} (in=${c} out=${n})`),e.println(` cost $${s.cost.toFixed(6)}`),s.steps.length>1)e.println(` steps ${s.steps.length}`),s.steps.forEach((i,g)=>{e.println(` [${g}] input=${i.tokens.input} output=${i.tokens.output} cache.read=${i.tokens.cache.read} cache.write=${i.tokens.cache.write} reasoning=${i.tokens.reasoning} cost=$${i.cost.toFixed(6)}`)});e.println("")}let h=r.reduce((s,t)=>s+t.cost,0);e.println(`Total cost for shown turns: $${h.toFixed(6)}`),e.println("(source: Session.getUsage(), same numbers persisted to the message record \u2014 see session.usage log tag)")})}});export{v as UsageCommand};
2
+ import{Ud as d}from"./chunk-4jfnhghx.js";import{fe as f}from"./chunk-w8nj5ph5.js";import{cg as e}from"./chunk-psmwrvqs.js";import{Ah as l}from"./chunk-6zdzbmzs.js";import"./chunk-qn1fhqyw.js";import"./chunk-674pexjx.js";import"./chunk-zjyaze0d.js";import"./chunk-xdcwx384.js";import"./chunk-rd08wx37.js";import"./chunk-fp2xgnjn.js";import{Lj as m,bl as u}from"./chunk-5asf8f41.js";import"./chunk-2pw56zpj.js";import"./chunk-rt49c6js.js";import"./chunk-4gzggzc0.js";import"./chunk-31a47ptm.js";import"./chunk-ywj77e0m.js";import"./chunk-83n11xym.js";import"./chunk-h036zy9e.js";import"./chunk-j3agzs13.js";import"./chunk-3152y1q9.js";import"./chunk-71jmhvef.js";import"./chunk-qrztx1b4.js";import"./chunk-ae1b15bd.js";import"./chunk-6qwnty59.js";import"./chunk-crqycrs4.js";import"./chunk-1bq15kf0.js";import"./chunk-pdcxmr6x.js";import"./chunk-cqtkxwd8.js";import"./chunk-a1mbach4.js";import"./chunk-m6967jtv.js";import"./chunk-j2snkw45.js";import"./chunk-bmdqb48f.js";import"./chunk-3cs1qf8x.js";import"./chunk-4xqwt6dr.js";import"./chunk-g77kddrs.js";import"./chunk-kegvr7wt.js";import"./chunk-2tkgtasa.js";import"./chunk-6cztstry.js";import"./chunk-4yd2vvh6.js";import"./chunk-fkq0v5qv.js";import"./chunk-1e75j4m1.js";import"./chunk-2w3n0q9m.js";import"./chunk-6dd2dx69.js";import"./chunk-fdmz0502.js";import"./chunk-5re7995e.js";import"./chunk-mnjz8nqs.js";import"./chunk-6yshpz0z.js";import"./chunk-5dvy83ms.js";import"./chunk-ffx0cr44.js";import"./chunk-33mzqyyb.js";import"./chunk-sg9enzsp.js";import"./chunk-5q98z8ck.js";import"./chunk-wfpnv00c.js";import"./chunk-9kc2th5c.js";import"./chunk-hf39qx6t.js";import"./chunk-x0de4z05.js";import"./chunk-sh03ka27.js";var v=f({command:"usage [sessionID]",describe:"show per-turn token/cost breakdown for a session (debug/verification tool)",builder:(o)=>{return o.positional("sessionID",{describe:"session ID to inspect (default: most recently updated session)",type:"string"}).option("format",{describe:"output format",type:"string",choices:["table","json"],default:"table"}).option("limit",{describe:"number of most recent turns to show (default: all)",type:"number"})},handler:async(o)=>{await d(process.cwd(),async()=>{let a=o.sessionID?m.make(o.sessionID):[...u.list({roots:!1,limit:1})][0]?.id;if(!a)e.error("No sessions found"),process.exit(1);let p=(await l.runPromise(u.Service.use((s)=>s.messages({sessionID:a,agentID:"*"})))).filter((s)=>s.info.role==="assistant").map((s)=>{let t=s.info,c=s.parts.filter((n)=>n.type==="step-finish");return{messageID:t.id,provider:t.providerID,model:t.modelID,finish:t.finish,cost:t.cost??0,tokens:t.tokens??{input:0,output:0,reasoning:0,cache:{read:0,write:0}},steps:c.map((n)=>({cost:n.cost,tokens:n.tokens}))}}),r=o.limit?p.slice(-o.limit):p;if(r.length===0){e.println("No assistant turns found for this session");return}if(o.format==="json"){console.log(JSON.stringify({sessionID:a,turns:r},null,2));return}e.println(`Session ${a} \u2014 ${r.length} turn(s)`),e.println("");for(let s of r){let t=s.tokens,c=t.input+t.cache.read+t.cache.write,n=t.output+t.reasoning;if(e.println(`${s.messageID} ${s.provider}/${s.model} finish=${s.finish??"-"}`),e.println(` tokens input=${t.input} cache.read=${t.cache.read} cache.write=${t.cache.write} output=${t.output} reasoning=${t.reasoning} (in=${c} out=${n})`),e.println(` cost $${s.cost.toFixed(6)}`),s.steps.length>1)e.println(` steps ${s.steps.length}`),s.steps.forEach((i,g)=>{e.println(` [${g}] input=${i.tokens.input} output=${i.tokens.output} cache.read=${i.tokens.cache.read} cache.write=${i.tokens.cache.write} reasoning=${i.tokens.reasoning} cost=$${i.cost.toFixed(6)}`)});e.println("")}let h=r.reduce((s,t)=>s+t.cost,0);e.println(`Total cost for shown turns: $${h.toFixed(6)}`),e.println("(source: Session.getUsage(), same numbers persisted to the message record \u2014 see session.usage log tag)")})}});export{v as UsageCommand};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{Ap as z}from"./chunk-pp10epga.js";class B extends Error{cause;constructor(q,x){super(q);this.name="QreditChargeError",this.cause=x}}async function E(q){return z(q)}function F(q){if(q===void 0)return"\u2014";if(q===0)return"0";let x=q<0?"-":"",j=Math.abs(q);if(j<0.001)return x+j.toFixed(6);if(j<0.01)return x+j.toFixed(4);if(j<0.1)return x+j.toFixed(3);if(j<1)return x+j.toFixed(2);return x+(Number.isInteger(j)?String(j):j.toFixed(2))}
2
+ import{Ap as z}from"./chunk-6qwnty59.js";class B extends Error{cause;constructor(q,x){super(q);this.name="QreditChargeError",this.cause=x}}async function E(q){return z(q)}function F(q){if(q===void 0)return"\u2014";if(q===0)return"0";let x=q<0?"-":"",j=Math.abs(q);if(j<0.001)return x+j.toFixed(6);if(j<0.01)return x+j.toFixed(4);if(j<0.1)return x+j.toFixed(3);if(j<1)return x+j.toFixed(2);return x+(Number.isInteger(j)?String(j):j.toFixed(2))}
3
3
  export{B as G,E as H,F as I};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{$n as c,Ao as D,Bo as E,Co as F,Do as G,Eo as H,Fo as I,Go as J,Ho as K,Io as L,Jo as M,Ko as N,Lo as O,Mo as P,No as Q,Oo as R,Po as S,Qo as T,Ro as U,So as V,To as W,Uo as X,Vo as Y,Zn as a,_n as b,ao as d,bo as e,co as f,do as g,eo as h,fo as i,go as j,ho as k,io as l,jo as m,ko as n,lo as o,mo as p,no as q,oo as r,po as s,qo as t,ro as u,so as v,to as w,uo as x,vo as y,wo as z,xo as A,yo as B,zo as C}from"./chunk-j1bv93m4.js";import"./chunk-pp10epga.js";import"./chunk-crqycrs4.js";import"./chunk-1bq15kf0.js";import"./chunk-pdcxmr6x.js";import"./chunk-cqtkxwd8.js";import"./chunk-a1mbach4.js";import"./chunk-1mfdmm2t.js";import"./chunk-fkq0v5qv.js";import"./chunk-1e75j4m1.js";import"./chunk-1a08ffyd.js";import"./chunk-8jkqyf9n.js";import"./chunk-6yshpz0z.js";import"./chunk-5dvy83ms.js";import"./chunk-ffx0cr44.js";import"./chunk-33mzqyyb.js";import"./chunk-sg9enzsp.js";import"./chunk-5q98z8ck.js";import"./chunk-wfpnv00c.js";import"./chunk-9kc2th5c.js";import"./chunk-sh03ka27.js";export{S as transformQlexStream,T as toOrchestratedSSEStream,U as toOpenAICompletion,o as sanitizeUpstreamProviderError,d as safeQlexRequestId,G as resolveToolMode,c as resolveQlexRetryable,D as renderToolProtocolPrompt,J as recordTierOutputAdvisory,u as planTierBudget,P as partialTagSuffixLength,O as parseQlexFrame,t as parseQlexError,w as normalizeQlexMessagesWithReport,x as normalizeQlexMessages,A as mergeLeadingSystemMessages,r as isGatewayRequiredError,N as isFreeTierFallbackRoutingChunk,y as hasUserRoleMessage,z as hasUsableUserMessage,H as hasToolContext,Y as getTierOutputBudgetRecovery,K as getTierOutputAdvisory,M as flushTierOutputAdvisoryWrites,v as flattenMessageContent,s as extractQlexErrorMetadata,F as encodeToolProtocolMessages,Q as encodeExtractedArguments,E as decodeToolArgumentsToObject,W as createQlexProvider,V as createCustomFetch,L as clearTierOutputAdvisories,q as classifyQlexStreamError,X as canIncreaseTierOutputBudget,I as buildQlexBody,R as ToolCallExtractor,B as TOOL_CALL_OPEN,C as TOOL_CALL_CLOSE,p as QlexStreamError,j as QlexRequestTooLargeError,i as QlexRequestRejectedError,k as QlexRequestNotSentError,g as QlexRateLimitError,e as QlexNotLoggedInError,h as QlexInvalidCredentialsError,f as QlexInsufficientBalanceError,l as QlexGatewayError,a as QLEX_STREAM_URL,n as QLEX_STREAM_IDLE_TIMEOUT_MS,m as QLEX_RESPONSE_TIMEOUT_MS,b as QLEX_ORCHESTRATED_URL};
2
+ import{$n as c,Ao as D,Bo as E,Co as F,Do as G,Eo as H,Fo as I,Go as J,Ho as K,Io as L,Jo as M,Ko as N,Lo as O,Mo as P,No as Q,Oo as R,Po as S,Qo as T,Ro as U,So as V,To as W,Uo as X,Vo as Y,Zn as a,_n as b,ao as d,bo as e,co as f,do as g,eo as h,fo as i,go as j,ho as k,io as l,jo as m,ko as n,lo as o,mo as p,no as q,oo as r,po as s,qo as t,ro as u,so as v,to as w,uo as x,vo as y,wo as z,xo as A,yo as B,zo as C}from"./chunk-ae1b15bd.js";import"./chunk-6qwnty59.js";import"./chunk-crqycrs4.js";import"./chunk-1bq15kf0.js";import"./chunk-pdcxmr6x.js";import"./chunk-cqtkxwd8.js";import"./chunk-a1mbach4.js";import"./chunk-4yd2vvh6.js";import"./chunk-fkq0v5qv.js";import"./chunk-1e75j4m1.js";import"./chunk-5re7995e.js";import"./chunk-mnjz8nqs.js";import"./chunk-6yshpz0z.js";import"./chunk-5dvy83ms.js";import"./chunk-ffx0cr44.js";import"./chunk-33mzqyyb.js";import"./chunk-sg9enzsp.js";import"./chunk-5q98z8ck.js";import"./chunk-wfpnv00c.js";import"./chunk-9kc2th5c.js";import"./chunk-sh03ka27.js";export{S as transformQlexStream,T as toOrchestratedSSEStream,U as toOpenAICompletion,o as sanitizeUpstreamProviderError,d as safeQlexRequestId,G as resolveToolMode,c as resolveQlexRetryable,D as renderToolProtocolPrompt,J as recordTierOutputAdvisory,u as planTierBudget,P as partialTagSuffixLength,O as parseQlexFrame,t as parseQlexError,w as normalizeQlexMessagesWithReport,x as normalizeQlexMessages,A as mergeLeadingSystemMessages,r as isGatewayRequiredError,N as isFreeTierFallbackRoutingChunk,y as hasUserRoleMessage,z as hasUsableUserMessage,H as hasToolContext,Y as getTierOutputBudgetRecovery,K as getTierOutputAdvisory,M as flushTierOutputAdvisoryWrites,v as flattenMessageContent,s as extractQlexErrorMetadata,F as encodeToolProtocolMessages,Q as encodeExtractedArguments,E as decodeToolArgumentsToObject,W as createQlexProvider,V as createCustomFetch,L as clearTierOutputAdvisories,q as classifyQlexStreamError,X as canIncreaseTierOutputBudget,I as buildQlexBody,R as ToolCallExtractor,B as TOOL_CALL_OPEN,C as TOOL_CALL_CLOSE,p as QlexStreamError,j as QlexRequestTooLargeError,i as QlexRequestRejectedError,k as QlexRequestNotSentError,g as QlexRateLimitError,e as QlexNotLoggedInError,h as QlexInvalidCredentialsError,f as QlexInsufficientBalanceError,l as QlexGatewayError,a as QLEX_STREAM_URL,n as QLEX_STREAM_IDLE_TIMEOUT_MS,m as QLEX_RESPONSE_TIMEOUT_MS,b as QLEX_ORCHESTRATED_URL};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{$d as O,Vd as m,Yd as P,Zd as R,_d as k,be as q,ce as $,de as I}from"./chunk-p0852vfn.js";import"./chunk-ej0yzstw.js";import{fe as h}from"./chunk-w8nj5ph5.js";import{cg as r}from"./chunk-psmwrvqs.js";import{Ah as L,ph as E}from"./chunk-fd04358e.js";import"./chunk-qn1fhqyw.js";import"./chunk-674pexjx.js";import"./chunk-zjyaze0d.js";import"./chunk-xdcwx384.js";import"./chunk-rd08wx37.js";import"./chunk-fp2xgnjn.js";import{Dj as N,Sk as x}from"./chunk-y1v7mf1a.js";import"./chunk-358wdvj7.js";import{Ml as i}from"./chunk-dn0437c1.js";import"./chunk-47jkx37s.js";import"./chunk-31a47ptm.js";import"./chunk-jwv6fda1.js";import"./chunk-hx13a8es.js";import"./chunk-h036zy9e.js";import"./chunk-j3agzs13.js";import"./chunk-3152y1q9.js";import"./chunk-71jmhvef.js";import"./chunk-qrztx1b4.js";import"./chunk-j1bv93m4.js";import"./chunk-pp10epga.js";import"./chunk-crqycrs4.js";import"./chunk-1bq15kf0.js";import"./chunk-pdcxmr6x.js";import"./chunk-cqtkxwd8.js";import"./chunk-a1mbach4.js";import"./chunk-m6967jtv.js";import"./chunk-j2snkw45.js";import"./chunk-bmdqb48f.js";import"./chunk-3cs1qf8x.js";import"./chunk-4xqwt6dr.js";import"./chunk-g77kddrs.js";import"./chunk-9znfb8f2.js";import"./chunk-6kch0q2d.js";import"./chunk-6cztstry.js";import"./chunk-1mfdmm2t.js";import"./chunk-fkq0v5qv.js";import"./chunk-1e75j4m1.js";import"./chunk-2w3n0q9m.js";import"./chunk-6dd2dx69.js";import"./chunk-fdmz0502.js";import"./chunk-1a08ffyd.js";import"./chunk-8jkqyf9n.js";import"./chunk-6yshpz0z.js";import"./chunk-5dvy83ms.js";import{hu as C,mu as j}from"./chunk-ffx0cr44.js";import"./chunk-33mzqyyb.js";import"./chunk-sg9enzsp.js";import"./chunk-5q98z8ck.js";import"./chunk-wfpnv00c.js";import"./chunk-9kc2th5c.js";import"./chunk-hf39qx6t.js";import"./chunk-x0de4z05.js";import{uP as F}from"./chunk-sh03ka27.js";import u from"path";import U from"fs/promises";var T=F(N(),1);import{EOL as S}from"os";var c=["bash","read","write","edit","glob","grep","webfetch","actor","task"],B=h({command:"create",describe:"create a new agent",builder:(o)=>o.option("path",{type:"string",describe:"directory path to generate the agent file"}).option("description",{type:"string",describe:"what the agent should do"}).option("mode",{type:"string",describe:"agent mode",choices:["all","primary","subagent"]}).option("tools",{type:"string",describe:`comma-separated list of tools to enable (default: all). Available: "${c.join(", ")}"`}).option("model",{type:"string",alias:["m"],describe:"model to use in the format of provider/model"}),async handler(o){await i.provide({directory:process.cwd(),async fn(){let{path:l,description:t,mode:s,tools:p}=o,d=l&&t&&s&&p!==void 0;if(!d)r.empty(),R("Create agent");let D=i.project,g;if(l)g=u.join(l,"agent");else{let e="global";if(D.vcs==="git"){let n=await $({message:"Location",options:[{label:"Current project",value:"project",hint:i.worktree},{label:"Global",value:"global",hint:j.Path.config}]});if(m(n))throw new r.CancelledError;e=n}g=u.join(e==="global"?j.Path.config:u.join(i.worktree,".qitqode"),"agent")}let b;if(t)b=t;else{let e=await I({message:"Description",placeholder:"What should this agent do?",validate:(n)=>n&&n.length>0?void 0:"Required"});if(m(e))throw new r.CancelledError;b=e}let w=q();w.start("Generating agent configuration...");let G=o.model?x.parseModel(o.model):void 0,f=await L.runPromise(E.Service.use((e)=>e.generate({description:b,model:G}))).catch((e)=>{if(w.stop(`LLM failed to generate agent: ${e.message}`,1),d)process.exit(1);throw new r.CancelledError});w.stop(`Agent ${f.identifier} generated`);let y;if(p!==void 0)y=p?p.split(",").map((e)=>e.trim()):c;else{let e=await O({message:"Select tools to enable (Space to toggle)",options:c.map((n)=>({label:n,value:n})),initialValues:c});if(m(e))throw new r.CancelledError;y=e}let v;if(s)v=s;else{let e=await $({message:"Agent mode",options:[{label:"All",value:"all",hint:"Can function in both primary and subagent roles"},{label:"Primary",value:"primary",hint:"Acts as a primary/main agent"},{label:"Subagent",value:"subagent",hint:"Can be used as a subagent by other agents"}],initialValue:"all"});if(m(e))throw new r.CancelledError;v=e}let A={};for(let e of c)if(!y.includes(e))A[e]=!1;let M={description:f.whenToUse,mode:v};if(Object.keys(A).length>0)M.tools=A;let V=T.default.stringify(f.systemPrompt,M),a=u.join(g,`${f.identifier}.md`);if(await U.mkdir(g,{recursive:!0}),await C.exists(a)){if(d)console.error(`Error: Agent file already exists: ${a}`),process.exit(1);throw P.error(`Agent file already exists: ${a}`),new r.CancelledError}if(await C.write(a,V),d)console.log(a);else P.success(`Agent created: ${a}`),k("Done")}})}}),J=h({command:"list",describe:"list all available agents",async handler(){await i.provide({directory:process.cwd(),async fn(){let l=(await L.runPromise(E.Service.use((t)=>t.list()))).sort((t,s)=>{if(t.native!==s.native)return t.native?-1:1;return t.name.localeCompare(s.name)});for(let t of l)process.stdout.write(`${t.name} (${t.mode})`+S),process.stdout.write(` ${JSON.stringify(t.permission,null,2)}`+S)}})}}),ne=h({command:"agent",describe:"manage agents",builder:(o)=>o.command(B).command(J).demandCommand(),async handler(){}});export{ne as AgentCommand};
2
+ import{$d as O,Vd as m,Yd as P,Zd as R,_d as k,be as q,ce as $,de as I}from"./chunk-p0852vfn.js";import"./chunk-ej0yzstw.js";import{fe as h}from"./chunk-w8nj5ph5.js";import{cg as r}from"./chunk-psmwrvqs.js";import{Ah as L,ph as E}from"./chunk-6zdzbmzs.js";import"./chunk-qn1fhqyw.js";import"./chunk-674pexjx.js";import"./chunk-zjyaze0d.js";import"./chunk-xdcwx384.js";import"./chunk-rd08wx37.js";import"./chunk-fp2xgnjn.js";import{Dj as N,Sk as x}from"./chunk-5asf8f41.js";import"./chunk-2pw56zpj.js";import{Ml as i}from"./chunk-rt49c6js.js";import"./chunk-4gzggzc0.js";import"./chunk-31a47ptm.js";import"./chunk-ywj77e0m.js";import"./chunk-83n11xym.js";import"./chunk-h036zy9e.js";import"./chunk-j3agzs13.js";import"./chunk-3152y1q9.js";import"./chunk-71jmhvef.js";import"./chunk-qrztx1b4.js";import"./chunk-ae1b15bd.js";import"./chunk-6qwnty59.js";import"./chunk-crqycrs4.js";import"./chunk-1bq15kf0.js";import"./chunk-pdcxmr6x.js";import"./chunk-cqtkxwd8.js";import"./chunk-a1mbach4.js";import"./chunk-m6967jtv.js";import"./chunk-j2snkw45.js";import"./chunk-bmdqb48f.js";import"./chunk-3cs1qf8x.js";import"./chunk-4xqwt6dr.js";import"./chunk-g77kddrs.js";import"./chunk-kegvr7wt.js";import"./chunk-2tkgtasa.js";import"./chunk-6cztstry.js";import"./chunk-4yd2vvh6.js";import"./chunk-fkq0v5qv.js";import"./chunk-1e75j4m1.js";import"./chunk-2w3n0q9m.js";import"./chunk-6dd2dx69.js";import"./chunk-fdmz0502.js";import"./chunk-5re7995e.js";import"./chunk-mnjz8nqs.js";import"./chunk-6yshpz0z.js";import"./chunk-5dvy83ms.js";import{hu as C,mu as j}from"./chunk-ffx0cr44.js";import"./chunk-33mzqyyb.js";import"./chunk-sg9enzsp.js";import"./chunk-5q98z8ck.js";import"./chunk-wfpnv00c.js";import"./chunk-9kc2th5c.js";import"./chunk-hf39qx6t.js";import"./chunk-x0de4z05.js";import{uP as F}from"./chunk-sh03ka27.js";import u from"path";import U from"fs/promises";var T=F(N(),1);import{EOL as S}from"os";var c=["bash","read","write","edit","glob","grep","webfetch","actor","task"],B=h({command:"create",describe:"create a new agent",builder:(o)=>o.option("path",{type:"string",describe:"directory path to generate the agent file"}).option("description",{type:"string",describe:"what the agent should do"}).option("mode",{type:"string",describe:"agent mode",choices:["all","primary","subagent"]}).option("tools",{type:"string",describe:`comma-separated list of tools to enable (default: all). Available: "${c.join(", ")}"`}).option("model",{type:"string",alias:["m"],describe:"model to use in the format of provider/model"}),async handler(o){await i.provide({directory:process.cwd(),async fn(){let{path:l,description:t,mode:s,tools:p}=o,d=l&&t&&s&&p!==void 0;if(!d)r.empty(),R("Create agent");let D=i.project,g;if(l)g=u.join(l,"agent");else{let e="global";if(D.vcs==="git"){let n=await $({message:"Location",options:[{label:"Current project",value:"project",hint:i.worktree},{label:"Global",value:"global",hint:j.Path.config}]});if(m(n))throw new r.CancelledError;e=n}g=u.join(e==="global"?j.Path.config:u.join(i.worktree,".qitqode"),"agent")}let b;if(t)b=t;else{let e=await I({message:"Description",placeholder:"What should this agent do?",validate:(n)=>n&&n.length>0?void 0:"Required"});if(m(e))throw new r.CancelledError;b=e}let w=q();w.start("Generating agent configuration...");let G=o.model?x.parseModel(o.model):void 0,f=await L.runPromise(E.Service.use((e)=>e.generate({description:b,model:G}))).catch((e)=>{if(w.stop(`LLM failed to generate agent: ${e.message}`,1),d)process.exit(1);throw new r.CancelledError});w.stop(`Agent ${f.identifier} generated`);let y;if(p!==void 0)y=p?p.split(",").map((e)=>e.trim()):c;else{let e=await O({message:"Select tools to enable (Space to toggle)",options:c.map((n)=>({label:n,value:n})),initialValues:c});if(m(e))throw new r.CancelledError;y=e}let v;if(s)v=s;else{let e=await $({message:"Agent mode",options:[{label:"All",value:"all",hint:"Can function in both primary and subagent roles"},{label:"Primary",value:"primary",hint:"Acts as a primary/main agent"},{label:"Subagent",value:"subagent",hint:"Can be used as a subagent by other agents"}],initialValue:"all"});if(m(e))throw new r.CancelledError;v=e}let A={};for(let e of c)if(!y.includes(e))A[e]=!1;let M={description:f.whenToUse,mode:v};if(Object.keys(A).length>0)M.tools=A;let V=T.default.stringify(f.systemPrompt,M),a=u.join(g,`${f.identifier}.md`);if(await U.mkdir(g,{recursive:!0}),await C.exists(a)){if(d)console.error(`Error: Agent file already exists: ${a}`),process.exit(1);throw P.error(`Agent file already exists: ${a}`),new r.CancelledError}if(await C.write(a,V),d)console.log(a);else P.success(`Agent created: ${a}`),k("Done")}})}}),J=h({command:"list",describe:"list all available agents",async handler(){await i.provide({directory:process.cwd(),async fn(){let l=(await L.runPromise(E.Service.use((t)=>t.list()))).sort((t,s)=>{if(t.native!==s.native)return t.native?-1:1;return t.name.localeCompare(s.name)});for(let t of l)process.stdout.write(`${t.name} (${t.mode})`+S),process.stdout.write(` ${JSON.stringify(t.permission,null,2)}`+S)}})}}),ne=h({command:"agent",describe:"manage agents",builder:(o)=>o.command(B).command(J).demandCommand(),async handler(){}});export{ne as AgentCommand};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{ft as X}from"./chunk-8jkqyf9n.js";function D(j){return j.parserConfiguration({"populate--":!0}).scriptName("qitqode").wrap(100).help("help","show help").alias("help","h").version("version","show version number",X).alias("version","v").option("print-logs",{describe:"print logs to stderr",type:"boolean"}).option("log-level",{describe:"log level",type:"string",choices:["DEBUG","INFO","WARN","ERROR"]}).option("pure",{describe:"run without external plugins",type:"boolean"})}var H={port:{type:"number",describe:"port to listen on",default:0},hostname:{type:"string",describe:"hostname to listen on",default:"127.0.0.1"},mdns:{type:"boolean",describe:"enable mDNS service discovery (defaults hostname to 0.0.0.0)",default:!1},"mdns-domain":{type:"string",describe:"custom domain name for mDNS service (default: qitqode.local)",default:"qitqode.local"},cors:{type:"string",array:!0,describe:"additional domains to allow for CORS",default:[]},"no-auth":{type:"boolean",describe:"allow starting without authentication on non-loopback addresses (DANGEROUS)",default:!1}};function u(j){return j.options(H)}function F(j,z=process.argv){return z.some((B)=>B===j||B.startsWith(`${j}=`))}function P(j,z=process.argv){return F("--port",z)||F("--hostname",z)||F("--mdns",z)||!!j.mdns||j.port!==0||j.hostname!=="127.0.0.1"}function _(j,z,B=process.argv){let J=F("--port",B),Z=F("--hostname",B),$=F("--mdns",B),q=F("--mdns-domain",B),K=$?j.mdns:z?.server?.mdns??j.mdns,M=q?j["mdns-domain"]:z?.server?.mdnsDomain??j["mdns-domain"],N=J?j.port:z?.server?.port??j.port,U=Z?j.hostname:K&&!z?.server?.hostname?"0.0.0.0":z?.server?.hostname??j.hostname,V=z?.server?.cors??[],Y=Array.isArray(j.cors)?j.cors:j.cors?[j.cors]:[],b=[...V,...Y],A=j["no-auth"];return{hostname:U,port:N,mdns:K,mdnsDomain:M,cors:b,noAuth:A}}var k={model:{type:"string",alias:["m"],describe:"model to use in the format of provider/model"},continue:{alias:["c"],describe:"continue the last session",type:"boolean"},session:{alias:["s"],type:"string",describe:"session id to continue"},fork:{type:"boolean",describe:"fork the session when continuing (use with --continue or --session)"},prompt:{type:"string",describe:"prompt to use"},agent:{type:"string",describe:"agent to use"},dark:{type:"boolean",describe:"start in dark theme (overrides saved theme preference for this launch)"},light:{type:"boolean",describe:"start in light theme (overrides saved theme preference for this launch)"},monochrome:{type:"boolean",describe:"start in monochrome accessible rendering \u2014 no color, plain terminal, screen-reader friendly"},headless:{type:"boolean",describe:"headless permissionless mode for AI subagent use \u2014 auto-approves all tool permissions, implies --never-ask"},fullauto:{type:"boolean",describe:"full-auto mode for the interactive TUI \u2014 never asks: starts in build mode, auto-decides questions and auto-approves every tool permission that is not explicitly denied by your config (dangerous!)"},"api-key":{type:"string",describe:"Qortex API key for non-interactive authentication in headless mode (can also be set via $QLEX_API_KEY)"},sso:{type:"boolean",describe:"sign in via SSO device-code flow before starting a headless session \u2014 prints a URL and code, waits for browser approval (requires --headless)"},free:{type:"boolean",describe:"start in Free tier (no cost) \u2014 shorthand for the Free model tier"},adaptive:{type:"boolean",describe:"start in Adaptive tier \u2014 shorthand for the Adaptive model tier"},fast:{type:"boolean",describe:"start in Fast tier \u2014 shorthand for the Fast model tier"},economical:{type:"boolean",describe:"start in Economical tier \u2014 shorthand for the Economical model tier"},maxInt:{type:"boolean",describe:"start in Max intelligence tier \u2014 shorthand for the Max intelligence model tier"},orchestrated:{type:"boolean",describe:"start in Orchestrated tier \u2014 shorthand for the Orchestrated model tier"}},L=36,W="\x1B[38;5;214m",I="\x1B[0;2m",Q="\x1B[0m";function G(j,z){let B=Math.round(j/100*L),J=`${"\u25A0".repeat(B)}${"\uFF65".repeat(L-B)}`;return`\r${W}${J} ${j.toString().padStart(3)}%${Q} ${I}${z}${Q}`}
2
+ import{ft as X}from"./chunk-mnjz8nqs.js";function D(j){return j.parserConfiguration({"populate--":!0}).scriptName("qitqode").wrap(100).help("help","show help").alias("help","h").version("version","show version number",X).alias("version","v").option("print-logs",{describe:"print logs to stderr",type:"boolean"}).option("log-level",{describe:"log level",type:"string",choices:["DEBUG","INFO","WARN","ERROR"]}).option("pure",{describe:"run without external plugins",type:"boolean"})}var H={port:{type:"number",describe:"port to listen on",default:0},hostname:{type:"string",describe:"hostname to listen on",default:"127.0.0.1"},mdns:{type:"boolean",describe:"enable mDNS service discovery (defaults hostname to 0.0.0.0)",default:!1},"mdns-domain":{type:"string",describe:"custom domain name for mDNS service (default: qitqode.local)",default:"qitqode.local"},cors:{type:"string",array:!0,describe:"additional domains to allow for CORS",default:[]},"no-auth":{type:"boolean",describe:"allow starting without authentication on non-loopback addresses (DANGEROUS)",default:!1}};function u(j){return j.options(H)}function F(j,z=process.argv){return z.some((B)=>B===j||B.startsWith(`${j}=`))}function P(j,z=process.argv){return F("--port",z)||F("--hostname",z)||F("--mdns",z)||!!j.mdns||j.port!==0||j.hostname!=="127.0.0.1"}function _(j,z,B=process.argv){let J=F("--port",B),Z=F("--hostname",B),$=F("--mdns",B),q=F("--mdns-domain",B),K=$?j.mdns:z?.server?.mdns??j.mdns,M=q?j["mdns-domain"]:z?.server?.mdnsDomain??j["mdns-domain"],N=J?j.port:z?.server?.port??j.port,U=Z?j.hostname:K&&!z?.server?.hostname?"0.0.0.0":z?.server?.hostname??j.hostname,V=z?.server?.cors??[],Y=Array.isArray(j.cors)?j.cors:j.cors?[j.cors]:[],b=[...V,...Y],A=j["no-auth"];return{hostname:U,port:N,mdns:K,mdnsDomain:M,cors:b,noAuth:A}}var k={model:{type:"string",alias:["m"],describe:"model to use in the format of provider/model"},continue:{alias:["c"],describe:"continue the last session",type:"boolean"},session:{alias:["s"],type:"string",describe:"session id to continue"},fork:{type:"boolean",describe:"fork the session when continuing (use with --continue or --session)"},prompt:{type:"string",describe:"prompt to use"},agent:{type:"string",describe:"agent to use"},dark:{type:"boolean",describe:"start in dark theme (overrides saved theme preference for this launch)"},light:{type:"boolean",describe:"start in light theme (overrides saved theme preference for this launch)"},monochrome:{type:"boolean",describe:"start in monochrome accessible rendering \u2014 no color, plain terminal, screen-reader friendly"},headless:{type:"boolean",describe:"headless permissionless mode for AI subagent use \u2014 auto-approves all tool permissions, implies --never-ask"},fullauto:{type:"boolean",describe:"full-auto mode for the interactive TUI \u2014 never asks: starts in build mode, auto-decides questions and auto-approves every tool permission that is not explicitly denied by your config (dangerous!)"},"api-key":{type:"string",describe:"Qortex API key for non-interactive authentication in headless mode (can also be set via $QLEX_API_KEY)"},sso:{type:"boolean",describe:"sign in via SSO device-code flow before starting a headless session \u2014 prints a URL and code, waits for browser approval (requires --headless)"},free:{type:"boolean",describe:"start in Free tier (no cost) \u2014 shorthand for the Free model tier"},adaptive:{type:"boolean",describe:"start in Adaptive tier \u2014 shorthand for the Adaptive model tier"},fast:{type:"boolean",describe:"start in Fast tier \u2014 shorthand for the Fast model tier"},economical:{type:"boolean",describe:"start in Economical tier \u2014 shorthand for the Economical model tier"},maxInt:{type:"boolean",describe:"start in Max intelligence tier \u2014 shorthand for the Max intelligence model tier"},orchestrated:{type:"boolean",describe:"start in Orchestrated tier \u2014 shorthand for the Orchestrated model tier"}},L=36,W="\x1B[38;5;214m",I="\x1B[0;2m",Q="\x1B[0m";function G(j,z){let B=Math.round(j/100*L),J=`${"\u25A0".repeat(B)}${"\uFF65".repeat(L-B)}`;return`\r${W}${J} ${j.toString().padStart(3)}%${Q} ${I}${z}${Q}`}
3
3
  export{D as Vf,H as Wf,u as Xf,P as Yf,_ as Zf,k as _f,G as $f};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Bh as H}from"./chunk-qn1fhqyw.js";import{Bp as T,gp as k,hp as X,kp as O,lp as b,mp as F,pp as h,qp as C}from"./chunk-pp10epga.js";import w from"http";var B="/callback",U=[51737,51738],K=new Set;function _(f){return f.replace(/[&<>\"']/g,(y)=>{switch(y){case"&":return"&amp;";case"<":return"&lt;";case">":return"&gt;";case'"':return"&quot;";default:return"&#39;"}})}function z(f){return`http://127.0.0.1:${f}${B}`}async function S(f){return new Promise((y,N)=>{let J=w.createServer();J.listen(f,"127.0.0.1",()=>{J.close(()=>y(f))}),J.on("error",N)})}async function E(){for(let f of U){if(K.has(f))continue;K.add(f);try{return await S(f)}catch{K.delete(f)}}throw new X(`Could not bind to any loopback port (tried ${U.join(", ")}). Free one of those ports and retry.`)}function R(f,y,N,J){return new Promise((Q,x)=>{let V=()=>K.delete(f),m=w.createServer(($,Y)=>{try{let Z=new URL($.url??"/",`http://localhost:${f}`);if(Z.pathname!==B){Y.writeHead(404),Y.end();return}let W=Z.searchParams.get("code"),D=Z.searchParams.get("state"),M=Z.searchParams.get("error"),q=Z.searchParams.get("error_description");if(M){let L=`${_(M)}${q?": "+_(q):""}`;Y.writeHead(200,{"Content-Type":"text/html"}),Y.end(`<html><body style="font-family:sans-serif;padding:2rem"><h2>Authorization failed</h2><p>${L}</p><p>You can close this tab.</p></body></html>`),m.close(),x(new X(`Authorization error: ${M}${q?" \u2014 "+q:""}`));return}if(!W||D!==y){Y.writeHead(400),Y.end("Invalid request");return}Y.writeHead(200,{"Content-Type":"text/html"}),Y.end('<html><body style="font-family:sans-serif;padding:2rem"><h2>Signed in! You can close this tab.</h2><p>Return to your terminal to continue.</p></body></html>'),m.close(),Q({code:W})}catch(Z){m.close(),x(Z)}});if(N?.aborted){V(),x(new X("Login cancelled"));return}let G=()=>{V(),m.close(()=>x(new X("Login cancelled")))};if(N?.addEventListener("abort",G,{once:!0}),N?.aborted){G();return}m.listen(f,"127.0.0.1",()=>{V(),J?.()}),m.on("error",($)=>{V(),x($)})})}function I(f,y){return new Promise((N,J)=>{if(y?.aborted){J(new X("Login cancelled"));return}let Q,x=()=>{clearTimeout(Q),y?.removeEventListener("abort",x),J(new X("Login cancelled"))};if(Q=setTimeout(()=>{y?.removeEventListener("abort",x),N()},f),y?.addEventListener("abort",x,{once:!0}),y?.aborted)x()})}function j(f,y=300000){if(!f)return!1;return Date.now()>=f-y}async function A(f){if(f.method==="api-key")return T({});let{issuer:y}=await k();return T({issuer:y,accessToken:f.key})}var d=300000;async function P(){let{issuer:f,clientId:y}=await k(),{verifier:N,challenge:J,state:Q}=O(),x=await E(),V=z(x),m=b({issuer:f,clientId:y,redirectUri:V,challenge:J,state:Q});return{issuer:f,clientId:y,verifier:N,port:x,redirectUri:V,authorizeStr:m,state:Q}}async function p(f){let{issuer:y,clientId:N}=await k(),{deviceCode:J,info:Q,intervalMs:x}=await h({issuer:y,clientId:N,signal:f.signal});if(f.onCode(Q),f.tryOpen){let m=Q.verificationUriComplete??Q.verificationUri;H(m)}let V=x;while(Date.now()<Q.expiresAt){await I(V,f.signal);let m=await C({issuer:y,clientId:N,deviceCode:J,currentIntervalMs:V,signal:f.signal});if(m.kind==="success")return m.profile;V=m.intervalMs}throw new X("The sign-in code expired before it was approved. Try again.")}async function g(){let{issuer:f,clientId:y,verifier:N,port:J,redirectUri:Q,authorizeStr:x,state:V}=await P();process.stdout.write(`
2
+ import{Bh as H}from"./chunk-qn1fhqyw.js";import{Bp as T,gp as k,hp as X,kp as O,lp as b,mp as F,pp as h,qp as C}from"./chunk-6qwnty59.js";import w from"http";var B="/callback",U=[51737,51738],K=new Set;function _(f){return f.replace(/[&<>\"']/g,(y)=>{switch(y){case"&":return"&amp;";case"<":return"&lt;";case">":return"&gt;";case'"':return"&quot;";default:return"&#39;"}})}function z(f){return`http://127.0.0.1:${f}${B}`}async function S(f){return new Promise((y,N)=>{let J=w.createServer();J.listen(f,"127.0.0.1",()=>{J.close(()=>y(f))}),J.on("error",N)})}async function E(){for(let f of U){if(K.has(f))continue;K.add(f);try{return await S(f)}catch{K.delete(f)}}throw new X(`Could not bind to any loopback port (tried ${U.join(", ")}). Free one of those ports and retry.`)}function R(f,y,N,J){return new Promise((Q,x)=>{let V=()=>K.delete(f),m=w.createServer(($,Y)=>{try{let Z=new URL($.url??"/",`http://localhost:${f}`);if(Z.pathname!==B){Y.writeHead(404),Y.end();return}let W=Z.searchParams.get("code"),D=Z.searchParams.get("state"),M=Z.searchParams.get("error"),q=Z.searchParams.get("error_description");if(M){let L=`${_(M)}${q?": "+_(q):""}`;Y.writeHead(200,{"Content-Type":"text/html"}),Y.end(`<html><body style="font-family:sans-serif;padding:2rem"><h2>Authorization failed</h2><p>${L}</p><p>You can close this tab.</p></body></html>`),m.close(),x(new X(`Authorization error: ${M}${q?" \u2014 "+q:""}`));return}if(!W||D!==y){Y.writeHead(400),Y.end("Invalid request");return}Y.writeHead(200,{"Content-Type":"text/html"}),Y.end('<html><body style="font-family:sans-serif;padding:2rem"><h2>Signed in! You can close this tab.</h2><p>Return to your terminal to continue.</p></body></html>'),m.close(),Q({code:W})}catch(Z){m.close(),x(Z)}});if(N?.aborted){V(),x(new X("Login cancelled"));return}let G=()=>{V(),m.close(()=>x(new X("Login cancelled")))};if(N?.addEventListener("abort",G,{once:!0}),N?.aborted){G();return}m.listen(f,"127.0.0.1",()=>{V(),J?.()}),m.on("error",($)=>{V(),x($)})})}function I(f,y){return new Promise((N,J)=>{if(y?.aborted){J(new X("Login cancelled"));return}let Q,x=()=>{clearTimeout(Q),y?.removeEventListener("abort",x),J(new X("Login cancelled"))};if(Q=setTimeout(()=>{y?.removeEventListener("abort",x),N()},f),y?.addEventListener("abort",x,{once:!0}),y?.aborted)x()})}function j(f,y=300000){if(!f)return!1;return Date.now()>=f-y}async function A(f){if(f.method==="api-key")return T({});let{issuer:y}=await k();return T({issuer:y,accessToken:f.key})}var d=300000;async function P(){let{issuer:f,clientId:y}=await k(),{verifier:N,challenge:J,state:Q}=O(),x=await E(),V=z(x),m=b({issuer:f,clientId:y,redirectUri:V,challenge:J,state:Q});return{issuer:f,clientId:y,verifier:N,port:x,redirectUri:V,authorizeStr:m,state:Q}}async function p(f){let{issuer:y,clientId:N}=await k(),{deviceCode:J,info:Q,intervalMs:x}=await h({issuer:y,clientId:N,signal:f.signal});if(f.onCode(Q),f.tryOpen){let m=Q.verificationUriComplete??Q.verificationUri;H(m)}let V=x;while(Date.now()<Q.expiresAt){await I(V,f.signal);let m=await C({issuer:y,clientId:N,deviceCode:J,currentIntervalMs:V,signal:f.signal});if(m.kind==="success")return m.profile;V=m.intervalMs}throw new X("The sign-in code expired before it was approved. Try again.")}async function g(){let{issuer:f,clientId:y,verifier:N,port:J,redirectUri:Q,authorizeStr:x,state:V}=await P();process.stdout.write(`
3
3
  `),process.stdout.write(` Opening Forgewise sign-in in your browser...
4
4
  `),process.stdout.write(" Sign-in URL: "+x+`
5
5
  `),process.stdout.write(`
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{A as g,u as a,v as b,w as c,x as d,y as e,z as f}from"./chunk-qqsj69m2.js";import"./chunk-jwv6fda1.js";import"./chunk-hx13a8es.js";import"./chunk-h036zy9e.js";import"./chunk-j3agzs13.js";import"./chunk-6kch0q2d.js";import"./chunk-6cztstry.js";import"./chunk-1mfdmm2t.js";import"./chunk-fkq0v5qv.js";import"./chunk-1e75j4m1.js";import"./chunk-2w3n0q9m.js";import"./chunk-fdmz0502.js";import"./chunk-8jkqyf9n.js";import"./chunk-6yshpz0z.js";import"./chunk-5dvy83ms.js";import"./chunk-ffx0cr44.js";import"./chunk-33mzqyyb.js";import"./chunk-sg9enzsp.js";import"./chunk-5q98z8ck.js";import"./chunk-wfpnv00c.js";import"./chunk-9kc2th5c.js";import"./chunk-sh03ka27.js";export{e as waitForDependencies,c as layer,f as get,d as defaultLayer,g as TuiConfig,b as Service,a as Info};
2
+ import{A as g,u as a,v as b,w as c,x as d,y as e,z as f}from"./chunk-h6b5966p.js";import"./chunk-ywj77e0m.js";import"./chunk-83n11xym.js";import"./chunk-h036zy9e.js";import"./chunk-j3agzs13.js";import"./chunk-2tkgtasa.js";import"./chunk-6cztstry.js";import"./chunk-4yd2vvh6.js";import"./chunk-fkq0v5qv.js";import"./chunk-1e75j4m1.js";import"./chunk-2w3n0q9m.js";import"./chunk-fdmz0502.js";import"./chunk-mnjz8nqs.js";import"./chunk-6yshpz0z.js";import"./chunk-5dvy83ms.js";import"./chunk-ffx0cr44.js";import"./chunk-33mzqyyb.js";import"./chunk-sg9enzsp.js";import"./chunk-5q98z8ck.js";import"./chunk-wfpnv00c.js";import"./chunk-9kc2th5c.js";import"./chunk-sh03ka27.js";export{e as waitForDependencies,c as layer,f as get,d as defaultLayer,g as TuiConfig,b as Service,a as Info};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Al as s,Bl as t,Cl as u,El as v,Fl as w}from"./chunk-dn0437c1.js";import"./chunk-47jkx37s.js";import{Am as c,Bm as d,Cm as e,Dm as f,Em as g,Fm as h,Gm as i,Hm as j,Im as k,Km as l,Lm as m,Mm as n,Om as o,Qm as p,Xm as q,Ym as r,mm as a,zm as b}from"./chunk-31a47ptm.js";import"./chunk-j3agzs13.js";import"./chunk-3152y1q9.js";import"./chunk-71jmhvef.js";import"./chunk-9znfb8f2.js";import"./chunk-6kch0q2d.js";import"./chunk-6cztstry.js";import"./chunk-1mfdmm2t.js";import"./chunk-fkq0v5qv.js";import"./chunk-1e75j4m1.js";import"./chunk-6dd2dx69.js";import"./chunk-fdmz0502.js";import"./chunk-8jkqyf9n.js";import"./chunk-6yshpz0z.js";import"./chunk-5dvy83ms.js";import"./chunk-ffx0cr44.js";import"./chunk-33mzqyyb.js";import"./chunk-sg9enzsp.js";import"./chunk-5q98z8ck.js";import"./chunk-wfpnv00c.js";import"./chunk-9kc2th5c.js";import"./chunk-sh03ka27.js";export{a as sql,e as or,f as not,c as ne,j as lte,i as lt,p as like,l as isNull,m as isNotNull,k as inArray,h as gte,g as gt,n as exists,b as eq,r as desc,t as count,o as between,q as asc,d as and,w as Storage,v as NotFoundError,s as JsonMigration,u as Database};
2
+ import{Al as s,Bl as t,Cl as u,El as v,Fl as w}from"./chunk-rt49c6js.js";import"./chunk-4gzggzc0.js";import{Am as c,Bm as d,Cm as e,Dm as f,Em as g,Fm as h,Gm as i,Hm as j,Im as k,Km as l,Lm as m,Mm as n,Om as o,Qm as p,Xm as q,Ym as r,mm as a,zm as b}from"./chunk-31a47ptm.js";import"./chunk-j3agzs13.js";import"./chunk-3152y1q9.js";import"./chunk-71jmhvef.js";import"./chunk-kegvr7wt.js";import"./chunk-2tkgtasa.js";import"./chunk-6cztstry.js";import"./chunk-4yd2vvh6.js";import"./chunk-fkq0v5qv.js";import"./chunk-1e75j4m1.js";import"./chunk-6dd2dx69.js";import"./chunk-fdmz0502.js";import"./chunk-mnjz8nqs.js";import"./chunk-6yshpz0z.js";import"./chunk-5dvy83ms.js";import"./chunk-ffx0cr44.js";import"./chunk-33mzqyyb.js";import"./chunk-sg9enzsp.js";import"./chunk-5q98z8ck.js";import"./chunk-wfpnv00c.js";import"./chunk-9kc2th5c.js";import"./chunk-sh03ka27.js";export{a as sql,e as or,f as not,c as ne,j as lte,i as lt,p as like,l as isNull,m as isNotNull,k as inArray,h as gte,g as gt,n as exists,b as eq,r as desc,t as count,o as between,q as asc,d as and,w as Storage,v as NotFoundError,s as JsonMigration,u as Database};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{ct as A}from"./chunk-fdmz0502.js";import{et as B}from"./chunk-1a08ffyd.js";import{Ht as O,It as Q,Jt as X}from"./chunk-6yshpz0z.js";function W(j,z){return typeof j==="object"&&j!==null&&"_tag"in j&&j._tag===z}function f(j){let z=O(j),J=typeof j==="object"&&j!==null&&"name"in j&&typeof j.name==="string"?j.name:z?.errorName,K=typeof j==="object"&&j!==null&&"data"in j&&typeof j.data==="object"&&j.data!==null&&"message"in j.data&&typeof j.data.message==="string"?j.data.message:void 0;if(J==="UnknownError"||z){let v=z??Q(j,J??"UnknownError"),G=K&&!K.startsWith("{")?K:"QitQode could not explain this failure.",L=v?` [${v.errorName}, error id ${v.errorID}${v.logFile?`; log: ${v.logFile}`:""}]`:"";return G+L}if(A.hasName(j,"MCPFailed"))return`MCP server "${j.data?.name}" failed. Note, qitqode does not support MCP authentication yet.`;if(W(j,"AccountServiceError")||W(j,"AccountTransportError"))return j.message??"";if(A.hasName(j,"ProviderModelNotFoundError")){let v=j.data,G=Array.isArray(v?.suggestions)?v.suggestions:[];return[`Model not found: ${v?.providerID}/${v?.modelID}`,...G.length?["Did you mean: "+G.join(", ")]:[],"Try: `qitqode models` to list available models","Or check your config (qitqode.json) provider/model names"].join(`
2
+ import{ct as A}from"./chunk-fdmz0502.js";import{et as B}from"./chunk-5re7995e.js";import{Ht as O,It as Q,Jt as X}from"./chunk-6yshpz0z.js";function W(j,z){return typeof j==="object"&&j!==null&&"_tag"in j&&j._tag===z}function f(j){let z=O(j),J=typeof j==="object"&&j!==null&&"name"in j&&typeof j.name==="string"?j.name:z?.errorName,K=typeof j==="object"&&j!==null&&"data"in j&&typeof j.data==="object"&&j.data!==null&&"message"in j.data&&typeof j.data.message==="string"?j.data.message:void 0;if(J==="UnknownError"||z){let v=z??Q(j,J??"UnknownError"),G=K&&!K.startsWith("{")?K:"QitQode could not explain this failure.",L=v?` [${v.errorName}, error id ${v.errorID}${v.logFile?`; log: ${v.logFile}`:""}]`:"";return G+L}if(A.hasName(j,"MCPFailed"))return`MCP server "${j.data?.name}" failed. Note, qitqode does not support MCP authentication yet.`;if(W(j,"AccountServiceError")||W(j,"AccountTransportError"))return j.message??"";if(A.hasName(j,"ProviderModelNotFoundError")){let v=j.data,G=Array.isArray(v?.suggestions)?v.suggestions:[];return[`Model not found: ${v?.providerID}/${v?.modelID}`,...G.length?["Did you mean: "+G.join(", ")]:[],"Try: `qitqode models` to list available models","Or check your config (qitqode.json) provider/model names"].join(`
3
3
  `)}if(A.hasName(j,"ProviderInitError"))return`Failed to initialize provider "${j.data?.providerID}". Check credentials and configuration.`;if(A.hasName(j,"ConfigJsonError")){let v=j.data;return`Config file at ${v?.path} is not valid JSON(C)`+(v?.message?`: ${v.message}`:"")}if(A.hasName(j,"ConfigDirectoryTypoError")){let v=j.data;return`Directory "${v?.dir}" in ${v?.path} is not valid. Rename the directory to "${v?.suggestion}" or remove it. This is a common typo.`}if(A.hasName(j,"ConfigFrontmatterError"))return j.data?.message??"";if(A.hasName(j,"ConfigInvalidError")){let v=j.data,G=v?.path,L=v?.message,Y=Array.isArray(v?.issues)?v.issues:[];return[`Configuration is invalid${G&&G!=="config"?` at ${G}`:""}`+(L?`: ${L}`:""),...Y.map((V)=>"\u21B3 "+V.message+" "+V.path.join("."))].join(`
4
4
  `)}if(A.hasName(j,"UICancelledError"))return"";let H=typeof j==="object"&&j!==null&&"name"in j?j.name:void 0;if(H==="QlexNotLoggedInError")return B.copy().notLoggedIn;if(H==="QlexInsufficientBalanceError")return(j.message??B.copy().insufficientBalanceFallback)+B.copy().insufficientBalanceCliSuffix;if(H==="QlexRateLimitError")return B.copy().rateLimit;if(H==="BackendInsufficientBalanceError")return(j.message??B.copy().insufficientBalanceFallback)+B.copy().insufficientBalanceCliSuffix;if(H==="BackendRateLimitError")return j.message??B.copy().rateLimit;if(H==="QlexInvalidCredentialsError")return j.message??B.copy().invalidCredentialsFallback}function q(j){let z=O(j)??Q(j);return`${X(j)}${z?` [${z.errorName}, error id ${z.errorID}; log: ${z.logFile}]`:""}`}function U({onlyFirst:j=!1}={}){return new RegExp("(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]",j?void 0:"g")}var Z=U();function _(j){if(typeof j!=="string")throw TypeError(`Expected a \`string\`, got \`${typeof j}\``);return j.replace(Z,"")}
5
5
  export{_ as Sf,f as Tf,q as Uf};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{n as a,o as b}from"./chunk-zpjtse0z.js";import"./chunk-7s9msscb.js";import"./chunk-qqsj69m2.js";import"./chunk-ajyfms68.js";import"./chunk-9z7y4x7q.js";import"./chunk-ykvgmje9.js";import"./chunk-art8gejd.js";import"./chunk-w4fr00s7.js";import"./chunk-840mmmzz.js";import"./chunk-rqap90xh.js";import"./chunk-k769v1ds.js";import"./chunk-0mztgsxp.js";import"./chunk-ej0yzstw.js";import"./chunk-c5cyt23k.js";import"./chunk-v1axkp21.js";import"./chunk-qpggztkq.js";import"./chunk-psmwrvqs.js";import"./chunk-e8s4mp5n.js";import"./chunk-9gxyt2ay.js";import"./chunk-fd04358e.js";import"./chunk-qn1fhqyw.js";import"./chunk-674pexjx.js";import"./chunk-zjyaze0d.js";import"./chunk-xdcwx384.js";import"./chunk-rd08wx37.js";import"./chunk-fp2xgnjn.js";import"./chunk-y1v7mf1a.js";import"./chunk-358wdvj7.js";import"./chunk-dn0437c1.js";import"./chunk-47jkx37s.js";import"./chunk-31a47ptm.js";import"./chunk-jwv6fda1.js";import"./chunk-hx13a8es.js";import"./chunk-h036zy9e.js";import"./chunk-j3agzs13.js";import"./chunk-3152y1q9.js";import"./chunk-71jmhvef.js";import"./chunk-qrztx1b4.js";import"./chunk-j1bv93m4.js";import"./chunk-pp10epga.js";import"./chunk-crqycrs4.js";import"./chunk-1bq15kf0.js";import"./chunk-pdcxmr6x.js";import"./chunk-cqtkxwd8.js";import"./chunk-a1mbach4.js";import"./chunk-m6967jtv.js";import"./chunk-j2snkw45.js";import"./chunk-bmdqb48f.js";import"./chunk-3cs1qf8x.js";import"./chunk-4xqwt6dr.js";import"./chunk-g77kddrs.js";import"./chunk-9znfb8f2.js";import"./chunk-6kch0q2d.js";import"./chunk-6cztstry.js";import"./chunk-1mfdmm2t.js";import"./chunk-fkq0v5qv.js";import"./chunk-1e75j4m1.js";import"./chunk-2w3n0q9m.js";import"./chunk-6dd2dx69.js";import"./chunk-06tgmvh6.js";import"./chunk-fdmz0502.js";import"./chunk-1a08ffyd.js";import"./chunk-8jkqyf9n.js";import"./chunk-6yshpz0z.js";import"./chunk-5dvy83ms.js";import"./chunk-ffx0cr44.js";import"./chunk-33mzqyyb.js";import"./chunk-sg9enzsp.js";import"./chunk-5q98z8ck.js";import"./chunk-wfpnv00c.js";import"./chunk-9kc2th5c.js";import"./chunk-hf39qx6t.js";import"./chunk-x0de4z05.js";import"./chunk-sh03ka27.js";export{b as tui,a as rendererConfig};
2
+ import{n as a,o as b}from"./chunk-mq3w4z8k.js";import"./chunk-vgmgg994.js";import"./chunk-h6b5966p.js";import"./chunk-ajyfms68.js";import"./chunk-djdfpezf.js";import"./chunk-n4qbnecw.js";import"./chunk-art8gejd.js";import"./chunk-wne3v1fk.js";import"./chunk-840mmmzz.js";import"./chunk-rqap90xh.js";import"./chunk-k769v1ds.js";import"./chunk-0mztgsxp.js";import"./chunk-ej0yzstw.js";import"./chunk-c5cyt23k.js";import"./chunk-v1axkp21.js";import"./chunk-fswt9qc0.js";import"./chunk-psmwrvqs.js";import"./chunk-878sb0es.js";import"./chunk-f0x3q5dj.js";import"./chunk-6zdzbmzs.js";import"./chunk-qn1fhqyw.js";import"./chunk-674pexjx.js";import"./chunk-zjyaze0d.js";import"./chunk-xdcwx384.js";import"./chunk-rd08wx37.js";import"./chunk-fp2xgnjn.js";import"./chunk-5asf8f41.js";import"./chunk-2pw56zpj.js";import"./chunk-rt49c6js.js";import"./chunk-4gzggzc0.js";import"./chunk-31a47ptm.js";import"./chunk-ywj77e0m.js";import"./chunk-83n11xym.js";import"./chunk-h036zy9e.js";import"./chunk-j3agzs13.js";import"./chunk-3152y1q9.js";import"./chunk-71jmhvef.js";import"./chunk-qrztx1b4.js";import"./chunk-ae1b15bd.js";import"./chunk-6qwnty59.js";import"./chunk-crqycrs4.js";import"./chunk-1bq15kf0.js";import"./chunk-pdcxmr6x.js";import"./chunk-cqtkxwd8.js";import"./chunk-a1mbach4.js";import"./chunk-m6967jtv.js";import"./chunk-j2snkw45.js";import"./chunk-bmdqb48f.js";import"./chunk-3cs1qf8x.js";import"./chunk-4xqwt6dr.js";import"./chunk-g77kddrs.js";import"./chunk-kegvr7wt.js";import"./chunk-2tkgtasa.js";import"./chunk-6cztstry.js";import"./chunk-4yd2vvh6.js";import"./chunk-fkq0v5qv.js";import"./chunk-1e75j4m1.js";import"./chunk-2w3n0q9m.js";import"./chunk-6dd2dx69.js";import"./chunk-06tgmvh6.js";import"./chunk-fdmz0502.js";import"./chunk-5re7995e.js";import"./chunk-mnjz8nqs.js";import"./chunk-6yshpz0z.js";import"./chunk-5dvy83ms.js";import"./chunk-ffx0cr44.js";import"./chunk-33mzqyyb.js";import"./chunk-sg9enzsp.js";import"./chunk-5q98z8ck.js";import"./chunk-wfpnv00c.js";import"./chunk-9kc2th5c.js";import"./chunk-hf39qx6t.js";import"./chunk-x0de4z05.js";import"./chunk-sh03ka27.js";export{b as tui,a as rendererConfig};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{dn as E,en as c,fn as M,gn as i}from"./chunk-jwv6fda1.js";import{Dn as e,En as _0,Fn as I,Gn as O0,in as g,kn as n,ln as k,on as d,pn as u}from"./chunk-hx13a8es.js";import{Nn as r}from"./chunk-j3agzs13.js";import{kt as G,pt as y}from"./chunk-8jkqyf9n.js";import{Gt as s}from"./chunk-6yshpz0z.js";import{Pt as X,Yt as o}from"./chunk-5dvy83ms.js";import{du as x,hu as K,mu as T}from"./chunk-ffx0cr44.js";import{nu as j}from"./chunk-33mzqyyb.js";import{BC as v,FF as L,VO as A,gI as w,oJ as f}from"./chunk-9kc2th5c.js";import{wP as p}from"./chunk-sh03ka27.js";var F={};p(F,{waitForDependencies:()=>M0,layer:()=>V0,get:()=>R0,defaultLayer:()=>W0,TuiConfig:()=>F,Service:()=>z,Info:()=>Z0});import l from"path";var J={};p(J,{Keybinds:()=>B0,ConfigKeybinds:()=>J});var _=(O,Z)=>A.String.pipe(A.optional,A.withDecodingDefault(w.succeed(O))).annotate({description:Z}),j0=process.platform==="win32"?"ctrl+z,ctrl+-,super+z":"ctrl+-,super+z",w0=A.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:_("ctrl+space","Next agent"),agent_cycle_reverse:_("none","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:_(j0,"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:_("<leader>right","Go to next child session"),session_child_cycle_reverse:_("<leader>left","Go to previous child session"),session_parent:_("<leader>up","Go to parent session"),session_main:_("<leader>escape","Back to the main conversation"),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"}),B0=r(w0);var K0=j.object(Object.fromEntries(Object.keys(J.Keybinds.shape).map((O)=>[O,j.string().optional()]))).strict(),R=j.object({scroll_speed:j.number().min(0.001).optional().describe("TUI scroll speed"),scroll_acceleration:j.object({enabled:j.boolean().describe("Enable scroll acceleration")}).optional().describe("Scroll acceleration settings"),diff_style:j.enum(["auto","stacked"]).optional().describe("Control diff rendering style: 'auto' adapts to terminal width, 'stacked' always shows single column"),mouse:j.boolean().optional().describe("Enable or disable mouse capture (default: true on desktop, false on Android/Termux)"),accessible:j.boolean().optional().describe("Screen-reader friendly mode: linear main-screen rendering, no mouse capture, reduced motion, no sound (default: false)"),reduce_motion:j.boolean().optional().describe("Disable spinners and other animations, showing static text instead (default: false)"),sound:j.boolean().optional().describe("Enable or disable sound cues (default: true)"),announcements:j.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=j.object({$schema:j.string().optional(),theme:j.string().optional(),keybinds:K0.optional(),plugin:M.Spec.zod.array().optional(),plugin_enabled:j.record(j.string(),j.boolean()).optional()}).extend(R.shape).strict();var D=o.create({service:"tui.migrate"}),X0="https://qitqode.com/tui.json",Y0=P.shape.theme.optional(),b=j.record(j.string(),j.unknown()).optional(),H0=j.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 t(O){let Z=await G0(O);for(let V of Z){let $=await K.readText(V).catch((m)=>{D.warn("failed to read config for tui migration",{path:V,error:m});return});if(!$)continue;let Q=[],B=g($,Q,{allowTrailingComma:!0});if(Q.length||!B||typeof B!=="object"||Array.isArray(B))continue;let W=Y0.safeParse("theme"in B?B.theme:void 0),Y=b.safeParse("keybinds"in B?B.keybinds:void 0),N=b.safeParse("tui"in B?B.tui:void 0),H={theme:W.success?W.data:void 0,keybinds:Y.success?Y.data:void 0,tui:N.success?N.data:void 0},S=H.tui?J0(H.tui):void 0;if(H.theme===void 0&&H.keybinds===void 0&&!S)continue;let U=l.join(l.dirname(V),"tui.json");if(await K.exists(U))continue;let C={$schema:X0};if(H.theme!==void 0)C.theme=H.theme;if(H.keybinds!==void 0)C.keybinds=H.keybinds;if(S)Object.assign(C,S);if(!await K.write(U,JSON.stringify(C,null,2)).then(()=>!0).catch((m)=>{return D.warn("failed to write tui migration target",{from:V,to:U,error:m}),!1}))continue;if(!await D0(V,$)){D.warn("tui config migrated but source file was not stripped",{from:V,to:U});continue}D.info("migrated tui config",{from:V,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 D0(O,Z){let V=O+".tui-migration.bak";if(!(await K.exists(V)?!0:await K.write(V,Z).then(()=>!0).catch((W)=>{return D.warn("failed to backup source config during tui migration",{path:O,backup:V,error:W}),!1})))return!1;let B=["theme","keybinds","tui"].reduce((W,Y)=>{let N=n(W,[Y],void 0,{formattingOptions:{insertSpaces:!0,tabSize:2}});if(!N.length)return W;return k(W,N)},Z);return K.write(O,B).then(()=>{return D.info("stripped tui keys from server config",{path:O,backup:V}),!0}).catch((W)=>{return D.warn("failed to strip legacy tui keys from server config",{path:O,backup:V,error:W}),!1})}async function G0(O){let Z=[...I(T.Path.config,"qitqode"),...await K.findUp(["qitqode.json","qitqode.jsonc"],O.cwd,void 0,{rootFirst:!0})];for(let $ of G(O.directories))Z.push(...I($,"qitqode"));if(X.QITQODE_CONFIG)Z.push(X.QITQODE_CONFIG);return(await Promise.all(G(Z).map(async($)=>{return await K.exists($)?$:void 0}))).filter(($)=>!!$)}var a=v.Reference("CurrentWorkingDirectory",{defaultValue:()=>process.cwd()});var h=o.create({service:"tui.config"}),Z0=P;class z extends v.Service()("@qitqode/TuiConfig"){}function I0(O,Z){if(K.contains(Z.directory,O))return"local";return"global"}function N0(O){let Z={...O};if(!("tui"in Z))return Z;if(!s(Z.tui))return delete Z.tui,Z;let V=Z.tui;return delete Z.tui,{...V,...Z}}async function U0(O,Z){if(!O.plugin)return O;for(let V=0;V<O.plugin.length;V++)O.plugin[V]=await M.resolvePluginSpec(O.plugin[V],Z);return O}async function q(O,Z,V){let $=await z0(Z);if(O.result=y(O.result,$),!$.plugin?.length)return;let Q=I0(Z,V),B=M.deduplicatePluginOrigins([...O.result.plugin_origins??[],...$.plugin.map((W)=>({spec:W,scope:Q,source:Z}))]);O.result.plugin=B.map((W)=>W.spec),O.result.plugin_origins=B}var A0=w.fn("TuiConfig.loadState")(function*(O){let Z=yield*_0(O.directory);yield*w.promise(()=>t({directories:Z,cwd:O.directory}));let V=X.QITQODE_DISABLE_PROJECT_CONFIG?[]:yield*e("tui",O.directory),$={result:{}};for(let W of I(T.Path.config,"tui"))yield*w.promise(()=>q($,W,O)).pipe(w.orDie);if(X.QITQODE_TUI_CONFIG){let W=X.QITQODE_TUI_CONFIG;yield*w.promise(()=>q($,W,O)).pipe(w.orDie),h.debug("loaded custom tui config",{path:W})}for(let W of V)yield*w.promise(()=>q($,W,O)).pipe(w.orDie);let Q=G(Z).filter((W)=>W.endsWith(".qitqode")||W===X.QITQODE_CONFIG_DIR);for(let W of Q){if(!W.endsWith(".qitqode")&&W!==X.QITQODE_CONFIG_DIR)continue;for(let Y of I(W,"tui"))yield*w.promise(()=>q($,Y,O)).pipe(w.orDie)}let B={...$.result.keybinds??{}};if(process.platform==="win32")B.terminal_suspend="none",B.input_undo??=G(["ctrl+z",...J.Keybinds.shape.input_undo.parse(void 0).split(",")]).join(",");return $.result.keybinds=J.Keybinds.parse(B),{config:$.result,dirs:$.result.plugin?.length?Q:[]}}),V0=L.effect(z,w.gen(function*(){let O=yield*a,Z=yield*u.Service,V=yield*x.Service,$=yield*A0({directory:O}),Q=yield*w.forEach($.dirs,(Y)=>i.install({fs:V,npm:Z,dir:Y}).pipe(w.forkScoped),{concurrency:"unbounded"}),B=w.fn("TuiConfig.get")(()=>w.succeed($.config)),W=w.fn("TuiConfig.waitForDependencies")(()=>w.forEach(Q,f.join,{concurrency:"unbounded"}).pipe(w.ignore(),w.asVoid));return z.of({get:B,waitForDependencies:W})}).pipe(w.withSpan("TuiConfig.layer"))),W0=V0.pipe(L.provide(u.defaultLayer),L.provide(x.defaultLayer)),{runPromise:$0}=d(z,W0);async function M0(){await $0((O)=>O.waitForDependencies())}async function R0(){return $0((O)=>O.get())}async function z0(O){let Z=await O0(O);if(!Z)return{};return C0(Z,O).catch((V)=>{return h.warn("failed to load tui config",{path:O,error:V}),{}})}async function C0(O,Z){return c.substitute({text:O,type:"path",path:Z,missing:"empty"}).then((V)=>E.jsonc(V,Z)).then((V)=>{if(!s(V))return{};return E.schema(Z0,N0(V),Z)}).then((V)=>U0(V,Z)).catch((V)=>{return h.warn("invalid tui config",{path:Z,error:V}),{}})}
2
+ import{dn as E,en as c,fn as M,gn as i}from"./chunk-ywj77e0m.js";import{Dn as e,En as _0,Fn as I,Gn as O0,in as g,kn as n,ln as k,on as d,pn as u}from"./chunk-83n11xym.js";import{Nn as r}from"./chunk-j3agzs13.js";import{kt as G,pt as y}from"./chunk-mnjz8nqs.js";import{Gt as s}from"./chunk-6yshpz0z.js";import{Pt as X,Yt as o}from"./chunk-5dvy83ms.js";import{du as x,hu as K,mu as T}from"./chunk-ffx0cr44.js";import{nu as j}from"./chunk-33mzqyyb.js";import{BC as v,FF as L,VO as A,gI as w,oJ as f}from"./chunk-9kc2th5c.js";import{wP as p}from"./chunk-sh03ka27.js";var F={};p(F,{waitForDependencies:()=>M0,layer:()=>V0,get:()=>R0,defaultLayer:()=>W0,TuiConfig:()=>F,Service:()=>z,Info:()=>Z0});import l from"path";var J={};p(J,{Keybinds:()=>B0,ConfigKeybinds:()=>J});var _=(O,Z)=>A.String.pipe(A.optional,A.withDecodingDefault(w.succeed(O))).annotate({description:Z}),j0=process.platform==="win32"?"ctrl+z,ctrl+-,super+z":"ctrl+-,super+z",w0=A.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:_("ctrl+space","Next agent"),agent_cycle_reverse:_("none","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:_(j0,"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:_("<leader>right","Go to next child session"),session_child_cycle_reverse:_("<leader>left","Go to previous child session"),session_parent:_("<leader>up","Go to parent session"),session_main:_("<leader>escape","Back to the main conversation"),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"}),B0=r(w0);var K0=j.object(Object.fromEntries(Object.keys(J.Keybinds.shape).map((O)=>[O,j.string().optional()]))).strict(),R=j.object({scroll_speed:j.number().min(0.001).optional().describe("TUI scroll speed"),scroll_acceleration:j.object({enabled:j.boolean().describe("Enable scroll acceleration")}).optional().describe("Scroll acceleration settings"),diff_style:j.enum(["auto","stacked"]).optional().describe("Control diff rendering style: 'auto' adapts to terminal width, 'stacked' always shows single column"),mouse:j.boolean().optional().describe("Enable or disable mouse capture (default: true on desktop, false on Android/Termux)"),accessible:j.boolean().optional().describe("Screen-reader friendly mode: linear main-screen rendering, no mouse capture, reduced motion, no sound (default: false)"),reduce_motion:j.boolean().optional().describe("Disable spinners and other animations, showing static text instead (default: false)"),sound:j.boolean().optional().describe("Enable or disable sound cues (default: true)"),announcements:j.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=j.object({$schema:j.string().optional(),theme:j.string().optional(),keybinds:K0.optional(),plugin:M.Spec.zod.array().optional(),plugin_enabled:j.record(j.string(),j.boolean()).optional()}).extend(R.shape).strict();var D=o.create({service:"tui.migrate"}),X0="https://qitqode.com/tui.json",Y0=P.shape.theme.optional(),b=j.record(j.string(),j.unknown()).optional(),H0=j.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 t(O){let Z=await G0(O);for(let V of Z){let $=await K.readText(V).catch((m)=>{D.warn("failed to read config for tui migration",{path:V,error:m});return});if(!$)continue;let Q=[],B=g($,Q,{allowTrailingComma:!0});if(Q.length||!B||typeof B!=="object"||Array.isArray(B))continue;let W=Y0.safeParse("theme"in B?B.theme:void 0),Y=b.safeParse("keybinds"in B?B.keybinds:void 0),N=b.safeParse("tui"in B?B.tui:void 0),H={theme:W.success?W.data:void 0,keybinds:Y.success?Y.data:void 0,tui:N.success?N.data:void 0},S=H.tui?J0(H.tui):void 0;if(H.theme===void 0&&H.keybinds===void 0&&!S)continue;let U=l.join(l.dirname(V),"tui.json");if(await K.exists(U))continue;let C={$schema:X0};if(H.theme!==void 0)C.theme=H.theme;if(H.keybinds!==void 0)C.keybinds=H.keybinds;if(S)Object.assign(C,S);if(!await K.write(U,JSON.stringify(C,null,2)).then(()=>!0).catch((m)=>{return D.warn("failed to write tui migration target",{from:V,to:U,error:m}),!1}))continue;if(!await D0(V,$)){D.warn("tui config migrated but source file was not stripped",{from:V,to:U});continue}D.info("migrated tui config",{from:V,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 D0(O,Z){let V=O+".tui-migration.bak";if(!(await K.exists(V)?!0:await K.write(V,Z).then(()=>!0).catch((W)=>{return D.warn("failed to backup source config during tui migration",{path:O,backup:V,error:W}),!1})))return!1;let B=["theme","keybinds","tui"].reduce((W,Y)=>{let N=n(W,[Y],void 0,{formattingOptions:{insertSpaces:!0,tabSize:2}});if(!N.length)return W;return k(W,N)},Z);return K.write(O,B).then(()=>{return D.info("stripped tui keys from server config",{path:O,backup:V}),!0}).catch((W)=>{return D.warn("failed to strip legacy tui keys from server config",{path:O,backup:V,error:W}),!1})}async function G0(O){let Z=[...I(T.Path.config,"qitqode"),...await K.findUp(["qitqode.json","qitqode.jsonc"],O.cwd,void 0,{rootFirst:!0})];for(let $ of G(O.directories))Z.push(...I($,"qitqode"));if(X.QITQODE_CONFIG)Z.push(X.QITQODE_CONFIG);return(await Promise.all(G(Z).map(async($)=>{return await K.exists($)?$:void 0}))).filter(($)=>!!$)}var a=v.Reference("CurrentWorkingDirectory",{defaultValue:()=>process.cwd()});var h=o.create({service:"tui.config"}),Z0=P;class z extends v.Service()("@qitqode/TuiConfig"){}function I0(O,Z){if(K.contains(Z.directory,O))return"local";return"global"}function N0(O){let Z={...O};if(!("tui"in Z))return Z;if(!s(Z.tui))return delete Z.tui,Z;let V=Z.tui;return delete Z.tui,{...V,...Z}}async function U0(O,Z){if(!O.plugin)return O;for(let V=0;V<O.plugin.length;V++)O.plugin[V]=await M.resolvePluginSpec(O.plugin[V],Z);return O}async function q(O,Z,V){let $=await z0(Z);if(O.result=y(O.result,$),!$.plugin?.length)return;let Q=I0(Z,V),B=M.deduplicatePluginOrigins([...O.result.plugin_origins??[],...$.plugin.map((W)=>({spec:W,scope:Q,source:Z}))]);O.result.plugin=B.map((W)=>W.spec),O.result.plugin_origins=B}var A0=w.fn("TuiConfig.loadState")(function*(O){let Z=yield*_0(O.directory);yield*w.promise(()=>t({directories:Z,cwd:O.directory}));let V=X.QITQODE_DISABLE_PROJECT_CONFIG?[]:yield*e("tui",O.directory),$={result:{}};for(let W of I(T.Path.config,"tui"))yield*w.promise(()=>q($,W,O)).pipe(w.orDie);if(X.QITQODE_TUI_CONFIG){let W=X.QITQODE_TUI_CONFIG;yield*w.promise(()=>q($,W,O)).pipe(w.orDie),h.debug("loaded custom tui config",{path:W})}for(let W of V)yield*w.promise(()=>q($,W,O)).pipe(w.orDie);let Q=G(Z).filter((W)=>W.endsWith(".qitqode")||W===X.QITQODE_CONFIG_DIR);for(let W of Q){if(!W.endsWith(".qitqode")&&W!==X.QITQODE_CONFIG_DIR)continue;for(let Y of I(W,"tui"))yield*w.promise(()=>q($,Y,O)).pipe(w.orDie)}let B={...$.result.keybinds??{}};if(process.platform==="win32")B.terminal_suspend="none",B.input_undo??=G(["ctrl+z",...J.Keybinds.shape.input_undo.parse(void 0).split(",")]).join(",");return $.result.keybinds=J.Keybinds.parse(B),{config:$.result,dirs:$.result.plugin?.length?Q:[]}}),V0=L.effect(z,w.gen(function*(){let O=yield*a,Z=yield*u.Service,V=yield*x.Service,$=yield*A0({directory:O}),Q=yield*w.forEach($.dirs,(Y)=>i.install({fs:V,npm:Z,dir:Y}).pipe(w.forkScoped),{concurrency:"unbounded"}),B=w.fn("TuiConfig.get")(()=>w.succeed($.config)),W=w.fn("TuiConfig.waitForDependencies")(()=>w.forEach(Q,f.join,{concurrency:"unbounded"}).pipe(w.ignore(),w.asVoid));return z.of({get:B,waitForDependencies:W})}).pipe(w.withSpan("TuiConfig.layer"))),W0=V0.pipe(L.provide(u.defaultLayer),L.provide(x.defaultLayer)),{runPromise:$0}=d(z,W0);async function M0(){await $0((O)=>O.waitForDependencies())}async function R0(){return $0((O)=>O.get())}async function z0(O){let Z=await O0(O);if(!Z)return{};return C0(Z,O).catch((V)=>{return h.warn("failed to load tui config",{path:O,error:V}),{}})}async function C0(O,Z){return c.substitute({text:O,type:"path",path:Z,missing:"empty"}).then((V)=>E.jsonc(V,Z)).then((V)=>{if(!s(V))return{};return E.schema(Z0,N0(V),Z)}).then((V)=>U0(V,Z)).catch((V)=>{return h.warn("invalid tui config",{path:Z,error:V}),{}})}
3
3
  export{Z0 as u,z as v,V0 as w,W0 as x,M0 as y,R0 as z,F as A};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{jg as E}from"./chunk-g738e799.js";import"./chunk-583d91xq.js";import"./chunk-e8s4mp5n.js";import"./chunk-9gxyt2ay.js";import"./chunk-5qhsfjzq.js";import"./chunk-nfg7nt13.js";import"./chunk-4s1n38ds.js";import"./chunk-2w79k0mh.js";import"./chunk-fd04358e.js";import"./chunk-qn1fhqyw.js";import"./chunk-674pexjx.js";import"./chunk-zjyaze0d.js";import"./chunk-xdcwx384.js";import"./chunk-rd08wx37.js";import"./chunk-fp2xgnjn.js";import"./chunk-y1v7mf1a.js";import"./chunk-358wdvj7.js";import"./chunk-dn0437c1.js";import"./chunk-47jkx37s.js";import"./chunk-31a47ptm.js";import"./chunk-jwv6fda1.js";import"./chunk-hx13a8es.js";import"./chunk-h036zy9e.js";import"./chunk-j3agzs13.js";import"./chunk-3152y1q9.js";import"./chunk-71jmhvef.js";import"./chunk-qrztx1b4.js";import"./chunk-j1bv93m4.js";import"./chunk-pp10epga.js";import"./chunk-crqycrs4.js";import"./chunk-1bq15kf0.js";import"./chunk-pdcxmr6x.js";import"./chunk-cqtkxwd8.js";import"./chunk-a1mbach4.js";import"./chunk-m6967jtv.js";import"./chunk-j2snkw45.js";import"./chunk-bmdqb48f.js";import"./chunk-3cs1qf8x.js";import"./chunk-4xqwt6dr.js";import"./chunk-g77kddrs.js";import"./chunk-9znfb8f2.js";import"./chunk-6kch0q2d.js";import"./chunk-6cztstry.js";import"./chunk-1mfdmm2t.js";import"./chunk-fkq0v5qv.js";import"./chunk-1e75j4m1.js";import"./chunk-2w3n0q9m.js";import"./chunk-6dd2dx69.js";import"./chunk-fdmz0502.js";import"./chunk-1a08ffyd.js";import"./chunk-8jkqyf9n.js";import"./chunk-6yshpz0z.js";import"./chunk-5dvy83ms.js";import"./chunk-ffx0cr44.js";import"./chunk-33mzqyyb.js";import"./chunk-sg9enzsp.js";import"./chunk-5q98z8ck.js";import"./chunk-wfpnv00c.js";import"./chunk-9kc2th5c.js";import"./chunk-hf39qx6t.js";import"./chunk-x0de4z05.js";import{yP as z}from"./chunk-sh03ka27.js";var J={command:"generate",handler:async()=>{let A=await E.openapi();for(let q of Object.values(A.paths))for(let y of["get","post","put","delete","patch"]){let k=q[y];if(!k?.operationId)continue;k["x-codeSamples"]=[{lang:"js",source:['import { createQitQodeClient } from "@qitqode/sdk"',"","const client = createQitQodeClient()",`await client.${k.operationId}({`," ...","})"].join(`
2
+ import{jg as E}from"./chunk-y4cz5s3h.js";import"./chunk-yhpwceqg.js";import"./chunk-878sb0es.js";import"./chunk-f0x3q5dj.js";import"./chunk-5qhsfjzq.js";import"./chunk-nfg7nt13.js";import"./chunk-4s1n38ds.js";import"./chunk-76wm7tw8.js";import"./chunk-6zdzbmzs.js";import"./chunk-qn1fhqyw.js";import"./chunk-674pexjx.js";import"./chunk-zjyaze0d.js";import"./chunk-xdcwx384.js";import"./chunk-rd08wx37.js";import"./chunk-fp2xgnjn.js";import"./chunk-5asf8f41.js";import"./chunk-2pw56zpj.js";import"./chunk-rt49c6js.js";import"./chunk-4gzggzc0.js";import"./chunk-31a47ptm.js";import"./chunk-ywj77e0m.js";import"./chunk-83n11xym.js";import"./chunk-h036zy9e.js";import"./chunk-j3agzs13.js";import"./chunk-3152y1q9.js";import"./chunk-71jmhvef.js";import"./chunk-qrztx1b4.js";import"./chunk-ae1b15bd.js";import"./chunk-6qwnty59.js";import"./chunk-crqycrs4.js";import"./chunk-1bq15kf0.js";import"./chunk-pdcxmr6x.js";import"./chunk-cqtkxwd8.js";import"./chunk-a1mbach4.js";import"./chunk-m6967jtv.js";import"./chunk-j2snkw45.js";import"./chunk-bmdqb48f.js";import"./chunk-3cs1qf8x.js";import"./chunk-4xqwt6dr.js";import"./chunk-g77kddrs.js";import"./chunk-kegvr7wt.js";import"./chunk-2tkgtasa.js";import"./chunk-6cztstry.js";import"./chunk-4yd2vvh6.js";import"./chunk-fkq0v5qv.js";import"./chunk-1e75j4m1.js";import"./chunk-2w3n0q9m.js";import"./chunk-6dd2dx69.js";import"./chunk-fdmz0502.js";import"./chunk-5re7995e.js";import"./chunk-mnjz8nqs.js";import"./chunk-6yshpz0z.js";import"./chunk-5dvy83ms.js";import"./chunk-ffx0cr44.js";import"./chunk-33mzqyyb.js";import"./chunk-sg9enzsp.js";import"./chunk-5q98z8ck.js";import"./chunk-wfpnv00c.js";import"./chunk-9kc2th5c.js";import"./chunk-hf39qx6t.js";import"./chunk-x0de4z05.js";import{yP as z}from"./chunk-sh03ka27.js";var J={command:"generate",handler:async()=>{let A=await E.openapi();for(let q of Object.values(A.paths))for(let y of["get","post","put","delete","patch"]){let k=q[y];if(!k?.operationId)continue;k["x-codeSamples"]=[{lang:"js",source:['import { createQitQodeClient } from "@qitqode/sdk"',"","const client = createQitQodeClient()",`await client.${k.operationId}({`," ...","})"].join(`
3
3
  `)}]}let F=JSON.stringify(A,null,2),B=await import("./chunk-dmb0ez0m.js"),C=await import("./chunk-6pt6nqwk.js"),D=await import("./chunk-gfvq78gy.js"),G=await(B.format??B.default?.format)(F,{parser:"json",plugins:[C.default??C,D.default??D],printWidth:120});await new Promise((q,y)=>{process.stdout.write(G,(k)=>{if(k)y(k);else q()})})}};export{J as GenerateCommand};