@caspian2026/agent-sdk 0.0.2 → 0.0.4

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 (219) hide show
  1. package/dist/{chunk-gcpfxk0c.js → chunk-095vqmds.js} +3 -3
  2. package/dist/{chunk-mxr2s6d1.js → chunk-0fhm9z6c.js} +16 -16
  3. package/dist/{chunk-qfk94vcn.js → chunk-0g5cy3wj.js} +4 -4
  4. package/dist/{chunk-htpehq9t.js → chunk-0jtbeesf.js} +2 -2
  5. package/dist/{chunk-960ze3jj.js → chunk-0m8q98kb.js} +15 -15
  6. package/dist/{chunk-5pp28k2r.js → chunk-0ym2z0c7.js} +1 -1
  7. package/dist/{chunk-c5mz5vw2.js → chunk-0zjqngwf.js} +2 -2
  8. package/dist/{chunk-8y30k9pz.js → chunk-16ytyka3.js} +2 -2
  9. package/dist/{chunk-qq0phwn8.js → chunk-17e8efpd.js} +16 -16
  10. package/dist/{chunk-p39a677r.js → chunk-1avyrycw.js} +23 -23
  11. package/dist/{chunk-055q0a2m.js → chunk-1avzakfd.js} +2 -2
  12. package/dist/{chunk-177s15bv.js → chunk-1dgdjrm1.js} +1 -1
  13. package/dist/{chunk-k5ez1h65.js → chunk-1jgr1xmv.js} +15 -15
  14. package/dist/{chunk-jxpmkae9.js → chunk-1kjqfv1c.js} +17 -17
  15. package/dist/{chunk-3mr5ryx4.js → chunk-1mky0pny.js} +3 -3
  16. package/dist/{chunk-hyb749hd.js → chunk-1mm70p6f.js} +15 -15
  17. package/dist/{chunk-018smjq7.js → chunk-1rjn0mzk.js} +1 -1
  18. package/dist/{chunk-0htx82k2.js → chunk-21gmrwhs.js} +3 -3
  19. package/dist/{chunk-zb8f6h5g.js → chunk-2gs4s61w.js} +101 -101
  20. package/dist/{chunk-5nchekqe.js → chunk-2jk0g0ej.js} +3 -3
  21. package/dist/{chunk-8mkwsdk1.js → chunk-2vgdqkw9.js} +1 -1
  22. package/dist/{chunk-7gvwg1v9.js → chunk-2yec5665.js} +18 -18
  23. package/dist/{chunk-26hg7303.js → chunk-30wsnkge.js} +2 -2
  24. package/dist/{chunk-jfja8q7w.js → chunk-317wp0wn.js} +16 -16
  25. package/dist/{chunk-80a8vabn.js → chunk-34rht45y.js} +18 -18
  26. package/dist/{chunk-qygmcg7w.js → chunk-3g1vqhyx.js} +3 -3
  27. package/dist/{chunk-6vthy0fj.js → chunk-3sgqn9w2.js} +15 -15
  28. package/dist/{chunk-1xct96nd.js → chunk-3x1b70w1.js} +15 -15
  29. package/dist/{chunk-ysanv95x.js → chunk-425w66ka.js} +1 -1
  30. package/dist/{chunk-70cw4cg9.js → chunk-4eersz9w.js} +8 -8
  31. package/dist/{chunk-682qgta2.js → chunk-4k0hbg1a.js} +15 -15
  32. package/dist/{chunk-5apfzkpy.js → chunk-4m9df5ef.js} +2 -2
  33. package/dist/{chunk-2h05vtpv.js → chunk-4var0kxc.js} +2 -2
  34. package/dist/{chunk-beg7bdyz.js → chunk-4vypk32f.js} +15 -15
  35. package/dist/{chunk-fshfxw2q.js → chunk-4w05nzbr.js} +1 -1
  36. package/dist/{chunk-f1m9pect.js → chunk-4xb3tk2t.js} +15 -15
  37. package/dist/{chunk-wjcq2vkf.js → chunk-5315xq5p.js} +15 -15
  38. package/dist/{chunk-537qfvn5.js → chunk-55te0vge.js} +17 -17
  39. package/dist/{chunk-xzhaa7gd.js → chunk-560c8jwm.js} +15 -15
  40. package/dist/{chunk-3yprydpw.js → chunk-56anbhek.js} +16 -16
  41. package/dist/{chunk-prcah3ys.js → chunk-57j7xceg.js} +15 -15
  42. package/dist/{chunk-p1zj9mg9.js → chunk-5bas1bgw.js} +15 -15
  43. package/dist/{chunk-f0rzvqmq.js → chunk-5j832wpx.js} +1 -1
  44. package/dist/{chunk-q6xs51jj.js → chunk-616gakh4.js} +2 -2
  45. package/dist/{chunk-2352ts05.js → chunk-6dsqeb38.js} +5 -5
  46. package/dist/{chunk-n18q5yqs.js → chunk-6g9cwd71.js} +25 -25
  47. package/dist/{chunk-k591cwbg.js → chunk-6x4zn0e1.js} +16 -16
  48. package/dist/{chunk-gkyzz8er.js → chunk-7cstfzdy.js} +2 -2
  49. package/dist/{chunk-jy9rxxqe.js → chunk-7rnqsng2.js} +3 -3
  50. package/dist/{chunk-d1pyf9as.js → chunk-7rz6y0tq.js} +10 -10
  51. package/dist/{chunk-zesnmkg3.js → chunk-7wdcfh4q.js} +3 -3
  52. package/dist/{chunk-8qhxyqj9.js → chunk-820f1c21.js} +15 -15
  53. package/dist/{chunk-nw9t5pq9.js → chunk-82n4y2dc.js} +1 -1
  54. package/dist/{chunk-zf47r1b7.js → chunk-88e7rxwn.js} +15 -15
  55. package/dist/{chunk-0kj8bq80.js → chunk-89cxsbxc.js} +15 -15
  56. package/dist/{chunk-v8g3kad0.js → chunk-89hcdy9t.js} +16 -16
  57. package/dist/{chunk-ratvcbmn.js → chunk-8aj0rx52.js} +16 -16
  58. package/dist/{chunk-qk7dfae6.js → chunk-8hpq2659.js} +1 -1
  59. package/dist/{chunk-ctdg0qxh.js → chunk-8se4t1n2.js} +22 -22
  60. package/dist/{chunk-q7zpf4r2.js → chunk-8vq3knm0.js} +1 -1
  61. package/dist/{chunk-3qbdzsvm.js → chunk-8xwx1xtg.js} +2 -2
  62. package/dist/{chunk-zshzdw1n.js → chunk-8ydbrnf1.js} +16 -16
  63. package/dist/{chunk-evp5pb9x.js → chunk-987n7wxq.js} +21 -21
  64. package/dist/{chunk-5fs6nkjr.js → chunk-9cvywhh8.js} +1 -1
  65. package/dist/{chunk-ev3qkf76.js → chunk-9hqrbv6v.js} +16 -16
  66. package/dist/{chunk-8n42zyfx.js → chunk-9p155d20.js} +2 -2
  67. package/dist/{chunk-q8c88vjm.js → chunk-9p88n9h9.js} +1 -1
  68. package/dist/{chunk-qj2e1apf.js → chunk-9x21rzc2.js} +63 -18
  69. package/dist/{chunk-tqmtkm0k.js → chunk-9yp4n9y7.js} +15 -15
  70. package/dist/{chunk-nebezy1d.js → chunk-a30v3z9j.js} +1 -1
  71. package/dist/{chunk-9grztvcg.js → chunk-a3h0jbbh.js} +18 -18
  72. package/dist/{chunk-ne5r3k03.js → chunk-aqhpkb8j.js} +16 -16
  73. package/dist/{chunk-vmbfv1y5.js → chunk-aqzymhrn.js} +2 -2
  74. package/dist/{chunk-hqqkj5pg.js → chunk-arhcgn51.js} +2 -2
  75. package/dist/{chunk-en8wkxh7.js → chunk-as5rvw4n.js} +4 -4
  76. package/dist/{chunk-6maej1hh.js → chunk-at1f2ywf.js} +2 -2
  77. package/dist/{chunk-tjcfpk38.js → chunk-b971scpe.js} +2 -2
  78. package/dist/{chunk-1c4j7qn2.js → chunk-bfzvmq85.js} +17 -17
  79. package/dist/{chunk-3389cj3w.js → chunk-bv1e9zhq.js} +15 -15
  80. package/dist/{chunk-4dn3n459.js → chunk-bvveczfm.js} +15 -15
  81. package/dist/{chunk-pckwmrzd.js → chunk-c11pmm4v.js} +3 -3
  82. package/dist/{chunk-efgjfast.js → chunk-c91nypz4.js} +1 -1
  83. package/dist/{chunk-7m2hp89m.js → chunk-c94meqzs.js} +3 -3
  84. package/dist/{chunk-8hj8ms5q.js → chunk-cfrxsh8r.js} +4 -4
  85. package/dist/{chunk-cxq7gc42.js → chunk-cgb2gp86.js} +15 -15
  86. package/dist/{chunk-fn1vvj8k.js → chunk-ckn5yj8j.js} +15 -15
  87. package/dist/{chunk-vzgkedm9.js → chunk-cm2v5g1p.js} +645 -754
  88. package/dist/{chunk-sw9ax3ym.js → chunk-cqa1kg0f.js} +19 -19
  89. package/dist/{chunk-7acgdm7x.js → chunk-cvm2tmwg.js} +3 -3
  90. package/dist/{chunk-sfcpjh4r.js → chunk-cyv6ms4j.js} +15 -15
  91. package/dist/{chunk-rvnb2gn6.js → chunk-d57akz81.js} +15 -15
  92. package/dist/{chunk-msecaxyj.js → chunk-d6rypdxt.js} +1 -1
  93. package/dist/{chunk-e97mp86b.js → chunk-dg0smfkn.js} +21 -21
  94. package/dist/{chunk-7yxvpj5j.js → chunk-dpf0m4gm.js} +16 -16
  95. package/dist/{chunk-hx3j6n92.js → chunk-dpns9q66.js} +16 -16
  96. package/dist/{chunk-mpbfkp8j.js → chunk-ds0s8q1e.js} +15 -15
  97. package/dist/{chunk-nhapyawz.js → chunk-dz73wv84.js} +55 -55
  98. package/dist/{chunk-vjn8mbcw.js → chunk-e3b3cm2x.js} +3 -3
  99. package/dist/{chunk-vb3x3cxe.js → chunk-e3xnqgg2.js} +24 -24
  100. package/dist/{chunk-7kcm5hn2.js → chunk-e503mhac.js} +3 -3
  101. package/dist/{chunk-q3jr5t07.js → chunk-e5t5eefc.js} +2 -2
  102. package/dist/{chunk-tp2jxmcx.js → chunk-e7efcp3k.js} +19 -19
  103. package/dist/{chunk-pcb7fbyg.js → chunk-ew3q65ss.js} +3 -3
  104. package/dist/{chunk-jr1xm1dd.js → chunk-ezaw2s8t.js} +20 -20
  105. package/dist/{chunk-2nv3d0he.js → chunk-f2fr72ts.js} +15 -15
  106. package/dist/{chunk-exah13mz.js → chunk-f5t2phet.js} +15 -15
  107. package/dist/{chunk-jk69qtzx.js → chunk-fbb45n14.js} +15 -15
  108. package/dist/{chunk-zghtdbat.js → chunk-fcpekt4c.js} +3 -3
  109. package/dist/{chunk-kajf3jgq.js → chunk-fxx785xe.js} +21 -21
  110. package/dist/{chunk-0kxcq8h9.js → chunk-g1ywy5br.js} +16 -16
  111. package/dist/{chunk-505mxxa9.js → chunk-ga86yjm1.js} +4 -4
  112. package/dist/{chunk-6t8yqfks.js → chunk-gdg6805t.js} +17 -17
  113. package/dist/{chunk-qwqjesx7.js → chunk-gdhz1652.js} +5 -5
  114. package/dist/{chunk-cdhmrbj4.js → chunk-gf5znw5n.js} +46 -46
  115. package/dist/{chunk-q6cfkntd.js → chunk-gqy9hsnm.js} +20 -20
  116. package/dist/{chunk-yff68ex1.js → chunk-gvrjgq1n.js} +2 -2
  117. package/dist/{chunk-wby6yd4m.js → chunk-h7m1p3rj.js} +16 -16
  118. package/dist/{chunk-my40g5hp.js → chunk-h8b7g6wh.js} +17 -17
  119. package/dist/{chunk-hchy0hq6.js → chunk-h95xc5bs.js} +3 -3
  120. package/dist/{chunk-2n7bbxm6.js → chunk-hhykgfc1.js} +16 -16
  121. package/dist/{chunk-69fgaak0.js → chunk-hvxyk4sa.js} +20 -20
  122. package/dist/{chunk-jyw3np47.js → chunk-j0amyr6k.js} +3 -3
  123. package/dist/{chunk-5rt4b8q9.js → chunk-j1ajjc3e.js} +23 -23
  124. package/dist/{chunk-kqggbte3.js → chunk-j4tk2ycp.js} +15 -15
  125. package/dist/{chunk-gxahdggv.js → chunk-jb40j5s1.js} +1 -1
  126. package/dist/{chunk-c37j5zxe.js → chunk-jmkn11my.js} +4 -4
  127. package/dist/{chunk-46hdszda.js → chunk-jpc9zwsk.js} +1 -1
  128. package/dist/{chunk-21bcvwr7.js → chunk-jybbewy1.js} +2 -2
  129. package/dist/{chunk-wtjt9qyk.js → chunk-jz892s9k.js} +10 -10
  130. package/dist/{chunk-pkkngdv0.js → chunk-k1k9c7z4.js} +64 -64
  131. package/dist/{chunk-a8792r1c.js → chunk-kdy55ceb.js} +3 -3
  132. package/dist/{chunk-rsq0h0rz.js → chunk-kndzdvxv.js} +21 -21
  133. package/dist/{chunk-6gh20s05.js → chunk-ks3ha3tz.js} +16 -16
  134. package/dist/{chunk-cc2tg4q8.js → chunk-ky39hkg1.js} +1 -1
  135. package/dist/{chunk-xd6kmmb1.js → chunk-kyqa1yzb.js} +22 -22
  136. package/dist/{chunk-pqvr8jq7.js → chunk-m3t8ps5y.js} +16 -16
  137. package/dist/{chunk-h6fsks9j.js → chunk-m5e40qm8.js} +16 -16
  138. package/dist/{chunk-430yrtmk.js → chunk-mbaqbx3h.js} +16 -16
  139. package/dist/{chunk-vrf54kmt.js → chunk-mch06cr9.js} +1 -1
  140. package/dist/{chunk-572vjq78.js → chunk-mk1y74w7.js} +3 -3
  141. package/dist/{chunk-2vqrdwx9.js → chunk-mng7stmp.js} +5 -5
  142. package/dist/{chunk-k2rybwww.js → chunk-mpn7t2e3.js} +16 -16
  143. package/dist/{chunk-k3939ggz.js → chunk-mprs88r7.js} +15 -15
  144. package/dist/{chunk-kr6qfwq0.js → chunk-ms362nhv.js} +1 -1
  145. package/dist/{chunk-bktfq0ns.js → chunk-mtnm04rp.js} +21 -21
  146. package/dist/{chunk-qj2mk79w.js → chunk-mw63s1zq.js} +2 -2
  147. package/dist/{chunk-ped973jn.js → chunk-n22dkg3y.js} +2 -2
  148. package/dist/{chunk-b0qptb1k.js → chunk-njrt3tac.js} +1 -1
  149. package/dist/{chunk-nxgsnh2y.js → chunk-nk82j7r2.js} +1 -1
  150. package/dist/{chunk-ebqwkhyf.js → chunk-npzbmwxy.js} +63 -63
  151. package/dist/{chunk-tvgvt220.js → chunk-nqn45znr.js} +9 -9
  152. package/dist/{chunk-7h2ybnf3.js → chunk-p13fw39x.js} +15 -15
  153. package/dist/{chunk-q6m26rc8.js → chunk-p602tkkz.js} +15 -15
  154. package/dist/{chunk-6t4a9cgj.js → chunk-p6zna4pn.js} +7 -7
  155. package/dist/{chunk-chakj069.js → chunk-q09vd0nw.js} +2 -2
  156. package/dist/{chunk-kjh11txh.js → chunk-q34bcbww.js} +15 -15
  157. package/dist/{chunk-spybh2dy.js → chunk-qav4kabk.js} +15 -15
  158. package/dist/{chunk-68w91pzt.js → chunk-qcnhb4cd.js} +7 -7
  159. package/dist/{chunk-w0yhbmxn.js → chunk-qqqaksgr.js} +18 -18
  160. package/dist/{chunk-zpmwvd09.js → chunk-qt0ddqas.js} +2 -2
  161. package/dist/{chunk-bdrjvs5k.js → chunk-qvh1w3t7.js} +2 -2
  162. package/dist/{chunk-nb6abcch.js → chunk-r6kaak61.js} +2 -2
  163. package/dist/{chunk-1yrcnrs7.js → chunk-rh6nm7zk.js} +16 -16
  164. package/dist/{chunk-2h0y6m16.js → chunk-rm2vtv77.js} +4 -4
  165. package/dist/{chunk-ahr1r7c6.js → chunk-rypet27a.js} +14 -14
  166. package/dist/{chunk-10qhq6f8.js → chunk-s7fh7n8s.js} +7 -7
  167. package/dist/{chunk-n0kmh4ra.js → chunk-sgr54ekm.js} +1 -1
  168. package/dist/{chunk-46hd1gyd.js → chunk-sv4cyh4x.js} +1 -1
  169. package/dist/{chunk-yg4vgpxs.js → chunk-t023rz4p.js} +2 -2
  170. package/dist/{chunk-19e603rv.js → chunk-t92cwjf4.js} +15 -15
  171. package/dist/{chunk-162ewhvy.js → chunk-th4n75pg.js} +15 -15
  172. package/dist/{chunk-p11xp4xp.js → chunk-tkt32f37.js} +1 -1
  173. package/dist/{chunk-jss0azv7.js → chunk-tncasfc8.js} +15 -15
  174. package/dist/{chunk-e2mv8ts8.js → chunk-tyhxfyv5.js} +16 -16
  175. package/dist/{chunk-qzj4e8fn.js → chunk-vajwapkf.js} +4 -4
  176. package/dist/{chunk-d4kwjqjy.js → chunk-vn5gr8dp.js} +1 -1
  177. package/dist/{chunk-e8p3fy6v.js → chunk-vq260rpw.js} +15 -15
  178. package/dist/{chunk-m1cehfta.js → chunk-vqp4phq0.js} +15 -15
  179. package/dist/{chunk-d7f1pzkq.js → chunk-vsqwd13w.js} +3 -3
  180. package/dist/{chunk-3e20cj49.js → chunk-vvkb8ej8.js} +4 -4
  181. package/dist/{chunk-npnvheft.js → chunk-w1g29evv.js} +18 -18
  182. package/dist/{chunk-waqwgprq.js → chunk-wcmyztt6.js} +25 -25
  183. package/dist/{chunk-s4cb0bcb.js → chunk-wr3pd88n.js} +1 -1
  184. package/dist/{chunk-w004kfw0.js → chunk-wva2xtyc.js} +23 -23
  185. package/dist/{chunk-e4bhfc6d.js → chunk-wwet4ffh.js} +15 -15
  186. package/dist/{chunk-ercvcek8.js → chunk-x1r3c099.js} +15 -15
  187. package/dist/{chunk-46n7byh8.js → chunk-x722mdg1.js} +18 -18
  188. package/dist/{chunk-e4p1jbs4.js → chunk-x94btg29.js} +3 -3
  189. package/dist/{chunk-0jmt5sx1.js → chunk-xcvyzxak.js} +15 -15
  190. package/dist/{chunk-rx278zpa.js → chunk-xd6f7sq8.js} +1 -1
  191. package/dist/{chunk-jgwd85hp.js → chunk-xecv7nyz.js} +18 -18
  192. package/dist/{chunk-hzgnejb1.js → chunk-xj4177ny.js} +2 -2
  193. package/dist/{chunk-p1hwrf72.js → chunk-xnv6kb39.js} +6 -6
  194. package/dist/{chunk-etgh9xvt.js → chunk-xq2k0708.js} +17 -17
  195. package/dist/{chunk-fbvw6wq9.js → chunk-xt34mfm4.js} +23 -23
  196. package/dist/{chunk-bvf2z3g6.js → chunk-xv460e3d.js} +18 -18
  197. package/dist/{chunk-j3zhb8vv.js → chunk-xwg327ys.js} +1 -1
  198. package/dist/{chunk-pxdzy0jh.js → chunk-xz4md1nk.js} +17 -17
  199. package/dist/{chunk-b2fd462a.js → chunk-xz655xxa.js} +1 -1
  200. package/dist/{chunk-kbm69rtz.js → chunk-y0fhjxef.js} +2 -2
  201. package/dist/{chunk-35sgv3er.js → chunk-y2p1r9d8.js} +3 -3
  202. package/dist/{chunk-kvfg8eeg.js → chunk-y30xrr37.js} +1 -1
  203. package/dist/{chunk-zqncgyf6.js → chunk-y8ncxg44.js} +16 -16
  204. package/dist/{chunk-zr6mz36s.js → chunk-y9kxzntj.js} +2 -2
  205. package/dist/{chunk-50bay5qy.js → chunk-yc0k454w.js} +27 -27
  206. package/dist/{chunk-15sfg4bs.js → chunk-yc23zxmj.js} +1 -1
  207. package/dist/{chunk-v0qraze5.js → chunk-yfyfkpkr.js} +15 -15
  208. package/dist/{chunk-mg7pbk0r.js → chunk-ym5m3v80.js} +1 -1
  209. package/dist/{chunk-mpk1sjyk.js → chunk-ysh2b44y.js} +23 -23
  210. package/dist/{chunk-yk62vxj2.js → chunk-ywchtr3y.js} +7 -7
  211. package/dist/{chunk-1xvcvdef.js → chunk-z2txyqmj.js} +17 -17
  212. package/dist/{chunk-zx5kw7z4.js → chunk-z5d6k0by.js} +2 -2
  213. package/dist/{chunk-gdg6411p.js → chunk-zdq8eg01.js} +15 -15
  214. package/dist/{chunk-tc1aazk4.js → chunk-zegpeqny.js} +16 -16
  215. package/dist/{chunk-5dmhsqap.js → chunk-zg68a3rk.js} +2 -2
  216. package/dist/cli.js +5 -5
  217. package/dist/sdk/query.cjs +407 -0
  218. package/dist/sdk/query.js +372 -0
  219. package/package.json +129 -122
