@costrict/csc 4.1.2 → 4.1.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.
- package/dist/{chunk-gbekxw41.js → chunk-09d9cpjk.js} +36 -36
- package/dist/{chunk-0zwtzj7s.js → chunk-0hf3xsng.js} +3 -3
- package/dist/{chunk-zfwgjjde.js → chunk-0q6t0wzt.js} +5 -3
- package/dist/{chunk-r9qnxgqt.js → chunk-0y9t47jm.js} +5 -5
- package/dist/{chunk-v9b2rh8h.js → chunk-11ekavk1.js} +38 -38
- package/dist/{chunk-9bf696cj.js → chunk-147vdz44.js} +49 -49
- package/dist/{chunk-9qgzdk8y.js → chunk-1bdg7mgh.js} +21 -10
- package/dist/{chunk-1928vvnf.js → chunk-1wee9cv0.js} +12 -12
- package/dist/{chunk-jx80x2sn.js → chunk-1x52prap.js} +35 -35
- package/dist/{chunk-2heyngx7.js → chunk-1xjaqypa.js} +35 -35
- package/dist/{chunk-ebfv6acv.js → chunk-1zwqxpb6.js} +6 -6
- package/dist/{chunk-6kddkcqk.js → chunk-22ys018y.js} +37 -37
- package/dist/{chunk-9gxdrrd5.js → chunk-24g5r745.js} +35 -35
- package/dist/{chunk-re5p7q2e.js → chunk-2d21405m.js} +4 -4
- package/dist/{chunk-qm3k6vez.js → chunk-2dfz3jwm.js} +5 -5
- package/dist/{chunk-xt65mfby.js → chunk-2grx4b5p.js} +13 -13
- package/dist/{chunk-3ed5qycn.js → chunk-2gv49qs2.js} +39 -39
- package/dist/{chunk-t408adb9.js → chunk-2h1dxajn.js} +36 -36
- package/dist/{chunk-3keyh8d3.js → chunk-2j3jrj2e.js} +2 -2
- package/dist/{chunk-pyfrphvc.js → chunk-2pzzfp72.js} +37 -37
- package/dist/{chunk-xxfz08mf.js → chunk-2rwde424.js} +35 -35
- package/dist/{chunk-y061xbn9.js → chunk-2vgbmtyb.js} +5 -5
- package/dist/{chunk-1xqh8b38.js → chunk-2w6j2m6p.js} +2 -2
- package/dist/{chunk-bdy3869e.js → chunk-2y94ygfz.js} +2 -2
- package/dist/{chunk-r8ywba1h.js → chunk-2yw4bwfh.js} +5 -5
- package/dist/{chunk-hjp1yckp.js → chunk-35dxmwra.js} +36 -36
- package/dist/{chunk-0cm9fcaq.js → chunk-37z2mmbw.js} +4 -4
- package/dist/{chunk-xm6t6khx.js → chunk-3c280vpt.js} +36 -36
- package/dist/{chunk-vzxtxv4a.js → chunk-3e6dv76a.js} +36 -36
- package/dist/{chunk-x6cjkxqe.js → chunk-3ft93eyw.js} +5 -5
- package/dist/{chunk-dt5c48mh.js → chunk-3khv1k2r.js} +2 -2
- package/dist/{chunk-rqa3fz1t.js → chunk-3te0naan.js} +35 -35
- package/dist/{chunk-kxn6mzy3.js → chunk-3vj11ct8.js} +2 -2
- package/dist/{chunk-am5zfwnf.js → chunk-42jhchth.js} +8 -8
- package/dist/{chunk-28p3x5mq.js → chunk-42r75rph.js} +38 -38
- package/dist/{chunk-hebz2z6z.js → chunk-4436nyqe.js} +36 -36
- package/dist/{chunk-496449vy.js → chunk-454ty3a9.js} +2 -2
- package/dist/{chunk-rasdgp8g.js → chunk-47mtpn1d.js} +4 -4
- package/dist/{chunk-jt7wch8z.js → chunk-48ggg92j.js} +2 -2
- package/dist/{chunk-s262tfgm.js → chunk-49sm91ec.js} +3 -3
- package/dist/{chunk-41ncbfk7.js → chunk-4c1h8w56.js} +3 -3
- package/dist/{chunk-0d8p649e.js → chunk-4c6gwct4.js} +62 -62
- package/dist/{chunk-t7434h4s.js → chunk-4c8r5etf.js} +35 -35
- package/dist/{chunk-w8xchcwf.js → chunk-4hhnec4s.js} +3 -3
- package/dist/{chunk-4ks3c21q.js → chunk-4hvh6etx.js} +44 -44
- package/dist/{chunk-qavfmmqd.js → chunk-4ke9brnb.js} +4 -4
- package/dist/{chunk-jhdtyhk5.js → chunk-4kevnqfd.js} +37 -37
- package/dist/{chunk-rhqffqzf.js → chunk-4m0bjecy.js} +6 -6
- package/dist/{chunk-rfxctace.js → chunk-4md0mpss.js} +3 -3
- package/dist/{chunk-qk2tvn8y.js → chunk-4mdj278s.js} +36 -36
- package/dist/{chunk-jcdv05ym.js → chunk-4mzrmt07.js} +2 -2
- package/dist/{chunk-vpn54vqg.js → chunk-4r00fs6b.js} +6 -6
- package/dist/{chunk-kszphewb.js → chunk-4v4ztt55.js} +36 -36
- package/dist/{chunk-w9fptpp9.js → chunk-4vvph2sr.js} +44 -44
- package/dist/{chunk-hkkz8rde.js → chunk-4y2sk1ad.js} +35 -35
- package/dist/{chunk-3hw6pcqt.js → chunk-4zaverwj.js} +10 -10
- package/dist/{chunk-w60fa5cj.js → chunk-5027cx6v.js} +45 -45
- package/dist/{chunk-62r8rxkw.js → chunk-50gyyx3a.js} +3 -3
- package/dist/{chunk-hjxz7a04.js → chunk-548vsr6m.js} +38 -38
- package/dist/{chunk-ennzq1s5.js → chunk-5511t18e.js} +2 -2
- package/dist/{chunk-7d5gzxsx.js → chunk-55kecgcg.js} +2 -2
- package/dist/{chunk-br1qf4bc.js → chunk-5aqaz23r.js} +5 -5
- package/dist/{chunk-r3fadmd6.js → chunk-5ev4k0f2.js} +4 -4
- package/dist/{chunk-nkgq6a5q.js → chunk-5h6ra6a2.js} +22 -22
- package/dist/{chunk-hh6kgtq5.js → chunk-5kwvenz7.js} +3 -3
- package/dist/{chunk-xhnmweqe.js → chunk-5n1mzppd.js} +41 -41
- package/dist/{chunk-pbmy8ktp.js → chunk-5np2696m.js} +7 -7
- package/dist/{chunk-kbbjfeb8.js → chunk-5s1cmr4k.js} +2 -2
- package/dist/{chunk-zgvyn6yk.js → chunk-5thkd3nq.js} +35 -35
- package/dist/{chunk-8fqa9v4h.js → chunk-5vh1p3ky.js} +35 -35
- package/dist/{chunk-r4mec6w5.js → chunk-65ryde7a.js} +3 -3
- package/dist/{chunk-46sfycpp.js → chunk-6m26tv8b.js} +6 -6
- package/dist/{chunk-8qp0ytjr.js → chunk-6p39g0w8.js} +2 -2
- package/dist/{chunk-ycsh7pst.js → chunk-6qk13za3.js} +5 -5
- package/dist/{chunk-172aq1cm.js → chunk-6t7858mm.js} +3 -3
- package/dist/{chunk-6aevda19.js → chunk-6tv01x8f.js} +2 -2
- package/dist/{chunk-h1frxdrg.js → chunk-6v5kghc6.js} +36 -36
- package/dist/{chunk-qjx52q61.js → chunk-72329dq9.js} +2 -2
- package/dist/{chunk-bh4k9q9y.js → chunk-7249b8sr.js} +3 -3
- package/dist/{chunk-tfew976a.js → chunk-73zxzeve.js} +35 -35
- package/dist/{chunk-hd8ydnzq.js → chunk-7481a4r2.js} +6 -6
- package/dist/{chunk-7yq22pd2.js → chunk-75qdw92d.js} +37 -37
- package/dist/{chunk-nmyfe9j9.js → chunk-7694q43p.js} +37 -37
- package/dist/{chunk-kkwym2b7.js → chunk-7a93vkn3.js} +4 -4
- package/dist/{chunk-5bd0sf0q.js → chunk-7c1rj5de.js} +4 -3
- package/dist/{chunk-s4pjm9jw.js → chunk-7m65ry6g.js} +35 -35
- package/dist/{chunk-yedzdc0a.js → chunk-7z2162vj.js} +6 -6
- package/dist/{chunk-vqhgs52z.js → chunk-81j0yjj5.js} +6 -6
- package/dist/{chunk-p1wxbhgj.js → chunk-82b0zw1g.js} +4 -4
- package/dist/{chunk-sx4gbak5.js → chunk-83p7ypqz.js} +36 -36
- package/dist/{chunk-hyztfnyq.js → chunk-83y4hwve.js} +157 -157
- package/dist/{chunk-e1m95nec.js → chunk-84ms4gmg.js} +5 -5
- package/dist/{chunk-1z6393pz.js → chunk-887mgrcf.js} +35 -35
- package/dist/{chunk-3c22f5y8.js → chunk-8c5w8v3y.js} +2 -2
- package/dist/{chunk-g6d9avms.js → chunk-8es30rt4.js} +93 -93
- package/dist/{chunk-94jqjx3g.js → chunk-8fqwp3m6.js} +39 -39
- package/dist/{chunk-fbtp7vga.js → chunk-8kjckc8g.js} +4 -4
- package/dist/{chunk-bb9h35x7.js → chunk-8qst0rhx.js} +35 -35
- package/dist/{chunk-cfeakba6.js → chunk-8vb5860k.js} +35 -35
- package/dist/{chunk-tq32b105.js → chunk-8y2wphhe.js} +3 -3
- package/dist/{chunk-04js9982.js → chunk-8ztxv0s8.js} +6 -6
- package/dist/{chunk-wqk03hpc.js → chunk-90dexk03.js} +35 -35
- package/dist/{chunk-hy5vd50e.js → chunk-948sac2f.js} +3 -3
- package/dist/{chunk-zr750mg3.js → chunk-953hv54z.js} +38 -38
- package/dist/{chunk-zyhpq0w1.js → chunk-96012zrd.js} +8 -3
- package/dist/{chunk-zmj9sehj.js → chunk-988v9k0d.js} +36 -36
- package/dist/{chunk-hthfhdty.js → chunk-9frmefq9.js} +7 -7
- package/dist/{chunk-5fny1a0a.js → chunk-9jftryb5.js} +5 -5
- package/dist/{chunk-mqr18cwx.js → chunk-9p9k73kh.js} +4 -4
- package/dist/{chunk-503675yy.js → chunk-9q15hsft.js} +2 -2
- package/dist/{chunk-c36xznt7.js → chunk-9q98b0yn.js} +12 -10
- package/dist/{chunk-rtgff67y.js → chunk-9rap9ebg.js} +43 -43
- package/dist/{chunk-bbpnmz87.js → chunk-9rq3w880.js} +4 -3
- package/dist/{chunk-fx7pr1g4.js → chunk-9scfrax2.js} +5 -5
- package/dist/{chunk-kcz5b7xv.js → chunk-9spwqs8d.js} +7 -7
- package/dist/{chunk-gn0ja3k5.js → chunk-9tzsvsnw.js} +4 -4
- package/dist/{chunk-g9caj6wj.js → chunk-9w213qwh.js} +46 -46
- package/dist/{chunk-9q952pw0.js → chunk-9yneyd6s.js} +2 -2
- package/dist/{chunk-cchv4yn8.js → chunk-a0vxkvbn.js} +37 -37
- package/dist/{chunk-2d4az1sb.js → chunk-a3jxa40m.js} +29 -29
- package/dist/{chunk-2n4jnkr3.js → chunk-a5tvkr47.js} +2 -2
- package/dist/{chunk-mnqvtfd5.js → chunk-a9c2z1wz.js} +8 -8
- package/dist/{chunk-1gta3pqg.js → chunk-ab57dtc9.js} +5 -5
- package/dist/{chunk-mp5km99q.js → chunk-abcd5j5y.js} +12 -12
- package/dist/{chunk-yt5gwdg5.js → chunk-ag4g1ggt.js} +2 -2
- package/dist/{chunk-jd5xs374.js → chunk-amrphgc8.js} +35 -35
- package/dist/{chunk-mdm5cbxy.js → chunk-apr24btq.js} +35 -35
- package/dist/{chunk-y6ce2s1q.js → chunk-attapyb3.js} +37 -37
- package/dist/{chunk-tdkwcv57.js → chunk-awsqxad3.js} +4 -4
- package/dist/{chunk-cnfzmqr8.js → chunk-axh75nac.js} +6 -6
- package/dist/{chunk-1hr30g9j.js → chunk-b0e59wz3.js} +36 -36
- package/dist/{chunk-e6dq8apj.js → chunk-b652a6dk.js} +35 -35
- package/dist/{chunk-ckh1zt0n.js → chunk-b6n6hjak.js} +41 -41
- package/dist/{chunk-rw1070pc.js → chunk-beyedb98.js} +4 -4
- package/dist/{chunk-jkyn6ge9.js → chunk-bh5nrh0k.js} +5 -5
- package/dist/{chunk-6fbvxhan.js → chunk-bjf81kyq.js} +2 -2
- package/dist/chunk-bpj3247f.js +750 -0
- package/dist/{chunk-txync4kd.js → chunk-bq6t381k.js} +6 -6
- package/dist/{chunk-n40kbp9f.js → chunk-bqaej1qd.js} +35 -35
- package/dist/{chunk-c3z2f4aq.js → chunk-bsx46tp0.js} +38 -38
- package/dist/{chunk-gz0nj0mm.js → chunk-bvgan6hr.js} +35 -35
- package/dist/{chunk-nv5rddp1.js → chunk-bxm7c03x.js} +35 -35
- package/dist/{chunk-a18ypbnr.js → chunk-c742mhq9.js} +37 -37
- package/dist/{chunk-x48x54hx.js → chunk-cdxhn1zj.js} +38 -38
- package/dist/{chunk-7zxvjs3d.js → chunk-cjmw41yz.js} +2 -2
- package/dist/{chunk-e26hypm4.js → chunk-cky6d5se.js} +36 -36
- package/dist/{chunk-fv94gm4h.js → chunk-csdze321.js} +36 -36
- package/dist/{chunk-0wfby4jk.js → chunk-cw94b6wr.js} +35 -35
- package/dist/{chunk-4hgk89n9.js → chunk-d06vspmk.js} +35 -35
- package/dist/{chunk-fgna18nd.js → chunk-d28aep53.js} +4 -4
- package/dist/{chunk-96gwphgv.js → chunk-d7t9v7ta.js} +3 -3
- package/dist/{chunk-vvk6wx6b.js → chunk-da9tm2qa.js} +6 -6
- package/dist/{chunk-58jcwxyh.js → chunk-dak5jvak.js} +6 -6
- package/dist/{chunk-ptermrp1.js → chunk-dq08hqxs.js} +38 -38
- package/dist/{chunk-sd2g0s0k.js → chunk-drdkvee7.js} +8 -8
- package/dist/{chunk-r6g3xx75.js → chunk-dwmzyeff.js} +37 -37
- package/dist/{chunk-eb6x30zz.js → chunk-dzkpgn3b.js} +37 -37
- package/dist/{chunk-wvs8wv8t.js → chunk-e1rckp3d.js} +2 -2
- package/dist/{chunk-xftqvncz.js → chunk-e29asgnz.js} +4 -4
- package/dist/{chunk-g0axk7cx.js → chunk-e56gbfpf.js} +35 -35
- package/dist/{chunk-qnztz65r.js → chunk-e9e7yh7j.js} +36 -36
- package/dist/{chunk-y0z468z2.js → chunk-eb9a1naq.js} +36 -36
- package/dist/{chunk-wzzaxwej.js → chunk-ee23jajz.js} +2 -2
- package/dist/{chunk-hq4jd1fy.js → chunk-egrm3m3a.js} +12 -12
- package/dist/{chunk-8v8n8gxv.js → chunk-ehc914vn.js} +11 -4
- package/dist/{chunk-r974358t.js → chunk-ehjsvcrt.js} +5 -5
- package/dist/{chunk-x41dz9y9.js → chunk-en9y1v8v.js} +2 -2
- package/dist/{chunk-6bb0gyhh.js → chunk-eqdmywve.js} +35 -35
- package/dist/{chunk-yteefw26.js → chunk-erqvy07y.js} +35 -35
- package/dist/{chunk-j5rnevxw.js → chunk-esxjcj0y.js} +40 -40
- package/dist/{chunk-xvmtyz8q.js → chunk-et2dhhdq.js} +2 -2
- package/dist/{chunk-rfvzhq5x.js → chunk-ey3q6r96.js} +35 -35
- package/dist/{chunk-0wzfz235.js → chunk-eya7mh5s.js} +35 -35
- package/dist/{chunk-1ta87008.js → chunk-eycktzbk.js} +10 -10
- package/dist/{chunk-thzmxfnt.js → chunk-ezj1ys56.js} +2 -2
- package/dist/{chunk-p8d1q69a.js → chunk-f092tjve.js} +35 -35
- package/dist/{chunk-wwfe7gg7.js → chunk-f4bg3n9r.js} +37 -37
- package/dist/{chunk-4f56n8y8.js → chunk-f4d05y69.js} +4 -4
- package/dist/{chunk-7hnmt967.js → chunk-f6wcbaqd.js} +54 -54
- package/dist/{chunk-qmp50hjb.js → chunk-f9asafa4.js} +9 -9
- package/dist/{chunk-7gyjd00q.js → chunk-f9yqhfrd.js} +3 -3
- package/dist/{chunk-x89sscn0.js → chunk-fawmw9km.js} +2 -2
- package/dist/{chunk-71053xes.js → chunk-fejn0zak.js} +6 -6
- package/dist/{chunk-b52sketm.js → chunk-ffpht24v.js} +35 -35
- package/dist/{chunk-6d9njm1w.js → chunk-fm1cnxaj.js} +2 -2
- package/dist/{chunk-p10xajeq.js → chunk-fp9vj0rq.js} +50 -50
- package/dist/{chunk-nmj9qx2x.js → chunk-fr6qz9nr.js} +45 -45
- package/dist/{chunk-dfzfxt1y.js → chunk-fs5cdxnp.js} +7 -7
- package/dist/{chunk-nkeknzb2.js → chunk-fv0k0mn7.js} +2 -2
- package/dist/{chunk-dpb1kvb9.js → chunk-g95zt8k8.js} +36 -36
- package/dist/{chunk-yvjzex9w.js → chunk-g9mdg0wk.js} +4 -4
- package/dist/{chunk-w3wdqhv0.js → chunk-gda7ak8c.js} +42 -42
- package/dist/{chunk-cydd546q.js → chunk-gg4ky3pk.js} +37 -37
- package/dist/{chunk-sczmmmvj.js → chunk-gh3sxpqt.js} +2 -2
- package/dist/{chunk-pqrb30bj.js → chunk-gkfhy27z.js} +10 -8
- package/dist/{chunk-v4h7dscd.js → chunk-gkp071jz.js} +6 -6
- package/dist/{chunk-tw0b366n.js → chunk-gmgyqmw4.js} +35 -35
- package/dist/{chunk-4xp653hr.js → chunk-gxzr8z7f.js} +35 -35
- package/dist/{chunk-2278qvvz.js → chunk-h03eymaj.js} +35 -35
- package/dist/{chunk-djbawqmw.js → chunk-h145ywcf.js} +35 -35
- package/dist/{chunk-yrr4d26k.js → chunk-h3gj9h7t.js} +36 -36
- package/dist/{chunk-fpb43g1s.js → chunk-h4hzqagh.js} +5 -5
- package/dist/{chunk-tr448vwb.js → chunk-h7meex22.js} +3 -3
- package/dist/{chunk-xa9xpah3.js → chunk-ha4bgnn1.js} +222 -75
- package/dist/{chunk-64wm5777.js → chunk-hf7w6c1y.js} +7 -7
- package/dist/{chunk-jt7ea6rq.js → chunk-hm3c5jch.js} +35 -35
- package/dist/{chunk-vtnm80k9.js → chunk-hrmytevz.js} +5 -5
- package/dist/{chunk-5dm3xwms.js → chunk-hw7zdnaq.js} +5 -5
- package/dist/{chunk-4v3p8phf.js → chunk-hz3rdc5x.js} +7 -7
- package/dist/{chunk-fknjgxt4.js → chunk-hzyn43j3.js} +36 -36
- package/dist/{chunk-t20f5mnk.js → chunk-j1esynw3.js} +6 -6
- package/dist/{chunk-nevf0mb9.js → chunk-j20g74f9.js} +7 -7
- package/dist/{chunk-qpatv1ep.js → chunk-j9xne3kv.js} +5 -5
- package/dist/{chunk-89jrgnx3.js → chunk-jcjyq2p1.js} +6 -6
- package/dist/{chunk-2bahqsy8.js → chunk-jcykmnmk.js} +4 -4
- package/dist/{chunk-vym5zrn6.js → chunk-jdx6pqay.js} +745 -356
- package/dist/{chunk-03g34taj.js → chunk-jm3bfch2.js} +35 -35
- package/dist/{chunk-psq9gtg7.js → chunk-js2a5x6x.js} +2 -2
- package/dist/{chunk-1tsg5bqp.js → chunk-jw0j8e2k.js} +6 -6
- package/dist/{chunk-2ea63hn5.js → chunk-jx52c20q.js} +35 -35
- package/dist/{chunk-2yz7ej7r.js → chunk-k5a0g0n1.js} +2 -2
- package/dist/{chunk-q90bcq6v.js → chunk-kbm6tqp9.js} +38 -38
- package/dist/{chunk-mpxcgg5f.js → chunk-ke8xk8zg.js} +3 -3
- package/dist/{chunk-v060k07j.js → chunk-khwgvhnp.js} +40 -40
- package/dist/{chunk-347n8wrb.js → chunk-kp1y42ya.js} +36 -36
- package/dist/chunk-ksav9jw1.js +2118 -0
- package/dist/{chunk-h93ve2g2.js → chunk-ky133fvv.js} +6 -6
- package/dist/{chunk-jkbkp0ek.js → chunk-kz68xhzh.js} +5 -5
- package/dist/{chunk-bm5370d5.js → chunk-m0fnkcdr.js} +6 -6
- package/dist/{chunk-04h1dzn8.js → chunk-m1q1cs5y.js} +38 -38
- package/dist/{chunk-cz5ycdta.js → chunk-m2t05hdr.js} +3 -3
- package/dist/{chunk-q72dtjqy.js → chunk-m4bfhf56.js} +2 -2
- package/dist/{chunk-bxmc7435.js → chunk-mb7ne7fv.js} +2 -2
- package/dist/{chunk-a96dsyhm.js → chunk-mn3rbfas.js} +38 -38
- package/dist/{chunk-5w9qcjjt.js → chunk-mne7ewfn.js} +41 -41
- package/dist/{chunk-cy223s48.js → chunk-mqfdx9c1.js} +5 -5
- package/dist/{chunk-7k0h27s8.js → chunk-mwzga09f.js} +6 -6
- package/dist/{chunk-5p3bwhcw.js → chunk-my2v9ayn.js} +2 -2
- package/dist/{chunk-y3cshvgb.js → chunk-mzbwfkxd.js} +2 -2
- package/dist/{chunk-87ddk39d.js → chunk-mzv3b466.js} +4 -4
- package/dist/{chunk-p6fhtt1h.js → chunk-n3mpdn3c.js} +3 -3
- package/dist/{chunk-bjc8f709.js → chunk-n57j5gs3.js} +42 -42
- package/dist/{chunk-h9mr8ey4.js → chunk-n7za733h.js} +9 -9
- package/dist/{chunk-0kv76cch.js → chunk-n7zfvhh2.js} +46 -46
- package/dist/{chunk-n51s6m60.js → chunk-n89tc6qq.js} +6 -6
- package/dist/{chunk-pr321r8d.js → chunk-n8jjg228.js} +3 -3
- package/dist/{chunk-v1rkrwwv.js → chunk-nk786fyz.js} +36 -36
- package/dist/{chunk-zb7ctc11.js → chunk-nqm0yexv.js} +35 -35
- package/dist/{chunk-7jbeh3g8.js → chunk-nx8c61ax.js} +3 -3
- package/dist/{chunk-6ypvw68g.js → chunk-nxfeyrc7.js} +35 -35
- package/dist/{chunk-a80y3b1p.js → chunk-p1m1w5dz.js} +12 -7
- package/dist/{chunk-gfycetpg.js → chunk-p1phzye5.js} +3 -3
- package/dist/{chunk-e5kn4hwp.js → chunk-p41t988k.js} +35 -35
- package/dist/{chunk-be8pcep0.js → chunk-p4ymzqkv.js} +2 -2
- package/dist/{chunk-zzac564h.js → chunk-p5dfmkjr.js} +6 -6
- package/dist/{chunk-v21ssxkp.js → chunk-p6r9kbzs.js} +2 -2
- package/dist/{chunk-12b1dsca.js → chunk-p6v3r3ft.js} +3 -3
- package/dist/{chunk-k3mghke5.js → chunk-pbsv26se.js} +35 -35
- package/dist/{chunk-52d0caw3.js → chunk-pfza1h60.js} +38 -38
- package/dist/{chunk-4k4kn7h2.js → chunk-pp46zp45.js} +16 -16
- package/dist/{chunk-7b1ze28c.js → chunk-pqz3gay7.js} +35 -35
- package/dist/{chunk-5r57a99p.js → chunk-prgfcrhy.js} +7 -7
- package/dist/{chunk-365z3p8q.js → chunk-ptxa1358.js} +4 -4
- package/dist/{chunk-83v18n96.js → chunk-pxne3x8j.js} +6 -6
- package/dist/{chunk-6zn0szv5.js → chunk-q7ra5hq0.js} +9 -9
- package/dist/{chunk-27rca2qk.js → chunk-qa5gps5n.js} +6 -6
- package/dist/{chunk-tmedrj3f.js → chunk-qgq7k5n1.js} +3 -3
- package/dist/{chunk-5cxetff3.js → chunk-qhr0bxds.js} +7 -7
- package/dist/{chunk-khnxj5vx.js → chunk-qqj27ps5.js} +3 -3
- package/dist/{chunk-v2vzfj4h.js → chunk-qre271gq.js} +35 -35
- package/dist/{chunk-0s2qjxt0.js → chunk-qy6y2jh6.js} +2 -2
- package/dist/{chunk-rbr0tsrz.js → chunk-qzmncxe1.js} +35 -35
- package/dist/{chunk-v522k1r4.js → chunk-r0h1fmx6.js} +48 -48
- package/dist/{chunk-zshw91dr.js → chunk-r3hnpmf2.js} +3 -3
- package/dist/{chunk-9sr5cheh.js → chunk-rb523kgm.js} +35 -35
- package/dist/{chunk-tnqjynvy.js → chunk-re33t7ae.js} +6 -6
- package/dist/{chunk-stqsfa68.js → chunk-rekj2av4.js} +3 -3
- package/dist/{chunk-swr65v0j.js → chunk-rfbycs7b.js} +8 -8
- package/dist/{chunk-8pqe4w62.js → chunk-rg9g7n81.js} +42 -42
- package/dist/{chunk-8fm77brm.js → chunk-rhqkpy2b.js} +39 -39
- package/dist/{chunk-6a32d602.js → chunk-rqwwtvv5.js} +35 -35
- package/dist/{chunk-n87c314c.js → chunk-s4ac4pp7.js} +36 -36
- package/dist/{chunk-nr2skyv7.js → chunk-s4sx5dc5.js} +37 -37
- package/dist/{chunk-zdsqreyq.js → chunk-s5z2mj7c.js} +3 -3
- package/dist/{chunk-q0w614e1.js → chunk-s8xmcaw5.js} +3 -3
- package/dist/{chunk-29n8fs0h.js → chunk-sb1dx4yy.js} +2 -2
- package/dist/{chunk-9cw6etxe.js → chunk-sg1bpfms.js} +36 -36
- package/dist/{chunk-dj6y2sr8.js → chunk-sp1rargj.js} +3 -3
- package/dist/{chunk-7myptjaa.js → chunk-srqavw76.js} +5 -5
- package/dist/{chunk-84a79s9g.js → chunk-sswwr1v8.js} +95 -95
- package/dist/{chunk-np05dg07.js → chunk-t0qse0mt.js} +35 -35
- package/dist/{chunk-k11m1rfc.js → chunk-t2a7a4z1.js} +37 -37
- package/dist/{chunk-cewbt8ah.js → chunk-t2kp8sdc.js} +2 -2
- package/dist/{chunk-6sytfk68.js → chunk-t2v0ebmx.js} +3 -3
- package/dist/{chunk-5thf5z45.js → chunk-t55pghx5.js} +21 -15
- package/dist/{chunk-x9qqj8wc.js → chunk-t7n4j11w.js} +35 -35
- package/dist/{chunk-45ynv6r6.js → chunk-tbq02fft.js} +2 -2
- package/dist/{chunk-2dvsb5m8.js → chunk-tesmhjvk.js} +3 -3
- package/dist/{chunk-ttzyw0y7.js → chunk-tezzj9bb.js} +9 -9
- package/dist/{chunk-9qj9t1g4.js → chunk-tq15k5ay.js} +2 -2
- package/dist/{chunk-swtk97hy.js → chunk-tsm2gvad.js} +6 -6
- package/dist/{chunk-0q8601fc.js → chunk-txnhypg4.js} +36 -36
- package/dist/{chunk-zc2mfxy0.js → chunk-v5pdtb2b.js} +38 -38
- package/dist/{chunk-e6p5x2p4.js → chunk-v8h3am9m.js} +4 -4
- package/dist/{chunk-0ftbdtb6.js → chunk-v9c0rpa4.js} +5 -521
- package/dist/{chunk-wa7g3yv7.js → chunk-vepbgbhk.js} +5 -5
- package/dist/{chunk-y9bpc4a6.js → chunk-vh2bq1kq.js} +6 -6
- package/dist/{chunk-wz34c685.js → chunk-vjdg504j.js} +7 -7
- package/dist/{chunk-gt9gwwdh.js → chunk-vyry6wjr.js} +5 -5
- package/dist/{chunk-8dehkx39.js → chunk-w4e43b9x.js} +3 -3
- package/dist/{chunk-86n03xsk.js → chunk-w99mdc33.js} +36 -36
- package/dist/{chunk-3ax3g4ky.js → chunk-w9dg1k61.js} +5 -5
- package/dist/{chunk-ycdbp5q4.js → chunk-wh5tc9r0.js} +35 -35
- package/dist/{chunk-epprxdgg.js → chunk-whnv6e1q.js} +2 -2
- package/dist/{chunk-0z3swktk.js → chunk-wj4hsqr1.js} +38 -38
- package/dist/{chunk-envqyd27.js → chunk-wp0pya1g.js} +37 -37
- package/dist/{chunk-b21j3y4h.js → chunk-wvzcb6s1.js} +2 -2
- package/dist/{chunk-s5pnejsn.js → chunk-wx81sgv6.js} +2 -2
- package/dist/{chunk-cwpxrn2d.js → chunk-wxpmz8ng.js} +8 -8
- package/dist/{chunk-9ggwn844.js → chunk-wz2q3pmg.js} +34 -9
- package/dist/{chunk-4zvptd40.js → chunk-x1ge840e.js} +369 -48
- package/dist/{chunk-7ckqn3c3.js → chunk-x5r53g6r.js} +35 -35
- package/dist/{chunk-k5rrrd0q.js → chunk-x78tw87y.js} +41 -41
- package/dist/{chunk-5e4sk6wr.js → chunk-x7hqhzet.js} +2 -2
- package/dist/{chunk-gcpc6b2z.js → chunk-x8g49rpq.js} +2 -2
- package/dist/{chunk-fb5ehysd.js → chunk-xajtn6jn.js} +37 -37
- package/dist/{chunk-6zkxtny0.js → chunk-xamca8ds.js} +3 -3
- package/dist/{chunk-b7fcydvv.js → chunk-xcxzmq1e.js} +9 -9
- package/dist/{chunk-5hn85d4q.js → chunk-xjmanbrm.js} +37 -37
- package/dist/{chunk-da7f9a81.js → chunk-xkdszxwb.js} +21 -21
- package/dist/{chunk-m7qa1fqb.js → chunk-y01apqxs.js} +2 -2
- package/dist/{chunk-hgxb4qn5.js → chunk-y16r571d.js} +35 -35
- package/dist/{chunk-3tnabt1t.js → chunk-y3h553se.js} +2 -2
- package/dist/{chunk-rnjtkqzg.js → chunk-y754et1n.js} +2 -2
- package/dist/{chunk-j74ctwq9.js → chunk-yat2gecz.js} +2 -2
- package/dist/{chunk-hhcx2jjn.js → chunk-yh6gejzw.js} +3 -3
- package/dist/{chunk-m0zzdgkt.js → chunk-yhmwwakf.js} +14 -14
- package/dist/{chunk-t7y6mg54.js → chunk-yn41ejk4.js} +5 -5
- package/dist/{chunk-q110twdj.js → chunk-ypr3kzdn.js} +36 -36
- package/dist/{chunk-76g1m8sa.js → chunk-yrc25q6d.js} +2 -2
- package/dist/{chunk-nmzy0qjn.js → chunk-yvvzd26e.js} +5 -5
- package/dist/{chunk-vetj2j2n.js → chunk-yw9cb2g1.js} +40 -40
- package/dist/{chunk-9vvffdb6.js → chunk-yxpqycx5.js} +44 -44
- package/dist/{chunk-t12d6tby.js → chunk-yy7b3b4y.js} +3 -3
- package/dist/{chunk-wdn3pb9r.js → chunk-z08t19e5.js} +2 -2
- package/dist/{chunk-k1y8sta6.js → chunk-z7wmymhj.js} +4 -5
- package/dist/{chunk-w59jkye4.js → chunk-zcgknb7z.js} +36 -36
- package/dist/{chunk-jv7tn7yh.js → chunk-zk2geh0a.js} +35 -35
- package/dist/{chunk-et42fzf1.js → chunk-zk84db7h.js} +18 -18
- package/dist/{chunk-bgpftrxc.js → chunk-zkf9chex.js} +36 -36
- package/dist/{chunk-gz6pze8f.js → chunk-zkqykb4r.js} +38 -38
- package/dist/{chunk-x1wk407b.js → chunk-zqbw60sv.js} +2 -2
- package/dist/{chunk-svb5eqfz.js → chunk-zsdme624.js} +6 -6
- package/dist/{chunk-49z79885.js → chunk-zsecvy91.js} +3 -3
- package/dist/{chunk-egkwv0bp.js → chunk-ztetpy4q.js} +2 -2
- package/dist/cli.js +31 -31
- package/dist/services/rawDump/batchWorker.js +10 -8
- package/package.json +2 -1
- package/dist/chunk-20rdctr8.js +0 -413
- package/dist/chunk-3ydfy1vc.js +0 -1079
package/dist/chunk-3ydfy1vc.js
DELETED
|
@@ -1,1079 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import {
|
|
3
|
-
init_log,
|
|
4
|
-
logError
|
|
5
|
-
} from "./chunk-vtcqe66h.js";
|
|
6
|
-
import {
|
|
7
|
-
init_slowOperations,
|
|
8
|
-
jsonParse,
|
|
9
|
-
jsonStringify
|
|
10
|
-
} from "./chunk-dea6k409.js";
|
|
11
|
-
import {
|
|
12
|
-
__require
|
|
13
|
-
} from "./chunk-qp2qdcda.js";
|
|
14
|
-
|
|
15
|
-
// src/server/sessionHandle.ts
|
|
16
|
-
init_slowOperations();
|
|
17
|
-
init_log();
|
|
18
|
-
import { spawn } from "child_process";
|
|
19
|
-
import { createInterface } from "readline";
|
|
20
|
-
|
|
21
|
-
// src/server/childSpawn.ts
|
|
22
|
-
import { basename } from "path";
|
|
23
|
-
var INIT_TIMEOUT_MS = (() => {
|
|
24
|
-
const raw = Number(process.env.CSC_SERVE_INIT_TIMEOUT_MS);
|
|
25
|
-
return Number.isFinite(raw) && raw > 0 ? raw : 120000;
|
|
26
|
-
})();
|
|
27
|
-
function getScriptArgsForChild() {
|
|
28
|
-
const argv1 = process.argv[1];
|
|
29
|
-
if (!argv1)
|
|
30
|
-
return [];
|
|
31
|
-
const execBase = basename(process.execPath);
|
|
32
|
-
if (!/^(bun|node)/i.test(execBase))
|
|
33
|
-
return [];
|
|
34
|
-
if (argv1.startsWith("B:/~BUN/") || argv1.startsWith("/snapshot/"))
|
|
35
|
-
return [];
|
|
36
|
-
if (argv1 === process.execPath)
|
|
37
|
-
return [];
|
|
38
|
-
if (argv1.endsWith(".ts") || argv1.endsWith(".tsx") || argv1.includes("/") || argv1.includes("\\")) {
|
|
39
|
-
return [argv1];
|
|
40
|
-
}
|
|
41
|
-
return [];
|
|
42
|
-
}
|
|
43
|
-
function getChildSpawnArgs() {
|
|
44
|
-
const execPath = process.execPath;
|
|
45
|
-
const scriptArgs = getScriptArgsForChild();
|
|
46
|
-
return { execPath, scriptArgs };
|
|
47
|
-
}
|
|
48
|
-
async function saveChildSpawnPrefix() {
|
|
49
|
-
if (process.env._CSC_CHILD_SPAWN_PREFIX)
|
|
50
|
-
return;
|
|
51
|
-
const { execPath, scriptArgs } = getChildSpawnArgs();
|
|
52
|
-
let defineArgs = [];
|
|
53
|
-
let featureArgs = [];
|
|
54
|
-
const isRunningSourceFile = scriptArgs.length > 0 && (scriptArgs[0].endsWith(".tsx") || scriptArgs[0].endsWith(".ts"));
|
|
55
|
-
if (isRunningSourceFile) {
|
|
56
|
-
try {
|
|
57
|
-
const definesMod = await import("./chunk-rfxctace.js");
|
|
58
|
-
const defines = definesMod.getMacroDefines();
|
|
59
|
-
defineArgs = Object.entries(defines).flatMap(([k, v]) => ["-d", `${k}:${v}`]);
|
|
60
|
-
const features = definesMod.DEFAULT_BUILD_FEATURES;
|
|
61
|
-
featureArgs = features.flatMap((f) => ["--feature", f]);
|
|
62
|
-
} catch {}
|
|
63
|
-
const envFeatures = Object.entries(process.env).filter(([k]) => k.startsWith("FEATURE_") && k.slice(8)).map(([k]) => ["--feature", k.slice(8)]).flat();
|
|
64
|
-
featureArgs = [...featureArgs, ...envFeatures];
|
|
65
|
-
}
|
|
66
|
-
const prefix = JSON.stringify({ execPath, scriptArgs, defineArgs, featureArgs });
|
|
67
|
-
process.env._CSC_CHILD_SPAWN_PREFIX = prefix;
|
|
68
|
-
}
|
|
69
|
-
function loadChildSpawnPrefix() {
|
|
70
|
-
const raw = process.env._CSC_CHILD_SPAWN_PREFIX;
|
|
71
|
-
if (!raw)
|
|
72
|
-
return null;
|
|
73
|
-
try {
|
|
74
|
-
return JSON.parse(raw);
|
|
75
|
-
} catch {
|
|
76
|
-
return null;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
// src/server/sessionControlChannel.ts
|
|
81
|
-
class ControlChannel {
|
|
82
|
-
pending = new Map;
|
|
83
|
-
register(requestId, timeoutMs = 1e4) {
|
|
84
|
-
return new Promise((resolve, reject) => {
|
|
85
|
-
const timeout = setTimeout(() => {
|
|
86
|
-
this.pending.delete(requestId);
|
|
87
|
-
reject(new Error(`Control response timed out for ${requestId}`));
|
|
88
|
-
}, timeoutMs);
|
|
89
|
-
this.pending.set(requestId, { resolve, reject, timeout });
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
tryResolve(msg) {
|
|
93
|
-
if (msg.type !== "control_response")
|
|
94
|
-
return false;
|
|
95
|
-
const response = msg.response;
|
|
96
|
-
const requestId = response?.request_id;
|
|
97
|
-
if (!requestId || !this.pending.has(requestId))
|
|
98
|
-
return false;
|
|
99
|
-
const entry = this.pending.get(requestId);
|
|
100
|
-
this.pending.delete(requestId);
|
|
101
|
-
clearTimeout(entry.timeout);
|
|
102
|
-
if (response?.subtype === "error") {
|
|
103
|
-
entry.reject(new Error(response.error ?? "Unknown error"));
|
|
104
|
-
} else {
|
|
105
|
-
entry.resolve(response?.response ?? {});
|
|
106
|
-
}
|
|
107
|
-
return true;
|
|
108
|
-
}
|
|
109
|
-
rejectAll(error) {
|
|
110
|
-
for (const [, entry] of this.pending) {
|
|
111
|
-
clearTimeout(entry.timeout);
|
|
112
|
-
entry.reject(error);
|
|
113
|
-
}
|
|
114
|
-
this.pending.clear();
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
// src/server/sessionMessageRouter.ts
|
|
119
|
-
init_slowOperations();
|
|
120
|
-
function routeMessage(msg, ctx) {
|
|
121
|
-
if (ctx.getStatus() === "starting" && msg.type === "control_response") {
|
|
122
|
-
const response = msg.response;
|
|
123
|
-
if (response?.subtype === "success" && response?.request_id === ctx.getInitRequestId()) {
|
|
124
|
-
handleInitResponse(response, ctx);
|
|
125
|
-
return;
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
if (msg.type === "control_response") {
|
|
129
|
-
if (ctx.getControlChannel().tryResolve(msg))
|
|
130
|
-
return;
|
|
131
|
-
}
|
|
132
|
-
ctx.emitMessage(msg);
|
|
133
|
-
switch (msg.type) {
|
|
134
|
-
case "assistant": {
|
|
135
|
-
handleAssistantMessage(msg, ctx);
|
|
136
|
-
break;
|
|
137
|
-
}
|
|
138
|
-
case "user": {
|
|
139
|
-
handleUserMessage(msg, ctx);
|
|
140
|
-
break;
|
|
141
|
-
}
|
|
142
|
-
case "result": {
|
|
143
|
-
handleResultMessage(msg, ctx);
|
|
144
|
-
break;
|
|
145
|
-
}
|
|
146
|
-
case "control_request": {
|
|
147
|
-
handleControlRequest(msg, ctx);
|
|
148
|
-
break;
|
|
149
|
-
}
|
|
150
|
-
case "control_cancel_request": {
|
|
151
|
-
handleCancelRequest(msg, ctx);
|
|
152
|
-
break;
|
|
153
|
-
}
|
|
154
|
-
case "stream_event": {
|
|
155
|
-
ctx.setLastActiveAt(Date.now());
|
|
156
|
-
ctx.emitEvent("stream_event", msg);
|
|
157
|
-
break;
|
|
158
|
-
}
|
|
159
|
-
case "system": {
|
|
160
|
-
ctx.emitEvent("message", msg);
|
|
161
|
-
break;
|
|
162
|
-
}
|
|
163
|
-
default: {
|
|
164
|
-
break;
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
function handleInitResponse(response, ctx) {
|
|
169
|
-
const initData = response.response ?? {};
|
|
170
|
-
ctx.setInitData(initData);
|
|
171
|
-
if (Array.isArray(initData.models) && initData.models.length > 0 && !ctx.getModel()) {
|
|
172
|
-
const first = initData.models[0];
|
|
173
|
-
ctx.setModel(first?.value ?? first?.name);
|
|
174
|
-
}
|
|
175
|
-
if (initData.account?.apiProvider) {
|
|
176
|
-
ctx.setProviderId(initData.account.apiProvider);
|
|
177
|
-
}
|
|
178
|
-
ctx.setStatus("running");
|
|
179
|
-
ctx.setLastActiveAt(Date.now());
|
|
180
|
-
ctx.resolveInit(initData);
|
|
181
|
-
ctx.emitEvent("ready", {
|
|
182
|
-
status: "running",
|
|
183
|
-
model: ctx.getModel(),
|
|
184
|
-
provider_id: ctx.getProviderId()
|
|
185
|
-
});
|
|
186
|
-
}
|
|
187
|
-
function handleAssistantMessage(msg, ctx) {
|
|
188
|
-
ctx.setLastActiveAt(Date.now());
|
|
189
|
-
ctx.setStatus("running");
|
|
190
|
-
if (msg.uuid && typeof msg.uuid === "string") {
|
|
191
|
-
ctx.setLastMessageUuid(msg.uuid);
|
|
192
|
-
}
|
|
193
|
-
let enriched = msg;
|
|
194
|
-
if (!msg.model && ctx.getModel()) {
|
|
195
|
-
enriched = { ...enriched, model: ctx.getModel() };
|
|
196
|
-
}
|
|
197
|
-
if (!msg.provider_id && ctx.getProviderId()) {
|
|
198
|
-
enriched = { ...enriched, provider_id: ctx.getProviderId() };
|
|
199
|
-
}
|
|
200
|
-
ctx.emitEvent("message", enriched);
|
|
201
|
-
if (msg.uuid) {
|
|
202
|
-
ctx.pushBufferMessage({
|
|
203
|
-
uuid: msg.uuid,
|
|
204
|
-
type: "assistant",
|
|
205
|
-
role: "assistant",
|
|
206
|
-
content: msg.message ?? msg.content ?? "",
|
|
207
|
-
timestamp: msg.timestamp ? new Date(msg.timestamp).getTime() : Date.now(),
|
|
208
|
-
parent_uuid: msg.parentUuid ?? null
|
|
209
|
-
});
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
function handleUserMessage(msg, ctx) {
|
|
213
|
-
if (msg.isReplay)
|
|
214
|
-
return;
|
|
215
|
-
const content = typeof msg.content === "string" ? msg.content : "";
|
|
216
|
-
if (content.includes("<local-command-stdout>"))
|
|
217
|
-
return;
|
|
218
|
-
ctx.emitEvent("message", msg);
|
|
219
|
-
}
|
|
220
|
-
function handleResultMessage(msg, ctx) {
|
|
221
|
-
ctx.setLastActiveAt(Date.now());
|
|
222
|
-
ctx.setStatus("running");
|
|
223
|
-
const cost = msg.cost_usd;
|
|
224
|
-
const usage = msg.usage;
|
|
225
|
-
if (cost)
|
|
226
|
-
ctx.addCost(cost);
|
|
227
|
-
if (usage?.input_tokens)
|
|
228
|
-
ctx.addInputTokens(usage.input_tokens);
|
|
229
|
-
if (usage?.output_tokens)
|
|
230
|
-
ctx.addOutputTokens(usage.output_tokens);
|
|
231
|
-
ctx.setBusyStatus({ type: "idle" });
|
|
232
|
-
ctx.emitBusyStatus();
|
|
233
|
-
ctx.emitEvent("result", msg);
|
|
234
|
-
ctx.resolvePrompt({ done: true });
|
|
235
|
-
}
|
|
236
|
-
function handleControlRequest(msg, ctx) {
|
|
237
|
-
const request = msg.request;
|
|
238
|
-
const requestId = msg.request_id;
|
|
239
|
-
if (request?.subtype === "can_use_tool") {
|
|
240
|
-
const toolName = request.tool_name ?? "Unknown";
|
|
241
|
-
const perm = {
|
|
242
|
-
requestId,
|
|
243
|
-
sessionId: ctx.sessionId,
|
|
244
|
-
toolName,
|
|
245
|
-
toolUseId: request.tool_use_id ?? "",
|
|
246
|
-
input: request.input ?? {},
|
|
247
|
-
title: `${request.tool_name}: ${JSON.stringify(request.input).slice(0, 80)}`,
|
|
248
|
-
description: `Execute ${request.tool_name}`,
|
|
249
|
-
suggestions: request.permission_suggestions ?? []
|
|
250
|
-
};
|
|
251
|
-
ctx.getPendingPermissions().set(requestId, perm);
|
|
252
|
-
ctx.emitEvent("control_request", { request_id: requestId, request });
|
|
253
|
-
if (toolName === "AskUserQuestion") {
|
|
254
|
-
const input = request.input ?? {};
|
|
255
|
-
const questions = input.questions ?? [];
|
|
256
|
-
ctx.emitOpencodeEvent("question.asked", {
|
|
257
|
-
sessionID: ctx.sessionId,
|
|
258
|
-
id: requestId,
|
|
259
|
-
questions: questions.map((q) => ({
|
|
260
|
-
question: q.question,
|
|
261
|
-
header: q.header ?? "",
|
|
262
|
-
options: (q.options ?? []).map((o) => ({
|
|
263
|
-
label: o.label,
|
|
264
|
-
description: o.description
|
|
265
|
-
})),
|
|
266
|
-
multiple: q.multiSelect ?? false,
|
|
267
|
-
custom: false
|
|
268
|
-
})),
|
|
269
|
-
tool: {
|
|
270
|
-
messageID: "",
|
|
271
|
-
callID: perm.toolUseId
|
|
272
|
-
}
|
|
273
|
-
});
|
|
274
|
-
} else {
|
|
275
|
-
ctx.emitOpencodeEvent("permission.asked", {
|
|
276
|
-
sessionID: ctx.sessionId,
|
|
277
|
-
id: requestId,
|
|
278
|
-
permission: toPermissionKey(toolName),
|
|
279
|
-
patterns: extractPatterns(perm.input),
|
|
280
|
-
metadata: { input: perm.input },
|
|
281
|
-
always: [],
|
|
282
|
-
tool: {
|
|
283
|
-
messageID: "",
|
|
284
|
-
callID: perm.toolUseId
|
|
285
|
-
}
|
|
286
|
-
});
|
|
287
|
-
}
|
|
288
|
-
} else if (request?.subtype === "elicitation") {
|
|
289
|
-
const question = {
|
|
290
|
-
requestId,
|
|
291
|
-
sessionId: ctx.sessionId,
|
|
292
|
-
mcpServerName: request.mcp_server_name ?? "",
|
|
293
|
-
message: request.message ?? "",
|
|
294
|
-
mode: request.mode ?? "form",
|
|
295
|
-
requestedSchema: request.requested_schema ?? {}
|
|
296
|
-
};
|
|
297
|
-
ctx.getPendingQuestions().set(requestId, question);
|
|
298
|
-
ctx.emitEvent("control_request", { request_id: requestId, request });
|
|
299
|
-
ctx.emitOpencodeEvent("question.asked", {
|
|
300
|
-
sessionID: ctx.sessionId,
|
|
301
|
-
id: requestId,
|
|
302
|
-
questions: [{
|
|
303
|
-
question: question.message,
|
|
304
|
-
header: question.mcpServerName || "MCP",
|
|
305
|
-
options: [],
|
|
306
|
-
multiple: false,
|
|
307
|
-
custom: true
|
|
308
|
-
}]
|
|
309
|
-
});
|
|
310
|
-
} else if (request?.subtype === "hook_callback") {
|
|
311
|
-
ctx.emitEvent("control_request", { request_id: requestId, request });
|
|
312
|
-
const callbackId = request.callback_id;
|
|
313
|
-
if (!callbackId || callbackId === "AUTO_APPROVE_CALLBACK_ID") {
|
|
314
|
-
ctx.writeStdin(jsonStringify({
|
|
315
|
-
type: "control_response",
|
|
316
|
-
response: {
|
|
317
|
-
subtype: "success",
|
|
318
|
-
request_id: requestId,
|
|
319
|
-
response: {
|
|
320
|
-
hookSpecificOutput: {
|
|
321
|
-
hookEventName: "PreToolUse",
|
|
322
|
-
permissionDecision: "allow",
|
|
323
|
-
permissionDecisionReason: "Auto-approved by serve"
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
}));
|
|
328
|
-
} else {
|
|
329
|
-
ctx.writeStdin(jsonStringify({
|
|
330
|
-
type: "control_response",
|
|
331
|
-
response: {
|
|
332
|
-
subtype: "success",
|
|
333
|
-
request_id: requestId,
|
|
334
|
-
response: {
|
|
335
|
-
hookSpecificOutput: {
|
|
336
|
-
hookEventName: "PreToolUse",
|
|
337
|
-
permissionDecision: "ask",
|
|
338
|
-
permissionDecisionReason: "Forwarding to can_use_tool"
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
|
-
}));
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
function handleCancelRequest(msg, ctx) {
|
|
347
|
-
const cancelRequestId = msg.request_id;
|
|
348
|
-
const wasPerm = ctx.getPendingPermissions().has(cancelRequestId);
|
|
349
|
-
const wasQuestion = ctx.getPendingQuestions().has(cancelRequestId);
|
|
350
|
-
ctx.getPendingPermissions().delete(cancelRequestId);
|
|
351
|
-
ctx.getPendingQuestions().delete(cancelRequestId);
|
|
352
|
-
if (wasQuestion) {
|
|
353
|
-
ctx.emitOpencodeEvent("question.rejected", {
|
|
354
|
-
sessionID: ctx.sessionId,
|
|
355
|
-
requestID: cancelRequestId
|
|
356
|
-
});
|
|
357
|
-
}
|
|
358
|
-
if (wasPerm) {
|
|
359
|
-
ctx.emitOpencodeEvent("permission.replied", {
|
|
360
|
-
sessionID: ctx.sessionId,
|
|
361
|
-
requestID: cancelRequestId
|
|
362
|
-
});
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
|
-
function toPermissionKey(toolName) {
|
|
366
|
-
const map = {
|
|
367
|
-
Read: "read",
|
|
368
|
-
Edit: "edit",
|
|
369
|
-
Write: "edit",
|
|
370
|
-
Glob: "glob",
|
|
371
|
-
Grep: "grep",
|
|
372
|
-
LS: "list",
|
|
373
|
-
Bash: "bash",
|
|
374
|
-
PowerShell: "bash",
|
|
375
|
-
Agent: "task",
|
|
376
|
-
WebFetch: "webfetch",
|
|
377
|
-
WebSearch: "websearch",
|
|
378
|
-
TodoRead: "todoread",
|
|
379
|
-
TodoWrite: "todowrite"
|
|
380
|
-
};
|
|
381
|
-
return map[toolName] ?? toolName.toLowerCase();
|
|
382
|
-
}
|
|
383
|
-
function extractPatterns(input) {
|
|
384
|
-
const patterns = [];
|
|
385
|
-
for (const key of ["file_path", "path", "pattern", "glob"]) {
|
|
386
|
-
const v = typeof input[key] === "string" ? input[key] : "";
|
|
387
|
-
if (v)
|
|
388
|
-
patterns.push(v);
|
|
389
|
-
}
|
|
390
|
-
const cmd = typeof input.command === "string" ? input.command : "";
|
|
391
|
-
if (cmd)
|
|
392
|
-
patterns.push(cmd);
|
|
393
|
-
return patterns;
|
|
394
|
-
}
|
|
395
|
-
// src/server/sessionHandle.ts
|
|
396
|
-
class SessionHandle {
|
|
397
|
-
opts;
|
|
398
|
-
sessionId;
|
|
399
|
-
cwd;
|
|
400
|
-
_spawnCwd;
|
|
401
|
-
child = null;
|
|
402
|
-
_status = "starting";
|
|
403
|
-
_busyStatus = { type: "idle" };
|
|
404
|
-
_model;
|
|
405
|
-
_agent;
|
|
406
|
-
_providerId;
|
|
407
|
-
_permissionMode;
|
|
408
|
-
_title;
|
|
409
|
-
_costUsd = 0;
|
|
410
|
-
_inputTokens = 0;
|
|
411
|
-
_outputTokens = 0;
|
|
412
|
-
createdAt = Date.now();
|
|
413
|
-
lastActiveAt = Date.now();
|
|
414
|
-
eventBus;
|
|
415
|
-
pendingPermissions = new Map;
|
|
416
|
-
pendingQuestions = new Map;
|
|
417
|
-
promptResolve = null;
|
|
418
|
-
promptReject = null;
|
|
419
|
-
verbose;
|
|
420
|
-
lastStderr = [];
|
|
421
|
-
listeners = new Set;
|
|
422
|
-
_initData = null;
|
|
423
|
-
initRequestId = null;
|
|
424
|
-
initResolve = null;
|
|
425
|
-
initReject = null;
|
|
426
|
-
_prompting = false;
|
|
427
|
-
_lastMessageUuid = null;
|
|
428
|
-
_controlChannel = new ControlChannel;
|
|
429
|
-
_titleGenerationAttempted = false;
|
|
430
|
-
_firstPromptContent;
|
|
431
|
-
_messageBuffer = [];
|
|
432
|
-
get status() {
|
|
433
|
-
return this._status;
|
|
434
|
-
}
|
|
435
|
-
get busyStatus() {
|
|
436
|
-
return this._busyStatus;
|
|
437
|
-
}
|
|
438
|
-
get model() {
|
|
439
|
-
return this._model;
|
|
440
|
-
}
|
|
441
|
-
get agent() {
|
|
442
|
-
return this._agent;
|
|
443
|
-
}
|
|
444
|
-
get permissionMode() {
|
|
445
|
-
return this._permissionMode;
|
|
446
|
-
}
|
|
447
|
-
get title() {
|
|
448
|
-
return this._title;
|
|
449
|
-
}
|
|
450
|
-
get costUsd() {
|
|
451
|
-
return this._costUsd;
|
|
452
|
-
}
|
|
453
|
-
get inputTokens() {
|
|
454
|
-
return this._inputTokens;
|
|
455
|
-
}
|
|
456
|
-
get messageCount() {
|
|
457
|
-
return 0;
|
|
458
|
-
}
|
|
459
|
-
get usage() {
|
|
460
|
-
return {
|
|
461
|
-
input_tokens: this._inputTokens,
|
|
462
|
-
output_tokens: this._outputTokens
|
|
463
|
-
};
|
|
464
|
-
}
|
|
465
|
-
get initData() {
|
|
466
|
-
return this._initData;
|
|
467
|
-
}
|
|
468
|
-
get prompting() {
|
|
469
|
-
return this._prompting;
|
|
470
|
-
}
|
|
471
|
-
get messageBuffer() {
|
|
472
|
-
return this._messageBuffer;
|
|
473
|
-
}
|
|
474
|
-
pushMessage(msg) {
|
|
475
|
-
if (this._messageBuffer.length > 0) {
|
|
476
|
-
const last = this._messageBuffer[this._messageBuffer.length - 1];
|
|
477
|
-
if (last.uuid === msg.uuid)
|
|
478
|
-
return;
|
|
479
|
-
}
|
|
480
|
-
this._messageBuffer.push(msg);
|
|
481
|
-
}
|
|
482
|
-
get lastMessageUuid() {
|
|
483
|
-
return this._lastMessageUuid;
|
|
484
|
-
}
|
|
485
|
-
getEffectiveBusyStatus() {
|
|
486
|
-
if (this._prompting) {
|
|
487
|
-
return { type: "busy" };
|
|
488
|
-
}
|
|
489
|
-
if (this._status === "stopped") {
|
|
490
|
-
return { type: "idle" };
|
|
491
|
-
}
|
|
492
|
-
return this._busyStatus;
|
|
493
|
-
}
|
|
494
|
-
get ready() {
|
|
495
|
-
return this._status === "running";
|
|
496
|
-
}
|
|
497
|
-
get silent() {
|
|
498
|
-
return this.opts.silent ?? false;
|
|
499
|
-
}
|
|
500
|
-
get spawnCwd() {
|
|
501
|
-
return this._spawnCwd ?? this.cwd;
|
|
502
|
-
}
|
|
503
|
-
async waitReady(timeoutMs = INIT_TIMEOUT_MS) {
|
|
504
|
-
if (this._status === "running")
|
|
505
|
-
return;
|
|
506
|
-
if (this._status === "stopped") {
|
|
507
|
-
throw new Error(`Session ${this.sessionId} is stopped`);
|
|
508
|
-
}
|
|
509
|
-
return new Promise((resolve, reject) => {
|
|
510
|
-
const timer = setTimeout(() => {
|
|
511
|
-
reject(new Error(`Session ${this.sessionId} init timed out`));
|
|
512
|
-
}, timeoutMs);
|
|
513
|
-
const origResolve = this.initResolve;
|
|
514
|
-
const origReject = this.initReject;
|
|
515
|
-
this.initResolve = (data) => {
|
|
516
|
-
clearTimeout(timer);
|
|
517
|
-
origResolve?.(data);
|
|
518
|
-
resolve();
|
|
519
|
-
};
|
|
520
|
-
this.initReject = (err) => {
|
|
521
|
-
clearTimeout(timer);
|
|
522
|
-
origReject?.(err);
|
|
523
|
-
reject(err);
|
|
524
|
-
};
|
|
525
|
-
});
|
|
526
|
-
}
|
|
527
|
-
constructor(opts) {
|
|
528
|
-
this.opts = opts;
|
|
529
|
-
this.sessionId = opts.sessionId;
|
|
530
|
-
this.cwd = opts.cwd;
|
|
531
|
-
this.eventBus = opts.eventBus;
|
|
532
|
-
this._model = opts.model;
|
|
533
|
-
this._agent = opts.agent;
|
|
534
|
-
this._permissionMode = opts.permissionMode ?? "default";
|
|
535
|
-
this.verbose = opts.verbose ?? false;
|
|
536
|
-
}
|
|
537
|
-
onMessage(listener) {
|
|
538
|
-
this.listeners.add(listener);
|
|
539
|
-
return () => {
|
|
540
|
-
this.listeners.delete(listener);
|
|
541
|
-
};
|
|
542
|
-
}
|
|
543
|
-
spawn() {
|
|
544
|
-
const printArgs = [
|
|
545
|
-
"--print",
|
|
546
|
-
"--input-format",
|
|
547
|
-
"stream-json",
|
|
548
|
-
"--output-format",
|
|
549
|
-
"stream-json",
|
|
550
|
-
...this.opts.resumeSessionId ? [] : ["--session-id", this.sessionId],
|
|
551
|
-
...this.opts.model ? ["--model", this.opts.model] : [],
|
|
552
|
-
...this._agent ? ["--agent", this._agent] : [],
|
|
553
|
-
"--permission-mode",
|
|
554
|
-
this._permissionMode,
|
|
555
|
-
"--permission-prompt-tool",
|
|
556
|
-
"stdio",
|
|
557
|
-
...this.opts.resumeSessionId ? ["--resume", this.opts.resumeSessionId] : [],
|
|
558
|
-
...this.opts.resumeSessionAt ? ["--resume-session-at", this.opts.resumeSessionAt] : [],
|
|
559
|
-
"--verbose"
|
|
560
|
-
];
|
|
561
|
-
const env = {
|
|
562
|
-
...process.env,
|
|
563
|
-
CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC: "1",
|
|
564
|
-
CSC_SERVE_MODE: "1"
|
|
565
|
-
};
|
|
566
|
-
if (this.opts.systemPrompt) {
|
|
567
|
-
env.CLAUDE_CODE_SYSTEM_PROMPT = this.opts.systemPrompt;
|
|
568
|
-
}
|
|
569
|
-
const saved = loadChildSpawnPrefix();
|
|
570
|
-
const defineArgs = saved?.defineArgs ?? [];
|
|
571
|
-
const featureArgs = saved?.featureArgs ?? [];
|
|
572
|
-
const spawnArgs = [
|
|
573
|
-
...defineArgs,
|
|
574
|
-
...featureArgs,
|
|
575
|
-
...this.opts.scriptArgs,
|
|
576
|
-
...printArgs.filter((x) => x != null)
|
|
577
|
-
];
|
|
578
|
-
this._spawnCwd = this.opts.cwd;
|
|
579
|
-
this.child = spawn(this.opts.execPath, spawnArgs, {
|
|
580
|
-
cwd: this.opts.cwd,
|
|
581
|
-
stdio: ["pipe", "pipe", "pipe"],
|
|
582
|
-
env,
|
|
583
|
-
windowsHide: true
|
|
584
|
-
});
|
|
585
|
-
this.setupStdout();
|
|
586
|
-
this.setupStderr();
|
|
587
|
-
this.child.on("close", (code, signal) => {
|
|
588
|
-
if (this._status !== "stopped") {
|
|
589
|
-
this._status = "stopped";
|
|
590
|
-
this._busyStatus = { type: "idle" };
|
|
591
|
-
this.emitBusyStatus();
|
|
592
|
-
this.emitEvent("deleted", {
|
|
593
|
-
status: "stopped",
|
|
594
|
-
exit_code: code,
|
|
595
|
-
signal: signal ?? null
|
|
596
|
-
});
|
|
597
|
-
}
|
|
598
|
-
if (this.initReject) {
|
|
599
|
-
const reject = this.initReject;
|
|
600
|
-
this.initResolve = null;
|
|
601
|
-
this.initReject = null;
|
|
602
|
-
process.stderr.write(`[serve:${this.sessionId}] exit_code=${code} cwd=${this.cwd} stderr:
|
|
603
|
-
${this.lastStderr.slice(-5).join(`
|
|
604
|
-
`)}
|
|
605
|
-
`);
|
|
606
|
-
reject(new Error(`Process exited with code ${code}`));
|
|
607
|
-
}
|
|
608
|
-
if (this.promptReject) {
|
|
609
|
-
this.promptReject(new Error(`Process exited with code ${code}`));
|
|
610
|
-
}
|
|
611
|
-
});
|
|
612
|
-
this.child.on("error", (err) => {
|
|
613
|
-
logError(err);
|
|
614
|
-
this._status = "stopped";
|
|
615
|
-
this._busyStatus = { type: "idle" };
|
|
616
|
-
this.emitBusyStatus();
|
|
617
|
-
if (this.initReject) {
|
|
618
|
-
const reject = this.initReject;
|
|
619
|
-
this.initResolve = null;
|
|
620
|
-
this.initReject = null;
|
|
621
|
-
reject(err);
|
|
622
|
-
}
|
|
623
|
-
if (this.promptReject) {
|
|
624
|
-
this.promptReject(err);
|
|
625
|
-
}
|
|
626
|
-
});
|
|
627
|
-
this.initRequestId = crypto.randomUUID();
|
|
628
|
-
this.sendInitialize();
|
|
629
|
-
const timeout = setTimeout(() => {
|
|
630
|
-
if (this.initReject) {
|
|
631
|
-
const reject = this.initReject;
|
|
632
|
-
this.initResolve = null;
|
|
633
|
-
this.initReject = null;
|
|
634
|
-
this._status = "stopped";
|
|
635
|
-
this.emitEvent("deleted", {
|
|
636
|
-
status: "stopped",
|
|
637
|
-
reason: "init_timeout"
|
|
638
|
-
});
|
|
639
|
-
reject(new Error(`Session ${this.sessionId} init timed out`));
|
|
640
|
-
}
|
|
641
|
-
}, INIT_TIMEOUT_MS);
|
|
642
|
-
this.initResolve = (data) => {
|
|
643
|
-
clearTimeout(timeout);
|
|
644
|
-
this.initReject = null;
|
|
645
|
-
};
|
|
646
|
-
this.initReject = (_err) => {
|
|
647
|
-
clearTimeout(timeout);
|
|
648
|
-
this.initResolve = null;
|
|
649
|
-
};
|
|
650
|
-
}
|
|
651
|
-
async start() {
|
|
652
|
-
if (!this.child) {
|
|
653
|
-
this.spawn();
|
|
654
|
-
}
|
|
655
|
-
if (this._status === "running")
|
|
656
|
-
return;
|
|
657
|
-
return new Promise((resolve, reject) => {
|
|
658
|
-
const origResolve = this.initResolve;
|
|
659
|
-
const origReject = this.initReject;
|
|
660
|
-
this.initResolve = (data) => {
|
|
661
|
-
origResolve?.(data);
|
|
662
|
-
resolve();
|
|
663
|
-
};
|
|
664
|
-
this.initReject = (err) => {
|
|
665
|
-
origReject?.(err);
|
|
666
|
-
reject(err);
|
|
667
|
-
};
|
|
668
|
-
});
|
|
669
|
-
}
|
|
670
|
-
sendInitialize() {
|
|
671
|
-
const request = {
|
|
672
|
-
subtype: "initialize"
|
|
673
|
-
};
|
|
674
|
-
if (this.opts.hooks) {
|
|
675
|
-
request.hooks = this.opts.hooks;
|
|
676
|
-
}
|
|
677
|
-
const msg = jsonStringify({
|
|
678
|
-
type: "control_request",
|
|
679
|
-
request_id: this.initRequestId,
|
|
680
|
-
request
|
|
681
|
-
});
|
|
682
|
-
this.writeStdin(msg);
|
|
683
|
-
}
|
|
684
|
-
setupStdout() {
|
|
685
|
-
if (!this.child?.stdout)
|
|
686
|
-
return;
|
|
687
|
-
const rl = createInterface({ input: this.child.stdout });
|
|
688
|
-
rl.on("line", (line) => {
|
|
689
|
-
if (!line.trim())
|
|
690
|
-
return;
|
|
691
|
-
let msg;
|
|
692
|
-
try {
|
|
693
|
-
msg = jsonParse(line);
|
|
694
|
-
} catch {
|
|
695
|
-
return;
|
|
696
|
-
}
|
|
697
|
-
routeMessage(msg, this.createRouterCtx());
|
|
698
|
-
});
|
|
699
|
-
}
|
|
700
|
-
setupStderr() {
|
|
701
|
-
if (!this.child?.stderr)
|
|
702
|
-
return;
|
|
703
|
-
const rl = createInterface({ input: this.child.stderr });
|
|
704
|
-
rl.on("line", (line) => {
|
|
705
|
-
if (this.verbose) {
|
|
706
|
-
process.stderr.write(`[serve:${this.sessionId}] ${line}
|
|
707
|
-
`);
|
|
708
|
-
}
|
|
709
|
-
if (this.lastStderr.length >= 20) {
|
|
710
|
-
this.lastStderr.shift();
|
|
711
|
-
}
|
|
712
|
-
this.lastStderr.push(line);
|
|
713
|
-
});
|
|
714
|
-
}
|
|
715
|
-
emitEvent(event, data) {
|
|
716
|
-
if (this.opts.silent)
|
|
717
|
-
return;
|
|
718
|
-
this.eventBus.publishSessionEvent(this.sessionId, event, data);
|
|
719
|
-
}
|
|
720
|
-
emitOpencodeEvent(event, properties) {
|
|
721
|
-
if (this.opts.silent)
|
|
722
|
-
return;
|
|
723
|
-
if (properties.type === event && "properties" in properties) {
|
|
724
|
-
this.eventBus.publish(event, properties);
|
|
725
|
-
return;
|
|
726
|
-
}
|
|
727
|
-
this.eventBus.publish(event, {
|
|
728
|
-
session_id: properties.sessionID,
|
|
729
|
-
...properties
|
|
730
|
-
});
|
|
731
|
-
}
|
|
732
|
-
emitBusyStatus() {
|
|
733
|
-
if (this.opts.silent)
|
|
734
|
-
return;
|
|
735
|
-
this.eventBus.publish("session.status", {
|
|
736
|
-
sessionID: this.sessionId,
|
|
737
|
-
status: this._busyStatus
|
|
738
|
-
});
|
|
739
|
-
}
|
|
740
|
-
emitMessage(msg) {
|
|
741
|
-
for (const listener of this.listeners) {
|
|
742
|
-
try {
|
|
743
|
-
listener(msg);
|
|
744
|
-
} catch {}
|
|
745
|
-
}
|
|
746
|
-
}
|
|
747
|
-
writeStdin(data) {
|
|
748
|
-
if (this.child?.stdin && !this.child.stdin.destroyed) {
|
|
749
|
-
const flushed = this.child.stdin.write(data + `
|
|
750
|
-
`);
|
|
751
|
-
if (!flushed) {
|
|
752
|
-
this.child.stdin.once("drain", () => {});
|
|
753
|
-
}
|
|
754
|
-
}
|
|
755
|
-
}
|
|
756
|
-
createRouterCtx() {
|
|
757
|
-
return {
|
|
758
|
-
sessionId: this.sessionId,
|
|
759
|
-
silent: this.opts.silent ?? false,
|
|
760
|
-
getStatus: () => this._status,
|
|
761
|
-
getBusyStatus: () => this._busyStatus,
|
|
762
|
-
getModel: () => this._model,
|
|
763
|
-
getProviderId: () => this._providerId,
|
|
764
|
-
getInitRequestId: () => this.initRequestId,
|
|
765
|
-
getLastMessageUuid: () => this._lastMessageUuid,
|
|
766
|
-
setStatus: (s) => {
|
|
767
|
-
this._status = s;
|
|
768
|
-
},
|
|
769
|
-
setBusyStatus: (s) => {
|
|
770
|
-
this._busyStatus = s;
|
|
771
|
-
},
|
|
772
|
-
setModel: (m) => {
|
|
773
|
-
this._model = m;
|
|
774
|
-
},
|
|
775
|
-
setProviderId: (id) => {
|
|
776
|
-
this._providerId = id;
|
|
777
|
-
},
|
|
778
|
-
setInitData: (d) => {
|
|
779
|
-
this._initData = d;
|
|
780
|
-
},
|
|
781
|
-
setLastMessageUuid: (u) => {
|
|
782
|
-
this._lastMessageUuid = u;
|
|
783
|
-
},
|
|
784
|
-
setLastActiveAt: (t) => {
|
|
785
|
-
this.lastActiveAt = t;
|
|
786
|
-
},
|
|
787
|
-
addCost: (c) => {
|
|
788
|
-
this._costUsd += c;
|
|
789
|
-
},
|
|
790
|
-
addInputTokens: (t) => {
|
|
791
|
-
this._inputTokens += t;
|
|
792
|
-
},
|
|
793
|
-
addOutputTokens: (t) => {
|
|
794
|
-
this._outputTokens += t;
|
|
795
|
-
},
|
|
796
|
-
getControlChannel: () => this._controlChannel,
|
|
797
|
-
getPendingPermissions: () => this.pendingPermissions,
|
|
798
|
-
getPendingQuestions: () => this.pendingQuestions,
|
|
799
|
-
resolveInit: (data) => {
|
|
800
|
-
const resolve = this.initResolve;
|
|
801
|
-
this.initResolve = null;
|
|
802
|
-
this.initReject = null;
|
|
803
|
-
resolve?.(data);
|
|
804
|
-
this.opts.onInit?.(data);
|
|
805
|
-
},
|
|
806
|
-
resolvePrompt: (value) => {
|
|
807
|
-
this._busyStatus = { type: "idle" };
|
|
808
|
-
this.emitBusyStatus();
|
|
809
|
-
if (this.promptResolve) {
|
|
810
|
-
this.promptResolve(value);
|
|
811
|
-
this.promptResolve = null;
|
|
812
|
-
this.promptReject = null;
|
|
813
|
-
}
|
|
814
|
-
if (this._firstPromptContent && !this._titleGenerationAttempted) {
|
|
815
|
-
this._titleGenerationAttempted = true;
|
|
816
|
-
const content = this._firstPromptContent;
|
|
817
|
-
this.sendControlRequest({
|
|
818
|
-
subtype: "generate_session_title",
|
|
819
|
-
description: content,
|
|
820
|
-
persist: true
|
|
821
|
-
}, 30000).then((res) => {
|
|
822
|
-
const title = res.title || content.slice(0, 100);
|
|
823
|
-
this.setTitle(title);
|
|
824
|
-
}).catch(() => {
|
|
825
|
-
this.setTitle(content.slice(0, 100));
|
|
826
|
-
});
|
|
827
|
-
}
|
|
828
|
-
},
|
|
829
|
-
emitEvent: (event, data) => this.emitEvent(event, data),
|
|
830
|
-
emitOpencodeEvent: (event, props) => this.emitOpencodeEvent(event, props),
|
|
831
|
-
emitBusyStatus: () => this.emitBusyStatus(),
|
|
832
|
-
emitMessage: (msg) => this.emitMessage(msg),
|
|
833
|
-
writeStdin: (data) => this.writeStdin(data),
|
|
834
|
-
pushBufferMessage: (msg) => this.pushMessage(msg)
|
|
835
|
-
};
|
|
836
|
-
}
|
|
837
|
-
setTitle(title) {
|
|
838
|
-
this._title = title;
|
|
839
|
-
this.emitEvent("ready", this.getInfo());
|
|
840
|
-
}
|
|
841
|
-
async sendControlRequest(request, timeoutMs = 1e4) {
|
|
842
|
-
const requestId = crypto.randomUUID();
|
|
843
|
-
this.writeStdin(jsonStringify({
|
|
844
|
-
type: "control_request",
|
|
845
|
-
request_id: requestId,
|
|
846
|
-
request
|
|
847
|
-
}));
|
|
848
|
-
return this._controlChannel.register(requestId, timeoutMs);
|
|
849
|
-
}
|
|
850
|
-
async setModel(model) {
|
|
851
|
-
this._model = model;
|
|
852
|
-
await this.sendControlRequest({ subtype: "set_model", model });
|
|
853
|
-
}
|
|
854
|
-
async setAgent(agent) {
|
|
855
|
-
this._agent = agent;
|
|
856
|
-
await this.sendControlRequest({ subtype: "set_agent", agent });
|
|
857
|
-
}
|
|
858
|
-
async setPermissionMode(mode) {
|
|
859
|
-
this._permissionMode = mode;
|
|
860
|
-
await this.sendControlRequest({ subtype: "set_permission_mode", mode });
|
|
861
|
-
}
|
|
862
|
-
async getMcpStatus() {
|
|
863
|
-
const response = await this.sendControlRequest({ subtype: "mcp_status" });
|
|
864
|
-
return response.mcpServers ?? [];
|
|
865
|
-
}
|
|
866
|
-
async prompt(content, opts) {
|
|
867
|
-
if (this._status === "stopped") {
|
|
868
|
-
throw new Error(`Session ${this.sessionId} is stopped`);
|
|
869
|
-
}
|
|
870
|
-
if (this._prompting) {
|
|
871
|
-
throw new Error(`Session ${this.sessionId} is already processing a prompt`);
|
|
872
|
-
}
|
|
873
|
-
this._prompting = true;
|
|
874
|
-
const alreadyBusy = this._busyStatus?.type === "busy";
|
|
875
|
-
if (!alreadyBusy) {
|
|
876
|
-
this._busyStatus = { type: "busy" };
|
|
877
|
-
this.emitBusyStatus();
|
|
878
|
-
}
|
|
879
|
-
this.lastActiveAt = Date.now();
|
|
880
|
-
const uuid = opts?.messageID ?? crypto.randomUUID();
|
|
881
|
-
const userMsg = jsonStringify({
|
|
882
|
-
type: "user",
|
|
883
|
-
content,
|
|
884
|
-
uuid,
|
|
885
|
-
session_id: this.sessionId,
|
|
886
|
-
message: { role: "user", content },
|
|
887
|
-
parent_tool_use_id: null
|
|
888
|
-
});
|
|
889
|
-
this.emitEvent("message", {
|
|
890
|
-
type: "user",
|
|
891
|
-
content,
|
|
892
|
-
uuid,
|
|
893
|
-
session_id: this.sessionId,
|
|
894
|
-
model: this._model ?? "",
|
|
895
|
-
provider_id: this._providerId ?? ""
|
|
896
|
-
});
|
|
897
|
-
this.pushMessage({
|
|
898
|
-
uuid,
|
|
899
|
-
type: "user",
|
|
900
|
-
role: "user",
|
|
901
|
-
content,
|
|
902
|
-
timestamp: Date.now(),
|
|
903
|
-
parent_uuid: null
|
|
904
|
-
});
|
|
905
|
-
this.writeStdin(userMsg);
|
|
906
|
-
if (!this._title && !this._titleGenerationAttempted) {
|
|
907
|
-
this._firstPromptContent = content;
|
|
908
|
-
}
|
|
909
|
-
return new Promise((resolve, reject) => {
|
|
910
|
-
this.promptResolve = (value) => {
|
|
911
|
-
this._prompting = false;
|
|
912
|
-
resolve(value);
|
|
913
|
-
};
|
|
914
|
-
this.promptReject = (reason) => {
|
|
915
|
-
this._prompting = false;
|
|
916
|
-
reject(reason);
|
|
917
|
-
};
|
|
918
|
-
});
|
|
919
|
-
}
|
|
920
|
-
async abort() {
|
|
921
|
-
if (!this.child || this.child.killed)
|
|
922
|
-
return;
|
|
923
|
-
const interrupt = jsonStringify({
|
|
924
|
-
type: "control_request",
|
|
925
|
-
request_id: crypto.randomUUID(),
|
|
926
|
-
request: { subtype: "interrupt" }
|
|
927
|
-
});
|
|
928
|
-
this.writeStdin(interrupt);
|
|
929
|
-
this._busyStatus = { type: "idle" };
|
|
930
|
-
this.emitBusyStatus();
|
|
931
|
-
if (!this.promptResolve)
|
|
932
|
-
return;
|
|
933
|
-
await new Promise((resolve) => {
|
|
934
|
-
const timeout = setTimeout(() => {
|
|
935
|
-
this.kill();
|
|
936
|
-
resolve();
|
|
937
|
-
}, 2000);
|
|
938
|
-
const originalResolve = this.promptResolve;
|
|
939
|
-
this.promptResolve = (value) => {
|
|
940
|
-
clearTimeout(timeout);
|
|
941
|
-
originalResolve?.(value);
|
|
942
|
-
resolve();
|
|
943
|
-
};
|
|
944
|
-
});
|
|
945
|
-
}
|
|
946
|
-
replyPermission(requestId, behavior, opts) {
|
|
947
|
-
const response = {
|
|
948
|
-
type: "control_response",
|
|
949
|
-
response: {
|
|
950
|
-
subtype: "success",
|
|
951
|
-
request_id: requestId,
|
|
952
|
-
response: behavior === "allow" ? {
|
|
953
|
-
behavior: "allow",
|
|
954
|
-
updatedInput: opts?.updatedInput ?? {},
|
|
955
|
-
...opts?.updatedPermissions ? { updatedPermissions: opts.updatedPermissions } : {},
|
|
956
|
-
...opts?.decisionClassification ? { decisionClassification: opts.decisionClassification } : {}
|
|
957
|
-
} : {
|
|
958
|
-
behavior: "deny",
|
|
959
|
-
message: opts?.message ?? "Denied",
|
|
960
|
-
...opts?.interrupt ? { interrupt: true } : {}
|
|
961
|
-
}
|
|
962
|
-
}
|
|
963
|
-
};
|
|
964
|
-
this.writeStdin(jsonStringify(response));
|
|
965
|
-
const perm = this.getPendingPermission(requestId);
|
|
966
|
-
const toolName = perm?.toolName;
|
|
967
|
-
this.pendingPermissions.delete(requestId);
|
|
968
|
-
this.emitEvent("permission_replied", {
|
|
969
|
-
request_id: requestId,
|
|
970
|
-
behavior
|
|
971
|
-
});
|
|
972
|
-
if (toolName === "AskUserQuestion") {
|
|
973
|
-
const eventType = behavior === "allow" ? "question.replied" : "question.rejected";
|
|
974
|
-
this.emitOpencodeEvent(eventType, {
|
|
975
|
-
sessionID: this.sessionId,
|
|
976
|
-
requestID: requestId
|
|
977
|
-
});
|
|
978
|
-
} else {
|
|
979
|
-
this.emitOpencodeEvent("permission.replied", {
|
|
980
|
-
sessionID: this.sessionId,
|
|
981
|
-
requestID: requestId
|
|
982
|
-
});
|
|
983
|
-
}
|
|
984
|
-
}
|
|
985
|
-
replyQuestion(requestId, action, content) {
|
|
986
|
-
const response = {
|
|
987
|
-
type: "control_response",
|
|
988
|
-
response: {
|
|
989
|
-
subtype: "success",
|
|
990
|
-
request_id: requestId,
|
|
991
|
-
response: action === "accept" ? { action: "accept", content } : { action: "decline" }
|
|
992
|
-
}
|
|
993
|
-
};
|
|
994
|
-
this.writeStdin(jsonStringify(response));
|
|
995
|
-
this.pendingQuestions.delete(requestId);
|
|
996
|
-
this.emitEvent("question_replied", {
|
|
997
|
-
request_id: requestId,
|
|
998
|
-
action
|
|
999
|
-
});
|
|
1000
|
-
const eventType = action === "accept" ? "question.replied" : "question.rejected";
|
|
1001
|
-
this.emitOpencodeEvent(eventType, {
|
|
1002
|
-
sessionID: this.sessionId,
|
|
1003
|
-
requestID: requestId
|
|
1004
|
-
});
|
|
1005
|
-
}
|
|
1006
|
-
kill() {
|
|
1007
|
-
if (this.child && !this.child.killed) {
|
|
1008
|
-
if (process.platform === "win32") {
|
|
1009
|
-
this.child.kill();
|
|
1010
|
-
} else {
|
|
1011
|
-
this.child.kill("SIGTERM");
|
|
1012
|
-
}
|
|
1013
|
-
}
|
|
1014
|
-
this._status = "stopped";
|
|
1015
|
-
this._controlChannel.rejectAll(new Error("Session killed"));
|
|
1016
|
-
}
|
|
1017
|
-
forceKill() {
|
|
1018
|
-
if (this.child && !this.child.killed) {
|
|
1019
|
-
if (process.platform === "win32") {
|
|
1020
|
-
this.child.kill();
|
|
1021
|
-
} else {
|
|
1022
|
-
this.child.kill("SIGKILL");
|
|
1023
|
-
}
|
|
1024
|
-
}
|
|
1025
|
-
this._status = "stopped";
|
|
1026
|
-
this._controlChannel.rejectAll(new Error("Session force killed"));
|
|
1027
|
-
}
|
|
1028
|
-
[Symbol.dispose]() {
|
|
1029
|
-
this.forceKill();
|
|
1030
|
-
}
|
|
1031
|
-
getPendingPermissions() {
|
|
1032
|
-
return [...this.pendingPermissions.values()];
|
|
1033
|
-
}
|
|
1034
|
-
getPendingPermission(requestId) {
|
|
1035
|
-
return this.pendingPermissions.get(requestId);
|
|
1036
|
-
}
|
|
1037
|
-
getPendingQuestions() {
|
|
1038
|
-
return [...this.pendingQuestions.values()];
|
|
1039
|
-
}
|
|
1040
|
-
getPendingQuestion(requestId) {
|
|
1041
|
-
return this.pendingQuestions.get(requestId);
|
|
1042
|
-
}
|
|
1043
|
-
handleMessage(msg) {
|
|
1044
|
-
routeMessage(msg, this.createRouterCtx());
|
|
1045
|
-
}
|
|
1046
|
-
getLastStderr() {
|
|
1047
|
-
return [...this.lastStderr];
|
|
1048
|
-
}
|
|
1049
|
-
getInfo() {
|
|
1050
|
-
return {
|
|
1051
|
-
id: this.sessionId,
|
|
1052
|
-
session_id: this.sessionId,
|
|
1053
|
-
slug: this.sessionId,
|
|
1054
|
-
projectID: "",
|
|
1055
|
-
directory: this.cwd,
|
|
1056
|
-
cwd: this.cwd,
|
|
1057
|
-
title: this._title,
|
|
1058
|
-
version: "",
|
|
1059
|
-
time: {
|
|
1060
|
-
created: this.createdAt,
|
|
1061
|
-
updated: this.lastActiveAt
|
|
1062
|
-
},
|
|
1063
|
-
status: this._status,
|
|
1064
|
-
model: this._model,
|
|
1065
|
-
permission_mode: this._permissionMode,
|
|
1066
|
-
created_at: this.createdAt,
|
|
1067
|
-
last_active_at: this.lastActiveAt,
|
|
1068
|
-
cost_usd: this._costUsd,
|
|
1069
|
-
input_tokens: this._inputTokens,
|
|
1070
|
-
output_tokens: this._outputTokens,
|
|
1071
|
-
last_message_uuid: this._lastMessageUuid
|
|
1072
|
-
};
|
|
1073
|
-
}
|
|
1074
|
-
}
|
|
1075
|
-
|
|
1076
|
-
export { getScriptArgsForChild, getChildSpawnArgs, saveChildSpawnPrefix, SessionHandle };
|
|
1077
|
-
|
|
1078
|
-
//# debugId=24D614804A0627DC64756E2164756E21
|
|
1079
|
-
//# sourceMappingURL=chunk-3ydfy1vc.js.map
|