@redscope-ai/redscope 1.0.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 +224 -0
- package/dist/chunk-090920rk.js +288 -0
- package/dist/chunk-0afb2r78.js +141 -0
- package/dist/chunk-0d4ekx1g.js +73 -0
- package/dist/chunk-0g6nwbhq.js +15 -0
- package/dist/chunk-0qj905nt.js +18 -0
- package/dist/chunk-0s5btnn1.js +186 -0
- package/dist/chunk-0s8fars0.js +91 -0
- package/dist/chunk-10ev3dvh.js +312 -0
- package/dist/chunk-10k5jfc5.js +1295 -0
- package/dist/chunk-12tspwqa.js +240 -0
- package/dist/chunk-13qesvnw.js +17 -0
- package/dist/chunk-143eh1e0.js +121 -0
- package/dist/chunk-14p6wvsq.js +39 -0
- package/dist/chunk-19f3zb1m.js +342 -0
- package/dist/chunk-1a5cep8h.js +145 -0
- package/dist/chunk-1abw9kkn.js +34 -0
- package/dist/chunk-1aer7c78.js +118 -0
- package/dist/chunk-1dazz4g6.js +154 -0
- package/dist/chunk-1fcf4ty1.js +142 -0
- package/dist/chunk-1gnxhyf8.js +62 -0
- package/dist/chunk-1he3944e.js +8124 -0
- package/dist/chunk-1jpayz7y.js +952 -0
- package/dist/chunk-1qd6f6vk.js +269 -0
- package/dist/chunk-1v0kpe62.js +2547 -0
- package/dist/chunk-1w20m7gw.js +445 -0
- package/dist/chunk-1y7kp51j.js +72 -0
- package/dist/chunk-1ycb5sxt.js +247 -0
- package/dist/chunk-1zbwhcbt.js +1124 -0
- package/dist/chunk-20psem54.js +116 -0
- package/dist/chunk-23h69r5b.js +30 -0
- package/dist/chunk-23x86ptv.js +473 -0
- package/dist/chunk-24fyv3jz.js +378 -0
- package/dist/chunk-24kv69g3.js +97 -0
- package/dist/chunk-2azx8zsc.js +125 -0
- package/dist/chunk-2d1gwzz9.js +524 -0
- package/dist/chunk-2g0ytd9d.js +29058 -0
- package/dist/chunk-2hfp9kat.js +21 -0
- package/dist/chunk-2j875eq6.js +37 -0
- package/dist/chunk-2kcgxnvp.js +39 -0
- package/dist/chunk-2kz09j2s.js +23 -0
- package/dist/chunk-2mwnwp0n.js +17 -0
- package/dist/chunk-2p1cqhcn.js +921 -0
- package/dist/chunk-2p369q9z.js +61 -0
- package/dist/chunk-2rf6asgf.js +151 -0
- package/dist/chunk-2vr7mqx1.js +384 -0
- package/dist/chunk-2xcg933e.js +205 -0
- package/dist/chunk-2ypwckbz.js +40310 -0
- package/dist/chunk-30wnahyg.js +626 -0
- package/dist/chunk-326zehp8.js +204 -0
- package/dist/chunk-32s6jzgw.js +183 -0
- package/dist/chunk-35yzt1a7.js +202 -0
- package/dist/chunk-38frkej6.js +62 -0
- package/dist/chunk-3abaq08g.js +34 -0
- package/dist/chunk-3h59ttr5.js +32 -0
- package/dist/chunk-3nk9q8dr.js +154 -0
- package/dist/chunk-3prrxevm.js +224 -0
- package/dist/chunk-3tv8p9xw.js +127 -0
- package/dist/chunk-3txyekes.js +19 -0
- package/dist/chunk-3vfxjn7g.js +19 -0
- package/dist/chunk-3w9sye8h.js +81 -0
- package/dist/chunk-3y69j7y8.js +24 -0
- package/dist/chunk-3zwjpkjh.js +1603 -0
- package/dist/chunk-40t1d75v.js +3442 -0
- package/dist/chunk-470kmby4.js +318 -0
- package/dist/chunk-47jc141z.js +335 -0
- package/dist/chunk-48rz50ct.js +868 -0
- package/dist/chunk-49wv03ts.js +232 -0
- package/dist/chunk-4a189mn2.js +103 -0
- package/dist/chunk-4c4fmh7a.js +15 -0
- package/dist/chunk-4ct8dsj5.js +49 -0
- package/dist/chunk-4kqt1pm1.js +100 -0
- package/dist/chunk-4ng0xy0e.js +802 -0
- package/dist/chunk-4spgkgr3.js +43 -0
- package/dist/chunk-4tjdwtyy.js +19 -0
- package/dist/chunk-4tr60273.js +370 -0
- package/dist/chunk-4vnaeng5.js +29 -0
- package/dist/chunk-4wbqpeaw.js +871 -0
- package/dist/chunk-4wgkv3fv.js +1140 -0
- package/dist/chunk-4yjskjb6.js +40 -0
- package/dist/chunk-50m3a23z.js +35 -0
- package/dist/chunk-511f79az.js +182 -0
- package/dist/chunk-51sgztvv.js +161 -0
- package/dist/chunk-563fcpv1.js +290 -0
- package/dist/chunk-564cnq6v.js +735 -0
- package/dist/chunk-569r8cxc.js +31 -0
- package/dist/chunk-570x55d4.js +12 -0
- package/dist/chunk-571556cm.js +80 -0
- package/dist/chunk-59t4c56e.js +63 -0
- package/dist/chunk-5axjhkma.js +36 -0
- package/dist/chunk-5b188q5e.js +157 -0
- package/dist/chunk-5dmn1865.js +439 -0
- package/dist/chunk-5ks4829r.js +267 -0
- package/dist/chunk-5mmhfbxb.js +1078 -0
- package/dist/chunk-5rdt14hy.js +742 -0
- package/dist/chunk-5ssryexj.js +121 -0
- package/dist/chunk-5v95pnq4.js +15 -0
- package/dist/chunk-5xvjt2t9.js +68 -0
- package/dist/chunk-5zyq6t1q.js +118 -0
- package/dist/chunk-60fkafk2.js +15 -0
- package/dist/chunk-62fjkf5q.js +46 -0
- package/dist/chunk-64gazrrb.js +8067 -0
- package/dist/chunk-65tq2yjx.js +126 -0
- package/dist/chunk-65zbgg1n.js +14 -0
- package/dist/chunk-66v8mty3.js +264 -0
- package/dist/chunk-6acx5heq.js +292 -0
- package/dist/chunk-6hr7742d.js +61 -0
- package/dist/chunk-6hygvrhn.js +143 -0
- package/dist/chunk-6kjh280m.js +128 -0
- package/dist/chunk-6s0q1s5r.js +66 -0
- package/dist/chunk-6x35ffpx.js +690 -0
- package/dist/chunk-71jfy1hh.js +570 -0
- package/dist/chunk-71sdcaq6.js +15 -0
- package/dist/chunk-754qdxs5.js +92 -0
- package/dist/chunk-79v5bkj4.js +1176 -0
- package/dist/chunk-7br0w7j5.js +151 -0
- package/dist/chunk-7cjgrzz1.js +298 -0
- package/dist/chunk-7d41ks0y.js +133 -0
- package/dist/chunk-7f40pmtr.js +71 -0
- package/dist/chunk-7g15x8hm.js +131 -0
- package/dist/chunk-7gtnzdet.js +120 -0
- package/dist/chunk-7h0z4aqx.js +702 -0
- package/dist/chunk-7h7e5a7d.js +25 -0
- package/dist/chunk-7m2cznwr.js +40 -0
- package/dist/chunk-7nvday0n.js +252 -0
- package/dist/chunk-7qey87th.js +145 -0
- package/dist/chunk-7qx3xhv3.js +9076 -0
- package/dist/chunk-7tfdhkpy.js +61 -0
- package/dist/chunk-80m511j6.js +121 -0
- package/dist/chunk-80ysxfe9.js +784 -0
- package/dist/chunk-8375zk8t.js +17200 -0
- package/dist/chunk-85bpkyy9.js +412 -0
- package/dist/chunk-85tcn547.js +876 -0
- package/dist/chunk-85vqgbc8.js +13 -0
- package/dist/chunk-86626jb4.js +49 -0
- package/dist/chunk-87ms17f6.js +444 -0
- package/dist/chunk-87mz239c.js +118 -0
- package/dist/chunk-89vdzt4e.js +254 -0
- package/dist/chunk-89z3e99z.js +159 -0
- package/dist/chunk-8cwrz1dd.js +1806 -0
- package/dist/chunk-8gv2pjby.js +21 -0
- package/dist/chunk-8hdevr3s.js +140 -0
- package/dist/chunk-8hdsk6qc.js +710 -0
- package/dist/chunk-8kct9arg.js +724 -0
- package/dist/chunk-8kf8h7xf.js +23 -0
- package/dist/chunk-8qed8ymj.js +605 -0
- package/dist/chunk-8sdgr592.js +101 -0
- package/dist/chunk-8we9w8pw.js +111 -0
- package/dist/chunk-8xnm5637.js +72 -0
- package/dist/chunk-8y3q0eqy.js +67 -0
- package/dist/chunk-8yvsnrkr.js +3449 -0
- package/dist/chunk-8zz4z1q3.js +42 -0
- package/dist/chunk-90eyff3k.js +119 -0
- package/dist/chunk-92bjkrf2.js +121 -0
- package/dist/chunk-92zrc7c6.js +327 -0
- package/dist/chunk-935nrvdb.js +13 -0
- package/dist/chunk-94pfyv6a.js +48 -0
- package/dist/chunk-9568p8se.js +115 -0
- package/dist/chunk-96km1ywr.js +37 -0
- package/dist/chunk-980bg4w4.js +163 -0
- package/dist/chunk-9a9g5hbj.js +205 -0
- package/dist/chunk-9cm4725d.js +4395 -0
- package/dist/chunk-9ds3vzq8.js +847 -0
- package/dist/chunk-9ffc9n60.js +618 -0
- package/dist/chunk-9fstrwv2.js +184 -0
- package/dist/chunk-9gt0g0qe.js +153 -0
- package/dist/chunk-9h9k5vz3.js +2761 -0
- package/dist/chunk-9he8bmhy.js +17 -0
- package/dist/chunk-9hn8e6h1.js +12 -0
- package/dist/chunk-9j0n3g8e.js +179 -0
- package/dist/chunk-9j6pa3ft.js +251 -0
- package/dist/chunk-9jpg9dn7.js +122 -0
- package/dist/chunk-9mycnwj5.js +46 -0
- package/dist/chunk-9npy2c17.js +517 -0
- package/dist/chunk-9p6sec8n.js +34 -0
- package/dist/chunk-9pnym83h.js +4584 -0
- package/dist/chunk-9skwrnd2.js +25 -0
- package/dist/chunk-9tsfaqr8.js +459 -0
- package/dist/chunk-9tsw3cqv.js +5924 -0
- package/dist/chunk-9w6ckyk4.js +49 -0
- package/dist/chunk-a15bwzv6.js +147 -0
- package/dist/chunk-a9t6cp69.js +28 -0
- package/dist/chunk-ad2yk19p.js +102 -0
- package/dist/chunk-ad4cw4nw.js +336 -0
- package/dist/chunk-ad69fbsk.js +347 -0
- package/dist/chunk-ae76ded0.js +30 -0
- package/dist/chunk-aeysytks.js +216 -0
- package/dist/chunk-ag81m9bq.js +61 -0
- package/dist/chunk-ahx7gp6r.js +4448 -0
- package/dist/chunk-aj4tk4tk.js +23 -0
- package/dist/chunk-an82t9jc.js +104 -0
- package/dist/chunk-apg95qd7.js +1393 -0
- package/dist/chunk-aq5n2adz.js +27 -0
- package/dist/chunk-aw4s3a99.js +208 -0
- package/dist/chunk-awgdfggg.js +14 -0
- package/dist/chunk-ayymxgn1.js +164 -0
- package/dist/chunk-azbab59e.js +637 -0
- package/dist/chunk-azdxq2a3.js +293 -0
- package/dist/chunk-b0tjx3k1.js +523 -0
- package/dist/chunk-b5pp4g2g.js +371 -0
- package/dist/chunk-b5zm8dt6.js +26 -0
- package/dist/chunk-bcnye5a0.js +109 -0
- package/dist/chunk-beqz3k49.js +190 -0
- package/dist/chunk-bf906wpw.js +147 -0
- package/dist/chunk-bgan4cpf.js +13 -0
- package/dist/chunk-bhzp13h7.js +1178 -0
- package/dist/chunk-bk403kpw.js +142 -0
- package/dist/chunk-bmq4c135.js +489 -0
- package/dist/chunk-bprbeda7.js +35 -0
- package/dist/chunk-bst7czdd.js +888 -0
- package/dist/chunk-bths4xgn.js +111 -0
- package/dist/chunk-btjn3qby.js +13 -0
- package/dist/chunk-bwb1vxnt.js +120 -0
- package/dist/chunk-bxa6tw4m.js +643 -0
- package/dist/chunk-bxfjr8qb.js +27 -0
- package/dist/chunk-bxpzhrej.js +73 -0
- package/dist/chunk-bzyzrq0k.js +51 -0
- package/dist/chunk-c0k7b0jw.js +4265 -0
- package/dist/chunk-c17f0h2s.js +16 -0
- package/dist/chunk-c1yc761e.js +6748 -0
- package/dist/chunk-c5g9shkw.js +298 -0
- package/dist/chunk-c696122m.js +69 -0
- package/dist/chunk-c92b3yxx.js +109 -0
- package/dist/chunk-c9aqz56y.js +143 -0
- package/dist/chunk-cba7c5w3.js +345 -0
- package/dist/chunk-cbcxbbe6.js +6543 -0
- package/dist/chunk-cdfjb87h.js +11 -0
- package/dist/chunk-ce8zjt1y.js +136 -0
- package/dist/chunk-cep7e37k.js +22740 -0
- package/dist/chunk-chs5qm8d.js +258 -0
- package/dist/chunk-ckydq33g.js +144 -0
- package/dist/chunk-cnge6wpj.js +514 -0
- package/dist/chunk-cpnsvqf1.js +13 -0
- package/dist/chunk-cqqebkv4.js +32 -0
- package/dist/chunk-cvqpp7dk.js +627 -0
- package/dist/chunk-cwc33j40.js +65 -0
- package/dist/chunk-cypvrq2a.js +155 -0
- package/dist/chunk-d1ha0swn.js +475 -0
- package/dist/chunk-d2an0138.js +35 -0
- package/dist/chunk-d2tt72ck.js +343 -0
- package/dist/chunk-d6wvcqrw.js +9507 -0
- package/dist/chunk-d7ys2kka.js +991 -0
- package/dist/chunk-dbts5q5p.js +122 -0
- package/dist/chunk-dct29ggs.js +295 -0
- package/dist/chunk-de0qnnf7.js +1059 -0
- package/dist/chunk-dep72ce4.js +513 -0
- package/dist/chunk-dgpvgy8x.js +47 -0
- package/dist/chunk-dhhd7dtc.js +20 -0
- package/dist/chunk-dhzpmxv6.js +594 -0
- package/dist/chunk-djes4da7.js +413 -0
- package/dist/chunk-dnhv3vx7.js +166 -0
- package/dist/chunk-dqtvafan.js +2365 -0
- package/dist/chunk-dr4a3tcp.js +60 -0
- package/dist/chunk-dz2xk9kb.js +100 -0
- package/dist/chunk-dz7nc6rf.js +15 -0
- package/dist/chunk-e3abfxpy.js +1486 -0
- package/dist/chunk-e3cq9z89.js +85 -0
- package/dist/chunk-e3j7m7k2.js +642 -0
- package/dist/chunk-e4dsy4g1.js +9951 -0
- package/dist/chunk-e5592pnn.js +197 -0
- package/dist/chunk-e55hdegh.js +129 -0
- package/dist/chunk-e5r5r04e.js +1030 -0
- package/dist/chunk-e60zztbt.js +442 -0
- package/dist/chunk-e7qq6vn0.js +372 -0
- package/dist/chunk-e9aat7xw.js +80 -0
- package/dist/chunk-e9d5v3zs.js +143 -0
- package/dist/chunk-eax32zk4.js +87 -0
- package/dist/chunk-ebfwmbx1.js +117 -0
- package/dist/chunk-ec71pb8t.js +971 -0
- package/dist/chunk-eemjb825.js +17252 -0
- package/dist/chunk-ees8xdhd.js +256 -0
- package/dist/chunk-eewg66y1.js +112 -0
- package/dist/chunk-eg22v12d.js +266 -0
- package/dist/chunk-enzzk67f.js +313 -0
- package/dist/chunk-eskhp70f.js +117 -0
- package/dist/chunk-ewx6z4g8.js +55 -0
- package/dist/chunk-eyvx461k.js +76 -0
- package/dist/chunk-eztq2b5f.js +94 -0
- package/dist/chunk-f0ffwzdd.js +321 -0
- package/dist/chunk-f80n68mf.js +119 -0
- package/dist/chunk-fae2hjxp.js +99 -0
- package/dist/chunk-fbtfp370.js +60 -0
- package/dist/chunk-fc6ndtgf.js +94 -0
- package/dist/chunk-fdwabr8p.js +13870 -0
- package/dist/chunk-fejeqe61.js +785 -0
- package/dist/chunk-fh0d6mvk.js +168 -0
- package/dist/chunk-fh19zcaf.js +304 -0
- package/dist/chunk-fh8bd39r.js +186 -0
- package/dist/chunk-fj2ebbpn.js +33 -0
- package/dist/chunk-fjn632v7.js +194 -0
- package/dist/chunk-fncpkzs5.js +1389 -0
- package/dist/chunk-fpd1gpt8.js +332 -0
- package/dist/chunk-fq9snrnh.js +295 -0
- package/dist/chunk-fqcfzg3j.js +207 -0
- package/dist/chunk-ftt3vqj2.js +1919 -0
- package/dist/chunk-g06pm4n9.js +395 -0
- package/dist/chunk-g4m5pf4g.js +8 -0
- package/dist/chunk-g72h52y6.js +36 -0
- package/dist/chunk-g79ej71s.js +1627 -0
- package/dist/chunk-g7fwk59d.js +19 -0
- package/dist/chunk-g9jnkrtm.js +663 -0
- package/dist/chunk-g9vg5d7t.js +38 -0
- package/dist/chunk-ga1jkyqy.js +1636 -0
- package/dist/chunk-gaaap2nk.js +676 -0
- package/dist/chunk-gc6erq5q.js +483 -0
- package/dist/chunk-gjrcmf0a.js +752 -0
- package/dist/chunk-gmdy2w3z.js +238999 -0
- package/dist/chunk-gsz4yrrk.js +81 -0
- package/dist/chunk-gy47rjy8.js +3830 -0
- package/dist/chunk-h12a4f4x.js +11 -0
- package/dist/chunk-h1yratmg.js +725 -0
- package/dist/chunk-h9y0jnsy.js +155 -0
- package/dist/chunk-hbhs3mwy.js +133 -0
- package/dist/chunk-hbs8cmb4.js +8 -0
- package/dist/chunk-hdk0t1ht.js +940 -0
- package/dist/chunk-hef8dx4s.js +178 -0
- package/dist/chunk-hgsca8mt.js +381 -0
- package/dist/chunk-hhsxm2yr.js +67 -0
- package/dist/chunk-hj5tzzpd.js +39 -0
- package/dist/chunk-hjxqmtg5.js +94 -0
- package/dist/chunk-hn4w9pkj.js +68 -0
- package/dist/chunk-hnprkjgp.js +25 -0
- package/dist/chunk-hq3n5ex7.js +183 -0
- package/dist/chunk-hqjspfma.js +158 -0
- package/dist/chunk-hqxp6b72.js +1198 -0
- package/dist/chunk-hs6nrmq6.js +94 -0
- package/dist/chunk-hwba5xdc.js +267 -0
- package/dist/chunk-hy566ev3.js +430 -0
- package/dist/chunk-hzmzwte2.js +153 -0
- package/dist/chunk-hzxzvzw8.js +274 -0
- package/dist/chunk-j139fzgs.js +114 -0
- package/dist/chunk-j1mep9ck.js +62 -0
- package/dist/chunk-j3xveeg4.js +273 -0
- package/dist/chunk-j5y1s11j.js +100 -0
- package/dist/chunk-j9475b46.js +26 -0
- package/dist/chunk-j9rgqs8m.js +1192 -0
- package/dist/chunk-jccjaddz.js +74 -0
- package/dist/chunk-jdkwfy9e.js +35 -0
- package/dist/chunk-jdqp0r4h.js +6157 -0
- package/dist/chunk-jdzk4zwn.js +587 -0
- package/dist/chunk-jfafmkte.js +49 -0
- package/dist/chunk-jg3r989b.js +16 -0
- package/dist/chunk-jhtccjc9.js +54 -0
- package/dist/chunk-jj2ff1pr.js +688 -0
- package/dist/chunk-jmv7k0jn.js +37 -0
- package/dist/chunk-jmxzmwpw.js +65 -0
- package/dist/chunk-jnjxdqyr.js +353 -0
- package/dist/chunk-jsbbez9j.js +138 -0
- package/dist/chunk-jvpt2dc0.js +424 -0
- package/dist/chunk-jwd7cka0.js +34 -0
- package/dist/chunk-jy5er3st.js +15 -0
- package/dist/chunk-jyby79z5.js +121 -0
- package/dist/chunk-jzyr6j5n.js +332 -0
- package/dist/chunk-k49xc781.js +63 -0
- package/dist/chunk-k7dt2g4a.js +41 -0
- package/dist/chunk-k7hexw3v.js +969 -0
- package/dist/chunk-k7wwkraa.js +117 -0
- package/dist/chunk-kb3758f7.js +51 -0
- package/dist/chunk-kc67kt75.js +3119 -0
- package/dist/chunk-kdhmfxmh.js +3149 -0
- package/dist/chunk-kejdd6zc.js +51 -0
- package/dist/chunk-kekrjeem.js +402 -0
- package/dist/chunk-kez5r0zz.js +280 -0
- package/dist/chunk-kfsvcs5t.js +75 -0
- package/dist/chunk-khtvffc4.js +285 -0
- package/dist/chunk-kkz4w1tv.js +64 -0
- package/dist/chunk-kmywng0j.js +272 -0
- package/dist/chunk-kq6vcpdr.js +224 -0
- package/dist/chunk-kqzdszcc.js +37 -0
- package/dist/chunk-ktxpp02w.js +435 -0
- package/dist/chunk-kwcvhbtz.js +26 -0
- package/dist/chunk-kx0cm9qr.js +128 -0
- package/dist/chunk-kxcmqz10.js +120 -0
- package/dist/chunk-kxwava1g.js +14 -0
- package/dist/chunk-kywtr3jg.js +825 -0
- package/dist/chunk-kzwg923p.js +8 -0
- package/dist/chunk-m1eq3sgv.js +255 -0
- package/dist/chunk-m21h5zb4.js +119 -0
- package/dist/chunk-m2c3bjv1.js +111 -0
- package/dist/chunk-m41e19ms.js +42 -0
- package/dist/chunk-m7ka36ex.js +97 -0
- package/dist/chunk-m81w8tbm.js +259 -0
- package/dist/chunk-m95ggkax.js +281 -0
- package/dist/chunk-manx26xa.js +145 -0
- package/dist/chunk-mdxh3pk2.js +298 -0
- package/dist/chunk-mhbfkcja.js +311 -0
- package/dist/chunk-mjnr5erm.js +173 -0
- package/dist/chunk-mngvnmwp.js +135 -0
- package/dist/chunk-mvfqanv5.js +63 -0
- package/dist/chunk-mw1nesq1.js +140 -0
- package/dist/chunk-mx168925.js +661 -0
- package/dist/chunk-mxwvj18g.js +795 -0
- package/dist/chunk-my7r5mba.js +257 -0
- package/dist/chunk-myaa1kkf.js +17 -0
- package/dist/chunk-myypc3tn.js +46 -0
- package/dist/chunk-mzcnmnpq.js +3379 -0
- package/dist/chunk-mznav6d1.js +194 -0
- package/dist/chunk-n0qxskpr.js +24 -0
- package/dist/chunk-n6a6hgtp.js +394 -0
- package/dist/chunk-n6d5fgx0.js +254 -0
- package/dist/chunk-n6ym3n03.js +120 -0
- package/dist/chunk-n9g24mwe.js +104 -0
- package/dist/chunk-naamqdf9.js +185 -0
- package/dist/chunk-nb2jk7zj.js +15 -0
- package/dist/chunk-nbkbq9en.js +67 -0
- package/dist/chunk-ndttd6es.js +38 -0
- package/dist/chunk-nfygaaxg.js +133 -0
- package/dist/chunk-ngdzpszd.js +454 -0
- package/dist/chunk-nmfwksa4.js +1297 -0
- package/dist/chunk-nt837qt9.js +21 -0
- package/dist/chunk-nwc3v0vp.js +691 -0
- package/dist/chunk-nz8ha95p.js +3610 -0
- package/dist/chunk-nzxfj0gq.js +2007 -0
- package/dist/chunk-p0r8887g.js +6932 -0
- package/dist/chunk-p1seyqdm.js +120 -0
- package/dist/chunk-p425zbgw.js +726 -0
- package/dist/chunk-p7hamd2c.js +146 -0
- package/dist/chunk-pdvg91cg.js +32 -0
- package/dist/chunk-pecy49yr.js +14649 -0
- package/dist/chunk-pfxrg89f.js +547 -0
- package/dist/chunk-pfyw3155.js +2750 -0
- package/dist/chunk-pr8m11pm.js +1192 -0
- package/dist/chunk-ptxteaeh.js +1591 -0
- package/dist/chunk-pv164mac.js +394 -0
- package/dist/chunk-pxxhtxf5.js +10154 -0
- package/dist/chunk-q0e485mg.js +61 -0
- package/dist/chunk-q1vrhh0q.js +458 -0
- package/dist/chunk-q2h79ncs.js +370 -0
- package/dist/chunk-q3b4n194.js +56 -0
- package/dist/chunk-q44zc68f.js +4301 -0
- package/dist/chunk-q8gknbdx.js +352 -0
- package/dist/chunk-q8xk3kdj.js +11 -0
- package/dist/chunk-qak46xtp.js +119 -0
- package/dist/chunk-qfq7absv.js +95 -0
- package/dist/chunk-qfsn720k.js +151 -0
- package/dist/chunk-qg4811f6.js +228 -0
- package/dist/chunk-qgzn3qps.js +90 -0
- package/dist/chunk-qhaggqkt.js +113 -0
- package/dist/chunk-qjjp27z8.js +195 -0
- package/dist/chunk-qxp0nye6.js +34 -0
- package/dist/chunk-qy3nagaq.js +4957 -0
- package/dist/chunk-qz2meav1.js +1452 -0
- package/dist/chunk-r50hne7m.js +63 -0
- package/dist/chunk-r6m0vgnv.js +80 -0
- package/dist/chunk-r7yw38vf.js +22864 -0
- package/dist/chunk-r8xc618w.js +42 -0
- package/dist/chunk-r961r5kj.js +87 -0
- package/dist/chunk-r9b5xrh0.js +66 -0
- package/dist/chunk-rcn2pd6q.js +477 -0
- package/dist/chunk-rdeh8p3y.js +148 -0
- package/dist/chunk-rg9x1742.js +542 -0
- package/dist/chunk-rgyzsbs3.js +39 -0
- package/dist/chunk-rk2fsxtz.js +16 -0
- package/dist/chunk-rkchkwv9.js +40 -0
- package/dist/chunk-rp8whpb3.js +478 -0
- package/dist/chunk-rpkxdtgr.js +68 -0
- package/dist/chunk-rpmntgyh.js +394 -0
- package/dist/chunk-rpshz4dy.js +614 -0
- package/dist/chunk-rqd60ay5.js +133 -0
- package/dist/chunk-rrsjf2ea.js +229 -0
- package/dist/chunk-rtjk8c8e.js +173 -0
- package/dist/chunk-rw0y2wdf.js +1017 -0
- package/dist/chunk-rx5w7ess.js +663 -0
- package/dist/chunk-rx8t9d35.js +1947 -0
- package/dist/chunk-rxcazxgf.js +195 -0
- package/dist/chunk-rxg6q3bp.js +1413 -0
- package/dist/chunk-rxrb7xnd.js +71 -0
- package/dist/chunk-rxrzxff3.js +118 -0
- package/dist/chunk-ryqjc943.js +71 -0
- package/dist/chunk-rzk9k2rf.js +81 -0
- package/dist/chunk-s2qv0nht.js +119 -0
- package/dist/chunk-s3hafnk3.js +2285 -0
- package/dist/chunk-s4a496tt.js +226 -0
- package/dist/chunk-s4d1h3ka.js +35 -0
- package/dist/chunk-sm3k3ze4.js +16525 -0
- package/dist/chunk-sn0bja82.js +385 -0
- package/dist/chunk-sngjggw1.js +4227 -0
- package/dist/chunk-sq047n34.js +364 -0
- package/dist/chunk-sttwe2tw.js +8584 -0
- package/dist/chunk-sw8qx1r0.js +86 -0
- package/dist/chunk-swstah6a.js +240 -0
- package/dist/chunk-syrkr0mf.js +63 -0
- package/dist/chunk-sz206bd9.js +26 -0
- package/dist/chunk-t09669cj.js +333 -0
- package/dist/chunk-t5f8e30k.js +602 -0
- package/dist/chunk-t5m78mc8.js +432 -0
- package/dist/chunk-t5x1dqwn.js +143 -0
- package/dist/chunk-t877ea0w.js +168 -0
- package/dist/chunk-t91hb71c.js +17 -0
- package/dist/chunk-tb636bcf.js +942 -0
- package/dist/chunk-tb8sykbr.js +426 -0
- package/dist/chunk-tbdkekz3.js +125 -0
- package/dist/chunk-td2gsz7s.js +225 -0
- package/dist/chunk-tenvxbyh.js +20 -0
- package/dist/chunk-texg4qqt.js +317 -0
- package/dist/chunk-teymzz80.js +266 -0
- package/dist/chunk-tj26qpf7.js +153 -0
- package/dist/chunk-tk85ec4p.js +395 -0
- package/dist/chunk-tq205h01.js +164 -0
- package/dist/chunk-tqzddjzg.js +61 -0
- package/dist/chunk-trqrj23e.js +134 -0
- package/dist/chunk-tw1hfsxv.js +2477 -0
- package/dist/chunk-txxdfq83.js +122 -0
- package/dist/chunk-v0yhe582.js +31 -0
- package/dist/chunk-v14184xm.js +15 -0
- package/dist/chunk-v1h9z4hw.js +138 -0
- package/dist/chunk-v3ey5j7f.js +329 -0
- package/dist/chunk-v3nh1sfn.js +208 -0
- package/dist/chunk-v3x8tcc0.js +45 -0
- package/dist/chunk-v4nqnvqq.js +3984 -0
- package/dist/chunk-v4ypszbb.js +15 -0
- package/dist/chunk-v7wbqcx9.js +63 -0
- package/dist/chunk-v8r5fev3.js +341 -0
- package/dist/chunk-v9zg5kzx.js +2810 -0
- package/dist/chunk-va1wh5ss.js +24 -0
- package/dist/chunk-vbfswhht.js +42 -0
- package/dist/chunk-ve7x2tfq.js +124 -0
- package/dist/chunk-vfz8k89y.js +485 -0
- package/dist/chunk-vgm5k14x.js +35678 -0
- package/dist/chunk-vh9pej3c.js +247 -0
- package/dist/chunk-vjxqyt6f.js +3820 -0
- package/dist/chunk-vpb1xstn.js +178 -0
- package/dist/chunk-vqt79tj8.js +110 -0
- package/dist/chunk-vr0n9pv9.js +152 -0
- package/dist/chunk-vrejmja5.js +90 -0
- package/dist/chunk-vrxasmdw.js +449 -0
- package/dist/chunk-vrxb946v.js +125 -0
- package/dist/chunk-vv4kj0q8.js +98 -0
- package/dist/chunk-vvpfng7w.js +8 -0
- package/dist/chunk-vw6ybyew.js +2007 -0
- package/dist/chunk-vwenx8ke.js +17 -0
- package/dist/chunk-vwfa0s5a.js +155 -0
- package/dist/chunk-vx71j8xe.js +63 -0
- package/dist/chunk-vxbjzggp.js +43 -0
- package/dist/chunk-vxjxtz8w.js +440 -0
- package/dist/chunk-vy0c1bwp.js +9 -0
- package/dist/chunk-w3zczyse.js +14 -0
- package/dist/chunk-w4p5t920.js +655 -0
- package/dist/chunk-w68wc625.js +287 -0
- package/dist/chunk-w9ddp3yf.js +96 -0
- package/dist/chunk-wcggm5ja.js +125 -0
- package/dist/chunk-wgnyph3q.js +1306 -0
- package/dist/chunk-wjm5pc1e.js +134 -0
- package/dist/chunk-wnve0drm.js +131 -0
- package/dist/chunk-wp27ev2k.js +135 -0
- package/dist/chunk-wyvy8a4x.js +131 -0
- package/dist/chunk-x671y4dk.js +129 -0
- package/dist/chunk-xbj5keyy.js +22 -0
- package/dist/chunk-xf4fzms8.js +39 -0
- package/dist/chunk-xf59k3zg.js +65 -0
- package/dist/chunk-xgzc4w49.js +204 -0
- package/dist/chunk-xhj7g13b.js +2149 -0
- package/dist/chunk-xjp0cd00.js +56 -0
- package/dist/chunk-xkhnmhqs.js +74 -0
- package/dist/chunk-xkrkqx61.js +55 -0
- package/dist/chunk-xmpgmeb8.js +114 -0
- package/dist/chunk-xrw80zgd.js +4249 -0
- package/dist/chunk-xrzc96g0.js +202 -0
- package/dist/chunk-xt76sm44.js +318 -0
- package/dist/chunk-xwet3awb.js +20 -0
- package/dist/chunk-xyg1sk2w.js +78 -0
- package/dist/chunk-y0jpkqb0.js +180 -0
- package/dist/chunk-y1q7rt9n.js +102 -0
- package/dist/chunk-y67ntyek.js +258 -0
- package/dist/chunk-ybk37qp9.js +37 -0
- package/dist/chunk-yc1stfve.js +5386 -0
- package/dist/chunk-ychjpjef.js +62 -0
- package/dist/chunk-yez8fa9g.js +276 -0
- package/dist/chunk-ygm7xszr.js +90 -0
- package/dist/chunk-ym11azkj.js +37 -0
- package/dist/chunk-ympz2h15.js +578 -0
- package/dist/chunk-yqx3az3n.js +129 -0
- package/dist/chunk-yt3nfhcc.js +152 -0
- package/dist/chunk-yy8q0n8s.js +120 -0
- package/dist/chunk-yzb92zxv.js +8 -0
- package/dist/chunk-yzet6xyr.js +119 -0
- package/dist/chunk-yzm97qp1.js +226 -0
- package/dist/chunk-z0jgeax8.js +35 -0
- package/dist/chunk-z1r3z6w6.js +29 -0
- package/dist/chunk-z2dp53wn.js +17 -0
- package/dist/chunk-z79355gz.js +308 -0
- package/dist/chunk-z7e94hxz.js +251 -0
- package/dist/chunk-z8cqdcec.js +173 -0
- package/dist/chunk-z99tbg45.js +148 -0
- package/dist/chunk-z9nsjcht.js +37 -0
- package/dist/chunk-za3k6h2h.js +470 -0
- package/dist/chunk-zacynq5p.js +265 -0
- package/dist/chunk-zb0x40az.js +1785 -0
- package/dist/chunk-zbxtzycc.js +274 -0
- package/dist/chunk-zga50181.js +342 -0
- package/dist/chunk-zhb2pns1.js +44 -0
- package/dist/chunk-zkch6trx.js +231 -0
- package/dist/chunk-znf3z4qt.js +954 -0
- package/dist/chunk-zp8zwdgq.js +72 -0
- package/dist/chunk-ztjd8pyf.js +120 -0
- package/dist/chunk-ztmb7geg.js +173 -0
- package/dist/chunk-zvr4snzv.js +887 -0
- package/dist/chunk-zw62m6n3.js +34858 -0
- package/dist/chunk-zwwdebd0.js +65 -0
- package/dist/chunk-zxc6x9w8.js +340 -0
- package/dist/chunk-zy2e7sz0.js +8 -0
- package/dist/chunk-zzf074w3.js +196 -0
- package/dist/chunk-zzz0nwb5.js +310 -0
- package/dist/cli-bun.js +2 -0
- package/dist/cli-node.js +2 -0
- package/dist/cli.js +218 -0
- package/dist/vendor/audio-capture/arm64-darwin/audio-capture.node +0 -0
- package/dist/vendor/audio-capture/arm64-linux/audio-capture.node +0 -0
- package/dist/vendor/audio-capture/arm64-win32/audio-capture.node +0 -0
- package/dist/vendor/audio-capture/x64-darwin/audio-capture.node +0 -0
- package/dist/vendor/audio-capture/x64-linux/audio-capture.node +0 -0
- package/dist/vendor/audio-capture/x64-win32/audio-capture.node +0 -0
- package/dist/vendor/ripgrep/x64-win32/rg.exe +0 -0
- package/package.json +243 -0
- package/scripts/chrome-mcp-bridge-resolver.mjs +43 -0
- package/scripts/chrome-mcp-env.mjs +19 -0
- package/scripts/postinstall.cjs +339 -0
- package/scripts/run-parallel.mjs +10 -0
- package/scripts/setup-chrome-mcp.mjs +69 -0
|
@@ -0,0 +1,871 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import {
|
|
3
|
+
buildCliLaunch,
|
|
4
|
+
init_cliLaunch
|
|
5
|
+
} from "./chunk-4kqt1pm1.js";
|
|
6
|
+
import"./chunk-rpmntgyh.js";
|
|
7
|
+
import {
|
|
8
|
+
getClaudeAIOAuthTokens,
|
|
9
|
+
init_auth
|
|
10
|
+
} from "./chunk-eemjb825.js";
|
|
11
|
+
import"./chunk-ga1jkyqy.js";
|
|
12
|
+
import"./chunk-y1q7rt9n.js";
|
|
13
|
+
import"./chunk-8kct9arg.js";
|
|
14
|
+
import"./chunk-k7hexw3v.js";
|
|
15
|
+
import"./chunk-trqrj23e.js";
|
|
16
|
+
import"./chunk-za3k6h2h.js";
|
|
17
|
+
import"./chunk-8kf8h7xf.js";
|
|
18
|
+
import"./chunk-bgan4cpf.js";
|
|
19
|
+
import"./chunk-jmv7k0jn.js";
|
|
20
|
+
import"./chunk-hjxqmtg5.js";
|
|
21
|
+
import"./chunk-bzyzrq0k.js";
|
|
22
|
+
import"./chunk-vwenx8ke.js";
|
|
23
|
+
import"./chunk-q2h79ncs.js";
|
|
24
|
+
import"./chunk-v4ypszbb.js";
|
|
25
|
+
import {
|
|
26
|
+
getOauthConfig,
|
|
27
|
+
init_oauth
|
|
28
|
+
} from "./chunk-qfsn720k.js";
|
|
29
|
+
import"./chunk-j9475b46.js";
|
|
30
|
+
import"./chunk-fdwabr8p.js";
|
|
31
|
+
import"./chunk-326zehp8.js";
|
|
32
|
+
import"./chunk-40t1d75v.js";
|
|
33
|
+
import"./chunk-e3abfxpy.js";
|
|
34
|
+
import"./chunk-fejeqe61.js";
|
|
35
|
+
import"./chunk-q1vrhh0q.js";
|
|
36
|
+
import"./chunk-hn4w9pkj.js";
|
|
37
|
+
import"./chunk-2g0ytd9d.js";
|
|
38
|
+
import"./chunk-de0qnnf7.js";
|
|
39
|
+
import"./chunk-j1mep9ck.js";
|
|
40
|
+
import"./chunk-6x35ffpx.js";
|
|
41
|
+
import"./chunk-1zbwhcbt.js";
|
|
42
|
+
import"./chunk-10k5jfc5.js";
|
|
43
|
+
import"./chunk-n9g24mwe.js";
|
|
44
|
+
import"./chunk-e3j7m7k2.js";
|
|
45
|
+
import"./chunk-hzmzwte2.js";
|
|
46
|
+
import"./chunk-pdvg91cg.js";
|
|
47
|
+
import"./chunk-c696122m.js";
|
|
48
|
+
import"./chunk-xbj5keyy.js";
|
|
49
|
+
import"./chunk-c1yc761e.js";
|
|
50
|
+
import"./chunk-c5g9shkw.js";
|
|
51
|
+
import"./chunk-aeysytks.js";
|
|
52
|
+
import {
|
|
53
|
+
init_debug,
|
|
54
|
+
init_slowOperations,
|
|
55
|
+
jsonParse,
|
|
56
|
+
jsonStringify,
|
|
57
|
+
logForDebugging
|
|
58
|
+
} from "./chunk-s3hafnk3.js";
|
|
59
|
+
import"./chunk-kb3758f7.js";
|
|
60
|
+
import"./chunk-9h9k5vz3.js";
|
|
61
|
+
import"./chunk-xmpgmeb8.js";
|
|
62
|
+
import"./chunk-2kz09j2s.js";
|
|
63
|
+
import"./chunk-c0k7b0jw.js";
|
|
64
|
+
import"./chunk-pecy49yr.js";
|
|
65
|
+
import"./chunk-azbab59e.js";
|
|
66
|
+
import"./chunk-3nk9q8dr.js";
|
|
67
|
+
import"./chunk-hhsxm2yr.js";
|
|
68
|
+
|
|
69
|
+
// src/ssh/SSHSessionManager.ts
|
|
70
|
+
init_debug();
|
|
71
|
+
init_slowOperations();
|
|
72
|
+
function isStdoutMessage(value) {
|
|
73
|
+
return typeof value === "object" && value !== null && "type" in value && typeof value.type === "string";
|
|
74
|
+
}
|
|
75
|
+
var BASE_RECONNECT_DELAY_MS = 2000;
|
|
76
|
+
var MAX_RECONNECT_DELAY_MS = 15000;
|
|
77
|
+
var DEFAULT_MAX_RECONNECT_ATTEMPTS = 3;
|
|
78
|
+
|
|
79
|
+
class SSHSessionManagerImpl {
|
|
80
|
+
proc;
|
|
81
|
+
options;
|
|
82
|
+
connected = false;
|
|
83
|
+
disconnected = false;
|
|
84
|
+
readLoopAbort = null;
|
|
85
|
+
reconnectAttempt = 0;
|
|
86
|
+
maxReconnectAttempts;
|
|
87
|
+
userInitiatedDisconnect = false;
|
|
88
|
+
reconnecting = false;
|
|
89
|
+
constructor(proc, options) {
|
|
90
|
+
this.proc = proc;
|
|
91
|
+
this.options = options;
|
|
92
|
+
this.maxReconnectAttempts = options.maxReconnectAttempts ?? DEFAULT_MAX_RECONNECT_ATTEMPTS;
|
|
93
|
+
}
|
|
94
|
+
connect() {
|
|
95
|
+
if (this.connected)
|
|
96
|
+
return;
|
|
97
|
+
this.readLoopAbort = new AbortController;
|
|
98
|
+
this.startReadLoop();
|
|
99
|
+
this.monitorExit();
|
|
100
|
+
this.connected = true;
|
|
101
|
+
this.options.onConnected();
|
|
102
|
+
}
|
|
103
|
+
async startReadLoop() {
|
|
104
|
+
const stdout = this.proc.stdout;
|
|
105
|
+
if (!stdout) {
|
|
106
|
+
this.options.onError(new Error("SSH process stdout is not available"));
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
const reader = stdout.getReader();
|
|
110
|
+
const decoder = new TextDecoder;
|
|
111
|
+
let lineBuffer = "";
|
|
112
|
+
try {
|
|
113
|
+
while (!this.disconnected) {
|
|
114
|
+
const { done, value } = await reader.read();
|
|
115
|
+
if (done)
|
|
116
|
+
break;
|
|
117
|
+
lineBuffer += decoder.decode(value, { stream: true });
|
|
118
|
+
const lines = lineBuffer.split(`
|
|
119
|
+
`);
|
|
120
|
+
lineBuffer = lines.pop() ?? "";
|
|
121
|
+
for (const line of lines) {
|
|
122
|
+
const trimmed = line.trim();
|
|
123
|
+
if (!trimmed)
|
|
124
|
+
continue;
|
|
125
|
+
this.processLine(trimmed);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
} catch (err) {
|
|
129
|
+
if (!this.disconnected) {
|
|
130
|
+
this.options.onError(err instanceof Error ? err : new Error(String(err)));
|
|
131
|
+
}
|
|
132
|
+
} finally {
|
|
133
|
+
reader.releaseLock();
|
|
134
|
+
if (!this.disconnected && !this.userInitiatedDisconnect) {
|
|
135
|
+
this.handleProcessExit();
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
monitorExit() {
|
|
140
|
+
if (this.proc.exitCode !== null) {
|
|
141
|
+
if (!this.userInitiatedDisconnect) {
|
|
142
|
+
this.handleProcessExit();
|
|
143
|
+
}
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
this.proc.exited.then(() => {
|
|
147
|
+
if (!this.disconnected && !this.userInitiatedDisconnect) {
|
|
148
|
+
this.handleProcessExit();
|
|
149
|
+
}
|
|
150
|
+
}).catch(() => {
|
|
151
|
+
if (!this.disconnected && !this.userInitiatedDisconnect) {
|
|
152
|
+
this.handleProcessExit();
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
async handleProcessExit() {
|
|
157
|
+
if (this.disconnected || this.reconnecting)
|
|
158
|
+
return;
|
|
159
|
+
this.connected = false;
|
|
160
|
+
if (!this.options.reconnect) {
|
|
161
|
+
this.disconnected = true;
|
|
162
|
+
this.options.onDisconnected();
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
if (this.reconnectAttempt >= this.maxReconnectAttempts) {
|
|
166
|
+
this.disconnected = true;
|
|
167
|
+
this.options.onDisconnected();
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
this.reconnecting = true;
|
|
171
|
+
try {
|
|
172
|
+
await this.attemptReconnect();
|
|
173
|
+
} finally {
|
|
174
|
+
this.reconnecting = false;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
async attemptReconnect() {
|
|
178
|
+
const reconnect = this.options.reconnect;
|
|
179
|
+
while (this.reconnectAttempt < this.maxReconnectAttempts) {
|
|
180
|
+
this.reconnectAttempt++;
|
|
181
|
+
this.options.onReconnecting(this.reconnectAttempt, this.maxReconnectAttempts);
|
|
182
|
+
const delay = Math.min(BASE_RECONNECT_DELAY_MS * 2 ** (this.reconnectAttempt - 1), MAX_RECONNECT_DELAY_MS);
|
|
183
|
+
await new Promise((r) => setTimeout(r, delay));
|
|
184
|
+
if (this.userInitiatedDisconnect)
|
|
185
|
+
return;
|
|
186
|
+
try {
|
|
187
|
+
const newProc = await reconnect();
|
|
188
|
+
this.proc = newProc;
|
|
189
|
+
this.reconnectAttempt = 0;
|
|
190
|
+
this.connected = true;
|
|
191
|
+
this.startReadLoop();
|
|
192
|
+
this.monitorExit();
|
|
193
|
+
this.options.onConnected();
|
|
194
|
+
return;
|
|
195
|
+
} catch (err) {
|
|
196
|
+
logForDebugging(`[SSH] reconnect attempt ${this.reconnectAttempt} failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
this.disconnected = true;
|
|
200
|
+
this.options.onDisconnected();
|
|
201
|
+
}
|
|
202
|
+
processLine(line) {
|
|
203
|
+
let raw;
|
|
204
|
+
try {
|
|
205
|
+
raw = jsonParse(line);
|
|
206
|
+
} catch {
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
if (!isStdoutMessage(raw))
|
|
210
|
+
return;
|
|
211
|
+
const parsed = raw;
|
|
212
|
+
if (parsed.type === "control_request") {
|
|
213
|
+
const request = parsed;
|
|
214
|
+
if (request.request.subtype === "can_use_tool") {
|
|
215
|
+
this.options.onPermissionRequest(request.request, request.request_id);
|
|
216
|
+
} else {
|
|
217
|
+
logForDebugging(`[SSH] Unsupported control request subtype: ${request.request.subtype}`);
|
|
218
|
+
this.sendErrorResponse(request.request_id, `Unsupported control request subtype: ${request.request.subtype}`);
|
|
219
|
+
}
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
222
|
+
if (parsed.type !== "control_response" && parsed.type !== "keep_alive" && parsed.type !== "control_cancel_request" && parsed.type !== "streamlined_text" && parsed.type !== "streamlined_tool_use_summary" && !(parsed.type === "system" && parsed.subtype === "post_turn_summary")) {
|
|
223
|
+
this.options.onMessage(parsed);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
writeToStdin(data) {
|
|
227
|
+
try {
|
|
228
|
+
const stdin = this.proc.stdin;
|
|
229
|
+
if (!stdin || typeof stdin === "number" || this.disconnected)
|
|
230
|
+
return false;
|
|
231
|
+
const encoded = new TextEncoder().encode(data + `
|
|
232
|
+
`);
|
|
233
|
+
stdin.write(encoded);
|
|
234
|
+
stdin.flush?.();
|
|
235
|
+
return true;
|
|
236
|
+
} catch {
|
|
237
|
+
return false;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
async sendMessage(content) {
|
|
241
|
+
const message = jsonStringify({
|
|
242
|
+
type: "user",
|
|
243
|
+
message: {
|
|
244
|
+
role: "user",
|
|
245
|
+
content
|
|
246
|
+
},
|
|
247
|
+
parent_tool_use_id: null,
|
|
248
|
+
session_id: ""
|
|
249
|
+
});
|
|
250
|
+
return this.writeToStdin(message);
|
|
251
|
+
}
|
|
252
|
+
sendInterrupt() {
|
|
253
|
+
const request = jsonStringify({
|
|
254
|
+
type: "control_request",
|
|
255
|
+
request_id: crypto.randomUUID(),
|
|
256
|
+
request: {
|
|
257
|
+
subtype: "interrupt"
|
|
258
|
+
}
|
|
259
|
+
});
|
|
260
|
+
this.writeToStdin(request);
|
|
261
|
+
}
|
|
262
|
+
respondToPermissionRequest(requestId, response) {
|
|
263
|
+
const msg = jsonStringify({
|
|
264
|
+
type: "control_response",
|
|
265
|
+
response: {
|
|
266
|
+
subtype: "success",
|
|
267
|
+
request_id: requestId,
|
|
268
|
+
response: {
|
|
269
|
+
behavior: response.behavior,
|
|
270
|
+
...response.behavior === "allow" ? { updatedInput: response.updatedInput } : { message: response.message }
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
});
|
|
274
|
+
this.writeToStdin(msg);
|
|
275
|
+
}
|
|
276
|
+
sendErrorResponse(requestId, error) {
|
|
277
|
+
const response = jsonStringify({
|
|
278
|
+
type: "control_response",
|
|
279
|
+
response: {
|
|
280
|
+
subtype: "error",
|
|
281
|
+
request_id: requestId,
|
|
282
|
+
error
|
|
283
|
+
}
|
|
284
|
+
});
|
|
285
|
+
this.writeToStdin(response);
|
|
286
|
+
}
|
|
287
|
+
disconnect() {
|
|
288
|
+
if (this.disconnected)
|
|
289
|
+
return;
|
|
290
|
+
this.userInitiatedDisconnect = true;
|
|
291
|
+
this.disconnected = true;
|
|
292
|
+
this.connected = false;
|
|
293
|
+
this.readLoopAbort?.abort();
|
|
294
|
+
try {
|
|
295
|
+
const stdin = this.proc.stdin;
|
|
296
|
+
if (stdin && typeof stdin !== "number") {
|
|
297
|
+
stdin.end?.();
|
|
298
|
+
}
|
|
299
|
+
} catch {}
|
|
300
|
+
try {
|
|
301
|
+
this.proc.kill();
|
|
302
|
+
} catch {}
|
|
303
|
+
}
|
|
304
|
+
isConnected() {
|
|
305
|
+
return this.connected && !this.disconnected;
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
// src/ssh/SSHAuthProxy.ts
|
|
310
|
+
init_auth();
|
|
311
|
+
init_oauth();
|
|
312
|
+
init_debug();
|
|
313
|
+
import { randomUUID } from "crypto";
|
|
314
|
+
import { unlinkSync } from "fs";
|
|
315
|
+
var isWindows = process.platform === "win32";
|
|
316
|
+
function resolveAuthHeaders() {
|
|
317
|
+
const apiKey = process.env.ANTHROPIC_API_KEY;
|
|
318
|
+
if (apiKey) {
|
|
319
|
+
return { "x-api-key": apiKey };
|
|
320
|
+
}
|
|
321
|
+
const oauthTokens = getClaudeAIOAuthTokens();
|
|
322
|
+
if (oauthTokens?.accessToken) {
|
|
323
|
+
return { Authorization: `Bearer ${oauthTokens.accessToken}` };
|
|
324
|
+
}
|
|
325
|
+
return {};
|
|
326
|
+
}
|
|
327
|
+
function resolveUpstreamBaseUrl() {
|
|
328
|
+
return process.env.ANTHROPIC_BASE_URL || getOauthConfig().BASE_API_URL;
|
|
329
|
+
}
|
|
330
|
+
async function proxyFetch(req, nonce) {
|
|
331
|
+
if (nonce && req.headers.get("x-auth-nonce") !== nonce) {
|
|
332
|
+
return new Response("Forbidden", { status: 403 });
|
|
333
|
+
}
|
|
334
|
+
const upstreamBase = resolveUpstreamBaseUrl();
|
|
335
|
+
const url = new URL(req.url);
|
|
336
|
+
const upstreamUrl = `${upstreamBase}${url.pathname}${url.search}`;
|
|
337
|
+
const authHeaders = resolveAuthHeaders();
|
|
338
|
+
if (Object.keys(authHeaders).length === 0) {
|
|
339
|
+
return new Response(JSON.stringify({
|
|
340
|
+
error: "No API credentials available on local machine"
|
|
341
|
+
}), { status: 401, headers: { "content-type": "application/json" } });
|
|
342
|
+
}
|
|
343
|
+
const forwardHeaders = new Headers(req.headers);
|
|
344
|
+
for (const [k, v] of Object.entries(authHeaders)) {
|
|
345
|
+
forwardHeaders.set(k, v);
|
|
346
|
+
}
|
|
347
|
+
forwardHeaders.delete("host");
|
|
348
|
+
forwardHeaders.delete("x-auth-nonce");
|
|
349
|
+
logForDebugging(`[SSHAuthProxy] ${req.method} ${url.pathname} -> ${upstreamUrl}`);
|
|
350
|
+
try {
|
|
351
|
+
const upstreamRes = await fetch(upstreamUrl, {
|
|
352
|
+
method: req.method,
|
|
353
|
+
headers: forwardHeaders,
|
|
354
|
+
body: req.body,
|
|
355
|
+
duplex: "half"
|
|
356
|
+
});
|
|
357
|
+
const responseHeaders = new Headers(upstreamRes.headers);
|
|
358
|
+
responseHeaders.delete("content-encoding");
|
|
359
|
+
responseHeaders.delete("content-length");
|
|
360
|
+
return new Response(upstreamRes.body, {
|
|
361
|
+
status: upstreamRes.status,
|
|
362
|
+
statusText: upstreamRes.statusText,
|
|
363
|
+
headers: responseHeaders
|
|
364
|
+
});
|
|
365
|
+
} catch (err) {
|
|
366
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
367
|
+
logForDebugging(`[SSHAuthProxy] upstream error: ${message}`);
|
|
368
|
+
return new Response(JSON.stringify({ error: `Proxy upstream error: ${message}` }), { status: 502, headers: { "content-type": "application/json" } });
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
async function createAuthProxy() {
|
|
372
|
+
const id = randomUUID();
|
|
373
|
+
if (isWindows) {
|
|
374
|
+
return createTcpAuthProxy(id);
|
|
375
|
+
}
|
|
376
|
+
return createUnixSocketAuthProxy(id);
|
|
377
|
+
}
|
|
378
|
+
async function createUnixSocketAuthProxy(id) {
|
|
379
|
+
const socketPath = `/tmp/claude-ssh-auth-${id}.sock`;
|
|
380
|
+
const server = Bun.serve({
|
|
381
|
+
unix: socketPath,
|
|
382
|
+
fetch: (req) => proxyFetch(req, null)
|
|
383
|
+
});
|
|
384
|
+
logForDebugging(`[SSHAuthProxy] listening on unix:${socketPath}`);
|
|
385
|
+
const proxy = {
|
|
386
|
+
stop() {
|
|
387
|
+
server.stop(true);
|
|
388
|
+
try {
|
|
389
|
+
unlinkSync(socketPath);
|
|
390
|
+
} catch {}
|
|
391
|
+
}
|
|
392
|
+
};
|
|
393
|
+
return {
|
|
394
|
+
proxy,
|
|
395
|
+
localAddress: socketPath,
|
|
396
|
+
authEnv: { ANTHROPIC_AUTH_SOCKET: socketPath }
|
|
397
|
+
};
|
|
398
|
+
}
|
|
399
|
+
async function createTcpAuthProxy(id) {
|
|
400
|
+
const nonce = randomUUID();
|
|
401
|
+
const server = Bun.serve({
|
|
402
|
+
port: 0,
|
|
403
|
+
hostname: "127.0.0.1",
|
|
404
|
+
fetch: (req) => proxyFetch(req, nonce)
|
|
405
|
+
});
|
|
406
|
+
const port = server.port;
|
|
407
|
+
logForDebugging(`[SSHAuthProxy] listening on TCP 127.0.0.1:${port} (nonce-protected)`);
|
|
408
|
+
const proxy = {
|
|
409
|
+
stop() {
|
|
410
|
+
server.stop(true);
|
|
411
|
+
}
|
|
412
|
+
};
|
|
413
|
+
return {
|
|
414
|
+
proxy,
|
|
415
|
+
localAddress: `127.0.0.1:${port}`,
|
|
416
|
+
authEnv: {
|
|
417
|
+
ANTHROPIC_BASE_URL: `http://127.0.0.1:${port}`,
|
|
418
|
+
ANTHROPIC_AUTH_NONCE: nonce
|
|
419
|
+
}
|
|
420
|
+
};
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
// src/ssh/SSHProbe.ts
|
|
424
|
+
init_debug();
|
|
425
|
+
var PROBE_TIMEOUT_MS = 15000;
|
|
426
|
+
|
|
427
|
+
class SSHProbeError extends Error {
|
|
428
|
+
constructor(message) {
|
|
429
|
+
super(message);
|
|
430
|
+
this.name = "SSHProbeError";
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
async function probeRemote(host, onProgress) {
|
|
434
|
+
onProgress?.("Probing remote host\u2026");
|
|
435
|
+
const proc = Bun.spawn([
|
|
436
|
+
"ssh",
|
|
437
|
+
"-o",
|
|
438
|
+
"BatchMode=yes",
|
|
439
|
+
"-o",
|
|
440
|
+
"ConnectTimeout=10",
|
|
441
|
+
host,
|
|
442
|
+
'CLAUDE_BIN=$(test -x "$HOME/.local/bin/claude" && echo "$HOME/.local/bin/claude" || command -v claude 2>/dev/null); echo "$CLAUDE_BIN"; $CLAUDE_BIN --version 2>/dev/null; uname -sm; pwd'
|
|
443
|
+
], { stdin: "ignore", stdout: "pipe", stderr: "pipe" });
|
|
444
|
+
const result = await Promise.race([
|
|
445
|
+
proc.exited,
|
|
446
|
+
new Promise((_, reject) => setTimeout(() => reject(new SSHProbeError(`SSH probe timed out after ${PROBE_TIMEOUT_MS / 1000}s`)), PROBE_TIMEOUT_MS))
|
|
447
|
+
]);
|
|
448
|
+
const stdout = await new Response(proc.stdout).text();
|
|
449
|
+
const stderr = await new Response(proc.stderr).text();
|
|
450
|
+
if (result !== 0) {
|
|
451
|
+
const detail = stderr.trim() || `exit code ${result}`;
|
|
452
|
+
throw new SSHProbeError(`SSH probe failed: ${detail}`);
|
|
453
|
+
}
|
|
454
|
+
const lines = stdout.split(`
|
|
455
|
+
`).map((l) => l.trim()).filter(Boolean);
|
|
456
|
+
logForDebugging(`[SSHProbe] raw lines: ${JSON.stringify(lines)}`);
|
|
457
|
+
const unameIdx = lines.findIndex((l) => /^(Linux|Darwin)\s/.test(l));
|
|
458
|
+
if (unameIdx === -1) {
|
|
459
|
+
throw new SSHProbeError("Could not detect remote platform (uname output missing)");
|
|
460
|
+
}
|
|
461
|
+
const binaryPath = unameIdx >= 2 ? lines[unameIdx - 2] || null : null;
|
|
462
|
+
const versionLine = unameIdx >= 1 ? lines[unameIdx - 1] || null : null;
|
|
463
|
+
const remoteVersion = versionLine && /^\d+\.\d+/.test(versionLine) ? versionLine : null;
|
|
464
|
+
const hasBinary = binaryPath !== null && binaryPath.startsWith("/");
|
|
465
|
+
const defaultCwd = lines[unameIdx + 1] || "/";
|
|
466
|
+
const [osName, arch] = lines[unameIdx].split(/\s+/);
|
|
467
|
+
const remotePlatform = osName === "Darwin" ? "darwin" : "linux";
|
|
468
|
+
const remoteArch = arch === "aarch64" || arch === "arm64" ? "arm64" : "x64";
|
|
469
|
+
onProgress?.(`Detected ${remotePlatform}/${remoteArch}`);
|
|
470
|
+
return {
|
|
471
|
+
hasBinary: hasBinary && remoteVersion !== null,
|
|
472
|
+
remoteVersion,
|
|
473
|
+
remotePlatform,
|
|
474
|
+
remoteArch,
|
|
475
|
+
defaultCwd,
|
|
476
|
+
binaryPath: hasBinary ? binaryPath : null
|
|
477
|
+
};
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
// src/ssh/SSHDeploy.ts
|
|
481
|
+
init_debug();
|
|
482
|
+
import { existsSync } from "fs";
|
|
483
|
+
import { resolve } from "path";
|
|
484
|
+
var SSH_TIMEOUT_MS = 60000;
|
|
485
|
+
var REMOTE_BIN_DIR = "~/.local/bin";
|
|
486
|
+
var REMOTE_CLI_FILE = "claude-code-cli.js";
|
|
487
|
+
var REMOTE_WRAPPER = "claude";
|
|
488
|
+
async function runSshCommand(host, command, timeoutMs = SSH_TIMEOUT_MS) {
|
|
489
|
+
const proc = Bun.spawn(["ssh", "-o", "ConnectTimeout=10", host, command], {
|
|
490
|
+
stdout: "pipe",
|
|
491
|
+
stderr: "pipe"
|
|
492
|
+
});
|
|
493
|
+
const timer = setTimeout(() => proc.kill(), timeoutMs);
|
|
494
|
+
try {
|
|
495
|
+
const [stdout, stderr] = await Promise.all([
|
|
496
|
+
new Response(proc.stdout).text(),
|
|
497
|
+
new Response(proc.stderr).text()
|
|
498
|
+
]);
|
|
499
|
+
const exitCode = await proc.exited;
|
|
500
|
+
return { stdout: stdout.trim(), stderr: stderr.trim(), exitCode };
|
|
501
|
+
} finally {
|
|
502
|
+
clearTimeout(timer);
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
function findLocalBinary() {
|
|
506
|
+
const projectRoot = resolve(import.meta.dir, "../..");
|
|
507
|
+
const distPath = resolve(projectRoot, "dist/cli.js");
|
|
508
|
+
if (existsSync(distPath))
|
|
509
|
+
return distPath;
|
|
510
|
+
const devPath = resolve(projectRoot, "src/entrypoints/cli.tsx");
|
|
511
|
+
if (existsSync(devPath))
|
|
512
|
+
return devPath;
|
|
513
|
+
throw new Error("Cannot find local CLI binary to deploy. Run `bun run build` first.");
|
|
514
|
+
}
|
|
515
|
+
async function deployBinary(options) {
|
|
516
|
+
const { host, remotePlatform, remoteArch, localVersion, onProgress } = options;
|
|
517
|
+
if (remotePlatform !== "linux" && remotePlatform !== "darwin") {
|
|
518
|
+
throw new Error(`Remote platform "${remotePlatform}" is not supported. Only linux and darwin are supported.`);
|
|
519
|
+
}
|
|
520
|
+
logForDebugging(`[SSHDeploy] deploying to ${host} (${remotePlatform}/${remoteArch}, v${localVersion})`);
|
|
521
|
+
const localBinary = findLocalBinary();
|
|
522
|
+
logForDebugging(`[SSHDeploy] local binary: ${localBinary}`);
|
|
523
|
+
onProgress?.("Creating remote directory...");
|
|
524
|
+
const mkdirResult = await runSshCommand(host, `mkdir -p ${REMOTE_BIN_DIR}`);
|
|
525
|
+
if (mkdirResult.exitCode !== 0) {
|
|
526
|
+
throw new Error(`Failed to create remote directory: ${mkdirResult.stderr}`);
|
|
527
|
+
}
|
|
528
|
+
onProgress?.("Uploading binary...");
|
|
529
|
+
const remotePath = `${REMOTE_BIN_DIR}/${REMOTE_CLI_FILE}`;
|
|
530
|
+
const scpProc = Bun.spawn(["scp", "-o", "ConnectTimeout=10", localBinary, `${host}:${remotePath}`], { stdout: "pipe", stderr: "pipe" });
|
|
531
|
+
const scpTimer = setTimeout(() => scpProc.kill(), SSH_TIMEOUT_MS);
|
|
532
|
+
const scpStderr = await new Response(scpProc.stderr).text();
|
|
533
|
+
const scpExit = await scpProc.exited;
|
|
534
|
+
clearTimeout(scpTimer);
|
|
535
|
+
if (scpExit !== 0) {
|
|
536
|
+
throw new Error(`SCP upload failed (exit ${scpExit}): ${scpStderr.trim()}`);
|
|
537
|
+
}
|
|
538
|
+
onProgress?.("Installing wrapper script...");
|
|
539
|
+
const wrapperScript = [
|
|
540
|
+
`cat > ${REMOTE_BIN_DIR}/${REMOTE_WRAPPER} << 'WRAPPER'`,
|
|
541
|
+
"#!/bin/sh",
|
|
542
|
+
`exec bun ${REMOTE_BIN_DIR}/${REMOTE_CLI_FILE} "$@"`,
|
|
543
|
+
"WRAPPER",
|
|
544
|
+
`chmod +x ${REMOTE_BIN_DIR}/${REMOTE_WRAPPER}`
|
|
545
|
+
].join(`
|
|
546
|
+
`);
|
|
547
|
+
const wrapperResult = await runSshCommand(host, wrapperScript);
|
|
548
|
+
if (wrapperResult.exitCode !== 0) {
|
|
549
|
+
throw new Error(`Failed to install wrapper script: ${wrapperResult.stderr}`);
|
|
550
|
+
}
|
|
551
|
+
onProgress?.("Verifying installation...");
|
|
552
|
+
const verifyResult = await runSshCommand(host, `${REMOTE_BIN_DIR}/${REMOTE_WRAPPER} --version`);
|
|
553
|
+
if (verifyResult.exitCode !== 0) {
|
|
554
|
+
throw new Error(`Binary deployed but verification failed (exit ${verifyResult.exitCode}): ${verifyResult.stderr}`);
|
|
555
|
+
}
|
|
556
|
+
logForDebugging(`[SSHDeploy] deployed successfully, remote version: ${verifyResult.stdout}`);
|
|
557
|
+
onProgress?.(`Deployed v${verifyResult.stdout}`);
|
|
558
|
+
return `${REMOTE_BIN_DIR}/${REMOTE_WRAPPER}`;
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
// src/ssh/createSSHSession.ts
|
|
562
|
+
init_cliLaunch();
|
|
563
|
+
init_debug();
|
|
564
|
+
init_slowOperations();
|
|
565
|
+
import { randomUUID as randomUUID2 } from "crypto";
|
|
566
|
+
var INIT_TIMEOUT_MS = 30000;
|
|
567
|
+
var STDERR_TAIL_LINES = 20;
|
|
568
|
+
|
|
569
|
+
class SSHSessionError extends Error {
|
|
570
|
+
constructor(message) {
|
|
571
|
+
super(message);
|
|
572
|
+
this.name = "SSHSessionError";
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
async function createSSHSession(config, callbacks) {
|
|
576
|
+
const { host, localVersion, extraCliArgs, remoteBin } = config;
|
|
577
|
+
const onProgress = callbacks?.onProgress;
|
|
578
|
+
let remoteBinaryPath;
|
|
579
|
+
let defaultCwd = "/";
|
|
580
|
+
if (remoteBin) {
|
|
581
|
+
onProgress?.("Using custom remote binary, skipping probe/deploy\u2026");
|
|
582
|
+
remoteBinaryPath = remoteBin;
|
|
583
|
+
logForDebugging(`[SSH] custom remoteBin: ${remoteBin}`);
|
|
584
|
+
try {
|
|
585
|
+
const pwdProc = Bun.spawn(["ssh", "-o", "BatchMode=yes", "-o", "ConnectTimeout=5", host, "pwd"], {
|
|
586
|
+
stdin: "ignore",
|
|
587
|
+
stdout: "pipe",
|
|
588
|
+
stderr: "ignore"
|
|
589
|
+
});
|
|
590
|
+
await pwdProc.exited;
|
|
591
|
+
const pwd = (await new Response(pwdProc.stdout).text()).trim();
|
|
592
|
+
if (pwd.startsWith("/"))
|
|
593
|
+
defaultCwd = pwd;
|
|
594
|
+
} catch {}
|
|
595
|
+
} else {
|
|
596
|
+
const probe = await probeRemote(host, onProgress);
|
|
597
|
+
logForDebugging(`[SSH] probe result: ${JSON.stringify(probe)}`);
|
|
598
|
+
defaultCwd = probe.defaultCwd;
|
|
599
|
+
remoteBinaryPath = probe.binaryPath ?? "~/.local/bin/claude";
|
|
600
|
+
if (!probe.hasBinary || probe.remoteVersion !== localVersion) {
|
|
601
|
+
onProgress?.(probe.hasBinary ? `Updating remote binary (${probe.remoteVersion} \u2192 ${localVersion})\u2026` : "Deploying binary to remote\u2026");
|
|
602
|
+
remoteBinaryPath = await deployBinary({
|
|
603
|
+
host,
|
|
604
|
+
remotePlatform: probe.remotePlatform,
|
|
605
|
+
remoteArch: probe.remoteArch,
|
|
606
|
+
localVersion,
|
|
607
|
+
onProgress
|
|
608
|
+
});
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
const { proxy, localAddress, authEnv } = await createAuthProxy();
|
|
612
|
+
logForDebugging(`[SSH] auth proxy listening on ${localAddress}`);
|
|
613
|
+
const remoteSocketId = randomUUID2().slice(0, 8);
|
|
614
|
+
const isWindows2 = process.platform === "win32";
|
|
615
|
+
const remoteCli = [];
|
|
616
|
+
for (const [k, v] of Object.entries(authEnv)) {
|
|
617
|
+
remoteCli.push(`${k}=${v}`);
|
|
618
|
+
}
|
|
619
|
+
remoteCli.push(remoteBinaryPath, "--output-format", "stream-json", "--input-format", "stream-json", "--verbose", "-p");
|
|
620
|
+
if (config.cwd)
|
|
621
|
+
remoteCli.push("--cwd", config.cwd);
|
|
622
|
+
if (config.permissionMode)
|
|
623
|
+
remoteCli.push("--permission-mode", config.permissionMode);
|
|
624
|
+
if (config.dangerouslySkipPermissions)
|
|
625
|
+
remoteCli.push("--dangerously-skip-permissions");
|
|
626
|
+
remoteCli.push(...extraCliArgs);
|
|
627
|
+
const sshArgs = ["ssh"];
|
|
628
|
+
if (!isWindows2) {
|
|
629
|
+
const remoteSocket = `/tmp/claude-ssh-auth-${remoteSocketId}.sock`;
|
|
630
|
+
sshArgs.push("-R", `${remoteSocket}:${localAddress}`);
|
|
631
|
+
sshArgs.push("-o", "StreamLocalBindUnlink=yes");
|
|
632
|
+
const idx = remoteCli.indexOf(`ANTHROPIC_AUTH_SOCKET=${authEnv.ANTHROPIC_AUTH_SOCKET}`);
|
|
633
|
+
if (idx !== -1) {
|
|
634
|
+
remoteCli[idx] = `ANTHROPIC_AUTH_SOCKET=${remoteSocket}`;
|
|
635
|
+
}
|
|
636
|
+
} else {
|
|
637
|
+
const localPort = localAddress.split(":")[1];
|
|
638
|
+
const remotePort = 1e4 + Math.floor(Math.random() * 50000);
|
|
639
|
+
sshArgs.push("-R", `${remotePort}:127.0.0.1:${localPort}`);
|
|
640
|
+
const baseIdx = remoteCli.findIndex((s) => s.startsWith("ANTHROPIC_BASE_URL="));
|
|
641
|
+
if (baseIdx !== -1) {
|
|
642
|
+
remoteCli[baseIdx] = `ANTHROPIC_BASE_URL=http://127.0.0.1:${remotePort}`;
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
sshArgs.push(host, remoteCli.join(" "));
|
|
646
|
+
onProgress?.("Starting remote session\u2026");
|
|
647
|
+
logForDebugging(`[SSH] spawning: ${sshArgs.join(" ")}`);
|
|
648
|
+
let proc;
|
|
649
|
+
try {
|
|
650
|
+
proc = Bun.spawn(sshArgs, {
|
|
651
|
+
stdin: "pipe",
|
|
652
|
+
stdout: "pipe",
|
|
653
|
+
stderr: "pipe"
|
|
654
|
+
});
|
|
655
|
+
} catch (err) {
|
|
656
|
+
proxy.stop();
|
|
657
|
+
throw new SSHSessionError(`Failed to spawn SSH process: ${err instanceof Error ? err.message : String(err)}`);
|
|
658
|
+
}
|
|
659
|
+
const stderrChunks = [];
|
|
660
|
+
collectStderr(proc, stderrChunks);
|
|
661
|
+
let remoteCwd;
|
|
662
|
+
if (remoteBin) {
|
|
663
|
+
const earlyExit = await Promise.race([
|
|
664
|
+
proc.exited.then((code) => code),
|
|
665
|
+
new Promise((r) => setTimeout(() => r(null), 3000))
|
|
666
|
+
]);
|
|
667
|
+
if (earlyExit !== null) {
|
|
668
|
+
proxy.stop();
|
|
669
|
+
const tail = stderrChunks.join("").trim();
|
|
670
|
+
throw new SSHSessionError(`Remote process exited immediately (code ${earlyExit})${tail ? `: ${tail}` : ""}`);
|
|
671
|
+
}
|
|
672
|
+
remoteCwd = config.cwd || defaultCwd || "/";
|
|
673
|
+
} else {
|
|
674
|
+
try {
|
|
675
|
+
remoteCwd = await waitForInit(proc, config.cwd || defaultCwd);
|
|
676
|
+
} catch (err) {
|
|
677
|
+
proxy.stop();
|
|
678
|
+
proc.kill();
|
|
679
|
+
throw err;
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
logForDebugging(`[SSH] remote session initialized, remoteCwd=${remoteCwd}`);
|
|
683
|
+
let currentProc = proc;
|
|
684
|
+
const reconnect = async () => {
|
|
685
|
+
logForDebugging("[SSH] reconnect: re-spawning SSH process with --continue");
|
|
686
|
+
const reconnectArgs = [...sshArgs];
|
|
687
|
+
const cmdIdx = reconnectArgs.length - 1;
|
|
688
|
+
const existingCmd = reconnectArgs[cmdIdx];
|
|
689
|
+
if (!existingCmd.includes("--continue")) {
|
|
690
|
+
reconnectArgs[cmdIdx] = existingCmd.replace(/ -p(?:\s|$)/, " -p --continue ");
|
|
691
|
+
}
|
|
692
|
+
const newProc = Bun.spawn(reconnectArgs, {
|
|
693
|
+
stdin: "pipe",
|
|
694
|
+
stdout: "pipe",
|
|
695
|
+
stderr: "pipe"
|
|
696
|
+
});
|
|
697
|
+
const newStderrChunks = [];
|
|
698
|
+
collectStderr(newProc, newStderrChunks);
|
|
699
|
+
await waitForInit(newProc, remoteCwd);
|
|
700
|
+
currentProc = newProc;
|
|
701
|
+
stderrChunks.length = 0;
|
|
702
|
+
stderrChunks.push(...newStderrChunks);
|
|
703
|
+
return newProc;
|
|
704
|
+
};
|
|
705
|
+
return {
|
|
706
|
+
remoteCwd,
|
|
707
|
+
get proc() {
|
|
708
|
+
return currentProc;
|
|
709
|
+
},
|
|
710
|
+
proxy,
|
|
711
|
+
createManager(options) {
|
|
712
|
+
return new SSHSessionManagerImpl(currentProc, {
|
|
713
|
+
...options,
|
|
714
|
+
reconnect
|
|
715
|
+
});
|
|
716
|
+
},
|
|
717
|
+
getStderrTail() {
|
|
718
|
+
return stderrChunks.slice(-STDERR_TAIL_LINES).join("");
|
|
719
|
+
}
|
|
720
|
+
};
|
|
721
|
+
}
|
|
722
|
+
async function createLocalSSHSession(config) {
|
|
723
|
+
const { proxy, authEnv } = await createAuthProxy();
|
|
724
|
+
const cliArgs = [
|
|
725
|
+
"--output-format",
|
|
726
|
+
"stream-json",
|
|
727
|
+
"--input-format",
|
|
728
|
+
"stream-json",
|
|
729
|
+
"-p"
|
|
730
|
+
];
|
|
731
|
+
if (config.cwd) {
|
|
732
|
+
cliArgs.push("--cwd", config.cwd);
|
|
733
|
+
}
|
|
734
|
+
if (config.permissionMode) {
|
|
735
|
+
cliArgs.push("--permission-mode", config.permissionMode);
|
|
736
|
+
}
|
|
737
|
+
if (config.dangerouslySkipPermissions) {
|
|
738
|
+
cliArgs.push("--dangerously-skip-permissions");
|
|
739
|
+
}
|
|
740
|
+
const spec = buildCliLaunch(cliArgs);
|
|
741
|
+
let proc;
|
|
742
|
+
try {
|
|
743
|
+
proc = Bun.spawn([spec.execPath, ...spec.args], {
|
|
744
|
+
stdin: "pipe",
|
|
745
|
+
stdout: "pipe",
|
|
746
|
+
stderr: "pipe",
|
|
747
|
+
env: { ...spec.env, ...authEnv }
|
|
748
|
+
});
|
|
749
|
+
} catch (err) {
|
|
750
|
+
proxy.stop();
|
|
751
|
+
throw new SSHSessionError(`Failed to spawn local CLI process: ${err instanceof Error ? err.message : String(err)}`);
|
|
752
|
+
}
|
|
753
|
+
logForDebugging("[SSH] local session spawned, waiting for init message...");
|
|
754
|
+
const stderrChunks = [];
|
|
755
|
+
collectStderr(proc, stderrChunks);
|
|
756
|
+
let remoteCwd;
|
|
757
|
+
try {
|
|
758
|
+
remoteCwd = await waitForInit(proc, config.cwd);
|
|
759
|
+
} catch (err) {
|
|
760
|
+
proxy.stop();
|
|
761
|
+
proc.kill();
|
|
762
|
+
throw err;
|
|
763
|
+
}
|
|
764
|
+
logForDebugging(`[SSH] local session initialized, remoteCwd=${remoteCwd}`);
|
|
765
|
+
let currentProc = proc;
|
|
766
|
+
const reconnect = async () => {
|
|
767
|
+
logForDebugging("[SSH] local reconnect: re-spawning CLI with --continue");
|
|
768
|
+
const reconnectCliArgs = [...cliArgs];
|
|
769
|
+
if (!reconnectCliArgs.includes("--continue")) {
|
|
770
|
+
reconnectCliArgs.push("--continue");
|
|
771
|
+
}
|
|
772
|
+
const reconnectSpec = buildCliLaunch(reconnectCliArgs);
|
|
773
|
+
const newProc = Bun.spawn([reconnectSpec.execPath, ...reconnectSpec.args], {
|
|
774
|
+
stdin: "pipe",
|
|
775
|
+
stdout: "pipe",
|
|
776
|
+
stderr: "pipe",
|
|
777
|
+
env: { ...reconnectSpec.env, ...authEnv }
|
|
778
|
+
});
|
|
779
|
+
const newStderrChunks = [];
|
|
780
|
+
collectStderr(newProc, newStderrChunks);
|
|
781
|
+
await waitForInit(newProc, remoteCwd);
|
|
782
|
+
currentProc = newProc;
|
|
783
|
+
stderrChunks.length = 0;
|
|
784
|
+
stderrChunks.push(...newStderrChunks);
|
|
785
|
+
return newProc;
|
|
786
|
+
};
|
|
787
|
+
return {
|
|
788
|
+
remoteCwd,
|
|
789
|
+
get proc() {
|
|
790
|
+
return currentProc;
|
|
791
|
+
},
|
|
792
|
+
proxy,
|
|
793
|
+
createManager(options) {
|
|
794
|
+
return new SSHSessionManagerImpl(currentProc, {
|
|
795
|
+
...options,
|
|
796
|
+
reconnect
|
|
797
|
+
});
|
|
798
|
+
},
|
|
799
|
+
getStderrTail() {
|
|
800
|
+
return stderrChunks.slice(-STDERR_TAIL_LINES).join("");
|
|
801
|
+
}
|
|
802
|
+
};
|
|
803
|
+
}
|
|
804
|
+
async function waitForInit(proc, fallbackCwd) {
|
|
805
|
+
const stdout = proc.stdout;
|
|
806
|
+
if (!stdout) {
|
|
807
|
+
throw new SSHSessionError("Child process stdout is not readable");
|
|
808
|
+
}
|
|
809
|
+
const reader = stdout.getReader();
|
|
810
|
+
const decoder = new TextDecoder;
|
|
811
|
+
let buffer = "";
|
|
812
|
+
const deadline = Date.now() + INIT_TIMEOUT_MS;
|
|
813
|
+
try {
|
|
814
|
+
while (Date.now() < deadline) {
|
|
815
|
+
const remaining = deadline - Date.now();
|
|
816
|
+
const result = await Promise.race([
|
|
817
|
+
reader.read(),
|
|
818
|
+
new Promise((_, reject) => setTimeout(() => reject(new SSHSessionError("Remote CLI did not initialize within 30 seconds. Check SSH connectivity and remote binary.")), remaining))
|
|
819
|
+
]);
|
|
820
|
+
if (result.done) {
|
|
821
|
+
throw new SSHSessionError("Child process exited before sending init message");
|
|
822
|
+
}
|
|
823
|
+
buffer += decoder.decode(result.value, { stream: true });
|
|
824
|
+
const lines = buffer.split(`
|
|
825
|
+
`);
|
|
826
|
+
buffer = lines.pop() ?? "";
|
|
827
|
+
for (const line of lines) {
|
|
828
|
+
const trimmed = line.trim();
|
|
829
|
+
if (!trimmed)
|
|
830
|
+
continue;
|
|
831
|
+
try {
|
|
832
|
+
const msg = jsonParse(trimmed);
|
|
833
|
+
if (msg.type === "system" && msg.subtype === "init") {
|
|
834
|
+
reader.releaseLock();
|
|
835
|
+
return msg.cwd || fallbackCwd || process.cwd();
|
|
836
|
+
}
|
|
837
|
+
} catch {}
|
|
838
|
+
}
|
|
839
|
+
}
|
|
840
|
+
} catch (err) {
|
|
841
|
+
reader.releaseLock();
|
|
842
|
+
throw err instanceof SSHSessionError ? err : new SSHSessionError(`Error reading init message: ${err instanceof Error ? err.message : String(err)}`);
|
|
843
|
+
}
|
|
844
|
+
reader.releaseLock();
|
|
845
|
+
throw new SSHSessionError("Remote CLI did not initialize within 30 seconds. Check SSH connectivity and remote binary.");
|
|
846
|
+
}
|
|
847
|
+
function collectStderr(proc, chunks) {
|
|
848
|
+
const stderr = proc.stderr;
|
|
849
|
+
if (!stderr)
|
|
850
|
+
return;
|
|
851
|
+
const reader = stderr.getReader();
|
|
852
|
+
const decoder = new TextDecoder;
|
|
853
|
+
(async () => {
|
|
854
|
+
try {
|
|
855
|
+
while (true) {
|
|
856
|
+
const { done, value } = await reader.read();
|
|
857
|
+
if (done)
|
|
858
|
+
break;
|
|
859
|
+
chunks.push(decoder.decode(value, { stream: true }));
|
|
860
|
+
if (chunks.length > STDERR_TAIL_LINES * 2) {
|
|
861
|
+
chunks.splice(0, chunks.length - STDERR_TAIL_LINES);
|
|
862
|
+
}
|
|
863
|
+
}
|
|
864
|
+
} catch {}
|
|
865
|
+
})();
|
|
866
|
+
}
|
|
867
|
+
export {
|
|
868
|
+
createSSHSession,
|
|
869
|
+
createLocalSSHSession,
|
|
870
|
+
SSHSessionError
|
|
871
|
+
};
|