@@ -0,0 +1,407 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropNames = Object.getOwnPropertyNames;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ function __accessProp(key) {
6
+ return this[key];
7
+ }
8
+ var __toCommonJS = (from) => {
9
+ var entry = (__moduleCache ??= new WeakMap).get(from), desc;
10
+ if (entry)
11
+ return entry;
12
+ entry = __defProp({}, "__esModule", { value: true });
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (var key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(entry, key))
16
+ __defProp(entry, key, {
17
+ get: __accessProp.bind(from, key),
18
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
19
+ });
20
+ }
21
+ __moduleCache.set(from, entry);
22
+ return entry;
23
+ };
24
+ var __moduleCache;
25
+ var __returnValue = (v) => v;
26
+ function __exportSetter(name, newValue) {
27
+ this[name] = __returnValue.bind(null, newValue);
28
+ }
29
+ var __export = (target, all) => {
30
+ for (var name in all)
31
+ __defProp(target, name, {
32
+ get: all[name],
33
+ enumerable: true,
34
+ configurable: true,
35
+ set: __exportSetter.bind(all, name)
36
+ });
37
+ };
38
+
39
+ // src/entrypoints/sdk/query.ts
40
+ var exports_query = {};
41
+ __export(exports_query, {
42
+ query: () => query
43
+ });
44
+ module.exports = __toCommonJS(exports_query);
45
+ var import_node_child_process = require("node:child_process");
46
+ var import_node_readline = require("node:readline");
47
+ var require_ = require;
48
+ function resolveCliPath(options) {
49
+ if (options.pathToClaudeCodeExecutable) {
50
+ return options.pathToClaudeCodeExecutable;
51
+ }
52
+ try {
53
+ return require_.resolve("@caspian2026/agent-sdk/dist/cli.js");
54
+ } catch {
55
+ throw new Error("Cannot resolve CLI path. Set options.pathToClaudeCodeExecutable or install @caspian2026/agent-sdk.");
56
+ }
57
+ }
58
+ function buildCliArgs(options) {
59
+ const args = ["-p", "--output-format", "stream-json", "--input-format", "stream-json", "--verbose"];
60
+ if (options.model) {
61
+ args.push("--model", options.model);
62
+ }
63
+ if (options.resume) {
64
+ args.push("--resume", options.resume);
65
+ }
66
+ if (options.continue) {
67
+ args.push("--continue");
68
+ }
69
+ if (options.permissionMode) {
70
+ args.push("--permission-mode", options.permissionMode);
71
+ }
72
+ if (options.maxTurns !== undefined) {
73
+ args.push("--max-turns", String(options.maxTurns));
74
+ }
75
+ if (options.maxBudgetUsd !== undefined) {
76
+ args.push("--max-budget-usd", String(options.maxBudgetUsd));
77
+ }
78
+ if (options.thinking) {
79
+ args.push("--thinking", options.thinking);
80
+ }
81
+ if (options.allowedTools?.length) {
82
+ args.push("--allowed-tools", ...options.allowedTools);
83
+ }
84
+ if (options.includePartialMessages) {
85
+ args.push("--include-partial-messages");
86
+ }
87
+ if (options.allowDangerouslySkipPermissions) {
88
+ args.push("--dangerously-skip-permissions");
89
+ }
90
+ if (options.permissionPromptToolName) {
91
+ args.push("--permission-prompt-tool", options.permissionPromptToolName);
92
+ }
93
+ if (options.plugins?.length) {
94
+ for (const plugin of options.plugins) {
95
+ args.push("--plugin-dir", plugin.path);
96
+ }
97
+ }
98
+ if (options.additionalDirectories?.length) {
99
+ args.push("--add-dir", ...options.additionalDirectories);
100
+ }
101
+ if (options.settingSources?.length) {
102
+ args.push("--setting-sources", ...options.settingSources);
103
+ }
104
+ if (typeof options.systemPrompt === "string") {
105
+ args.push("--system-prompt", options.systemPrompt);
106
+ } else if (options.systemPrompt && typeof options.systemPrompt === "object") {
107
+ if (options.systemPrompt.type === "preset" && options.systemPrompt.append) {
108
+ args.push("--append-system-prompt", options.systemPrompt.append);
109
+ }
110
+ }
111
+ if (options.fallbackModel) {
112
+ args.push("--fallback-model", options.fallbackModel);
113
+ }
114
+ if (options.mcpServers && Object.keys(options.mcpServers).length > 0) {
115
+ args.push("--mcp-config", JSON.stringify(options.mcpServers));
116
+ }
117
+ if (options.extraArgs) {
118
+ for (const [key, value] of Object.entries(options.extraArgs)) {
119
+ if (value === null) {
120
+ args.push(key);
121
+ } else {
122
+ args.push(key, value);
123
+ }
124
+ }
125
+ }
126
+ return args;
127
+ }
128
+ function ndjsonParse(line) {
129
+ if (!line.trim())
130
+ return;
131
+ return JSON.parse(line);
132
+ }
133
+ function ndjsonStringify(obj) {
134
+ return JSON.stringify(obj) + `
135
+ `;
136
+ }
137
+ function buildHookCallbackMap(hooks) {
138
+ const map = new Map;
139
+ if (!hooks)
140
+ return map;
141
+ for (const [_event, matchers] of Object.entries(hooks)) {
142
+ if (!matchers)
143
+ continue;
144
+ for (const matcher of matchers) {
145
+ for (const hook of matcher.hooks) {
146
+ const id = `hook_${_event}_${matcher.matcher || "all"}_${map.size}`;
147
+ map.set(id, { callback: hook, timeout: matcher.timeout });
148
+ }
149
+ }
150
+ }
151
+ return map;
152
+ }
153
+ function buildHooksConfig(hooks) {
154
+ if (!hooks)
155
+ return;
156
+ const config = {};
157
+ for (const [event, matchers] of Object.entries(hooks)) {
158
+ if (!matchers)
159
+ continue;
160
+ const eventHooks = [];
161
+ for (const matcher of matchers) {
162
+ const callbackIds = [];
163
+ for (let i = 0;i < matcher.hooks.length; i++) {
164
+ callbackIds.push(`hook_${event}_${matcher.matcher || "all"}_${eventHooks.length * matcher.hooks.length + i}`);
165
+ }
166
+ eventHooks.push({
167
+ matcher: matcher.matcher,
168
+ hookCallbackIds: callbackIds,
169
+ timeout: matcher.timeout
170
+ });
171
+ }
172
+ if (eventHooks.length > 0) {
173
+ config[event] = eventHooks;
174
+ }
175
+ }
176
+ return Object.keys(config).length > 0 ? config : undefined;
177
+ }
178
+ async function* query(params) {
179
+ const { prompt, options } = params;
180
+ const abortController = options.abortController ?? new AbortController;
181
+ const signal = abortController.signal;
182
+ const cliPath = resolveCliPath(options);
183
+ const cliArgs = buildCliArgs(options);
184
+ const cliDir = options.cwd ?? process.cwd();
185
+ const env = {
186
+ ...process.env,
187
+ ...options.env,
188
+ ELECTRON_RUN_AS_NODE: "1"
189
+ };
190
+ const child = import_node_child_process.spawn(process.execPath, [cliPath, ...cliArgs], {
191
+ cwd: cliDir,
192
+ env,
193
+ stdio: ["pipe", "pipe", "pipe"],
194
+ signal
195
+ });
196
+ const stdin = child.stdin;
197
+ const stdout = child.stdout;
198
+ const stderr = child.stderr;
199
+ if (options.stderr) {
200
+ stderr.on("data", (chunk) => {
201
+ options.stderr(chunk.toString());
202
+ });
203
+ } else {
204
+ stderr.resume();
205
+ }
206
+ const hookCallbacks = buildHookCallbackMap(options.hooks);
207
+ const pendingControlRequests = new Map;
208
+ const hooksConfig = buildHooksConfig(options.hooks);
209
+ if (hooksConfig) {
210
+ const initRequestId = "sdk-init-hooks";
211
+ const initRequest = {
212
+ type: "control_request",
213
+ request_id: initRequestId,
214
+ request: {
215
+ subtype: "initialize",
216
+ hooks: hooksConfig
217
+ }
218
+ };
219
+ stdin.write(ndjsonStringify(initRequest));
220
+ }
221
+ const promptQueue = [];
222
+ async function writePrompt() {
223
+ if (typeof prompt === "string") {
224
+ const msg = {
225
+ type: "user",
226
+ content: prompt,
227
+ uuid: "",
228
+ session_id: "",
229
+ message: { role: "user", content: prompt },
230
+ parent_tool_use_id: null
231
+ };
232
+ stdin.write(ndjsonStringify(msg));
233
+ } else {
234
+ for await (const userMsg of prompt) {
235
+ if (signal.aborted)
236
+ break;
237
+ stdin.write(ndjsonStringify(userMsg));
238
+ }
239
+ }
240
+ }
241
+ const promptPromise = writePrompt().catch((err) => {
242
+ if (!signal.aborted) {
243
+ throw err;
244
+ }
245
+ });
246
+ const rl = import_node_readline.createInterface({ input: stdout });
247
+ async function handleControlRequest(msg) {
248
+ const { request_id, request } = msg;
249
+ try {
250
+ switch (request.subtype) {
251
+ case "can_use_tool": {
252
+ if (!options.canUseTool) {
253
+ const response2 = {
254
+ type: "control_response",
255
+ response: { subtype: "success", request_id, response: { behavior: "deny", message: "No permission handler configured" } }
256
+ };
257
+ stdin.write(ndjsonStringify(response2));
258
+ break;
259
+ }
260
+ const toolName = request.tool_name;
261
+ const toolInput = request.input ?? {};
262
+ const toolUseID = request.tool_use_id;
263
+ const suggestions = request.permission_suggestions;
264
+ const blockedPath = request.blocked_path;
265
+ const decisionReason = request.decision_reason;
266
+ const agentID = request.agent_id;
267
+ const result = await options.canUseTool(toolName, toolInput, {
268
+ signal,
269
+ suggestions,
270
+ blockedPath,
271
+ decisionReason,
272
+ toolUseID,
273
+ agentID
274
+ });
275
+ const response = {
276
+ type: "control_response",
277
+ response: {
278
+ subtype: "success",
279
+ request_id,
280
+ response: result
281
+ }
282
+ };
283
+ stdin.write(ndjsonStringify(response));
284
+ break;
285
+ }
286
+ case "hook_callback": {
287
+ const callbackId = request.callback_id;
288
+ const hookInput = request.input;
289
+ const toolUseId = request.tool_use_id;
290
+ const hookEntry = hookCallbacks.get(callbackId);
291
+ if (hookEntry) {
292
+ const result = await hookEntry.callback(hookInput, toolUseId, { signal });
293
+ const response = {
294
+ type: "control_response",
295
+ response: {
296
+ subtype: "success",
297
+ request_id,
298
+ response: result
299
+ }
300
+ };
301
+ stdin.write(ndjsonStringify(response));
302
+ } else {
303
+ const response = {
304
+ type: "control_response",
305
+ response: {
306
+ subtype: "success",
307
+ request_id,
308
+ response: {}
309
+ }
310
+ };
311
+ stdin.write(ndjsonStringify(response));
312
+ }
313
+ break;
314
+ }
315
+ case "initialize": {
316
+ const response = {
317
+ type: "control_response",
318
+ response: { subtype: "success", request_id, response: {} }
319
+ };
320
+ stdin.write(ndjsonStringify(response));
321
+ break;
322
+ }
323
+ default: {
324
+ const response = {
325
+ type: "control_response",
326
+ response: { subtype: "success", request_id, response: {} }
327
+ };
328
+ stdin.write(ndjsonStringify(response));
329
+ }
330
+ }
331
+ } catch (err) {
332
+ const errorMsg = err instanceof Error ? err.message : String(err);
333
+ const response = {
334
+ type: "control_response",
335
+ response: { subtype: "error", request_id, error: errorMsg }
336
+ };
337
+ try {
338
+ stdin.write(ndjsonStringify(response));
339
+ } catch {}
340
+ }
341
+ }
342
+ try {
343
+ for await (const line of rl) {
344
+ if (signal.aborted)
345
+ break;
346
+ let msg;
347
+ try {
348
+ msg = ndjsonParse(line);
349
+ } catch {
350
+ continue;
351
+ }
352
+ if (!msg || typeof msg !== "object")
353
+ continue;
354
+ const typed = msg;
355
+ switch (typed.type) {
356
+ case "control_request": {
357
+ handleControlRequest(typed).catch(() => {});
358
+ break;
359
+ }
360
+ case "control_response": {
361
+ const resp = typed;
362
+ const pending = pendingControlRequests.get(resp.response.request_id);
363
+ if (pending) {
364
+ pendingControlRequests.delete(resp.response.request_id);
365
+ if (resp.response.subtype === "error") {
366
+ pending.reject(new Error(resp.response.error));
367
+ } else {
368
+ pending.resolve(resp.response);
369
+ }
370
+ }
371
+ break;
372
+ }
373
+ case "control_cancel_request": {
374
+ const cancel = typed;
375
+ const pending = pendingControlRequests.get(cancel.request_id);
376
+ if (pending) {
377
+ pendingControlRequests.delete(cancel.request_id);
378
+ pending.reject(new Error("Request cancelled"));
379
+ }
380
+ break;
381
+ }
382
+ case "keep_alive": {
383
+ stdin.write(ndjsonStringify({ type: "keep_alive" }));
384
+ break;
385
+ }
386
+ default: {
387
+ if (typed.type === "assistant" || typed.type === "user" || typed.type === "system" || typed.type === "result" || typed.type === "stream_event" || typed.type === "tool_progress") {
388
+ yield typed;
389
+ }
390
+ }
391
+ }
392
+ }
393
+ } finally {
394
+ rl.close();
395
+ try {
396
+ stdin.end();
397
+ } catch {}
398
+ if (!child.killed) {
399
+ child.kill();
400
+ }
401
+ for (const pending of pendingControlRequests.values()) {
402
+ pending.reject(new Error("Query ended"));
403
+ }
404
+ pendingControlRequests.clear();
405
+ await promptPromise.catch(() => {});
406
+ }
407
+ }