claude-code-best 1.3.7 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/{chunk-xtaw765g.js → chunk-00b2znqm.js} +2 -2
- package/dist/{chunk-vam5at9t.js → chunk-0ctfznp2.js} +83 -82
- package/dist/{chunk-db82mfh9.js → chunk-0kp39at8.js} +38 -38
- package/dist/{chunk-427mfnyx.js → chunk-0n0r9fwa.js} +1 -1
- package/dist/{chunk-86tz7yxt.js → chunk-0qe6jzfm.js} +26 -26
- package/dist/{chunk-z66q1nam.js → chunk-0rbezx7s.js} +26 -26
- package/dist/{chunk-6ex0f5ej.js → chunk-0w8eb8gt.js} +2 -2
- package/dist/{chunk-d267stxj.js → chunk-0z0m6mm5.js} +1 -1
- package/dist/{chunk-mfzgqp0c.js → chunk-157v5wtn.js} +2 -2
- package/dist/{chunk-ps5rsyxe.js → chunk-1e8f0nx0.js} +26 -26
- package/dist/{chunk-xcq3rdb0.js → chunk-1j332jvg.js} +10 -10
- package/dist/{chunk-9jg130e9.js → chunk-1neq14g8.js} +26 -26
- package/dist/{chunk-qwa5erw8.js → chunk-1zjrec16.js} +5 -5
- package/dist/{chunk-tvnrwrg3.js → chunk-21pvq2fw.js} +29 -29
- package/dist/{chunk-9tc901nb.js → chunk-25yy8wx5.js} +4 -4
- package/dist/{chunk-yp2yx0qj.js → chunk-29p0hjfs.js} +2 -2
- package/dist/{chunk-mcbqmbp2.js → chunk-29yjrfeq.js} +1 -1
- package/dist/{chunk-2h06sph0.js → chunk-2apay7a3.js} +29 -29
- package/dist/{chunk-9k2c5sxb.js → chunk-2c4003f8.js} +26 -26
- package/dist/{chunk-h7ffkxg4.js → chunk-2eb66dha.js} +6 -6
- package/dist/{chunk-8q4yg5pk.js → chunk-2j4wdmkt.js} +1 -1
- package/dist/{chunk-r6gyed9y.js → chunk-2mbctja8.js} +5 -5
- package/dist/{chunk-zc1s4swn.js → chunk-2smwf3e9.js} +2 -2
- package/dist/{chunk-k303kw9v.js → chunk-2x5az5dc.js} +27 -27
- package/dist/{chunk-76hrbqgr.js → chunk-34vnwd0v.js} +8 -8
- package/dist/{chunk-ga2vcmhy.js → chunk-386z9vh4.js} +28 -28
- package/dist/{chunk-14mkqwft.js → chunk-3ah2pq1f.js} +32 -32
- package/dist/{chunk-c8rgc3hw.js → chunk-3c0rxf7q.js} +31 -31
- package/dist/{chunk-e8zmtbry.js → chunk-3ef0cpf6.js} +27 -27
- package/dist/{chunk-mh8752jz.js → chunk-3fjgkntc.js} +1 -1
- package/dist/{chunk-qvywetwr.js → chunk-3gtk4mh3.js} +31 -31
- package/dist/{chunk-4ayhftnk.js → chunk-3gww1j1y.js} +32 -28
- package/dist/{chunk-zhe3rws3.js → chunk-3wjy1cpr.js} +4 -4
- package/dist/{chunk-w65283w4.js → chunk-4169yf5x.js} +2 -2
- package/dist/{chunk-h6dqpbac.js → chunk-43b84za2.js} +1 -1
- package/dist/{chunk-zmpygkz6.js → chunk-4581z0wr.js} +8 -8
- package/dist/{chunk-kcp8svja.js → chunk-45bbgebk.js} +4 -4
- package/dist/{chunk-xfft38wf.js → chunk-4drmj637.js} +5 -5
- package/dist/{chunk-2crz81z3.js → chunk-4f4jqsza.js} +1 -1
- package/dist/{chunk-fx6ghdvg.js → chunk-4f5xrg8h.js} +26 -26
- package/dist/{chunk-cdgv0k77.js → chunk-4gpt5ay1.js} +27 -27
- package/dist/{chunk-tw2wjsnb.js → chunk-4krsdy3p.js} +2 -2
- package/dist/{chunk-qhbchv06.js → chunk-4m47hfh0.js} +26 -26
- package/dist/{chunk-qahkzpj6.js → chunk-4nf1ec4f.js} +1 -1
- package/dist/{chunk-g5rf37hh.js → chunk-4vj2d7dz.js} +33 -33
- package/dist/{chunk-px27vhxx.js → chunk-4vjvqns0.js} +3 -3
- package/dist/{chunk-qmckdcc4.js → chunk-50xwa16q.js} +27 -27
- package/dist/{chunk-drsh1vv8.js → chunk-53sfy7n4.js} +26 -26
- package/dist/{chunk-24qcj0k5.js → chunk-53vj9v9s.js} +6 -6
- package/dist/{chunk-ftajx4gw.js → chunk-5526qw2k.js} +1 -1
- package/dist/{chunk-t0b0bas5.js → chunk-5840qkdv.js} +1 -1
- package/dist/{chunk-tm4w23dp.js → chunk-5hjsrynt.js} +1 -1
- package/dist/{chunk-gfk81w5r.js → chunk-5km8j211.js} +1 -1
- package/dist/{chunk-qkrenskm.js → chunk-5wzcv9gh.js} +5 -5
- package/dist/{chunk-18mm4jf8.js → chunk-5xjn56aq.js} +3 -3
- package/dist/{chunk-g71q1n7x.js → chunk-5yd55bg7.js} +26 -26
- package/dist/{chunk-fye86v7m.js → chunk-607fe07t.js} +26 -26
- package/dist/{chunk-g2tmm7k7.js → chunk-688ah6p4.js} +40 -40
- package/dist/{chunk-3c81vb6k.js → chunk-6ad36q0w.js} +3 -3
- package/dist/{chunk-zh6xf1fd.js → chunk-6b45etp0.js} +2 -2
- package/dist/{chunk-bhvmpf9m.js → chunk-6cqap182.js} +30 -30
- package/dist/{chunk-s2cwz71x.js → chunk-6k1w8x4k.js} +27 -27
- package/dist/{chunk-y3rg86fk.js → chunk-6sqsx9jy.js} +5 -5
- package/dist/{chunk-451hjtv9.js → chunk-6wpr3tjc.js} +26 -26
- package/dist/{chunk-5h17d17z.js → chunk-6yahjmr9.js} +1 -1
- package/dist/{chunk-t38536jf.js → chunk-75fdprgp.js} +1 -1
- package/dist/{chunk-h0s737p0.js → chunk-7750n93j.js} +1 -1
- package/dist/{chunk-s13m8efn.js → chunk-77dn0tk8.js} +1 -1
- package/dist/{chunk-v7xwthvg.js → chunk-79wycw4g.js} +68 -66
- package/dist/{chunk-145d3809.js → chunk-7cfbwd7q.js} +27 -27
- package/dist/{chunk-fskf0b3x.js → chunk-7hftfbxa.js} +2 -2
- package/dist/{chunk-n35gnb9g.js → chunk-7hmy36fh.js} +121 -2
- package/dist/{chunk-vmpcmvqq.js → chunk-7p1esgzf.js} +1 -1
- package/dist/{chunk-qn4cbm38.js → chunk-7w2h14a6.js} +5 -5
- package/dist/{chunk-2z6bv21c.js → chunk-86epd45z.js} +11 -11
- package/dist/{chunk-62dx37pf.js → chunk-8833n19q.js} +1 -1
- package/dist/{chunk-gpk30ekc.js → chunk-8cn35yvf.js} +4 -4
- package/dist/{chunk-zahg0adp.js → chunk-8favkbxx.js} +2 -2
- package/dist/{chunk-q890kpff.js → chunk-8fwh1vg6.js} +5 -5
- package/dist/{chunk-m83vaktc.js → chunk-8j0cag62.js} +1 -1
- package/dist/{chunk-wkx2xsed.js → chunk-8n7czf03.js} +27 -27
- package/dist/{chunk-ky85ntn8.js → chunk-90vttb3v.js} +36 -36
- package/dist/{chunk-e6nenv5n.js → chunk-9fsvmcz5.js} +29 -29
- package/dist/{chunk-p2sww3pd.js → chunk-9gpr8jae.js} +27 -27
- package/dist/{chunk-dne2ghq6.js → chunk-9je35yst.js} +3 -3
- package/dist/{chunk-2c4jgf3n.js → chunk-9qbwahdr.js} +3 -3
- package/dist/{chunk-8y1zs48n.js → chunk-9tgts6mc.js} +1 -1
- package/dist/{chunk-pvtzf6vs.js → chunk-a27gcyws.js} +2 -2
- package/dist/{chunk-c4x4fb6d.js → chunk-a5b9swcd.js} +26 -26
- package/dist/{chunk-3j857x3k.js → chunk-adjan1zm.js} +26 -26
- package/dist/{chunk-7gxyarah.js → chunk-agabmbjf.js} +29 -29
- package/dist/{chunk-xwhmcc3g.js → chunk-ajs8dza3.js} +26 -26
- package/dist/{chunk-sn3wbs2w.js → chunk-akkp39da.js} +26 -26
- package/dist/{chunk-nwgkkhk7.js → chunk-amyrs3hm.js} +2 -2
- package/dist/{chunk-f6wypwa6.js → chunk-ap1ykep6.js} +1 -1
- package/dist/{chunk-bzps3qec.js → chunk-azksrewr.js} +32 -32
- package/dist/{chunk-xvjdbsfa.js → chunk-b0x349dj.js} +27 -27
- package/dist/{chunk-ag3hbrat.js → chunk-b2vzxkee.js} +5 -5
- package/dist/{chunk-zy4fsy90.js → chunk-beq5rrj7.js} +5 -5
- package/dist/{chunk-gwah3f17.js → chunk-bv1k9d6v.js} +26 -26
- package/dist/{chunk-hbf3y5tw.js → chunk-bx6g17ek.js} +4 -4
- package/dist/{chunk-vm0b9vaz.js → chunk-c1jzx2gv.js} +4 -4
- package/dist/{chunk-z2aps7d9.js → chunk-c4y7537k.js} +2 -2
- package/dist/{chunk-cpvn0j86.js → chunk-ccb92crb.js} +4 -4
- package/dist/{chunk-3nwsgn73.js → chunk-cd6mvmte.js} +27 -27
- package/dist/{chunk-5k4kh5n9.js → chunk-cdqf4qst.js} +26 -26
- package/dist/{chunk-h5dk6k0g.js → chunk-cj8t81dc.js} +26 -26
- package/dist/{chunk-7etmzq13.js → chunk-cnggqnzm.js} +6 -6
- package/dist/{chunk-9p95042q.js → chunk-cqndxy46.js} +1 -1
- package/dist/chunk-cr6s4vp6.js +1396 -0
- package/dist/{chunk-rshk7m9c.js → chunk-crvsdcfv.js} +26 -26
- package/dist/{chunk-540608wh.js → chunk-cyjjqcs3.js} +27 -27
- package/dist/{chunk-fsex4yt2.js → chunk-cyxsqapw.js} +3 -3
- package/dist/{chunk-5ccpwbk7.js → chunk-d3paf9v2.js} +26 -26
- package/dist/{chunk-m2cskgz4.js → chunk-d6ecf8f1.js} +35 -35
- package/dist/{chunk-ermvk1xn.js → chunk-d92pjy0h.js} +29 -29
- package/dist/{chunk-dvf5921w.js → chunk-deatxv64.js} +8 -8
- package/dist/{chunk-v081mpyx.js → chunk-djp9rrcq.js} +17 -17
- package/dist/{chunk-e1t8jh0t.js → chunk-dtv3phgm.js} +26 -26
- package/dist/{chunk-1wykga1n.js → chunk-e5mw3cyw.js} +1 -1
- package/dist/{chunk-ar8awa36.js → chunk-e6rrn2tj.js} +26 -26
- package/dist/{chunk-n42nvr59.js → chunk-ebzv9705.js} +2 -2
- package/dist/{chunk-kmzv85ze.js → chunk-edz2xqmx.js} +35 -35
- package/dist/{chunk-4stgesb0.js → chunk-egwqdd9k.js} +13 -13
- package/dist/{chunk-w6rh4zpx.js → chunk-enzrrdn4.js} +1 -1
- package/dist/{chunk-y95se10r.js → chunk-erjs2wr4.js} +4 -4
- package/dist/{chunk-ms9225af.js → chunk-etg0he8j.js} +26 -26
- package/dist/{chunk-n2gc23dm.js → chunk-evww0yyb.js} +2 -2
- package/dist/{chunk-1ez8vf1y.js → chunk-ew9re4pd.js} +3 -3
- package/dist/{chunk-wp9nwczx.js → chunk-ewb2cm8z.js} +2 -2
- package/dist/{chunk-b4btw5kv.js → chunk-fbs21kq9.js} +1 -1
- package/dist/{chunk-ydraa9ey.js → chunk-fezbtqkp.js} +35 -35
- package/dist/{chunk-s1p2w5a5.js → chunk-fjh0vhqw.js} +3 -3
- package/dist/{chunk-dchgtage.js → chunk-fsqp1hdd.js} +2 -2
- package/dist/{chunk-2fx2x8qp.js → chunk-fsrg55vw.js} +4 -4
- package/dist/{chunk-4ydmya8m.js → chunk-g3t3tpmr.js} +5 -5
- package/dist/{chunk-7z0078sp.js → chunk-g5w87dmr.js} +1 -1
- package/dist/{chunk-ez958w7j.js → chunk-g9t81ym4.js} +27 -27
- package/dist/{chunk-379rspd7.js → chunk-gc91es60.js} +26 -26
- package/dist/{chunk-gz4r3k7a.js → chunk-gfc6zk7q.js} +3 -3
- package/dist/{chunk-symd8dvh.js → chunk-gra7rch0.js} +35 -35
- package/dist/{chunk-66j7fn6z.js → chunk-gyzh9997.js} +26 -26
- package/dist/{chunk-h7bkf3h2.js → chunk-h65cdcmj.js} +8 -8
- package/dist/{chunk-5s1bctjb.js → chunk-hcwq2bw3.js} +5 -5
- package/dist/{chunk-9f01qpne.js → chunk-hhx05ny2.js} +37 -37
- package/dist/{chunk-1av0kkwh.js → chunk-hy2yy9dj.js} +1 -1
- package/dist/{chunk-zwrt0s3s.js → chunk-hz4cc1fy.js} +26 -26
- package/dist/{chunk-n0rn505k.js → chunk-j5pcp6j1.js} +2 -2
- package/dist/{chunk-x42kc5wj.js → chunk-jhbtp60e.js} +4 -4
- package/dist/{chunk-kmcaa88h.js → chunk-jjcks6sw.js} +1 -1
- package/dist/{chunk-9nddm5c7.js → chunk-jver0cay.js} +1 -1
- package/dist/{chunk-m2rx2dtd.js → chunk-jz86pz25.js} +38 -38
- package/dist/{chunk-ay9wm3tf.js → chunk-k5kw9hyy.js} +1 -1
- package/dist/{chunk-antr836n.js → chunk-k8vb990d.js} +26 -26
- package/dist/{chunk-m95fj0wm.js → chunk-kyvg0zcc.js} +2 -2
- package/dist/{chunk-r325sbz7.js → chunk-m007chff.js} +12 -12
- package/dist/{chunk-qxv21mcq.js → chunk-m08081ys.js} +27 -27
- package/dist/{chunk-wmd0v561.js → chunk-m77e1esy.js} +1 -1
- package/dist/{chunk-1vzaw5f6.js → chunk-mcwdvkc5.js} +5 -5
- package/dist/{chunk-y10byvag.js → chunk-mdk5vcer.js} +9 -9
- package/dist/{chunk-9ejadhq8.js → chunk-mfmqxvy3.js} +28 -28
- package/dist/{chunk-c1cm8km0.js → chunk-mg88phh5.js} +26 -26
- package/dist/{chunk-vvm5az9j.js → chunk-mh9bbz4s.js} +2 -2
- package/dist/{chunk-9gypgvd7.js → chunk-mhd4n6av.js} +1 -1
- package/dist/{chunk-4q5a5mjb.js → chunk-mmc59v16.js} +332 -132
- package/dist/{chunk-jty4xkhc.js → chunk-mqqg7cf6.js} +3 -3
- package/dist/{chunk-0pxmxyxv.js → chunk-mt10f1tp.js} +1 -1
- package/dist/{chunk-9b0btjar.js → chunk-mz2rbmwe.js} +29 -29
- package/dist/{chunk-n612gr22.js → chunk-n4by7yk8.js} +27 -27
- package/dist/{chunk-nbzntnkz.js → chunk-ndgnv15y.js} +27 -27
- package/dist/{chunk-rgpxnjx4.js → chunk-ne7y2xb5.js} +3 -3
- package/dist/{chunk-j44ngncb.js → chunk-nnbp6hww.js} +2 -2
- package/dist/{chunk-d969b8ne.js → chunk-nrgyjw8e.js} +5 -5
- package/dist/{chunk-psp1n9vg.js → chunk-ns09xpt7.js} +1 -1
- package/dist/{chunk-22rs73mh.js → chunk-ns11b23b.js} +28 -28
- package/dist/{chunk-g14ex9z0.js → chunk-nskrydpn.js} +26 -26
- package/dist/{chunk-nzchm0f2.js → chunk-nt5vedsr.js} +1 -1
- package/dist/{chunk-rhxtttx1.js → chunk-nzrgdzqp.js} +2 -2
- package/dist/{chunk-6qexrv9a.js → chunk-p2pgnk1y.js} +26 -26
- package/dist/{chunk-ynjbppdn.js → chunk-p78dmmrg.js} +26 -26
- package/dist/{chunk-6wrs3ahh.js → chunk-p88crc0s.js} +4 -4
- package/dist/{chunk-40ax4h54.js → chunk-p9rdn455.js} +27 -27
- package/dist/{chunk-xjd32sva.js → chunk-pc4szfak.js} +5 -5
- package/dist/{chunk-64mwy58c.js → chunk-pp11ggs7.js} +1 -1
- package/dist/{chunk-bpmw0wp2.js → chunk-ptpynwv2.js} +26 -26
- package/dist/{chunk-5r3wgr44.js → chunk-ptxwtjpj.js} +17 -1387
- package/dist/{chunk-jg7na104.js → chunk-pzxksam8.js} +26 -26
- package/dist/{chunk-1vzb650a.js → chunk-q223vmcc.js} +1 -1
- package/dist/{chunk-zajs1j2b.js → chunk-q6d7rjw1.js} +26 -26
- package/dist/{chunk-58rg6rn2.js → chunk-q7e35wkk.js} +1 -1
- package/dist/{chunk-6xr5mayh.js → chunk-qbmbmhef.js} +26 -26
- package/dist/{chunk-zv5yt0g4.js → chunk-qga7he5v.js} +2 -2
- package/dist/{chunk-s3aygngf.js → chunk-qkwmefpm.js} +27 -27
- package/dist/{chunk-y82s03p7.js → chunk-qpprdv6x.js} +2 -2
- package/dist/{chunk-855katq2.js → chunk-qqfr3g23.js} +28 -28
- package/dist/{chunk-c2ktjyc0.js → chunk-qxy16bqn.js} +91 -1028
- package/dist/{chunk-k5c76pvm.js → chunk-r1gkg1zh.js} +29 -29
- package/dist/{chunk-egcx83tp.js → chunk-r4hf85nn.js} +3 -3
- package/dist/{chunk-ymtkahxp.js → chunk-r8cbwyz2.js} +35 -35
- package/dist/{chunk-kbshq7zc.js → chunk-rck3g0jk.js} +26 -26
- package/dist/{chunk-2pdcq92c.js → chunk-rejx7z4t.js} +1 -1
- package/dist/{chunk-0ahxmrws.js → chunk-rfnh6gdw.js} +5 -5
- package/dist/{chunk-52evx0rm.js → chunk-rywnz223.js} +4 -4
- package/dist/{chunk-r7s0jwb1.js → chunk-s0c72pgz.js} +27 -27
- package/dist/{chunk-tbma29g4.js → chunk-s4erjnky.js} +26 -26
- package/dist/{chunk-tf8gr3bs.js → chunk-s7gt9pbp.js} +27 -27
- package/dist/{chunk-c14sp904.js → chunk-s95y1wsx.js} +3 -3
- package/dist/{chunk-4yxd0e7k.js → chunk-sfs23jb0.js} +26 -26
- package/dist/{chunk-y29pdynp.js → chunk-sjr9vygr.js} +3 -3
- package/dist/{chunk-z7svjppe.js → chunk-smskbnfh.js} +4 -4
- package/dist/{chunk-p7d5ms03.js → chunk-swjmy1ec.js} +4 -4
- package/dist/{chunk-c96k89rp.js → chunk-t5vfbd78.js} +26 -26
- package/dist/{chunk-163379k5.js → chunk-t76a178c.js} +26 -26
- package/dist/{chunk-h93tjx98.js → chunk-tgav5bz9.js} +84 -83
- package/dist/chunk-tr91zear.js +1012 -0
- package/dist/{chunk-b6whrv9m.js → chunk-ts2892h4.js} +6 -6
- package/dist/{chunk-bkzs71af.js → chunk-txz05nf1.js} +1 -1
- package/dist/{chunk-ztrgnar4.js → chunk-v3kfrhgg.js} +1 -1
- package/dist/chunk-v47r6dev.js +3799 -0
- package/dist/{chunk-vb6w46m9.js → chunk-v7vav1dg.js} +27 -27
- package/dist/{chunk-3avnvgnv.js → chunk-v88g6btg.js} +2 -2
- package/dist/{chunk-h7mpryyc.js → chunk-v9bnkmpp.js} +27 -27
- package/dist/{chunk-8wv29424.js → chunk-vchfbqh0.js} +1 -1
- package/dist/{chunk-9v5bwvbm.js → chunk-vcv8kqah.js} +29 -29
- package/dist/{chunk-gdb6dvba.js → chunk-vdv5g7q5.js} +27 -27
- package/dist/{chunk-awwfrm4f.js → chunk-vjbm6e89.js} +8 -8
- package/dist/{chunk-cxf74p1t.js → chunk-vjvstd86.js} +1 -1
- package/dist/{chunk-3er4wswe.js → chunk-vmb323h1.js} +113 -113
- package/dist/{chunk-r7r3jm3y.js → chunk-vq51wj3f.js} +26 -26
- package/dist/{chunk-kz13d2bs.js → chunk-vqrph16d.js} +2 -2
- package/dist/{chunk-3s2gjp2n.js → chunk-vvsc8651.js} +34 -34
- package/dist/{chunk-wkjjv1jr.js → chunk-w5b8wpff.js} +27 -27
- package/dist/{chunk-yevbmk5g.js → chunk-w5f4g9ty.js} +1 -1
- package/dist/{chunk-nsxw7en4.js → chunk-w64rnehj.js} +5 -5
- package/dist/{chunk-b31v41mz.js → chunk-w74twxev.js} +5 -5
- package/dist/{chunk-ry1jb15g.js → chunk-w8hh0w92.js} +26 -26
- package/dist/{chunk-kh04yrpx.js → chunk-wh42d494.js} +27 -27
- package/dist/{chunk-536fmbtq.js → chunk-wm9c1620.js} +1 -1
- package/dist/{chunk-08a6n2pp.js → chunk-x0qzkte0.js} +1 -1
- package/dist/{chunk-9nydmbm4.js → chunk-x3p67k4j.js} +1 -1
- package/dist/{chunk-eef1npre.js → chunk-x7jtxq14.js} +1 -1
- package/dist/{chunk-b4twmt0s.js → chunk-xayw54gs.js} +5 -5
- package/dist/{chunk-hgfw7nx2.js → chunk-xe4dvfz2.js} +26 -26
- package/dist/{chunk-x639j7py.js → chunk-xjcmfp13.js} +29 -29
- package/dist/{chunk-59mg8c5k.js → chunk-xmretc2b.js} +26 -26
- package/dist/{chunk-1q82ecz5.js → chunk-xqf27kff.js} +26 -26
- package/dist/{chunk-0fpkjw2j.js → chunk-xsevshsa.js} +4 -4
- package/dist/{chunk-bnvd1jc1.js → chunk-y0fvv8rp.js} +3 -3
- package/dist/{chunk-5cc50ecq.js → chunk-y2x0t2gb.js} +32 -32
- package/dist/{chunk-d73t8nhj.js → chunk-y315v6st.js} +12 -12
- package/dist/{chunk-0a2qnsbr.js → chunk-y81y5v3d.js} +28 -28
- package/dist/{chunk-5scrgrwv.js → chunk-yatby2yh.js} +1 -1
- package/dist/{chunk-e03zrq9n.js → chunk-yg0h97bm.js} +26 -26
- package/dist/{chunk-667f3w39.js → chunk-ypgs2acw.js} +5 -5
- package/dist/{chunk-p1af059d.js → chunk-ysdxmhpv.js} +29 -29
- package/dist/{chunk-0h4sw1v3.js → chunk-ytwnb2km.js} +26 -26
- package/dist/{chunk-0xq2bfvv.js → chunk-z6gvvfmf.js} +2 -2
- package/dist/{chunk-2tcznfv0.js → chunk-z6q66vf8.js} +1 -1
- package/dist/{chunk-35xyzbd2.js → chunk-z9f8mvd1.js} +32 -32
- package/dist/{chunk-j3ctqpsn.js → chunk-zda436nm.js} +2 -2
- package/dist/{chunk-49n22kr8.js → chunk-zddcrj90.js} +26 -26
- package/dist/{chunk-c209ascy.js → chunk-zh7z8zmq.js} +3 -3
- package/dist/{chunk-9byk2a4b.js → chunk-zhq7vk2g.js} +5 -5
- package/dist/{chunk-c9p5eyxf.js → chunk-zjhz0qyc.js} +28 -28
- package/dist/{chunk-vqawqpkx.js → chunk-zkv7atzf.js} +37 -37
- package/dist/{chunk-wef34bk5.js → chunk-zrrd9egx.js} +27 -27
- package/dist/{chunk-9r28w6ye.js → chunk-zttmdag3.js} +1 -1
- package/dist/cli.js +14 -8
- package/package.json +9 -3
|
@@ -0,0 +1,1012 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import {
|
|
3
|
+
buildSystemInitMessage,
|
|
4
|
+
exports_MessageSelector,
|
|
5
|
+
init_MessageSelector,
|
|
6
|
+
processUserInput,
|
|
7
|
+
sdkCompatToolName
|
|
8
|
+
} from "./chunk-cr6s4vp6.js";
|
|
9
|
+
import {
|
|
10
|
+
init_mappers,
|
|
11
|
+
localCommandOutputToSDKAssistantMessage,
|
|
12
|
+
toSDKCompactMetadata
|
|
13
|
+
} from "./chunk-w5f4g9ty.js";
|
|
14
|
+
import {
|
|
15
|
+
init_systemTheme,
|
|
16
|
+
resolveThemeSetting
|
|
17
|
+
} from "./chunk-cnsj3vq2.js";
|
|
18
|
+
import {
|
|
19
|
+
SYNTHETIC_MESSAGES,
|
|
20
|
+
SYNTHETIC_OUTPUT_TOOL_NAME,
|
|
21
|
+
accumulateUsage,
|
|
22
|
+
asSystemPrompt,
|
|
23
|
+
categorizeRetryableAPIError,
|
|
24
|
+
countToolCalls,
|
|
25
|
+
createAbortController,
|
|
26
|
+
exports_coordinatorMode,
|
|
27
|
+
exports_snipCompact,
|
|
28
|
+
exports_snipProjection,
|
|
29
|
+
fileHistoryEnabled,
|
|
30
|
+
fileHistoryMakeSnapshot,
|
|
31
|
+
flushSessionStorage,
|
|
32
|
+
getScratchpadDir,
|
|
33
|
+
getSlashCommandToolSkills,
|
|
34
|
+
getSystemContext,
|
|
35
|
+
getSystemPrompt,
|
|
36
|
+
getUserContext,
|
|
37
|
+
handleOrphanedPermission,
|
|
38
|
+
headlessProfilerCheckpoint,
|
|
39
|
+
init_Shell,
|
|
40
|
+
init_SyntheticOutputTool,
|
|
41
|
+
init_Tool,
|
|
42
|
+
init_abortController,
|
|
43
|
+
init_claude,
|
|
44
|
+
init_commands1 as init_commands,
|
|
45
|
+
init_context,
|
|
46
|
+
init_coordinatorMode,
|
|
47
|
+
init_cost_tracker,
|
|
48
|
+
init_errors,
|
|
49
|
+
init_fileHistory,
|
|
50
|
+
init_filesystem,
|
|
51
|
+
init_headlessProfiler,
|
|
52
|
+
init_hookHelpers,
|
|
53
|
+
init_last,
|
|
54
|
+
init_logging,
|
|
55
|
+
init_memdir,
|
|
56
|
+
init_messages1 as init_messages,
|
|
57
|
+
init_pluginLoader,
|
|
58
|
+
init_prompts1 as init_prompts,
|
|
59
|
+
init_query,
|
|
60
|
+
init_queryHelpers,
|
|
61
|
+
init_sessionStorage,
|
|
62
|
+
init_snipCompact,
|
|
63
|
+
init_snipProjection,
|
|
64
|
+
init_systemPromptType,
|
|
65
|
+
init_thinking,
|
|
66
|
+
isResultSuccessful,
|
|
67
|
+
isScratchpadEnabled,
|
|
68
|
+
last_default,
|
|
69
|
+
loadAllPluginsCacheOnly,
|
|
70
|
+
loadMemoryPrompt,
|
|
71
|
+
normalizeMessage,
|
|
72
|
+
query,
|
|
73
|
+
recordTranscript,
|
|
74
|
+
registerStructuredOutputEnforcement,
|
|
75
|
+
setCwd,
|
|
76
|
+
shouldEnableThinkingByDefault,
|
|
77
|
+
toolMatchesName,
|
|
78
|
+
updateUsage
|
|
79
|
+
} from "./chunk-mmc59v16.js";
|
|
80
|
+
import {
|
|
81
|
+
EMPTY_USAGE
|
|
82
|
+
} from "./chunk-75fdprgp.js";
|
|
83
|
+
import {
|
|
84
|
+
cloneFileStateCache,
|
|
85
|
+
init_fileStateCache
|
|
86
|
+
} from "./chunk-zttmdag3.js";
|
|
87
|
+
import {
|
|
88
|
+
getFastModeState,
|
|
89
|
+
getGlobalConfig,
|
|
90
|
+
getMainLoopModel,
|
|
91
|
+
hasAutoMemPathOverride,
|
|
92
|
+
init_config1 as init_config,
|
|
93
|
+
init_fastMode,
|
|
94
|
+
init_model,
|
|
95
|
+
init_paths,
|
|
96
|
+
parseUserSpecifiedModel
|
|
97
|
+
} from "./chunk-4581z0wr.js";
|
|
98
|
+
import {
|
|
99
|
+
init_strip_ansi,
|
|
100
|
+
stripAnsi
|
|
101
|
+
} from "./chunk-e4jqbn4d.js";
|
|
102
|
+
import {
|
|
103
|
+
getCwd,
|
|
104
|
+
init_cwd
|
|
105
|
+
} from "./chunk-tv74hgw9.js";
|
|
106
|
+
import {
|
|
107
|
+
LOCAL_COMMAND_STDERR_TAG,
|
|
108
|
+
LOCAL_COMMAND_STDOUT_TAG,
|
|
109
|
+
getInMemoryErrors,
|
|
110
|
+
init_log,
|
|
111
|
+
init_xml
|
|
112
|
+
} from "./chunk-d2vb6m9e.js";
|
|
113
|
+
import {
|
|
114
|
+
getModelUsage,
|
|
115
|
+
getSessionId,
|
|
116
|
+
getTotalAPIDuration,
|
|
117
|
+
getTotalCostUSD,
|
|
118
|
+
init_state,
|
|
119
|
+
isSessionPersistenceDisabled
|
|
120
|
+
} from "./chunk-gzp6rza1.js";
|
|
121
|
+
import {
|
|
122
|
+
init_envUtils,
|
|
123
|
+
isBareMode,
|
|
124
|
+
isEnvTruthy
|
|
125
|
+
} from "./chunk-hxhwzgnn.js";
|
|
126
|
+
import {
|
|
127
|
+
__toCommonJS
|
|
128
|
+
} from "./chunk-qp2qdcda.js";
|
|
129
|
+
|
|
130
|
+
// src/utils/queryContext.ts
|
|
131
|
+
init_prompts();
|
|
132
|
+
init_context();
|
|
133
|
+
init_abortController();
|
|
134
|
+
init_model();
|
|
135
|
+
init_systemPromptType();
|
|
136
|
+
init_thinking();
|
|
137
|
+
async function fetchSystemPromptParts({
|
|
138
|
+
tools,
|
|
139
|
+
mainLoopModel,
|
|
140
|
+
additionalWorkingDirectories,
|
|
141
|
+
mcpClients,
|
|
142
|
+
customSystemPrompt
|
|
143
|
+
}) {
|
|
144
|
+
const [defaultSystemPrompt, userContext, systemContext] = await Promise.all([
|
|
145
|
+
customSystemPrompt !== undefined ? Promise.resolve([]) : getSystemPrompt(tools, mainLoopModel, additionalWorkingDirectories, mcpClients),
|
|
146
|
+
getUserContext(),
|
|
147
|
+
customSystemPrompt !== undefined ? Promise.resolve({}) : getSystemContext()
|
|
148
|
+
]);
|
|
149
|
+
return { defaultSystemPrompt, userContext, systemContext };
|
|
150
|
+
}
|
|
151
|
+
async function buildSideQuestionFallbackParams({
|
|
152
|
+
tools,
|
|
153
|
+
commands,
|
|
154
|
+
mcpClients,
|
|
155
|
+
messages,
|
|
156
|
+
readFileState,
|
|
157
|
+
getAppState,
|
|
158
|
+
setAppState,
|
|
159
|
+
customSystemPrompt,
|
|
160
|
+
appendSystemPrompt,
|
|
161
|
+
thinkingConfig,
|
|
162
|
+
agents
|
|
163
|
+
}) {
|
|
164
|
+
const mainLoopModel = getMainLoopModel();
|
|
165
|
+
const appState = getAppState();
|
|
166
|
+
const { defaultSystemPrompt, userContext, systemContext } = await fetchSystemPromptParts({
|
|
167
|
+
tools,
|
|
168
|
+
mainLoopModel,
|
|
169
|
+
additionalWorkingDirectories: Array.from(appState.toolPermissionContext.additionalWorkingDirectories.keys()),
|
|
170
|
+
mcpClients,
|
|
171
|
+
customSystemPrompt
|
|
172
|
+
});
|
|
173
|
+
const systemPrompt = asSystemPrompt([
|
|
174
|
+
...customSystemPrompt !== undefined ? [customSystemPrompt] : defaultSystemPrompt,
|
|
175
|
+
...appendSystemPrompt ? [appendSystemPrompt] : []
|
|
176
|
+
]);
|
|
177
|
+
const last = messages.at(-1);
|
|
178
|
+
const forkContextMessages = last?.type === "assistant" && last.message.stop_reason === null ? messages.slice(0, -1) : messages;
|
|
179
|
+
const toolUseContext = {
|
|
180
|
+
options: {
|
|
181
|
+
commands,
|
|
182
|
+
debug: false,
|
|
183
|
+
mainLoopModel,
|
|
184
|
+
tools,
|
|
185
|
+
verbose: false,
|
|
186
|
+
thinkingConfig: thinkingConfig ?? (shouldEnableThinkingByDefault() !== false ? { type: "adaptive" } : { type: "disabled" }),
|
|
187
|
+
mcpClients,
|
|
188
|
+
mcpResources: {},
|
|
189
|
+
isNonInteractiveSession: true,
|
|
190
|
+
agentDefinitions: { activeAgents: agents, allAgents: [] },
|
|
191
|
+
customSystemPrompt,
|
|
192
|
+
appendSystemPrompt
|
|
193
|
+
},
|
|
194
|
+
abortController: createAbortController(),
|
|
195
|
+
readFileState,
|
|
196
|
+
getAppState,
|
|
197
|
+
setAppState,
|
|
198
|
+
messages: forkContextMessages,
|
|
199
|
+
setInProgressToolUseIDs: () => {},
|
|
200
|
+
setResponseLength: () => {},
|
|
201
|
+
updateFileHistoryState: () => {},
|
|
202
|
+
updateAttributionState: () => {}
|
|
203
|
+
};
|
|
204
|
+
return {
|
|
205
|
+
systemPrompt,
|
|
206
|
+
userContext,
|
|
207
|
+
systemContext,
|
|
208
|
+
toolUseContext,
|
|
209
|
+
forkContextMessages
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
// src/QueryEngine.ts
|
|
214
|
+
init_last();
|
|
215
|
+
init_state();
|
|
216
|
+
init_claude();
|
|
217
|
+
init_logging();
|
|
218
|
+
init_strip_ansi();
|
|
219
|
+
init_commands();
|
|
220
|
+
init_xml();
|
|
221
|
+
init_cost_tracker();
|
|
222
|
+
init_memdir();
|
|
223
|
+
init_paths();
|
|
224
|
+
init_query();
|
|
225
|
+
init_errors();
|
|
226
|
+
init_Tool();
|
|
227
|
+
init_SyntheticOutputTool();
|
|
228
|
+
init_abortController();
|
|
229
|
+
init_config();
|
|
230
|
+
init_cwd();
|
|
231
|
+
init_envUtils();
|
|
232
|
+
init_fastMode();
|
|
233
|
+
init_fileHistory();
|
|
234
|
+
init_fileStateCache();
|
|
235
|
+
init_headlessProfiler();
|
|
236
|
+
init_hookHelpers();
|
|
237
|
+
init_log();
|
|
238
|
+
init_messages();
|
|
239
|
+
init_model();
|
|
240
|
+
init_pluginLoader();
|
|
241
|
+
import { randomUUID } from "crypto";
|
|
242
|
+
init_Shell();
|
|
243
|
+
init_sessionStorage();
|
|
244
|
+
init_systemPromptType();
|
|
245
|
+
init_systemTheme();
|
|
246
|
+
init_thinking();
|
|
247
|
+
init_mappers();
|
|
248
|
+
init_filesystem();
|
|
249
|
+
init_queryHelpers();
|
|
250
|
+
var messageSelector = () => (init_MessageSelector(), __toCommonJS(exports_MessageSelector));
|
|
251
|
+
var getCoordinatorUserContext = (init_coordinatorMode(), __toCommonJS(exports_coordinatorMode)).getCoordinatorUserContext;
|
|
252
|
+
var snipModule = (init_snipCompact(), __toCommonJS(exports_snipCompact));
|
|
253
|
+
var snipProjection = (init_snipProjection(), __toCommonJS(exports_snipProjection));
|
|
254
|
+
|
|
255
|
+
class QueryEngine {
|
|
256
|
+
config;
|
|
257
|
+
mutableMessages;
|
|
258
|
+
abortController;
|
|
259
|
+
permissionDenials;
|
|
260
|
+
totalUsage;
|
|
261
|
+
hasHandledOrphanedPermission = false;
|
|
262
|
+
readFileState;
|
|
263
|
+
discoveredSkillNames = new Set;
|
|
264
|
+
loadedNestedMemoryPaths = new Set;
|
|
265
|
+
constructor(config) {
|
|
266
|
+
this.config = config;
|
|
267
|
+
this.mutableMessages = config.initialMessages ?? [];
|
|
268
|
+
this.abortController = config.abortController ?? createAbortController();
|
|
269
|
+
this.permissionDenials = [];
|
|
270
|
+
this.readFileState = config.readFileCache;
|
|
271
|
+
this.totalUsage = EMPTY_USAGE;
|
|
272
|
+
}
|
|
273
|
+
async* submitMessage(prompt, options) {
|
|
274
|
+
const {
|
|
275
|
+
cwd,
|
|
276
|
+
commands,
|
|
277
|
+
tools,
|
|
278
|
+
mcpClients,
|
|
279
|
+
verbose = false,
|
|
280
|
+
thinkingConfig,
|
|
281
|
+
maxTurns,
|
|
282
|
+
maxBudgetUsd,
|
|
283
|
+
taskBudget,
|
|
284
|
+
canUseTool,
|
|
285
|
+
customSystemPrompt,
|
|
286
|
+
appendSystemPrompt,
|
|
287
|
+
userSpecifiedModel,
|
|
288
|
+
fallbackModel,
|
|
289
|
+
jsonSchema,
|
|
290
|
+
getAppState,
|
|
291
|
+
setAppState,
|
|
292
|
+
replayUserMessages = false,
|
|
293
|
+
includePartialMessages = false,
|
|
294
|
+
agents = [],
|
|
295
|
+
setSDKStatus,
|
|
296
|
+
orphanedPermission
|
|
297
|
+
} = this.config;
|
|
298
|
+
this.discoveredSkillNames.clear();
|
|
299
|
+
setCwd(cwd);
|
|
300
|
+
const persistSession = !isSessionPersistenceDisabled();
|
|
301
|
+
const startTime = Date.now();
|
|
302
|
+
const wrappedCanUseTool = async (tool, input, toolUseContext, assistantMessage, toolUseID, forceDecision) => {
|
|
303
|
+
const result2 = await canUseTool(tool, input, toolUseContext, assistantMessage, toolUseID, forceDecision);
|
|
304
|
+
if (result2.behavior !== "allow") {
|
|
305
|
+
this.permissionDenials.push({
|
|
306
|
+
type: "permission_denial",
|
|
307
|
+
tool_name: sdkCompatToolName(tool.name),
|
|
308
|
+
tool_use_id: toolUseID,
|
|
309
|
+
tool_input: input
|
|
310
|
+
});
|
|
311
|
+
}
|
|
312
|
+
return result2;
|
|
313
|
+
};
|
|
314
|
+
const initialAppState = getAppState();
|
|
315
|
+
const initialMainLoopModel = userSpecifiedModel ? parseUserSpecifiedModel(userSpecifiedModel) : getMainLoopModel();
|
|
316
|
+
const initialThinkingConfig = thinkingConfig ? thinkingConfig : shouldEnableThinkingByDefault() !== false ? { type: "adaptive" } : { type: "disabled" };
|
|
317
|
+
headlessProfilerCheckpoint("before_getSystemPrompt");
|
|
318
|
+
const customPrompt = typeof customSystemPrompt === "string" ? customSystemPrompt : undefined;
|
|
319
|
+
const {
|
|
320
|
+
defaultSystemPrompt,
|
|
321
|
+
userContext: baseUserContext,
|
|
322
|
+
systemContext
|
|
323
|
+
} = await fetchSystemPromptParts({
|
|
324
|
+
tools,
|
|
325
|
+
mainLoopModel: initialMainLoopModel,
|
|
326
|
+
additionalWorkingDirectories: Array.from(initialAppState.toolPermissionContext.additionalWorkingDirectories.keys()),
|
|
327
|
+
mcpClients,
|
|
328
|
+
customSystemPrompt: customPrompt
|
|
329
|
+
});
|
|
330
|
+
headlessProfilerCheckpoint("after_getSystemPrompt");
|
|
331
|
+
const userContext = {
|
|
332
|
+
...baseUserContext,
|
|
333
|
+
...getCoordinatorUserContext(mcpClients, isScratchpadEnabled() ? getScratchpadDir() : undefined)
|
|
334
|
+
};
|
|
335
|
+
const memoryMechanicsPrompt = customPrompt !== undefined && hasAutoMemPathOverride() ? await loadMemoryPrompt() : null;
|
|
336
|
+
const systemPrompt = asSystemPrompt([
|
|
337
|
+
...customPrompt !== undefined ? [customPrompt] : defaultSystemPrompt,
|
|
338
|
+
...memoryMechanicsPrompt ? [memoryMechanicsPrompt] : [],
|
|
339
|
+
...appendSystemPrompt ? [appendSystemPrompt] : []
|
|
340
|
+
]);
|
|
341
|
+
const hasStructuredOutputTool = tools.some((t) => toolMatchesName(t, SYNTHETIC_OUTPUT_TOOL_NAME));
|
|
342
|
+
if (jsonSchema && hasStructuredOutputTool) {
|
|
343
|
+
registerStructuredOutputEnforcement(setAppState, getSessionId());
|
|
344
|
+
}
|
|
345
|
+
let processUserInputContext = {
|
|
346
|
+
messages: this.mutableMessages,
|
|
347
|
+
setMessages: (fn) => {
|
|
348
|
+
this.mutableMessages = fn(this.mutableMessages);
|
|
349
|
+
},
|
|
350
|
+
onChangeAPIKey: () => {},
|
|
351
|
+
handleElicitation: this.config.handleElicitation,
|
|
352
|
+
options: {
|
|
353
|
+
commands,
|
|
354
|
+
debug: false,
|
|
355
|
+
tools,
|
|
356
|
+
verbose,
|
|
357
|
+
mainLoopModel: initialMainLoopModel,
|
|
358
|
+
thinkingConfig: initialThinkingConfig,
|
|
359
|
+
mcpClients,
|
|
360
|
+
mcpResources: {},
|
|
361
|
+
ideInstallationStatus: null,
|
|
362
|
+
isNonInteractiveSession: true,
|
|
363
|
+
customSystemPrompt,
|
|
364
|
+
appendSystemPrompt,
|
|
365
|
+
agentDefinitions: { activeAgents: agents, allAgents: [] },
|
|
366
|
+
theme: resolveThemeSetting(getGlobalConfig().theme),
|
|
367
|
+
maxBudgetUsd
|
|
368
|
+
},
|
|
369
|
+
getAppState,
|
|
370
|
+
setAppState,
|
|
371
|
+
abortController: this.abortController,
|
|
372
|
+
readFileState: this.readFileState,
|
|
373
|
+
nestedMemoryAttachmentTriggers: new Set,
|
|
374
|
+
loadedNestedMemoryPaths: this.loadedNestedMemoryPaths,
|
|
375
|
+
dynamicSkillDirTriggers: new Set,
|
|
376
|
+
discoveredSkillNames: this.discoveredSkillNames,
|
|
377
|
+
setInProgressToolUseIDs: () => {},
|
|
378
|
+
setResponseLength: () => {},
|
|
379
|
+
updateFileHistoryState: (updater) => {
|
|
380
|
+
setAppState((prev) => {
|
|
381
|
+
const updated = updater(prev.fileHistory);
|
|
382
|
+
if (updated === prev.fileHistory)
|
|
383
|
+
return prev;
|
|
384
|
+
return { ...prev, fileHistory: updated };
|
|
385
|
+
});
|
|
386
|
+
},
|
|
387
|
+
updateAttributionState: (updater) => {
|
|
388
|
+
setAppState((prev) => {
|
|
389
|
+
const updated = updater(prev.attribution);
|
|
390
|
+
if (updated === prev.attribution)
|
|
391
|
+
return prev;
|
|
392
|
+
return { ...prev, attribution: updated };
|
|
393
|
+
});
|
|
394
|
+
},
|
|
395
|
+
setSDKStatus
|
|
396
|
+
};
|
|
397
|
+
if (orphanedPermission && !this.hasHandledOrphanedPermission) {
|
|
398
|
+
this.hasHandledOrphanedPermission = true;
|
|
399
|
+
for await (const message of handleOrphanedPermission(orphanedPermission, tools, this.mutableMessages, processUserInputContext)) {
|
|
400
|
+
yield message;
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
const {
|
|
404
|
+
messages: messagesFromUserInput,
|
|
405
|
+
shouldQuery,
|
|
406
|
+
allowedTools,
|
|
407
|
+
model: modelFromUserInput,
|
|
408
|
+
resultText
|
|
409
|
+
} = await processUserInput({
|
|
410
|
+
input: prompt,
|
|
411
|
+
mode: "prompt",
|
|
412
|
+
setToolJSX: () => {},
|
|
413
|
+
context: {
|
|
414
|
+
...processUserInputContext,
|
|
415
|
+
messages: this.mutableMessages
|
|
416
|
+
},
|
|
417
|
+
messages: this.mutableMessages,
|
|
418
|
+
uuid: options?.uuid,
|
|
419
|
+
isMeta: options?.isMeta,
|
|
420
|
+
querySource: "sdk"
|
|
421
|
+
});
|
|
422
|
+
this.mutableMessages.push(...messagesFromUserInput);
|
|
423
|
+
const messages = [...this.mutableMessages];
|
|
424
|
+
if (persistSession && messagesFromUserInput.length > 0) {
|
|
425
|
+
const transcriptPromise = recordTranscript(messages);
|
|
426
|
+
if (isBareMode()) {} else {
|
|
427
|
+
await transcriptPromise;
|
|
428
|
+
if (isEnvTruthy(process.env.CLAUDE_CODE_EAGER_FLUSH) || isEnvTruthy(process.env.CLAUDE_CODE_IS_COWORK)) {
|
|
429
|
+
await flushSessionStorage();
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
const replayableMessages = messagesFromUserInput.filter((msg) => msg.type === "user" && !msg.isMeta && !msg.toolUseResult && messageSelector().selectableUserMessagesFilter(msg) || msg.type === "system" && msg.subtype === "compact_boundary");
|
|
434
|
+
const messagesToAck = replayUserMessages ? replayableMessages : [];
|
|
435
|
+
setAppState((prev) => ({
|
|
436
|
+
...prev,
|
|
437
|
+
toolPermissionContext: {
|
|
438
|
+
...prev.toolPermissionContext,
|
|
439
|
+
alwaysAllowRules: {
|
|
440
|
+
...prev.toolPermissionContext.alwaysAllowRules,
|
|
441
|
+
command: allowedTools
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
}));
|
|
445
|
+
const mainLoopModel = modelFromUserInput ?? initialMainLoopModel;
|
|
446
|
+
processUserInputContext = {
|
|
447
|
+
messages,
|
|
448
|
+
setMessages: () => {},
|
|
449
|
+
onChangeAPIKey: () => {},
|
|
450
|
+
handleElicitation: this.config.handleElicitation,
|
|
451
|
+
options: {
|
|
452
|
+
commands,
|
|
453
|
+
debug: false,
|
|
454
|
+
tools,
|
|
455
|
+
verbose,
|
|
456
|
+
mainLoopModel,
|
|
457
|
+
thinkingConfig: initialThinkingConfig,
|
|
458
|
+
mcpClients,
|
|
459
|
+
mcpResources: {},
|
|
460
|
+
ideInstallationStatus: null,
|
|
461
|
+
isNonInteractiveSession: true,
|
|
462
|
+
customSystemPrompt,
|
|
463
|
+
appendSystemPrompt,
|
|
464
|
+
theme: resolveThemeSetting(getGlobalConfig().theme),
|
|
465
|
+
agentDefinitions: { activeAgents: agents, allAgents: [] },
|
|
466
|
+
maxBudgetUsd
|
|
467
|
+
},
|
|
468
|
+
getAppState,
|
|
469
|
+
setAppState,
|
|
470
|
+
abortController: this.abortController,
|
|
471
|
+
readFileState: this.readFileState,
|
|
472
|
+
nestedMemoryAttachmentTriggers: new Set,
|
|
473
|
+
loadedNestedMemoryPaths: this.loadedNestedMemoryPaths,
|
|
474
|
+
dynamicSkillDirTriggers: new Set,
|
|
475
|
+
discoveredSkillNames: this.discoveredSkillNames,
|
|
476
|
+
setInProgressToolUseIDs: () => {},
|
|
477
|
+
setResponseLength: () => {},
|
|
478
|
+
updateFileHistoryState: processUserInputContext.updateFileHistoryState,
|
|
479
|
+
updateAttributionState: processUserInputContext.updateAttributionState,
|
|
480
|
+
setSDKStatus
|
|
481
|
+
};
|
|
482
|
+
headlessProfilerCheckpoint("before_skills_plugins");
|
|
483
|
+
const [skills, { enabled: enabledPlugins }] = await Promise.all([
|
|
484
|
+
getSlashCommandToolSkills(getCwd()),
|
|
485
|
+
loadAllPluginsCacheOnly()
|
|
486
|
+
]);
|
|
487
|
+
headlessProfilerCheckpoint("after_skills_plugins");
|
|
488
|
+
yield buildSystemInitMessage({
|
|
489
|
+
tools,
|
|
490
|
+
mcpClients,
|
|
491
|
+
model: mainLoopModel,
|
|
492
|
+
permissionMode: initialAppState.toolPermissionContext.mode,
|
|
493
|
+
commands,
|
|
494
|
+
agents,
|
|
495
|
+
skills,
|
|
496
|
+
plugins: enabledPlugins,
|
|
497
|
+
fastMode: initialAppState.fastMode
|
|
498
|
+
});
|
|
499
|
+
headlessProfilerCheckpoint("system_message_yielded");
|
|
500
|
+
if (!shouldQuery) {
|
|
501
|
+
for (const msg of messagesFromUserInput) {
|
|
502
|
+
if (msg.type === "user" && typeof msg.message.content === "string" && (msg.message.content.includes(`<${LOCAL_COMMAND_STDOUT_TAG}>`) || msg.message.content.includes(`<${LOCAL_COMMAND_STDERR_TAG}>`) || msg.isCompactSummary)) {
|
|
503
|
+
yield {
|
|
504
|
+
type: "user",
|
|
505
|
+
message: {
|
|
506
|
+
...msg.message,
|
|
507
|
+
content: stripAnsi(msg.message.content)
|
|
508
|
+
},
|
|
509
|
+
session_id: getSessionId(),
|
|
510
|
+
parent_tool_use_id: null,
|
|
511
|
+
uuid: msg.uuid,
|
|
512
|
+
timestamp: msg.timestamp,
|
|
513
|
+
isReplay: !msg.isCompactSummary,
|
|
514
|
+
isSynthetic: msg.isMeta || msg.isVisibleInTranscriptOnly
|
|
515
|
+
};
|
|
516
|
+
}
|
|
517
|
+
if (msg.type === "system" && msg.subtype === "local_command" && typeof msg.content === "string" && (msg.content.includes(`<${LOCAL_COMMAND_STDOUT_TAG}>`) || msg.content.includes(`<${LOCAL_COMMAND_STDERR_TAG}>`))) {
|
|
518
|
+
yield localCommandOutputToSDKAssistantMessage(msg.content, msg.uuid);
|
|
519
|
+
}
|
|
520
|
+
if (msg.type === "system" && msg.subtype === "compact_boundary") {
|
|
521
|
+
const compactMsg = msg;
|
|
522
|
+
yield {
|
|
523
|
+
type: "system",
|
|
524
|
+
subtype: "compact_boundary",
|
|
525
|
+
session_id: getSessionId(),
|
|
526
|
+
uuid: msg.uuid,
|
|
527
|
+
compact_metadata: toSDKCompactMetadata(compactMsg.compactMetadata)
|
|
528
|
+
};
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
if (persistSession) {
|
|
532
|
+
await recordTranscript(messages);
|
|
533
|
+
if (isEnvTruthy(process.env.CLAUDE_CODE_EAGER_FLUSH) || isEnvTruthy(process.env.CLAUDE_CODE_IS_COWORK)) {
|
|
534
|
+
await flushSessionStorage();
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
yield {
|
|
538
|
+
type: "result",
|
|
539
|
+
subtype: "success",
|
|
540
|
+
is_error: false,
|
|
541
|
+
duration_ms: Date.now() - startTime,
|
|
542
|
+
duration_api_ms: getTotalAPIDuration(),
|
|
543
|
+
num_turns: messages.length - 1,
|
|
544
|
+
result: resultText ?? "",
|
|
545
|
+
stop_reason: null,
|
|
546
|
+
session_id: getSessionId(),
|
|
547
|
+
total_cost_usd: getTotalCostUSD(),
|
|
548
|
+
usage: this.totalUsage,
|
|
549
|
+
modelUsage: getModelUsage(),
|
|
550
|
+
permission_denials: this.permissionDenials,
|
|
551
|
+
fast_mode_state: getFastModeState(mainLoopModel, initialAppState.fastMode),
|
|
552
|
+
uuid: randomUUID()
|
|
553
|
+
};
|
|
554
|
+
return;
|
|
555
|
+
}
|
|
556
|
+
if (fileHistoryEnabled() && persistSession) {
|
|
557
|
+
messagesFromUserInput.filter(messageSelector().selectableUserMessagesFilter).forEach((message) => {
|
|
558
|
+
fileHistoryMakeSnapshot((updater) => {
|
|
559
|
+
setAppState((prev) => ({
|
|
560
|
+
...prev,
|
|
561
|
+
fileHistory: updater(prev.fileHistory)
|
|
562
|
+
}));
|
|
563
|
+
}, message.uuid);
|
|
564
|
+
});
|
|
565
|
+
}
|
|
566
|
+
let currentMessageUsage = EMPTY_USAGE;
|
|
567
|
+
let turnCount = 1;
|
|
568
|
+
let hasAcknowledgedInitialMessages = false;
|
|
569
|
+
let structuredOutputFromTool;
|
|
570
|
+
let lastStopReason = null;
|
|
571
|
+
const errorLogWatermark = getInMemoryErrors().at(-1);
|
|
572
|
+
const initialStructuredOutputCalls = jsonSchema ? countToolCalls(this.mutableMessages, SYNTHETIC_OUTPUT_TOOL_NAME) : 0;
|
|
573
|
+
for await (const message of query({
|
|
574
|
+
messages,
|
|
575
|
+
systemPrompt,
|
|
576
|
+
userContext,
|
|
577
|
+
systemContext,
|
|
578
|
+
canUseTool: wrappedCanUseTool,
|
|
579
|
+
toolUseContext: processUserInputContext,
|
|
580
|
+
fallbackModel,
|
|
581
|
+
querySource: "sdk",
|
|
582
|
+
maxTurns,
|
|
583
|
+
taskBudget
|
|
584
|
+
})) {
|
|
585
|
+
if (message.type === "assistant" || message.type === "user" || message.type === "system" && message.subtype === "compact_boundary") {
|
|
586
|
+
if (persistSession && message.type === "system" && message.subtype === "compact_boundary") {
|
|
587
|
+
const compactMsg = message;
|
|
588
|
+
const tailUuid = compactMsg.compactMetadata?.preservedSegment?.tailUuid;
|
|
589
|
+
if (tailUuid) {
|
|
590
|
+
const tailIdx = this.mutableMessages.findLastIndex((m) => m.uuid === tailUuid);
|
|
591
|
+
if (tailIdx !== -1) {
|
|
592
|
+
await recordTranscript(this.mutableMessages.slice(0, tailIdx + 1));
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
messages.push(message);
|
|
597
|
+
if (persistSession) {
|
|
598
|
+
if (message.type === "assistant") {
|
|
599
|
+
recordTranscript(messages);
|
|
600
|
+
} else {
|
|
601
|
+
await recordTranscript(messages);
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
if (!hasAcknowledgedInitialMessages && messagesToAck.length > 0) {
|
|
605
|
+
hasAcknowledgedInitialMessages = true;
|
|
606
|
+
for (const msgToAck of messagesToAck) {
|
|
607
|
+
if (msgToAck.type === "user") {
|
|
608
|
+
yield {
|
|
609
|
+
type: "user",
|
|
610
|
+
message: msgToAck.message,
|
|
611
|
+
session_id: getSessionId(),
|
|
612
|
+
parent_tool_use_id: null,
|
|
613
|
+
uuid: msgToAck.uuid,
|
|
614
|
+
timestamp: msgToAck.timestamp,
|
|
615
|
+
isReplay: true
|
|
616
|
+
};
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
if (message.type === "user") {
|
|
622
|
+
turnCount++;
|
|
623
|
+
}
|
|
624
|
+
switch (message.type) {
|
|
625
|
+
case "tombstone":
|
|
626
|
+
break;
|
|
627
|
+
case "assistant": {
|
|
628
|
+
const msg = message;
|
|
629
|
+
const stopReason = msg.message?.stop_reason;
|
|
630
|
+
if (stopReason != null) {
|
|
631
|
+
lastStopReason = stopReason;
|
|
632
|
+
}
|
|
633
|
+
this.mutableMessages.push(msg);
|
|
634
|
+
yield* normalizeMessage(msg);
|
|
635
|
+
break;
|
|
636
|
+
}
|
|
637
|
+
case "progress": {
|
|
638
|
+
const msg = message;
|
|
639
|
+
this.mutableMessages.push(msg);
|
|
640
|
+
if (persistSession) {
|
|
641
|
+
messages.push(msg);
|
|
642
|
+
recordTranscript(messages);
|
|
643
|
+
}
|
|
644
|
+
yield* normalizeMessage(msg);
|
|
645
|
+
break;
|
|
646
|
+
}
|
|
647
|
+
case "user": {
|
|
648
|
+
const msg = message;
|
|
649
|
+
this.mutableMessages.push(msg);
|
|
650
|
+
yield* normalizeMessage(msg);
|
|
651
|
+
break;
|
|
652
|
+
}
|
|
653
|
+
case "stream_event": {
|
|
654
|
+
const event = message.event;
|
|
655
|
+
if (event.type === "message_start") {
|
|
656
|
+
currentMessageUsage = EMPTY_USAGE;
|
|
657
|
+
const eventMessage = event.message;
|
|
658
|
+
currentMessageUsage = updateUsage(currentMessageUsage, eventMessage.usage);
|
|
659
|
+
}
|
|
660
|
+
if (event.type === "message_delta") {
|
|
661
|
+
currentMessageUsage = updateUsage(currentMessageUsage, event.usage);
|
|
662
|
+
const delta = event.delta;
|
|
663
|
+
if (delta.stop_reason != null) {
|
|
664
|
+
lastStopReason = delta.stop_reason;
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
if (event.type === "message_stop") {
|
|
668
|
+
this.totalUsage = accumulateUsage(this.totalUsage, currentMessageUsage);
|
|
669
|
+
}
|
|
670
|
+
if (includePartialMessages) {
|
|
671
|
+
yield {
|
|
672
|
+
type: "stream_event",
|
|
673
|
+
event,
|
|
674
|
+
session_id: getSessionId(),
|
|
675
|
+
parent_tool_use_id: null,
|
|
676
|
+
uuid: randomUUID()
|
|
677
|
+
};
|
|
678
|
+
}
|
|
679
|
+
break;
|
|
680
|
+
}
|
|
681
|
+
case "attachment": {
|
|
682
|
+
const msg = message;
|
|
683
|
+
this.mutableMessages.push(msg);
|
|
684
|
+
if (persistSession) {
|
|
685
|
+
messages.push(msg);
|
|
686
|
+
recordTranscript(messages);
|
|
687
|
+
}
|
|
688
|
+
const attachment = msg.attachment;
|
|
689
|
+
if (attachment.type === "structured_output") {
|
|
690
|
+
structuredOutputFromTool = attachment.data;
|
|
691
|
+
} else if (attachment.type === "max_turns_reached") {
|
|
692
|
+
if (persistSession) {
|
|
693
|
+
if (isEnvTruthy(process.env.CLAUDE_CODE_EAGER_FLUSH) || isEnvTruthy(process.env.CLAUDE_CODE_IS_COWORK)) {
|
|
694
|
+
await flushSessionStorage();
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
yield {
|
|
698
|
+
type: "result",
|
|
699
|
+
subtype: "error_max_turns",
|
|
700
|
+
duration_ms: Date.now() - startTime,
|
|
701
|
+
duration_api_ms: getTotalAPIDuration(),
|
|
702
|
+
is_error: true,
|
|
703
|
+
num_turns: attachment.turnCount,
|
|
704
|
+
stop_reason: lastStopReason,
|
|
705
|
+
session_id: getSessionId(),
|
|
706
|
+
total_cost_usd: getTotalCostUSD(),
|
|
707
|
+
usage: this.totalUsage,
|
|
708
|
+
modelUsage: getModelUsage(),
|
|
709
|
+
permission_denials: this.permissionDenials,
|
|
710
|
+
fast_mode_state: getFastModeState(mainLoopModel, initialAppState.fastMode),
|
|
711
|
+
uuid: randomUUID(),
|
|
712
|
+
errors: [
|
|
713
|
+
`Reached maximum number of turns (${attachment.maxTurns})`
|
|
714
|
+
]
|
|
715
|
+
};
|
|
716
|
+
return;
|
|
717
|
+
} else if (replayUserMessages && attachment.type === "queued_command") {
|
|
718
|
+
yield {
|
|
719
|
+
type: "user",
|
|
720
|
+
message: {
|
|
721
|
+
role: "user",
|
|
722
|
+
content: attachment.prompt
|
|
723
|
+
},
|
|
724
|
+
session_id: getSessionId(),
|
|
725
|
+
parent_tool_use_id: null,
|
|
726
|
+
uuid: attachment.source_uuid || msg.uuid,
|
|
727
|
+
timestamp: msg.timestamp,
|
|
728
|
+
isReplay: true
|
|
729
|
+
};
|
|
730
|
+
}
|
|
731
|
+
break;
|
|
732
|
+
}
|
|
733
|
+
case "stream_request_start":
|
|
734
|
+
break;
|
|
735
|
+
case "system": {
|
|
736
|
+
const msg = message;
|
|
737
|
+
const snipResult = this.config.snipReplay?.(msg, this.mutableMessages);
|
|
738
|
+
if (snipResult !== undefined) {
|
|
739
|
+
if (snipResult.executed) {
|
|
740
|
+
this.mutableMessages.length = 0;
|
|
741
|
+
this.mutableMessages.push(...snipResult.messages);
|
|
742
|
+
}
|
|
743
|
+
break;
|
|
744
|
+
}
|
|
745
|
+
this.mutableMessages.push(msg);
|
|
746
|
+
if (msg.subtype === "compact_boundary" && msg.compactMetadata) {
|
|
747
|
+
const compactMsg = msg;
|
|
748
|
+
const mutableBoundaryIdx = this.mutableMessages.length - 1;
|
|
749
|
+
if (mutableBoundaryIdx > 0) {
|
|
750
|
+
this.mutableMessages.splice(0, mutableBoundaryIdx);
|
|
751
|
+
}
|
|
752
|
+
const localBoundaryIdx = messages.length - 1;
|
|
753
|
+
if (localBoundaryIdx > 0) {
|
|
754
|
+
messages.splice(0, localBoundaryIdx);
|
|
755
|
+
}
|
|
756
|
+
yield {
|
|
757
|
+
type: "system",
|
|
758
|
+
subtype: "compact_boundary",
|
|
759
|
+
session_id: getSessionId(),
|
|
760
|
+
uuid: msg.uuid,
|
|
761
|
+
compact_metadata: toSDKCompactMetadata(compactMsg.compactMetadata)
|
|
762
|
+
};
|
|
763
|
+
}
|
|
764
|
+
if (msg.subtype === "api_error") {
|
|
765
|
+
const apiErrorMsg = msg;
|
|
766
|
+
yield {
|
|
767
|
+
type: "system",
|
|
768
|
+
subtype: "api_retry",
|
|
769
|
+
attempt: apiErrorMsg.retryAttempt,
|
|
770
|
+
max_retries: apiErrorMsg.maxRetries,
|
|
771
|
+
retry_delay_ms: apiErrorMsg.retryInMs,
|
|
772
|
+
error_status: apiErrorMsg.error.status ?? null,
|
|
773
|
+
error: categorizeRetryableAPIError(apiErrorMsg.error),
|
|
774
|
+
session_id: getSessionId(),
|
|
775
|
+
uuid: msg.uuid
|
|
776
|
+
};
|
|
777
|
+
}
|
|
778
|
+
break;
|
|
779
|
+
}
|
|
780
|
+
case "tool_use_summary": {
|
|
781
|
+
const msg = message;
|
|
782
|
+
yield {
|
|
783
|
+
type: "tool_use_summary",
|
|
784
|
+
summary: msg.summary,
|
|
785
|
+
preceding_tool_use_ids: msg.precedingToolUseIds,
|
|
786
|
+
session_id: getSessionId(),
|
|
787
|
+
uuid: msg.uuid
|
|
788
|
+
};
|
|
789
|
+
break;
|
|
790
|
+
}
|
|
791
|
+
}
|
|
792
|
+
if (maxBudgetUsd !== undefined && getTotalCostUSD() >= maxBudgetUsd) {
|
|
793
|
+
if (persistSession) {
|
|
794
|
+
if (isEnvTruthy(process.env.CLAUDE_CODE_EAGER_FLUSH) || isEnvTruthy(process.env.CLAUDE_CODE_IS_COWORK)) {
|
|
795
|
+
await flushSessionStorage();
|
|
796
|
+
}
|
|
797
|
+
}
|
|
798
|
+
yield {
|
|
799
|
+
type: "result",
|
|
800
|
+
subtype: "error_max_budget_usd",
|
|
801
|
+
duration_ms: Date.now() - startTime,
|
|
802
|
+
duration_api_ms: getTotalAPIDuration(),
|
|
803
|
+
is_error: true,
|
|
804
|
+
num_turns: turnCount,
|
|
805
|
+
stop_reason: lastStopReason,
|
|
806
|
+
session_id: getSessionId(),
|
|
807
|
+
total_cost_usd: getTotalCostUSD(),
|
|
808
|
+
usage: this.totalUsage,
|
|
809
|
+
modelUsage: getModelUsage(),
|
|
810
|
+
permission_denials: this.permissionDenials,
|
|
811
|
+
fast_mode_state: getFastModeState(mainLoopModel, initialAppState.fastMode),
|
|
812
|
+
uuid: randomUUID(),
|
|
813
|
+
errors: [`Reached maximum budget ($${maxBudgetUsd})`]
|
|
814
|
+
};
|
|
815
|
+
return;
|
|
816
|
+
}
|
|
817
|
+
if (message.type === "user" && jsonSchema) {
|
|
818
|
+
const currentCalls = countToolCalls(this.mutableMessages, SYNTHETIC_OUTPUT_TOOL_NAME);
|
|
819
|
+
const callsThisQuery = currentCalls - initialStructuredOutputCalls;
|
|
820
|
+
const maxRetries = parseInt(process.env.MAX_STRUCTURED_OUTPUT_RETRIES || "5", 10);
|
|
821
|
+
if (callsThisQuery >= maxRetries) {
|
|
822
|
+
if (persistSession) {
|
|
823
|
+
if (isEnvTruthy(process.env.CLAUDE_CODE_EAGER_FLUSH) || isEnvTruthy(process.env.CLAUDE_CODE_IS_COWORK)) {
|
|
824
|
+
await flushSessionStorage();
|
|
825
|
+
}
|
|
826
|
+
}
|
|
827
|
+
yield {
|
|
828
|
+
type: "result",
|
|
829
|
+
subtype: "error_max_structured_output_retries",
|
|
830
|
+
duration_ms: Date.now() - startTime,
|
|
831
|
+
duration_api_ms: getTotalAPIDuration(),
|
|
832
|
+
is_error: true,
|
|
833
|
+
num_turns: turnCount,
|
|
834
|
+
stop_reason: lastStopReason,
|
|
835
|
+
session_id: getSessionId(),
|
|
836
|
+
total_cost_usd: getTotalCostUSD(),
|
|
837
|
+
usage: this.totalUsage,
|
|
838
|
+
modelUsage: getModelUsage(),
|
|
839
|
+
permission_denials: this.permissionDenials,
|
|
840
|
+
fast_mode_state: getFastModeState(mainLoopModel, initialAppState.fastMode),
|
|
841
|
+
uuid: randomUUID(),
|
|
842
|
+
errors: [
|
|
843
|
+
`Failed to provide valid structured output after ${maxRetries} attempts`
|
|
844
|
+
]
|
|
845
|
+
};
|
|
846
|
+
return;
|
|
847
|
+
}
|
|
848
|
+
}
|
|
849
|
+
}
|
|
850
|
+
const result = messages.findLast((m) => m.type === "assistant" || m.type === "user");
|
|
851
|
+
const edeResultType = result?.type ?? "undefined";
|
|
852
|
+
const edeLastContentType = result?.type === "assistant" ? last_default(result.message.content)?.type ?? "none" : "n/a";
|
|
853
|
+
if (persistSession) {
|
|
854
|
+
if (isEnvTruthy(process.env.CLAUDE_CODE_EAGER_FLUSH) || isEnvTruthy(process.env.CLAUDE_CODE_IS_COWORK)) {
|
|
855
|
+
await flushSessionStorage();
|
|
856
|
+
}
|
|
857
|
+
}
|
|
858
|
+
if (!isResultSuccessful(result, lastStopReason)) {
|
|
859
|
+
yield {
|
|
860
|
+
type: "result",
|
|
861
|
+
subtype: "error_during_execution",
|
|
862
|
+
duration_ms: Date.now() - startTime,
|
|
863
|
+
duration_api_ms: getTotalAPIDuration(),
|
|
864
|
+
is_error: true,
|
|
865
|
+
num_turns: turnCount,
|
|
866
|
+
stop_reason: lastStopReason,
|
|
867
|
+
session_id: getSessionId(),
|
|
868
|
+
total_cost_usd: getTotalCostUSD(),
|
|
869
|
+
usage: this.totalUsage,
|
|
870
|
+
modelUsage: getModelUsage(),
|
|
871
|
+
permission_denials: this.permissionDenials,
|
|
872
|
+
fast_mode_state: getFastModeState(mainLoopModel, initialAppState.fastMode),
|
|
873
|
+
uuid: randomUUID(),
|
|
874
|
+
errors: (() => {
|
|
875
|
+
const all = getInMemoryErrors();
|
|
876
|
+
const start = errorLogWatermark ? all.lastIndexOf(errorLogWatermark) + 1 : 0;
|
|
877
|
+
return [
|
|
878
|
+
`[ede_diagnostic] result_type=${edeResultType} last_content_type=${edeLastContentType} stop_reason=${lastStopReason}`,
|
|
879
|
+
...all.slice(start).map((_) => _.error)
|
|
880
|
+
];
|
|
881
|
+
})()
|
|
882
|
+
};
|
|
883
|
+
return;
|
|
884
|
+
}
|
|
885
|
+
let textResult = "";
|
|
886
|
+
let isApiError = false;
|
|
887
|
+
if (result.type === "assistant") {
|
|
888
|
+
const lastContent = last_default(result.message.content);
|
|
889
|
+
if (lastContent?.type === "text" && !SYNTHETIC_MESSAGES.has(lastContent.text)) {
|
|
890
|
+
textResult = lastContent.text;
|
|
891
|
+
}
|
|
892
|
+
isApiError = Boolean(result.isApiErrorMessage);
|
|
893
|
+
}
|
|
894
|
+
yield {
|
|
895
|
+
type: "result",
|
|
896
|
+
subtype: "success",
|
|
897
|
+
is_error: isApiError,
|
|
898
|
+
duration_ms: Date.now() - startTime,
|
|
899
|
+
duration_api_ms: getTotalAPIDuration(),
|
|
900
|
+
num_turns: turnCount,
|
|
901
|
+
result: textResult,
|
|
902
|
+
stop_reason: lastStopReason,
|
|
903
|
+
session_id: getSessionId(),
|
|
904
|
+
total_cost_usd: getTotalCostUSD(),
|
|
905
|
+
usage: this.totalUsage,
|
|
906
|
+
modelUsage: getModelUsage(),
|
|
907
|
+
permission_denials: this.permissionDenials,
|
|
908
|
+
structured_output: structuredOutputFromTool,
|
|
909
|
+
fast_mode_state: getFastModeState(mainLoopModel, initialAppState.fastMode),
|
|
910
|
+
uuid: randomUUID()
|
|
911
|
+
};
|
|
912
|
+
}
|
|
913
|
+
interrupt() {
|
|
914
|
+
this.abortController.abort();
|
|
915
|
+
}
|
|
916
|
+
resetAbortController() {
|
|
917
|
+
this.abortController = createAbortController();
|
|
918
|
+
}
|
|
919
|
+
getAbortSignal() {
|
|
920
|
+
return this.abortController.signal;
|
|
921
|
+
}
|
|
922
|
+
getMessages() {
|
|
923
|
+
return this.mutableMessages;
|
|
924
|
+
}
|
|
925
|
+
getReadFileState() {
|
|
926
|
+
return this.readFileState;
|
|
927
|
+
}
|
|
928
|
+
getSessionId() {
|
|
929
|
+
return getSessionId();
|
|
930
|
+
}
|
|
931
|
+
setModel(model) {
|
|
932
|
+
this.config.userSpecifiedModel = model;
|
|
933
|
+
}
|
|
934
|
+
}
|
|
935
|
+
async function* ask({
|
|
936
|
+
commands,
|
|
937
|
+
prompt,
|
|
938
|
+
promptUuid,
|
|
939
|
+
isMeta,
|
|
940
|
+
cwd,
|
|
941
|
+
tools,
|
|
942
|
+
mcpClients,
|
|
943
|
+
verbose = false,
|
|
944
|
+
thinkingConfig,
|
|
945
|
+
maxTurns,
|
|
946
|
+
maxBudgetUsd,
|
|
947
|
+
taskBudget,
|
|
948
|
+
canUseTool,
|
|
949
|
+
mutableMessages = [],
|
|
950
|
+
getReadFileCache,
|
|
951
|
+
setReadFileCache,
|
|
952
|
+
customSystemPrompt,
|
|
953
|
+
appendSystemPrompt,
|
|
954
|
+
userSpecifiedModel,
|
|
955
|
+
fallbackModel,
|
|
956
|
+
jsonSchema,
|
|
957
|
+
getAppState,
|
|
958
|
+
setAppState,
|
|
959
|
+
abortController,
|
|
960
|
+
replayUserMessages = false,
|
|
961
|
+
includePartialMessages = false,
|
|
962
|
+
handleElicitation,
|
|
963
|
+
agents = [],
|
|
964
|
+
setSDKStatus,
|
|
965
|
+
orphanedPermission
|
|
966
|
+
}) {
|
|
967
|
+
const engine = new QueryEngine({
|
|
968
|
+
cwd,
|
|
969
|
+
tools,
|
|
970
|
+
commands,
|
|
971
|
+
mcpClients,
|
|
972
|
+
agents: agents ?? [],
|
|
973
|
+
canUseTool,
|
|
974
|
+
getAppState,
|
|
975
|
+
setAppState,
|
|
976
|
+
initialMessages: mutableMessages,
|
|
977
|
+
readFileCache: cloneFileStateCache(getReadFileCache()),
|
|
978
|
+
customSystemPrompt,
|
|
979
|
+
appendSystemPrompt,
|
|
980
|
+
userSpecifiedModel,
|
|
981
|
+
fallbackModel,
|
|
982
|
+
thinkingConfig,
|
|
983
|
+
maxTurns,
|
|
984
|
+
maxBudgetUsd,
|
|
985
|
+
taskBudget,
|
|
986
|
+
jsonSchema,
|
|
987
|
+
verbose,
|
|
988
|
+
handleElicitation,
|
|
989
|
+
replayUserMessages,
|
|
990
|
+
includePartialMessages,
|
|
991
|
+
setSDKStatus,
|
|
992
|
+
abortController,
|
|
993
|
+
orphanedPermission,
|
|
994
|
+
...{
|
|
995
|
+
snipReplay: (yielded, store) => {
|
|
996
|
+
if (!snipProjection.isSnipBoundaryMessage(yielded))
|
|
997
|
+
return;
|
|
998
|
+
return snipModule.snipCompactIfNeeded(store, { force: true });
|
|
999
|
+
}
|
|
1000
|
+
}
|
|
1001
|
+
});
|
|
1002
|
+
try {
|
|
1003
|
+
yield* engine.submitMessage(prompt, {
|
|
1004
|
+
uuid: promptUuid,
|
|
1005
|
+
isMeta
|
|
1006
|
+
});
|
|
1007
|
+
} finally {
|
|
1008
|
+
setReadFileCache(engine.getReadFileState());
|
|
1009
|
+
}
|
|
1010
|
+
}
|
|
1011
|
+
|
|
1012
|
+
export { buildSideQuestionFallbackParams, QueryEngine, ask };
|