@qitqode/qitqode-android-arm64 0.1.31 → 0.1.32

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 (84) hide show
  1. package/bundle/{chunk-c14s0kxq.js → chunk-02jtpxe0.js} +1 -1
  2. package/bundle/{chunk-6t1ehq36.js → chunk-096pd6c4.js} +1 -1
  3. package/bundle/{chunk-jcjbr3q7.js → chunk-0c2p3a6v.js} +1 -1
  4. package/bundle/{chunk-53w4zqps.js → chunk-0c5rxty9.js} +1 -1
  5. package/bundle/{chunk-9mjz6e27.js → chunk-0e86gt9r.js} +1 -1
  6. package/bundle/{chunk-6bpe215q.js → chunk-15j5cn4t.js} +1 -1
  7. package/bundle/{chunk-0w0ctb90.js → chunk-1r95p0tp.js} +1 -1
  8. package/bundle/{chunk-mh0j6dzy.js → chunk-20702epe.js} +1 -1
  9. package/bundle/{chunk-04n2ycg5.js → chunk-257me4z3.js} +4 -4
  10. package/bundle/{chunk-83gqkmth.js → chunk-2phz0bn9.js} +1 -1
  11. package/bundle/{chunk-1fswr17z.js → chunk-2wajs9xv.js} +1 -1
  12. package/bundle/{chunk-3ytjm3az.js → chunk-3nx7112w.js} +1 -1
  13. package/bundle/{chunk-drvkj3xg.js → chunk-3wetyrjs.js} +1 -1
  14. package/bundle/{chunk-20f83ca0.js → chunk-4sc82a27.js} +1 -1
  15. package/bundle/{chunk-4gkk28xk.js → chunk-56z7x7h4.js} +1 -1
  16. package/bundle/{chunk-hnctaq8s.js → chunk-59yqvk48.js} +1 -1
  17. package/bundle/{chunk-0yt5njh7.js → chunk-5jx0yadh.js} +2 -2
  18. package/bundle/{chunk-6bphjajd.js → chunk-5pb551dx.js} +1 -1
  19. package/bundle/{chunk-anwnwfjf.js → chunk-634pnryq.js} +1 -1
  20. package/bundle/{chunk-cnmq5xtq.js → chunk-6aqyhfag.js} +2 -2
  21. package/bundle/{chunk-gcw4rn10.js → chunk-764fksh3.js} +1 -1
  22. package/bundle/{chunk-cmbh77cs.js → chunk-7tr9ejyk.js} +1 -1
  23. package/bundle/{chunk-ssajqv72.js → chunk-7z777y9k.js} +1 -1
  24. package/bundle/{chunk-qvnb3j71.js → chunk-85wcc1tp.js} +1 -1
  25. package/bundle/{chunk-csz0dgyp.js → chunk-89w3yhf8.js} +1 -1
  26. package/bundle/chunk-8dwq41q1.js +28 -0
  27. package/bundle/{chunk-11x3t2tt.js → chunk-8r6ht39z.js} +1 -1
  28. package/bundle/{chunk-d68fzyw7.js → chunk-9gazyynx.js} +1 -1
  29. package/bundle/{chunk-ehhas0ew.js → chunk-ad72gb5f.js} +1 -1
  30. package/bundle/{chunk-gbrnn2dk.js → chunk-avf8v3hb.js} +1 -1
  31. package/bundle/{chunk-fq0x3esz.js → chunk-caj1b9y7.js} +2 -2
  32. package/bundle/chunk-d0damw6y.js +2 -0
  33. package/bundle/{chunk-qbc36nbb.js → chunk-d3ermm6d.js} +1 -1
  34. package/bundle/{chunk-c1bdzxbx.js → chunk-d9hbhkbq.js} +1 -1
  35. package/bundle/{chunk-bgw4fvg2.js → chunk-e5mv5wnt.js} +1 -1
  36. package/bundle/{chunk-31mnd3ph.js → chunk-ew9pdrp9.js} +1 -1
  37. package/bundle/{chunk-redjxn13.js → chunk-ezfy0b6q.js} +1 -1
  38. package/bundle/{chunk-takew94z.js → chunk-gz8sz7z1.js} +1 -1
  39. package/bundle/{chunk-abd1cfpg.js → chunk-h6f3kbz2.js} +1 -1
  40. package/bundle/{chunk-r4ndwym0.js → chunk-hnvn2c25.js} +1 -1
  41. package/bundle/{chunk-pxvk3syj.js → chunk-jdynx7m6.js} +1 -1
  42. package/bundle/{chunk-ez8vkgfz.js → chunk-k1txw65h.js} +1 -1
  43. package/bundle/{chunk-mxzceza9.js → chunk-k5atbdbm.js} +1 -1
  44. package/bundle/{chunk-4d87mhwn.js → chunk-k75jqg60.js} +1 -1
  45. package/bundle/{chunk-pctt1qv8.js → chunk-k7aenxan.js} +1 -1
  46. package/bundle/{chunk-s9ntkjz3.js → chunk-m2q317gh.js} +1 -1
  47. package/bundle/{chunk-1f7ajq8s.js → chunk-mahgmbt9.js} +1 -1
  48. package/bundle/{chunk-68yw2hk9.js → chunk-mqd1jsg2.js} +1 -1
  49. package/bundle/{chunk-8ymffyep.js → chunk-nkkch4h7.js} +1 -1
  50. package/bundle/{chunk-z6pwkwdr.js → chunk-pje60pj2.js} +1 -1
  51. package/bundle/{chunk-c1vnp55z.js → chunk-pv67gwce.js} +1 -1
  52. package/bundle/{chunk-50sv6y2e.js → chunk-q7vasbxn.js} +1 -1
  53. package/bundle/chunk-qadw6j20.js +2 -0
  54. package/bundle/{chunk-n0dy98h2.js → chunk-qggcszs2.js} +1 -1
  55. package/bundle/{chunk-873skv7w.js → chunk-r7sqdfad.js} +1 -1
  56. package/bundle/{chunk-50tb3g5x.js → chunk-r8m7rtfc.js} +1 -1
  57. package/bundle/{chunk-7pfj4x1a.js → chunk-rkyf0cp8.js} +1 -1
  58. package/bundle/{chunk-f8eter69.js → chunk-rza530gm.js} +1 -1
  59. package/bundle/{chunk-mcg24gkb.js → chunk-s3mnrhbx.js} +1 -1
  60. package/bundle/{chunk-f2btnww9.js → chunk-s6ktx2sx.js} +1 -1
  61. package/bundle/{chunk-eh7e49k4.js → chunk-w7vh8cxt.js} +1 -1
  62. package/bundle/{chunk-pf9g671w.js → chunk-w8saweey.js} +1 -1
  63. package/bundle/{chunk-r78czx4d.js → chunk-we9cv8we.js} +1 -1
  64. package/bundle/{chunk-3h9rq2wq.js → chunk-wezarrvy.js} +1 -1
  65. package/bundle/{chunk-g9cjsfvg.js → chunk-whe7h2mj.js} +1 -1
  66. package/bundle/{chunk-phv9kdq6.js → chunk-wmqsdt2c.js} +1 -1
  67. package/bundle/{chunk-fjq3a347.js → chunk-wqj0xasg.js} +1 -1
  68. package/bundle/{chunk-vb286b31.js → chunk-wr42tphe.js} +1 -1
  69. package/bundle/{chunk-fyqjm5fv.js → chunk-x25zkrz7.js} +1 -1
  70. package/bundle/{chunk-m5m448mg.js → chunk-xj765svc.js} +1 -1
  71. package/bundle/{chunk-d65qs4d0.js → chunk-xrs18kzn.js} +1 -1
  72. package/bundle/{chunk-5v0xjs3x.js → chunk-y6123zvq.js} +1 -1
  73. package/bundle/{chunk-fxdtq2ed.js → chunk-y7sy3w6z.js} +1 -1
  74. package/bundle/{chunk-44a82dg0.js → chunk-ygs5pzk7.js} +2 -2
  75. package/bundle/{chunk-jxswwvr3.js → chunk-za7mwbye.js} +1 -1
  76. package/bundle/{chunk-vbeb74ny.js → chunk-zaks8cae.js} +1 -1
  77. package/bundle/{chunk-9x5232dw.js → chunk-zcsgqk9f.js} +1 -1
  78. package/bundle/{chunk-5eq1fft9.js → chunk-zqqx96jx.js} +1 -1
  79. package/bundle/index.js +3 -3
  80. package/bundle/worker.js +1 -1
  81. package/package.json +1 -1
  82. package/bundle/chunk-excnptfy.js +0 -2
  83. package/bundle/chunk-nsk8dkwp.js +0 -28
  84. package/bundle/chunk-ppjnqexm.js +0 -2
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- import{Cd as W$}from"./chunk-s9ntkjz3.js";import{Ed as j$}from"./chunk-fyqjm5fv.js";import{Rd as A$}from"./chunk-yajd975f.js";import{Of as J$}from"./chunk-c1vnp55z.js";import{ag as Z$}from"./chunk-pctt1qv8.js";import"./chunk-11x3t2tt.js";import"./chunk-68yw2hk9.js";import"./chunk-takew94z.js";import"./chunk-cjww2jmv.js";import"./chunk-nfg7nt13.js";import"./chunk-xvwvd4kq.js";import"./chunk-qbc36nbb.js";import{gh as MD}from"./chunk-fq0x3esz.js";import{Uh as hD}from"./chunk-44a82dg0.js";import"./chunk-vxyy2dp3.js";import"./chunk-yp5bypsp.js";import"./chunk-7hm0c2yg.js";import"./chunk-gj0wt0cy.js";import"./chunk-5hw6xa49.js";import"./chunk-326p5b10.js";import{ql as _$,rl as U,sk as sD,tl as G$,yk as k,zk as P}from"./chunk-04n2ycg5.js";import"./chunk-8ymffyep.js";import"./chunk-mcg24gkb.js";import"./chunk-redjxn13.js";import"./chunk-bn0h9dny.js";import"./chunk-r4ndwym0.js";import"./chunk-3ytjm3az.js";import"./chunk-htz93dsd.js";import"./chunk-vcw00k0n.js";import{no as X$,qo as Y$}from"./chunk-r78czx4d.js";import"./chunk-2hc5z7b5.js";import"./chunk-d68fzyw7.js";import"./chunk-4jtxtkj7.js";import"./chunk-ay8emwym.js";import"./chunk-2maqde7w.js";import{_p as f$}from"./chunk-kj20f048.js";import"./chunk-cqtkxwd8.js";import"./chunk-x9rbv6p6.js";import"./chunk-g5rabwre.js";import"./chunk-jbx3s7nw.js";import"./chunk-15hw2z9t.js";import"./chunk-48ge2ryx.js";import"./chunk-n9xns8by.js";import"./chunk-y9q0hb7b.js";import"./chunk-c1bdzxbx.js";import"./chunk-ehhas0ew.js";import"./chunk-d6ry9418.js";import"./chunk-0dt0bxz6.js";import"./chunk-10bjs581.js";import"./chunk-4cnwn1rh.js";import"./chunk-gcw4rn10.js";import{Ms as w$,Vr as Q$,_s as H}from"./chunk-m5m448mg.js";import{st as kD}from"./chunk-tqj69nh6.js";import"./chunk-ag8kz1e7.js";import"./chunk-5tray1fw.js";import{St as D}from"./chunk-c11d28qn.js";import"./chunk-mzs2pjyc.js";import"./chunk-gagtmjmp.js";import"./chunk-zs8kqdsf.js";import"./chunk-dxpj0cxh.js";import"./chunk-zw815d68.js";import{DO as ow}from"./chunk-7xm75w1e.js";var O={authenticate:"authenticate",initialize:"initialize",session_cancel:"session/cancel",session_close:"session/close",session_fork:"session/fork",session_list:"session/list",session_load:"session/load",session_new:"session/new",session_prompt:"session/prompt",session_resume:"session/resume",session_set_config_option:"session/set_config_option",session_set_mode:"session/set_mode",session_set_model:"session/set_model"},F={fs_read_text_file:"fs/read_text_file",fs_write_text_file:"fs/write_text_file",session_request_permission:"session/request_permission",session_update:"session/update",terminal_create:"terminal/create",terminal_kill:"terminal/kill",terminal_output:"terminal/output",terminal_release:"terminal/release",terminal_wait_for_exit:"terminal/wait_for_exit"};var K$=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),terminal:D.boolean().optional().default(!1)}),B$=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),label:D.string().nullish(),name:D.string(),optional:D.boolean().optional().default(!1),secret:D.boolean().optional().default(!0)}),O$=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),description:D.string().nullish(),id:D.string(),name:D.string()}),N$=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),description:D.string().nullish(),id:D.string(),link:D.string().nullish(),name:D.string(),vars:D.array(B$)}),F$=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),args:D.array(D.string()).optional(),description:D.string().nullish(),env:D.record(D.string(),D.string()).optional(),id:D.string(),name:D.string()}),L$=D.union([N$.and(D.object({type:D.literal("env_var")})),F$.and(D.object({type:D.literal("terminal")})),O$]),n=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),methodId:D.string()}),x$=D.object({_meta:D.record(D.string(),D.unknown()).nullish()}),V$=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),blob:D.string(),mimeType:D.string().nullish(),uri:D.string()}),H$=D.object({_meta:D.record(D.string(),D.unknown()).nullish()}),P$=D.object({amount:D.number(),currency:D.string()}),k$=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),terminalId:D.string()}),T$=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),newText:D.string(),oldText:D.string().nullish(),path:D.string()}),vD=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),name:D.string(),value:D.string()}),U$=D.union([D.literal(-32700),D.literal(-32600),D.literal(-32601),D.literal(-32602),D.literal(-32603),D.literal(-32800),D.literal(-32000),D.literal(-32002),D.number().int().min(-2147483648,{message:"Invalid value: Expected int32 to be >= -2147483648"}).max(2147483647,{message:"Invalid value: Expected int32 to be <= 2147483647"})]),ID=D.object({code:U$,data:D.unknown().optional(),message:D.string()}),qD=D.unknown(),SD=D.unknown(),RD=D.unknown(),b$=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),readTextFile:D.boolean().optional().default(!1),writeTextFile:D.boolean().optional().default(!1)}),h$=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),auth:K$.optional().default({terminal:!1}),fs:b$.optional().default({readTextFile:!1,writeTextFile:!1}),terminal:D.boolean().optional().default(!1)}),cD=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),name:D.string(),value:D.string()}),uD=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),name:D.string(),title:D.string().nullish(),version:D.string()}),M$=D.object({_meta:D.record(D.string(),D.unknown()).nullish()}),t=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),cursor:D.string().nullish(),cwd:D.string().nullish()}),C$=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),http:D.boolean().optional().default(!1),sse:D.boolean().optional().default(!1)}),E$=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),headers:D.array(cD),name:D.string(),url:D.string()}),v$=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),headers:D.array(cD),name:D.string(),url:D.string()}),I$=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),args:D.array(D.string()),command:D.string(),env:D.array(vD),name:D.string()}),I=D.union([E$.and(D.object({type:D.literal("http")})),v$.and(D.object({type:D.literal("sse")})),I$]),o=D.string(),q$=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),description:D.string().nullish(),modelId:o,name:D.string()}),r=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),cwd:D.string(),mcpServers:D.array(I)}),gD=D.string(),S$=D.union([D.literal("allow_once"),D.literal("allow_always"),D.literal("reject_once"),D.literal("reject_always")]),R$=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),kind:S$,name:D.string(),optionId:gD}),c$=D.union([D.literal("high"),D.literal("medium"),D.literal("low")]),u$=D.union([D.literal("pending"),D.literal("in_progress"),D.literal("completed")]),g$=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),content:D.string(),priority:c$,status:u$}),l$=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),entries:D.array(g$)}),d$=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),audio:D.boolean().optional().default(!1),embeddedContext:D.boolean().optional().default(!1),image:D.boolean().optional().default(!1)}),lD=D.number().int().gte(0).lte(65535),z=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),clientCapabilities:h$.optional().default({auth:{terminal:!1},fs:{readTextFile:!1,writeTextFile:!1},terminal:!1}),clientInfo:uD.nullish(),protocolVersion:lD}),i$=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),content:D.string()}),m$=D.object({_meta:D.record(D.string(),D.unknown()).nullish()}),T=D.union([D.number(),D.string()]).nullable(),sw=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),requestId:T}),p$=D.enum(["assistant","user"]),E=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),audience:D.array(p$).nullish(),lastModified:D.string().nullish(),priority:D.number().nullish()}),n$=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),annotations:E.nullish(),data:D.string(),mimeType:D.string()}),t$=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),annotations:E.nullish(),data:D.string(),mimeType:D.string(),uri:D.string().nullish()}),o$=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),annotations:E.nullish(),description:D.string().nullish(),mimeType:D.string().nullish(),name:D.string(),size:D.number().nullish(),title:D.string().nullish(),uri:D.string()}),r$=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),optionId:gD}),z$=D.union([D.object({outcome:D.literal("cancelled")}),r$.and(D.object({outcome:D.literal("selected")}))]),a$=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),outcome:z$}),s$=D.object({_meta:D.record(D.string(),D.unknown()).nullish()}),e$=D.object({currentValue:D.boolean()}),Dw=D.string(),dD=D.string(),$w=D.union([D.literal("mode"),D.literal("model"),D.literal("thought_level"),D.string()]),a=D.string(),iD=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),description:D.string().nullish(),name:D.string(),value:a}),ww=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),group:Dw,name:D.string(),options:D.array(iD)}),Qw=D.union([D.array(iD),D.array(ww)]),fw=D.object({currentValue:a,options:Qw}),M=D.intersection(D.union([fw.and(D.object({type:D.literal("select")})),e$.and(D.object({type:D.literal("boolean")}))]),D.object({_meta:D.record(D.string(),D.unknown()).nullish(),category:$w.nullish(),description:D.string().nullish(),id:dD,name:D.string()})),_w=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),configOptions:D.array(M)}),Gw=D.object({_meta:D.record(D.string(),D.unknown()).nullish()}),N=D.string(),s=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),sessionId:N}),ew=D.object({method:D.string(),params:D.union([s,qD]).nullish()}),e=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),sessionId:N}),DD=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),args:D.array(D.string()).optional(),command:D.string(),cwd:D.string().nullish(),env:D.array(vD).optional(),outputByteLimit:D.number().nullish(),sessionId:N}),$D=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),cwd:D.string(),mcpServers:D.array(I).optional(),sessionId:N}),wD=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),sessionId:N,terminalId:D.string()}),QD=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),cwd:D.string(),mcpServers:D.array(I),sessionId:N}),fD=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),limit:D.number().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),line:D.number().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),path:D.string(),sessionId:N}),_D=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),sessionId:N,terminalId:D.string()}),GD=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),cwd:D.string(),mcpServers:D.array(I).optional(),sessionId:N}),Jw=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),cwd:D.string(),sessionId:N,title:D.string().nullish(),updatedAt:D.string().nullish()}),Xw=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),nextCursor:D.string().nullish(),sessions:D.array(Jw)}),Yw=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),title:D.string().nullish(),updatedAt:D.string().nullish()}),Zw=D.object({_meta:D.record(D.string(),D.unknown()).nullish()}),q=D.string(),jw=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),currentModeId:q}),Aw=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),description:D.string().nullish(),id:q,name:D.string()}),S=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),availableModes:D.array(Aw),currentModeId:q}),R=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),availableModels:D.array(q$),currentModelId:o}),Ww=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),configOptions:D.array(M).nullish(),models:R.nullish(),modes:S.nullish(),sessionId:N}),yw=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),configOptions:D.array(M).nullish(),models:R.nullish(),modes:S.nullish()}),Kw=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),configOptions:D.array(M).nullish(),models:R.nullish(),modes:S.nullish(),sessionId:N}),Bw=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),configOptions:D.array(M).nullish(),models:R.nullish(),modes:S.nullish()}),Ow=D.object({_meta:D.record(D.string(),D.unknown()).nullish()}),Nw=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),close:s$.nullish(),fork:Gw.nullish(),list:Zw.nullish(),resume:Ow.nullish()}),Fw=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),loadSession:D.boolean().optional().default(!1),mcpCapabilities:C$.optional().default({http:!1,sse:!1}),promptCapabilities:d$.optional().default({audio:!1,embeddedContext:!1,image:!1}),sessionCapabilities:Nw.optional().default({})}),Lw=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),agentCapabilities:Fw.optional().default({loadSession:!1,mcpCapabilities:{http:!1,sse:!1},promptCapabilities:{audio:!1,embeddedContext:!1,image:!1},sessionCapabilities:{}}),agentInfo:uD.nullish(),authMethods:D.array(L$).optional().default([]),protocolVersion:lD}),JD=D.intersection(D.union([D.object({type:D.literal("boolean"),value:D.boolean()}),D.object({value:a})]),D.object({_meta:D.record(D.string(),D.unknown()).nullish(),configId:dD,sessionId:N})),xw=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),configOptions:D.array(M)}),XD=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),modeId:q,sessionId:N}),Vw=D.object({_meta:D.record(D.string(),D.unknown()).nullish()}),YD=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),modelId:o,sessionId:N}),Hw=D.object({_meta:D.record(D.string(),D.unknown()).nullish()}),Pw=D.union([D.literal("end_turn"),D.literal("max_tokens"),D.literal("max_turn_requests"),D.literal("refusal"),D.literal("cancelled")]),kw=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),terminalId:D.string()}),Tw=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),exitCode:D.number().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),signal:D.string().nullish()}),ZD=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),sessionId:N,terminalId:D.string()}),Uw=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),exitStatus:Tw.nullish(),output:D.string(),truncated:D.boolean()}),bw=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),annotations:E.nullish(),text:D.string()}),hw=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),mimeType:D.string().nullish(),text:D.string(),uri:D.string()}),Mw=D.union([hw,V$]),Cw=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),annotations:E.nullish(),resource:Mw}),jD=D.union([bw.and(D.object({type:D.literal("text")})),t$.and(D.object({type:D.literal("image")})),n$.and(D.object({type:D.literal("audio")})),o$.and(D.object({type:D.literal("resource_link")})),Cw.and(D.object({type:D.literal("resource")}))]),Ew=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),content:jD}),p=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),content:jD,messageId:D.string().nullish()}),AD=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),messageId:D.string().nullish(),prompt:D.array(jD),sessionId:N}),DQ=D.object({id:T,method:D.string(),params:D.union([z,n,r,QD,t,$D,GD,e,XD,JD,AD,YD,SD]).nullish()}),mD=D.union([Ew.and(D.object({type:D.literal("content")})),T$.and(D.object({type:D.literal("diff")})),kw.and(D.object({type:D.literal("terminal")}))]),pD=D.string(),nD=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),line:D.number().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),path:D.string()}),tD=D.union([D.literal("pending"),D.literal("in_progress"),D.literal("completed"),D.literal("failed")]),oD=D.union([D.literal("read"),D.literal("edit"),D.literal("delete"),D.literal("move"),D.literal("search"),D.literal("execute"),D.literal("think"),D.literal("fetch"),D.literal("switch_mode"),D.literal("other")]),vw=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),content:D.array(mD).optional(),kind:oD.optional(),locations:D.array(nD).optional(),rawInput:D.unknown().optional(),rawOutput:D.unknown().optional(),status:tD.optional(),title:D.string(),toolCallId:pD}),rD=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),content:D.array(mD).nullish(),kind:oD.nullish(),locations:D.array(nD).nullish(),rawInput:D.unknown().optional(),rawOutput:D.unknown().optional(),status:tD.nullish(),title:D.string().nullish(),toolCallId:pD}),WD=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),options:D.array(R$),sessionId:N,toolCall:rD}),Iw=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),hint:D.string()}),qw=Iw,Sw=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),description:D.string(),input:qw.nullish(),name:D.string()}),Rw=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),availableCommands:D.array(Sw)}),cw=D.object({cachedReadTokens:D.number().nullish(),cachedWriteTokens:D.number().nullish(),inputTokens:D.number(),outputTokens:D.number(),thoughtTokens:D.number().nullish(),totalTokens:D.number()}),uw=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),stopReason:Pw,usage:cw.nullish(),userMessageId:D.string().nullish()}),$Q=D.union([D.object({id:T,result:D.union([Lw,x$,Kw,yw,Xw,Ww,Bw,H$,Vw,xw,uw,Hw,RD])}),D.object({error:ID,id:T})]),gw=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),cost:P$.nullish(),size:D.number(),used:D.number()}),lw=D.union([p.and(D.object({sessionUpdate:D.literal("user_message_chunk")})),p.and(D.object({sessionUpdate:D.literal("agent_message_chunk")})),p.and(D.object({sessionUpdate:D.literal("agent_thought_chunk")})),vw.and(D.object({sessionUpdate:D.literal("tool_call")})),rD.and(D.object({sessionUpdate:D.literal("tool_call_update")})),l$.and(D.object({sessionUpdate:D.literal("plan")})),Rw.and(D.object({sessionUpdate:D.literal("available_commands_update")})),jw.and(D.object({sessionUpdate:D.literal("current_mode_update")})),_w.and(D.object({sessionUpdate:D.literal("config_option_update")})),Yw.and(D.object({sessionUpdate:D.literal("session_info_update")})),gw.and(D.object({sessionUpdate:D.literal("usage_update")}))]),yD=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),sessionId:N,update:lw}),wQ=D.object({method:D.string(),params:D.union([yD,qD]).nullish()}),KD=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),sessionId:N,terminalId:D.string()}),dw=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),exitCode:D.number().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),signal:D.string().nullish()}),BD=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),content:D.string(),path:D.string(),sessionId:N}),QQ=D.object({id:T,method:D.string(),params:D.union([BD,fD,WD,DD,ZD,_D,KD,wD,SD]).nullish()}),iw=D.object({_meta:D.record(D.string(),D.unknown()).nullish()}),fQ=D.union([D.object({id:T,result:D.union([iw,i$,a$,k$,Uw,m$,dw,M$,RD])}),D.object({error:ID,id:T})]);function zD($,Q){let w=new TextEncoder,f=new TextDecoder,X=new ReadableStream({async start(_){let J="",j=Q.getReader();try{while(!0){let{value:B,done:Y}=await j.read();if(Y)break;if(!B)continue;J+=f.decode(B,{stream:!0});let Z=J.split(`
2
+ import{Cd as W$}from"./chunk-m2q317gh.js";import{Ed as j$}from"./chunk-x25zkrz7.js";import{Rd as A$}from"./chunk-yajd975f.js";import{Of as J$}from"./chunk-pv67gwce.js";import{ag as Z$}from"./chunk-k7aenxan.js";import"./chunk-8r6ht39z.js";import"./chunk-mqd1jsg2.js";import"./chunk-gz8sz7z1.js";import"./chunk-cjww2jmv.js";import"./chunk-nfg7nt13.js";import"./chunk-xvwvd4kq.js";import"./chunk-d3ermm6d.js";import{gh as MD}from"./chunk-caj1b9y7.js";import{Uh as hD}from"./chunk-ygs5pzk7.js";import"./chunk-vxyy2dp3.js";import"./chunk-yp5bypsp.js";import"./chunk-7hm0c2yg.js";import"./chunk-gj0wt0cy.js";import"./chunk-5hw6xa49.js";import"./chunk-326p5b10.js";import{ql as _$,rl as U,sk as sD,tl as G$,yk as k,zk as P}from"./chunk-257me4z3.js";import"./chunk-nkkch4h7.js";import"./chunk-s3mnrhbx.js";import"./chunk-ezfy0b6q.js";import"./chunk-bn0h9dny.js";import"./chunk-hnvn2c25.js";import"./chunk-3nx7112w.js";import"./chunk-htz93dsd.js";import"./chunk-vcw00k0n.js";import{no as X$,qo as Y$}from"./chunk-we9cv8we.js";import"./chunk-2hc5z7b5.js";import"./chunk-9gazyynx.js";import"./chunk-4jtxtkj7.js";import"./chunk-ay8emwym.js";import"./chunk-2maqde7w.js";import{_p as f$}from"./chunk-kj20f048.js";import"./chunk-cqtkxwd8.js";import"./chunk-x9rbv6p6.js";import"./chunk-g5rabwre.js";import"./chunk-jbx3s7nw.js";import"./chunk-15hw2z9t.js";import"./chunk-48ge2ryx.js";import"./chunk-n9xns8by.js";import"./chunk-y9q0hb7b.js";import"./chunk-d9hbhkbq.js";import"./chunk-ad72gb5f.js";import"./chunk-d6ry9418.js";import"./chunk-0dt0bxz6.js";import"./chunk-10bjs581.js";import"./chunk-4cnwn1rh.js";import"./chunk-764fksh3.js";import{Ms as w$,Vr as Q$,_s as H}from"./chunk-xj765svc.js";import{st as kD}from"./chunk-tqj69nh6.js";import"./chunk-ag8kz1e7.js";import"./chunk-5tray1fw.js";import{St as D}from"./chunk-c11d28qn.js";import"./chunk-mzs2pjyc.js";import"./chunk-gagtmjmp.js";import"./chunk-zs8kqdsf.js";import"./chunk-dxpj0cxh.js";import"./chunk-zw815d68.js";import{DO as ow}from"./chunk-7xm75w1e.js";var O={authenticate:"authenticate",initialize:"initialize",session_cancel:"session/cancel",session_close:"session/close",session_fork:"session/fork",session_list:"session/list",session_load:"session/load",session_new:"session/new",session_prompt:"session/prompt",session_resume:"session/resume",session_set_config_option:"session/set_config_option",session_set_mode:"session/set_mode",session_set_model:"session/set_model"},F={fs_read_text_file:"fs/read_text_file",fs_write_text_file:"fs/write_text_file",session_request_permission:"session/request_permission",session_update:"session/update",terminal_create:"terminal/create",terminal_kill:"terminal/kill",terminal_output:"terminal/output",terminal_release:"terminal/release",terminal_wait_for_exit:"terminal/wait_for_exit"};var K$=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),terminal:D.boolean().optional().default(!1)}),B$=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),label:D.string().nullish(),name:D.string(),optional:D.boolean().optional().default(!1),secret:D.boolean().optional().default(!0)}),O$=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),description:D.string().nullish(),id:D.string(),name:D.string()}),N$=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),description:D.string().nullish(),id:D.string(),link:D.string().nullish(),name:D.string(),vars:D.array(B$)}),F$=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),args:D.array(D.string()).optional(),description:D.string().nullish(),env:D.record(D.string(),D.string()).optional(),id:D.string(),name:D.string()}),L$=D.union([N$.and(D.object({type:D.literal("env_var")})),F$.and(D.object({type:D.literal("terminal")})),O$]),n=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),methodId:D.string()}),x$=D.object({_meta:D.record(D.string(),D.unknown()).nullish()}),V$=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),blob:D.string(),mimeType:D.string().nullish(),uri:D.string()}),H$=D.object({_meta:D.record(D.string(),D.unknown()).nullish()}),P$=D.object({amount:D.number(),currency:D.string()}),k$=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),terminalId:D.string()}),T$=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),newText:D.string(),oldText:D.string().nullish(),path:D.string()}),vD=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),name:D.string(),value:D.string()}),U$=D.union([D.literal(-32700),D.literal(-32600),D.literal(-32601),D.literal(-32602),D.literal(-32603),D.literal(-32800),D.literal(-32000),D.literal(-32002),D.number().int().min(-2147483648,{message:"Invalid value: Expected int32 to be >= -2147483648"}).max(2147483647,{message:"Invalid value: Expected int32 to be <= 2147483647"})]),ID=D.object({code:U$,data:D.unknown().optional(),message:D.string()}),qD=D.unknown(),SD=D.unknown(),RD=D.unknown(),b$=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),readTextFile:D.boolean().optional().default(!1),writeTextFile:D.boolean().optional().default(!1)}),h$=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),auth:K$.optional().default({terminal:!1}),fs:b$.optional().default({readTextFile:!1,writeTextFile:!1}),terminal:D.boolean().optional().default(!1)}),cD=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),name:D.string(),value:D.string()}),uD=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),name:D.string(),title:D.string().nullish(),version:D.string()}),M$=D.object({_meta:D.record(D.string(),D.unknown()).nullish()}),t=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),cursor:D.string().nullish(),cwd:D.string().nullish()}),C$=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),http:D.boolean().optional().default(!1),sse:D.boolean().optional().default(!1)}),E$=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),headers:D.array(cD),name:D.string(),url:D.string()}),v$=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),headers:D.array(cD),name:D.string(),url:D.string()}),I$=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),args:D.array(D.string()),command:D.string(),env:D.array(vD),name:D.string()}),I=D.union([E$.and(D.object({type:D.literal("http")})),v$.and(D.object({type:D.literal("sse")})),I$]),o=D.string(),q$=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),description:D.string().nullish(),modelId:o,name:D.string()}),r=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),cwd:D.string(),mcpServers:D.array(I)}),gD=D.string(),S$=D.union([D.literal("allow_once"),D.literal("allow_always"),D.literal("reject_once"),D.literal("reject_always")]),R$=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),kind:S$,name:D.string(),optionId:gD}),c$=D.union([D.literal("high"),D.literal("medium"),D.literal("low")]),u$=D.union([D.literal("pending"),D.literal("in_progress"),D.literal("completed")]),g$=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),content:D.string(),priority:c$,status:u$}),l$=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),entries:D.array(g$)}),d$=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),audio:D.boolean().optional().default(!1),embeddedContext:D.boolean().optional().default(!1),image:D.boolean().optional().default(!1)}),lD=D.number().int().gte(0).lte(65535),z=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),clientCapabilities:h$.optional().default({auth:{terminal:!1},fs:{readTextFile:!1,writeTextFile:!1},terminal:!1}),clientInfo:uD.nullish(),protocolVersion:lD}),i$=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),content:D.string()}),m$=D.object({_meta:D.record(D.string(),D.unknown()).nullish()}),T=D.union([D.number(),D.string()]).nullable(),sw=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),requestId:T}),p$=D.enum(["assistant","user"]),E=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),audience:D.array(p$).nullish(),lastModified:D.string().nullish(),priority:D.number().nullish()}),n$=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),annotations:E.nullish(),data:D.string(),mimeType:D.string()}),t$=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),annotations:E.nullish(),data:D.string(),mimeType:D.string(),uri:D.string().nullish()}),o$=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),annotations:E.nullish(),description:D.string().nullish(),mimeType:D.string().nullish(),name:D.string(),size:D.number().nullish(),title:D.string().nullish(),uri:D.string()}),r$=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),optionId:gD}),z$=D.union([D.object({outcome:D.literal("cancelled")}),r$.and(D.object({outcome:D.literal("selected")}))]),a$=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),outcome:z$}),s$=D.object({_meta:D.record(D.string(),D.unknown()).nullish()}),e$=D.object({currentValue:D.boolean()}),Dw=D.string(),dD=D.string(),$w=D.union([D.literal("mode"),D.literal("model"),D.literal("thought_level"),D.string()]),a=D.string(),iD=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),description:D.string().nullish(),name:D.string(),value:a}),ww=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),group:Dw,name:D.string(),options:D.array(iD)}),Qw=D.union([D.array(iD),D.array(ww)]),fw=D.object({currentValue:a,options:Qw}),M=D.intersection(D.union([fw.and(D.object({type:D.literal("select")})),e$.and(D.object({type:D.literal("boolean")}))]),D.object({_meta:D.record(D.string(),D.unknown()).nullish(),category:$w.nullish(),description:D.string().nullish(),id:dD,name:D.string()})),_w=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),configOptions:D.array(M)}),Gw=D.object({_meta:D.record(D.string(),D.unknown()).nullish()}),N=D.string(),s=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),sessionId:N}),ew=D.object({method:D.string(),params:D.union([s,qD]).nullish()}),e=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),sessionId:N}),DD=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),args:D.array(D.string()).optional(),command:D.string(),cwd:D.string().nullish(),env:D.array(vD).optional(),outputByteLimit:D.number().nullish(),sessionId:N}),$D=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),cwd:D.string(),mcpServers:D.array(I).optional(),sessionId:N}),wD=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),sessionId:N,terminalId:D.string()}),QD=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),cwd:D.string(),mcpServers:D.array(I),sessionId:N}),fD=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),limit:D.number().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),line:D.number().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),path:D.string(),sessionId:N}),_D=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),sessionId:N,terminalId:D.string()}),GD=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),cwd:D.string(),mcpServers:D.array(I).optional(),sessionId:N}),Jw=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),cwd:D.string(),sessionId:N,title:D.string().nullish(),updatedAt:D.string().nullish()}),Xw=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),nextCursor:D.string().nullish(),sessions:D.array(Jw)}),Yw=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),title:D.string().nullish(),updatedAt:D.string().nullish()}),Zw=D.object({_meta:D.record(D.string(),D.unknown()).nullish()}),q=D.string(),jw=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),currentModeId:q}),Aw=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),description:D.string().nullish(),id:q,name:D.string()}),S=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),availableModes:D.array(Aw),currentModeId:q}),R=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),availableModels:D.array(q$),currentModelId:o}),Ww=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),configOptions:D.array(M).nullish(),models:R.nullish(),modes:S.nullish(),sessionId:N}),yw=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),configOptions:D.array(M).nullish(),models:R.nullish(),modes:S.nullish()}),Kw=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),configOptions:D.array(M).nullish(),models:R.nullish(),modes:S.nullish(),sessionId:N}),Bw=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),configOptions:D.array(M).nullish(),models:R.nullish(),modes:S.nullish()}),Ow=D.object({_meta:D.record(D.string(),D.unknown()).nullish()}),Nw=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),close:s$.nullish(),fork:Gw.nullish(),list:Zw.nullish(),resume:Ow.nullish()}),Fw=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),loadSession:D.boolean().optional().default(!1),mcpCapabilities:C$.optional().default({http:!1,sse:!1}),promptCapabilities:d$.optional().default({audio:!1,embeddedContext:!1,image:!1}),sessionCapabilities:Nw.optional().default({})}),Lw=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),agentCapabilities:Fw.optional().default({loadSession:!1,mcpCapabilities:{http:!1,sse:!1},promptCapabilities:{audio:!1,embeddedContext:!1,image:!1},sessionCapabilities:{}}),agentInfo:uD.nullish(),authMethods:D.array(L$).optional().default([]),protocolVersion:lD}),JD=D.intersection(D.union([D.object({type:D.literal("boolean"),value:D.boolean()}),D.object({value:a})]),D.object({_meta:D.record(D.string(),D.unknown()).nullish(),configId:dD,sessionId:N})),xw=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),configOptions:D.array(M)}),XD=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),modeId:q,sessionId:N}),Vw=D.object({_meta:D.record(D.string(),D.unknown()).nullish()}),YD=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),modelId:o,sessionId:N}),Hw=D.object({_meta:D.record(D.string(),D.unknown()).nullish()}),Pw=D.union([D.literal("end_turn"),D.literal("max_tokens"),D.literal("max_turn_requests"),D.literal("refusal"),D.literal("cancelled")]),kw=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),terminalId:D.string()}),Tw=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),exitCode:D.number().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),signal:D.string().nullish()}),ZD=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),sessionId:N,terminalId:D.string()}),Uw=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),exitStatus:Tw.nullish(),output:D.string(),truncated:D.boolean()}),bw=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),annotations:E.nullish(),text:D.string()}),hw=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),mimeType:D.string().nullish(),text:D.string(),uri:D.string()}),Mw=D.union([hw,V$]),Cw=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),annotations:E.nullish(),resource:Mw}),jD=D.union([bw.and(D.object({type:D.literal("text")})),t$.and(D.object({type:D.literal("image")})),n$.and(D.object({type:D.literal("audio")})),o$.and(D.object({type:D.literal("resource_link")})),Cw.and(D.object({type:D.literal("resource")}))]),Ew=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),content:jD}),p=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),content:jD,messageId:D.string().nullish()}),AD=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),messageId:D.string().nullish(),prompt:D.array(jD),sessionId:N}),DQ=D.object({id:T,method:D.string(),params:D.union([z,n,r,QD,t,$D,GD,e,XD,JD,AD,YD,SD]).nullish()}),mD=D.union([Ew.and(D.object({type:D.literal("content")})),T$.and(D.object({type:D.literal("diff")})),kw.and(D.object({type:D.literal("terminal")}))]),pD=D.string(),nD=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),line:D.number().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),path:D.string()}),tD=D.union([D.literal("pending"),D.literal("in_progress"),D.literal("completed"),D.literal("failed")]),oD=D.union([D.literal("read"),D.literal("edit"),D.literal("delete"),D.literal("move"),D.literal("search"),D.literal("execute"),D.literal("think"),D.literal("fetch"),D.literal("switch_mode"),D.literal("other")]),vw=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),content:D.array(mD).optional(),kind:oD.optional(),locations:D.array(nD).optional(),rawInput:D.unknown().optional(),rawOutput:D.unknown().optional(),status:tD.optional(),title:D.string(),toolCallId:pD}),rD=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),content:D.array(mD).nullish(),kind:oD.nullish(),locations:D.array(nD).nullish(),rawInput:D.unknown().optional(),rawOutput:D.unknown().optional(),status:tD.nullish(),title:D.string().nullish(),toolCallId:pD}),WD=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),options:D.array(R$),sessionId:N,toolCall:rD}),Iw=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),hint:D.string()}),qw=Iw,Sw=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),description:D.string(),input:qw.nullish(),name:D.string()}),Rw=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),availableCommands:D.array(Sw)}),cw=D.object({cachedReadTokens:D.number().nullish(),cachedWriteTokens:D.number().nullish(),inputTokens:D.number(),outputTokens:D.number(),thoughtTokens:D.number().nullish(),totalTokens:D.number()}),uw=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),stopReason:Pw,usage:cw.nullish(),userMessageId:D.string().nullish()}),$Q=D.union([D.object({id:T,result:D.union([Lw,x$,Kw,yw,Xw,Ww,Bw,H$,Vw,xw,uw,Hw,RD])}),D.object({error:ID,id:T})]),gw=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),cost:P$.nullish(),size:D.number(),used:D.number()}),lw=D.union([p.and(D.object({sessionUpdate:D.literal("user_message_chunk")})),p.and(D.object({sessionUpdate:D.literal("agent_message_chunk")})),p.and(D.object({sessionUpdate:D.literal("agent_thought_chunk")})),vw.and(D.object({sessionUpdate:D.literal("tool_call")})),rD.and(D.object({sessionUpdate:D.literal("tool_call_update")})),l$.and(D.object({sessionUpdate:D.literal("plan")})),Rw.and(D.object({sessionUpdate:D.literal("available_commands_update")})),jw.and(D.object({sessionUpdate:D.literal("current_mode_update")})),_w.and(D.object({sessionUpdate:D.literal("config_option_update")})),Yw.and(D.object({sessionUpdate:D.literal("session_info_update")})),gw.and(D.object({sessionUpdate:D.literal("usage_update")}))]),yD=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),sessionId:N,update:lw}),wQ=D.object({method:D.string(),params:D.union([yD,qD]).nullish()}),KD=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),sessionId:N,terminalId:D.string()}),dw=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),exitCode:D.number().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),signal:D.string().nullish()}),BD=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),content:D.string(),path:D.string(),sessionId:N}),QQ=D.object({id:T,method:D.string(),params:D.union([BD,fD,WD,DD,ZD,_D,KD,wD,SD]).nullish()}),iw=D.object({_meta:D.record(D.string(),D.unknown()).nullish()}),fQ=D.union([D.object({id:T,result:D.union([iw,i$,a$,k$,Uw,m$,dw,M$,RD])}),D.object({error:ID,id:T})]);function zD($,Q){let w=new TextEncoder,f=new TextDecoder,X=new ReadableStream({async start(_){let J="",j=Q.getReader();try{while(!0){let{value:B,done:Y}=await j.read();if(Y)break;if(!B)continue;J+=f.decode(B,{stream:!0});let Z=J.split(`
3
3
  `);J=Z.pop()||"";for(let A of Z){let y=A.trim();if(y)try{let W=JSON.parse(y);_.enqueue(W)}catch(W){console.error("Failed to parse JSON message:",y,W)}}}}finally{j.releaseLock(),_.close()}}}),G=new WritableStream({async write(_){let J=JSON.stringify(_)+`
4
4
  `,j=$.getWriter();try{await j.write(w.encode(J))}finally{j.releaseLock()}}});return{readable:X,writable:G}}class OD{#D;constructor($,Q){let w=$(this),f=async(G,_)=>{switch(G){case O.initialize:{let J=z.parse(_);return w.initialize(J)}case O.session_new:{let J=r.parse(_);return w.newSession(J)}case O.session_load:{if(!w.loadSession)throw K.methodNotFound(G);let J=QD.parse(_);return w.loadSession(J)}case O.session_list:{if(!w.listSessions)throw K.methodNotFound(G);let J=t.parse(_);return w.listSessions(J)}case O.session_fork:{if(!w.unstable_forkSession)throw K.methodNotFound(G);let J=$D.parse(_);return w.unstable_forkSession(J)}case O.session_resume:{if(!w.unstable_resumeSession)throw K.methodNotFound(G);let J=GD.parse(_);return w.unstable_resumeSession(J)}case O.session_close:{if(!w.unstable_closeSession)throw K.methodNotFound(G);let J=e.parse(_);return w.unstable_closeSession(J)}case O.session_set_mode:{if(!w.setSessionMode)throw K.methodNotFound(G);let J=XD.parse(_);return await w.setSessionMode(J)??{}}case O.authenticate:{let J=n.parse(_);return await w.authenticate(J)??{}}case O.session_prompt:{let J=AD.parse(_);return w.prompt(J)}case O.session_set_model:{if(!w.unstable_setSessionModel)throw K.methodNotFound(G);let J=YD.parse(_);return await w.unstable_setSessionModel(J)??{}}case O.session_set_config_option:{if(!w.setSessionConfigOption)throw K.methodNotFound(G);let J=JD.parse(_);return w.setSessionConfigOption(J)}default:if(w.extMethod)return w.extMethod(G,_);throw K.methodNotFound(G)}},X=async(G,_)=>{switch(G){case O.session_cancel:{let J=s.parse(_);return w.cancel(J)}default:if(w.extNotification)return w.extNotification(G,_);throw K.methodNotFound(G)}};this.#D=new ND(f,X,Q)}async sessionUpdate($){return await this.#D.sendNotification(F.session_update,$)}async requestPermission($){return await this.#D.sendRequest(F.session_request_permission,$)}async readTextFile($){return await this.#D.sendRequest(F.fs_read_text_file,$)}async writeTextFile($){return await this.#D.sendRequest(F.fs_write_text_file,$)??{}}async createTerminal($){let Q=await this.#D.sendRequest(F.terminal_create,$);return new aD(Q.terminalId,$.sessionId,this.#D)}async extMethod($,Q){return await this.#D.sendRequest($,Q)}async extNotification($,Q){return await this.#D.sendNotification($,Q)}get signal(){return this.#D.signal}get closed(){return this.#D.closed}}class aD{id;#D;#$;constructor($,Q,w){this.id=$,this.#D=Q,this.#$=w}async currentOutput(){return await this.#$.sendRequest(F.terminal_output,{sessionId:this.#D,terminalId:this.id})}async waitForExit(){return await this.#$.sendRequest(F.terminal_wait_for_exit,{sessionId:this.#D,terminalId:this.id})}async kill(){return await this.#$.sendRequest(F.terminal_kill,{sessionId:this.#D,terminalId:this.id})??{}}async release(){return await this.#$.sendRequest(F.terminal_release,{sessionId:this.#D,terminalId:this.id})??{}}async[Symbol.asyncDispose](){await this.release()}}class pw{#D;constructor($,Q){let w=$(this),f=async(G,_)=>{switch(G){case F.fs_write_text_file:{let J=BD.parse(_);return w.writeTextFile?.(J)}case F.fs_read_text_file:{let J=fD.parse(_);return w.readTextFile?.(J)}case F.session_request_permission:{let J=WD.parse(_);return w.requestPermission(J)}case F.terminal_create:{let J=DD.parse(_);return w.createTerminal?.(J)}case F.terminal_output:{let J=ZD.parse(_);return w.terminalOutput?.(J)}case F.terminal_release:{let J=_D.parse(_);return await w.releaseTerminal?.(J)??{}}case F.terminal_wait_for_exit:{let J=KD.parse(_);return w.waitForTerminalExit?.(J)}case F.terminal_kill:{let J=wD.parse(_);return await w.killTerminal?.(J)??{}}default:if(w.extMethod)return w.extMethod(G,_);throw K.methodNotFound(G)}},X=async(G,_)=>{switch(G){case F.session_update:{let J=yD.parse(_);return w.sessionUpdate(J)}default:if(w.extNotification)return w.extNotification(G,_);throw K.methodNotFound(G)}};this.#D=new ND(f,X,Q)}async initialize($){return await this.#D.sendRequest(O.initialize,$)}async newSession($){return await this.#D.sendRequest(O.session_new,$)}async loadSession($){return await this.#D.sendRequest(O.session_load,$)??{}}async unstable_forkSession($){return await this.#D.sendRequest(O.session_fork,$)}async listSessions($){return await this.#D.sendRequest(O.session_list,$)}async unstable_resumeSession($){return await this.#D.sendRequest(O.session_resume,$)}async unstable_closeSession($){return await this.#D.sendRequest(O.session_close,$)}async setSessionMode($){return await this.#D.sendRequest(O.session_set_mode,$)??{}}async unstable_setSessionModel($){return await this.#D.sendRequest(O.session_set_model,$)??{}}async setSessionConfigOption($){return await this.#D.sendRequest(O.session_set_config_option,$)}async authenticate($){return await this.#D.sendRequest(O.authenticate,$)??{}}async prompt($){return await this.#D.sendRequest(O.session_prompt,$)}async cancel($){return await this.#D.sendNotification(O.session_cancel,$)}async extMethod($,Q){return await this.#D.sendRequest($,Q)}async extNotification($,Q){return await this.#D.sendNotification($,Q)}get signal(){return this.#D.signal}get closed(){return this.#D.closed}}class ND{#D=new Map;#$=0;#G;#J;#Q;#f=Promise.resolve();#_=new AbortController;#X;constructor($,Q,w){this.#G=$,this.#J=Q,this.#Q=w,this.#X=new Promise((f)=>{this.#_.signal.addEventListener("abort",()=>f())}),this.#Y()}get signal(){return this.#_.signal}get closed(){return this.#X}async#Y(){let $=this.#Q.readable.getReader();try{while(!0){let{value:Q,done:w}=await $.read();if(w)break;if(!Q)continue;try{this.#Z(Q)}catch(f){if(console.error("Unexpected error during message processing:",Q,f),"id"in Q&&Q.id!==void 0)this.#w({jsonrpc:"2.0",id:Q.id,error:{code:-32700,message:"Parse error"}})}}}finally{$.releaseLock(),this.#_.abort()}}async#Z($){if("method"in $&&"id"in $){let Q=await this.#j($.method,$.params);if("error"in Q)console.error("Error handling request",$,Q.error);await this.#w({jsonrpc:"2.0",id:$.id,...Q})}else if("method"in $){let Q=await this.#A($.method,$.params);if("error"in Q)console.error("Error handling notification",$,Q.error)}else if("id"in $)this.#W($);else console.error("Invalid message",{message:$})}async#j($,Q){try{return{result:await this.#G($,Q)??null}}catch(w){if(w instanceof K)return w.toResult();if(w instanceof D.ZodError)return K.invalidParams(w.format()).toResult();let f;if(w instanceof Error)f=w.message;else if(typeof w==="object"&&w!=null&&"message"in w&&typeof w.message==="string")f=w.message;try{return K.internalError(f?JSON.parse(f):{}).toResult()}catch{return K.internalError({details:f}).toResult()}}}async#A($,Q){try{return await this.#J($,Q),{result:null}}catch(w){if(w instanceof K)return w.toResult();if(w instanceof D.ZodError)return K.invalidParams(w.format()).toResult();let f;if(w instanceof Error)f=w.message;else if(typeof w==="object"&&w!=null&&"message"in w&&typeof w.message==="string")f=w.message;try{return K.internalError(f?JSON.parse(f):{}).toResult()}catch{return K.internalError({details:f}).toResult()}}}#W($){let Q=this.#D.get($.id);if(Q){if("result"in $)Q.resolve($.result);else if("error"in $)Q.reject($.error);this.#D.delete($.id)}else console.error("Got response to unknown request",$.id)}async sendRequest($,Q){let w=this.#$++,f=new Promise((X,G)=>{this.#D.set(w,{resolve:X,reject:G})});return await this.#w({jsonrpc:"2.0",id:w,method:$,params:Q}),f}async sendNotification($,Q){await this.#w({jsonrpc:"2.0",method:$,params:Q})}async#w($){return this.#f=this.#f.then(async()=>{let Q=this.#Q.writable.getWriter();try{await Q.write($)}finally{Q.releaseLock()}}).catch((Q)=>{console.error("ACP write error:",Q)}),this.#f}}class K extends Error{code;data;constructor($,Q,w){super(Q);this.code=$,this.name="RequestError",this.data=w}static parseError($,Q){return new K(-32700,`Parse error${Q?`: ${Q}`:""}`,$)}static invalidRequest($,Q){return new K(-32600,`Invalid request${Q?`: ${Q}`:""}`,$)}static methodNotFound($){return new K(-32601,`"Method not found": ${$}`,{method:$})}static invalidParams($,Q){return new K(-32602,`Invalid params${Q?`: ${Q}`:""}`,$)}static internalError($,Q){return new K(-32603,`Internal error${Q?`: ${Q}`:""}`,$)}static authRequired($,Q){return new K(-32000,`Authentication required${Q?`: ${Q}`:""}`,$)}static resourceNotFound($){return new K(-32002,`Resource not found${$?`: ${$}`:""}`,$&&{uri:$})}toResult(){return{error:{code:this.code,message:this.message,data:this.data}}}toErrorResponse(){return{code:this.code,message:this.message,data:this.data}}}var v={};ow(v,{init:()=>zw,Agent:()=>CD,ACP:()=>v});var FD=H.create({service:"acp-session-manager"});class LD{sessions=new Map;sdk;constructor($){this.sdk=$}tryGet($){return this.sessions.get($)}async create($,Q,w){let X=(await this.sdk.session.create({directory:$},{throwOnError:!0}).then((J)=>J.data)).id,_={id:X,cwd:$,mcpServers:Q,createdAt:new Date,model:w};return FD.info("creating_session",{state:_}),this.sessions.set(X,_),_}async load($,Q,w,f){let X=await this.sdk.session.get({sessionID:$,directory:Q},{throwOnError:!0}).then((J)=>J.data),G=f,_={id:$,cwd:Q,mcpServers:w,createdAt:new Date(X.time.created),model:G};return FD.info("loading_session",{state:_}),this.sessions.set($,_),_}get($){let Q=this.sessions.get($);if(!Q)throw FD.error("session not found",{sessionId:$}),K.invalidParams(JSON.stringify({error:`Session not found: ${$}`}));return Q}getModel($){return this.get($).model}setModel($,Q){let w=this.get($);return w.model=Q,this.sessions.set($,w),w}getVariant($){return this.get($).variant}setVariant($,Q){let w=this.get($);return w.variant=Q,this.sessions.set($,w),w}setMode($,Q){let w=this.get($);return w.modeId=Q,this.sessions.set($,w),w}}import{pathToFileURL as c}from"url";var nw=H.create({service:"acp-message-translator"}),tw="default";function b($){switch($.toLocaleLowerCase()){case"bash":return"execute";case"webfetch":return"fetch";case"edit":case"patch":case"write":return"edit";case"grep":case"glob":case"context7_resolve_library_id":case"context7_get_library_docs":return"search";case"read":return"read";default:return"other"}}function u($,Q){switch($.toLocaleLowerCase()){case"read":case"edit":case"write":return Q.filePath?[{path:Q.filePath}]:[];case"glob":case"grep":return Q.path?[{path:Q.path}]:[];case"bash":return[];default:return[]}}function g($){try{if($.startsWith("file://")){let Q=$.slice(7),w=Q.split("/").pop()||Q;return{type:"file",url:$,filename:w,mime:"text/plain"}}if($.startsWith("zed://")){let w=new URL($).searchParams.get("path");if(w){let f=w.split("/").pop()||w;return{type:"file",url:c(w).href,filename:f,mime:"text/plain"}}}return{type:"text",text:$}}catch{return{type:"text",text:$}}}function eD($,Q){let w=sD($,Q);if(w===!1){nw.error("Failed to apply unified diff (context mismatch)");return}return w}function xD($){if($.tool!=="bash")return;if(!("metadata"in $.state)||!$.state.metadata||typeof $.state.metadata!=="object")return;let Q=$.state.metadata.output;if(typeof Q!=="string")return;return Q}function l($){return[...$].sort((Q,w)=>{let f=Q.name.toLowerCase(),X=w.name.toLowerCase();if(f<X)return-1;if(f>X)return 1;return 0})}function VD($,Q){let w=$.find((X)=>X.id===Q.providerID);if(!w)return[];let f=w.models[Q.modelID];if(!f?.variants)return[];return Object.keys(f.variants)}function D$($,Q={}){let w=Q.includeVariants??!1;return $.flatMap((f)=>{let X=Object.values(f.models);return U.sort(X).flatMap((_)=>{let J={modelId:`${f.id}/${_.id}`,name:`${f.name}/${_.name}`};if(!w||!_.variants)return[J];let B=Object.keys(_.variants).filter((Y)=>Y!==tw).map((Y)=>({modelId:`${f.id}/${_.id}/${Y}`,name:`${f.name}/${_.name} (${Y})`}));return[J,...B]})})}function d($,Q,w,f){let X=`${$.providerID}/${$.modelID}`;if(!f||!Q||!w.includes(Q))return X;return`${X}/${Q}`}function HD($){return{opencode:{modelId:`${$.model.providerID}/${$.model.modelID}`,variant:$.variant??null,availableVariants:$.availableVariants}}}function PD($,Q){let w=U.parseModel($),f=Q.find((G)=>G.id===w.providerID);if(!f)return{model:w,variant:void 0};if(f.models[w.modelID])return{model:w,variant:void 0};let X=w.modelID.split("/");if(X.length>1){let G=X[X.length-1],_=X.slice(0,-1).join("/"),J=f.models[_];if(J?.variants&&G in J.variants)return{model:{providerID:w.providerID,modelID:P.make(_)},variant:G}}return{model:w,variant:void 0}}function i($){let Q=[{id:"model",name:"Model",category:"model",type:"select",currentValue:$.currentModelId,options:$.availableModels.map((w)=>({value:w.modelId,name:w.name}))}];if($.modes)Q.push({id:"mode",name:"Session Mode",category:"mode",type:"select",currentValue:$.modes.currentModeId,options:$.modes.availableModes.map((w)=>({value:w.id,name:w.name,...w.description?{description:w.description}:{}}))});return Q}var $$=H.create({service:"acp-permissions"});class TD{connection;sdk;sessionManager;permissionQueues=new Map;permissionOptions=[{optionId:"once",kind:"allow_once",name:"Allow once"},{optionId:"always",kind:"allow_always",name:"Always allow"},{optionId:"reject",kind:"reject_once",name:"Reject"}];constructor($,Q,w){this.connection=$;this.sdk=Q;this.sessionManager=w}handle($){let Q=this.sessionManager.tryGet($.sessionID);if(!Q)return;let f=(this.permissionQueues.get($.sessionID)??Promise.resolve()).then(async()=>{let X=Q.cwd,G=await this.connection.requestPermission({sessionId:$.sessionID,toolCall:{toolCallId:$.tool?.callID??$.id,status:"pending",title:$.permission,rawInput:$.metadata,kind:b($.permission),locations:u($.permission,$.metadata??{})},options:this.permissionOptions}).catch(async(_)=>{$$.error("failed to request permission from ACP",{error:_,permissionID:$.id,sessionID:$.sessionID}),await this.sdk.permission.reply({requestID:$.id,reply:"reject",directory:X});return});if(!G)return;if(G.outcome.outcome!=="selected"){await this.sdk.permission.reply({requestID:$.id,reply:"reject",directory:X});return}if(G.outcome.optionId!=="reject"&&$.permission=="edit"){let _=$.metadata||{},J=typeof _.filepath==="string"?_.filepath:"",j=typeof _.diff==="string"?_.diff:"",B=await kD.exists(J)?await kD.readText(J):"",Y=eD(B,j);if(Y)this.connection.writeTextFile({sessionId:Q.id,path:J,content:Y})}await this.sdk.permission.reply({requestID:$.id,reply:G.outcome.optionId,directory:X})}).catch((X)=>{$$.error("failed to handle permission",{error:X,permissionID:$.id})}).finally(()=>{if(this.permissionQueues.get($.sessionID)===f)this.permissionQueues.delete($.sessionID)});this.permissionQueues.set($.sessionID,f)}}var L=H.create({service:"acp-event-bridge"});class UD{connection;sdk;sessionManager;eventAbort=new AbortController;eventStarted=!1;bashSnapshots=new Map;toolStarts=new Set;permissionHandler;constructor($,Q,w){this.connection=$;this.sdk=Q;this.sessionManager=w;this.permissionHandler=new TD($,Q,w)}start(){if(this.eventStarted)return;this.eventStarted=!0,this.runEventSubscription().catch(($)=>{if(this.eventAbort.signal.aborted)return;L.error("event subscription failed",{error:$})})}stop(){this.eventAbort.abort()}async runEventSubscription(){while(!0){if(this.eventAbort.signal.aborted)return;let $=await this.sdk.global.event({signal:this.eventAbort.signal,sseMaxRetryAttempts:0});for await(let Q of $.stream){if(this.eventAbort.signal.aborted)return;let w=Q?.payload;if(!w)continue;await this.handleEvent(w).catch((f)=>{L.error("failed to handle event",{error:f,type:w.type})})}if(this.eventAbort.signal.aborted)return;await new Promise((Q)=>{let w=()=>{clearTimeout(f),this.eventAbort.signal.removeEventListener("abort",w),Q()},f=setTimeout(w,1000);if(this.eventAbort.signal.addEventListener("abort",w,{once:!0}),this.eventAbort.signal.aborted)w()})}}async handleEvent($){switch($.type){case"permission.asked":{this.permissionHandler.handle($.properties);return}case"message.part.updated":{L.info("message part updated",{event:$.properties});let w=$.properties.part,f=this.sessionManager.tryGet(w.sessionID);if(!f)return;let X=f.id;if(w.type==="tool")switch(await this.toolStart(X,w),w.state.status){case"pending":this.bashSnapshots.delete(w.callID);return;case"running":{let G=xD(w),_=[];if(G){let J=w$.fast(G);if(w.tool==="bash"){if(this.bashSnapshots.get(w.callID)===J){await this.sendToolInProgress(X,w,w.state,[]);return}this.bashSnapshots.set(w.callID,J)}_.push({type:"content",content:{type:"text",text:G}})}await this.sendToolInProgress(X,w,w.state,_);return}case"completed":await this.sendToolCompleted(X,w,w.state);return;case"error":await this.sendToolError(X,w,w.state);return}if(w.type!=="text"&&w.type!=="file")return;return}case"message.part.delta":{let Q=$.properties,w=this.sessionManager.tryGet(Q.sessionID);if(!w)return;let f=w.id,X=await this.sdk.session.message({sessionID:Q.sessionID,messageID:Q.messageID,directory:w.cwd},{throwOnError:!0}).then((_)=>_.data).catch((_)=>{L.error("unexpected error when fetching message",{error:_});return});if(!X||X.info.role!=="assistant")return;let G=X.parts.find((_)=>_.id===Q.partID);if(!G)return;if(G.type==="text"&&Q.field==="text"&&G.ignored!==!0){await this.connection.sessionUpdate({sessionId:f,update:{sessionUpdate:"agent_message_chunk",messageId:Q.messageID,content:{type:"text",text:Q.delta}}}).catch((_)=>{L.error("failed to send text delta to ACP",{error:_})});return}if(G.type==="reasoning"&&Q.field==="text")await this.connection.sessionUpdate({sessionId:f,update:{sessionUpdate:"agent_thought_chunk",messageId:Q.messageID,content:{type:"text",text:Q.delta}}}).catch((_)=>{L.error("failed to send reasoning delta to ACP",{error:_})});return}}}async sendToolInProgress($,Q,w,f){await this.connection.sessionUpdate({sessionId:$,update:{sessionUpdate:"tool_call_update",toolCallId:Q.callID,status:"in_progress",kind:b(Q.tool),title:Q.tool,locations:u(Q.tool,w.input),rawInput:w.input,...f.length>0&&{content:f}}}).catch((X)=>{L.error("failed to send tool in_progress to ACP",{error:X})})}async sendToolCompleted($,Q,w){this.toolStarts.delete(Q.callID),this.bashSnapshots.delete(Q.callID);let f=b(Q.tool),X=[{type:"content",content:{type:"text",text:w.output}}];if(f==="edit"){let G=w.input,_=typeof G.filePath==="string"?G.filePath:"",J=typeof G.oldString==="string"?G.oldString:"",j=typeof G.newString==="string"?G.newString:typeof G.content==="string"?G.content:"";X.push({type:"diff",path:_,oldText:J,newText:j})}await this.connection.sessionUpdate({sessionId:$,update:{sessionUpdate:"tool_call_update",toolCallId:Q.callID,status:"completed",kind:f,content:X,title:w.title,rawInput:w.input,rawOutput:{output:w.output,metadata:w.metadata}}}).catch((G)=>{L.error("failed to send tool completed to ACP",{error:G})})}async sendToolError($,Q,w){this.toolStarts.delete(Q.callID),this.bashSnapshots.delete(Q.callID),await this.connection.sessionUpdate({sessionId:$,update:{sessionUpdate:"tool_call_update",toolCallId:Q.callID,status:"failed",kind:b(Q.tool),title:Q.tool,rawInput:w.input,content:[{type:"content",content:{type:"text",text:w.error}}],rawOutput:{error:w.error,metadata:w.metadata}}}).catch((f)=>{L.error("failed to send tool error to ACP",{error:f})})}async toolStart($,Q){if(this.toolStarts.has(Q.callID))return;this.toolStarts.add(Q.callID),await this.connection.sessionUpdate({sessionId:$,update:{sessionUpdate:"tool_call",toolCallId:Q.callID,title:Q.tool,kind:b(Q.tool),status:"pending",locations:[],rawInput:{}}}).catch((w)=>{L.error("failed to send tool pending to ACP",{error:w})})}async processMessage($){if(L.debug("process message",$),$.info.role!=="assistant"&&$.info.role!=="user")return;let Q=$.info.sessionID;for(let w of $.parts)if(w.type==="tool")switch(await this.toolStart(Q,w),w.state.status){case"pending":this.bashSnapshots.delete(w.callID);break;case"running":{let f=xD(w),X=[];if(f)X.push({type:"content",content:{type:"text",text:f}});await this.sendToolInProgress(Q,w,w.state,X);break}case"completed":await this.sendToolCompleted(Q,w,w.state);break;case"error":await this.sendToolError(Q,w,w.state);break}else if(w.type==="text"){if(w.text){let f=w.synthetic?["assistant"]:w.ignored?["user"]:void 0;await this.connection.sessionUpdate({sessionId:Q,update:{sessionUpdate:$.info.role==="user"?"user_message_chunk":"agent_message_chunk",messageId:$.info.id,content:{type:"text",text:w.text,...f&&{annotations:{audience:f}}}}}).catch((X)=>{L.error("failed to send text to ACP",{error:X})})}}else if(w.type==="file"){let f=w.url,X=w.filename??"file",G=w.mime||"application/octet-stream",_=$.info.role==="user"?"user_message_chunk":"agent_message_chunk";if(f.startsWith("file://"))await this.connection.sessionUpdate({sessionId:Q,update:{sessionUpdate:_,messageId:$.info.id,content:{type:"resource_link",uri:f,name:X,mimeType:G}}}).catch((J)=>{L.error("failed to send resource_link to ACP",{error:J})});else if(f.startsWith("data:")){let J=f.match(/^data:([^;]+);base64,(.*)$/),j=J?.[1],B=J?.[2]??"",Y=j||G;if(Y.startsWith("image/"))await this.connection.sessionUpdate({sessionId:Q,update:{sessionUpdate:_,messageId:$.info.id,content:{type:"image",mimeType:Y,data:B,uri:c(X).href}}}).catch((Z)=>{L.error("failed to send image to ACP",{error:Z})});else{let Z=Y.startsWith("text/")||Y==="application/json",A=c(X).href,y=Z?{uri:A,mimeType:Y,text:Buffer.from(B,"base64").toString("utf-8")}:{uri:A,mimeType:Y,blob:B};await this.connection.sessionUpdate({sessionId:Q,update:{sessionUpdate:_,messageId:$.info.id,content:{type:"resource",resource:y}}}).catch((W)=>{L.error("failed to send resource to ACP",{error:W})})}}}else if(w.type==="reasoning"){if(w.text)await this.connection.sessionUpdate({sessionId:Q,update:{sessionUpdate:"agent_thought_chunk",messageId:$.info.id,content:{type:"text",text:w.text}}}).catch((f)=>{L.error("failed to send reasoning to ACP",{error:f})})}}}var V=H.create({service:"acp-agent"});async function rw($,Q,w,f){return(await $.config.providers({directory:f}).then((J)=>J.data?.providers??[]).catch((J)=>{return V.error("failed to get providers for context limit",{error:J}),[]})).find((J)=>J.id===Q)?.models[w]?.limit.context??null}async function bD($,Q,w,f){let X=await Q.session.messages({sessionID:w,directory:f,agent_id:"main"},{throwOnError:!0}).then((Z)=>Z.data).catch((Z)=>{V.error("failed to fetch messages for usage update",{error:Z});return});if(!X)return;let G=X.filter((Z)=>Z.info.role==="assistant"),_=G[G.length-1];if(!_)return;let J=_.info;if(!J.providerID||!J.modelID)return;let j=await rw(Q,k.make(J.providerID),P.make(J.modelID),f);if(!j)return;let B=J.tokens.input+(J.tokens.cache?.read??0),Y=G.reduce((Z,A)=>Z+A.info.cost,0);await $.sessionUpdate({sessionId:w,update:{sessionUpdate:"usage_update",used:B,size:j,cost:{amount:Y,currency:"USD"}}}).catch((Z)=>{V.error("failed to send usage update",{error:Z})})}async function zw({sdk:$}){return{create:(Q,w)=>{return new CD(Q,w)}}}class CD{connection;config;sdk;sessionManager;eventBridge;constructor($,Q){this.connection=$,this.config=Q,this.sdk=Q.sdk,this.sessionManager=new LD(this.sdk),this.eventBridge=new UD($,this.sdk,this.sessionManager),this.eventBridge.start()}async initialize($){V.info("initialize",{protocolVersion:$.protocolVersion});let Q={description:"Run `qitqode auth login` in the terminal",name:"Login with qitqode",id:"qitqode-login"};if($.clientCapabilities?._meta?.["terminal-auth"]===!0)Q._meta={"terminal-auth":{command:"qitqode",args:["auth","login"],label:"QitQode Login"}};return{protocolVersion:1,agentCapabilities:{loadSession:!0,mcpCapabilities:{http:!0,sse:!0},promptCapabilities:{embeddedContext:!0,image:!0},sessionCapabilities:{fork:{},list:{},resume:{}}},authMethods:[Q],agentInfo:{name:"QitQode",version:Q$}}}async authenticate($){throw Error("Authentication not implemented")}rethrowSessionError($){let Q=G$.fromError($,{providerID:k.make(this.config.defaultModel?.providerID??"unknown")});if(f$.isInstance(Q))throw K.authRequired();throw $}fetchSessionMessages($,Q){return this.sdk.session.messages({sessionID:$,directory:Q,agent_id:"main"},{throwOnError:!0}).then((w)=>w.data).catch((w)=>{V.error("unexpected error when fetching message",{error:w});return})}loadSessionProviders($){return this.sdk.config.providers({directory:$},{throwOnError:!0}).then((Q)=>Q.data.providers)}async newSession($){let Q=$.cwd;try{let w=await h(this.config,Q),X=(await this.sessionManager.create($.cwd,$.mcpServers,w)).id;V.info("creating_session",{sessionId:X,mcpServers:$.mcpServers.length});let G=await this.loadSessionMode({cwd:Q,mcpServers:$.mcpServers,sessionId:X});return{sessionId:X,configOptions:G.configOptions,models:G.models,modes:G.modes,_meta:G._meta}}catch(w){this.rethrowSessionError(w)}}async loadSession($){let{cwd:Q,sessionId:w}=$;try{let f=await h(this.config,Q);await this.sessionManager.load(w,$.cwd,$.mcpServers,f),V.info("load_session",{sessionId:w,mcpServers:$.mcpServers.length});let X=await this.loadSessionMode({cwd:Q,mcpServers:$.mcpServers,sessionId:w}),G=await this.fetchSessionMessages(w,Q),_=G?.findLast((J)=>J.info.role==="user")?.info;if(_?.role==="user"){if(X.models.currentModelId=`${_.model.providerID}/${_.model.modelID}`,this.sessionManager.setModel(w,{providerID:k.make(_.model.providerID),modelID:P.make(_.model.modelID)}),X.modes?.availableModes.some((J)=>J.id===_.agent))X.modes.currentModeId=_.agent,this.sessionManager.setMode(w,_.agent);X.configOptions=i({currentModelId:X.models.currentModelId,availableModels:X.models.availableModels,modes:X.modes})}return await this.replayMessagesAndSendUsage(G,w,Q),X}catch(f){this.rethrowSessionError(f)}}async listSessions($){try{let w=await this.sdk.session.list({directory:$.cwd??void 0,roots:!0},{throwOnError:!0}).then((Z)=>Z.data??[]),f=$.cursor?Number($.cursor):void 0,X=w.toSorted((Z,A)=>A.time.updated-Z.time.updated),G=f?X.filter((Z)=>Z.time.updated<f):X,_=G.slice(0,100),J=_.map((Z)=>({sessionId:Z.id,cwd:Z.directory,title:Z.title,updatedAt:new Date(Z.time.updated).toISOString()})),j=_[_.length-1],B=G.length>100&&j?String(j.time.updated):void 0,Y={sessions:J};if(B)Y.nextCursor=B;return Y}catch(Q){this.rethrowSessionError(Q)}}async unstable_forkSession($){let Q=$.cwd,w=$.mcpServers??[];try{let f=await h(this.config,Q),X=await this.sdk.session.fork({sessionID:$.sessionId,directory:Q},{throwOnError:!0}).then((j)=>j.data);if(!X)throw Error("Fork session returned no data");let G=X.id;await this.sessionManager.load(G,Q,w,f),V.info("fork_session",{sessionId:G,mcpServers:w.length});let _=await this.loadSessionMode({cwd:Q,mcpServers:w,sessionId:G}),J=await this.fetchSessionMessages(G,Q);return await this.replayMessagesAndSendUsage(J,G,Q),_}catch(f){this.rethrowSessionError(f)}}async unstable_resumeSession($){let{cwd:Q,sessionId:w}=$,f=$.mcpServers??[];try{let X=await h(this.config,Q);await this.sessionManager.load(w,Q,f,X),V.info("resume_session",{sessionId:w,mcpServers:f.length});let G=await this.loadSessionMode({cwd:Q,mcpServers:f,sessionId:w});return await bD(this.connection,this.sdk,w,Q),G}catch(X){this.rethrowSessionError(X)}}async loadAvailableModes($){return(await this.config.sdk.app.agents({directory:$},{throwOnError:!0}).then((w)=>w.data)).filter((w)=>w.mode!=="subagent"&&!w.hidden).map((w)=>({id:w.name,name:w.name,description:w.description}))}async resolveModeState($,Q){let w=await this.loadAvailableModes($),f=this.sessionManager.get(Q).modeId||await(async()=>{if(!w.length)return;let X=await MD.runPromise(hD.Service.use((_)=>_.defaultAgent())),G=w.find((_)=>_.name===X)?.id??w[0].id;return this.sessionManager.setMode(Q,G),G})();return{availableModes:w,currentModeId:f}}async replayMessagesAndSendUsage($,Q,w){for(let f of $??[])V.debug("replay message",f),await this.eventBridge.processMessage(f);await bD(this.connection,this.sdk,Q,w)}async resolveModelsAndModes($){let Q=VD($.entries,$.model);$.onVariants?.(Q);let w=D$($.entries,{includeVariants:!0}),f=await this.resolveModeState($.directory,$.sessionId),X=f.currentModeId?{availableModes:f.availableModes,currentModeId:f.currentModeId}:void 0;return{availableVariants:Q,availableModels:w,modes:X}}async loadSessionMode($){let Q=$.cwd,w=await h(this.config,Q),f=$.sessionId,X=await this.sdk.config.providers({directory:Q}).then((W)=>W.data.providers),G=l(X),_=this.sessionManager.getVariant(f),{availableVariants:J,availableModels:j,modes:B}=await this.resolveModelsAndModes({entries:G,model:w,directory:Q,sessionId:f,onVariants:(W)=>{if(_&&!W.includes(_))this.sessionManager.setVariant(f,void 0)}}),Z=(await this.config.sdk.command.list({directory:Q},{throwOnError:!0}).then((W)=>W.data)).map((W)=>({name:W.name,description:W.description??""}));if(!new Set(Z.map((W)=>W.name)).has("compact"))Z.push({name:"compact",description:"summarize the session to reduce context"});let y={};for(let W of $.mcpServers)if("type"in W)y[W.name]={url:W.url,headers:W.headers.reduce((x,{name:C,value:m})=>{return x[C]=m,x},{}),type:"remote"};else y[W.name]={type:"local",command:[W.command,...W.args],environment:W.env.reduce((x,{name:C,value:m})=>{return x[C]=m,x},{})};return await Promise.all(Object.entries(y).map(async([W,x])=>{await this.sdk.mcp.add({directory:Q,name:W,config:x},{throwOnError:!0}).catch((C)=>{V.error("failed to add mcp server",{name:W,error:C})})})),setTimeout(()=>{this.connection.sessionUpdate({sessionId:f,update:{sessionUpdate:"available_commands_update",availableCommands:Z}})},0),{sessionId:f,models:{currentModelId:d(w,_,J,!0),availableModels:j},modes:B,configOptions:i({currentModelId:d(w,_,J,!0),availableModels:j,modes:B}),_meta:HD({model:w,variant:this.sessionManager.getVariant(f),availableVariants:J})}}async unstable_setSessionModel($){let Q=this.sessionManager.get($.sessionId),w=await this.loadSessionProviders(Q.cwd),f=PD($.modelId,w);this.sessionManager.setModel(Q.id,f.model),this.sessionManager.setVariant(Q.id,f.variant);let X=l(w),G=VD(X,f.model);return{_meta:HD({model:f.model,variant:f.variant,availableVariants:G})}}async setSessionMode($){let Q=this.sessionManager.get($.sessionId);if(!(await this.loadAvailableModes(Q.cwd)).some((f)=>f.id===$.modeId))throw Error(`Agent not found: ${$.modeId}`);this.sessionManager.setMode($.sessionId,$.modeId)}async setSessionConfigOption($){let Q=this.sessionManager.get($.sessionId),w=await this.loadSessionProviders(Q.cwd),f=l(w);if($.configId==="model"){if(typeof $.value!=="string")throw K.invalidParams("model value must be a string");let Y=PD($.value,w);this.sessionManager.setModel(Q.id,Y.model),this.sessionManager.setVariant(Q.id,Y.variant)}else if($.configId==="mode"){if(typeof $.value!=="string")throw K.invalidParams("mode value must be a string");if(!(await this.loadAvailableModes(Q.cwd)).some((Z)=>Z.id===$.value))throw K.invalidParams(JSON.stringify({error:`Mode not found: ${$.value}`}));this.sessionManager.setMode(Q.id,$.value)}else throw K.invalidParams(JSON.stringify({error:`Unknown config option: ${$.configId}`}));let X=this.sessionManager.get(Q.id),G=X.model??await h(this.config,Q.cwd),{availableVariants:_,availableModels:J,modes:j}=await this.resolveModelsAndModes({entries:f,model:G,directory:Q.cwd,sessionId:Q.id}),B=d(G,X.variant,_,!0);return{configOptions:i({currentModelId:B,availableModels:J,modes:j})}}async prompt($){let Q=$.sessionId,w=this.sessionManager.get(Q),f=w.cwd,X=w.model,G=X??await h(this.config,f);if(!X)this.sessionManager.setModel(w.id,G);let _=w.modeId??await MD.runPromise(hD.Service.use((A)=>A.defaultAgent())),J=[];for(let A of $.prompt)switch(A.type){case"text":{let y=A.annotations?.audience,W=y?.length===1&&y[0]==="assistant",x=y?.length===1&&y[0]==="user";J.push({type:"text",text:A.text,...W&&{synthetic:!0},...x&&{ignored:!0}});break}case"image":{let y=g(A.uri??""),W=y.type==="file"?y.filename:"image";if(A.data)J.push({type:"file",url:`data:${A.mimeType};base64,${A.data}`,filename:W,mime:A.mimeType});else if(A.uri&&A.uri.startsWith("http:"))J.push({type:"file",url:A.uri,filename:W,mime:A.mimeType});break}case"resource_link":{let y=g(A.uri);if(A.name&&y.type==="file")y.filename=A.name;J.push(y);break}case"resource":{let y=A.resource;if("text"in y&&y.text)J.push({type:"text",text:y.text});else if("blob"in y&&y.blob&&y.mimeType){let W=g(y.uri??""),x=W.type==="file"?W.filename:"file";J.push({type:"file",url:`data:${y.mimeType};base64,${y.blob}`,filename:x,mime:y.mimeType})}break}default:break}V.info("parts",{parts:J});let j=(()=>{let A=J.filter((x)=>x.type==="text").map((x)=>x.text).join("").trim();if(!A.startsWith("/"))return;let[y,...W]=A.slice(1).split(/\s+/);return{name:y,args:W.join(" ").trim()}})(),B=(A)=>({totalTokens:A.tokens.input+A.tokens.output+A.tokens.reasoning+(A.tokens.cache?.read??0)+(A.tokens.cache?.write??0),inputTokens:A.tokens.input,outputTokens:A.tokens.output,thoughtTokens:A.tokens.reasoning||void 0,cachedReadTokens:A.tokens.cache?.read||void 0,cachedWriteTokens:A.tokens.cache?.write||void 0}),Y,Z=!1;if(!j)Z=!0,Y=(await this.sdk.session.prompt({sessionID:Q,model:{providerID:G.providerID,modelID:G.modelID},variant:this.sessionManager.getVariant(Q),parts:J,agent:_,directory:f})).data?.info;else{let A=await this.config.sdk.command.list({directory:f},{throwOnError:!0}).then((y)=>y.data.find((W)=>W.name===j.name));if(A)Z=!0,Y=(await this.sdk.session.command({sessionID:Q,command:A.name,arguments:j.args,model:G.providerID+"/"+G.modelID,agent:_,directory:f})).data?.info;else switch(j.name){case"compact":await this.config.sdk.session.summarize({sessionID:Q,directory:f,providerID:G.providerID,modelID:G.modelID},{throwOnError:!0});break}}return await bD(this.connection,this.sdk,Q,f),{stopReason:"end_turn",...Z?{usage:Y?B(Y):void 0}:{},_meta:{}}}async cancel($){let Q=this.sessionManager.get($.sessionId);await this.config.sdk.session.abort({sessionID:$.sessionId,directory:Q.cwd},{throwOnError:!0})}}async function h($,Q){let{sdk:w,defaultModel:f}=$;if(f)return f;let X=Q??process.cwd(),G=await w.config.get({directory:X},{throwOnError:!0}).then((Y)=>{let Z=Y.data;if(!Z||!Z.model)return;return U.parseModel(Z.model)}).catch((Y)=>{V.error("failed to load user config for default model",{error:Y});return}),_=await w.config.providers({directory:X},{throwOnError:!0}).then((Y)=>Y.data?.providers??[]).catch((Y)=>{return V.error("failed to list providers for default model",{error:Y}),[]});if(G&&_.length){let Y=_.find((Z)=>Z.id===G.providerID);if(Y&&Y.models[G.modelID])return G}if(G&&!_.length)return G;let J=_.find((Y)=>Y.id==="opencode");if(J){if(J.models["big-pickle"])return{providerID:k.opencode,modelID:P.make("big-pickle")};let[Y]=U.sort(Object.values(J.models));if(Y)return{providerID:k.make(Y.providerID),modelID:P.make(Y.id)}}for(let Y of["default","fast","economical","power"]){let Z=_$[Y];if(!Z)continue;if(_.find((y)=>y.id===Z.providerID)?.models[Z.modelID])return{providerID:k.make(Z.providerID),modelID:P.make(Z.modelID)}}let j=_.flatMap((Y)=>Object.values(Y.models)),[B]=U.sort(j);if(B)return{providerID:k.make(B.providerID),modelID:P.make(B.id)};if(G)return G;return{providerID:k.opencode,modelID:P.make("big-pickle")}}var ED=H.create({service:"acp-command"}),sQ=A$({command:"acp",describe:"start ACP (Agent Client Protocol) server",builder:($)=>{return J$($).option("cwd",{describe:"working directory",type:"string",default:process.cwd()})},handler:async($)=>{if(process.env.QITQODE_CLIENT="acp",process.env.QITQODE_KEY)ED.info("Using QITQODE_KEY for authentication.");else if(!await Y$())ED.warn("No QitQode credential found. AI features will not work until you sign in (`qitqode auth login`) or set QITQODE_KEY.");await j$(process.cwd(),async()=>{let Q=await W$($),w=await Z$.listen(Q),f=X$({baseUrl:`http://${w.hostname}:${w.port}`}),X=new WritableStream({write(j){return new Promise((B,Y)=>{process.stdout.write(j,(Z)=>{if(Z)Y(Z);else B()})})}}),G=new ReadableStream({start(j){process.stdin.on("data",(B)=>{j.enqueue(new Uint8Array(B))}),process.stdin.on("end",()=>j.close()),process.stdin.on("error",(B)=>j.error(B))}}),_=zD(X,G),J=await v.init({sdk:f});new OD((j)=>{return J.create(j,{sdk:f})},_),ED.info("setup connection"),process.stdin.resume(),await new Promise((j,B)=>{process.stdin.on("end",j),process.stdin.on("error",B)})})}});export{sQ as AcpCommand};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{I as M}from"./chunk-t9mz17gb.js";import{Vf as X}from"./chunk-rbk8seme.js";import{Ag as N,Bg as V,Eg as x,vg as C,yg as L}from"./chunk-takew94z.js";import{Xj as B}from"./chunk-04n2ycg5.js";import{qo as G}from"./chunk-r78czx4d.js";import{pH as z}from"./chunk-zs8kqdsf.js";var Z="forgewise";function A(j){if(!j||j.type!=="api")return"skip";if(j.method==="api-key")return"skip";if(L(j.expiresAt))return"skip";return"probe"}function F(j){if(j===null)return"skipped";if(!j)return"revoked";return"valid"}function U(j){if(!j||j.type!=="api")return{kind:"skip"};if(j.method==="api-key")return{kind:"skip"};if(!L(j.expiresAt))return{kind:"skip"};if(j.refreshToken)return{kind:"refresh-token",refreshToken:j.refreshToken};return{kind:"browser"}}function T(j){if(j==="invalid_grant")return{kind:"revoked"};if(j===null)return{kind:"transient"};return{kind:"persist",credential:M(j,{rotateRefreshToken:!0})}}var b=1e4;function P(j){if(!j)return;if(j.type!=="api")return{type:j.type,expiresAt:0};return{type:j.type,method:j.metadata?.method,expiresAt:Number(j.metadata?.expires_at??0),refreshToken:j.metadata?.refresh_token}}function w(){if(process.platform==="linux")return Boolean(process.env.DISPLAY||process.env.WAYLAND_DISPLAY);return process.platform==="win32"||process.platform==="darwin"}var K=()=>z.gen(function*(){let j=yield*B.Service,D=yield*z.orElseSucceed(j.get(Z),()=>{return});if(A(P(D))==="skip")return"skipped";if(!D||D.type!=="api")return"skipped";let J=yield*z.orElseSucceed(z.tryPromise({try:()=>C(),catch:()=>{return}}).pipe(z.map((Q)=>Q.issuer)),()=>{return});if(!J)return"skipped";let $=yield*z.promise(()=>N(J,D.key)),H=F($);if(H==="revoked")yield*z.orElseSucceed(j.remove(Z),()=>{return});return H}).pipe(z.withSpan("forgewise.validateStoredToken")),W=()=>z.gen(function*(){let j=yield*B.Service,D=yield*z.orElseSucceed(j.get(Z),()=>{return}),J=U(P(D));if(J.kind==="skip")return"skipped";if(J.kind==="refresh-token"){let _=yield*z.promise(()=>V(J.refreshToken).catch(()=>null)),q=T(_);if(q.kind==="revoked")return yield*z.orElseSucceed(j.remove(Z),()=>{return}),"failed";if(q.kind==="persist")return(yield*j.set(Z,q.credential).pipe(z.map(()=>!0),z.catch(()=>z.succeed(!1))))?"ok":"failed"}if(!w())return"skipped";let $=new AbortController,H=setTimeout(()=>$.abort(),b),Q=yield*z.promise(()=>x({signal:$.signal}).catch(()=>null).finally(()=>clearTimeout(H)));if(!Q)return"failed";let Y=M(Q,{rotateRefreshToken:!1});return(yield*j.set(Z,Y).pipe(z.map(()=>!0),z.catch(()=>z.succeed(!1))))?"ok":"failed"}).pipe(z.withSpan("forgewise.refreshIfNeeded"));var E=()=>z.gen(function*(){if((yield*z.promise(()=>G()))?.method!=="sso")return"ok";if((yield*K())==="revoked")return yield*z.sync(()=>X.println(X.Style.TEXT_DANGER+"Your session was revoked (signed out from another device or by an admin action). Run `qitqode auth login` to sign in again."+X.Style.TEXT_NORMAL)),"revoked";if((yield*W())==="failed")yield*z.sync(()=>X.println(X.Style.TEXT_DIM+"(Session refresh failed \u2014 run `qitqode auth login` to re-authenticate)"+X.Style.TEXT_NORMAL));return"ok"});
2
+ import{I as M}from"./chunk-t9mz17gb.js";import{Vf as X}from"./chunk-rbk8seme.js";import{Ag as N,Bg as V,Eg as x,vg as C,yg as L}from"./chunk-gz8sz7z1.js";import{Xj as B}from"./chunk-257me4z3.js";import{qo as G}from"./chunk-we9cv8we.js";import{pH as z}from"./chunk-zs8kqdsf.js";var Z="forgewise";function A(j){if(!j||j.type!=="api")return"skip";if(j.method==="api-key")return"skip";if(L(j.expiresAt))return"skip";return"probe"}function F(j){if(j===null)return"skipped";if(!j)return"revoked";return"valid"}function U(j){if(!j||j.type!=="api")return{kind:"skip"};if(j.method==="api-key")return{kind:"skip"};if(!L(j.expiresAt))return{kind:"skip"};if(j.refreshToken)return{kind:"refresh-token",refreshToken:j.refreshToken};return{kind:"browser"}}function T(j){if(j==="invalid_grant")return{kind:"revoked"};if(j===null)return{kind:"transient"};return{kind:"persist",credential:M(j,{rotateRefreshToken:!0})}}var b=1e4;function P(j){if(!j)return;if(j.type!=="api")return{type:j.type,expiresAt:0};return{type:j.type,method:j.metadata?.method,expiresAt:Number(j.metadata?.expires_at??0),refreshToken:j.metadata?.refresh_token}}function w(){if(process.platform==="linux")return Boolean(process.env.DISPLAY||process.env.WAYLAND_DISPLAY);return process.platform==="win32"||process.platform==="darwin"}var K=()=>z.gen(function*(){let j=yield*B.Service,D=yield*z.orElseSucceed(j.get(Z),()=>{return});if(A(P(D))==="skip")return"skipped";if(!D||D.type!=="api")return"skipped";let J=yield*z.orElseSucceed(z.tryPromise({try:()=>C(),catch:()=>{return}}).pipe(z.map((Q)=>Q.issuer)),()=>{return});if(!J)return"skipped";let $=yield*z.promise(()=>N(J,D.key)),H=F($);if(H==="revoked")yield*z.orElseSucceed(j.remove(Z),()=>{return});return H}).pipe(z.withSpan("forgewise.validateStoredToken")),W=()=>z.gen(function*(){let j=yield*B.Service,D=yield*z.orElseSucceed(j.get(Z),()=>{return}),J=U(P(D));if(J.kind==="skip")return"skipped";if(J.kind==="refresh-token"){let _=yield*z.promise(()=>V(J.refreshToken).catch(()=>null)),q=T(_);if(q.kind==="revoked")return yield*z.orElseSucceed(j.remove(Z),()=>{return}),"failed";if(q.kind==="persist")return(yield*j.set(Z,q.credential).pipe(z.map(()=>!0),z.catch(()=>z.succeed(!1))))?"ok":"failed"}if(!w())return"skipped";let $=new AbortController,H=setTimeout(()=>$.abort(),b),Q=yield*z.promise(()=>x({signal:$.signal}).catch(()=>null).finally(()=>clearTimeout(H)));if(!Q)return"failed";let Y=M(Q,{rotateRefreshToken:!1});return(yield*j.set(Z,Y).pipe(z.map(()=>!0),z.catch(()=>z.succeed(!1))))?"ok":"failed"}).pipe(z.withSpan("forgewise.refreshIfNeeded"));var E=()=>z.gen(function*(){if((yield*z.promise(()=>G()))?.method!=="sso")return"ok";if((yield*K())==="revoked")return yield*z.sync(()=>X.println(X.Style.TEXT_DANGER+"Your session was revoked (signed out from another device or by an admin action). Run `qitqode auth login` to sign in again."+X.Style.TEXT_NORMAL)),"revoked";if((yield*W())==="failed")yield*z.sync(()=>X.println(X.Style.TEXT_DIM+"(Session refresh failed \u2014 run `qitqode auth login` to re-authenticate)"+X.Style.TEXT_NORMAL));return"ok"});
3
3
  export{E as h};
package/bundle/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Jf as eD,Kf as k0}from"./chunk-pxvk3syj.js";import{Mf as y0,Nf as s0,Rf as r0,Sf as a0}from"./chunk-c1vnp55z.js";import{Vf as Ku}from"./chunk-rbk8seme.js";import{Rr as l0}from"./chunk-4gkk28xk.js";import{Sr as i0}from"./chunk-4cnwn1rh.js";import"./chunk-gcw4rn10.js";import{Vr as Lu,Wr as d0,Xr as o0,Yr as hF,ys as g0}from"./chunk-m5m448mg.js";import{bt as GF}from"./chunk-tqj69nh6.js";import"./chunk-ag8kz1e7.js";import"./chunk-5tray1fw.js";import"./chunk-c11d28qn.js";import"./chunk-mzs2pjyc.js";import"./chunk-gagtmjmp.js";import"./chunk-zs8kqdsf.js";import{BO as p2,CO as c2,FO as p}from"./chunk-7xm75w1e.js";var eF=c2((R3,aF)=>{aF.exports=function(u){if(u===void 0)u=2;if(u>=Error.stackTraceLimit)throw TypeError("getCallerFile(position) requires position be less then Error.stackTraceLimit but position was: `"+u+"` and Error.stackTraceLimit was: `"+Error.stackTraceLimit+"`");var F=Error.prepareStackTrace;Error.prepareStackTrace=function(C,f){return f};var E=Error().stack;if(Error.prepareStackTrace=F,E!==null&&typeof E==="object")return E[u]?E[u].getFileName():void 0}});import{notStrictEqual as v2,strictEqual as m2}from"assert";var F2={right:B2,center:f2};class ZF{constructor(D){var u;this.width=D.width,this.wrap=(u=D.wrap)!==null&&u!==void 0?u:!0,this.rows=[]}span(...D){let u=this.div(...D);u.span=!0}resetOutput(){this.rows=[]}div(...D){if(D.length===0)this.div("");if(this.wrap&&this.shouldApplyLayoutDSL(...D)&&typeof D[0]==="string")return this.applyLayoutDSL(D[0]);let u=D.map((F)=>{if(typeof F==="string")return this.colFromString(F);return F});return this.rows.push(u),u}shouldApplyLayoutDSL(...D){return D.length===1&&typeof D[0]==="string"&&/[\t\n]/.test(D[0])}applyLayoutDSL(D){let u=D.split(`
2
+ import{Jf as eD,Kf as k0}from"./chunk-jdynx7m6.js";import{Mf as y0,Nf as s0,Rf as r0,Sf as a0}from"./chunk-pv67gwce.js";import{Vf as Ku}from"./chunk-rbk8seme.js";import{Rr as l0}from"./chunk-56z7x7h4.js";import{Sr as i0}from"./chunk-4cnwn1rh.js";import"./chunk-764fksh3.js";import{Vr as Lu,Wr as d0,Xr as o0,Yr as hF,ys as g0}from"./chunk-xj765svc.js";import{bt as GF}from"./chunk-tqj69nh6.js";import"./chunk-ag8kz1e7.js";import"./chunk-5tray1fw.js";import"./chunk-c11d28qn.js";import"./chunk-mzs2pjyc.js";import"./chunk-gagtmjmp.js";import"./chunk-zs8kqdsf.js";import{BO as p2,CO as c2,FO as p}from"./chunk-7xm75w1e.js";var eF=c2((R3,aF)=>{aF.exports=function(u){if(u===void 0)u=2;if(u>=Error.stackTraceLimit)throw TypeError("getCallerFile(position) requires position be less then Error.stackTraceLimit but position was: `"+u+"` and Error.stackTraceLimit was: `"+Error.stackTraceLimit+"`");var F=Error.prepareStackTrace;Error.prepareStackTrace=function(C,f){return f};var E=Error().stack;if(Error.prepareStackTrace=F,E!==null&&typeof E==="object")return E[u]?E[u].getFileName():void 0}});import{notStrictEqual as v2,strictEqual as m2}from"assert";var F2={right:B2,center:f2};class ZF{constructor(D){var u;this.width=D.width,this.wrap=(u=D.wrap)!==null&&u!==void 0?u:!0,this.rows=[]}span(...D){let u=this.div(...D);u.span=!0}resetOutput(){this.rows=[]}div(...D){if(D.length===0)this.div("");if(this.wrap&&this.shouldApplyLayoutDSL(...D)&&typeof D[0]==="string")return this.applyLayoutDSL(D[0]);let u=D.map((F)=>{if(typeof F==="string")return this.colFromString(F);return F});return this.rows.push(u),u}shouldApplyLayoutDSL(...D){return D.length===1&&typeof D[0]==="string"&&/[\t\n]/.test(D[0])}applyLayoutDSL(D){let u=D.split(`
3
3
  `).map((E)=>E.split("\t")),F=0;return u.forEach((E)=>{if(E.length>1&&JD.stringWidth(E[0])>F)F=Math.min(Math.floor(this.width*0.5),JD.stringWidth(E[0]))}),u.forEach((E)=>{this.div(...E.map((C,f)=>{return{text:C.trim(),padding:this.measurePadding(C),width:f===0&&E.length>1?F:void 0}}))}),this.rows[this.rows.length-1]}colFromString(D){return{text:D,padding:this.measurePadding(D)}}measurePadding(D){let u=JD.stripAnsi(D);return[0,u.match(/\s*$/)[0].length,0,u.match(/^\s*/)[0].length]}toString(){let D=[];return this.rows.forEach((u)=>{this.rowToString(u,D)}),D.filter((u)=>!u.hidden).map((u)=>u.text).join(`
4
4
  `)}rowToString(D,u){return this.rasterize(D).forEach((F,E)=>{let C="";F.forEach((f,$)=>{let{width:G}=D[$],J=this.negatePadding(D[$]),Y=f;if(J>JD.stringWidth(f))Y+=" ".repeat(J-JD.stringWidth(f));if(D[$].align&&D[$].align!=="left"&&this.wrap){let Q=F2[D[$].align];if(Y=Q(Y,J),JD.stringWidth(Y)<J)Y+=" ".repeat((G||0)-JD.stringWidth(Y)-1)}let U=D[$].padding||[0,0,0,0];if(U[3])C+=" ".repeat(U[3]);if(C+=XF(D[$],Y,"| "),C+=Y,C+=XF(D[$],Y," |"),U[1])C+=" ".repeat(U[1]);if(E===0&&u.length>0)C=this.renderInline(C,u[u.length-1])}),u.push({text:C.replace(/ +$/,""),span:D.span})}),u}renderInline(D,u){let F=D.match(/^ */),E=F?F[0].length:0,C=u.text,f=JD.stringWidth(C.trimRight());if(!u.span)return D;if(!this.wrap)return u.hidden=!0,C+D;if(E<f)return D;return u.hidden=!0,C.trimRight()+" ".repeat(E-f)+D.trimLeft()}rasterize(D){let u=[],F=this.columnWidths(D),E;return D.forEach((C,f)=>{if(C.width=F[f],this.wrap)E=JD.wrap(C.text,this.negatePadding(C),{hard:!0}).split(`
5
5
  `);else E=C.text.split(`
@@ -77,5 +77,5 @@ ${W.join(`
77
77
  `;X.forEach((W)=>{O+=W}),u.fail(O)}};let J={};f.conflicts=function(Q,X){if(q("<string|object> [array|string]",[Q,X],arguments.length),typeof Q==="object")Object.keys(Q).forEach((O)=>{f.conflicts(O,Q[O])});else{if(D.global(Q),!J[Q])J[Q]=[];if(Array.isArray(X))X.forEach((O)=>f.conflicts(Q,O));else J[Q].push(X)}},f.getConflicting=()=>J,f.conflicting=function(Q){if(Object.keys(Q).forEach((X)=>{if(J[X])J[X].forEach((O)=>{if(O&&Q[X]!==void 0&&Q[O]!==void 0)u.fail(E("Arguments %s and %s are mutually exclusive",X,O))})}),D.getInternalMethods().getParserConfiguration()["strip-dashed"])Object.keys(J).forEach((X)=>{J[X].forEach((O)=>{if(O&&Q[F.Parser.camelCase(X)]!==void 0&&Q[F.Parser.camelCase(O)]!==void 0)u.fail(E("Arguments %s and %s are mutually exclusive",X,O))})})},f.recommendCommands=function(Q,X){X=X.sort((A,v)=>v.length-A.length);let W=null,Z=1/0;for(let A=0,v;(v=X[A])!==void 0;A++){let n=O0(Q,v);if(n<=3&&n<Z)Z=n,W=v}if(W)u.fail(E("Did you mean %s?",W))},f.reset=function(Q){return $=xD($,(X)=>!Q[X]),J=xD(J,(X)=>!Q[X]),f};let Y=[];return f.freeze=function(){Y.push({implied:$,conflicting:J})},f.unfreeze=function(){let Q=Y.pop();XD(Q,void 0,F),{implied:$,conflicting:J}=Q},f}var su=[],$u;function hu(D,u,F,E){$u=E;let C={};if(Object.prototype.hasOwnProperty.call(D,"extends")){if(typeof D.extends!=="string")return C;let f=/\.json|\..*rc$/.test(D.extends),$=null;if(!f)try{$=import.meta.resolve(D.extends)}catch(G){return D}else $=M8(u,D.extends);G8($),su.push($),C=f?JSON.parse($u.readFileSync($,"utf8")):E.require(D.extends),delete D.extends,C=hu(C,$u.path.dirname($),F,$u)}return su=[],F?W0(C,D):Object.assign({},C,D)}function G8(D){if(su.indexOf(D)>-1)throw new DD(`Circular extended configurations: '${D}'.`)}function M8(D,u){return $u.path.resolve(D,u)}function W0(D,u){let F={};function E(C){return C&&typeof C==="object"&&!Array.isArray(C)}Object.assign(F,D);for(let C of Object.keys(u))if(E(u[C])&&E(F[C]))F[C]=W0(D[C],u[C]);else F[C]=u[C];return F}var H=function(D,u,F,E,C){if(E==="m")throw TypeError("Private method is not writable");if(E==="a"&&!C)throw TypeError("Private accessor was defined without a setter");if(typeof u==="function"?D!==u||!C:!u.has(D))throw TypeError("Cannot write private member to an object whose class did not declare it");return E==="a"?C.call(D,F):C?C.value=F:u.set(D,F),F},B=function(D,u,F,E){if(F==="a"&&!E)throw TypeError("Private accessor was defined without a getter");if(typeof u==="function"?D!==u||!E:!u.has(D))throw TypeError("Cannot read private member from an object whose class did not declare it");return F==="m"?E:F==="a"?E.call(D):E?E.value:u.get(D)},uD,vD,zu,ZD,QD,Wu,wD,mD,Uu,WD,Nu,UD,VD,OD,ND,Ru,iD,hD,K,ju,qu,TD,dD,Fu,oD,bD,Hu,P,kD,gD,lD,b,Iu,_D,r;function c0(D){return(u=[],F=D.process.cwd(),E)=>{let C=new p0(u,F,E,D);return Object.defineProperty(C,"argv",{get:()=>{return C.parse()},enumerable:!0}),C.help(),C.version(),C}}var U0=Symbol("copyDoubleDash"),N0=Symbol("copyDoubleDash"),ru=Symbol("deleteFromParserHintObject"),R0=Symbol("emitWarning"),j0=Symbol("freeze"),q0=Symbol("getDollarZero"),yD=Symbol("getParserConfiguration"),H0=Symbol("getUsageConfiguration"),au=Symbol("guessLocale"),I0=Symbol("guessVersion"),V0=Symbol("parsePositionalNumbers"),eu=Symbol("pkgUp"),tD=Symbol("populateParserHintArray"),Eu=Symbol("populateParserHintSingleValueDictionary"),DF=Symbol("populateParserHintArrayDictionary"),uF=Symbol("populateParserHintDictionary"),FF=Symbol("sanitizeKey"),EF=Symbol("setKey"),CF=Symbol("unfreeze"),_0=Symbol("validateAsync"),K0=Symbol("getCommandInstance"),L0=Symbol("getContext"),A0=Symbol("getHasOutput"),S0=Symbol("getLoggerInstance"),x0=Symbol("getParseContext"),P0=Symbol("getUsageInstance"),w0=Symbol("getValidationInstance"),Vu=Symbol("hasParseCallback"),b0=Symbol("isGlobalContext"),sD=Symbol("postProcess"),t0=Symbol("rebase"),BF=Symbol("reset"),Gu=Symbol("runYargsParserAndExecuteCommands"),fF=Symbol("runValidation"),n0=Symbol("setHasOutput"),rD=Symbol("kTrackManuallySetKeys"),X8="en_US";class p0{constructor(D=[],u,F,E){this.customScriptName=!1,this.parsed=!1,uD.set(this,void 0),vD.set(this,void 0),zu.set(this,{commands:[],fullCommands:[]}),ZD.set(this,null),QD.set(this,null),Wu.set(this,"show-hidden"),wD.set(this,null),mD.set(this,!0),Uu.set(this,{}),WD.set(this,!0),Nu.set(this,[]),UD.set(this,void 0),VD.set(this,{}),OD.set(this,!1),ND.set(this,null),Ru.set(this,!0),iD.set(this,void 0),hD.set(this,""),K.set(this,void 0),ju.set(this,void 0),qu.set(this,{}),TD.set(this,null),dD.set(this,null),Fu.set(this,{}),oD.set(this,{}),bD.set(this,void 0),Hu.set(this,!1),P.set(this,void 0),kD.set(this,!1),gD.set(this,!1),lD.set(this,!1),b.set(this,void 0),Iu.set(this,{}),_D.set(this,null),r.set(this,void 0),H(this,P,E,"f"),H(this,bD,D,"f"),H(this,vD,u,"f"),H(this,ju,F,"f"),H(this,UD,new lu(this),"f"),this.$0=this[q0](),this[BF](),H(this,uD,B(this,uD,"f"),"f"),H(this,b,B(this,b,"f"),"f"),H(this,r,B(this,r,"f"),"f"),H(this,K,B(this,K,"f"),"f"),B(this,K,"f").showHiddenOpt=B(this,Wu,"f"),H(this,iD,this[N0](),"f"),B(this,P,"f").y18n.setLocale(X8)}addHelpOpt(D,u){if(q("[string|boolean] [string]",[D,u],arguments.length),B(this,ND,"f"))this[ru](B(this,ND,"f")),H(this,ND,null,"f");if(D===!1&&u===void 0)return this;return H(this,ND,typeof D==="string"?D:"help","f"),this.boolean(B(this,ND,"f")),this.describe(B(this,ND,"f"),u||B(this,b,"f").deferY18nLookup("Show help")),this}help(D,u){return this.addHelpOpt(D,u)}addShowHiddenOpt(D,u){if(q("[string|boolean] [string]",[D,u],arguments.length),D===!1&&u===void 0)return this;let F=typeof D==="string"?D:B(this,Wu,"f");return this.boolean(F),this.describe(F,u||B(this,b,"f").deferY18nLookup("Show hidden options")),B(this,K,"f").showHiddenOpt=F,this}showHidden(D,u){return this.addShowHiddenOpt(D,u)}alias(D,u){return q("<object|string|array> [string|array]",[D,u],arguments.length),this[DF](this.alias.bind(this),"alias",D,u),this}array(D){return q("<array|string>",[D],arguments.length),this[tD]("array",D),this[rD](D),this}boolean(D){return q("<array|string>",[D],arguments.length),this[tD]("boolean",D),this[rD](D),this}check(D,u){return q("<function> [boolean]",[D,u],arguments.length),this.middleware((F,E)=>{return pD(()=>{return D(F,E.getOptions())},(C)=>{if(!C)B(this,b,"f").fail(B(this,P,"f").y18n.__("Argument check failed: %s",D.toString()));else if(typeof C==="string"||C instanceof Error)B(this,b,"f").fail(C.toString(),C);return F},(C)=>{return B(this,b,"f").fail(C.message?C.message:C.toString(),C),F})},!1,u),this}choices(D,u){return q("<object|string|array> [string|array]",[D,u],arguments.length),this[DF](this.choices.bind(this),"choices",D,u),this}coerce(D,u){if(q("<object|string|array> [function]",[D,u],arguments.length),Array.isArray(D)){if(!u)throw new DD("coerce callback must be provided");for(let E of D)this.coerce(E,u);return this}else if(typeof D==="object"){for(let E of Object.keys(D))this.coerce(E,D[E]);return this}if(!u)throw new DD("coerce callback must be provided");let F=D;return B(this,K,"f").key[F]=!0,B(this,UD,"f").addCoerceMiddleware((E,C)=>{var f;let $=(f=C.getAliases()[F])!==null&&f!==void 0?f:[],G=[F,...$].filter((J)=>Object.prototype.hasOwnProperty.call(E,J));if(G.length===0)return E;return pD(()=>{return u(E[G[0]])},(J)=>{return G.forEach((Y)=>{E[Y]=J}),E},(J)=>{throw new DD(J.message)})},F),this}conflicts(D,u){return q("<string|object> [string|array]",[D,u],arguments.length),B(this,r,"f").conflicts(D,u),this}config(D="config",u,F){if(q("[object|string] [string|function] [function]",[D,u,F],arguments.length),typeof D==="object"&&!Array.isArray(D))return D=hu(D,B(this,vD,"f"),this[yD]()["deep-merge-config"]||!1,B(this,P,"f")),B(this,K,"f").configObjects=(B(this,K,"f").configObjects||[]).concat(D),this;if(typeof u==="function")F=u,u=void 0;return this.describe(D,u||B(this,b,"f").deferY18nLookup("Path to JSON config file")),(Array.isArray(D)?D:[D]).forEach((E)=>{B(this,K,"f").config[E]=F||!0}),this}completion(D,u,F){if(q("[string] [string|boolean|function] [function]",[D,u,F],arguments.length),typeof u==="function")F=u,u=void 0;if(H(this,QD,D||B(this,QD,"f")||"completion","f"),!u&&u!==!1)u="generate completion script";if(this.command(B(this,QD,"f"),u),F)B(this,ZD,"f").registerFunction(F);return this}command(D,u,F,E,C,f){return q("<string|array|object> [string|boolean] [function|object] [function] [array] [boolean|string]",[D,u,F,E,C,f],arguments.length),B(this,uD,"f").addHandler(D,u,F,E,C,f),this}commands(D,u,F,E,C,f){return this.command(D,u,F,E,C,f)}commandDir(D,u){q("<string> [object]",[D,u],arguments.length);let F=B(this,ju,"f")||B(this,P,"f").require;return B(this,uD,"f").addDirectory(D,F,B(this,P,"f").getCallerFile(),u),this}count(D){return q("<array|string>",[D],arguments.length),this[tD]("count",D),this[rD](D),this}default(D,u,F){if(q("<object|string|array> [*] [string]",[D,u,F],arguments.length),F)gu(D,B(this,P,"f")),B(this,K,"f").defaultDescription[D]=F;if(typeof u==="function"){if(gu(D,B(this,P,"f")),!B(this,K,"f").defaultDescription[D])B(this,K,"f").defaultDescription[D]=B(this,b,"f").functionDescription(u);u=u.call()}return this[Eu](this.default.bind(this),"default",D,u),this}defaults(D,u,F){return this.default(D,u,F)}demandCommand(D=1,u,F,E){if(q("[number] [number|string] [string|null|undefined] [string|null|undefined]",[D,u,F,E],arguments.length),typeof u!=="number")F=u,u=1/0;return this.global("_",!1),B(this,K,"f").demandedCommands._={min:D,max:u,minMsg:F,maxMsg:E},this}demand(D,u,F){if(Array.isArray(u))u.forEach((E)=>{XD(F,!0,B(this,P,"f")),this.demandOption(E,F)}),u=1/0;else if(typeof u!=="number")F=u,u=1/0;if(typeof D==="number")XD(F,!0,B(this,P,"f")),this.demandCommand(D,u,F,F);else if(Array.isArray(D))D.forEach((E)=>{XD(F,!0,B(this,P,"f")),this.demandOption(E,F)});else if(typeof F==="string")this.demandOption(D,F);else if(F===!0||typeof F>"u")this.demandOption(D);return this}demandOption(D,u){return q("<object|string|array> [string]",[D,u],arguments.length),this[Eu](this.demandOption.bind(this),"demandedOptions",D,u),this}deprecateOption(D,u){return q("<string> [string|boolean]",[D,u],arguments.length),B(this,K,"f").deprecatedOptions[D]=u,this}describe(D,u){return q("<object|string|array> [string]",[D,u],arguments.length),this[EF](D,!0),B(this,b,"f").describe(D,u),this}detectLocale(D){return q("<boolean>",[D],arguments.length),H(this,mD,D,"f"),this}env(D){if(q("[string|boolean]",[D],arguments.length),D===!1)delete B(this,K,"f").envPrefix;else B(this,K,"f").envPrefix=D||"";return this}epilogue(D){return q("<string>",[D],arguments.length),B(this,b,"f").epilog(D),this}epilog(D){return this.epilogue(D)}example(D,u){if(q("<string|array> [string]",[D,u],arguments.length),Array.isArray(D))D.forEach((F)=>this.example(...F));else B(this,b,"f").example(D,u);return this}exit(D,u){if(H(this,OD,!0,"f"),H(this,wD,u,"f"),B(this,WD,"f"))B(this,P,"f").process.exit(D)}exitProcess(D=!0){return q("[boolean]",[D],arguments.length),H(this,WD,D,"f"),this}fail(D){if(q("<function|boolean>",[D],arguments.length),typeof D==="boolean"&&D!==!1)throw new DD("Invalid first argument. Expected function or boolean 'false'");return B(this,b,"f").failFn(D),this}getAliases(){return this.parsed?this.parsed.aliases:{}}async getCompletion(D,u){if(q("<array> [function]",[D,u],arguments.length),!u)return new Promise((F,E)=>{B(this,ZD,"f").getCompletion(D,(C,f)=>{if(C)E(C);else F(f)})});else return B(this,ZD,"f").getCompletion(D,u)}getDemandedOptions(){return q([],0),B(this,K,"f").demandedOptions}getDemandedCommands(){return q([],0),B(this,K,"f").demandedCommands}getDeprecatedOptions(){return q([],0),B(this,K,"f").deprecatedOptions}getDetectLocale(){return B(this,mD,"f")}getExitProcess(){return B(this,WD,"f")}getGroups(){return Object.assign({},B(this,VD,"f"),B(this,oD,"f"))}getHelp(){if(H(this,OD,!0,"f"),!B(this,b,"f").hasCachedHelpMessage()){if(!this.parsed){let u=this[Gu](B(this,bD,"f"),void 0,void 0,0,!0);if(l(u))return u.then(()=>{return B(this,b,"f").help()})}let D=B(this,uD,"f").runDefaultBuilderOn(this);if(l(D))return D.then(()=>{return B(this,b,"f").help()})}return Promise.resolve(B(this,b,"f").help())}getOptions(){return B(this,K,"f")}getStrict(){return B(this,kD,"f")}getStrictCommands(){return B(this,gD,"f")}getStrictOptions(){return B(this,lD,"f")}global(D,u){if(q("<string|array> [boolean]",[D,u],arguments.length),D=[].concat(D),u!==!1)B(this,K,"f").local=B(this,K,"f").local.filter((F)=>D.indexOf(F)===-1);else D.forEach((F)=>{if(!B(this,K,"f").local.includes(F))B(this,K,"f").local.push(F)});return this}group(D,u){q("<string|array> <string>",[D,u],arguments.length);let F=B(this,oD,"f")[u]||B(this,VD,"f")[u];if(B(this,oD,"f")[u])delete B(this,oD,"f")[u];let E={};return B(this,VD,"f")[u]=(F||[]).concat(D).filter((C)=>{if(E[C])return!1;return E[C]=!0}),this}hide(D){return q("<string>",[D],arguments.length),B(this,K,"f").hiddenOptions.push(D),this}implies(D,u){return q("<string|object> [number|string|array]",[D,u],arguments.length),B(this,r,"f").implies(D,u),this}locale(D){if(q("[string]",[D],arguments.length),D===void 0)return this[au](),B(this,P,"f").y18n.getLocale();return H(this,mD,!1,"f"),B(this,P,"f").y18n.setLocale(D),this}middleware(D,u,F){return B(this,UD,"f").addMiddleware(D,!!u,F)}nargs(D,u){return q("<string|object|array> [number]",[D,u],arguments.length),this[Eu](this.nargs.bind(this),"narg",D,u),this}normalize(D){return q("<array|string>",[D],arguments.length),this[tD]("normalize",D),this}number(D){return q("<array|string>",[D],arguments.length),this[tD]("number",D),this[rD](D),this}option(D,u){if(q("<string|object> [object]",[D,u],arguments.length),typeof D==="object")Object.keys(D).forEach((F)=>{this.options(F,D[F])});else{if(typeof u!=="object")u={};if(this[rD](D),B(this,_D,"f")&&(D==="version"||(u===null||u===void 0?void 0:u.alias)==="version"))this[R0](['"version" is a reserved word.',"Please do one of the following:",'- Disable version with `yargs.version(false)` if using "version" as an option',"- Use the built-in `yargs.version` method instead (if applicable)","- Use a different option key","https://yargs.js.org/docs/#api-reference-version"].join(`
78
78
  `),void 0,"versionWarning");if(B(this,K,"f").key[D]=!0,u.alias)this.alias(D,u.alias);let F=u.deprecate||u.deprecated;if(F)this.deprecateOption(D,F);let E=u.demand||u.required||u.require;if(E)this.demand(D,E);if(u.demandOption)this.demandOption(D,typeof u.demandOption==="string"?u.demandOption:void 0);if(u.conflicts)this.conflicts(D,u.conflicts);if("default"in u)this.default(D,u.default);if(u.implies!==void 0)this.implies(D,u.implies);if(u.nargs!==void 0)this.nargs(D,u.nargs);if(u.config)this.config(D,u.configParser);if(u.normalize)this.normalize(D);if(u.choices)this.choices(D,u.choices);if(u.coerce)this.coerce(D,u.coerce);if(u.group)this.group(D,u.group);if(u.boolean||u.type==="boolean"){if(this.boolean(D),u.alias)this.boolean(u.alias)}if(u.array||u.type==="array"){if(this.array(D),u.alias)this.array(u.alias)}if(u.number||u.type==="number"){if(this.number(D),u.alias)this.number(u.alias)}if(u.string||u.type==="string"){if(this.string(D),u.alias)this.string(u.alias)}if(u.count||u.type==="count")this.count(D);if(typeof u.global==="boolean")this.global(D,u.global);if(u.defaultDescription)B(this,K,"f").defaultDescription[D]=u.defaultDescription;if(u.skipValidation)this.skipValidation(D);let C=u.describe||u.description||u.desc,f=B(this,b,"f").getDescriptions();if(!Object.prototype.hasOwnProperty.call(f,D)||typeof C==="string")this.describe(D,C);if(u.hidden)this.hide(D);if(u.requiresArg)this.requiresArg(D)}return this}options(D,u){return this.option(D,u)}parse(D,u,F){if(q("[string|array] [function|boolean|object] [function]",[D,u,F],arguments.length),this[j0](),typeof D>"u")D=B(this,bD,"f");if(typeof u==="object")H(this,dD,u,"f"),u=F;if(typeof u==="function")H(this,TD,u,"f"),u=!1;if(!u)H(this,bD,D,"f");if(B(this,TD,"f"))H(this,WD,!1,"f");let E=this[Gu](D,!!u),C=this.parsed;if(B(this,ZD,"f").setParsed(this.parsed),l(E))return E.then((f)=>{if(B(this,TD,"f"))B(this,TD,"f").call(this,B(this,wD,"f"),f,B(this,hD,"f"));return f}).catch((f)=>{if(B(this,TD,"f"))B(this,TD,"f")(f,this.parsed.argv,B(this,hD,"f"));throw f}).finally(()=>{this[CF](),this.parsed=C});else{if(B(this,TD,"f"))B(this,TD,"f").call(this,B(this,wD,"f"),E,B(this,hD,"f"));this[CF](),this.parsed=C}return E}parseAsync(D,u,F){let E=this.parse(D,u,F);return!l(E)?Promise.resolve(E):E}parseSync(D,u,F){let E=this.parse(D,u,F);if(l(E))throw new DD(".parseSync() must not be used with asynchronous builders, handlers, or middleware");return E}parserConfiguration(D){return q("<object>",[D],arguments.length),H(this,qu,D,"f"),this}pkgConf(D,u){q("<string> [string]",[D,u],arguments.length);let F=null,E=this[eu](u||B(this,vD,"f"));if(E[D]&&typeof E[D]==="object")F=hu(E[D],u||B(this,vD,"f"),this[yD]()["deep-merge-config"]||!1,B(this,P,"f")),B(this,K,"f").configObjects=(B(this,K,"f").configObjects||[]).concat(F);return this}positional(D,u){q("<string> <object>",[D,u],arguments.length);let F=["default","defaultDescription","implies","normalize","choices","conflicts","coerce","type","describe","desc","description","alias"];u=xD(u,(f,$)=>{if(f==="type"&&!["string","number","boolean"].includes($))return!1;return F.includes(f)});let E=B(this,zu,"f").fullCommands[B(this,zu,"f").fullCommands.length-1],C=E?B(this,uD,"f").cmdToParseOptions(E):{array:[],alias:{},default:{},demand:{}};return Du(C).forEach((f)=>{let $=C[f];if(Array.isArray($)){if($.indexOf(D)!==-1)u[f]=!0}else if($[D]&&!(f in u))u[f]=$[D]}),this.group(D,B(this,b,"f").getPositionalGroupName()),this.option(D,u)}recommendCommands(D=!0){return q("[boolean]",[D],arguments.length),H(this,Hu,D,"f"),this}required(D,u,F){return this.demand(D,u,F)}require(D,u,F){return this.demand(D,u,F)}requiresArg(D){if(q("<array|string|object> [number]",[D],arguments.length),typeof D==="string"&&B(this,K,"f").narg[D])return this;else this[Eu](this.requiresArg.bind(this),"narg",D,NaN);return this}showCompletionScript(D,u){return q("[string] [string]",[D,u],arguments.length),D=D||this.$0,B(this,iD,"f").log(B(this,ZD,"f").generateCompletionScript(D,u||B(this,QD,"f")||"completion")),this}showHelp(D){if(q("[string|function]",[D],arguments.length),H(this,OD,!0,"f"),!B(this,b,"f").hasCachedHelpMessage()){if(!this.parsed){let F=this[Gu](B(this,bD,"f"),void 0,void 0,0,!0);if(l(F))return F.then(()=>{B(this,b,"f").showHelp(D)}),this}let u=B(this,uD,"f").runDefaultBuilderOn(this);if(l(u))return u.then(()=>{B(this,b,"f").showHelp(D)}),this}return B(this,b,"f").showHelp(D),this}scriptName(D){return this.customScriptName=!0,this.$0=D,this}showHelpOnFail(D,u){return q("[boolean|string] [string]",[D,u],arguments.length),B(this,b,"f").showHelpOnFail(D,u),this}showVersion(D){return q("[string|function]",[D],arguments.length),B(this,b,"f").showVersion(D),this}skipValidation(D){return q("<array|string>",[D],arguments.length),this[tD]("skipValidation",D),this}strict(D){return q("[boolean]",[D],arguments.length),H(this,kD,D!==!1,"f"),this}strictCommands(D){return q("[boolean]",[D],arguments.length),H(this,gD,D!==!1,"f"),this}strictOptions(D){return q("[boolean]",[D],arguments.length),H(this,lD,D!==!1,"f"),this}string(D){return q("<array|string>",[D],arguments.length),this[tD]("string",D),this[rD](D),this}terminalWidth(){return q([],0),B(this,P,"f").process.stdColumns}updateLocale(D){return this.updateStrings(D)}updateStrings(D){return q("<object>",[D],arguments.length),H(this,mD,!1,"f"),B(this,P,"f").y18n.updateLocale(D),this}usage(D,u,F,E){if(q("<string|null|undefined> [string|boolean] [function|object] [function]",[D,u,F,E],arguments.length),u!==void 0)if(XD(D,null,B(this,P,"f")),(D||"").match(/^\$0( |$)/))return this.command(D,u,F,E);else throw new DD(".usage() description must start with $0 if being used as alias for .command()");else return B(this,b,"f").usage(D),this}usageConfiguration(D){return q("<object>",[D],arguments.length),H(this,Iu,D,"f"),this}version(D,u,F){if(q("[boolean|string] [string] [string]",[D,u,F],arguments.length),B(this,_D,"f"))this[ru](B(this,_D,"f")),B(this,b,"f").version(void 0),H(this,_D,null,"f");if(arguments.length===0)F=this[I0](),D="version";else if(arguments.length===1){if(D===!1)return this;F=D,D="version"}else if(arguments.length===2)F=u,u=void 0;return H(this,_D,typeof D==="string"?D:"version","f"),u=u||B(this,b,"f").deferY18nLookup("Show version number"),B(this,b,"f").version(F||void 0),this.boolean(B(this,_D,"f")),this.describe(B(this,_D,"f"),u),this}wrap(D){return q("<number|null|undefined>",[D],arguments.length),B(this,b,"f").wrap(D),this}[(uD=new WeakMap,vD=new WeakMap,zu=new WeakMap,ZD=new WeakMap,QD=new WeakMap,Wu=new WeakMap,wD=new WeakMap,mD=new WeakMap,Uu=new WeakMap,WD=new WeakMap,Nu=new WeakMap,UD=new WeakMap,VD=new WeakMap,OD=new WeakMap,ND=new WeakMap,Ru=new WeakMap,iD=new WeakMap,hD=new WeakMap,K=new WeakMap,ju=new WeakMap,qu=new WeakMap,TD=new WeakMap,dD=new WeakMap,Fu=new WeakMap,oD=new WeakMap,bD=new WeakMap,Hu=new WeakMap,P=new WeakMap,kD=new WeakMap,gD=new WeakMap,lD=new WeakMap,b=new WeakMap,Iu=new WeakMap,_D=new WeakMap,r=new WeakMap,U0)](D){if(!D._||!D["--"])return D;D._.push.apply(D._,D["--"]);try{delete D["--"]}catch(u){}return D}[N0](){return{log:(...D)=>{if(!this[Vu]())console.log(...D);if(H(this,OD,!0,"f"),B(this,hD,"f").length)H(this,hD,B(this,hD,"f")+`
79
79
  `,"f");H(this,hD,B(this,hD,"f")+D.join(" "),"f")},error:(...D)=>{if(!this[Vu]())console.error(...D);if(H(this,OD,!0,"f"),B(this,hD,"f").length)H(this,hD,B(this,hD,"f")+`
80
- `,"f");H(this,hD,B(this,hD,"f")+D.join(" "),"f")}}}[ru](D){Du(B(this,K,"f")).forEach((u)=>{if(((E)=>E==="configObjects")(u))return;let F=B(this,K,"f")[u];if(Array.isArray(F)){if(F.includes(D))F.splice(F.indexOf(D),1)}else if(typeof F==="object")delete F[D]}),delete B(this,b,"f").getDescriptions()[D]}[R0](D,u,F){if(!B(this,Uu,"f")[F])B(this,P,"f").process.emitWarning(D,u),B(this,Uu,"f")[F]=!0}[j0](){B(this,Nu,"f").push({options:B(this,K,"f"),configObjects:B(this,K,"f").configObjects.slice(0),exitProcess:B(this,WD,"f"),groups:B(this,VD,"f"),strict:B(this,kD,"f"),strictCommands:B(this,gD,"f"),strictOptions:B(this,lD,"f"),completionCommand:B(this,QD,"f"),output:B(this,hD,"f"),exitError:B(this,wD,"f"),hasOutput:B(this,OD,"f"),parsed:this.parsed,parseFn:B(this,TD,"f"),parseContext:B(this,dD,"f")}),B(this,b,"f").freeze(),B(this,r,"f").freeze(),B(this,uD,"f").freeze(),B(this,UD,"f").freeze()}[q0](){let D="",u;if(/\b(node|iojs|electron)(\.exe)?$/.test(B(this,P,"f").process.argv()[0]))u=B(this,P,"f").process.argv().slice(1,2);else u=B(this,P,"f").process.argv().slice(0,1);if(D=u.map((F)=>{let E=this[t0](B(this,vD,"f"),F);return F.match(/^(\/|([a-zA-Z]:)?\\)/)&&E.length<F.length?E:F}).join(" ").trim(),B(this,P,"f").getEnv("_")&&B(this,P,"f").getProcessArgvBin()===B(this,P,"f").getEnv("_"))D=B(this,P,"f").getEnv("_").replace(`${B(this,P,"f").path.dirname(B(this,P,"f").process.execPath())}/`,"");return D}[yD](){return B(this,qu,"f")}[H0](){return B(this,Iu,"f")}[au](){if(!B(this,mD,"f"))return;let D=B(this,P,"f").getEnv("LC_ALL")||B(this,P,"f").getEnv("LC_MESSAGES")||B(this,P,"f").getEnv("LANG")||B(this,P,"f").getEnv("LANGUAGE")||"en_US";this.locale(D.replace(/[.:].*/,""))}[I0](){return this[eu]().version||"unknown"}[V0](D){let u=D["--"]?D["--"]:D._;for(let F=0,E;(E=u[F])!==void 0;F++)if(B(this,P,"f").Parser.looksLikeNumber(E)&&Number.isSafeInteger(Math.floor(parseFloat(`${E}`))))u[F]=Number(E);return D}[eu](D){let u=D||"*";if(B(this,Fu,"f")[u])return B(this,Fu,"f")[u];let F={};try{let E=D||B(this,P,"f").mainFilename;if(B(this,P,"f").path.extname(E))E=B(this,P,"f").path.dirname(E);let C=B(this,P,"f").findUp(E,(f,$)=>{if($.includes("package.json"))return"package.json";else return});XD(C,void 0,B(this,P,"f")),F=JSON.parse(B(this,P,"f").readFileSync(C,"utf8"))}catch(E){}return B(this,Fu,"f")[u]=F||{},B(this,Fu,"f")[u]}[tD](D,u){u=[].concat(u),u.forEach((F)=>{F=this[FF](F),B(this,K,"f")[D].push(F)})}[Eu](D,u,F,E){this[uF](D,u,F,E,(C,f,$)=>{B(this,K,"f")[C][f]=$})}[DF](D,u,F,E){this[uF](D,u,F,E,(C,f,$)=>{B(this,K,"f")[C][f]=(B(this,K,"f")[C][f]||[]).concat($)})}[uF](D,u,F,E,C){if(Array.isArray(F))F.forEach((f)=>{D(f,E)});else if(((f)=>typeof f==="object")(F))for(let f of Du(F))D(f,F[f]);else C(u,this[FF](F),E)}[FF](D){if(D==="__proto__")return"___proto___";return D}[EF](D,u){return this[Eu](this[EF].bind(this),"key",D,u),this}[CF](){var D,u,F,E,C,f,$,G,J,Y,U,Q;let X=B(this,Nu,"f").pop();XD(X,void 0,B(this,P,"f"));let O;D=this,u=this,F=this,E=this,C=this,f=this,$=this,G=this,J=this,Y=this,U=this,Q=this,{options:{set value(W){H(D,K,W,"f")}}.value,configObjects:O,exitProcess:{set value(W){H(u,WD,W,"f")}}.value,groups:{set value(W){H(F,VD,W,"f")}}.value,output:{set value(W){H(E,hD,W,"f")}}.value,exitError:{set value(W){H(C,wD,W,"f")}}.value,hasOutput:{set value(W){H(f,OD,W,"f")}}.value,parsed:this.parsed,strict:{set value(W){H($,kD,W,"f")}}.value,strictCommands:{set value(W){H(G,gD,W,"f")}}.value,strictOptions:{set value(W){H(J,lD,W,"f")}}.value,completionCommand:{set value(W){H(Y,QD,W,"f")}}.value,parseFn:{set value(W){H(U,TD,W,"f")}}.value,parseContext:{set value(W){H(Q,dD,W,"f")}}.value}=X,B(this,K,"f").configObjects=O,B(this,b,"f").unfreeze(),B(this,r,"f").unfreeze(),B(this,uD,"f").unfreeze(),B(this,UD,"f").unfreeze()}[_0](D,u){return pD(u,(F)=>{return D(F),F})}getInternalMethods(){return{getCommandInstance:this[K0].bind(this),getContext:this[L0].bind(this),getHasOutput:this[A0].bind(this),getLoggerInstance:this[S0].bind(this),getParseContext:this[x0].bind(this),getParserConfiguration:this[yD].bind(this),getUsageConfiguration:this[H0].bind(this),getUsageInstance:this[P0].bind(this),getValidationInstance:this[w0].bind(this),hasParseCallback:this[Vu].bind(this),isGlobalContext:this[b0].bind(this),postProcess:this[sD].bind(this),reset:this[BF].bind(this),runValidation:this[fF].bind(this),runYargsParserAndExecuteCommands:this[Gu].bind(this),setHasOutput:this[n0].bind(this)}}[K0](){return B(this,uD,"f")}[L0](){return B(this,zu,"f")}[A0](){return B(this,OD,"f")}[S0](){return B(this,iD,"f")}[x0](){return B(this,dD,"f")||{}}[P0](){return B(this,b,"f")}[w0](){return B(this,r,"f")}[Vu](){return!!B(this,TD,"f")}[b0](){return B(this,Ru,"f")}[sD](D,u,F,E){if(F)return D;if(l(D))return D;if(!u)D=this[U0](D);if(this[yD]()["parse-positional-numbers"]||this[yD]()["parse-positional-numbers"]===void 0)D=this[V0](D);if(E)D=cD(D,this,B(this,UD,"f").getMiddleware(),!1);return D}[BF](D={}){H(this,K,B(this,K,"f")||{},"f");let u={};u.local=B(this,K,"f").local||[],u.configObjects=B(this,K,"f").configObjects||[];let F={};u.local.forEach((f)=>{F[f]=!0,(D[f]||[]).forEach(($)=>{F[$]=!0})}),Object.assign(B(this,oD,"f"),Object.keys(B(this,VD,"f")).reduce((f,$)=>{let G=B(this,VD,"f")[$].filter((J)=>!(J in F));if(G.length>0)f[$]=G;return f},{})),H(this,VD,{},"f");let E=["array","boolean","string","skipValidation","count","normalize","number","hiddenOptions"],C=["narg","key","alias","default","defaultDescription","config","choices","demandedOptions","demandedCommands","deprecatedOptions"];if(E.forEach((f)=>{u[f]=(B(this,K,"f")[f]||[]).filter(($)=>!F[$])}),C.forEach((f)=>{u[f]=xD(B(this,K,"f")[f],($)=>!F[$])}),u.envPrefix=B(this,K,"f").envPrefix,H(this,K,u,"f"),H(this,b,B(this,b,"f")?B(this,b,"f").reset(F):M0(this,B(this,P,"f")),"f"),H(this,r,B(this,r,"f")?B(this,r,"f").reset(F):Y0(this,B(this,b,"f"),B(this,P,"f")),"f"),H(this,uD,B(this,uD,"f")?B(this,uD,"f").reset():h0(B(this,b,"f"),B(this,r,"f"),B(this,UD,"f"),B(this,P,"f")),"f"),!B(this,ZD,"f"))H(this,ZD,Q0(this,B(this,b,"f"),B(this,uD,"f"),B(this,P,"f")),"f");return B(this,UD,"f").reset(),H(this,QD,null,"f"),H(this,hD,"","f"),H(this,wD,null,"f"),H(this,OD,!1,"f"),this.parsed=!1,this}[t0](D,u){return B(this,P,"f").path.relative(D,u)}[Gu](D,u,F,E=0,C=!1){var f,$,G,J;let Y=!!F||C;D=D||B(this,bD,"f"),B(this,K,"f").__=B(this,P,"f").y18n.__,B(this,K,"f").configuration=this[yD]();let U=!!B(this,K,"f").configuration["populate--"],Q=Object.assign({},B(this,K,"f").configuration,{"populate--":!0}),X=B(this,P,"f").Parser.detailed(D,Object.assign({},B(this,K,"f"),{configuration:{"parse-positional-numbers":!1,...Q}})),O=Object.assign(X.argv,B(this,dD,"f")),W=void 0,Z=X.aliases,A=!1,v=!1;if(Object.keys(O).forEach((n)=>{if(n===B(this,ND,"f")&&O[n])A=!0;else if(n===B(this,_D,"f")&&O[n])v=!0}),O.$0=this.$0,this.parsed=X,E===0)B(this,b,"f").clearCachedHelpMessage();try{if(this[au](),u)return this[sD](O,U,!!F,!1);if(B(this,ND,"f")){if([B(this,ND,"f")].concat(Z[B(this,ND,"f")]||[]).filter((ED)=>ED.length>1).includes(""+O._[O._.length-1]))O._.pop(),A=!0}H(this,Ru,!1,"f");let n=B(this,uD,"f").getCommands(),GD=((f=B(this,ZD,"f"))===null||f===void 0?void 0:f.completionKey)?[($=B(this,ZD,"f"))===null||$===void 0?void 0:$.completionKey,...(J=this.getAliases()[(G=B(this,ZD,"f"))===null||G===void 0?void 0:G.completionKey])!==null&&J!==void 0?J:[]].some((g)=>Object.prototype.hasOwnProperty.call(O,g)):!1,t=A||GD||C;if(O._.length){if(n.length){let g;for(let ED=E||0,a;O._[ED]!==void 0;ED++)if(a=String(O._[ED]),n.includes(a)&&a!==B(this,QD,"f")){let ID=B(this,uD,"f").runCommand(a,this,X,ED+1,C,A||v||C);return this[sD](ID,U,!!F,!1)}else if(!g&&a!==B(this,QD,"f")){g=a;break}if(!B(this,uD,"f").hasDefaultCommand()&&B(this,Hu,"f")&&g&&!t)B(this,r,"f").recommendCommands(g,n)}if(B(this,QD,"f")&&O._.includes(B(this,QD,"f"))&&!GD){if(B(this,WD,"f"))PD(!0);this.showCompletionScript(),this.exit(0)}}if(B(this,uD,"f").hasDefaultCommand()&&!t){let g=B(this,uD,"f").runCommand(null,this,X,0,C,A||v||C);return this[sD](g,U,!!F,!1)}if(GD){if(B(this,WD,"f"))PD(!0);D=[].concat(D);let g=D.slice(D.indexOf(`--${B(this,ZD,"f").completionKey}`)+1);return B(this,ZD,"f").getCompletion(g,(ED,a)=>{if(ED)throw new DD(ED.message);(a||[]).forEach((ID)=>{B(this,iD,"f").log(ID)}),this.exit(0)}),this[sD](O,!U,!!F,!1)}if(!B(this,OD,"f")){if(A){if(B(this,WD,"f"))PD(!0);Y=!0,this.showHelp((g)=>{B(this,iD,"f").log(g),this.exit(0)})}else if(v){if(B(this,WD,"f"))PD(!0);Y=!0,B(this,b,"f").showVersion("log"),this.exit(0)}}if(!Y&&B(this,K,"f").skipValidation.length>0)Y=Object.keys(O).some((g)=>B(this,K,"f").skipValidation.indexOf(g)>=0&&O[g]===!0);if(!Y){if(X.error)throw new DD(X.error.message);if(!GD){let g=this[fF](Z,{},X.error);if(!F)W=cD(O,this,B(this,UD,"f").getMiddleware(),!0);if(W=this[_0](g,W!==null&&W!==void 0?W:O),l(W)&&!F)W=W.then(()=>{return cD(O,this,B(this,UD,"f").getMiddleware(),!1)})}}}catch(n){if(n instanceof DD)B(this,b,"f").fail(n.message,n);else throw n}return this[sD](W!==null&&W!==void 0?W:O,U,!!F,!0)}[fF](D,u,F,E){let C={...this.getDemandedOptions()};return(f)=>{if(F)throw new DD(F.message);B(this,r,"f").nonOptionCount(f),B(this,r,"f").requiredArguments(f,C);let $=!1;if(B(this,gD,"f"))$=B(this,r,"f").unknownCommands(f);if(B(this,kD,"f")&&!$)B(this,r,"f").unknownArguments(f,D,u,!!E);else if(B(this,lD,"f"))B(this,r,"f").unknownArguments(f,D,{},!1,!1);B(this,r,"f").limitedChoices(f),B(this,r,"f").implications(f),B(this,r,"f").conflicting(f)}}[n0](){H(this,OD,!0,"f")}[rD](D){if(typeof D==="string")B(this,K,"f").key[D]=!0;else for(let u of D)B(this,K,"f").key[u]=!0}}function z0(D){return!!D&&typeof D.getInternalMethods==="function"}var Z8=c0(ku),v0=Z8;import{EOL as HD}from"os";import e0 from"path";import J8 from"fs";var m0=g0("main");l0("main");var RD=du(process.argv),D2=new Set(["--version","-v"]);if(RD.length===1&&D2.has(RD[0]))process.stdout.write(Lu+HD),process.exit();if(RD.length===2&&RD.some((D)=>D2.has(D))&&RD.includes("--verbose")){let D=process.argv[1],u=(()=>{if(!D||D.startsWith("-"))return;if(D.startsWith("/$bunfs/")||/^B:[\\/]~BUN[\\/]/.test(D))return;let E=e0.resolve(D);if(E===process.execPath)return;try{if(!J8.statSync(E).isFile())return}catch{return}return E})(),F=[`version: ${Lu}`,`channel: ${d0}`,`commit: ${o0}`,`binary: ${process.execPath}`,...u?[`bundle: ${u}`]:[]];process.stdout.write(F.join(HD)+HD),process.exit()}var _u={acp:()=>import("./chunk-9x5232dw.js").then((D)=>D.AcpCommand),mcp:()=>import("./chunk-gbrnn2dk.js").then((D)=>D.McpCommand),attach:()=>import("./chunk-20f83ca0.js").then((D)=>D.AttachCommand),run:()=>import("./chunk-hnctaq8s.js").then((D)=>D.RunCommand),generate:()=>import("./chunk-4d87mhwn.js").then((D)=>D.GenerateCommand),debug:()=>import("./chunk-jcjbr3q7.js").then((D)=>D.DebugCommand),console:()=>import("./chunk-1fswr17z.js").then((D)=>D.ConsoleCommand),providers:()=>import("./chunk-cmbh77cs.js").then((D)=>D.ProvidersCommand),agent:()=>import("./chunk-pf9g671w.js").then((D)=>D.AgentCommand),upgrade:()=>import("./chunk-anwnwfjf.js").then((D)=>D.UpgradeCommand),uninstall:()=>import("./chunk-f8eter69.js").then((D)=>D.UninstallCommand),serve:()=>import("./chunk-fjq3a347.js").then((D)=>D.ServeCommand),models:()=>import("./chunk-9mjz6e27.js").then((D)=>D.ModelsCommand),stats:()=>import("./chunk-6bphjajd.js").then((D)=>D.StatsCommand),usage:()=>import("./chunk-jxswwvr3.js").then((D)=>D.UsageCommand),export:()=>import("./chunk-31mnd3ph.js").then((D)=>D.ExportCommand),import:()=>import("./chunk-6bpe215q.js").then((D)=>D.ImportCommand),github:()=>import("./chunk-z6pwkwdr.js").then((D)=>D.GithubCommand),pr:()=>import("./chunk-qvnb3j71.js").then((D)=>D.PrCommand),session:()=>import("./chunk-3h9rq2wq.js").then((D)=>D.SessionCommand),plugin:()=>import("./chunk-7pfj4x1a.js").then((D)=>D.PluginCommand),plug:()=>import("./chunk-7pfj4x1a.js").then((D)=>D.PluginCommand),auth:()=>import("./chunk-fxdtq2ed.js").then((D)=>D.AuthCommand),qredits:()=>import("./chunk-873skv7w.js").then((D)=>D.QreditsCommand),batch:()=>import("./chunk-c14s0kxq.js").then((D)=>D.BatchCommand),db:()=>import("./chunk-phv9kdq6.js").then((D)=>D.DbCommand),default:()=>import("./chunk-0yt5njh7.js").then((D)=>D.TuiThreadCommand)};function y(D,u,F){return{command:D,describe:u,aliases:F,handler:async()=>{}}}function $F(){return[y("acp","start ACP (Agent Client Protocol) server"),y("mcp","manage MCP (Model Context Protocol) servers"),{command:"$0 [project]",describe:"start qitqode tui",builder:(D)=>D.positional("project",{type:"string",describe:"path to start qitqode in"}).options(s0).options(r0).option("never-ask",{type:"boolean",describe:"start in never-ask mode, auto-decide without asking (permissions excluded)",default:!1}).option("trust",{type:"boolean",describe:"skip workspace trust prompt and trust the directory",default:!1}),handler:async()=>{}},y("attach <url>","attach to a running qitqode server"),y("run [message..]","run qitqode with a message"),y("generate","generate files"),y("debug","debugging and troubleshooting tools"),y("console","manage qitqode accounts"),y("providers","manage AI providers and credentials",["auth"]),y("agent","manage agents"),y("upgrade [target]","upgrade qitqode to the latest or a specific version"),y("uninstall","uninstall qitqode and remove all related files"),y("serve","starts a headless qitqode server"),y("models [provider]","list all available models"),y("stats","show token usage and cost statistics"),y("usage [sessionID]","show per-turn token usage and cost"),y("export [sessionID]","export session data as JSON"),y("import <file>","import session data from JSON file or URL"),y("github","manage GitHub agent"),y("pr <number>","fetch and checkout a GitHub PR branch, then run qitqode"),y("session","manage sessions"),y("plugin <module>","install plugin and update config",["plug"]),y("auth <command>","Sign in or out of Forgewise"),y("qredits <command>","Check Qredits balance and spend history"),y("batch <command>","Submit and poll async batch LLM jobs"),y("db","database tools")]}function zF(D){let u=new Set(["--log-level","--model","-m","--session","-s","--prompt","--agent","--port","--hostname","--mdns-domain","--cors"]);for(let F=0;F<D.length;F++){let E=D[F];if(E==="--")return;if(E.startsWith("-")){if(u.has(E))F++;continue}return E}}function Q8(D){return D.length>0&&D.every((u)=>u==="--help"||u==="-h")}function O8(D){return D.includes("--help")||D.includes("-h")}async function T8(D){let u=zF(D);if(D.includes("--get-yargs-completions")||u==="completion")return $F();if(Q8(D))return $F();else if(u&&u in _u)return[await _u[u]()];else if(O8(D))return $F();else return[await _u.default()]}function u2(D){let u=D.trimStart();if(!u.startsWith("qitqode ")){process.stderr.write(Ku.logo()+HD+HD),process.stderr.write(u);return}process.stderr.write(D)}var Mu=y0(v0(RD)).middleware(async(D)=>{if(D.pure)process.env.QITQODE_PURE="1";let u=await import("./chunk-6t1ehq36.js"),{Filesystem:F}=await import("./chunk-csz0dgyp.js"),{Heap:E}=await import("./chunk-f2btnww9.js"),{Global:C}=await import("./chunk-0w0ctb90.js");await u.init({print:process.argv.includes("--print-logs"),dev:hF,level:(()=>{if(D.logLevel)return D.logLevel;if(hF)return"DEBUG";return"INFO"})()}),E.start(),(await import("./chunk-bgw4fvg2.js")).startRefresh(),process.env.AGENT="1",process.env.QITQODE="1",process.env.QITQODE_PID=String(process.pid),u.Default.info("qitqode",{version:Lu,command:zF(RD)??"tui",process_role:m0.processRole,run_id:m0.runID});let $=e0.join(C.Path.data,"qitqode.db");if(!await F.exists($)){let{JsonMigration:G,Database:J}=await import("./chunk-ez8vkgfz.js"),{drizzle:Y}=await import("./chunk-7mke41x0.js"),U=process.stderr.isTTY;process.stderr.write("Performing one time database migration, may take a few minutes..."+HD);let Q=-1;if(U)process.stderr.write("\x1B[?25l");try{await G.run(Y({client:J.Client().$client}),{progress:(X)=>{let O=Math.floor(X.current/X.total*100);if(O===Q&&X.current!==X.total)return;if(Q=O,U){if(process.stderr.write(a0(O,`${X.label.padEnd(12)} ${X.current}/${X.total}`)),X.current===X.total)process.stderr.write(`
81
- `)}else process.stderr.write(`sqlite-migration:${O}${HD}`)}})}finally{if(U)process.stderr.write("\x1B[?25h");else process.stderr.write(`sqlite-migration:done${HD}`)}process.stderr.write("Database migration complete."+HD)}if(!process.env.QITQODE_DISABLE_CLAUDE_IMPORT&&!process.env.QITQODE_CLAUDE_IMPORTED){process.env.QITQODE_CLAUDE_IMPORTED="1";let G=async()=>{try{let{ClaudeImport:U}=await import("./chunk-mh0j6dzy.js");await U.run()}catch(U){u.Default.warn("claude-import failed",{e:GF(U)})}},J=zF(RD);if(!J||!(J in _u))G();else await G()}}).usage("").completion("completion","generate shell completion script");for(let D of await T8(RD))Mu.command(D);Mu.fail((D,u)=>{if(D?.startsWith("Unknown argument")||D?.startsWith("Not enough non-option arguments")||D?.startsWith("Invalid values:")){if(u)throw u;Mu.showHelp(u2)}if(u)throw u;process.exit(1)}).strict();try{if(RD.includes("-h")||RD.includes("--help"))await Mu.parse(RD,(D,u,F)=>{if(D)throw D;if(!F)return;u2(F)});else await Mu.parse()}catch(D){let u={};if(D instanceof i0){let C=D.toObject();Object.assign(u,{...C.data})}if(D instanceof Error)Object.assign(u,{name:D.name,message:D.message,cause:D.cause?.toString(),stack:D.stack});if(D instanceof ResolveMessage)Object.assign(u,{name:D.name,message:D.message,code:D.code,specifier:D.specifier,referrer:D.referrer,position:D.position,importKind:D.importKind});let F=await import("./chunk-6t1ehq36.js");F.Default.error("fatal",u);let E=k0(D);if(E)Ku.error(E);if(E===void 0)Ku.error("Unexpected error, check log file at "+F.file()+" for more details"+HD),process.stderr.write(GF(D)+HD);process.exitCode=1}finally{process.exit()}
80
+ `,"f");H(this,hD,B(this,hD,"f")+D.join(" "),"f")}}}[ru](D){Du(B(this,K,"f")).forEach((u)=>{if(((E)=>E==="configObjects")(u))return;let F=B(this,K,"f")[u];if(Array.isArray(F)){if(F.includes(D))F.splice(F.indexOf(D),1)}else if(typeof F==="object")delete F[D]}),delete B(this,b,"f").getDescriptions()[D]}[R0](D,u,F){if(!B(this,Uu,"f")[F])B(this,P,"f").process.emitWarning(D,u),B(this,Uu,"f")[F]=!0}[j0](){B(this,Nu,"f").push({options:B(this,K,"f"),configObjects:B(this,K,"f").configObjects.slice(0),exitProcess:B(this,WD,"f"),groups:B(this,VD,"f"),strict:B(this,kD,"f"),strictCommands:B(this,gD,"f"),strictOptions:B(this,lD,"f"),completionCommand:B(this,QD,"f"),output:B(this,hD,"f"),exitError:B(this,wD,"f"),hasOutput:B(this,OD,"f"),parsed:this.parsed,parseFn:B(this,TD,"f"),parseContext:B(this,dD,"f")}),B(this,b,"f").freeze(),B(this,r,"f").freeze(),B(this,uD,"f").freeze(),B(this,UD,"f").freeze()}[q0](){let D="",u;if(/\b(node|iojs|electron)(\.exe)?$/.test(B(this,P,"f").process.argv()[0]))u=B(this,P,"f").process.argv().slice(1,2);else u=B(this,P,"f").process.argv().slice(0,1);if(D=u.map((F)=>{let E=this[t0](B(this,vD,"f"),F);return F.match(/^(\/|([a-zA-Z]:)?\\)/)&&E.length<F.length?E:F}).join(" ").trim(),B(this,P,"f").getEnv("_")&&B(this,P,"f").getProcessArgvBin()===B(this,P,"f").getEnv("_"))D=B(this,P,"f").getEnv("_").replace(`${B(this,P,"f").path.dirname(B(this,P,"f").process.execPath())}/`,"");return D}[yD](){return B(this,qu,"f")}[H0](){return B(this,Iu,"f")}[au](){if(!B(this,mD,"f"))return;let D=B(this,P,"f").getEnv("LC_ALL")||B(this,P,"f").getEnv("LC_MESSAGES")||B(this,P,"f").getEnv("LANG")||B(this,P,"f").getEnv("LANGUAGE")||"en_US";this.locale(D.replace(/[.:].*/,""))}[I0](){return this[eu]().version||"unknown"}[V0](D){let u=D["--"]?D["--"]:D._;for(let F=0,E;(E=u[F])!==void 0;F++)if(B(this,P,"f").Parser.looksLikeNumber(E)&&Number.isSafeInteger(Math.floor(parseFloat(`${E}`))))u[F]=Number(E);return D}[eu](D){let u=D||"*";if(B(this,Fu,"f")[u])return B(this,Fu,"f")[u];let F={};try{let E=D||B(this,P,"f").mainFilename;if(B(this,P,"f").path.extname(E))E=B(this,P,"f").path.dirname(E);let C=B(this,P,"f").findUp(E,(f,$)=>{if($.includes("package.json"))return"package.json";else return});XD(C,void 0,B(this,P,"f")),F=JSON.parse(B(this,P,"f").readFileSync(C,"utf8"))}catch(E){}return B(this,Fu,"f")[u]=F||{},B(this,Fu,"f")[u]}[tD](D,u){u=[].concat(u),u.forEach((F)=>{F=this[FF](F),B(this,K,"f")[D].push(F)})}[Eu](D,u,F,E){this[uF](D,u,F,E,(C,f,$)=>{B(this,K,"f")[C][f]=$})}[DF](D,u,F,E){this[uF](D,u,F,E,(C,f,$)=>{B(this,K,"f")[C][f]=(B(this,K,"f")[C][f]||[]).concat($)})}[uF](D,u,F,E,C){if(Array.isArray(F))F.forEach((f)=>{D(f,E)});else if(((f)=>typeof f==="object")(F))for(let f of Du(F))D(f,F[f]);else C(u,this[FF](F),E)}[FF](D){if(D==="__proto__")return"___proto___";return D}[EF](D,u){return this[Eu](this[EF].bind(this),"key",D,u),this}[CF](){var D,u,F,E,C,f,$,G,J,Y,U,Q;let X=B(this,Nu,"f").pop();XD(X,void 0,B(this,P,"f"));let O;D=this,u=this,F=this,E=this,C=this,f=this,$=this,G=this,J=this,Y=this,U=this,Q=this,{options:{set value(W){H(D,K,W,"f")}}.value,configObjects:O,exitProcess:{set value(W){H(u,WD,W,"f")}}.value,groups:{set value(W){H(F,VD,W,"f")}}.value,output:{set value(W){H(E,hD,W,"f")}}.value,exitError:{set value(W){H(C,wD,W,"f")}}.value,hasOutput:{set value(W){H(f,OD,W,"f")}}.value,parsed:this.parsed,strict:{set value(W){H($,kD,W,"f")}}.value,strictCommands:{set value(W){H(G,gD,W,"f")}}.value,strictOptions:{set value(W){H(J,lD,W,"f")}}.value,completionCommand:{set value(W){H(Y,QD,W,"f")}}.value,parseFn:{set value(W){H(U,TD,W,"f")}}.value,parseContext:{set value(W){H(Q,dD,W,"f")}}.value}=X,B(this,K,"f").configObjects=O,B(this,b,"f").unfreeze(),B(this,r,"f").unfreeze(),B(this,uD,"f").unfreeze(),B(this,UD,"f").unfreeze()}[_0](D,u){return pD(u,(F)=>{return D(F),F})}getInternalMethods(){return{getCommandInstance:this[K0].bind(this),getContext:this[L0].bind(this),getHasOutput:this[A0].bind(this),getLoggerInstance:this[S0].bind(this),getParseContext:this[x0].bind(this),getParserConfiguration:this[yD].bind(this),getUsageConfiguration:this[H0].bind(this),getUsageInstance:this[P0].bind(this),getValidationInstance:this[w0].bind(this),hasParseCallback:this[Vu].bind(this),isGlobalContext:this[b0].bind(this),postProcess:this[sD].bind(this),reset:this[BF].bind(this),runValidation:this[fF].bind(this),runYargsParserAndExecuteCommands:this[Gu].bind(this),setHasOutput:this[n0].bind(this)}}[K0](){return B(this,uD,"f")}[L0](){return B(this,zu,"f")}[A0](){return B(this,OD,"f")}[S0](){return B(this,iD,"f")}[x0](){return B(this,dD,"f")||{}}[P0](){return B(this,b,"f")}[w0](){return B(this,r,"f")}[Vu](){return!!B(this,TD,"f")}[b0](){return B(this,Ru,"f")}[sD](D,u,F,E){if(F)return D;if(l(D))return D;if(!u)D=this[U0](D);if(this[yD]()["parse-positional-numbers"]||this[yD]()["parse-positional-numbers"]===void 0)D=this[V0](D);if(E)D=cD(D,this,B(this,UD,"f").getMiddleware(),!1);return D}[BF](D={}){H(this,K,B(this,K,"f")||{},"f");let u={};u.local=B(this,K,"f").local||[],u.configObjects=B(this,K,"f").configObjects||[];let F={};u.local.forEach((f)=>{F[f]=!0,(D[f]||[]).forEach(($)=>{F[$]=!0})}),Object.assign(B(this,oD,"f"),Object.keys(B(this,VD,"f")).reduce((f,$)=>{let G=B(this,VD,"f")[$].filter((J)=>!(J in F));if(G.length>0)f[$]=G;return f},{})),H(this,VD,{},"f");let E=["array","boolean","string","skipValidation","count","normalize","number","hiddenOptions"],C=["narg","key","alias","default","defaultDescription","config","choices","demandedOptions","demandedCommands","deprecatedOptions"];if(E.forEach((f)=>{u[f]=(B(this,K,"f")[f]||[]).filter(($)=>!F[$])}),C.forEach((f)=>{u[f]=xD(B(this,K,"f")[f],($)=>!F[$])}),u.envPrefix=B(this,K,"f").envPrefix,H(this,K,u,"f"),H(this,b,B(this,b,"f")?B(this,b,"f").reset(F):M0(this,B(this,P,"f")),"f"),H(this,r,B(this,r,"f")?B(this,r,"f").reset(F):Y0(this,B(this,b,"f"),B(this,P,"f")),"f"),H(this,uD,B(this,uD,"f")?B(this,uD,"f").reset():h0(B(this,b,"f"),B(this,r,"f"),B(this,UD,"f"),B(this,P,"f")),"f"),!B(this,ZD,"f"))H(this,ZD,Q0(this,B(this,b,"f"),B(this,uD,"f"),B(this,P,"f")),"f");return B(this,UD,"f").reset(),H(this,QD,null,"f"),H(this,hD,"","f"),H(this,wD,null,"f"),H(this,OD,!1,"f"),this.parsed=!1,this}[t0](D,u){return B(this,P,"f").path.relative(D,u)}[Gu](D,u,F,E=0,C=!1){var f,$,G,J;let Y=!!F||C;D=D||B(this,bD,"f"),B(this,K,"f").__=B(this,P,"f").y18n.__,B(this,K,"f").configuration=this[yD]();let U=!!B(this,K,"f").configuration["populate--"],Q=Object.assign({},B(this,K,"f").configuration,{"populate--":!0}),X=B(this,P,"f").Parser.detailed(D,Object.assign({},B(this,K,"f"),{configuration:{"parse-positional-numbers":!1,...Q}})),O=Object.assign(X.argv,B(this,dD,"f")),W=void 0,Z=X.aliases,A=!1,v=!1;if(Object.keys(O).forEach((n)=>{if(n===B(this,ND,"f")&&O[n])A=!0;else if(n===B(this,_D,"f")&&O[n])v=!0}),O.$0=this.$0,this.parsed=X,E===0)B(this,b,"f").clearCachedHelpMessage();try{if(this[au](),u)return this[sD](O,U,!!F,!1);if(B(this,ND,"f")){if([B(this,ND,"f")].concat(Z[B(this,ND,"f")]||[]).filter((ED)=>ED.length>1).includes(""+O._[O._.length-1]))O._.pop(),A=!0}H(this,Ru,!1,"f");let n=B(this,uD,"f").getCommands(),GD=((f=B(this,ZD,"f"))===null||f===void 0?void 0:f.completionKey)?[($=B(this,ZD,"f"))===null||$===void 0?void 0:$.completionKey,...(J=this.getAliases()[(G=B(this,ZD,"f"))===null||G===void 0?void 0:G.completionKey])!==null&&J!==void 0?J:[]].some((g)=>Object.prototype.hasOwnProperty.call(O,g)):!1,t=A||GD||C;if(O._.length){if(n.length){let g;for(let ED=E||0,a;O._[ED]!==void 0;ED++)if(a=String(O._[ED]),n.includes(a)&&a!==B(this,QD,"f")){let ID=B(this,uD,"f").runCommand(a,this,X,ED+1,C,A||v||C);return this[sD](ID,U,!!F,!1)}else if(!g&&a!==B(this,QD,"f")){g=a;break}if(!B(this,uD,"f").hasDefaultCommand()&&B(this,Hu,"f")&&g&&!t)B(this,r,"f").recommendCommands(g,n)}if(B(this,QD,"f")&&O._.includes(B(this,QD,"f"))&&!GD){if(B(this,WD,"f"))PD(!0);this.showCompletionScript(),this.exit(0)}}if(B(this,uD,"f").hasDefaultCommand()&&!t){let g=B(this,uD,"f").runCommand(null,this,X,0,C,A||v||C);return this[sD](g,U,!!F,!1)}if(GD){if(B(this,WD,"f"))PD(!0);D=[].concat(D);let g=D.slice(D.indexOf(`--${B(this,ZD,"f").completionKey}`)+1);return B(this,ZD,"f").getCompletion(g,(ED,a)=>{if(ED)throw new DD(ED.message);(a||[]).forEach((ID)=>{B(this,iD,"f").log(ID)}),this.exit(0)}),this[sD](O,!U,!!F,!1)}if(!B(this,OD,"f")){if(A){if(B(this,WD,"f"))PD(!0);Y=!0,this.showHelp((g)=>{B(this,iD,"f").log(g),this.exit(0)})}else if(v){if(B(this,WD,"f"))PD(!0);Y=!0,B(this,b,"f").showVersion("log"),this.exit(0)}}if(!Y&&B(this,K,"f").skipValidation.length>0)Y=Object.keys(O).some((g)=>B(this,K,"f").skipValidation.indexOf(g)>=0&&O[g]===!0);if(!Y){if(X.error)throw new DD(X.error.message);if(!GD){let g=this[fF](Z,{},X.error);if(!F)W=cD(O,this,B(this,UD,"f").getMiddleware(),!0);if(W=this[_0](g,W!==null&&W!==void 0?W:O),l(W)&&!F)W=W.then(()=>{return cD(O,this,B(this,UD,"f").getMiddleware(),!1)})}}}catch(n){if(n instanceof DD)B(this,b,"f").fail(n.message,n);else throw n}return this[sD](W!==null&&W!==void 0?W:O,U,!!F,!0)}[fF](D,u,F,E){let C={...this.getDemandedOptions()};return(f)=>{if(F)throw new DD(F.message);B(this,r,"f").nonOptionCount(f),B(this,r,"f").requiredArguments(f,C);let $=!1;if(B(this,gD,"f"))$=B(this,r,"f").unknownCommands(f);if(B(this,kD,"f")&&!$)B(this,r,"f").unknownArguments(f,D,u,!!E);else if(B(this,lD,"f"))B(this,r,"f").unknownArguments(f,D,{},!1,!1);B(this,r,"f").limitedChoices(f),B(this,r,"f").implications(f),B(this,r,"f").conflicting(f)}}[n0](){H(this,OD,!0,"f")}[rD](D){if(typeof D==="string")B(this,K,"f").key[D]=!0;else for(let u of D)B(this,K,"f").key[u]=!0}}function z0(D){return!!D&&typeof D.getInternalMethods==="function"}var Z8=c0(ku),v0=Z8;import{EOL as HD}from"os";import e0 from"path";import J8 from"fs";var m0=g0("main");l0("main");var RD=du(process.argv),D2=new Set(["--version","-v"]);if(RD.length===1&&D2.has(RD[0]))process.stdout.write(Lu+HD),process.exit();if(RD.length===2&&RD.some((D)=>D2.has(D))&&RD.includes("--verbose")){let D=process.argv[1],u=(()=>{if(!D||D.startsWith("-"))return;if(D.startsWith("/$bunfs/")||/^B:[\\/]~BUN[\\/]/.test(D))return;let E=e0.resolve(D);if(E===process.execPath)return;try{if(!J8.statSync(E).isFile())return}catch{return}return E})(),F=[`version: ${Lu}`,`channel: ${d0}`,`commit: ${o0}`,`binary: ${process.execPath}`,...u?[`bundle: ${u}`]:[]];process.stdout.write(F.join(HD)+HD),process.exit()}var _u={acp:()=>import("./chunk-zcsgqk9f.js").then((D)=>D.AcpCommand),mcp:()=>import("./chunk-avf8v3hb.js").then((D)=>D.McpCommand),attach:()=>import("./chunk-4sc82a27.js").then((D)=>D.AttachCommand),run:()=>import("./chunk-59yqvk48.js").then((D)=>D.RunCommand),generate:()=>import("./chunk-k75jqg60.js").then((D)=>D.GenerateCommand),debug:()=>import("./chunk-0c2p3a6v.js").then((D)=>D.DebugCommand),console:()=>import("./chunk-2wajs9xv.js").then((D)=>D.ConsoleCommand),providers:()=>import("./chunk-7tr9ejyk.js").then((D)=>D.ProvidersCommand),agent:()=>import("./chunk-w8saweey.js").then((D)=>D.AgentCommand),upgrade:()=>import("./chunk-634pnryq.js").then((D)=>D.UpgradeCommand),uninstall:()=>import("./chunk-rza530gm.js").then((D)=>D.UninstallCommand),serve:()=>import("./chunk-wqj0xasg.js").then((D)=>D.ServeCommand),models:()=>import("./chunk-0e86gt9r.js").then((D)=>D.ModelsCommand),stats:()=>import("./chunk-5pb551dx.js").then((D)=>D.StatsCommand),usage:()=>import("./chunk-za7mwbye.js").then((D)=>D.UsageCommand),export:()=>import("./chunk-ew9pdrp9.js").then((D)=>D.ExportCommand),import:()=>import("./chunk-15j5cn4t.js").then((D)=>D.ImportCommand),github:()=>import("./chunk-pje60pj2.js").then((D)=>D.GithubCommand),pr:()=>import("./chunk-85wcc1tp.js").then((D)=>D.PrCommand),session:()=>import("./chunk-wezarrvy.js").then((D)=>D.SessionCommand),plugin:()=>import("./chunk-rkyf0cp8.js").then((D)=>D.PluginCommand),plug:()=>import("./chunk-rkyf0cp8.js").then((D)=>D.PluginCommand),auth:()=>import("./chunk-y7sy3w6z.js").then((D)=>D.AuthCommand),qredits:()=>import("./chunk-r7sqdfad.js").then((D)=>D.QreditsCommand),batch:()=>import("./chunk-02jtpxe0.js").then((D)=>D.BatchCommand),db:()=>import("./chunk-wmqsdt2c.js").then((D)=>D.DbCommand),default:()=>import("./chunk-5jx0yadh.js").then((D)=>D.TuiThreadCommand)};function y(D,u,F){return{command:D,describe:u,aliases:F,handler:async()=>{}}}function $F(){return[y("acp","start ACP (Agent Client Protocol) server"),y("mcp","manage MCP (Model Context Protocol) servers"),{command:"$0 [project]",describe:"start qitqode tui",builder:(D)=>D.positional("project",{type:"string",describe:"path to start qitqode in"}).options(s0).options(r0).option("never-ask",{type:"boolean",describe:"start in never-ask mode, auto-decide without asking (permissions excluded)",default:!1}).option("trust",{type:"boolean",describe:"skip workspace trust prompt and trust the directory",default:!1}),handler:async()=>{}},y("attach <url>","attach to a running qitqode server"),y("run [message..]","run qitqode with a message"),y("generate","generate files"),y("debug","debugging and troubleshooting tools"),y("console","manage qitqode accounts"),y("providers","manage AI providers and credentials",["auth"]),y("agent","manage agents"),y("upgrade [target]","upgrade qitqode to the latest or a specific version"),y("uninstall","uninstall qitqode and remove all related files"),y("serve","starts a headless qitqode server"),y("models [provider]","list all available models"),y("stats","show token usage and cost statistics"),y("usage [sessionID]","show per-turn token usage and cost"),y("export [sessionID]","export session data as JSON"),y("import <file>","import session data from JSON file or URL"),y("github","manage GitHub agent"),y("pr <number>","fetch and checkout a GitHub PR branch, then run qitqode"),y("session","manage sessions"),y("plugin <module>","install plugin and update config",["plug"]),y("auth <command>","Sign in or out of Forgewise"),y("qredits <command>","Check Qredits balance and spend history"),y("batch <command>","Submit and poll async batch LLM jobs"),y("db","database tools")]}function zF(D){let u=new Set(["--log-level","--model","-m","--session","-s","--prompt","--agent","--port","--hostname","--mdns-domain","--cors"]);for(let F=0;F<D.length;F++){let E=D[F];if(E==="--")return;if(E.startsWith("-")){if(u.has(E))F++;continue}return E}}function Q8(D){return D.length>0&&D.every((u)=>u==="--help"||u==="-h")}function O8(D){return D.includes("--help")||D.includes("-h")}async function T8(D){let u=zF(D);if(D.includes("--get-yargs-completions")||u==="completion")return $F();if(Q8(D))return $F();else if(u&&u in _u)return[await _u[u]()];else if(O8(D))return $F();else return[await _u.default()]}function u2(D){let u=D.trimStart();if(!u.startsWith("qitqode ")){process.stderr.write(Ku.logo()+HD+HD),process.stderr.write(u);return}process.stderr.write(D)}var Mu=y0(v0(RD)).middleware(async(D)=>{if(D.pure)process.env.QITQODE_PURE="1";let u=await import("./chunk-096pd6c4.js"),{Filesystem:F}=await import("./chunk-89w3yhf8.js"),{Heap:E}=await import("./chunk-s6ktx2sx.js"),{Global:C}=await import("./chunk-1r95p0tp.js");await u.init({print:process.argv.includes("--print-logs"),dev:hF,level:(()=>{if(D.logLevel)return D.logLevel;if(hF)return"DEBUG";return"INFO"})()}),E.start(),(await import("./chunk-e5mv5wnt.js")).startRefresh(),process.env.AGENT="1",process.env.QITQODE="1",process.env.QITQODE_PID=String(process.pid),u.Default.info("qitqode",{version:Lu,command:zF(RD)??"tui",process_role:m0.processRole,run_id:m0.runID});let $=e0.join(C.Path.data,"qitqode.db");if(!await F.exists($)){let{JsonMigration:G,Database:J}=await import("./chunk-k1txw65h.js"),{drizzle:Y}=await import("./chunk-7mke41x0.js"),U=process.stderr.isTTY;process.stderr.write("Performing one time database migration, may take a few minutes..."+HD);let Q=-1;if(U)process.stderr.write("\x1B[?25l");try{await G.run(Y({client:J.Client().$client}),{progress:(X)=>{let O=Math.floor(X.current/X.total*100);if(O===Q&&X.current!==X.total)return;if(Q=O,U){if(process.stderr.write(a0(O,`${X.label.padEnd(12)} ${X.current}/${X.total}`)),X.current===X.total)process.stderr.write(`
81
+ `)}else process.stderr.write(`sqlite-migration:${O}${HD}`)}})}finally{if(U)process.stderr.write("\x1B[?25h");else process.stderr.write(`sqlite-migration:done${HD}`)}process.stderr.write("Database migration complete."+HD)}if(!process.env.QITQODE_DISABLE_CLAUDE_IMPORT&&!process.env.QITQODE_CLAUDE_IMPORTED){process.env.QITQODE_CLAUDE_IMPORTED="1";let G=async()=>{try{let{ClaudeImport:U}=await import("./chunk-20702epe.js");await U.run()}catch(U){u.Default.warn("claude-import failed",{e:GF(U)})}},J=zF(RD);if(!J||!(J in _u))G();else await G()}}).usage("").completion("completion","generate shell completion script");for(let D of await T8(RD))Mu.command(D);Mu.fail((D,u)=>{if(D?.startsWith("Unknown argument")||D?.startsWith("Not enough non-option arguments")||D?.startsWith("Invalid values:")){if(u)throw u;Mu.showHelp(u2)}if(u)throw u;process.exit(1)}).strict();try{if(RD.includes("-h")||RD.includes("--help"))await Mu.parse(RD,(D,u,F)=>{if(D)throw D;if(!F)return;u2(F)});else await Mu.parse()}catch(D){let u={};if(D instanceof i0){let C=D.toObject();Object.assign(u,{...C.data})}if(D instanceof Error)Object.assign(u,{name:D.name,message:D.message,cause:D.cause?.toString(),stack:D.stack});if(D instanceof ResolveMessage)Object.assign(u,{name:D.name,message:D.message,code:D.code,specifier:D.specifier,referrer:D.referrer,position:D.position,importKind:D.importKind});let F=await import("./chunk-096pd6c4.js");F.Default.error("fatal",u);let E=k0(D);if(E)Ku.error(E);if(E===void 0)Ku.error("Unexpected error, check log file at "+F.file()+" for more details"+HD),process.stderr.write(GF(D)+HD);process.exitCode=1}finally{process.exit()}
package/bundle/worker.js CHANGED
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Xf as H}from"./chunk-5v0xjs3x.js";import{ag as x}from"./chunk-pctt1qv8.js";import"./chunk-11x3t2tt.js";import"./chunk-68yw2hk9.js";import"./chunk-takew94z.js";import"./chunk-cjww2jmv.js";import"./chunk-nfg7nt13.js";import"./chunk-xvwvd4kq.js";import"./chunk-qbc36nbb.js";import{Wg as V,gh as O}from"./chunk-fq0x3esz.js";import"./chunk-44a82dg0.js";import"./chunk-vxyy2dp3.js";import"./chunk-yp5bypsp.js";import"./chunk-7hm0c2yg.js";import"./chunk-gj0wt0cy.js";import"./chunk-5hw6xa49.js";import"./chunk-326p5b10.js";import{Dl as Z,Wj as Y}from"./chunk-04n2ycg5.js";import{Fl as N}from"./chunk-8ymffyep.js";import{Ql as C,lm as q}from"./chunk-mcg24gkb.js";import"./chunk-redjxn13.js";import"./chunk-bn0h9dny.js";import"./chunk-r4ndwym0.js";import"./chunk-3ytjm3az.js";import"./chunk-htz93dsd.js";import"./chunk-vcw00k0n.js";import"./chunk-r78czx4d.js";import"./chunk-2hc5z7b5.js";import"./chunk-d68fzyw7.js";import"./chunk-4jtxtkj7.js";import"./chunk-ay8emwym.js";import"./chunk-2maqde7w.js";import"./chunk-kj20f048.js";import"./chunk-cqtkxwd8.js";import"./chunk-x9rbv6p6.js";import"./chunk-g5rabwre.js";import"./chunk-jbx3s7nw.js";import"./chunk-15hw2z9t.js";import"./chunk-48ge2ryx.js";import"./chunk-n9xns8by.js";import"./chunk-y9q0hb7b.js";import"./chunk-c1bdzxbx.js";import"./chunk-ehhas0ew.js";import"./chunk-d6ry9418.js";import"./chunk-0dt0bxz6.js";import"./chunk-10bjs581.js";import{Rr as k}from"./chunk-4gkk28xk.js";import"./chunk-4cnwn1rh.js";import"./chunk-gcw4rn10.js";import{Ks as z,Rs as T,Vr as X,Yr as G,_s as W,ys as j}from"./chunk-m5m448mg.js";import"./chunk-tqj69nh6.js";import"./chunk-ag8kz1e7.js";import"./chunk-5tray1fw.js";import"./chunk-c11d28qn.js";import"./chunk-mzs2pjyc.js";import"./chunk-gagtmjmp.js";import"./chunk-zs8kqdsf.js";import"./chunk-dxpj0cxh.js";import"./chunk-zw815d68.js";import"./chunk-7xm75w1e.js";var $=W.create({service:"upgrade"});function L(D,E){if(D===!1)return"disabled";if(D===!0&&E==="patch")return"install";return"notify"}async function M(){if(G)return;let D=await O.runPromise(Z.Service.use((J)=>J.getGlobal())),E=await O.runPromise(N.Service.use((J)=>J.method())),K=await O.runPromise(N.Service.use((J)=>J.latest(E))).catch((J)=>{$.warn("failed to check for updates",{method:E,error:String(J)})});if(!K)return;if(!N.isNewerVersion(X,K)){$.warn("ignoring non-newer update version",{current:X,latest:K});return}if(T.QITQODE_ALWAYS_NOTIFY_UPDATE){await Y.publish(N.Event.UpdateAvailable,{version:K});return}if(T.QITQODE_DISABLE_AUTOUPDATE)return;let _=N.getReleaseType(X,K),Q=L(D.autoupdate,_);if(Q==="disabled")return;if(Q==="notify"){await Y.publish(N.Event.UpdateAvailable,{version:K});return}if(E==="unknown")return;await O.runPromise(N.Service.use((J)=>J.upgrade(E,K))).then(()=>Y.publish(N.Event.Updated,{version:K})).catch((J)=>{$.warn("auto-upgrade failed",{method:E,target:K,error:String(J)})})}import{writeHeapSnapshot as P}from"v8";j("worker");await W.init({print:process.argv.includes("--print-logs"),dev:N.isLocal(),level:(()=>{if(N.isLocal())return"DEBUG";return"INFO"})()});H.start();k("worker");C.on("event",(D)=>{z.emit("global.event",D)});var U,S={async fetch(D){let E={...D.headers},K=w();if(K&&!E.authorization&&!E.Authorization)E.Authorization=K;let _=new Request(D.url,{method:D.method,headers:E,body:D.body}),Q=await x.Default().app.fetch(_),J=await Q.text();return{status:Q.status,headers:Object.fromEntries(Q.headers.entries()),body:J}},snapshot(){return P("server.heapsnapshot")},async server(D){if(U)await U.stop(!0);return U=await x.listen(D),{url:U.url.toString()}},async checkUpgrade(D){await q.provide({directory:D.directory,init:()=>O.runPromise(V),fn:async()=>{await M().catch(()=>{})}})},async reload(){await O.runPromise(Z.Service.use((D)=>D.invalidate(!0)))},async shutdown(){if(W.Default.info("worker shutting down"),await q.disposeAll(),U)await U.stop(!0)}};z.listen(S);function w(){let D=T.QITQODE_SERVER_PASSWORD;if(!D)return;let E=T.QITQODE_SERVER_USERNAME??"qitqode";return`Basic ${btoa(`${E}:${D}`)}`}export{S as rpc};
2
+ import{Xf as H}from"./chunk-y6123zvq.js";import{ag as x}from"./chunk-k7aenxan.js";import"./chunk-8r6ht39z.js";import"./chunk-mqd1jsg2.js";import"./chunk-gz8sz7z1.js";import"./chunk-cjww2jmv.js";import"./chunk-nfg7nt13.js";import"./chunk-xvwvd4kq.js";import"./chunk-d3ermm6d.js";import{Wg as V,gh as O}from"./chunk-caj1b9y7.js";import"./chunk-ygs5pzk7.js";import"./chunk-vxyy2dp3.js";import"./chunk-yp5bypsp.js";import"./chunk-7hm0c2yg.js";import"./chunk-gj0wt0cy.js";import"./chunk-5hw6xa49.js";import"./chunk-326p5b10.js";import{Dl as Z,Wj as Y}from"./chunk-257me4z3.js";import{Fl as N}from"./chunk-nkkch4h7.js";import{Ql as C,lm as q}from"./chunk-s3mnrhbx.js";import"./chunk-ezfy0b6q.js";import"./chunk-bn0h9dny.js";import"./chunk-hnvn2c25.js";import"./chunk-3nx7112w.js";import"./chunk-htz93dsd.js";import"./chunk-vcw00k0n.js";import"./chunk-we9cv8we.js";import"./chunk-2hc5z7b5.js";import"./chunk-9gazyynx.js";import"./chunk-4jtxtkj7.js";import"./chunk-ay8emwym.js";import"./chunk-2maqde7w.js";import"./chunk-kj20f048.js";import"./chunk-cqtkxwd8.js";import"./chunk-x9rbv6p6.js";import"./chunk-g5rabwre.js";import"./chunk-jbx3s7nw.js";import"./chunk-15hw2z9t.js";import"./chunk-48ge2ryx.js";import"./chunk-n9xns8by.js";import"./chunk-y9q0hb7b.js";import"./chunk-d9hbhkbq.js";import"./chunk-ad72gb5f.js";import"./chunk-d6ry9418.js";import"./chunk-0dt0bxz6.js";import"./chunk-10bjs581.js";import{Rr as k}from"./chunk-56z7x7h4.js";import"./chunk-4cnwn1rh.js";import"./chunk-764fksh3.js";import{Ks as z,Rs as T,Vr as X,Yr as G,_s as W,ys as j}from"./chunk-xj765svc.js";import"./chunk-tqj69nh6.js";import"./chunk-ag8kz1e7.js";import"./chunk-5tray1fw.js";import"./chunk-c11d28qn.js";import"./chunk-mzs2pjyc.js";import"./chunk-gagtmjmp.js";import"./chunk-zs8kqdsf.js";import"./chunk-dxpj0cxh.js";import"./chunk-zw815d68.js";import"./chunk-7xm75w1e.js";var $=W.create({service:"upgrade"});function L(D,E){if(D===!1)return"disabled";if(D===!0&&E==="patch")return"install";return"notify"}async function M(){if(G)return;let D=await O.runPromise(Z.Service.use((J)=>J.getGlobal())),E=await O.runPromise(N.Service.use((J)=>J.method())),K=await O.runPromise(N.Service.use((J)=>J.latest(E))).catch((J)=>{$.warn("failed to check for updates",{method:E,error:String(J)})});if(!K)return;if(!N.isNewerVersion(X,K)){$.warn("ignoring non-newer update version",{current:X,latest:K});return}if(T.QITQODE_ALWAYS_NOTIFY_UPDATE){await Y.publish(N.Event.UpdateAvailable,{version:K});return}if(T.QITQODE_DISABLE_AUTOUPDATE)return;let _=N.getReleaseType(X,K),Q=L(D.autoupdate,_);if(Q==="disabled")return;if(Q==="notify"){await Y.publish(N.Event.UpdateAvailable,{version:K});return}if(E==="unknown")return;await O.runPromise(N.Service.use((J)=>J.upgrade(E,K))).then(()=>Y.publish(N.Event.Updated,{version:K})).catch((J)=>{$.warn("auto-upgrade failed",{method:E,target:K,error:String(J)})})}import{writeHeapSnapshot as P}from"v8";j("worker");await W.init({print:process.argv.includes("--print-logs"),dev:N.isLocal(),level:(()=>{if(N.isLocal())return"DEBUG";return"INFO"})()});H.start();k("worker");C.on("event",(D)=>{z.emit("global.event",D)});var U,S={async fetch(D){let E={...D.headers},K=w();if(K&&!E.authorization&&!E.Authorization)E.Authorization=K;let _=new Request(D.url,{method:D.method,headers:E,body:D.body}),Q=await x.Default().app.fetch(_),J=await Q.text();return{status:Q.status,headers:Object.fromEntries(Q.headers.entries()),body:J}},snapshot(){return P("server.heapsnapshot")},async server(D){if(U)await U.stop(!0);return U=await x.listen(D),{url:U.url.toString()}},async checkUpgrade(D){await q.provide({directory:D.directory,init:()=>O.runPromise(V),fn:async()=>{await M().catch(()=>{})}})},async reload(){await O.runPromise(Z.Service.use((D)=>D.invalidate(!0)))},async shutdown(){if(W.Default.info("worker shutting down"),await q.disposeAll(),U)await U.stop(!0)}};z.listen(S);function w(){let D=T.QITQODE_SERVER_PASSWORD;if(!D)return;let E=T.QITQODE_SERVER_USERNAME??"qitqode";return`Basic ${btoa(`${E}:${D}`)}`}export{S as rpc};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qitqode/qitqode-android-arm64",
3
- "version": "0.1.31",
3
+ "version": "0.1.32",
4
4
  "description": "Android arm64 runtime for @qitqode/cli.",
5
5
  "license": "MIT",
6
6
  "author": "QitQode",
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Cl as a}from"./chunk-04n2ycg5.js";import"./chunk-8ymffyep.js";import"./chunk-mcg24gkb.js";import"./chunk-redjxn13.js";import"./chunk-bn0h9dny.js";import"./chunk-r4ndwym0.js";import"./chunk-3ytjm3az.js";import"./chunk-htz93dsd.js";import"./chunk-vcw00k0n.js";import"./chunk-r78czx4d.js";import"./chunk-2hc5z7b5.js";import"./chunk-d68fzyw7.js";import"./chunk-4jtxtkj7.js";import"./chunk-ay8emwym.js";import"./chunk-2maqde7w.js";import"./chunk-kj20f048.js";import"./chunk-cqtkxwd8.js";import"./chunk-x9rbv6p6.js";import"./chunk-g5rabwre.js";import"./chunk-jbx3s7nw.js";import"./chunk-15hw2z9t.js";import"./chunk-48ge2ryx.js";import"./chunk-c1bdzxbx.js";import"./chunk-ehhas0ew.js";import"./chunk-d6ry9418.js";import"./chunk-0dt0bxz6.js";import"./chunk-10bjs581.js";import"./chunk-4cnwn1rh.js";import"./chunk-gcw4rn10.js";import"./chunk-m5m448mg.js";import"./chunk-tqj69nh6.js";import"./chunk-ag8kz1e7.js";import"./chunk-5tray1fw.js";import"./chunk-c11d28qn.js";import"./chunk-mzs2pjyc.js";import"./chunk-gagtmjmp.js";import"./chunk-zs8kqdsf.js";import"./chunk-zw815d68.js";import"./chunk-7xm75w1e.js";export{a as Session};
@@ -1,28 +0,0 @@
1
- // @bun
2
- import{of as c}from"./chunk-hnzegjgv.js";import{Po as m}from"./chunk-ay8emwym.js";import"./chunk-2maqde7w.js";import"./chunk-kj20f048.js";import"./chunk-cqtkxwd8.js";import"./chunk-x9rbv6p6.js";import{Ur as Q}from"./chunk-gcw4rn10.js";import{Zs as p}from"./chunk-m5m448mg.js";import"./chunk-tqj69nh6.js";import"./chunk-ag8kz1e7.js";import"./chunk-5tray1fw.js";import"./chunk-c11d28qn.js";import"./chunk-mzs2pjyc.js";import"./chunk-gagtmjmp.js";import"./chunk-zs8kqdsf.js";import"./chunk-7xm75w1e.js";var f=p({service:"provider.qlex"}),n=Q.streamUrl(),s=Q.omniqueryBaseUrl()+"/runOrchestrated";class d extends Error{name="QlexNotLoggedInError";constructor(){super(Q.copy().notLoggedIn)}}class A extends Error{name="QlexInsufficientBalanceError";constructor(J){super(Q.copy().insufficientBalance(J))}}class I extends Error{name="QlexRateLimitError";constructor(){super(Q.copy().rateLimit)}}class v extends Error{name="QlexInvalidCredentialsError";constructor(J){super(Q.copy().invalidCredentials(J))}}class O extends Error{name="QlexGatewayError";constructor(J){super(Q.copy().gatewayUnavailable(J))}}var a=60000;function PJ(J){return Q.sanitizeUpstreamError(J)}class L extends Error{name="QlexStreamError";constructor(J){super(Q.copy().streamFailed(J))}}function y(J){return m(J)}var r=new Set(["coding","agent","research","review","chat"]);function t(J){if(J===void 0)return;if(typeof J==="string"&&r.has(J))return J;throw Error(`invalid Qortex posture: ${String(J)}`)}function o(J){if(J===void 0)return;let K=Array.isArray(J)?J:[J];if(K.every((V)=>typeof V==="string"&&/^[^/\s]+\/[^/\s]+$/.test(V)))return Array.isArray(J)?K:J;throw Error(`invalid Qortex directive registry key: ${String(J)}`)}function h(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 V=K;if(typeof V.text==="string")return V.text;if(typeof V.content==="string")return V.content}return""}).join("");if(J===void 0||J===null)return"";return String(J)}function e(J){if(!Array.isArray(J))return J;return J.map((K)=>{if(!K||typeof K!=="object")return K;let V=K;if(!("content"in V))return K;return{...V,content:h(V.content)}})}function JJ(J){if(!Array.isArray(J))return J;let K=(z)=>!!z&&typeof z==="object"&&z.role==="system",V=0;while(V<J.length&&K(J[V]))V++;if(V<=1)return J;let Z=J.slice(0,V),Y=Z.map((z)=>typeof z.content==="string"?z.content:String(z.content??"")).filter((z)=>z.length>0).join(`
3
-
4
- `);return[{...Z[0],role:"system",content:Y},...J.slice(V)]}var T="<tool_call>",B="</tool_call>";function KJ(J){if(!Array.isArray(J)||J.length===0)return;let K=J.map((V)=>{try{return JSON.stringify(V)}catch{return}}).filter((V)=>V!==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
- `)}function VJ(J){let K=J.function??{},V=typeof K.name==="string"?K.name:"",Z={};if(typeof K.arguments==="string")try{Z=JSON.parse(K.arguments)}catch{Z=K.arguments}else if(K.arguments!==void 0)Z=K.arguments;return`${T}
6
- ${JSON.stringify({name:V,arguments:Z})}
7
- ${B}`}function YJ(J,K){if(!Array.isArray(J))return J;let V=J.map((Y)=>{if(!Y||typeof Y!=="object")return Y;let z=Y;if(z.role==="assistant"&&Array.isArray(z.tool_calls)){let $=z.tool_calls.map(VJ).join(`
8
- `),H=h(z.content),{tool_calls:X,...G}=z;return{...G,content:H.length>0?`${H}
9
- ${$}`:$}}if(z.role==="tool"){let{tool_call_id:$,name:H,...X}=z;return{...X,role:"user",content:`<tool_response>
10
- ${h(z.content)}
11
- </tool_response>`}}return Y}),Z=KJ(K);if(Z){let Y=0;while(Y<V.length&&!!V[Y]&&typeof V[Y]==="object"&&V[Y].role==="system")Y++;V.splice(Y,0,{role:"system",content:Z})}return V}function ZJ(){return process.env.QITQODE_TOOL_PROTOCOL==="text"?"text":"native"}function $J(J){if(Array.isArray(J.tools)&&J.tools.length>0)return!0;let K=J.messages;if(!Array.isArray(K))return!1;return K.some((V)=>{if(!V||typeof V!=="object")return!1;let Z=V;return Z.role==="tool"||Z.role==="assistant"&&Array.isArray(Z.tool_calls)})}function g(J,K){let V=K?.toolMode??"native",Z=J.model??"default",Y={stream:J.stream??!0};if(J.temperature!==void 0)Y.temperature=J.temperature;if(J.max_tokens!==void 0)Y.max_tokens=J.max_tokens;let z=K?.outputAdvisory;if(z){let j=z.tierOutputLimit;if(Y.max_tokens!==void 0){if(j!==void 0&&Y.max_tokens>j)Y.max_tokens=j}else{let P=z.tierRecommendedStepTokens??j;if(P!==void 0)Y.max_tokens=P}}if(J.tools!==void 0)Y.tools=J.tools;if(J.tool_choice!==void 0)Y.tool_choice=J.tool_choice;if(J.stream_options!==void 0)Y.stream_options=J.stream_options;let $=V==="text"?YJ(J.messages,J.tools):J.messages,H={},X=t(J.posture);if(X!==void 0)H.posture=X;let G=o(J.directive);if(G!==void 0)H.directive=G;if(J.modelPersona!==void 0)H.modelPersona=J.modelPersona;return{tier:Z,messages:JJ(e($)),opts:Y,...H}}var x=new Map;function u(J){return typeof J==="number"&&Number.isFinite(J)&&J>0?J:void 0}function zJ(J,K){let V={},Z=u(K.tierOutputLimit),Y=u(K.tierRecommendedStepTokens);if(Z!==void 0)V.tierOutputLimit=Z;if(Y!==void 0)V.tierRecommendedStepTokens=Y;if(V.tierOutputLimit===void 0&&V.tierRecommendedStepTokens===void 0)return;x.set(J,V)}function HJ(J){return x.get(J)}function _J(){x.clear()}function jJ(J){let K=(V)=>typeof V==="string"&&(V.startsWith("qlex")||V.startsWith("qortex"));return K(J.id)||K(J.object)}function DJ(J){let K=[],V=J.indexOf(`
12
- `)===-1?[J]:J.split(`
13
- `);for(let $ of V){let H=$.endsWith("\r")?$.slice(0,-1):$;if(!H.startsWith("data:"))continue;let X=H.slice(5);if(X.startsWith(" "))X=X.slice(1);K.push(X)}if(K.length===0)return{kind:"skip"};let Z=K.length===1?K[0]:K.join(`
14
- `);if(Z==="")return{kind:"skip"};if(Z==="[DONE]")return{kind:"done"};if(Z.startsWith("[ERROR]"))return{kind:"error",message:Z.slice(7).trim()||"qlex stream error"};let Y=Z.charCodeAt(0),z=Y===123||Y===91||Y===32||Y===9||Y===10||Y===13;try{if(!z)return{kind:"token",content:Z};let $=JSON.parse(Z);if($&&typeof $==="object"){let H=$.id;if(H==="qlex-cost"||H==="qortex-cost")return{kind:"cost",cost:$};if(H==="qlex-stream"&&$.usage&&typeof $.usage==="object"){let j=$.choices,P;if(Array.isArray(j)&&j[0]&&typeof j[0]==="object"){let k=j[0].finish_reason;if(typeof k==="string")P=k}return{kind:"usage",usage:$.usage,finishReason:P}}if(Array.isArray($.choices))return{kind:"passthrough",chunk:$};let X=$,G=typeof X.content==="string"?X.content:typeof X.text==="string"?X.text:typeof X.delta==="string"?X.delta:void 0;if(G!==void 0)return{kind:"token",content:G};if(jJ($)){let j=$.object;return{kind:"control",control:typeof j==="string"&&j.endsWith(".tier.outputLimits")?"tier-output-limits":"unknown",chunk:$}}}}catch{}return{kind:"token",content:Z}}function WJ(J,K){let V=Math.min(J.length,K.length-1);for(let Z=V;Z>=1;Z--)if(K.startsWith(J.slice(J.length-Z)))return Z;return 0}class i{onText;onToolCall;pending="";inBlock=!1;constructor(J,K){this.onText=J;this.onToolCall=K}feed(J){this.pending+=J,this.drain(!1)}flush(){if(this.drain(!0),this.inBlock)this.emitBlock(this.pending,!0),this.inBlock=!1;else if(this.pending.length>0)this.onText(this.pending);this.pending=""}drain(J){while(!0)if(!this.inBlock){let K=this.pending.indexOf(T);if(K===-1){let V=J?0:WJ(this.pending,T),Z=this.pending.length-V;if(Z>0)this.onText(this.pending.slice(0,Z)),this.pending=V>0?this.pending.slice(Z):"";return}if(K>0)this.onText(this.pending.slice(0,K));this.pending=this.pending.slice(K+T.length),this.inBlock=!0}else{let K=this.pending.indexOf(B);if(K===-1)return;if(this.emitBlock(this.pending.slice(0,K),!1),this.pending=this.pending.slice(K+B.length),this.pending.startsWith(`\r
15
- `))this.pending=this.pending.slice(2);else if(this.pending.startsWith(`
16
- `))this.pending=this.pending.slice(1);this.inBlock=!1}}emitBlock(J,K){try{let V=JSON.parse(J.trim());if(V&&typeof V==="object"&&typeof V.name==="string"){let Z=V.arguments;this.onToolCall({name:V.name,arguments:typeof Z==="string"?Z:JSON.stringify(Z??{})});return}}catch{}this.onText(`${T}${J}${K?"":B}`)}}function C(J,K,V){let Z={id:"qlex-stream",object:"chat.completion.chunk",created:Math.floor(Date.now()/1000),model:"qlex",choices:[{index:0,delta:J,finish_reason:K}]};if(V)Z.usage=V;return`data: ${JSON.stringify(Z)}
17
-
18
- `}function XJ(J,K){let V=K?.toolProtocolEnabled===!0,Z=K?.tier,Y=J.getReader(),z=new TextDecoder,$=new TextEncoder,H="",X=!1,G=!1,j,P,k;return new ReadableStream({async start(F){let _=(D)=>{let W=X?{content:D}:{role:"assistant",content:D};X=!0,F.enqueue($.encode(C(W,null)))},S=0,N=V?new i(_,(D)=>{let W={...X?{}:{role:"assistant"},tool_calls:[{index:S,id:`qlexcall_${Date.now().toString(36)}_${S}`,type:"function",function:{name:D.name,arguments:D.arguments}}]};X=!0,S++,F.enqueue($.encode(C(W,null)))}):void 0,R=(D)=>N?N.feed(D):_(D),E=()=>{N?.flush();let D=j||P!==void 0?{prompt_tokens:j?.tokens.prompt??0,completion_tokens:j?.tokens.completion??0,total_tokens:j?.tokens.total??(j?.tokens.prompt??0)+(j?.tokens.completion??0),cost_usd:j?.cost_usd,cost_credits:j?.cost_credits??j?.cost_qredits,context_window:P}:void 0,W=S>0?"tool_calls":k??"stop";F.enqueue($.encode(C({},W,D))),F.enqueue($.encode(`data: [DONE]
19
-
20
- `)),F.close(),G=!0},U=(D)=>{let W=DJ(D);switch(W.kind){case"skip":return!1;case"token":return R(W.content),!1;case"passthrough":{let M=W.chunk.choices;if(Array.isArray(M)&&M[0]&&typeof M[0]==="object"){let w=M[0].finish_reason;if(typeof w==="string")k=w}return X=!0,F.enqueue($.encode(`data: ${JSON.stringify(W.chunk)}
21
-
22
- `)),!1}case"cost":if(W.cost.final)j=W.cost;return!1;case"usage":if(W.usage.context_window!==void 0)P=W.usage.context_window;if(W.finishReason!==void 0)k=W.finishReason;return!1;case"control":{if(W.control==="tier-output-limits"){let M=W.chunk;if(Z!==void 0)zJ(Z,M);f.debug("qlex tier output limits",{tierOutputLimit:M.tierOutputLimit,tierRecommendedStepTokens:M.tierRecommendedStepTokens,tierStepGuidance:M.tierStepGuidance})}else f.debug("qlex control frame dropped",{id:W.chunk.id,object:W.chunk.object});return!1}case"done":return E(),!0;case"error":return F.error(new L(W.message)),G=!0,!0}};try{while(!0){let{done:W,value:M}=await Y.read();if(W)break;H+=z.decode(M,{stream:!0});let w;while((w=H.indexOf(`
23
-
24
- `))!==-1){let q=H.slice(0,w);if(H=H.slice(w+2),U(q))return}}H+=z.decode();let D=H.replace(/\r?\n$/,"");if(D.length>0&&U(D))return;if(!G)E()}catch(D){if(!G)F.error(D instanceof L?D:new L(D instanceof Error?D.message:String(D)))}finally{Y.releaseLock()}},cancel(F){Y.cancel(F).catch(()=>{})}})}function l(J){return{content:typeof J.content==="string"?J.content:J.choices?.[0]?.message?.content??"",finishReason:J.choices?.[0]?.finish_reason??"stop"}}function NJ(J){let K=J??{},{content:V,finishReason:Z}=l(K),Y=K.usage??{},z=Y.prompt_tokens??0,$=Y.completion_tokens??0,H="orch-"+Date.now().toString(36),X=Math.floor(Date.now()/1000),G=(_,S,N)=>{let R={id:H,object:"chat.completion.chunk",created:X,model:"orchestrated",choices:[{index:0,delta:_,finish_reason:S}]};if(N)R.usage=N;return`data: ${JSON.stringify(R)}
25
-
26
- `},j={prompt_tokens:z,completion_tokens:$,total_tokens:Y.total_tokens??z+$};if(typeof Y.cost_usd==="number")j.cost_usd=Y.cost_usd;if(typeof Y.cost_credits==="number")j.cost_credits=Y.cost_credits;if(typeof Y.context_window==="number")j.context_window=Y.context_window;let P=[G({role:"assistant",content:""},null),G({content:V},null),G({},Z,j),`data: [DONE]
27
-
28
- `],k=new TextEncoder,F=new ReadableStream({start(_){for(let S of P)_.enqueue(k.encode(S));_.close()}});return new Response(F,{status:200,headers:{"content-type":"text/event-stream"}})}function kJ(J){let K=J??{},{content:V,finishReason:Z}=l(K),Y=K.usage??{},z=Y.prompt_tokens??0,$=Y.completion_tokens??0,H={id:"orch-"+Date.now(),object:"chat.completion",created:Math.floor(Date.now()/1000),model:"orchestrated",choices:[{index:0,message:{role:"assistant",content:V},finish_reason:Z}],usage:{prompt_tokens:z,completion_tokens:$,total_tokens:Y.total_tokens??z+$,...typeof Y.cost_usd==="number"?{cost_usd:Y.cost_usd}:{},...typeof Y.context_window==="number"?{context_window:Y.context_window}:{}}};return new Response(JSON.stringify(H),{status:200,headers:{"content-type":"application/json"}})}function UJ(J,K=globalThis.fetch,V,Z){let Y=Z?.responseTimeoutMs??a;return async(z,$)=>{if($?.method==="POST"&&typeof $?.body==="string"){let H;try{H=JSON.parse($.body)}catch{return K(z,$)}let X=ZJ(),G=HJ(H.model??"default"),j=g(H,{toolMode:X,outputAdvisory:G}),P=await J(),k=typeof P==="string"?{key:P,method:"sso"}:P;if(!k?.key)throw new d;let F=new Headers($.headers);if(k.method==="api-key")F.delete("Authorization"),F.set("x-api-key",k.key);else F.delete("x-api-key"),F.set("Authorization",`Bearer ${k.key}`);if(F.set("Content-Type","application/json"),j.tier==="orchestrated"){let U=$.signal,D=new AbortController,W=()=>D.abort(U?.reason);if(U)if(U.aborted)D.abort(U.reason);else U.addEventListener("abort",W,{once:!0});let M=!1,w=setTimeout(()=>{M=!0,D.abort()},Y),q;try{q=await K(s,{method:"POST",headers:F,body:JSON.stringify(j),signal:D.signal})}catch(b){if(U?.removeEventListener("abort",W),M)throw new O(`no response within ${Math.round(Y/1000)}s`);throw b}finally{clearTimeout(w)}if(U?.removeEventListener("abort",W),q.status===402){let b=await q.text().catch(()=>"");throw new A(b||void 0)}if(q.status===429)throw new I;if(q.status===401||q.status===403){let b=await q.text().catch(()=>"");if(y(b))throw new O(`HTTP ${q.status}`);throw await V?.().catch(()=>{}),new v(b?`HTTP ${q.status}: ${b}`:`HTTP ${q.status}`)}if(!q.ok){let b=await q.text().catch(()=>"");throw new O(b?`HTTP ${q.status}: ${b}`:`HTTP ${q.status}`)}return NJ(await q.json())}let _=$.signal,S=async(U)=>{let D=new AbortController,W=()=>D.abort(_?.reason);if(_)if(_.aborted)D.abort(_.reason);else _.addEventListener("abort",W,{once:!0});let M=()=>_?.removeEventListener("abort",W),w=!1,q=setTimeout(()=>{w=!0,D.abort()},Y);try{return{res:await K(n,{method:"POST",headers:F,body:JSON.stringify(U),signal:D.signal}),detach:M}}catch(b){if(M(),w)throw new O(`no response within ${Math.round(Y/1000)}s`);throw b}finally{clearTimeout(q)}},{res:N,detach:R}=await S(j);if(N.status===400&&X==="native"&&$J(H))R(),await N.body?.cancel().catch(()=>{}),{res:N,detach:R}=await S(g(H,{toolMode:"text",outputAdvisory:G}));try{if(N.status===402){let U=await N.text().catch(()=>"");throw new A(U||void 0)}if(N.status===429)throw new I;if(N.status===401||N.status===403){let U=await N.text().catch(()=>"");if(y(U))throw new O(`HTTP ${N.status}`);throw await V?.().catch(()=>{}),new v(U?`HTTP ${N.status}: ${U}`:`HTTP ${N.status}`)}if(!N.ok){let U=await N.text().catch(()=>"");throw new O(U?`HTTP ${N.status}: ${U}`:`HTTP ${N.status}`)}}catch(U){throw R(),U}if(H.stream!==!1&&N.body){let U=Array.isArray(H.tools)&&H.tools.length>0;return new Response(XJ(N.body,{toolProtocolEnabled:U,tier:j.tier}),{status:N.status,statusText:N.statusText,headers:{"content-type":"text/event-stream"}})}return N}return K(z,$)}}function bJ(J){let K=J.getToken??(async()=>J.bearerToken),V=UJ(K,globalThis.fetch,J.onInvalidCredentials);return c({name:J.name??"qlex",baseURL:Q.streamBaseUrl(),fetch:V})}export{XJ as transformQlexStream,NJ as toOrchestratedSSEStream,kJ as toOpenAICompletion,PJ as sanitizeUpstreamProviderError,ZJ as resolveToolMode,KJ as renderToolProtocolPrompt,zJ as recordTierOutputAdvisory,WJ as partialTagSuffixLength,DJ as parseQlexFrame,e as normalizeQlexMessages,JJ as mergeLeadingSystemMessages,y as isGatewayRequiredError,$J as hasToolContext,HJ as getTierOutputAdvisory,h as flattenMessageContent,YJ as encodeToolProtocolMessages,bJ as createQlexProvider,UJ as createCustomFetch,_J as clearTierOutputAdvisories,g as buildQlexBody,i as ToolCallExtractor,T as TOOL_CALL_OPEN,B as TOOL_CALL_CLOSE,L as QlexStreamError,I as QlexRateLimitError,d as QlexNotLoggedInError,v as QlexInvalidCredentialsError,A as QlexInsufficientBalanceError,O as QlexGatewayError,n as QLEX_STREAM_URL,a as QLEX_RESPONSE_TIMEOUT_MS,s as QLEX_ORCHESTRATED_URL};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{n as a,o as b}from"./chunk-cnmq5xtq.js";import"./chunk-d65qs4d0.js";import"./chunk-83gqkmth.js";import"./chunk-c8k32724.js";import"./chunk-g9cjsfvg.js";import"./chunk-t9mz17gb.js";import"./chunk-yt3f3j35.js";import"./chunk-50sv6y2e.js";import"./chunk-wfb608qf.js";import"./chunk-eh7e49k4.js";import"./chunk-bzgj60w4.js";import"./chunk-kdcnder5.js";import"./chunk-x4sp99g6.js";import"./chunk-fvzwbjh8.js";import"./chunk-e10py6yr.js";import"./chunk-pxvk3syj.js";import"./chunk-rbk8seme.js";import"./chunk-68yw2hk9.js";import"./chunk-takew94z.js";import"./chunk-44a82dg0.js";import"./chunk-vxyy2dp3.js";import"./chunk-04n2ycg5.js";import"./chunk-8ymffyep.js";import"./chunk-mcg24gkb.js";import"./chunk-redjxn13.js";import"./chunk-bn0h9dny.js";import"./chunk-r4ndwym0.js";import"./chunk-3ytjm3az.js";import"./chunk-htz93dsd.js";import"./chunk-vcw00k0n.js";import"./chunk-r78czx4d.js";import"./chunk-2hc5z7b5.js";import"./chunk-d68fzyw7.js";import"./chunk-4jtxtkj7.js";import"./chunk-ay8emwym.js";import"./chunk-2maqde7w.js";import"./chunk-kj20f048.js";import"./chunk-cqtkxwd8.js";import"./chunk-x9rbv6p6.js";import"./chunk-g5rabwre.js";import"./chunk-jbx3s7nw.js";import"./chunk-15hw2z9t.js";import"./chunk-48ge2ryx.js";import"./chunk-n9xns8by.js";import"./chunk-y9q0hb7b.js";import"./chunk-c1bdzxbx.js";import"./chunk-ehhas0ew.js";import"./chunk-d6ry9418.js";import"./chunk-0dt0bxz6.js";import"./chunk-10bjs581.js";import"./chunk-4cnwn1rh.js";import"./chunk-gcw4rn10.js";import"./chunk-m5m448mg.js";import"./chunk-tqj69nh6.js";import"./chunk-ag8kz1e7.js";import"./chunk-5tray1fw.js";import"./chunk-c11d28qn.js";import"./chunk-mzs2pjyc.js";import"./chunk-gagtmjmp.js";import"./chunk-zs8kqdsf.js";import"./chunk-dxpj0cxh.js";import"./chunk-zw815d68.js";import"./chunk-7xm75w1e.js";export{b as tui,a as rendererConfig};