@qitqode/qitqode-android-arm64 0.1.30 → 0.1.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundle/{chunk-37n34pzd.js → chunk-01my2y0c.js} +1 -1
- package/bundle/{chunk-ejjea8hh.js → chunk-02jtpxe0.js} +1 -1
- package/bundle/{chunk-6qy1ghrx.js → chunk-05mce0j3.js} +1 -1
- package/bundle/chunk-096pd6c4.js +2 -0
- package/bundle/{chunk-g1dwbvkg.js → chunk-0bbs01f0.js} +1 -1
- package/bundle/chunk-0c2p3a6v.js +2 -0
- package/bundle/chunk-0c5rxty9.js +2 -0
- package/bundle/{chunk-j6emx6jn.js → chunk-0dt0bxz6.js} +2 -2
- package/bundle/chunk-0e86gt9r.js +2 -0
- package/bundle/{chunk-mskwkcgj.js → chunk-0mx2psfc.js} +1 -1
- package/bundle/chunk-0p27fvfr.js +2 -0
- package/bundle/chunk-0qs1vx97.js +2 -0
- package/bundle/{chunk-f45tp3e3.js → chunk-0v0vqbn5.js} +1 -1
- package/bundle/{chunk-be216spx.js → chunk-10bjs581.js} +2 -2
- package/bundle/{chunk-bss414qz.js → chunk-12vef2pr.js} +1 -1
- package/bundle/{chunk-jm1ptn8n.js → chunk-15hw2z9t.js} +1 -1
- package/bundle/chunk-15j5cn4t.js +2 -0
- package/bundle/{chunk-srh4xvsj.js → chunk-1gx18dm5.js} +1 -1
- package/bundle/chunk-1r95p0tp.js +2 -0
- package/bundle/chunk-1rhhhm88.js +2 -0
- package/bundle/{chunk-b0syck9r.js → chunk-1sgahe1s.js} +1 -1
- package/bundle/{chunk-26nfphsg.js → chunk-1vb79bw1.js} +1 -1
- package/bundle/chunk-1wbjh23g.js +2 -0
- package/bundle/chunk-20702epe.js +2 -0
- package/bundle/{chunk-371r2111.js → chunk-24jg9d61.js} +1 -1
- package/bundle/chunk-257me4z3.js +800 -0
- package/bundle/{chunk-1sgby720.js → chunk-2hc5z7b5.js} +1 -1
- package/bundle/{chunk-yq3m8190.js → chunk-2maqde7w.js} +2 -2
- package/bundle/{chunk-mrw279k3.js → chunk-2phz0bn9.js} +1 -1
- package/bundle/{chunk-b8tw709r.js → chunk-2vn41ecx.js} +1 -1
- package/bundle/chunk-2wajs9xv.js +2 -0
- package/bundle/{chunk-w87a3mzm.js → chunk-2zq4k837.js} +1 -1
- package/bundle/{chunk-1bhvt33f.js → chunk-31qrzrwy.js} +1 -1
- package/bundle/{chunk-d5bxan80.js → chunk-326p5b10.js} +2 -2
- package/bundle/{chunk-0df4kede.js → chunk-33e9y2aw.js} +1 -1
- package/bundle/{chunk-zcm2jdr5.js → chunk-35xk4g91.js} +1 -1
- package/bundle/{chunk-5fz8tph5.js → chunk-3632wgg1.js} +1 -1
- package/bundle/{chunk-1ngtxja9.js → chunk-3bxg5bta.js} +1 -1
- package/bundle/{chunk-mgk9sh16.js → chunk-3c6p8tm3.js} +1 -1
- package/bundle/{chunk-fqw4y7x0.js → chunk-3nx7112w.js} +2 -2
- package/bundle/{chunk-n26yf3he.js → chunk-3wetyrjs.js} +1 -1
- package/bundle/{chunk-2jmxt3fb.js → chunk-40efytmk.js} +1 -1
- package/bundle/chunk-42p59wm4.js +2 -0
- package/bundle/chunk-4512pvca.js +2 -0
- package/bundle/chunk-456bmaww.js +2 -0
- package/bundle/{chunk-c5e6sk9c.js → chunk-48ge2ryx.js} +1 -1
- package/bundle/chunk-48pajrnt.js +2 -0
- package/bundle/{chunk-12bssxd4.js → chunk-4cnwn1rh.js} +2 -2
- package/bundle/chunk-4fy9c54h.js +2 -0
- package/bundle/{chunk-4tbwha3m.js → chunk-4jtxtkj7.js} +2 -2
- package/bundle/chunk-4sc82a27.js +2 -0
- package/bundle/chunk-52bam8g7.js +2 -0
- package/bundle/{chunk-6fp8a9ek.js → chunk-53bqcctj.js} +1 -1
- package/bundle/{chunk-hwbyqezq.js → chunk-56z7x7h4.js} +2 -2
- package/bundle/chunk-59y8q9m5.js +2 -0
- package/bundle/chunk-59yqvk48.js +3 -0
- package/bundle/{chunk-a1pw9r6f.js → chunk-5hw6xa49.js} +2 -2
- package/bundle/{chunk-8qkhddq3.js → chunk-5jx0yadh.js} +2 -2
- package/bundle/chunk-5pb551dx.js +2 -0
- package/bundle/{chunk-qrey2gwb.js → chunk-5q4harvc.js} +2 -2
- package/bundle/chunk-5tray1fw.js +3 -0
- package/bundle/{chunk-my6sz5d6.js → chunk-60v5jvgt.js} +1 -1
- package/bundle/chunk-634pnryq.js +2 -0
- package/bundle/chunk-64ezpbwt.js +2 -0
- package/bundle/{chunk-5fgx6fa4.js → chunk-69nzndk7.js} +1 -1
- package/bundle/{chunk-k8ss3135.js → chunk-6aqyhfag.js} +218 -218
- package/bundle/{chunk-chmrvbbj.js → chunk-6d5rrre9.js} +1 -1
- package/bundle/{chunk-g3dhsmbt.js → chunk-6hpgb8h4.js} +3 -3
- package/bundle/{chunk-drs1gv2b.js → chunk-6kp07m7p.js} +1 -1
- package/bundle/{chunk-wy46mbwt.js → chunk-6phh70sp.js} +1 -1
- package/bundle/{chunk-v2zp22r3.js → chunk-70ck4v3t.js} +1 -1
- package/bundle/{chunk-2tnarng3.js → chunk-71sjjjr8.js} +1 -1
- package/bundle/{chunk-ds69qc8b.js → chunk-71xz70r9.js} +1 -1
- package/bundle/{chunk-2dzk5txw.js → chunk-73e409hd.js} +1 -1
- package/bundle/chunk-764fksh3.js +2 -0
- package/bundle/{chunk-g7rjtehn.js → chunk-78ymd20x.js} +1 -1
- package/bundle/{chunk-szr0f7k2.js → chunk-7avcnwv8.js} +1 -1
- package/bundle/{chunk-z8v2tsz2.js → chunk-7hm0c2yg.js} +1 -1
- package/bundle/chunk-7mke41x0.js +2 -0
- package/bundle/chunk-7ry9cvby.js +2 -0
- package/bundle/chunk-7tr9ejyk.js +7 -0
- package/bundle/chunk-7wczs9mx.js +2 -0
- package/bundle/{chunk-aztre27e.js → chunk-7xm75w1e.js} +1 -1
- package/bundle/{chunk-s3yna2wm.js → chunk-7z5jh4ra.js} +1 -1
- package/bundle/chunk-7z777y9k.js +2 -0
- package/bundle/{chunk-vj62pc0h.js → chunk-81qwdg5s.js} +1 -1
- package/bundle/chunk-85wcc1tp.js +3 -0
- package/bundle/chunk-89w3yhf8.js +2 -0
- package/bundle/chunk-8dwq41q1.js +28 -0
- package/bundle/{chunk-6hv59ere.js → chunk-8hytwgwf.js} +1 -1
- package/bundle/{chunk-wz0zcddf.js → chunk-8n20thvd.js} +2 -2
- package/bundle/{chunk-s07j8hfy.js → chunk-8qswepp2.js} +1 -1
- package/bundle/{chunk-bpbptx89.js → chunk-8r6ht39z.js} +1 -1
- package/bundle/chunk-8v96pmqn.js +2 -0
- package/bundle/chunk-8y2scz6z.js +2 -0
- package/bundle/chunk-8zx7vnx6.js +2 -0
- package/bundle/{chunk-qhc90p4a.js → chunk-93p131d5.js} +1 -1
- package/bundle/chunk-94a76f8w.js +2 -0
- package/bundle/{chunk-ppfjf7qx.js → chunk-9emq67vc.js} +1 -1
- package/bundle/{chunk-bvkq0a5q.js → chunk-9f1z9xce.js} +1 -1
- package/bundle/{chunk-dcvatax2.js → chunk-9gazyynx.js} +2 -2
- package/bundle/chunk-9ng7jjp7.js +2 -0
- package/bundle/chunk-9tpgnjy8.js +2 -0
- package/bundle/{chunk-mk6cddvd.js → chunk-a1wdeapb.js} +1 -1
- package/bundle/{chunk-qjn86fc0.js → chunk-a7amey9s.js} +1 -1
- package/bundle/chunk-a7ym9f0v.js +2 -0
- package/bundle/chunk-a8f2xvy3.js +2 -0
- package/bundle/chunk-a99cvwta.js +2 -0
- package/bundle/{chunk-42f7p0hq.js → chunk-ad72gb5f.js} +2 -2
- package/bundle/{chunk-89v6dgpp.js → chunk-ag8kz1e7.js} +2 -2
- package/bundle/{chunk-zv6pjtz1.js → chunk-avf8v3hb.js} +1 -1
- package/bundle/chunk-avys5mnz.js +2 -0
- package/bundle/chunk-axvjd10y.js +2 -0
- package/bundle/{chunk-m612agnk.js → chunk-ay8emwym.js} +1 -1
- package/bundle/chunk-b4pphqab.js +2 -0
- package/bundle/chunk-b6087ak4.js +2 -0
- package/bundle/{chunk-msegx0t7.js → chunk-b8gjz6bk.js} +1 -1
- package/bundle/{chunk-gf0pdgjs.js → chunk-bh53dz71.js} +1 -1
- package/bundle/chunk-bn0h9dny.js +10 -0
- package/bundle/chunk-brkqxbjy.js +2 -0
- package/bundle/{chunk-09kba1hg.js → chunk-c11d28qn.js} +2 -2
- package/bundle/chunk-c26qxt5g.js +2 -0
- package/bundle/chunk-c6zscb38.js +2 -0
- package/bundle/{chunk-ddnpx1yx.js → chunk-caj1b9y7.js} +5 -5
- package/bundle/{chunk-pekm54ce.js → chunk-cfgvm15x.js} +1 -1
- package/bundle/{chunk-v4xcysh0.js → chunk-chpr8ekb.js} +1 -1
- package/bundle/chunk-cjww2jmv.js +3 -0
- package/bundle/{chunk-m67tcnk4.js → chunk-ck2gfaba.js} +1 -1
- package/bundle/{chunk-9j1qqdr2.js → chunk-cphrgyp6.js} +1 -1
- package/bundle/{chunk-eb9mytjq.js → chunk-ctaze2hn.js} +1 -1
- package/bundle/{chunk-5qam3c8r.js → chunk-cxnfy6qk.js} +1 -1
- package/bundle/{chunk-cafzcmrg.js → chunk-d07p6fpk.js} +2 -2
- package/bundle/chunk-d0damw6y.js +2 -0
- package/bundle/{chunk-b8bytvka.js → chunk-d3ermm6d.js} +2 -2
- package/bundle/{chunk-4qqkqrn9.js → chunk-d6ry9418.js} +2 -2
- package/bundle/{chunk-sn4nez18.js → chunk-d9hbhkbq.js} +2 -2
- package/bundle/{chunk-ztc3gm8y.js → chunk-dactgryw.js} +1 -1
- package/bundle/chunk-dafmkrhn.js +2 -0
- package/bundle/{chunk-dfnv7vkn.js → chunk-db405hjg.js} +1 -1
- package/bundle/chunk-dgprdym0.js +2 -0
- package/bundle/{chunk-7yrhe3xq.js → chunk-dnwefyhv.js} +1 -1
- package/bundle/chunk-dryzt12j.js +2 -0
- package/bundle/chunk-dsamees2.js +2 -0
- package/bundle/{chunk-xpc2zgj7.js → chunk-dxpj0cxh.js} +2 -2
- package/bundle/{chunk-yjtdgcq5.js → chunk-dynv30gm.js} +1 -1
- package/bundle/chunk-dyqpxx3b.js +2 -0
- package/bundle/{chunk-2rs39vj2.js → chunk-e01wnqvc.js} +1 -1
- package/bundle/{chunk-2vepzgek.js → chunk-e10py6yr.js} +1 -1
- package/bundle/chunk-e5mv5wnt.js +2 -0
- package/bundle/{chunk-qv2s39dv.js → chunk-e7ny0b3x.js} +1 -1
- package/bundle/{chunk-n8h6x2en.js → chunk-ejrhvy38.js} +1 -1
- package/bundle/{chunk-dq9kpj4a.js → chunk-enpzvmtc.js} +1 -1
- package/bundle/chunk-ew9pdrp9.js +3 -0
- package/bundle/{chunk-gj3hzx3d.js → chunk-ezfy0b6q.js} +2 -2
- package/bundle/{chunk-2km50rd3.js → chunk-fgg9txzb.js} +1 -1
- package/bundle/{chunk-b9za12y1.js → chunk-fn9h4ync.js} +1 -1
- package/bundle/{chunk-ngchsw2g.js → chunk-fvzwbjh8.js} +1 -1
- package/bundle/{chunk-nzehfpxp.js → chunk-g10d6x57.js} +1 -1
- package/bundle/{chunk-zyhdxggp.js → chunk-g5rabwre.js} +2 -2
- package/bundle/{chunk-kfsb2stm.js → chunk-g7ccdh7r.js} +1 -1
- package/bundle/{chunk-phxrg7aw.js → chunk-gagtmjmp.js} +2 -2
- package/bundle/{chunk-yp0a8q29.js → chunk-gb00fh4z.js} +3 -3
- package/bundle/{chunk-hw1dmx28.js → chunk-gbpvs0fx.js} +1 -1
- package/bundle/{chunk-j8efst22.js → chunk-gj0wt0cy.js} +1 -1
- package/bundle/{chunk-2q96x1t5.js → chunk-gsar6xda.js} +1 -1
- package/bundle/{chunk-xs3xtz6x.js → chunk-gt31468k.js} +1 -1
- package/bundle/{chunk-ecn8gbtz.js → chunk-gwp17r03.js} +1 -1
- package/bundle/chunk-gwzw92jt.js +2 -0
- package/bundle/chunk-gz8sz7z1.js +9 -0
- package/bundle/{chunk-2bn4b42t.js → chunk-h2afsbm1.js} +1 -1
- package/bundle/{chunk-tj78jsp9.js → chunk-h4j5xzc8.js} +1 -1
- package/bundle/chunk-h6f3kbz2.js +2 -0
- package/bundle/{chunk-b3dqcbsc.js → chunk-hbbsbyyq.js} +1 -1
- package/bundle/{chunk-2gerf08b.js → chunk-hnvn2c25.js} +2 -2
- package/bundle/{chunk-vn7nkrqb.js → chunk-hnzegjgv.js} +1 -1
- package/bundle/chunk-hp7tssgv.js +2 -0
- package/bundle/chunk-ht0hbdmx.js +2 -0
- package/bundle/{chunk-j9pcnkkq.js → chunk-ht5w06x7.js} +2 -2
- package/bundle/{chunk-a1p2f16h.js → chunk-htz93dsd.js} +2 -2
- package/bundle/{chunk-q6ztpfcs.js → chunk-jbx3s7nw.js} +2 -2
- package/bundle/{chunk-hxz2rdjq.js → chunk-jdynx7m6.js} +1 -1
- package/bundle/{chunk-h9pvnp5c.js → chunk-jef04wyf.js} +1 -1
- package/bundle/{chunk-ct48575c.js → chunk-jh0bw59r.js} +1 -1
- package/bundle/{chunk-knpt9n8f.js → chunk-jrqb0jwy.js} +1 -1
- package/bundle/{chunk-1dwcga8g.js → chunk-js1n8tgv.js} +1 -1
- package/bundle/chunk-k1txw65h.js +2 -0
- package/bundle/chunk-k5atbdbm.js +2 -0
- package/bundle/chunk-k75jqg60.js +3 -0
- package/bundle/{chunk-yn6sbycg.js → chunk-k7aenxan.js} +2 -2
- package/bundle/{chunk-1rp1cvmc.js → chunk-kf167jw7.js} +1 -1
- package/bundle/{chunk-wsy0m70r.js → chunk-kfxv5rfg.js} +1 -1
- package/bundle/{chunk-btz9jvec.js → chunk-kj20f048.js} +1 -1
- package/bundle/{chunk-j5kb0y1m.js → chunk-kq6b222y.js} +1 -1
- package/bundle/{chunk-1t9jne14.js → chunk-ktzq4ha1.js} +1 -1
- package/bundle/{chunk-5v4py9p2.js → chunk-m2q317gh.js} +1 -1
- package/bundle/chunk-mahgmbt9.js +2 -0
- package/bundle/{chunk-1qshjfzm.js → chunk-mk1bfzg5.js} +1 -1
- package/bundle/{chunk-2y90ad1v.js → chunk-mqd1jsg2.js} +1 -1
- package/bundle/{chunk-t12xrrfr.js → chunk-mzs2pjyc.js} +2 -2
- package/bundle/{chunk-m02zt1a3.js → chunk-n9xns8by.js} +2 -2
- package/bundle/chunk-ngm6pqyt.js +2 -0
- package/bundle/chunk-ngtavamt.js +2 -0
- package/bundle/chunk-nkhc32s3.js +2 -0
- package/bundle/{chunk-wpajh5s5.js → chunk-nkkch4h7.js} +1 -1
- package/bundle/chunk-npse2xrd.js +2 -0
- package/bundle/{chunk-k7gq9bra.js → chunk-nv3eyyaj.js} +1 -1
- package/bundle/{chunk-ab6cabxh.js → chunk-p18axz0m.js} +1 -1
- package/bundle/{chunk-jje0srjq.js → chunk-p62gb4wj.js} +1 -1
- package/bundle/chunk-p6e4vqy7.js +2 -0
- package/bundle/{chunk-m1h5a4vg.js → chunk-p9qfbr02.js} +1 -1
- package/bundle/{chunk-ggqst87g.js → chunk-pe29yy6s.js} +1 -1
- package/bundle/{chunk-yy526n9c.js → chunk-pje60pj2.js} +1 -1
- package/bundle/{chunk-3n1324bt.js → chunk-pp2eqkse.js} +1 -1
- package/bundle/{chunk-x067eetw.js → chunk-pp6vhqrr.js} +1 -1
- package/bundle/chunk-pqkjhn8h.js +2 -0
- package/bundle/{chunk-ezja6njs.js → chunk-pv67gwce.js} +1 -1
- package/bundle/{chunk-b3rpzkcb.js → chunk-q7vasbxn.js} +1 -1
- package/bundle/chunk-qadw6j20.js +2 -0
- package/bundle/{chunk-89q1y7tc.js → chunk-qc8rsn4v.js} +1 -1
- package/bundle/chunk-qd8w2gkd.js +2 -0
- package/bundle/chunk-qggcszs2.js +2 -0
- package/bundle/{chunk-q1v2pytx.js → chunk-qrsveve6.js} +1 -1
- package/bundle/chunk-r7sqdfad.js +2 -0
- package/bundle/chunk-r8m7rtfc.js +2 -0
- package/bundle/{chunk-7ppd2phw.js → chunk-rbk8seme.js} +1 -1
- package/bundle/chunk-rf12t4n5.js +2 -0
- package/bundle/{chunk-04tw0r4s.js → chunk-rg0mrprz.js} +1 -1
- package/bundle/{chunk-cdhmc0t0.js → chunk-rjd8gbs5.js} +1 -1
- package/bundle/chunk-rkyf0cp8.js +2 -0
- package/bundle/chunk-rpgne7xh.js +2 -0
- package/bundle/chunk-rvgj1vky.js +2 -0
- package/bundle/{chunk-c01z3cvg.js → chunk-rvkrgkeq.js} +1 -1
- package/bundle/chunk-rza530gm.js +5 -0
- package/bundle/{chunk-2ahqhh4z.js → chunk-rzhdkkpz.js} +1 -1
- package/bundle/chunk-s3mnrhbx.js +5 -0
- package/bundle/chunk-s6ktx2sx.js +2 -0
- package/bundle/{chunk-kqn9h2gk.js → chunk-skqbaadf.js} +1 -1
- package/bundle/chunk-ss2jvqrg.js +2 -0
- package/bundle/{chunk-ydp0q1hk.js → chunk-ss2ms1r3.js} +1 -1
- package/bundle/{chunk-1fbeendk.js → chunk-t56r99hp.js} +1 -1
- package/bundle/{chunk-xc5044tm.js → chunk-t8m74g39.js} +1 -1
- package/bundle/{chunk-s6bar2f9.js → chunk-t9mz17gb.js} +2 -2
- package/bundle/{chunk-cvdxgsq1.js → chunk-tq0239xp.js} +1 -1
- package/bundle/{chunk-whxjkz9a.js → chunk-tqj69nh6.js} +2 -2
- package/bundle/{chunk-hj5y7fvk.js → chunk-tt30dybd.js} +1 -1
- package/bundle/{chunk-5a5t01ka.js → chunk-tvdmnee6.js} +1 -1
- package/bundle/chunk-tvwwq4b3.js +2 -0
- package/bundle/{chunk-dhjp0zx2.js → chunk-v1xjc3s8.js} +1 -1
- package/bundle/chunk-v2n26eg4.js +2 -0
- package/bundle/chunk-vcw00k0n.js +3 -0
- package/bundle/{chunk-7jbz3dgt.js → chunk-vhe0tth1.js} +1 -1
- package/bundle/{chunk-yfkvjphe.js → chunk-vvxmwyrw.js} +1 -1
- package/bundle/{chunk-p68rwmhc.js → chunk-vxyy2dp3.js} +2 -2
- package/bundle/{chunk-y2v09y71.js → chunk-vywnd5sf.js} +1 -1
- package/bundle/{chunk-0jgsp4c2.js → chunk-w18xs2h5.js} +1 -1
- package/bundle/{chunk-fjgyrsbw.js → chunk-w7vh8cxt.js} +1 -1
- package/bundle/chunk-w8saweey.js +2 -0
- package/bundle/chunk-we9cv8we.js +8 -0
- package/bundle/chunk-wezarrvy.js +2 -0
- package/bundle/{chunk-d6r4xwtg.js → chunk-wfb608qf.js} +3 -3
- package/bundle/{chunk-3g1yz39h.js → chunk-whe7h2mj.js} +1 -1
- package/bundle/chunk-wmqsdt2c.js +3 -0
- package/bundle/chunk-wqj0xasg.js +2 -0
- package/bundle/chunk-wr42tphe.js +2 -0
- package/bundle/chunk-x24y7qyd.js +2 -0
- package/bundle/{chunk-07g7cybt.js → chunk-x25zkrz7.js} +1 -1
- package/bundle/{chunk-tr8sf0dk.js → chunk-x3y2xzhn.js} +1 -1
- package/bundle/{chunk-27yxgy03.js → chunk-x4sp99g6.js} +1 -1
- package/bundle/{chunk-3nwve06r.js → chunk-x562b0xk.js} +1 -1
- package/bundle/{chunk-61c62e5s.js → chunk-x7k5yeey.js} +1 -1
- package/bundle/{chunk-fkgv2hqd.js → chunk-x9rbv6p6.js} +1 -1
- package/bundle/{chunk-wnqwb6fd.js → chunk-xcmgkc57.js} +1 -1
- package/bundle/chunk-xj765svc.js +3 -0
- package/bundle/{chunk-gm85xefs.js → chunk-xm7wascx.js} +1 -1
- package/bundle/{chunk-whcg14sc.js → chunk-xrs18kzn.js} +1 -1
- package/bundle/{chunk-6nbzdb0r.js → chunk-xthkjax9.js} +1 -1
- package/bundle/{chunk-scnz207s.js → chunk-xvwvd4kq.js} +2 -2
- package/bundle/{chunk-zb0me4kk.js → chunk-xzrb857v.js} +1 -1
- package/bundle/chunk-y2d0w09y.js +2 -0
- package/bundle/{chunk-3nyqh1d6.js → chunk-y3b4k38p.js} +1 -1
- package/bundle/{chunk-svvgv1s0.js → chunk-y6123zvq.js} +1 -1
- package/bundle/chunk-y7sy3w6z.js +2 -0
- package/bundle/{chunk-vg2fmyje.js → chunk-y9q0hb7b.js} +2 -2
- package/bundle/chunk-yb79f79m.js +2 -0
- package/bundle/{chunk-fnbpap62.js → chunk-yek0sk2q.js} +1 -1
- package/bundle/{chunk-wfs4pcwa.js → chunk-ygs5pzk7.js} +4 -4
- package/bundle/{chunk-3bmzjznz.js → chunk-yhbcbjfk.js} +1 -1
- package/bundle/{chunk-sermjas1.js → chunk-yjf3kyej.js} +1 -1
- package/bundle/chunk-yjnyzpmt.js +2 -0
- package/bundle/{chunk-0a0vat1h.js → chunk-yp5bypsp.js} +2 -2
- package/bundle/{chunk-h0rpmne5.js → chunk-yp8wyzzm.js} +1 -1
- package/bundle/chunk-yqbcnsa1.js +2 -0
- package/bundle/{chunk-4xh1qm90.js → chunk-yv0xrnn9.js} +1 -1
- package/bundle/chunk-z3mra3nm.js +2 -0
- package/bundle/chunk-za7mwbye.js +2 -0
- package/bundle/chunk-zaks8cae.js +11 -0
- package/bundle/{chunk-0fmbz83g.js → chunk-zcsgqk9f.js} +1 -1
- package/bundle/chunk-zqqx96jx.js +3 -0
- package/bundle/{chunk-snm5q21k.js → chunk-zs8kqdsf.js} +2 -2
- package/bundle/{chunk-y062spw2.js → chunk-zscer8rc.js} +1 -1
- package/bundle/{chunk-qjjch1zt.js → chunk-zw815d68.js} +2 -2
- package/bundle/chunk-zy9w1vkc.js +2 -0
- package/bundle/index.js +3 -3
- package/bundle/parser.worker.js +2 -2
- package/bundle/worker.js +1 -1
- package/package.json +1 -1
- package/bundle/chunk-07ws99b1.js +0 -2
- package/bundle/chunk-09c4ngag.js +0 -2
- package/bundle/chunk-0ch32p4c.js +0 -3
- package/bundle/chunk-0jgst767.js +0 -2
- package/bundle/chunk-0psrr9vp.js +0 -2
- package/bundle/chunk-1j73cnvz.js +0 -2
- package/bundle/chunk-1yddn03z.js +0 -2
- package/bundle/chunk-27dgtm8r.js +0 -2
- package/bundle/chunk-2ec6ps8r.js +0 -5
- package/bundle/chunk-38g8yzw0.js +0 -2
- package/bundle/chunk-3bkd0ar3.js +0 -2
- package/bundle/chunk-3f4zht9e.js +0 -2
- package/bundle/chunk-3pxnp6jb.js +0 -2
- package/bundle/chunk-3szwfy7w.js +0 -3
- package/bundle/chunk-426dt7be.js +0 -2
- package/bundle/chunk-4amgp4yd.js +0 -3
- package/bundle/chunk-4p5e5tsz.js +0 -28
- package/bundle/chunk-4pjm21a5.js +0 -2
- package/bundle/chunk-4sz3jbc5.js +0 -2
- package/bundle/chunk-58x5seqn.js +0 -2
- package/bundle/chunk-5xe6x2rt.js +0 -2
- package/bundle/chunk-618tmyx9.js +0 -2
- package/bundle/chunk-6d9wsjxm.js +0 -2
- package/bundle/chunk-730a2d1k.js +0 -2
- package/bundle/chunk-76wrw0cs.js +0 -2
- package/bundle/chunk-7bd0x9vf.js +0 -2
- package/bundle/chunk-7czkntef.js +0 -2
- package/bundle/chunk-7ex57nyh.js +0 -2
- package/bundle/chunk-7gpczxbh.js +0 -2
- package/bundle/chunk-7j0bgeh2.js +0 -2
- package/bundle/chunk-7py443fe.js +0 -2
- package/bundle/chunk-90q5sae0.js +0 -2
- package/bundle/chunk-9amwe0ed.js +0 -2
- package/bundle/chunk-9grvepmd.js +0 -2
- package/bundle/chunk-9hrh15p2.js +0 -2
- package/bundle/chunk-a0v55ywn.js +0 -8
- package/bundle/chunk-a2qz9m10.js +0 -2
- package/bundle/chunk-av6ezvxm.js +0 -2
- package/bundle/chunk-beksar7w.js +0 -2
- package/bundle/chunk-bg66rqrx.js +0 -2
- package/bundle/chunk-bn15mzd7.js +0 -2
- package/bundle/chunk-bt6yw07v.js +0 -2
- package/bundle/chunk-cy9s1ma5.js +0 -2
- package/bundle/chunk-d0nkvp57.js +0 -2
- package/bundle/chunk-dvk2wwjj.js +0 -2
- package/bundle/chunk-dxe29jj6.js +0 -2
- package/bundle/chunk-e0jy9qxd.js +0 -2
- package/bundle/chunk-eercqt72.js +0 -2
- package/bundle/chunk-efxd6b2k.js +0 -2
- package/bundle/chunk-eneawsj8.js +0 -2
- package/bundle/chunk-f72pppr7.js +0 -2
- package/bundle/chunk-feyphhxd.js +0 -2
- package/bundle/chunk-fnnch1e9.js +0 -2
- package/bundle/chunk-ft93f33g.js +0 -3
- package/bundle/chunk-gk34kh8p.js +0 -2
- package/bundle/chunk-gn50xqbd.js +0 -2
- package/bundle/chunk-h6rv626m.js +0 -2
- package/bundle/chunk-h7s2w1e2.js +0 -2
- package/bundle/chunk-hmv2cdnz.js +0 -2
- package/bundle/chunk-ht81ensf.js +0 -2
- package/bundle/chunk-hxpgs78j.js +0 -5
- package/bundle/chunk-j59ktwny.js +0 -2
- package/bundle/chunk-jmz2mq3t.js +0 -2
- package/bundle/chunk-jvqbvgjy.js +0 -11
- package/bundle/chunk-k309zez0.js +0 -3
- package/bundle/chunk-k3fn3yed.js +0 -2
- package/bundle/chunk-kpw6nghv.js +0 -2
- package/bundle/chunk-m5ghbt5y.js +0 -2
- package/bundle/chunk-mj4bepvj.js +0 -2
- package/bundle/chunk-mn41f9qv.js +0 -2
- package/bundle/chunk-mqjf9sbm.js +0 -2
- package/bundle/chunk-n5gwrrbb.js +0 -2
- package/bundle/chunk-nfjhem1c.js +0 -2
- package/bundle/chunk-ngytjdg2.js +0 -3
- package/bundle/chunk-nj4d554m.js +0 -11
- package/bundle/chunk-nrc3bj9p.js +0 -2
- package/bundle/chunk-nt4e3em9.js +0 -3
- package/bundle/chunk-nxyyn2ra.js +0 -2
- package/bundle/chunk-p5tceb4k.js +0 -2
- package/bundle/chunk-pvpy9kq1.js +0 -800
- package/bundle/chunk-qjgm3e2p.js +0 -2
- package/bundle/chunk-qt80mhdn.js +0 -2
- package/bundle/chunk-qtw5nrr4.js +0 -2
- package/bundle/chunk-rc9ex3vt.js +0 -2
- package/bundle/chunk-s9672vvv.js +0 -2
- package/bundle/chunk-sbyey0qb.js +0 -2
- package/bundle/chunk-shpq6es1.js +0 -3
- package/bundle/chunk-sj5v361q.js +0 -2
- package/bundle/chunk-ta3k9syc.js +0 -2
- package/bundle/chunk-tk5afan4.js +0 -2
- package/bundle/chunk-tpndnprb.js +0 -2
- package/bundle/chunk-v965rsr8.js +0 -3
- package/bundle/chunk-vcmrrt8b.js +0 -3
- package/bundle/chunk-vcrn3v70.js +0 -2
- package/bundle/chunk-vwxfgea7.js +0 -2
- package/bundle/chunk-w0kgcz1t.js +0 -2
- package/bundle/chunk-wgpsmxqx.js +0 -7
- package/bundle/chunk-wksczmes.js +0 -2
- package/bundle/chunk-wsxta33r.js +0 -2
- package/bundle/chunk-xck0sq3k.js +0 -2
- package/bundle/chunk-xjyhtm8r.js +0 -2
- package/bundle/chunk-xm08fc2q.js +0 -3
- package/bundle/chunk-ygc5qegv.js +0 -2
- package/bundle/chunk-yjqmzm51.js +0 -2
- package/bundle/chunk-yzc53n88.js +0 -2
- package/bundle/chunk-yzjc15vp.js +0 -9
- package/bundle/chunk-z7y9pdj7.js +0 -2
- package/bundle/chunk-z8g819cz.js +0 -2
- package/bundle/chunk-z8r65yw3.js +0 -2
- package/bundle/chunk-zt1nbwmm.js +0 -2
- package/bundle/chunk-zz36xg2n.js +0 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{$h as
|
|
2
|
+
import{$h as m5,Ah as vV,Ch as G$,Eh as iJ,Fh as dV,Gh as Q$,Ih as _0,Jh as p4,Kh as q5,Lh as P$,Mh as G1,Nh as _4,Oh as v4,Ph as K7,Qh as mV,Rh as GJ,Sh as r9,Th as W0,Uh as h2,Vh as N5,Wh as x5,Xh as w5,Yh as b5,Zh as P6,_h as L5,hh as J8,ih as fV,jh as V8,kh as c$,lh as EV,mh as zQ,nh as j$,oh as y$,ph as RJ,qh as CJ,rh as t4,sh as YQ,th as j1,vh as C5,xh as w6,yh as y1}from"./chunk-ygs5pzk7.js";import{ai as GY}from"./chunk-vxyy2dp3.js";import{Ui as U7}from"./chunk-5hw6xa49.js";import{$j as d8,$k as i9,Ak as D5,Al as E2,Bk as uZ,Bl as v0,Ck as pZ,Cl as J2,Dk as y5,Dl as V2,Hk as S3,Ik as k3,Nk as O5,Wj as u,Wk as F5,Xj as I$,Xk as O2,Zk as P5,_k as z5,bk as h9,ek as u4,fk as yZ,ik as B8,jk as A1,kk as F2,kl as hY,lk as x2,ll as A6,mk as Q2,ml as M2,nl as p8,ok as s6,ol as K2,pk as J$,pl as p2,rl as P2,sl as cV,tk as yJ,tl as p,uk as OJ,ul as xQ,wl as U2,xk as z0,xl as n9,yk as $1,yl as U6,zk as t0,zl as O7}from"./chunk-257me4z3.js";import{Fl as lV}from"./chunk-nkkch4h7.js";import{Ql as e4,Tl as QV,Ul as DZ,Vl as k0,_l as z1,bm as a2,cm as l$,dm as D8,em as R$,fm as j5,im as IJ,jm as U$,lm as S2,mm as v,nm as FV,om as P0,pm as cZ}from"./chunk-s3mnrhbx.js";import{rm as i1,sm as n1,tm as s1,wm as hJ,xm as D2}from"./chunk-ezfy0b6q.js";import{Um as K1,Vm as X0,Wm as t1,Xm as M4,_m as G0,an as kY,gn as TY,hn as gY,jn as vQ,wn as dQ,xn as E8}from"./chunk-bn0h9dny.js";import{Pn as hV}from"./chunk-3nx7112w.js";import{ho as lJ,jo as cJ}from"./chunk-vcw00k0n.js";import{Bo as $0}from"./chunk-we9cv8we.js";import{Fp as t$,Gp as RX,tp as W$,up as cY}from"./chunk-2maqde7w.js";import{gq as FY,hq as JY}from"./chunk-kj20f048.js";import{Bq as B6}from"./chunk-n9xns8by.js";import{Fq as I0,Kq as gV,Lq as u5}from"./chunk-d9hbhkbq.js";import{Nq as E0,Oq as a4,Rq as r4}from"./chunk-ad72gb5f.js";import{br as H$,cr as NJ,ir as KZ,jr as xJ}from"./chunk-d6ry9418.js";import{Sr as w2}from"./chunk-4cnwn1rh.js";import{Ur as M7}from"./chunk-764fksh3.js";import{Ds as H6,Is as MV,Ls as _6,Qs as q$,Rs as L0,Vr as w1,Zr as J5,_s as s,ds as O6,os as V5}from"./chunk-xj765svc.js";import{$s as k5,bt as O$,dt as q4,ht as QJ,kt as gJ,nt as LV,ot as n2,st as V$}from"./chunk-tqj69nh6.js";import{tt as P3}from"./chunk-ag8kz1e7.js";import{ut as q}from"./chunk-5tray1fw.js";import{At as A2,Bt as R7,Ct as cX,Dt as m2,Et as c,Ft as o,Gt as i2,Ht as _2,It as C7,Jt as S7,Kt as T2,Lt as R0,Mt as i,Nt as l2,Ot as YX,Pt as k7,Qt as oX,Rt as uX,St as y2,vt as XX,xt as x,yt as lX,zt as z2}from"./chunk-c11d28qn.js";import{Tt as mX,nu as G9}from"./chunk-mzs2pjyc.js";import{Yy as s4,hz as L7}from"./chunk-gagtmjmp.js";import{EI as i8,JN as c9,LC as F6,LN as d5,MG as HZ,MN as c4,OE as _,QF as _J,QG as jZ,QN as c2,RM as c0,VB as W5,WD as G2,_I as AX,aO as TJ,bE as u2,hF as H8,iE as k2,nF as UJ,oN as K5,pH as Y,pN as G5,qN as H5,rB as B5,rN as m4,tN as E5,uB as Y0,uF as AJ,vN as l4,yE as d2,yN as v5,zC as Z2,zF as MJ}from"./chunk-zs8kqdsf.js";import{BO as J9,DO as L2,FO as K$,GO as mY,HO as lY}from"./chunk-7xm75w1e.js";var y0={};L2(y0,{layer:()=>lZ,defaultLayer:()=>YB,SessionStatus:()=>y0,Service:()=>X6,Info:()=>mZ,Event:()=>y7});var mZ=q.union([q.object({type:q.literal("idle")}),q.object({type:q.literal("retry"),attempt:q.number(),message:q.string(),next:q.number()}),q.object({type:q.literal("busy"),message:q.string().optional()})]).meta({ref:"SessionStatus"}),y7={Status:D2.define("session.status",q.object({sessionID:F2.zod,status:mZ})),Idle:D2.define("session.idle",q.object({sessionID:F2.zod}))};class X6 extends Z2.Service()("@qitqode/SessionStatus"){}var lZ=_.effect(X6,Y.gen(function*(){let $=yield*u.Service,Z=yield*v.make(Y.fn("SessionStatus.state")(()=>Y.succeed(new Map))),X=Y.fn("SessionStatus.get")(function*(V){return(yield*v.get(Z)).get(V)??{type:"idle"}}),Q=Y.fn("SessionStatus.list")(function*(){return new Map(yield*v.get(Z))}),J=Y.fn("SessionStatus.set")(function*(V,B){let D=yield*v.get(Z);if(yield*$.publish(y7.Status,{sessionID:V,status:B}),B.type==="idle"){yield*$.publish(y7.Idle,{sessionID:V}),D.delete(V);return}D.set(V,B)});return X6.of({get:X,list:Q,set:J})})),YB=lZ.pipe(_.provide(u.layer));var O0={};L2(O0,{layer:()=>oZ,defaultLayer:()=>QB,SessionRunState:()=>O0,Service:()=>Q6});class Q6 extends Z2.Service()("@qitqode/SessionRunState"){}var Y6=($,Z)=>`${$}:${Z}`,oZ=_.effect(Q6,Y.gen(function*(){let $=yield*y0.Service,Z=E0.create({service:"SessionRunState"}),X=yield*v.make(Y.fn("SessionRunState.state")(function*(){let W=yield*d2.Scope,K=new Map;return yield*Y.addFinalizer(Y.fnUntraced(function*(){yield*Y.forEach(K.values(),(j)=>j.cancel,{concurrency:8,discard:!0}),K.clear()})),{runners:K,scope:W}})),Q=Y.fn("SessionRunState.runner")(function*(W,K,j){let G=Y6(W,K),z=yield*v.get(X),O=z.runners.get(G);if(O)return O;let P=K==="main",w=cZ.make(z.scope,{label:G,onReentryWarn:(L)=>Z.warn("runner-reentry",L),onIdle:P?Y.gen(function*(){z.runners.delete(G),yield*$.set(W,{type:"idle"})}):Y.sync(()=>{z.runners.delete(G)}),onBusy:P?$.set(W,{type:"busy"}):Y.void,onInterrupt:j,busy:()=>{throw new O7(W)}});return z.runners.set(G,w),w}),J=Y.fn("SessionRunState.assertNotBusy")(function*(W){if((yield*v.get(X)).runners.get(Y6(W,"main"))?.busy)throw new O7(W)}),V=Y.fn("SessionRunState.cancel")(function*(W){let K=Y6(W,"main"),G=(yield*v.get(X)).runners.get(K);if(!G||!G.busy){yield*$.set(W,{type:"idle"});return}yield*G.cancel}),B=Y.fn("SessionRunState.cancelActor")(function*(W,K){let j=Y6(W,K),z=(yield*v.get(X)).runners.get(j);if(!z||!z.busy)return;yield*z.cancel}),D=Y.fn("SessionRunState.ensureRunning")(function*(W,K,j,G){return yield*(yield*Q(W,K,j)).ensureRunning(G)}),H=Y.fn("SessionRunState.startShell")(function*(W,K,j){return yield*(yield*Q(W,"main",K)).startShell(j)});return Q6.of({assertNotBusy:J,cancel:V,cancelActor:B,ensureRunning:D,startShell:H})})),QB=oZ.pipe(_.provide(y0.defaultLayer));var F0={};L2(F0,{parseVerdictFromCompletion:()=>BB,layer:()=>iZ,defaultLayer:()=>VB,Verdict:()=>r$,Service:()=>V6,Goal:()=>F0,Event:()=>P7});var r$=q.object({ok:q.boolean(),impossible:q.boolean().optional(),reason:q.string()}),P7={Updated:D2.define("session.goal",q.object({sessionID:F2.zod,goal:q.object({condition:q.string()}).optional(),lastVerdict:r$.extend({attempt:q.number(),messageID:q.string().optional(),error:q.boolean().optional()}).optional()}))},J6=`You are evaluating a stop-condition hook in QitQode. Read the conversation transcript carefully, then judge whether the user-provided condition is satisfied.
|
|
3
3
|
|
|
4
4
|
Your response must be a JSON object with one of these shapes:
|
|
5
5
|
- {"ok": true, "reason": "<quote evidence from the transcript that satisfies the condition>"}
|
|
@@ -508,7 +508,7 @@ If you repeat the same output again, the session will be terminated.
|
|
|
508
508
|
`)})});function hQ($){if(!$.lastFinished)return;let Z=[];for(let J=$.msgs.length-1;J>=0&&Z.length<t9;J--){let V=$.msgs[J];if(V.info.role!=="assistant"||!V.info.finish)continue;let B=f8(V.parts);if(B===void 0)break;Z.push(B)}if(!(Z.length===t9&&Z.every((J)=>J===Z[0])))return;let Q=$.msgs.findLast((J)=>J.info.role==="user");if(!Q||Q.parts.some((J)=>J.type==="text"&&J.text?.includes("repeating the same action")))return;Q.parts.push({id:Q2.ascending(),messageID:Q.info.id,sessionID:$.sessionID,type:"text",synthetic:!0,text:["<system-reminder>",`Your last ${t9} steps have been identical \u2014 you appear to be`,"repeating the same action without making progress. Stop and reconsider:","the current approach is not working. Try a different strategy, use a","different tool, or if you are blocked, explain the blocker to the user","instead of repeating the same step again.","</system-reminder>"].join(`
|
|
509
509
|
`)})}var e9=s.create({service:"auto-dream"}),$Z=86400000,eK=7,$G=30,mQ=1e4,ZZ="Auto Dream",XZ="Auto Distill",fQ=0,EQ=0,lQ=["Run one automatic dream memory consolidation pass for the current project.","","Use the memory files as the working index and the raw qitqode trajectory database as the source of truth.","Use bash for read-only SQLite and filesystem inspection. Do not modify the database.","Consolidate only durable, verified information into project memory."].join(`
|
|
510
510
|
`),cQ=["Run one automatic distill pass for the current project.","","Review the past month of sessions and identify repeated manual workflows worth packaging.","Use the raw qitqode trajectory database as the source of truth and memory files to spot cross-session patterns.","Inventory existing skills, agents, and commands first so you reuse or extend instead of duplicating.","Use bash for read-only SQLite and filesystem inspection. Do not modify the database.","Produce a compact shortlist, then create only the high-confidence missing assets."].join(`
|
|
511
|
-
`);function oQ($){return Y.gen(function*(){if(!$.enabled)return!1;let Z=$.intervalDays*$Z,X=yield*Y.sync(()=>a2.use((V)=>V.select({time_created:k0.time_created}).from(k0).where(G0(k0.title,$.title)).orderBy(E8(k0.time_created)).limit(1).get())),Q=Date.now(),J=X?Q-X.time_created:1/0;if(!X){let V=yield*Y.sync(()=>a2.use((B)=>B.select({time_created:k0.time_created}).from(k0).where(vQ(k0.parent_id)).orderBy(dQ(k0.time_created)).limit(1).get()));if(!V||Q-V.time_created<Z)return e9.info(`auto-${$.label} skipped \u2014 project too young`,{projectAge:V?Math.round((Q-V.time_created)/$Z)+"d":"empty",interval:$.intervalDays+"d"}),!1}if(J<Z)return e9.info(`auto-${$.label} skipped \u2014 last run too recent`,{lastRunAgo:Math.round(J/$Z)+"d",interval:$.intervalDays+"d"}),!1;return e9.info(`auto-${$.label} triggering`,{lastRun:X?new Date(X.time_created).toISOString():"never",interval:$.intervalDays+"d"}),!0})}function uQ($){let Z=$.dream?.auto!==!1;if(!Z)return Y.succeed(!1);let X=Date.now();if(X-fQ<mQ)return Y.succeed(!1);fQ=X;let Q=$.dream?.interval_days??eK;return oQ({enabled:Z,intervalDays:Q,title:ZZ,label:"dream"})}function pQ($){let Z=$.distill?.auto!==!1;if(!Z)return Y.succeed(!1);let X=Date.now();if(X-EQ<mQ)return Y.succeed(!1);EQ=X;let Q=$.distill?.interval_days??$G;return oQ({enabled:Z,intervalDays:Q,title:XZ,label:"distill"})}var iQ=Y.fnUntraced(function*($){let Z=yield*$.config.get(),X=yield*uQ(Z).pipe(Y.catch(()=>Y.succeed(!1))),Q=yield*pQ(Z).pipe(Y.catch(()=>Y.succeed(!1))),J={providerID:$.lastUser.model.providerID,modelID:$.lastUser.model.modelID};if(!X&&!Q)return;let{AppRuntime:V}=yield*Y.promise(()=>import("./chunk-h6rv626m.js"));if(X)V.runPromise(E2.use((B)=>Y.gen(function*(){let D=yield*B.create({title:ZZ});yield*(yield*$.promptServiceTag).prompt({sessionID:D.id,agent:"dream",model:J,parts:[{type:"text",text:lQ}]})}))).catch((B)=>$.log.error("auto-dream prompt failed",{error:String(B)}));if(Q)V.runPromise(E2.use((B)=>Y.gen(function*(){let D=yield*B.create({title:XZ});yield*(yield*$.promptServiceTag).prompt({sessionID:D.id,agent:"distill",model:J,parts:[{type:"text",text:cQ}]})}))).catch((B)=>$.log.error("auto-distill prompt failed",{error:String(B)}))});var XG=($)=>$.pipe(Y.catchDefect((Z)=>Z instanceof $0.BackendAuthRejectedError?Y.succeed(void 0):Y.die(Z))),YZ=($)=>XG(Y.promise(()=>$0.resolvePrompt($))).pipe(Y.map((Z)=>Z??"")),nQ=Y.gen(function*(){let $=yield*YZ("session/build-switch"),Z=yield*YZ("session/max-steps"),X=yield*YZ("session/compose");return{buildSwitch:$,maxSteps:Z,promptCompose:X}});var sQ=E0.create({service:"session.prompt"}),YG=s.create({service:"session.prompt"});function aQ($,Z,X,Q){return Y.gen(function*(){let{bus:J,status:V,sessions:B,agents:D,provider:H,processor:W,prune:K,checkpoint:j,compaction:G,config:z,plugin:O,permission:P,fsys:w,registry:L,scope:F,instruction:U,state:y,goal:S,taskGateState:I,taskRegistry:M,revert:f,summary:b,sys:k,llm:h,actorRegistry:N,inbox:A}=yield*S4,R=yield*nQ,C=R.buildSwitch,T=R.maxSteps,l=R.promptCompose,d=(t,N2,j2)=>DQ(H,J,t,N2,j2),g=(t,N2)=>OQ(B,t,N2),E=a9(B),m=1024,e=new class extends Set{add(t){if(super.add(t),this.size>1024){let N2=this.values().next().value;if(N2!==void 0)this.delete(N2)}return this}},n=(t)=>o9({getOps:$,...t}),a=qQ({agents:D,provider:H,llm:h,sessions:B,elog:sQ}),H2=NQ({sessions:B,fsys:w,buildSwitch:C,promptCompose:l});return{runLoop:Y.fn("SessionPrompt.run")(function*(t,N2,j2){let g0=yield*v.context,R2=sQ.with({sessionID:t}),X2,q2=0,b2=yield*B.get(t),r2,w0,D0=N2??"main",p0=GQ({sessionID:t,agentID:D0,task_id:j2,plugin:O,bus:J,prune:K,scope:F}),{cancellation:h0,agentMetrics:M$,publishAgentRequest:i0,schedulePrune:n0}=p0,N1=KQ({sessionID:t,agentID:D0,task_id:j2,session:b2,cancellation:h0,plugin:O});return yield*Y.gen(function*(){yield*p0.before;let s0=(t2,Y2)=>g4(sY(t2,Y2,p.parts(Y2.id))),s$=!1,K8=kQ({sessionID:t,bus:J,appendSyntheticUserTurn:E,slog:R2}),f0=SQ({sessionID:t,sessions:B,bus:J,appendSyntheticUserTurn:E,slog:R2}),{autoContinueOutputLength:G8,autoContinueInvalidOutput:_Z,autoRetryStructuredOutput:oV,handleTextRepeat:uV,writeContentFilterError:IZ,writeModelError:RZ}=f0,CZ=FQ({sessionID:t,agentID:N2,agents:D,taskGateState:I,taskRegistry:M,appendSyntheticUserTurn:E,slog:R2}),SZ=PQ({sessionID:t,agentID:N2,session:b2,goal:S,bus:J,appendSyntheticUserTurn:E,slog:R2});while(!0){if(!N2||N2==="main")yield*V.set(t,{type:"busy"});yield*A.drain(t,N2??"main").pipe(Y.ignore),yield*R2.info("loop",{step:q2});let t2=yield*p.filterCompactedEffect(t,{contextFrom:b2.contextFrom,contextWatermark:b2.contextWatermark,agentID:N2??"main"}),Y2,TZ,a0,H7,b0,gZ=[];for(let W2=t2.length-1;W2>=0;W2--){let K0=t2[W2];if(!Y2&&K0.info.role==="user")Y2=K0.info,TZ=K0;if(!a0&&K0.info.role==="assistant")a0=K0.info,H7=K0;if(!b0&&K0.info.role==="assistant"&&K0.info.finish)b0=K0.info;if(Y2&&b0)break;if(!b0){let $6=K0.parts.filter((a$)=>a$.type==="subtask");gZ.push(...$6)}}if(!Y2)throw Error("No user message found in stream. This should never happen.");yield*TQ({sessionID:t,msgs:t2,checkpoint:j,config:z});let nV=H7?.parts.some((W2)=>W2.type==="tool"&&!W2.metadata?.providerExecuted)??!1;if(a0?.finish==="length"&&!nV&&Y2.id<a0.id&&(yield*G8({lastUser:Y2,assistant:a0})))continue;if(a0){let W2=d9({phase:"existing-assistant",lastUser:Y2,assistant:a0,parts:H7?.parts??[]});if(W2.type==="filtered"){yield*IZ({assistant:a0}),yield*R2.info("exiting loop",{classification:W2.type});break}if(W2.type==="failed"){yield*RZ({assistant:a0,reason:W2.reason}),yield*R2.info("exiting loop",{classification:W2.type,reason:W2.reason});break}if(W2.type==="think-only"||W2.type==="invalid"){let K0=W2.type==="invalid"?W2.reason:"think-only";if(yield*_Z({lastUser:Y2,assistant:a0,reason:K0}))continue;yield*R2.info("exiting loop",{classification:W2.type});break}if(W2.type==="final"&&W2.degraded)yield*R2.warn("degraded final on abnormal finish",{finish:a0.finish});if(W2.type!=="continue"){if(yield*CZ(Y2))continue;if(yield*SZ(Y2))continue;yield*R2.info("exiting loop",{classification:W2.type});break}}if(q2++,q2===1)yield*a({session:b2,modelID:Y2.model.modelID,providerID:Y2.model.providerID,history:t2}).pipe(Y.ignore,Y.forkIn(F));if(q2===1&&!b2.parentID)yield*iQ({config:z,lastUser:Y2,promptServiceTag:Q,log:YG});let r0=yield*d(Y2.model.providerID,Y2.model.modelID,t);w0=r0,r2=b0;let hZ=gZ.pop();if(hZ?.type==="subtask"){yield*n({task:hZ,model:r0,lastUser:Y2,sessionID:t,session:b2,msgs:t2});continue}let fZ=TZ;if(fZ?.parts.some((W2)=>W2.type==="compaction")){let W2=fZ.parts.find((a$)=>a$.type==="compaction"),K0=yield*B.messages({sessionID:t,agentID:Y2.agentID??"main"});if((yield*G.process({parentID:Y2.id,messages:K0,sessionID:t,auto:W2?.auto??!1,overflow:W2?.overflow,agentID:Y2.agentID}))==="stop")break;continue}yield*gQ({sessionID:t,msgs:t2,lastFinished:b0,model:r0,config:z}),hQ({sessionID:t,msgs:t2,lastFinished:b0});let _$=yield*D.get(Y2.agent),j7=_$?.native===!0&&_$?.hidden===!0;if(!s$&&!j7&&b0&&b0.tokens){let W2=yield*$();yield*K.fireCheckpoints({sessionID:t,model:r0,tokens:b0.tokens,promptOps:W2,agentID:Y2.agentID}).pipe(Y.ignore)}if(!s$&&b0&&b0.tokens){if(yield*BQ({config:z,checkpoint:j,compaction:G,prune:K},{sessionID:t,lastFinished:b0,lastUser:Y2,model:r0,msgs:t2,isBoundedComputation:j7})){s$=!0;continue}}if(s$=!1,!_$)throw yield*m9(D,J,Y2.agent,t);let sV=_$.steps??1/0,aV=q2>=sV;t2=yield*H2({messages:t2,agent:_$,session:b2});let EZ=E4({sessionID:t,parentID:Y2.id,agentID:Y2.agentID,agent:_$.name,variant:Y2.model.variant,cwd:g0.directory,root:g0.worktree,modelID:r0.id,providerID:r0.providerID});yield*B.updateMessage(EZ);let e2=yield*W.create({assistantMessage:EZ,sessionID:t,model:r0,agentMetrics:M$}),rV=yield*Y.gen(function*(){let W2={value:X2},K0=yield*aY({sessionID:t,resolvedAgentID:D0,step:q2,task_id:j2,lastUser:Y2,lastFinished:b0,msgs:t2,agent:_$,session:b2,model:r0,handle:e2,structured:W2,resolveTools:Z,createStructuredOutputTool:X,summary:b,scope:F,plugin:O}),{tools:$6,format:a$,query:tV}=K0,{cancelledByPlugin:eV,withUserQueryPost:$B}=rY({sessionID:t,agentID:D0,step:q2,lastUser:Y2,msgs:t2,query:tV,handle:e2,plugin:O,sessions:B,cancellation:h0,trajectoryForStep:s0}),ZB=Y.fnUntraced(function*(Z6){if(Z6==="continue"&&(yield*G8({lastUser:Y2,assistant:e2.message})))return"continue";if(Z6==="text-repeat"){if(yield*uV({lastUser:Y2}))return"continue";return"break"}if(W2.value!==void 0)return X2=W2.value,e2.message.structured=W2.value,e2.message.finish=e2.message.finish??"stop",yield*B.updateMessage(e2.message),"break";let B$=d9({phase:"after-process",lastUser:Y2,assistant:e2.message,parts:p.parts(e2.message.id),processResult:Z6});if(B$.type==="filtered")return yield*IZ({assistant:e2.message}),"break";if(B$.type==="failed")return yield*RZ({assistant:e2.message,reason:B$.reason}),"break";if(B$.type!=="continue"&&!e2.message.error&&a$.type==="json_schema"){if(yield*oV({lastUser:Y2,assistant:e2.message}))return"continue";return"break"}if((B$.type==="think-only"||B$.type==="invalid")&&a$.type!=="json_schema"){let XB=B$.type==="invalid"?B$.reason:"think-only";if(yield*_Z({lastUser:Y2,assistant:e2.message,reason:XB}))return"continue";return"break"}if(B$.type==="final"&&B$.degraded)yield*R2.warn("degraded final on abnormal finish",{finish:e2.message.finish});if(Z6==="stop")return"break";return}),D7=yield*QQ({sessionID:t,lastUser:Y2,agent:_$,session:b2,model:r0,msgs:t2,tools:$6,format:a$,handle:e2,isLastStep:aV,task_id:j2,instructionsNotified:e,maxStepsText:T,actorRegistry:N,bus:J,config:z,instruction:U,llm:h,registry:L,status:V,sys:k,cancelledByPlugin:eV,withUserQueryPost:$B,slog:R2});if(D7.kind==="break")return"break";let dZ=yield*ZB(D7.result);if(dZ)return dZ;if(D7.result==="overflow")yield*WQ({config:z,checkpoint:j,compaction:G,prune:K},{sessionID:t,lastUser:Y2,model:r0,msgs:t2,isBoundedComputation:j7});return"continue"}).pipe(Y.ensuring(U.clear(e2.message.id))),vZ=yield*K8.check({lastUser:Y2,completedParts:p.parts(e2.message.id)});if(vZ==="terminate")break;if(vZ==="recovered")continue;if(rV==="break"){if(yield*CZ(Y2))continue;if(yield*SZ(Y2))continue;break}continue}let pV=yield*$();if(w0&&r2)yield*n0({model:w0,lastFinished:r2,promptOps:pV});let e8=yield*g(t,N2),iV=e8.info.role==="assistant"&&!!e8.info.error,kZ=yield*B.findMessage(t,(t2)=>t2.info.role==="user",{agentID:"*"});return yield*i0(iV?"error":"completed",Y0.isSome(kZ)?kZ.value.info.agent:e8.info.agent),e8}).pipe((s0)=>l9(t,J,s0),Y.onExit(N1),Y.orDie)}),lastAssistant:g}})}import rQ from"path";var QG=new TextEncoder,QZ=new TextDecoder,JG=($)=>`
|
|
511
|
+
`);function oQ($){return Y.gen(function*(){if(!$.enabled)return!1;let Z=$.intervalDays*$Z,X=yield*Y.sync(()=>a2.use((V)=>V.select({time_created:k0.time_created}).from(k0).where(G0(k0.title,$.title)).orderBy(E8(k0.time_created)).limit(1).get())),Q=Date.now(),J=X?Q-X.time_created:1/0;if(!X){let V=yield*Y.sync(()=>a2.use((B)=>B.select({time_created:k0.time_created}).from(k0).where(vQ(k0.parent_id)).orderBy(dQ(k0.time_created)).limit(1).get()));if(!V||Q-V.time_created<Z)return e9.info(`auto-${$.label} skipped \u2014 project too young`,{projectAge:V?Math.round((Q-V.time_created)/$Z)+"d":"empty",interval:$.intervalDays+"d"}),!1}if(J<Z)return e9.info(`auto-${$.label} skipped \u2014 last run too recent`,{lastRunAgo:Math.round(J/$Z)+"d",interval:$.intervalDays+"d"}),!1;return e9.info(`auto-${$.label} triggering`,{lastRun:X?new Date(X.time_created).toISOString():"never",interval:$.intervalDays+"d"}),!0})}function uQ($){let Z=$.dream?.auto!==!1;if(!Z)return Y.succeed(!1);let X=Date.now();if(X-fQ<mQ)return Y.succeed(!1);fQ=X;let Q=$.dream?.interval_days??eK;return oQ({enabled:Z,intervalDays:Q,title:ZZ,label:"dream"})}function pQ($){let Z=$.distill?.auto!==!1;if(!Z)return Y.succeed(!1);let X=Date.now();if(X-EQ<mQ)return Y.succeed(!1);EQ=X;let Q=$.distill?.interval_days??$G;return oQ({enabled:Z,intervalDays:Q,title:XZ,label:"distill"})}var iQ=Y.fnUntraced(function*($){let Z=yield*$.config.get(),X=yield*uQ(Z).pipe(Y.catch(()=>Y.succeed(!1))),Q=yield*pQ(Z).pipe(Y.catch(()=>Y.succeed(!1))),J={providerID:$.lastUser.model.providerID,modelID:$.lastUser.model.modelID};if(!X&&!Q)return;let{AppRuntime:V}=yield*Y.promise(()=>import("./chunk-k5atbdbm.js"));if(X)V.runPromise(E2.use((B)=>Y.gen(function*(){let D=yield*B.create({title:ZZ});yield*(yield*$.promptServiceTag).prompt({sessionID:D.id,agent:"dream",model:J,parts:[{type:"text",text:lQ}]})}))).catch((B)=>$.log.error("auto-dream prompt failed",{error:String(B)}));if(Q)V.runPromise(E2.use((B)=>Y.gen(function*(){let D=yield*B.create({title:XZ});yield*(yield*$.promptServiceTag).prompt({sessionID:D.id,agent:"distill",model:J,parts:[{type:"text",text:cQ}]})}))).catch((B)=>$.log.error("auto-distill prompt failed",{error:String(B)}))});var XG=($)=>$.pipe(Y.catchDefect((Z)=>Z instanceof $0.BackendAuthRejectedError?Y.succeed(void 0):Y.die(Z))),YZ=($)=>XG(Y.promise(()=>$0.resolvePrompt($))).pipe(Y.map((Z)=>Z??"")),nQ=Y.gen(function*(){let $=yield*YZ("session/build-switch"),Z=yield*YZ("session/max-steps"),X=yield*YZ("session/compose");return{buildSwitch:$,maxSteps:Z,promptCompose:X}});var sQ=E0.create({service:"session.prompt"}),YG=s.create({service:"session.prompt"});function aQ($,Z,X,Q){return Y.gen(function*(){let{bus:J,status:V,sessions:B,agents:D,provider:H,processor:W,prune:K,checkpoint:j,compaction:G,config:z,plugin:O,permission:P,fsys:w,registry:L,scope:F,instruction:U,state:y,goal:S,taskGateState:I,taskRegistry:M,revert:f,summary:b,sys:k,llm:h,actorRegistry:N,inbox:A}=yield*S4,R=yield*nQ,C=R.buildSwitch,T=R.maxSteps,l=R.promptCompose,d=(t,N2,j2)=>DQ(H,J,t,N2,j2),g=(t,N2)=>OQ(B,t,N2),E=a9(B),m=1024,e=new class extends Set{add(t){if(super.add(t),this.size>1024){let N2=this.values().next().value;if(N2!==void 0)this.delete(N2)}return this}},n=(t)=>o9({getOps:$,...t}),a=qQ({agents:D,provider:H,llm:h,sessions:B,elog:sQ}),H2=NQ({sessions:B,fsys:w,buildSwitch:C,promptCompose:l});return{runLoop:Y.fn("SessionPrompt.run")(function*(t,N2,j2){let g0=yield*v.context,R2=sQ.with({sessionID:t}),X2,q2=0,b2=yield*B.get(t),r2,w0,D0=N2??"main",p0=GQ({sessionID:t,agentID:D0,task_id:j2,plugin:O,bus:J,prune:K,scope:F}),{cancellation:h0,agentMetrics:M$,publishAgentRequest:i0,schedulePrune:n0}=p0,N1=KQ({sessionID:t,agentID:D0,task_id:j2,session:b2,cancellation:h0,plugin:O});return yield*Y.gen(function*(){yield*p0.before;let s0=(t2,Y2)=>g4(sY(t2,Y2,p.parts(Y2.id))),s$=!1,K8=kQ({sessionID:t,bus:J,appendSyntheticUserTurn:E,slog:R2}),f0=SQ({sessionID:t,sessions:B,bus:J,appendSyntheticUserTurn:E,slog:R2}),{autoContinueOutputLength:G8,autoContinueInvalidOutput:_Z,autoRetryStructuredOutput:oV,handleTextRepeat:uV,writeContentFilterError:IZ,writeModelError:RZ}=f0,CZ=FQ({sessionID:t,agentID:N2,agents:D,taskGateState:I,taskRegistry:M,appendSyntheticUserTurn:E,slog:R2}),SZ=PQ({sessionID:t,agentID:N2,session:b2,goal:S,bus:J,appendSyntheticUserTurn:E,slog:R2});while(!0){if(!N2||N2==="main")yield*V.set(t,{type:"busy"});yield*A.drain(t,N2??"main").pipe(Y.ignore),yield*R2.info("loop",{step:q2});let t2=yield*p.filterCompactedEffect(t,{contextFrom:b2.contextFrom,contextWatermark:b2.contextWatermark,agentID:N2??"main"}),Y2,TZ,a0,H7,b0,gZ=[];for(let W2=t2.length-1;W2>=0;W2--){let K0=t2[W2];if(!Y2&&K0.info.role==="user")Y2=K0.info,TZ=K0;if(!a0&&K0.info.role==="assistant")a0=K0.info,H7=K0;if(!b0&&K0.info.role==="assistant"&&K0.info.finish)b0=K0.info;if(Y2&&b0)break;if(!b0){let $6=K0.parts.filter((a$)=>a$.type==="subtask");gZ.push(...$6)}}if(!Y2)throw Error("No user message found in stream. This should never happen.");yield*TQ({sessionID:t,msgs:t2,checkpoint:j,config:z});let nV=H7?.parts.some((W2)=>W2.type==="tool"&&!W2.metadata?.providerExecuted)??!1;if(a0?.finish==="length"&&!nV&&Y2.id<a0.id&&(yield*G8({lastUser:Y2,assistant:a0})))continue;if(a0){let W2=d9({phase:"existing-assistant",lastUser:Y2,assistant:a0,parts:H7?.parts??[]});if(W2.type==="filtered"){yield*IZ({assistant:a0}),yield*R2.info("exiting loop",{classification:W2.type});break}if(W2.type==="failed"){yield*RZ({assistant:a0,reason:W2.reason}),yield*R2.info("exiting loop",{classification:W2.type,reason:W2.reason});break}if(W2.type==="think-only"||W2.type==="invalid"){let K0=W2.type==="invalid"?W2.reason:"think-only";if(yield*_Z({lastUser:Y2,assistant:a0,reason:K0}))continue;yield*R2.info("exiting loop",{classification:W2.type});break}if(W2.type==="final"&&W2.degraded)yield*R2.warn("degraded final on abnormal finish",{finish:a0.finish});if(W2.type!=="continue"){if(yield*CZ(Y2))continue;if(yield*SZ(Y2))continue;yield*R2.info("exiting loop",{classification:W2.type});break}}if(q2++,q2===1)yield*a({session:b2,modelID:Y2.model.modelID,providerID:Y2.model.providerID,history:t2}).pipe(Y.ignore,Y.forkIn(F));if(q2===1&&!b2.parentID)yield*iQ({config:z,lastUser:Y2,promptServiceTag:Q,log:YG});let r0=yield*d(Y2.model.providerID,Y2.model.modelID,t);w0=r0,r2=b0;let hZ=gZ.pop();if(hZ?.type==="subtask"){yield*n({task:hZ,model:r0,lastUser:Y2,sessionID:t,session:b2,msgs:t2});continue}let fZ=TZ;if(fZ?.parts.some((W2)=>W2.type==="compaction")){let W2=fZ.parts.find((a$)=>a$.type==="compaction"),K0=yield*B.messages({sessionID:t,agentID:Y2.agentID??"main"});if((yield*G.process({parentID:Y2.id,messages:K0,sessionID:t,auto:W2?.auto??!1,overflow:W2?.overflow,agentID:Y2.agentID}))==="stop")break;continue}yield*gQ({sessionID:t,msgs:t2,lastFinished:b0,model:r0,config:z}),hQ({sessionID:t,msgs:t2,lastFinished:b0});let _$=yield*D.get(Y2.agent),j7=_$?.native===!0&&_$?.hidden===!0;if(!s$&&!j7&&b0&&b0.tokens){let W2=yield*$();yield*K.fireCheckpoints({sessionID:t,model:r0,tokens:b0.tokens,promptOps:W2,agentID:Y2.agentID}).pipe(Y.ignore)}if(!s$&&b0&&b0.tokens){if(yield*BQ({config:z,checkpoint:j,compaction:G,prune:K},{sessionID:t,lastFinished:b0,lastUser:Y2,model:r0,msgs:t2,isBoundedComputation:j7})){s$=!0;continue}}if(s$=!1,!_$)throw yield*m9(D,J,Y2.agent,t);let sV=_$.steps??1/0,aV=q2>=sV;t2=yield*H2({messages:t2,agent:_$,session:b2});let EZ=E4({sessionID:t,parentID:Y2.id,agentID:Y2.agentID,agent:_$.name,variant:Y2.model.variant,cwd:g0.directory,root:g0.worktree,modelID:r0.id,providerID:r0.providerID});yield*B.updateMessage(EZ);let e2=yield*W.create({assistantMessage:EZ,sessionID:t,model:r0,agentMetrics:M$}),rV=yield*Y.gen(function*(){let W2={value:X2},K0=yield*aY({sessionID:t,resolvedAgentID:D0,step:q2,task_id:j2,lastUser:Y2,lastFinished:b0,msgs:t2,agent:_$,session:b2,model:r0,handle:e2,structured:W2,resolveTools:Z,createStructuredOutputTool:X,summary:b,scope:F,plugin:O}),{tools:$6,format:a$,query:tV}=K0,{cancelledByPlugin:eV,withUserQueryPost:$B}=rY({sessionID:t,agentID:D0,step:q2,lastUser:Y2,msgs:t2,query:tV,handle:e2,plugin:O,sessions:B,cancellation:h0,trajectoryForStep:s0}),ZB=Y.fnUntraced(function*(Z6){if(Z6==="continue"&&(yield*G8({lastUser:Y2,assistant:e2.message})))return"continue";if(Z6==="text-repeat"){if(yield*uV({lastUser:Y2}))return"continue";return"break"}if(W2.value!==void 0)return X2=W2.value,e2.message.structured=W2.value,e2.message.finish=e2.message.finish??"stop",yield*B.updateMessage(e2.message),"break";let B$=d9({phase:"after-process",lastUser:Y2,assistant:e2.message,parts:p.parts(e2.message.id),processResult:Z6});if(B$.type==="filtered")return yield*IZ({assistant:e2.message}),"break";if(B$.type==="failed")return yield*RZ({assistant:e2.message,reason:B$.reason}),"break";if(B$.type!=="continue"&&!e2.message.error&&a$.type==="json_schema"){if(yield*oV({lastUser:Y2,assistant:e2.message}))return"continue";return"break"}if((B$.type==="think-only"||B$.type==="invalid")&&a$.type!=="json_schema"){let XB=B$.type==="invalid"?B$.reason:"think-only";if(yield*_Z({lastUser:Y2,assistant:e2.message,reason:XB}))return"continue";return"break"}if(B$.type==="final"&&B$.degraded)yield*R2.warn("degraded final on abnormal finish",{finish:e2.message.finish});if(Z6==="stop")return"break";return}),D7=yield*QQ({sessionID:t,lastUser:Y2,agent:_$,session:b2,model:r0,msgs:t2,tools:$6,format:a$,handle:e2,isLastStep:aV,task_id:j2,instructionsNotified:e,maxStepsText:T,actorRegistry:N,bus:J,config:z,instruction:U,llm:h,registry:L,status:V,sys:k,cancelledByPlugin:eV,withUserQueryPost:$B,slog:R2});if(D7.kind==="break")return"break";let dZ=yield*ZB(D7.result);if(dZ)return dZ;if(D7.result==="overflow")yield*WQ({config:z,checkpoint:j,compaction:G,prune:K},{sessionID:t,lastUser:Y2,model:r0,msgs:t2,isBoundedComputation:j7});return"continue"}).pipe(Y.ensuring(U.clear(e2.message.id))),vZ=yield*K8.check({lastUser:Y2,completedParts:p.parts(e2.message.id)});if(vZ==="terminate")break;if(vZ==="recovered")continue;if(rV==="break"){if(yield*CZ(Y2))continue;if(yield*SZ(Y2))continue;break}continue}let pV=yield*$();if(w0&&r2)yield*n0({model:w0,lastFinished:r2,promptOps:pV});let e8=yield*g(t,N2),iV=e8.info.role==="assistant"&&!!e8.info.error,kZ=yield*B.findMessage(t,(t2)=>t2.info.role==="user",{agentID:"*"});return yield*i0(iV?"error":"completed",Y0.isSome(kZ)?kZ.value.info.agent:e8.info.agent),e8}).pipe((s0)=>l9(t,J,s0),Y.onExit(N1),Y.orDie)}),lastAssistant:g}})}import rQ from"path";var QG=new TextEncoder,QZ=new TextDecoder,JG=($)=>`
|
|
512
512
|
|
|
513
513
|
[... QitQode truncated ${$} bytes of shell output ...]
|
|
514
514
|
|
|
@@ -539,7 +539,7 @@ ${O}
|
|
|
539
539
|
`).length},NG=Y.fnUntraced(function*($,Z,X){let Q=qG.join(Z,X);if(!(yield*$.exists(Q).pipe(Y.orDie)))return"";let J=yield*$.readFile(Q).pipe(Y.catch(()=>Y.succeed(new Uint8Array)));if(Buffer.from(J).includes(0))return"";return Buffer.from(J).toString("utf8")}),FJ=($)=>new Map($.map((Z)=>[Z.file,{additions:Z.additions,deletions:Z.deletions}])),xG=(...$)=>{let Z=new Map;return $.flat().forEach((X)=>{if(!Z.has(X.file))Z.set(X.file,X)}),[...Z.values()]},BZ=Y.fnUntraced(function*($,Z,X,Q,J,V){let B=Q?yield*Z.prefix(X):"",D=(W,K,j)=>OJ(yJ(W,W,K,j,"","",{context:Number.MAX_SAFE_INTEGER}));return(yield*Y.forEach(J,(W)=>Y.gen(function*(){let K=W.status==="added"||!Q?"":yield*Z.show(X,Q,W.file,B),j=W.status==="deleted"?"":yield*NG($,X,W.file),G=V.get(W.file);return{file:W.file,patch:D(W.file,K,j),additions:G?.additions??(W.status==="added"?DJ(j):0),deletions:G?.deletions??(W.status==="deleted"?DJ(K):0),status:W.status}}),{concurrency:8})).toSorted((W,K)=>W.file.localeCompare(K.file))}),wG=Y.fnUntraced(function*($,Z,X,Q){if(!Q)return yield*BZ($,Z,X,Q,yield*Z.status(X),new Map);let[J,V]=yield*Y.all([Z.status(X),Z.stats(X,Q)],{concurrency:2});return yield*BZ($,Z,X,Q,J,FJ(V))}),bG=Y.fnUntraced(function*($,Z,X,Q){let[J,V,B]=yield*Y.all([Z.diff(X,Q),Z.stats(X,Q),Z.status(X)],{concurrency:3});return yield*BZ($,Z,X,Q,xG(J,B.filter((D)=>D.code==="??")),FJ(V))}),LG=q.enum(["git","branch"]),PJ={BranchUpdated:D2.define("vcs.branch.updated",q.object({branch:q.string().optional()}))},UG=q.object({branch:q.string().optional(),default_branch:q.string().optional()}).meta({ref:"VcsInfo"}),AG=q.object({file:q.string(),patch:q.string(),additions:q.number(),deletions:q.number(),status:q.enum(["added","deleted","modified"]).optional()}).meta({ref:"VcsFileDiff"});class X8 extends Z2.Service()("@qitqode/Vcs"){}var zJ=_.effect(X8,Y.gen(function*(){let $=yield*n2.Service,Z=yield*l$.Service,X=yield*u.Service,Q=yield*d2.Scope,J=yield*v.make(Y.fn("Vcs.state")(function*(V){if(V.project.vcs!=="git")return{current:void 0,root:void 0};let B=Y.fnUntraced(function*(){return yield*Z.branch(V.directory)}),[D,H]=yield*Y.all([Z.branch(V.directory),Z.defaultBranch(V.directory)],{concurrency:2}),W={current:D,root:H};return jJ.info("initialized",{branch:W.current,default_branch:W.root?.name}),yield*X.subscribe(c$.Event.Updated).pipe(c2.filter((K)=>K.properties.file.endsWith("HEAD")),c2.runForEach((K)=>Y.gen(function*(){let j=yield*B();if(j!==W.current)jJ.info("branch changed",{from:W.current,to:j}),W.current=j,yield*X.publish(PJ.BranchUpdated,{branch:j})})),Y.forkScoped),W}));return X8.of({init:Y.fn("Vcs.init")(function*(){yield*v.get(J).pipe(Y.forkIn(Q))}),branch:Y.fn("Vcs.branch")(function*(){return yield*v.use(J,(V)=>V.current)}),defaultBranch:Y.fn("Vcs.defaultBranch")(function*(){return yield*v.use(J,(V)=>V.root?.name)}),diff:Y.fn("Vcs.diff")(function*(V){let B=yield*v.get(J),D=yield*v.context;if(D.project.vcs!=="git")return[];if(V==="git")return yield*wG($,Z,D.directory,(yield*Z.hasHead(D.directory))?"HEAD":void 0);if(!B.root)return[];if(B.current&&B.current===B.root.name)return[];let H=yield*Z.mergeBase(D.directory,B.root.ref);if(!H)return[];return yield*bG($,Z,D.directory,H)})})})),MG=zJ.pipe(_.provide(l$.defaultLayer),_.provide(n2.defaultLayer),_.provide(u.layer));var o$={};L2(o$,{layer:()=>dJ,defaultLayer:()=>dG,Worktree:()=>o$,StartCommandFailedError:()=>fG,Service:()=>X7,ResetInput:()=>hG,ResetFailedError:()=>T0,RemoveInput:()=>gG,RemoveFailedError:()=>q1,NotGitError:()=>Z7,NameGenerationFailedError:()=>EJ,Info:()=>fJ,Event:()=>$7,CreateInput:()=>TG,CreateFailedError:()=>vJ});var A$={};L2(A$,{layer:()=>bJ,defaultLayer:()=>GZ,Service:()=>Q8});var P1=s.create({service:"share-next"}),Y8=process.env.QITQODE_DISABLE_SHARE==="true"||process.env.QITQODE_DISABLE_SHARE==="1",_G=c0.Struct({id:c0.String,url:c0.String,secret:c0.String});class Q8 extends Z2.Service()("@qitqode/ShareNext"){}var WZ=($)=>Y.sync(()=>a2.use($));function wJ($){return{create:`/api/${$}`,sync:(Z)=>`/api/${$}/${Z}/sync`,remove:(Z)=>`/api/${$}/${Z}`,data:(Z)=>`/api/${$}/${Z}/data`}}var IG=wJ("share"),RG=wJ("shares");function qJ($){switch($.type){case"session":return"session";case"message":return`message/${$.data.id}`;case"part":return`part/${$.data.messageID}/${$.data.id}`;case"session_diff":return"session_diff";case"model":return"model"}}var bJ=_.effect(Q8,Y.gen(function*(){let $=yield*d8.Service,Z=yield*u.Service,X=yield*V2.Service,Q=yield*KZ.HttpClient,J=KZ.filterStatusOk(Q),V=yield*P2.Service,B=yield*J2.Service;function D(F,U){return Y.gen(function*(){if(Y8)return;if(!(yield*j(F)))return;let S=yield*v.get(H),I=S.queue.get(F);if(I){for(let f of U)I.set(qJ(f),f);return}let M=new Map(U.map((f)=>[qJ(f),f]));S.queue.set(F,M),yield*G(F).pipe(Y.delay(1000),Y.catchCause((f)=>Y.sync(()=>{P1.error("share flush failed",{sessionID:F,cause:f})})),Y.forkIn(S.scope))})}let H=yield*v.make(Y.fn("ShareNext.state")(function*(F){let U={queue:new Map,scope:yield*d2.make(),shared:new Map};if(yield*Y.addFinalizer(()=>d2.close(U.scope,u2.void).pipe(Y.andThen(Y.sync(()=>{U.queue.clear(),U.shared.clear()})))),Y8)return U;let y=(S,I)=>Z.subscribe(S).pipe(c2.runForEach((M)=>I(M).pipe(Y.catchCause((f)=>Y.sync(()=>{P1.error("share subscriber failed",{type:S.type,cause:f})})))),Y.forkScoped);return yield*y(J2.Event.Updated,(S)=>Y.gen(function*(){let I=yield*B.get(S.properties.sessionID);yield*D(I.id,[{type:"session",data:I}])})),yield*y(p.Event.Updated,(S)=>Y.gen(function*(){let I=S.properties.info;if(yield*D(I.sessionID,[{type:"message",data:I}]),I.role!=="user")return;let M=yield*V.getModel(I.model.providerID,I.model.modelID);yield*D(I.sessionID,[{type:"model",data:[M]}])})),yield*y(p.Event.PartUpdated,(S)=>S.properties.part.type==="compaction"?Y.void:D(S.properties.part.sessionID,[{type:"part",data:S.properties.part}])),yield*y(J2.Event.Diff,(S)=>D(S.properties.sessionID,[{type:"session_diff",data:S.properties.diff}])),yield*y(J2.Event.Deleted,(S)=>L(S.properties.sessionID)),U})),W=Y.fn("ShareNext.request")(function*(){let F={},U=yield*$.active();if(Y0.isNone(U)||!U.value.active_org_id){let S=(yield*X.get()).enterprise?.url??"https://opncd.ai";return{headers:F,api:IG,baseUrl:S}}let y=yield*$.token(U.value.id);if(Y0.isNone(y))throw Error("No active account token available for sharing");return F.authorization=`Bearer ${y.value}`,F["x-org-id"]=U.value.active_org_id,{headers:F,api:RG,baseUrl:U.value.url}}),K=Y.fnUntraced(function*(F){let U=yield*WZ((y)=>y.select().from(z1).where(G0(z1.session_id,F)).get());if(!U)return;return{id:U.id,secret:U.secret,url:U.url}}),j=Y.fnUntraced(function*(F){let U=yield*v.get(H);if(U.shared.has(F)){let S=U.shared.get(F);return S===null?void 0:S}let y=yield*K(F);return U.shared.set(F,y??null),y}),G=Y.fn("ShareNext.flush")(function*(F){if(Y8)return;let U=yield*v.get(H),y=U.queue.get(F);if(!y)return;let S=yield*j(F);if(!S){U.queue.delete(F);return}let I=yield*W(),M=yield*H$.post(`${I.baseUrl}${I.api.sync(S.id)}`).pipe(H$.setHeaders(I.headers),H$.bodyJson({secret:S.secret,data:Array.from(y.values())}),Y.flatMap((f)=>Q.execute(f)));if(M.status>=400){P1.warn("failed to sync share",{sessionID:F,shareID:S.id,status:M.status});return}U.queue.delete(F)}),z=Y.fn("ShareNext.full")(function*(F){P1.info("full sync",{sessionID:F});let U=yield*B.get(F),y=yield*B.diff(F),S=yield*Y.sync(()=>Array.from(p.stream(F,{agentID:"*"}))),I=yield*Y.forEach(Array.from(new Map(S.filter((M)=>M.info.role==="user").map((M)=>M.info.model).map((M)=>[`${M.providerID}/${M.modelID}`,M])).values()),(M)=>V.getModel($1.make(M.providerID),t0.make(M.modelID)),{concurrency:8});yield*D(F,[{type:"session",data:U},...S.map((M)=>({type:"message",data:M.info})),...S.flatMap((M)=>M.parts.filter((f)=>f.type!=="compaction").map((f)=>({type:"part",data:f}))),{type:"session_diff",data:y},{type:"model",data:I}])}),O=Y.fn("ShareNext.init")(function*(){if(Y8)return;yield*v.get(H)}),P=Y.fn("ShareNext.url")(function*(){return(yield*W()).baseUrl}),w=Y.fn("ShareNext.create")(function*(F){if(Y8)return{id:"",url:"",secret:""};P1.info("creating share",{sessionID:F});let U=yield*W(),y=yield*H$.post(`${U.baseUrl}${U.api.create}`).pipe(H$.setHeaders(U.headers),H$.bodyJson({sessionID:F}),Y.flatMap((I)=>J.execute(I)),Y.flatMap(NJ.schemaBodyJson(_G)));yield*WZ((I)=>I.insert(z1).values({session_id:F,id:y.id,secret:y.secret,url:y.url}).onConflictDoUpdate({target:z1.session_id,set:{id:y.id,secret:y.secret,url:y.url}}).run());let S=yield*v.get(H);return S.shared.set(F,y),yield*z(F).pipe(Y.catchCause((I)=>Y.sync(()=>{P1.error("share full sync failed",{sessionID:F,cause:I})})),Y.forkIn(S.scope)),y}),L=Y.fn("ShareNext.remove")(function*(F){if(Y8)return;P1.info("removing share",{sessionID:F});let U=yield*v.get(H),y=yield*j(F);if(!y){U.shared.delete(F),U.queue.delete(F);return}let S=yield*W();yield*H$.delete(`${S.baseUrl}${S.api.remove(y.id)}`).pipe(H$.setHeaders(S.headers),H$.bodyJson({secret:y.secret}),Y.flatMap((I)=>J.execute(I))),yield*WZ((I)=>I.delete(z1).where(G0(z1.session_id,F)).run()),U.shared.delete(F),U.queue.delete(F)});return Q8.of({init:O,url:P,request:W,create:w,remove:L})})),GZ=bJ.pipe(_.provide(u.layer),_.provide(d8.defaultLayer),_.provide(V2.defaultLayer),_.provide(xJ.layer),_.provide(P2.defaultLayer),_.provide(J2.defaultLayer));var n4={};L2(n4,{layer:()=>LJ,defaultLayer:()=>CG,Service:()=>i4});class i4 extends Z2.Service()("@qitqode/SessionShare"){}var LJ=_.effect(i4,Y.gen(function*(){let $=yield*V2.Service,Z=yield*J2.Service,X=yield*Q8,Q=yield*d2.Scope,J=Y.fn("SessionShare.share")(function*(D){if((yield*$.get()).share==="disabled")throw Error("Sharing is disabled in configuration");let W=yield*X.create(D);return yield*Y.sync(()=>A1.run(J2.Event.Updated,{sessionID:D,info:{share:{url:W.url}}})),W}),V=Y.fn("SessionShare.unshare")(function*(D){yield*X.remove(D),yield*Y.sync(()=>A1.run(J2.Event.Updated,{sessionID:D,info:{share:{url:null}}}))}),B=Y.fn("SessionShare.create")(function*(D){let H=yield*Z.create(D);if(H.parentID)return H;let W=yield*$.get();if(!(L0.QITQODE_AUTO_SHARE||W.share==="auto"))return H;return yield*J(H.id).pipe(Y.ignore,Y.forkIn(Q)),H});return i4.of({create:B,share:J,unshare:V})})),CG=LJ.pipe(_.provide(GZ),_.provide(J2.defaultLayer),_.provide(V2.defaultLayer));var SJ=MJ(function*(){s.Default.info("bootstrapping",{directory:S2.directory}),yield*V2.Service.use(($)=>$.get()),yield*K2.Service.use(($)=>$.init()),yield*UJ([J$.Service,A$.Service,J8.Service,V8.Service,c$.Service,X8,z0.Service,RJ,CJ].map(($)=>jZ($.use((Z)=>Z.init())))).pipe(HZ("InstanceBootstrap.init")),yield*y$.Service.use(($)=>$.reconcile()).pipe(_J(($)=>AJ(()=>s.Default.warn("memory reconcile failed",{error:String($)}))),jZ),yield*u.Service.use(($)=>$.subscribeCallback(x0.Event.Executed,async(Z)=>{if(Z.properties.name===x0.Default.INIT)IJ(S2.project.id)})),yield*C2.subscribe()}).pipe(HZ("InstanceBootstrap"));var kG=_.mergeAll(V2.defaultLayer,K2.defaultLayer,A$.defaultLayer,J8.defaultLayer,J$.defaultLayer,V8.defaultLayer,c$.defaultLayer,F1.defaultLayer,z0.defaultLayer,u.defaultLayer,y$.defaultLayer,t4.defaultLayer).pipe(_.provide(a4)),kJ=s4.make(kG,{memoMap:r4});var m8=s.create({service:"worktree"}),$7={Ready:D2.define("worktree.ready",q.object({name:q.string(),branch:q.string()})),Failed:D2.define("worktree.failed",q.object({message:q.string()}))},fJ=q.object({name:q.string(),branch:q.string(),directory:q.string()}).meta({ref:"Worktree"}),TG=q.object({name:q.string().optional(),startCommand:q.string().optional().describe("Additional startup script to run after the project's start command")}).meta({ref:"WorktreeCreateInput"}),gG=q.object({directory:q.string()}).meta({ref:"WorktreeRemoveInput"}),hG=q.object({directory:q.string()}).meta({ref:"WorktreeResetInput"}),Z7=w2.create("WorktreeNotGitError",q.object({message:q.string()})),EJ=w2.create("WorktreeNameGenerationFailedError",q.object({message:q.string()})),vJ=w2.create("WorktreeCreateFailedError",q.object({message:q.string()})),fG=w2.create("WorktreeStartCommandFailedError",q.object({message:q.string()})),q1=w2.create("WorktreeRemoveFailedError",q.object({message:q.string()})),T0=w2.create("WorktreeResetFailedError",q.object({message:q.string()}));function EG($){return $.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+/,"").replace(/-+$/,"")}function vG(...$){return $.filter(Boolean).flatMap((Z)=>Z.split(`
|
|
540
540
|
`).map((X)=>X.trim()).flatMap((X)=>{let Q=X.match(/^warning:\s+failed to remove\s+(.+):\s+/i);if(!Q)return[];let J=Q[1]?.trim().replace(/^['"]|['"]$/g,"");if(!J)return[];return[J]}))}class X7 extends Z2.Service()("@qitqode/Worktree"){}var dJ=_.effect(X7,Y.gen(function*(){let $=yield*d2.Scope,Z=yield*n2.Service,X=yield*TJ.Path,Q=yield*i1.ChildProcessSpawner,J=yield*l$.Service,V=yield*U$.Service,B=Y.fnUntraced(function*(A,R){return yield*hJ(Q,A,R)},Y.catch((A)=>Y.succeed({code:1,text:"",stderr:A instanceof Error?A.message:String(A)}))),D=26,H=Y.fn("Worktree.candidate")(function*(A,R){let C=yield*v.context;for(let T of Array.from({length:26},(l,d)=>d)){let l=R?T===0?R:`${R}-${yZ.create()}`:yZ.create(),d=`qitqode/${l}`,g=X.join(A,l);if(yield*Z.exists(g).pipe(Y.orDie))continue;let E=`refs/heads/${d}`;if((yield*B(["show-ref","--verify","--quiet",E],{cwd:C.worktree})).code===0)continue;return fJ.parse({name:l,branch:d,directory:g})}throw new EJ({message:"Failed to generate a unique worktree name"})}),W=Y.fn("Worktree.makeWorktreeInfo")(function*(A){let R=yield*v.context;if(R.project.vcs!=="git")throw new Z7({message:"Worktrees are only supported for git projects"});let C=X.join(q$.Path.data,"worktree",R.project.id);yield*Z.makeDirectory(C,{recursive:!0}).pipe(Y.orDie);let T=A?EG(A):"";return yield*H(C,T||void 0)}),K=Y.fnUntraced(function*(A){let R=yield*v.context,C=yield*B(["worktree","add","--no-checkout","-b",A.branch,A.directory],{cwd:R.worktree});if(C.code!==0)throw new vJ({message:C.stderr||C.text||"Failed to create git worktree"});yield*V.addSandbox(R.project.id,A.directory).pipe(Y.catch(()=>Y.void))}),j=Y.fnUntraced(function*(A,R){let C=yield*v.context,T=yield*v.workspaceID,l=C.project.id,d=R?.trim(),g=yield*B(["reset","--hard"],{cwd:A.directory});if(g.code!==0){let m=g.stderr||g.text||"Failed to populate worktree";m8.error("worktree checkout failed",{directory:A.directory,message:m}),e4.emit("event",{directory:A.directory,project:C.project.id,workspace:T,payload:{type:$7.Failed.type,properties:{message:m}}});return}if(!(yield*Y.promise(()=>S2.provide({directory:A.directory,init:()=>kJ.runPromise(SJ),fn:()=>{return}}).then(()=>!0).catch((m)=>{let e=O$(m);return m8.error("worktree bootstrap failed",{directory:A.directory,message:e}),e4.emit("event",{directory:A.directory,project:C.project.id,workspace:T,payload:{type:$7.Failed.type,properties:{message:e}}}),!1}))))return;e4.emit("event",{directory:A.directory,project:C.project.id,workspace:T,payload:{type:$7.Ready.type,properties:{name:A.name,branch:A.branch}}}),yield*M(A.directory,{projectID:l,extra:d})}),G=Y.fn("Worktree.createFromInfo")(function*(A,R){yield*K(A),yield*j(A,R)}),z=Y.fn("Worktree.create")(function*(A){let R=yield*W(A?.name);return yield*K(R),yield*j(R,A?.startCommand).pipe(Y.catchCause((C)=>Y.sync(()=>m8.error("worktree bootstrap failed",{cause:C}))),Y.forkIn($)),R}),O=Y.fnUntraced(function*(A){let R=X.resolve(A),C=yield*Z.realPath(R).pipe(Y.catch(()=>Y.succeed(R))),T=X.normalize(C);return process.platform==="win32"?T.toLowerCase():T});function P(A){return A.split(`
|
|
541
541
|
`).map((R)=>R.trim()).reduce((R,C)=>{if(!C)return R;if(C.startsWith("worktree "))return R.push({path:C.slice(9).trim()}),R;let T=R[R.length-1];if(!T)return R;if(C.startsWith("branch "))T.branch=C.slice(7).trim();return R},[])}let w=Y.fnUntraced(function*(A,R){for(let C of A){if(!C.path)continue;if((yield*O(C.path))===R)return C}return});function L(A){return Z.exists(A).pipe(Y.orDie,Y.flatMap((R)=>R?B(["fsmonitor--daemon","stop"],{cwd:A}):Y.void))}function F(A){return Y.promise(()=>import("fs/promises").then((R)=>R.rm(A,{recursive:!0,force:!0,maxRetries:5,retryDelay:100})).catch((R)=>{let C=O$(R);throw new q1({message:C||"Failed to remove git worktree directory"})}))}let U=Y.fn("Worktree.remove")(function*(A){let R=yield*v.context;if(R.project.vcs!=="git")throw new Z7({message:"Worktrees are only supported for git projects"});let C=yield*O(A.directory),T=yield*B(["worktree","list","--porcelain"],{cwd:R.worktree});if(T.code!==0)throw new q1({message:T.stderr||T.text||"Failed to read git worktrees"});let l=P(T.text),d=yield*w(l,C);if(!d?.path){if(!(yield*Z.exists(C).pipe(Y.orDie)))return!0;let e=yield*O(X.join(q$.Path.data,"worktree",R.project.id));if(C!==e&&!C.startsWith(`${e}${X.sep}`))throw new q1({message:"Directory is not a registered or managed worktree"});return yield*L(C),yield*F(C),!0}yield*L(d.path);let g=yield*B(["worktree","remove","--force",d.path],{cwd:R.worktree});if(g.code!==0){let m=yield*B(["worktree","list","--porcelain"],{cwd:R.worktree});if(m.code!==0)throw new q1({message:g.stderr||g.text||m.stderr||m.text||"Failed to remove git worktree"});if((yield*w(P(m.text),C))?.path)throw new q1({message:g.stderr||g.text||"Failed to remove git worktree"})}yield*F(d.path);let E=d.branch?.replace(/^refs\/heads\//,"");if(E){let m=yield*B(["branch","-D",E],{cwd:R.worktree});if(m.code!==0)throw new q1({message:m.stderr||m.text||"Failed to delete worktree branch"})}return!0}),y=Y.fnUntraced(function*(A,R,C){let T=yield*B(A,R);if(T.code!==0)throw C(T);return T}),S=Y.fnUntraced(function*(A,R){let[C,T]=process.platform==="win32"?["cmd",["/c",R]]:["bash",["-lc",R]],l=yield*Q.spawn(n1.make(C,T,{cwd:A,extendEnv:!0,stdin:"ignore"})),[,d]=yield*Y.all([c2.runDrain(l.stdout),c2.mkString(c2.decodeText(l.stderr))],{concurrency:2}).pipe(Y.orDie);return{code:yield*l.exitCode,stderr:d}},Y.scoped,Y.catch(()=>Y.succeed({code:1,stderr:""}))),I=Y.fnUntraced(function*(A,R,C){let T=R.trim();if(!T)return!0;let l=yield*S(A,T);if(l.code===0)return!0;return m8.error("worktree start command failed",{kind:C,directory:A,message:l.stderr}),!1}),M=Y.fnUntraced(function*(A,R){let C=yield*Y.sync(()=>a2.use((g)=>g.select().from(DZ).where(G0(DZ.id,R.projectID)).get())),l=(C?U$.fromRow(C):void 0)?.commands?.start?.trim()??"";if(!(yield*I(A,l,"project")))return!1;return yield*I(A,R.extra??"","worktree"),!0}),f=Y.fnUntraced(function*(A,R){let C=yield*O(A);yield*Y.forEach(R,(T)=>Y.gen(function*(){let l=yield*O(X.resolve(A,T));if(l===C)return;if(!l.startsWith(`${C}${X.sep}`))return;yield*Z.remove(l,{recursive:!0}).pipe(Y.ignore)}),{concurrency:8})}),b=Y.fnUntraced(function*(A){let R=yield*B(["clean","-ffdx"],{cwd:A});if(R.code===0)return R;let C=vG(R.stderr,R.text);if(!C.length)return R;return yield*f(A,C),yield*B(["clean","-ffdx"],{cwd:A})}),k=Y.fn("Worktree.reset")(function*(A){let R=yield*v.context;if(R.project.vcs!=="git")throw new Z7({message:"Worktrees are only supported for git projects"});let C=yield*O(A.directory),T=yield*O(R.worktree);if(C===T)throw new T0({message:"Cannot reset the primary workspace"});let l=yield*B(["worktree","list","--porcelain"],{cwd:R.worktree});if(l.code!==0)throw new T0({message:l.stderr||l.text||"Failed to read git worktrees"});let d=yield*w(P(l.text),C);if(!d?.path)throw new T0({message:"Worktree not found"});let g=d.path,E=yield*J.defaultBranch(R.worktree);if(!E)throw new T0({message:"Default branch not found"});let m=E.ref.indexOf("/");if(E.ref!==E.name&&m>0){let a=E.ref.slice(0,m),H2=E.ref.slice(m+1);yield*y(["fetch",a,H2],{cwd:R.worktree},(I2)=>new T0({message:I2.stderr||I2.text||`Failed to fetch ${E.ref}`}))}yield*y(["reset","--hard",E.ref],{cwd:g},(a)=>new T0({message:a.stderr||a.text||"Failed to reset worktree to target"}));let e=yield*b(g);if(e.code!==0)throw new T0({message:e.stderr||e.text||"Failed to clean worktree"});yield*y(["submodule","update","--init","--recursive","--force"],{cwd:g},(a)=>new T0({message:a.stderr||a.text||"Failed to update submodules"})),yield*y(["submodule","foreach","--recursive","git","reset","--hard"],{cwd:g},(a)=>new T0({message:a.stderr||a.text||"Failed to reset submodules"})),yield*y(["submodule","foreach","--recursive","git","clean","-fdx"],{cwd:g},(a)=>new T0({message:a.stderr||a.text||"Failed to clean submodules"}));let n=yield*B(["-c","core.fsmonitor=false","status","--porcelain=v1"],{cwd:g});if(n.code!==0)throw new T0({message:n.stderr||n.text||"Failed to read git status"});if(n.text.trim())throw new T0({message:`Worktree reset left local changes:
|
|
542
|
-
${n.text.trim()}`});return yield*M(g,{projectID:R.project.id}).pipe(Y.catchCause((a)=>Y.sync(()=>m8.error("worktree start task failed",{cause:a}))),Y.forkIn($)),!0}),h=Y.fn("Worktree.head")(function*(A){return(yield*B(["rev-parse","HEAD"],{cwd:A})).text.trim()}),N=Y.fn("Worktree.isPristine")(function*(A,R){let C=yield*B(["status","--porcelain"],{cwd:A});if(C.code!==0)return!1;if(C.text.trim()!=="")return!1;let T=yield*B(["rev-parse","HEAD"],{cwd:A});return T.code===0&&T.text.trim()===R});return X7.of({makeWorktreeInfo:W,createFromInfo:G,create:z,remove:U,reset:k,head:h,isPristine:N})})),dG=dJ.pipe(_.provide(l$.defaultLayer),_.provide(s1),_.provide(U$.defaultLayer),_.provide(n2.defaultLayer),_.provide(gJ.layer));var u8={};L2(u8,{layer:()=>pJ,defaultLayer:()=>iG,UpdateInput:()=>pG,Service:()=>Y7,Pty:()=>u8,Info:()=>FZ,Event:()=>o8,CreateInput:()=>uG});function mJ($){let Z,X=!1;return()=>{if(X)return Z;return X=!0,Z=$(),Z}}var mG=c0.String.annotate({[cJ]:B8.schema("pty")}).pipe(c0.brand("PtyID")),l8=mG.pipe(lJ(($)=>({ascending:(Z)=>$.make(B8.ascending("pty",Z)),zod:B8.schema("pty").pipe(q.custom())})));var c8=s.create({service:"pty"}),oJ=2097152,uJ=65536,lG=new TextEncoder,OZ=($)=>$.data&&typeof $.data==="object"?$.data:$,cG=($)=>{let Z=JSON.stringify({cursor:$}),X=lG.encode(Z),Q=new Uint8Array(X.length+1);return Q[0]=0,Q.set(X,1),Q},oG=mJ(()=>import("./chunk-
|
|
542
|
+
${n.text.trim()}`});return yield*M(g,{projectID:R.project.id}).pipe(Y.catchCause((a)=>Y.sync(()=>m8.error("worktree start task failed",{cause:a}))),Y.forkIn($)),!0}),h=Y.fn("Worktree.head")(function*(A){return(yield*B(["rev-parse","HEAD"],{cwd:A})).text.trim()}),N=Y.fn("Worktree.isPristine")(function*(A,R){let C=yield*B(["status","--porcelain"],{cwd:A});if(C.code!==0)return!1;if(C.text.trim()!=="")return!1;let T=yield*B(["rev-parse","HEAD"],{cwd:A});return T.code===0&&T.text.trim()===R});return X7.of({makeWorktreeInfo:W,createFromInfo:G,create:z,remove:U,reset:k,head:h,isPristine:N})})),dG=dJ.pipe(_.provide(l$.defaultLayer),_.provide(s1),_.provide(U$.defaultLayer),_.provide(n2.defaultLayer),_.provide(gJ.layer));var u8={};L2(u8,{layer:()=>pJ,defaultLayer:()=>iG,UpdateInput:()=>pG,Service:()=>Y7,Pty:()=>u8,Info:()=>FZ,Event:()=>o8,CreateInput:()=>uG});function mJ($){let Z,X=!1;return()=>{if(X)return Z;return X=!0,Z=$(),Z}}var mG=c0.String.annotate({[cJ]:B8.schema("pty")}).pipe(c0.brand("PtyID")),l8=mG.pipe(lJ(($)=>({ascending:(Z)=>$.make(B8.ascending("pty",Z)),zod:B8.schema("pty").pipe(q.custom())})));var c8=s.create({service:"pty"}),oJ=2097152,uJ=65536,lG=new TextEncoder,OZ=($)=>$.data&&typeof $.data==="object"?$.data:$,cG=($)=>{let Z=JSON.stringify({cursor:$}),X=lG.encode(Z),Q=new Uint8Array(X.length+1);return Q[0]=0,Q.set(X,1),Q},oG=mJ(()=>import("./chunk-0bbs01f0.js")),FZ=q.object({id:l8.zod,title:q.string(),command:q.string(),args:q.array(q.string()),cwd:q.string(),status:q.enum(["running","exited"]),pid:q.number()}).meta({ref:"Pty"}),uG=q.object({command:q.string().optional(),args:q.array(q.string()).optional(),cwd:q.string().optional(),title:q.string().optional(),env:q.record(q.string(),q.string()).optional()}),pG=q.object({title:q.string().optional(),size:q.object({rows:q.number(),cols:q.number()}).optional()}),o8={Created:D2.define("pty.created",q.object({info:FZ})),Updated:D2.define("pty.updated",q.object({info:FZ})),Exited:D2.define("pty.exited",q.object({id:l8.zod,exitCode:q.number()})),Deleted:D2.define("pty.deleted",q.object({id:l8.zod}))};class Y7 extends Z2.Service()("@qitqode/Pty"){}var pJ=_.effect(Y7,Y.gen(function*(){let $=yield*u.Service,Z=yield*K2.Service;function X(G){try{G.process.kill()}catch{}for(let[z,O]of G.subscribers.entries())try{if(OZ(O)===z)O.close()}catch{}G.subscribers.clear()}let Q=yield*v.make(Y.fn("Pty.state")(function*(G){let z={dir:G.directory,sessions:new Map};return yield*Y.addFinalizer(()=>Y.sync(()=>{for(let O of z.sessions.values())X(O);z.sessions.clear()})),z})),J=Y.fn("Pty.remove")(function*(G){let z=yield*v.get(Q),O=z.sessions.get(G);if(!O)return;z.sessions.delete(G),c8.info("removing session",{id:G}),X(O),yield*$.publish(o8.Deleted,{id:O.info.id})}),V=Y.fn("Pty.list")(function*(){let G=yield*v.get(Q);return Array.from(G.sessions.values()).map((z)=>z.info)}),B=Y.fn("Pty.get")(function*(G){return(yield*v.get(Q)).sessions.get(G)?.info}),D=Y.fn("Pty.create")(function*(G){let z=yield*v.get(Q),O=yield*P0.make(),P=l8.ascending(),w=G.command||y1.preferred(),L=G.args||[];if(y1.login(w))L.push("-l");let F=G.cwd||z.dir,U=yield*Z.trigger("shell.env",{cwd:F},{env:{}}),y={...q4(),...G.env,...U.env,TERM:"xterm-256color",QITQODE_TERMINAL:"1"};if(process.platform==="win32")y.LC_ALL="C.UTF-8",y.LC_CTYPE="C.UTF-8",y.LANG="C.UTF-8";c8.info("creating session",{id:P,cmd:w,args:L,cwd:F});let{spawn:S}=yield*Y.promise(()=>oG()),I=yield*Y.sync(()=>S(w,L,{name:"xterm-256color",cwd:F,env:y})),M={id:P,title:G.title||`Terminal ${P.slice(-4)}`,command:w,args:L,cwd:F,status:"running",pid:I.pid},f={info:M,process:I,buffer:"",bufferCursor:0,cursor:0,subscribers:new Map};return z.sessions.set(P,f),I.onData(S2.bind((b)=>{f.cursor+=b.length;for(let[h,N]of f.subscribers.entries()){if(N.readyState!==1){f.subscribers.delete(h);continue}if(OZ(N)!==h){f.subscribers.delete(h);continue}try{N.send(b)}catch{f.subscribers.delete(h)}}if(f.buffer+=b,f.buffer.length<=oJ)return;let k=f.buffer.length-oJ;f.buffer=f.buffer.slice(k),f.bufferCursor+=k})),I.onExit(S2.bind(({exitCode:b})=>{if(f.info.status==="exited")return;c8.info("session exited",{id:P,exitCode:b}),f.info.status="exited",O.fork($.publish(o8.Exited,{id:P,exitCode:b})),O.fork(J(P))})),yield*$.publish(o8.Created,{info:M}),M}),H=Y.fn("Pty.update")(function*(G,z){let P=(yield*v.get(Q)).sessions.get(G);if(!P)return;if(z.title)P.info.title=z.title;if(z.size)P.process.resize(z.size.cols,z.size.rows);return yield*$.publish(o8.Updated,{info:P.info}),P.info}),W=Y.fn("Pty.resize")(function*(G,z,O){let w=(yield*v.get(Q)).sessions.get(G);if(w&&w.info.status==="running")w.process.resize(z,O)}),K=Y.fn("Pty.write")(function*(G,z){let P=(yield*v.get(Q)).sessions.get(G);if(P&&P.info.status==="running")P.process.write(z)}),j=Y.fn("Pty.connect")(function*(G,z,O){let w=(yield*v.get(Q)).sessions.get(G);if(!w){z.close();return}c8.info("client connected to session",{id:G});let L=OZ(z);w.subscribers.delete(L),w.subscribers.set(L,z);let F=()=>{w.subscribers.delete(L)},U=w.bufferCursor,y=w.cursor,S=O===-1?y:typeof O==="number"&&Number.isSafeInteger(O)?Math.max(0,O):0,I=(()=>{if(!w.buffer)return"";if(S>=y)return"";let M=Math.max(0,S-U);if(M>=w.buffer.length)return"";return w.buffer.slice(M)})();if(I)try{for(let M=0;M<I.length;M+=uJ)z.send(I.slice(M,M+uJ))}catch{F(),z.close();return}try{z.send(cG(y))}catch{F(),z.close();return}return{onMessage:(M)=>{w.process.write(typeof M==="string"?M:new TextDecoder().decode(M))},onClose:()=>{c8.info("client disconnected from session",{id:G}),F()}}});return Y7.of({list:V,get:B,create:D,update:H,remove:J,resize:W,write:K,connect:j})})),iG=pJ.pipe(_.provide(u.layer),_.provide(K2.defaultLayer));var n8={};L2(n8,{layer:()=>aJ,defaultLayer:()=>rG,Service:()=>V7,MAX_PRE_REACT:()=>nJ,MAX_POST_REACT:()=>sJ,Actor:()=>n8});var Q7=($,Z,X)=>Y.uninterruptible(Y.gen(function*(){let Q=yield*M2.Service;yield*Q.updateStatus($,Z,{status:"running"}).pipe(Y.ignore);let J=yield*X.pipe(Y.interruptible,Y.exit);if(u2.isSuccess(J))return yield*Q.updateStatus($,Z,{status:"idle",lastOutcome:"success",lastError:void 0}).pipe(Y.ignore),J.value;let V=J.cause,B=G2.hasInterruptsOnly(V);return yield*Q.updateStatus($,Z,{status:"idle",lastOutcome:B?"cancelled":"failure",lastError:B?void 0:nG(V)}).pipe(Y.ignore),yield*Y.failCause(V)}));function nG($){return G2.pretty($)}var J7=s.create({service:"actor.spawn"}),nJ=3,sJ=3,aG=`
|
|
543
543
|
|
|
544
544
|
---
|
|
545
545
|
|
|
@@ -569,7 +569,7 @@ This format lets the spawning agent and the checkpoint writer extract your progr
|
|
|
569
569
|
`).join(""))});return u$.set($,Q),Q.finally(()=>{if(u$.get($)===Q)u$.delete($)})}var VH=/^wf_[0-9A-Za-z]+$/,BV=($)=>{if(!VH.test($))throw Error(`invalid workflow runID: ${JSON.stringify($)}`);return $},WV=($)=>xZ.join(s8(),`${BV($)}.js`),wZ=($)=>xZ.join(s8(),`${BV($)}.jsonl`);function KV($){return{runID:$.id,sessionID:$.session_id,name:$.name,status:$.status,running:$.running,succeeded:$.succeeded,failed:$.failed,...$.current_phase?{currentPhase:$.current_phase}:{},...$.parent_actor_id?{parentActorID:$.parent_actor_id}:{},...$.args!==null&&$.args!==void 0?{args:$.args}:{},...$.script_sha?{scriptSha:$.script_sha}:{},...$.agent_timeout_ms!==null&&$.agent_timeout_ms!==void 0?{agentTimeoutMs:$.agent_timeout_ms}:{},...$.error?{error:$.error}:{},createdAt:$.time_created,updatedAt:$.time_updated}}var BH=($)=>Y.sync(()=>a2.use((Z)=>Z.insert(j0).values({id:$.runID,session_id:$.sessionID,name:$.name,status:"running",running:0,succeeded:0,failed:0,parent_actor_id:$.parentActorID??null,args:$.args??null,script_sha:$.scriptSha??null,agent_timeout_ms:$.agentTimeoutMs??null}).onConflictDoUpdate({target:j0.id,set:{status:"running",running:0,succeeded:0,failed:0,script_sha:$.scriptSha??null,...$.agentTimeoutMs!==void 0?{agent_timeout_ms:$.agentTimeoutMs}:{}}}).run())),WH=($)=>Y.sync(()=>a2.use((Z)=>Z.update(j0).set({current_phase:$.phase}).where(G0(j0.id,$.runID)).run())),KH=($)=>Y.sync(()=>a2.use((Z)=>Z.update(j0).set({running:$.running,succeeded:$.succeeded,failed:$.failed}).where(G0(j0.id,$.runID)).run())),GH=($)=>Y.sync(()=>a2.use((Z)=>Z.update(j0).set({status:$.status,...$.error?{error:$.error}:{}}).where(G0(j0.id,$.runID)).run())),HH=($)=>Y.sync(()=>a2.use((Z)=>{return(($?.sessionID)?Z.select().from(j0).where(G0(j0.session_id,$.sessionID)).orderBy(E8(j0.time_created)).all():Z.select().from(j0).orderBy(E8(j0.time_created)).all()).map(KV)})),jH=($)=>Y.sync(()=>a2.use((Z)=>{let X=Z.select().from(j0).where(G0(j0.id,$)).get();return X?KV(X):void 0})),DH=($,Z)=>Y.promise(async()=>{await(await import("fs/promises")).mkdir(s8(),{recursive:!0}),await Bun.write(WV($),Z)}),yH=($)=>Y.promise(()=>Bun.file(WV($)).text()),OH=($,Z)=>Y.promise(()=>VV($,[Z])),FH=($,Z)=>Y.promise(()=>VV($,Z)),PH=($)=>Y.promise(async()=>{let Z=Bun.file(wZ($));if(!await Z.exists())return{results:new Map,pass:1};let X=await Z.text(),Q=new Map,J=0;for(let V of X.split(`
|
|
570
570
|
`)){if(!V)continue;let B;try{B=JSON.parse(V)}catch{continue}if(typeof B.pass==="number"&&B.pass>J)J=B.pass;if(B.t==="agent")Q.set(B.key,B.result)}return{results:Q,pass:J+1}}),zH=($)=>Y.promise(async()=>{let X=(u$.get($)??Promise.resolve()).catch(()=>{}).then(async()=>{await(await import("fs/promises")).mkdir(s8(),{recursive:!0}),await Bun.write(wZ($),"")});u$.set($,X);try{await X}finally{if(u$.get($)===X)u$.delete($)}}),v2={recordStart:BH,recordPhase:WH,flushCounters:KH,recordTerminal:GH,list:HH,load:jH,writeScript:DH,readScript:yH,appendJournal:OH,appendJournalSync:FH,loadJournal:PH,clearJournal:zH};class bZ{#$=new Map;get($){return this.#$.get($)}set($){return this.#$.set($.runID,$),$}values(){return this.#$.values()}clear(){this.#$.clear()}}function GV($){let Z=(V)=>Y.gen(function*(){if(V.status!=="running")return;if(yield*X(V),yield*$.flushNow(V),yield*v2.recordTerminal({runID:V.runID,status:"cancelled"}).pipe(Y.ignore),V.fiber)yield*i8.interrupt(V.fiber);V.status="cancelled",yield*$.bus.publish(B7,{sessionID:V.sessionID,runID:V.runID,status:"cancelled"}),yield*k2.succeed(V.deferred,{status:"cancelled"})}).pipe(Y.provideService(I0,V.instance)),X=(V)=>Y.gen(function*(){let B=Q$.current;if(B)yield*Y.forEach([...V.childActorIDs],(D)=>B.cancel(V.sessionID,D,"graceful").pipe(Y.ignore),{concurrency:"unbounded",discard:!0});yield*Y.forEach([...V.worktrees],(D)=>$.worktree.remove({directory:D}).pipe(Y.ignore),{concurrency:"unbounded",discard:!0}),V.worktrees.clear(),yield*Y.forEach([...V.childRunIDs],(D)=>Y.gen(function*(){let H=$.runs.get(D);if(H&&H.status==="running")yield*Z(H)}).pipe(Y.ignore),{concurrency:"unbounded",discard:!0})}).pipe(Y.provideService(I0,V.instance));return{reclaim:X,cancelEntry:Z,complete:(V)=>Y.gen(function*(){if(V.entry.status="completed",yield*$.flushNow(V.entry),yield*v2.recordTerminal({runID:V.entry.runID,status:"completed"}).pipe(Y.ignore),yield*$.bus.publish(B7,{sessionID:V.sessionID,runID:V.entry.runID,status:"completed"}),V.notifyOnTerminal!==!1)yield*$.inbox.send({receiverSessionID:V.sessionID,receiverActorID:V.parentActorID,senderSessionID:V.sessionID,senderActorID:"workflow",type:"actor_notification",content:`Workflow completed. run_id: ${V.entry.runID}
|
|
571
571
|
`+JSON.stringify(V.result??null).slice(0,4000)}).pipe(Y.ignore);yield*k2.succeed(V.entry.deferred,{status:"completed",result:V.result})}).pipe(Y.provideService(I0,V.entry.instance)),fail:(V)=>Y.gen(function*(){if(yield*X(V.entry),V.entry.status="failed",yield*$.flushNow(V.entry),yield*v2.recordTerminal({runID:V.entry.runID,status:"failed",error:V.error}).pipe(Y.ignore),yield*$.bus.publish(B7,{sessionID:V.sessionID,runID:V.entry.runID,status:"failed",error:V.error}),V.notifyOnTerminal!==!1)yield*$.inbox.send({receiverSessionID:V.sessionID,receiverActorID:V.parentActorID,senderSessionID:V.sessionID,senderActorID:"workflow",type:"actor_notification",content:`Workflow failed. run_id: ${V.entry.runID}
|
|
572
|
-
error: ${V.error}`}).pipe(Y.ignore);yield*k2.succeed(V.entry.deferred,{status:"failed",error:V.error})}).pipe(Y.provideService(I0,V.entry.instance))}}import qH from"os";function LZ($){let Z=0,X=[],Q=()=>{Z--;let J=X.shift();if(J)J()};return{run(J){return new Promise((V,B)=>{let D=()=>{Z++,J().then((H)=>{Q(),V(H)},(H)=>{Q(),B(H)})};if(Z<$)D();else X.push(D)})}}}function HV(){let $=qH.cpus().length;return Math.min(16,2*Math.max(1,$>0?$:4))}function jV($,Z){return Y.gen(function*(){if(Z)yield*v2.clearJournal($).pipe(Y.ignore);let X=yield*v2.loadJournal($);return{results:X.results,pass:X.pass,occurrences:new Map}})}function DV($,Z){let X=$.occurrences.get(Z)??0;return $.occurrences.set(Z,X+1),Z+":"+X}function yV($,Z,X,Q){return v2.appendJournalSync($,[{t:"agent",key:X,result:Q,pass:Z.pass}]).pipe(Y.ignore)}var OV=Symbol("straggler-timeout");function PV($){let Z=(H,W,K,j)=>{let G=W.timeoutMs??$.runAgentTimeoutMs;if(!G||G<=0)return K;return Y.raceFirst(K,Y.sleep(`${G} millis`).pipe(Y.as(OV))).pipe(Y.flatMap((z)=>z===OV?Y.gen(function*(){let O=$.getActor();if(O)yield*O.cancel($.sessionID,H,"graceful").pipe(Y.ignore);return yield*Y.sync(()=>{try{j?.()}catch{}}),null}):Y.succeed(z)))},X=(H,W,K={})=>{try{$.bridge.fork($.bus.publish(XV,{sessionID:$.sessionID,runID:$.runID,actorID:K.actorID,agentType:H.agentType??"general",label:H.label,phase:H.phase??$.entry.currentPhase,reason:W,errorMessage:K.errorMessage}).pipe(Y.ignore))}catch{}},Q=(H)=>H.label?H.phase?`[${H.phase}] ${H.label}`:H.label:H.phase?`[${H.phase}]`:void 0,J=(H,W,K)=>({mode:"subagent",sessionID:$.sessionID,agentType:H.agentType??"general",description:Q(H),task:W,context:"none",tools:H.tools?[...H.tools]:"INHERIT",background:!0,parentActorID:$.parentActorID,model:K,onActorID:(j)=>$.entry.childActorIDs.add(j),...H.schema?{format:{type:"json_schema",schema:H.schema,retryCount:2}}:{}}),V=async(H,W,K,j)=>{$.entry.running++,$.scheduleFlush($.entry);let G="actor-error",z,O,P=await $.bridge.promise(Y.gen(function*(){let w=yield*H.spawn(J(K,W,j));z=w.actorID;let L=yield*Z(w.actorID,K,k2.await(w.outcome).pipe(Y.map((F)=>{if(F.status!=="success")return G="actor-error",O=F.error,null;let U=K.schema?F.structured??null:F.structured??F.finalText??null;if(U===null)G="no-deliverable";return U})),()=>{G="timeout"});return $.entry.childActorIDs.delete(w.actorID),L})).catch((w)=>{return G="spawn-reject",O=w instanceof Error?w.message:String(w),null});if($.entry.running--,P!==null)$.entry.succeeded++;else $.entry.failed++,X(K,G,{actorID:z,errorMessage:O});return $.scheduleFlush($.entry),P},B=async(H,W,K,j)=>{let G="actor-error",z,O,P=await $.bridge.promise(Y.gen(function*(){let b=yield*$.worktree.makeWorktreeInfo();return yield*$.worktree.createFromInfo(b),b})).catch((b)=>{return O=b instanceof Error?b.message:String(b),null});if(!P)return X(K,"spawn-reject",{errorMessage:O}),null;$.entry.worktrees.add(P.directory);let w=await $.bridge.promise($.worktree.head(P.directory)).catch(()=>""),L=await S2.provide({directory:P.directory,fn:()=>Promise.resolve(S2.current)}),F=await $.bridge.promise(FV().pipe(Y.provideService(I0,L)));$.entry.running++,$.scheduleFlush($.entry);let U=await S2.provide({directory:P.directory,fn:()=>F.promise(Y.gen(function*(){let b=yield*H.spawn(J(K,W,j));z=b.actorID;let k=yield*Z(b.actorID,K,k2.await(b.outcome),()=>{G="timeout"});if($.entry.childActorIDs.delete(b.actorID),k===null)return null;if(k.status!=="success")G="actor-error",O=k.error;return{actorID:b.actorID,outcome:k}})).catch((b)=>{return G="spawn-reject",O=b instanceof Error?b.message:String(b),null})}).catch((b)=>{return G="spawn-reject",O=b instanceof Error?b.message:String(b),null}),y=!!U&&U.outcome.status==="success";if($.entry.running--,y)$.entry.succeeded++;else $.entry.failed++,X(K,G,{actorID:z,errorMessage:O});$.scheduleFlush($.entry);let S=U&&U.outcome.status==="success"?K.schema?U.outcome.structured??null:U.outcome.structured??U.outcome.finalText??null:null,I=w!==""&&await $.bridge.promise($.worktree.isPristine(P.directory,w)).catch(()=>!1);if(!(y&&!I))return await $.bridge.promise($.worktree.remove({directory:P.directory})).catch(()=>{return}),$.entry.worktrees.delete(P.directory),y?S:null;let f={branch:P.branch,directory:P.directory,changed:!0};if(S&&typeof S==="object"&&!Array.isArray(S))return{...S,_worktree:f};return{_worktree:f,result:S}},D=async(H,W,K)=>{if($.entry.agentCount>=$.lifecycleCap)return $.warnCapOnce(),X(H,"over-cap"),null;$.entry.agentCount++;let j=$.getActor();if(!j)throw Error("Actor service unavailable");let G=await $.bridge.promise($.resolveAgentModel(H.model,$.defaultModel,$.entry.warnedModelRefs));return K(j,W,H,G)};return(H,W)=>{let K=W??{},j=String(H);if(K.isolation!=="worktree"){let G=JV(j,{agentType:K.agentType,model:K.model,schema:K.schema,phase:K.phase}),z=DV($.journal,G);if($.journal.results.has(z))return $.entry.succeeded++,$.scheduleFlush($.entry),Promise.resolve($.journal.results.get(z));return(async()=>{let O=await $.semaphore.run(async()=>$.globalSemaphore.run(async()=>D(K,j,V)));if(O!==null)await Y.runPromise(yV($.runID,$.journal,z,O));return O})()}return $.semaphore.run(async()=>$.globalSemaphore.run(async()=>D(K,j,B)))}}async function zV($){let Z=UZ(await $),[X,Q,{QuickJSWASMModule:J}]=await Promise.all([Z.importModuleLoader().then(UZ),Z.importFFI(),import("./chunk-
|
|
572
|
+
error: ${V.error}`}).pipe(Y.ignore);yield*k2.succeed(V.entry.deferred,{status:"failed",error:V.error})}).pipe(Y.provideService(I0,V.entry.instance))}}import qH from"os";function LZ($){let Z=0,X=[],Q=()=>{Z--;let J=X.shift();if(J)J()};return{run(J){return new Promise((V,B)=>{let D=()=>{Z++,J().then((H)=>{Q(),V(H)},(H)=>{Q(),B(H)})};if(Z<$)D();else X.push(D)})}}}function HV(){let $=qH.cpus().length;return Math.min(16,2*Math.max(1,$>0?$:4))}function jV($,Z){return Y.gen(function*(){if(Z)yield*v2.clearJournal($).pipe(Y.ignore);let X=yield*v2.loadJournal($);return{results:X.results,pass:X.pass,occurrences:new Map}})}function DV($,Z){let X=$.occurrences.get(Z)??0;return $.occurrences.set(Z,X+1),Z+":"+X}function yV($,Z,X,Q){return v2.appendJournalSync($,[{t:"agent",key:X,result:Q,pass:Z.pass}]).pipe(Y.ignore)}var OV=Symbol("straggler-timeout");function PV($){let Z=(H,W,K,j)=>{let G=W.timeoutMs??$.runAgentTimeoutMs;if(!G||G<=0)return K;return Y.raceFirst(K,Y.sleep(`${G} millis`).pipe(Y.as(OV))).pipe(Y.flatMap((z)=>z===OV?Y.gen(function*(){let O=$.getActor();if(O)yield*O.cancel($.sessionID,H,"graceful").pipe(Y.ignore);return yield*Y.sync(()=>{try{j?.()}catch{}}),null}):Y.succeed(z)))},X=(H,W,K={})=>{try{$.bridge.fork($.bus.publish(XV,{sessionID:$.sessionID,runID:$.runID,actorID:K.actorID,agentType:H.agentType??"general",label:H.label,phase:H.phase??$.entry.currentPhase,reason:W,errorMessage:K.errorMessage}).pipe(Y.ignore))}catch{}},Q=(H)=>H.label?H.phase?`[${H.phase}] ${H.label}`:H.label:H.phase?`[${H.phase}]`:void 0,J=(H,W,K)=>({mode:"subagent",sessionID:$.sessionID,agentType:H.agentType??"general",description:Q(H),task:W,context:"none",tools:H.tools?[...H.tools]:"INHERIT",background:!0,parentActorID:$.parentActorID,model:K,onActorID:(j)=>$.entry.childActorIDs.add(j),...H.schema?{format:{type:"json_schema",schema:H.schema,retryCount:2}}:{}}),V=async(H,W,K,j)=>{$.entry.running++,$.scheduleFlush($.entry);let G="actor-error",z,O,P=await $.bridge.promise(Y.gen(function*(){let w=yield*H.spawn(J(K,W,j));z=w.actorID;let L=yield*Z(w.actorID,K,k2.await(w.outcome).pipe(Y.map((F)=>{if(F.status!=="success")return G="actor-error",O=F.error,null;let U=K.schema?F.structured??null:F.structured??F.finalText??null;if(U===null)G="no-deliverable";return U})),()=>{G="timeout"});return $.entry.childActorIDs.delete(w.actorID),L})).catch((w)=>{return G="spawn-reject",O=w instanceof Error?w.message:String(w),null});if($.entry.running--,P!==null)$.entry.succeeded++;else $.entry.failed++,X(K,G,{actorID:z,errorMessage:O});return $.scheduleFlush($.entry),P},B=async(H,W,K,j)=>{let G="actor-error",z,O,P=await $.bridge.promise(Y.gen(function*(){let b=yield*$.worktree.makeWorktreeInfo();return yield*$.worktree.createFromInfo(b),b})).catch((b)=>{return O=b instanceof Error?b.message:String(b),null});if(!P)return X(K,"spawn-reject",{errorMessage:O}),null;$.entry.worktrees.add(P.directory);let w=await $.bridge.promise($.worktree.head(P.directory)).catch(()=>""),L=await S2.provide({directory:P.directory,fn:()=>Promise.resolve(S2.current)}),F=await $.bridge.promise(FV().pipe(Y.provideService(I0,L)));$.entry.running++,$.scheduleFlush($.entry);let U=await S2.provide({directory:P.directory,fn:()=>F.promise(Y.gen(function*(){let b=yield*H.spawn(J(K,W,j));z=b.actorID;let k=yield*Z(b.actorID,K,k2.await(b.outcome),()=>{G="timeout"});if($.entry.childActorIDs.delete(b.actorID),k===null)return null;if(k.status!=="success")G="actor-error",O=k.error;return{actorID:b.actorID,outcome:k}})).catch((b)=>{return G="spawn-reject",O=b instanceof Error?b.message:String(b),null})}).catch((b)=>{return G="spawn-reject",O=b instanceof Error?b.message:String(b),null}),y=!!U&&U.outcome.status==="success";if($.entry.running--,y)$.entry.succeeded++;else $.entry.failed++,X(K,G,{actorID:z,errorMessage:O});$.scheduleFlush($.entry);let S=U&&U.outcome.status==="success"?K.schema?U.outcome.structured??null:U.outcome.structured??U.outcome.finalText??null:null,I=w!==""&&await $.bridge.promise($.worktree.isPristine(P.directory,w)).catch(()=>!1);if(!(y&&!I))return await $.bridge.promise($.worktree.remove({directory:P.directory})).catch(()=>{return}),$.entry.worktrees.delete(P.directory),y?S:null;let f={branch:P.branch,directory:P.directory,changed:!0};if(S&&typeof S==="object"&&!Array.isArray(S))return{...S,_worktree:f};return{_worktree:f,result:S}},D=async(H,W,K)=>{if($.entry.agentCount>=$.lifecycleCap)return $.warnCapOnce(),X(H,"over-cap"),null;$.entry.agentCount++;let j=$.getActor();if(!j)throw Error("Actor service unavailable");let G=await $.bridge.promise($.resolveAgentModel(H.model,$.defaultModel,$.entry.warnedModelRefs));return K(j,W,H,G)};return(H,W)=>{let K=W??{},j=String(H);if(K.isolation!=="worktree"){let G=JV(j,{agentType:K.agentType,model:K.model,schema:K.schema,phase:K.phase}),z=DV($.journal,G);if($.journal.results.has(z))return $.entry.succeeded++,$.scheduleFlush($.entry),Promise.resolve($.journal.results.get(z));return(async()=>{let O=await $.semaphore.run(async()=>$.globalSemaphore.run(async()=>D(K,j,V)));if(O!==null)await Y.runPromise(yV($.runID,$.journal,z,O));return O})()}return $.semaphore.run(async()=>$.globalSemaphore.run(async()=>D(K,j,B)))}}async function zV($){let Z=UZ(await $),[X,Q,{QuickJSWASMModule:J}]=await Promise.all([Z.importModuleLoader().then(UZ),Z.importFFI(),import("./chunk-zy9w1vkc.js").then(UZ)]),V=await X();V.type="sync";let B=new Q(V);return new J(V,B)}function UZ($){return $&&"default"in $&&$.default?$.default&&"default"in $.default&&$.default.default?$.default.default:$.default:$}function qV($){let Z=typeof $=="number"?$:$.getTime();return function(){return Date.now()>Z}}var NH={type:"sync",importFFI:()=>import("./chunk-xthkjax9.js").then(($)=>$.QuickJSFFI),importModuleLoader:()=>import("./chunk-pp6vhqrr.js").then(($)=>$.default)},NV=NH;var xH=zV(NV),xV=43200000,wH=67108864,bH=2654435769,LH=`
|
|
573
573
|
globalThis.parallel = (thunks) =>
|
|
574
574
|
Promise.all(thunks.map((t) => Promise.resolve().then(t)));
|
|
575
575
|
globalThis.pipeline = (items, ...stages) =>
|
|
@@ -613,4 +613,4 @@ globalThis.URL = class URL {
|
|
|
613
613
|
${$}
|
|
614
614
|
})()`,O=V.evalCode(z);if(O.error){let h=V.dump(O.error);throw O.error.dispose(),Error(`workflow script error: ${typeof h==="string"?h:JSON.stringify(h)}`)}let P=H(O.value),w=1,L=50,F=50,U,y=0,S=()=>{if(J.hasPendingJob())J.executePendingJobs(),y=0;else y++;U=setTimeout(S,y<F?w:L)};U=setTimeout(S,w);let I,M=Date.now()+(X.deadlineMs??xV),f=new Promise((h,N)=>{let A=()=>{if(X.signal?.aborted){N(Error("workflow script aborted"));return}if(Date.now()>=M){N(Error("workflow script deadline exceeded"));return}I=setTimeout(A,5)};I=setTimeout(A,5)}),b,k=new Promise((h,N)=>{if(!X.signal)return;if(X.signal.aborted)return N(Error("workflow script aborted"));if(b=()=>N(Error("workflow script aborted")),X.signal.addEventListener("abort",b,{once:!0}),X.signal.aborted)b()});try{W7("resolve begin");let h=await Promise.race([V.resolvePromise(P),f,k]);if(W7("resolve end"),h.error){let A=V.dump(h.error);throw h.error.dispose(),Error(`workflow script rejected: ${typeof A==="string"?A:JSON.stringify(A)}`)}let N=H(h.value);return V.dump(N)}finally{if(clearTimeout(U),clearTimeout(I),b&&X.signal)X.signal.removeEventListener("abort",b)}}finally{for(let W of D)if(W.alive)W.dispose();for(let W of B)if(W.alive)W.dispose();V.dispose(),J.dispose()}}function UH($,Z,X,Q){for(let[J,V]of Object.entries(Z)){let B=$.newFunction(J,(...D)=>{let H=D.map((K)=>$.dump(K)),W=V(...H);if(W instanceof Promise){let K=$.newPromise();return Q.push(K),W.then((j)=>{if(!$.alive)return;let G=AZ($,j);K.resolve(G),G.dispose(),$.runtime.executePendingJobs()},(j)=>{if(!$.alive)return;let G=$.newString(j instanceof Error?j.message:String(j));K.reject(G),G.dispose(),$.runtime.executePendingJobs()}),K.settled.then(()=>{if($.alive)$.runtime.executePendingJobs()}),K.handle}return AZ($,W)});$.setProp($.global,J,X(B))}}function AZ($,Z){if(Z===void 0||Z===null)return $.undefined;if(typeof Z==="string")return $.newString(Z);if(typeof Z==="number")return $.newNumber(Z);if(typeof Z==="boolean")return Z?$.true:$.false;let X=$.newString(JSON.stringify(Z));try{let Q=$.evalCode("JSON.parse"),J=$.unwrapResult(Q),V=$.callFunction(J,$.undefined,X);return J.dispose(),$.unwrapResult(V)}finally{X.dispose()}}import i$ from"path";import{lstat as AH,realpath as MH}from"fs/promises";async function bV($){let Z=$;while(!0)try{await AH(Z);break}catch{let Q=i$.dirname(Z);if(Q===Z)break;Z=Q}let X=await MH(Z);return i$.resolve(X,i$.relative(Z,$))}async function p$($,Z){let X=i$.resolve($,Z),[Q,J]=await Promise.all([bV(i$.resolve($)),bV(X)]);if(!V$.contains($,X)||!V$.contains(Q,J))throw Error(`workspace path escapes the workspace root: ${JSON.stringify(Z)}`);return X}function UV($){return{async readFile(Z){let X=await p$($,String(Z));if(!await V$.exists(X))return null;return V$.readText(X)},async writeFile(Z,X){let Q=await p$($,String(Z));await V$.write(Q,String(X))},async exists(Z){let X=await p$($,String(Z));return V$.exists(X)},async glob(Z){let X=await LV.scan(String(Z),{cwd:$,absolute:!0,include:"all",dot:!0});return(await Promise.all(X.map(async(J)=>{let V=i$.relative($,J);if(V===""||V===".."||V.startsWith(`..${i$.sep}`)||i$.isAbsolute(V))return;try{return await p$($,V),V}catch{return}}))).filter((J)=>J!==void 0).sort()}}}function AV($){let Z=UV($.workspaceRoot),X={...$.hooks,readFile:Z.readFile,writeFile:Z.writeFile,glob:Z.glob,exists:Z.exists};return{hooks:X,evaluate:(Q,J)=>wV(Q,X,{...J,signal:J.signal})}}import{createHash as _H}from"crypto";function _V($){return Y.fn("WorkflowRuntime.resume")(function*(Z){let X=yield*Y.promise(()=>MV.write("workflow-resume:"+Z.runID));return yield*Y.gen(function*(){let Q=$.runs.get(Z.runID);if(Q&&Q.status==="running")return{runID:Z.runID,resumed:!1};let J=yield*v2.load(Z.runID);if(!J)return{runID:Z.runID,resumed:!1};let V=yield*v2.readScript(Z.runID).pipe(Y.exit),B=u2.isSuccess(V)?V.value:"";if(!B)return{runID:Z.runID,resumed:!1};let D=_H("sha256").update(B).digest("hex"),H=J.scriptSha!==D;return yield*$.launch({script:B,sessionID:J.sessionID,parentActorID:J.parentActorID??"main",args:J.args,freshJournal:H,agentTimeoutMs:Z.agentTimeoutMs??J.agentTimeoutMs},Z.runID,J.name),{runID:Z.runID,resumed:!0}}).pipe(Y.ensuring(Y.sync(()=>X[Symbol.dispose]())))})}import{createHash as CV}from"crypto";import IV from"path";var IH=/export\s+const\s+meta\s*=/;function a8($){return IH.test($)}var RH=/^[A-Za-z0-9._-]+$/;async function RV($,Z,X){if(!RH.test($))throw Error(`invalid workflow name: ${JSON.stringify($)}`);let Q=[".qitqode/workflows",".claude/workflows"];for(let J of await CH($,Q,Z,X))return V$.readText(J);return null}async function CH($,Z,X,Q){if(!V$.contains(Q,X))return[];let J=[],V=X;for(;;){for(let D of Z){let H=IV.join(V,D,`${$}.js`);if(await V$.exists(H))J.push(H)}if(V===Q)break;let B=IV.dirname(V);if(B===V)break;V=B}return J}function SV($){let Z=(V)=>{let B=String(V);$.entry.currentPhase=B,$.entry.transcript.push({kind:"phase",text:B}),$.bridge.fork(v2.recordPhase({runID:$.runID,phase:B}).pipe(Y.ignore)),$.bridge.fork(v2.appendJournal($.runID,{t:"phase",title:B,pass:$.journal.pass}).pipe(Y.ignore)),$.bridge.fork($.bus.publish(eJ,{sessionID:$.sessionID,runID:$.runID,title:B}));return},X=(V)=>{let B=String(V);$.entry.transcript.push({kind:"log",text:B}),$.bridge.fork(v2.appendJournal($.runID,{t:"log",msg:B,pass:$.journal.pass}).pipe(Y.ignore)),$.bridge.fork($.bus.publish($V,{sessionID:$.sessionID,runID:$.runID,message:B}));return},Q=new Map;return{phase:Z,logHook:X,workflowHook:(V,B,D)=>{let H=String(V),W=D??{},K=CV("sha256").update(JSON.stringify({spec:H,args:B??null})).digest("hex"),j=Q.get(K)??0;Q.set(K,j+1);let G=K+":"+j;if($.journal.results.has("wf:"+G))return $.entry.succeeded++,$.scheduleFlush($.entry),Promise.resolve($.journal.results.get("wf:"+G));let z="wf_"+CV("sha256").update($.runID+G).digest("hex");return $.bridge.promise(Y.gen(function*(){let O=a8(H)?H:yield*Y.promise(()=>RV(H,$.workspaceRoot,S2.worktree));if(O===null)return yield*Y.die(Error(`${$.structuralError}: unknown workflow: ${JSON.stringify(H)}`));let P=a8(H)?"inline:"+K.slice(0,12):H;if($.depth+1>$.maxDepth)return yield*Y.die(Error(`${$.structuralError}: workflow nesting exceeds maxDepth (${$.maxDepth})`));if($.lineage.includes(P))return yield*Y.die(Error(`${$.structuralError}: workflow cycle detected: ${P} is already an ancestor`));$.entry.childRunIDs.add(z),yield*$.launch({script:O,sessionID:$.sessionID,parentActorID:$.parentActorID,args:B,model:$.model,workspace:W.workspace?yield*Y.promise(()=>p$($.workspaceRoot,String(W.workspace))):$.workspaceRoot,maxConcurrentAgents:W.maxConcurrentAgents,scriptDeadlineMs:$.scriptDeadlineMs,lineage:[...$.lineage,P],depth:$.depth+1,maxDepth:$.maxDepth,notifyOnTerminal:!1},z,a8(H)?"inline":H);let w=yield*$.waitFor(z);if(w.status==="failed"&&w.error.includes($.structuralError)){let F=w.error.indexOf($.structuralError);return yield*Y.die(Error(w.error.slice(F)))}if(w.status!=="completed")yield*$.bus.publish(YV,{sessionID:$.sessionID,runID:$.runID,childRunID:z,name:a8(H)?"inline":H,status:w.status,...w.status==="failed"?{error:w.error}:{}}).pipe(Y.ignore);let L=w.status==="completed"?w.result??null:null;if(L!==null)yield*v2.appendJournalSync($.runID,[{t:"agent",key:"wf:"+G,result:L,pass:$.journal.pass}]).pipe(Y.ignore);return L}))}}}var MZ=s.create({service:"workflow.runtime"}),n$=($)=>{if(process.env.QQ_WF_TRACE)process.stderr.write(`[wf ${new Date().toISOString()}] ${$}
|
|
615
615
|
`)},SH=43200000,kH=1000,TH="WorkflowStructuralError";class G7 extends Z2.Service()("@qitqode/WorkflowRuntime"){}var TV=_.effect(G7,Y.gen(function*(){let $=yield*u.Service,Z=yield*o0.Service,X=yield*o$.Service,Q=yield*P2.Service,J=yield*V2.Service,V=yield*d2.Scope,B=new bZ,D=(N,A,R)=>N===void 0?Y.succeed(A):Q.resolveModelRef(N).pipe(Y.map((C)=>({providerID:C.providerID,modelID:C.id})),Y.catchCause(()=>Y.sync(()=>{let C=typeof N==="string"?N:`{${Object.keys(N).sort().join(",")}}`;if(!R.has(C))R.add(C),MZ.warn("workflow agent model ref did not resolve \u2014 using run default",{ref:C});return A}))),H,W=0,K,j=Y.fn("WorkflowRuntime.ensureGlobal")(function*(){if(K)return K;return H??=yield*J.get(),W=Math.max(1,H.workflow?.maxConcurrentAgents??HV()),K??=LZ(W),K}),G=new Map,z=(N)=>{let A=G.get(N.runID);if(A)clearTimeout(A),G.delete(N.runID);return v2.flushCounters({runID:N.runID,running:N.running,succeeded:N.succeeded,failed:N.failed}).pipe(Y.ignore)},O=(N)=>{if(G.has(N.runID))return;G.set(N.runID,setTimeout(()=>{G.delete(N.runID),Y.runFork(v2.flushCounters({runID:N.runID,running:N.running,succeeded:N.succeeded,failed:N.failed}).pipe(Y.ignore))},250))},P=GV({runs:B,bus:$,inbox:Z,worktree:X,flushNow:z}),w=(N)=>Y.gen(function*(){let A=B.get(N);if(!A)return{status:"failed",error:"child run missing"};return yield*k2.await(A.deferred)}),L=Y.fn("WorkflowRuntime.launch")(function*(N,A,R){let C=zZ(N.script),T=C.ok?C.body:N.script,l=N.workspace?yield*Y.promise(()=>p$(S2.worktree,N.workspace)):S2.worktree,d=S2.current,g=yield*k2.make(),E={runID:A,sessionID:N.sessionID,instance:d,status:"running",deferred:g,fiber:void 0,childActorIDs:new Set,worktrees:new Set,childRunIDs:new Set,name:R,running:0,succeeded:0,failed:0,agentCount:0,capWarned:!1,warnedModelRefs:new Set,currentPhase:void 0,transcript:[]};B.set(E);let m=kV("sha256").update(N.script).digest("hex");n$(`launch begin ${A}`),yield*v2.recordStart({runID:A,sessionID:N.sessionID,name:R,parentActorID:N.parentActorID,args:N.args,scriptSha:m,agentTimeoutMs:N.agentTimeoutMs}).pipe(Y.ignore),yield*v2.writeScript(A,N.script).pipe(Y.ignore);let e=yield*jV(A,N.freshJournal??!1),n=yield*P0.make(),a=yield*j(),H2=N.lineage??[],I2=N.depth??0,t=N.maxDepth??H?.workflow?.maxDepth??8,N2=N.maxConcurrentAgents??W,j2=Math.max(1,Math.min(N2,W)),g0=LZ(j2),R2=N.maxLifecycleAgents??H?.workflow?.maxLifecycleAgents??kH,X2=()=>{if(E.capWarned)return;E.capWarned=!0,MZ.warn("workflow lifecycle agent cap reached \u2014 over-cap agents return null",{runID:A,cap:R2})},q2=N.agentTimeoutMs,b2=PV({runID:A,sessionID:N.sessionID,parentActorID:N.parentActorID,defaultModel:N.model,runAgentTimeoutMs:q2,lifecycleCap:R2,entry:E,bridge:n,bus:$,worktree:X,getActor:()=>Q$.current,resolveAgentModel:D,journal:e,semaphore:g0,globalSemaphore:a,scheduleFlush:O,warnCapOnce:X2});yield*$.publish(ZV,{sessionID:N.sessionID,runID:A,name:R});let r2=SV({runID:A,sessionID:N.sessionID,parentActorID:N.parentActorID,model:N.model,scriptDeadlineMs:N.scriptDeadlineMs,workspaceRoot:l,lineage:H2,depth:I2,maxDepth:t,entry:E,bridge:n,bus:$,journal:e,scheduleFlush:O,launch:L,waitFor:w,structuralError:TH}),{phase:w0,logHook:D0,workflowHook:p0}=r2,h0=AV({workspaceRoot:l,hooks:{agent:b2,phase:w0,log:D0,workflow:p0}}),M$=Y.gen(function*(){let i0=kV("sha1").update(A).digest().readUInt32BE(0);n$(`eval begin ${A}`);let n0=yield*Y.tryPromise({try:(s0)=>h0.evaluate(T,{deadlineMs:N.scriptDeadlineMs??SH,args:N.args,seed:i0,signal:s0}),catch:(s0)=>s0 instanceof Error?s0:Error(String(s0))}).pipe(Y.result);if(n$(`eval end ${A} ${n0._tag}`),n0._tag==="Success"){yield*P.complete({entry:E,sessionID:N.sessionID,parentActorID:N.parentActorID,result:n0.success,notifyOnTerminal:N.notifyOnTerminal}),n$(`flushed ${A}`),n$(`terminal-recorded ${A}`),n$(`published ${A}`),n$(`deferred-succeeded ${A}`);return}let N1=n0.failure instanceof Error?n0.failure.message:String(n0.failure);MZ.warn("workflow run failed",{runID:A,error:N1}),yield*P.fail({entry:E,sessionID:N.sessionID,parentActorID:N.parentActorID,error:N1,notifyOnTerminal:N.notifyOnTerminal})});return E.fiber=yield*M$.pipe(Y.provideService(I0,d),Y.forkIn(V)),n$(`launched ${A}`),{runID:A}}),F=Y.fn("WorkflowRuntime.start")(function*(N){let A=zZ(N.script);if(!A.ok)return yield*Y.die(A.error);let R=B8.descending("workflow");return yield*L(N,R,A.meta.name)}),U=Y.fn("WorkflowRuntime.status")(function*(N){let A=B.get(N.runID);if(!A)return{status:"unknown",agentCount:0};return{status:A.status,agentCount:A.agentCount,...A.currentPhase!==void 0?{currentPhase:A.currentPhase}:{}}}),y=Y.fn("WorkflowRuntime.transcript")(function*(N){let A=B.get(N.runID);return A?A.transcript.slice():[]}),S=Y.fn("WorkflowRuntime.wait")(function*(N){let A=B.get(N.runID);if(!A)return{status:"failed",error:`unknown runID ${N.runID}`};if(N.timeoutMs===void 0)return yield*k2.await(A.deferred);let R=yield*k2.await(A.deferred).pipe(Y.timeout(N.timeoutMs),Y.catchTag("TimeoutError",()=>Y.succeed(null)));if(R===null)return{status:"failed",error:"workflow wait timed out"};return R}),I=Y.fn("WorkflowRuntime.cancel")(function*(N){let A=B.get(N.runID);if(!A)return;yield*P.cancelEntry(A)}),M=Y.fn("WorkflowRuntime.list")(function*(N){return yield*v2.list(N)}),f=_V({runs:B,launch:L}),b=G7.of({start:F,status:U,wait:S,transcript:y,cancel:I,list:M,resume:f}),k=!1,h=Y.gen(function*(){if(k)return;k=!0,yield*Y.forEach([...B.values()],(N)=>(N.status==="running"?P.cancelEntry(N):Y.void).pipe(Y.ignore),{concurrency:1,discard:!0});for(let N of G.values())clearTimeout(N);G.clear(),B.clear()});return K7.current=b,yield*Y.addFinalizer(()=>h),yield*Y.addFinalizer(()=>Y.sync(()=>{if(K7.current===b)K7.current=void 0})),b})),gH=TV.pipe(_.provide(u.defaultLayer),_.provide(o0.defaultLayer),_.provide(o$.defaultLayer),_.provide(P2.defaultLayer),_.provide(V2.defaultLayer));var hH=_.suspend(()=>_.mergeAll(hV.defaultLayer,n2.defaultLayer,u.defaultLayer,I$.defaultLayer,d8.defaultLayer,V2.defaultLayer,l$.defaultLayer,fV.defaultLayer,V8.defaultLayer,c$.defaultLayer,R$.defaultLayer,z0.defaultLayer,K2.defaultLayer,P2.defaultLayer,cV.defaultLayer,h2.defaultLayer,j$.defaultLayer,EV.defaultLayer,w6.defaultLayer,O2.defaultLayer,mV.defaultLayer,J2.defaultLayer,y0.defaultLayer,O0.defaultLayer,F0.defaultLayer,d0.defaultLayer,F$.defaultLayer,z$.defaultLayer,$$.defaultLayer,q0.defaultLayer,m$.defaultLayer,P$.defaultLayer,G$.defaultLayer,f2.defaultLayer,J$.defaultLayer,N0.defaultLayer,T$.defaultLayer,x0.defaultLayer,j1.defaultLayer,W0.defaultLayer,J8.defaultLayer,U$.defaultLayer,F1.defaultLayer,o$.defaultLayer,u8.defaultLayer,lV.defaultLayer,A$.defaultLayer,n4.defaultLayer,M2.defaultLayer,dV.defaultLayer,n8.defaultLayer,_0.defaultLayer,r8.defaultLayer,y$.defaultLayer,t4.defaultLayer).pipe(_.provideMerge(a4),_.provideMerge(vV))),W8=s4.make(hH,{memoMap:r4}),t8=($)=>gV($),QR={runSync($){return W8.runSync(t8($))},runPromise($,Z){return W8.runPromise(t8($),Z)},runPromiseExit($,Z){return W8.runPromiseExit(t8($),Z)},runFork($){return W8.runFork(t8($))},runCallback($){return W8.runCallback(t8($))},dispose:()=>W8.dispose()};
|
|
616
|
-
export{F1 as
|
|
616
|
+
export{F1 as Lg,T$ as Mg,A8 as Ng,Z0 as Og,M8 as Pg,I8 as Qg,F4 as Rg,N0 as Sg,x0 as Tg,A$ as Ug,n4 as Vg,SJ as Wg,o$ as Xg,c5 as Yg,y0 as Zg,O0 as _g,q0 as $g,$$ as ah,F$ as bh,m$ as ch,l8 as dh,u8 as eh,hH as fh,QR as gh};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Tr as E,Ur as yZ,Vr as N0,Wr as ZQ,Xr as ZJ,Yr as p0,Zr as n0,_r as i0,as as s0,bs as o0}from"./chunk-m02zt1a3.js";import{cs as AQ}from"./chunk-vg2fmyje.js";import{AH as e,DP as C0,EB as h0,HD as _0,JF as k0,KF as I0,KG as x0,MD as O0,MG as c0,MH as S0,MP as L0,NP as P0,QG as r,SD as D0,UG as u,VH as JJ,ZG as g,bI as QJ,eG as NJ,eH as y0,fG as PJ,hG as d0,iG as l0,jG as m0,kG as XQ,lG as u0,nB as g0,pE as E0,sG as A0,uD as WQ,wD as $Q,yH as t}from"./chunk-snm5q21k.js";import{_P as M}from"./chunk-qjjch1zt.js";import{$P as d,aQ as K,dQ as TJ}from"./chunk-aztre27e.js";var bJ=K((GQ)=>{Object.defineProperty(GQ,"__esModule",{value:!0});GQ.AbstractAsyncHooksContextManager=void 0;var t0=TJ("events"),e0=["addListener","on","once","prependListener","prependOnceListener"];class KQ{bind(J,Q){if(Q instanceof t0.EventEmitter)return this._bindEventEmitter(J,Q);if(typeof Q==="function")return this._bindFunction(J,Q);return Q}_bindFunction(J,Q){let Z=this,$=function(...q){return Z.with(J,()=>Q.apply(this,q))};return Object.defineProperty($,"length",{enumerable:!1,configurable:!0,writable:!1,value:Q.length}),$}_bindEventEmitter(J,Q){if(this._getPatchMap(Q)!==void 0)return Q;if(this._createPatchMap(Q),e0.forEach(($)=>{if(Q[$]===void 0)return;Q[$]=this._patchAddListener(Q,Q[$],J)}),typeof Q.removeListener==="function")Q.removeListener=this._patchRemoveListener(Q,Q.removeListener);if(typeof Q.off==="function")Q.off=this._patchRemoveListener(Q,Q.off);if(typeof Q.removeAllListeners==="function")Q.removeAllListeners=this._patchRemoveAllListeners(Q,Q.removeAllListeners);return Q}_patchRemoveListener(J,Q){let Z=this;return function($,q){let W=Z._getPatchMap(J)?.[$];if(W===void 0)return Q.call(this,$,q);let X=W.get(q);return Q.call(this,$,X||q)}}_patchRemoveAllListeners(J,Q){let Z=this;return function($){let q=Z._getPatchMap(J);if(q!==void 0){if(arguments.length===0)Z._createPatchMap(J);else if(q[$]!==void 0)delete q[$]}return Q.apply(this,arguments)}}_patchAddListener(J,Q,Z){let $=this;return function(q,W){if($._wrapped)return Q.call(this,q,W);let X=$._getPatchMap(J);if(X===void 0)X=$._createPatchMap(J);let H=X[q];if(H===void 0)H=new WeakMap,X[q]=H;let Y=$.bind(Z,W);H.set(W,Y),$._wrapped=!0;try{return Q.call(this,q,Y)}finally{$._wrapped=!1}}}_createPatchMap(J){let Q=Object.create(null);return J[this._kOtListeners]=Q,Q}_getPatchMap(J){return J[this._kOtListeners]}_kOtListeners=Symbol("OtListeners");_wrapped=!1}GQ.AbstractAsyncHooksContextManager=KQ});var jQ=K((UQ)=>{Object.defineProperty(UQ,"__esModule",{value:!0});UQ.AsyncHooksContextManager=void 0;var J6=M(),Q6=TJ("async_hooks"),Z6=bJ();class VQ extends Z6.AbstractAsyncHooksContextManager{_asyncHook;_contexts=new Map;_stack=[];constructor(){super();this._asyncHook=Q6.createHook({init:this._init.bind(this),before:this._before.bind(this),after:this._after.bind(this),destroy:this._destroy.bind(this),promiseResolve:this._destroy.bind(this)})}active(){return this._stack[this._stack.length-1]??J6.ROOT_CONTEXT}with(J,Q,Z,...$){this._enterContext(J);try{return Q.call(Z,...$)}finally{this._exitContext()}}enable(){return this._asyncHook.enable(),this}disable(){return this._asyncHook.disable(),this._contexts.clear(),this._stack=[],this}_init(J,Q){if(Q==="TIMERWRAP")return;let Z=this._stack[this._stack.length-1];if(Z!==void 0)this._contexts.set(J,Z)}_destroy(J){this._contexts.delete(J)}_before(J){let Q=this._contexts.get(J);if(Q!==void 0)this._enterContext(Q)}_after(){this._exitContext()}_enterContext(J){this._stack.push(J)}_exitContext(){this._stack.pop()}}UQ.AsyncHooksContextManager=VQ});var DQ=K((hQ)=>{Object.defineProperty(hQ,"__esModule",{value:!0});hQ.AsyncLocalStorageContextManager=void 0;var $6=M(),q6=TJ("async_hooks"),W6=bJ();class FQ extends W6.AbstractAsyncHooksContextManager{_asyncLocalStorage;constructor(){super();this._asyncLocalStorage=new q6.AsyncLocalStorage}active(){return this._asyncLocalStorage.getStore()??$6.ROOT_CONTEXT}with(J,Q,Z,...$){let q=Z==null?Q:Q.bind(Z);return this._asyncLocalStorage.run(J,q,...$)}enable(){return this}disable(){return this._asyncLocalStorage.disable(),this}}hQ.AsyncLocalStorageContextManager=FQ});var EQ=K((GJ)=>{Object.defineProperty(GJ,"__esModule",{value:!0});GJ.AsyncLocalStorageContextManager=GJ.AsyncHooksContextManager=void 0;var z6=jQ();Object.defineProperty(GJ,"AsyncHooksContextManager",{enumerable:!0,get:function(){return z6.AsyncHooksContextManager}});var X6=DQ();Object.defineProperty(GJ,"AsyncLocalStorageContextManager",{enumerable:!0,get:function(){return X6.AsyncLocalStorageContextManager}})});var MQ=K((kQ)=>{Object.defineProperty(kQ,"__esModule",{value:!0});kQ.ExceptionEventName=void 0;kQ.ExceptionEventName="exception"});var PQ=K((CQ)=>{Object.defineProperty(CQ,"__esModule",{value:!0});CQ.SpanImpl=void 0;var h=M(),O=E(),m=AQ(),H6=MQ();class RQ{_spanContext;kind;parentSpanContext;attributes={};links=[];events=[];startTime;resource;instrumentationScope;_droppedAttributesCount=0;_droppedEventsCount=0;_droppedLinksCount=0;_attributesCount=0;name;status={code:h.SpanStatusCode.UNSET};endTime=[0,0];_ended=!1;_duration=[-1,-1];_spanProcessor;_spanLimits;_attributeValueLengthLimit;_recordEndMetrics;_performanceStartTime;_performanceOffset;_startTimeProvided;constructor(J){let Q=Date.now();if(this._spanContext=J.spanContext,this._performanceStartTime=O.otperformance.now(),this._performanceOffset=Q-(this._performanceStartTime+O.otperformance.timeOrigin),this._startTimeProvided=J.startTime!=null,this._spanLimits=J.spanLimits,this._attributeValueLengthLimit=this._spanLimits.attributeValueLengthLimit??0,this._spanProcessor=J.spanProcessor,this.name=J.name,this.parentSpanContext=J.parentSpanContext,this.kind=J.kind,J.links)for(let Z of J.links)this.addLink(Z);if(this.startTime=this._getTime(J.startTime??Q),this.resource=J.resource,this.instrumentationScope=J.scope,this._recordEndMetrics=J.recordEndMetrics,J.attributes!=null)this.setAttributes(J.attributes);this._spanProcessor.onStart(this,J.context)}spanContext(){return this._spanContext}setAttribute(J,Q){if(Q==null||this._isSpanEnded())return this;if(J.length===0)return h.diag.warn(`Invalid attribute key: ${J}`),this;if(!(0,O.isAttributeValue)(Q))return h.diag.warn(`Invalid attribute value set for key: ${J}`),this;let{attributeCountLimit:Z}=this._spanLimits,$=!Object.prototype.hasOwnProperty.call(this.attributes,J);if(Z!==void 0&&this._attributesCount>=Z&&$)return this._droppedAttributesCount++,this;if(this.attributes[J]=this._truncateToSize(Q),$)this._attributesCount++;return this}setAttributes(J){for(let Q in J)if(Object.prototype.hasOwnProperty.call(J,Q))this.setAttribute(Q,J[Q]);return this}addEvent(J,Q,Z){if(this._isSpanEnded())return this;let{eventCountLimit:$}=this._spanLimits;if($===0)return h.diag.warn("No events allowed."),this._droppedEventsCount++,this;if($!==void 0&&this.events.length>=$){if(this._droppedEventsCount===0)h.diag.debug("Dropping extra events.");this.events.shift(),this._droppedEventsCount++}if((0,O.isTimeInput)(Q)){if(!(0,O.isTimeInput)(Z))Z=Q;Q=void 0}let q=(0,O.sanitizeAttributes)(Q),{attributePerEventCountLimit:W}=this._spanLimits,X={},H=0,Y=0;for(let V in q){if(!Object.prototype.hasOwnProperty.call(q,V))continue;let R=q[V];if(W!==void 0&&Y>=W){H++;continue}X[V]=this._truncateToSize(R),Y++}return this.events.push({name:J,attributes:X,time:this._getTime(Z),droppedAttributesCount:H}),this}addLink(J){if(this._isSpanEnded())return this;let{linkCountLimit:Q}=this._spanLimits;if(Q===0)return this._droppedLinksCount++,this;if(Q!==void 0&&this.links.length>=Q){if(this._droppedLinksCount===0)h.diag.debug("Dropping extra links.");this.links.shift(),this._droppedLinksCount++}let{attributePerLinkCountLimit:Z}=this._spanLimits,$=(0,O.sanitizeAttributes)(J.attributes),q={},W=0,X=0;for(let Y in $){if(!Object.prototype.hasOwnProperty.call($,Y))continue;let V=$[Y];if(Z!==void 0&&X>=Z){W++;continue}q[Y]=this._truncateToSize(V),X++}let H={context:J.context};if(X>0)H.attributes=q;if(W>0)H.droppedAttributesCount=W;return this.links.push(H),this}addLinks(J){for(let Q of J)this.addLink(Q);return this}setStatus(J){if(this._isSpanEnded())return this;if(J.code===h.SpanStatusCode.UNSET)return this;if(this.status.code===h.SpanStatusCode.OK)return this;let Q={code:J.code};if(J.code===h.SpanStatusCode.ERROR){if(typeof J.message==="string")Q.message=J.message;else if(J.message!=null)h.diag.warn(`Dropping invalid status.message of type '${typeof J.message}', expected 'string'`)}return this.status=Q,this}updateName(J){if(this._isSpanEnded())return this;return this.name=J,this}end(J){if(this._isSpanEnded()){h.diag.error(`${this.name} ${this._spanContext.traceId}-${this._spanContext.spanId} - You can only call end() on a span once.`);return}if(this.endTime=this._getTime(J),this._duration=(0,O.hrTimeDuration)(this.startTime,this.endTime),this._duration[0]<0)h.diag.warn("Inconsistent start and end time, startTime > endTime. Setting span duration to 0ms.",this.startTime,this.endTime),this.endTime=this.startTime.slice(),this._duration=[0,0];if(this._droppedEventsCount>0)h.diag.warn(`Dropped ${this._droppedEventsCount} events because eventCountLimit reached`);if(this._droppedLinksCount>0)h.diag.warn(`Dropped ${this._droppedLinksCount} links because linkCountLimit reached`);if(this._spanProcessor.onEnding)this._spanProcessor.onEnding(this);this._recordEndMetrics?.(),this._ended=!0,this._spanProcessor.onEnd(this)}_getTime(J){if(typeof J==="number"&&J<=O.otperformance.now())return(0,O.hrTime)(J+this._performanceOffset);if(typeof J==="number")return(0,O.millisToHrTime)(J);if(J instanceof Date)return(0,O.millisToHrTime)(J.getTime());if((0,O.isTimeInputHrTime)(J))return J;if(this._startTimeProvided)return(0,O.millisToHrTime)(Date.now());let Q=O.otperformance.now()-this._performanceStartTime;return(0,O.addHrTimes)(this.startTime,(0,O.millisToHrTime)(Q))}isRecording(){return this._ended===!1}recordException(J,Q){let Z={};if(typeof J==="string")Z[m.ATTR_EXCEPTION_MESSAGE]=J;else if(J){if(J.code)Z[m.ATTR_EXCEPTION_TYPE]=J.code.toString();else if(J.name)Z[m.ATTR_EXCEPTION_TYPE]=J.name;if(J.message)Z[m.ATTR_EXCEPTION_MESSAGE]=J.message;if(J.stack)Z[m.ATTR_EXCEPTION_STACKTRACE]=J.stack}if(Z[m.ATTR_EXCEPTION_TYPE]||Z[m.ATTR_EXCEPTION_MESSAGE])this.addEvent(H6.ExceptionEventName,Z,Q);else h.diag.warn(`Failed to record an exception ${J}`)}get duration(){return this._duration}get ended(){return this._ended}get droppedAttributesCount(){return this._droppedAttributesCount}get droppedEventsCount(){return this._droppedEventsCount}get droppedLinksCount(){return this._droppedLinksCount}_isSpanEnded(){if(this._ended){let J=Error(`Operation attempted on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`);h.diag.warn(`Cannot execute the operation on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`,J)}return this._ended}_truncateToLimitUtil(J,Q){if(J.length<=Q)return J;return J.substring(0,Q)}_truncateToSize(J){let Q=this._attributeValueLengthLimit;if(Q<=0)return h.diag.warn(`Attribute value limit must be positive, got ${Q}`),J;if(typeof J==="string")return this._truncateToLimitUtil(J,Q);if(Array.isArray(J))return J.map((Z)=>typeof Z==="string"?this._truncateToLimitUtil(Z,Q):Z);return J}}CQ.SpanImpl=RQ});var i=K((NQ)=>{Object.defineProperty(NQ,"__esModule",{value:!0});NQ.SamplingDecision=void 0;var K6;(function(J){J[J.NOT_RECORD=0]="NOT_RECORD",J[J.RECORD=1]="RECORD",J[J.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"})(K6=NQ.SamplingDecision||(NQ.SamplingDecision={}))});var wJ=K((TQ)=>{Object.defineProperty(TQ,"__esModule",{value:!0});TQ.AlwaysOffSampler=void 0;var G6=i();class fQ{shouldSample(){return{decision:G6.SamplingDecision.NOT_RECORD}}toString(){return"AlwaysOffSampler"}}TQ.AlwaysOffSampler=fQ});var VJ=K((xQ)=>{Object.defineProperty(xQ,"__esModule",{value:!0});xQ.AlwaysOnSampler=void 0;var w6=i();class _Q{shouldSample(){return{decision:w6.SamplingDecision.RECORD_AND_SAMPLED}}toString(){return"AlwaysOnSampler"}}xQ.AlwaysOnSampler=_Q});var dJ=K((vQ)=>{Object.defineProperty(vQ,"__esModule",{value:!0});vQ.ParentBasedSampler=void 0;var UJ=M(),V6=E(),yQ=wJ(),xJ=VJ();class SQ{_root;_remoteParentSampled;_remoteParentNotSampled;_localParentSampled;_localParentNotSampled;constructor(J){if(this._root=J.root,!this._root)(0,V6.globalErrorHandler)(Error("ParentBasedSampler must have a root sampler configured")),this._root=new xJ.AlwaysOnSampler;this._remoteParentSampled=J.remoteParentSampled??new xJ.AlwaysOnSampler,this._remoteParentNotSampled=J.remoteParentNotSampled??new yQ.AlwaysOffSampler,this._localParentSampled=J.localParentSampled??new xJ.AlwaysOnSampler,this._localParentNotSampled=J.localParentNotSampled??new yQ.AlwaysOffSampler}shouldSample(J,Q,Z,$,q,W){let X=UJ.trace.getSpanContext(J);if(!X||!(0,UJ.isSpanContextValid)(X))return this._root.shouldSample(J,Q,Z,$,q,W);if(X.isRemote){if(X.traceFlags&UJ.TraceFlags.SAMPLED)return this._remoteParentSampled.shouldSample(J,Q,Z,$,q,W);return this._remoteParentNotSampled.shouldSample(J,Q,Z,$,q,W)}if(X.traceFlags&UJ.TraceFlags.SAMPLED)return this._localParentSampled.shouldSample(J,Q,Z,$,q,W);return this._localParentNotSampled.shouldSample(J,Q,Z,$,q,W)}toString(){return`ParentBased{root=${this._root.toString()}, remoteParentSampled=${this._remoteParentSampled.toString()}, remoteParentNotSampled=${this._remoteParentNotSampled.toString()}, localParentSampled=${this._localParentSampled.toString()}, localParentNotSampled=${this._localParentNotSampled.toString()}}`}}vQ.ParentBasedSampler=SQ});var yJ=K((uQ)=>{Object.defineProperty(uQ,"__esModule",{value:!0});uQ.TraceIdRatioBasedSampler=void 0;var U6=M(),lQ=i();class mQ{_ratio;_upperBound;constructor(J=0){this._ratio=this._normalize(J),this._upperBound=Math.floor(this._ratio*4294967295)}shouldSample(J,Q){return{decision:(0,U6.isValidTraceId)(Q)&&this._accumulate(Q)<this._upperBound?lQ.SamplingDecision.RECORD_AND_SAMPLED:lQ.SamplingDecision.NOT_RECORD}}toString(){return`TraceIdRatioBased{${this._ratio}}`}_normalize(J){if(typeof J!=="number"||isNaN(J))return 0;return J>=1?1:J<=0?0:J}_accumulate(J){let Q=0;for(let Z=0;Z<J.length/8;Z++){let $=Z*8,q=parseInt(J.slice($,$+8),16);Q=(Q^q)>>>0}return Q}}uQ.TraceIdRatioBasedSampler=mQ});var gJ=K((oQ)=>{Object.defineProperty(oQ,"__esModule",{value:!0});oQ.buildSamplerFromEnv=oQ.loadDefaultConfig=void 0;var vJ=M(),_=E(),pQ=wJ(),SJ=VJ(),BJ=dJ(),nQ=yJ(),x;(function(J){J.AlwaysOff="always_off",J.AlwaysOn="always_on",J.ParentBasedAlwaysOff="parentbased_always_off",J.ParentBasedAlwaysOn="parentbased_always_on",J.ParentBasedTraceIdRatio="parentbased_traceidratio",J.TraceIdRatio="traceidratio"})(x||(x={}));var jJ=1;function B6(){return{sampler:sQ(),forceFlushTimeoutMillis:30000,generalLimits:{attributeValueLengthLimit:(0,_.getNumberFromEnv)("OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT")??1/0,attributeCountLimit:(0,_.getNumberFromEnv)("OTEL_ATTRIBUTE_COUNT_LIMIT")??128},spanLimits:{attributeValueLengthLimit:(0,_.getNumberFromEnv)("OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT")??1/0,attributeCountLimit:(0,_.getNumberFromEnv)("OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT")??128,linkCountLimit:(0,_.getNumberFromEnv)("OTEL_SPAN_LINK_COUNT_LIMIT")??128,eventCountLimit:(0,_.getNumberFromEnv)("OTEL_SPAN_EVENT_COUNT_LIMIT")??128,attributePerEventCountLimit:(0,_.getNumberFromEnv)("OTEL_SPAN_ATTRIBUTE_PER_EVENT_COUNT_LIMIT")??128,attributePerLinkCountLimit:(0,_.getNumberFromEnv)("OTEL_SPAN_ATTRIBUTE_PER_LINK_COUNT_LIMIT")??128}}}oQ.loadDefaultConfig=B6;function sQ(){let J=(0,_.getStringFromEnv)("OTEL_TRACES_SAMPLER")??x.ParentBasedAlwaysOn;switch(J){case x.AlwaysOn:return new SJ.AlwaysOnSampler;case x.AlwaysOff:return new pQ.AlwaysOffSampler;case x.ParentBasedAlwaysOn:return new BJ.ParentBasedSampler({root:new SJ.AlwaysOnSampler});case x.ParentBasedAlwaysOff:return new BJ.ParentBasedSampler({root:new pQ.AlwaysOffSampler});case x.TraceIdRatio:return new nQ.TraceIdRatioBasedSampler(iQ());case x.ParentBasedTraceIdRatio:return new BJ.ParentBasedSampler({root:new nQ.TraceIdRatioBasedSampler(iQ())});default:return vJ.diag.error(`OTEL_TRACES_SAMPLER value "${J}" invalid, defaulting to "${x.ParentBasedAlwaysOn}".`),new BJ.ParentBasedSampler({root:new SJ.AlwaysOnSampler})}}oQ.buildSamplerFromEnv=sQ;function iQ(){let J=(0,_.getNumberFromEnv)("OTEL_TRACES_SAMPLER_ARG");if(J==null)return vJ.diag.error(`OTEL_TRACES_SAMPLER_ARG is blank, defaulting to ${jJ}.`),jJ;if(J<0||J>1)return vJ.diag.error(`OTEL_TRACES_SAMPLER_ARG=${J} was given, but it is out of range ([0..1]), defaulting to ${jJ}.`),jJ;return J}});var lJ=K((tQ)=>{Object.defineProperty(tQ,"__esModule",{value:!0});tQ.reconfigureLimits=tQ.mergeConfig=tQ.DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT=tQ.DEFAULT_ATTRIBUTE_COUNT_LIMIT=void 0;var rQ=gJ(),FJ=E();tQ.DEFAULT_ATTRIBUTE_COUNT_LIMIT=128;tQ.DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT=1/0;function F6(J){let Q={sampler:(0,rQ.buildSamplerFromEnv)()},Z=(0,rQ.loadDefaultConfig)(),$=Object.assign({},Z,Q,J);return $.generalLimits=Object.assign({},Z.generalLimits,J.generalLimits||{}),$.spanLimits=Object.assign({},Z.spanLimits,J.spanLimits||{}),$}tQ.mergeConfig=F6;function h6(J){let Q=Object.assign({},J.spanLimits);return Q.attributeCountLimit=J.spanLimits?.attributeCountLimit??J.generalLimits?.attributeCountLimit??(0,FJ.getNumberFromEnv)("OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT")??(0,FJ.getNumberFromEnv)("OTEL_ATTRIBUTE_COUNT_LIMIT")??tQ.DEFAULT_ATTRIBUTE_COUNT_LIMIT,Q.attributeValueLengthLimit=J.spanLimits?.attributeValueLengthLimit??J.generalLimits?.attributeValueLengthLimit??(0,FJ.getNumberFromEnv)("OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT")??(0,FJ.getNumberFromEnv)("OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT")??tQ.DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT,Object.assign({},J,{spanLimits:Q})}tQ.reconfigureLimits=h6});var WZ=K(($Z)=>{Object.defineProperty($Z,"__esModule",{value:!0});$Z.BatchSpanProcessorBase=void 0;var s=M(),S=E();class ZZ{_maxExportBatchSize;_maxQueueSize;_scheduledDelayMillis;_exportTimeoutMillis;_exporter;_isExporting=!1;_finishedSpans=[];_timer;_shutdownOnce;_droppedSpansCount=0;constructor(J,Q){if(this._exporter=J,this._maxExportBatchSize=typeof Q?.maxExportBatchSize==="number"?Q.maxExportBatchSize:(0,S.getNumberFromEnv)("OTEL_BSP_MAX_EXPORT_BATCH_SIZE")??512,this._maxQueueSize=typeof Q?.maxQueueSize==="number"?Q.maxQueueSize:(0,S.getNumberFromEnv)("OTEL_BSP_MAX_QUEUE_SIZE")??2048,this._scheduledDelayMillis=typeof Q?.scheduledDelayMillis==="number"?Q.scheduledDelayMillis:(0,S.getNumberFromEnv)("OTEL_BSP_SCHEDULE_DELAY")??5000,this._exportTimeoutMillis=typeof Q?.exportTimeoutMillis==="number"?Q.exportTimeoutMillis:(0,S.getNumberFromEnv)("OTEL_BSP_EXPORT_TIMEOUT")??30000,this._shutdownOnce=new S.BindOnceFuture(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize)s.diag.warn("BatchSpanProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize"),this._maxExportBatchSize=this._maxQueueSize}forceFlush(){if(this._shutdownOnce.isCalled)return this._shutdownOnce.promise;return this._flushAll()}onStart(J,Q){}onEnd(J){if(this._shutdownOnce.isCalled)return;if((J.spanContext().traceFlags&s.TraceFlags.SAMPLED)===0)return;this._addToBuffer(J)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return Promise.resolve().then(()=>{return this.onShutdown()}).then(()=>{return this._flushAll()}).then(()=>{return this._exporter.shutdown()})}_addToBuffer(J){if(this._finishedSpans.length>=this._maxQueueSize){if(this._droppedSpansCount===0)s.diag.debug("maxQueueSize reached, dropping spans");this._droppedSpansCount++;return}if(this._droppedSpansCount>0)s.diag.warn(`Dropped ${this._droppedSpansCount} spans because maxQueueSize reached`),this._droppedSpansCount=0;this._finishedSpans.push(J),this._maybeStartTimer()}_flushAll(){return new Promise((J,Q)=>{let Z=[],$=Math.ceil(this._finishedSpans.length/this._maxExportBatchSize);for(let q=0,W=$;q<W;q++)Z.push(this._flushOneBatch());Promise.all(Z).then(()=>{J()}).catch(Q)})}_flushOneBatch(){if(this._clearTimer(),this._finishedSpans.length===0)return Promise.resolve();return new Promise((J,Q)=>{let Z=setTimeout(()=>{Q(Error("Timeout"))},this._exportTimeoutMillis);s.context.with((0,S.suppressTracing)(s.context.active()),()=>{let $;if(this._finishedSpans.length<=this._maxExportBatchSize)$=this._finishedSpans,this._finishedSpans=[];else $=this._finishedSpans.splice(0,this._maxExportBatchSize);let q=()=>this._exporter.export($,(X)=>{if(clearTimeout(Z),X.code===S.ExportResultCode.SUCCESS)J();else Q(X.error??Error("BatchSpanProcessor: span export failed"))}),W=null;for(let X=0,H=$.length;X<H;X++){let Y=$[X];if(Y.resource.asyncAttributesPending&&Y.resource.waitForAsyncAttributes)W??=[],W.push(Y.resource.waitForAsyncAttributes())}if(W===null)q();else Promise.all(W).then(q,(X)=>{(0,S.globalErrorHandler)(X),Q(X)})})})}_maybeStartTimer(){if(this._isExporting)return;let J=()=>{this._isExporting=!0,this._flushOneBatch().finally(()=>{if(this._isExporting=!1,this._finishedSpans.length>0)this._clearTimer(),this._maybeStartTimer()}).catch((Q)=>{this._isExporting=!1,(0,S.globalErrorHandler)(Q)})};if(this._finishedSpans.length>=this._maxExportBatchSize)return J();if(this._timer!==void 0)return;if(this._timer=setTimeout(()=>J(),this._scheduledDelayMillis),typeof this._timer!=="number")this._timer.unref()}_clearTimer(){if(this._timer!==void 0)clearTimeout(this._timer),this._timer=void 0}}$Z.BatchSpanProcessorBase=ZZ});var HZ=K((XZ)=>{Object.defineProperty(XZ,"__esModule",{value:!0});XZ.BatchSpanProcessor=void 0;var D6=WZ();class zZ extends D6.BatchSpanProcessorBase{onShutdown(){}}XZ.BatchSpanProcessor=zZ});var BZ=K((VZ)=>{Object.defineProperty(VZ,"__esModule",{value:!0});VZ.RandomIdGenerator=void 0;var E6=8,GZ=16;class wZ{generateTraceId=KZ(GZ);generateSpanId=KZ(E6)}VZ.RandomIdGenerator=wZ;var hJ=Buffer.allocUnsafe(GZ);function KZ(J){return function(){for(let Z=0;Z<J/4;Z++)hJ.writeUInt32BE(Math.random()*4294967296>>>0,Z*4);for(let Z=0;Z<J;Z++)if(hJ[Z]>0)break;else if(Z===J-1)hJ[J-1]=1;return hJ.toString("hex",0,J)}}});var jZ=K((OJ)=>{Object.defineProperty(OJ,"__esModule",{value:!0});OJ.RandomIdGenerator=OJ.BatchSpanProcessor=void 0;var k6=HZ();Object.defineProperty(OJ,"BatchSpanProcessor",{enumerable:!0,get:function(){return k6.BatchSpanProcessor}});var I6=BZ();Object.defineProperty(OJ,"RandomIdGenerator",{enumerable:!0,get:function(){return I6.RandomIdGenerator}})});var mJ=K((DJ)=>{Object.defineProperty(DJ,"__esModule",{value:!0});DJ.RandomIdGenerator=DJ.BatchSpanProcessor=void 0;var FZ=jZ();Object.defineProperty(DJ,"BatchSpanProcessor",{enumerable:!0,get:function(){return FZ.BatchSpanProcessor}});Object.defineProperty(DJ,"RandomIdGenerator",{enumerable:!0,get:function(){return FZ.RandomIdGenerator}})});var DZ=K((hZ)=>{Object.defineProperty(hZ,"__esModule",{value:!0});hZ.METRIC_OTEL_SDK_SPAN_STARTED=hZ.METRIC_OTEL_SDK_SPAN_LIVE=hZ.ATTR_OTEL_SPAN_SAMPLING_RESULT=hZ.ATTR_OTEL_SPAN_PARENT_ORIGIN=void 0;hZ.ATTR_OTEL_SPAN_PARENT_ORIGIN="otel.span.parent.origin";hZ.ATTR_OTEL_SPAN_SAMPLING_RESULT="otel.span.sampling_result";hZ.METRIC_OTEL_SDK_SPAN_LIVE="otel.sdk.span.live";hZ.METRIC_OTEL_SDK_SPAN_STARTED="otel.sdk.span.started"});var MZ=K((kZ)=>{Object.defineProperty(kZ,"__esModule",{value:!0});kZ.TracerMetrics=void 0;var EJ=i(),qJ=DZ();class EZ{startedSpans;liveSpans;constructor(J){this.startedSpans=J.createCounter(qJ.METRIC_OTEL_SDK_SPAN_STARTED,{unit:"{span}",description:"The number of created spans."}),this.liveSpans=J.createUpDownCounter(qJ.METRIC_OTEL_SDK_SPAN_LIVE,{unit:"{span}",description:"The number of currently live spans."})}startSpan(J,Q){let Z=N6(Q);if(this.startedSpans.add(1,{[qJ.ATTR_OTEL_SPAN_PARENT_ORIGIN]:P6(J),[qJ.ATTR_OTEL_SPAN_SAMPLING_RESULT]:Z}),Q===EJ.SamplingDecision.NOT_RECORD)return()=>{};let $={[qJ.ATTR_OTEL_SPAN_SAMPLING_RESULT]:Z};return this.liveSpans.add(1,$),()=>{this.liveSpans.add(-1,$)}}}kZ.TracerMetrics=EZ;function P6(J){if(!J)return"none";if(J.isRemote)return"remote";return"local"}function N6(J){switch(J){case EJ.SamplingDecision.RECORD_AND_SAMPLED:return"RECORD_AND_SAMPLE";case EJ.SamplingDecision.RECORD:return"RECORD_ONLY";case EJ.SamplingDecision.NOT_RECORD:return"DROP"}}});var CZ=K((AZ)=>{Object.defineProperty(AZ,"__esModule",{value:!0});AZ.VERSION=void 0;AZ.VERSION="2.6.1"});var fZ=K((PZ)=>{Object.defineProperty(PZ,"__esModule",{value:!0});PZ.Tracer=void 0;var F=M(),kJ=E(),f6=PQ(),T6=lJ(),b6=mJ(),_6=MZ(),x6=CZ();class LZ{_sampler;_generalLimits;_spanLimits;_idGenerator;instrumentationScope;_resource;_spanProcessor;_tracerMetrics;constructor(J,Q,Z,$){let q=(0,T6.mergeConfig)(Q);this._sampler=q.sampler,this._generalLimits=q.generalLimits,this._spanLimits=q.spanLimits,this._idGenerator=Q.idGenerator||new b6.RandomIdGenerator,this._resource=Z,this._spanProcessor=$,this.instrumentationScope=J;let W=q.meterProvider?q.meterProvider.getMeter("@opentelemetry/sdk-trace",x6.VERSION):F.createNoopMeter();this._tracerMetrics=new _6.TracerMetrics(W)}startSpan(J,Q={},Z=F.context.active()){if(Q.root)Z=F.trace.deleteSpan(Z);let $=F.trace.getSpan(Z);if((0,kJ.isTracingSuppressed)(Z))return F.diag.debug("Instrumentation suppressed, returning Noop Span"),F.trace.wrapSpanContext(F.INVALID_SPAN_CONTEXT);let q=$?.spanContext(),W=this._idGenerator.generateSpanId(),X,H,Y;if(!q||!F.trace.isSpanContextValid(q))H=this._idGenerator.generateTraceId();else H=q.traceId,Y=q.traceState,X=q;let V=Q.kind??F.SpanKind.INTERNAL,R=(Q.links??[]).map((D)=>{return{context:D.context,attributes:(0,kJ.sanitizeAttributes)(D.attributes)}}),z=(0,kJ.sanitizeAttributes)(Q.attributes),U=this._sampler.shouldSample(Z,H,J,V,z,R),I=this._tracerMetrics.startSpan(q,U.decision);Y=U.traceState??Y;let G=U.decision===F.SamplingDecision.RECORD_AND_SAMPLED?F.TraceFlags.SAMPLED:F.TraceFlags.NONE,w={traceId:H,spanId:W,traceFlags:G,traceState:Y};if(U.decision===F.SamplingDecision.NOT_RECORD)return F.diag.debug("Recording is off, propagating context in a non-recording span"),F.trace.wrapSpanContext(w);let B=(0,kJ.sanitizeAttributes)(Object.assign(z,U.attributes));return new f6.SpanImpl({resource:this._resource,scope:this.instrumentationScope,context:Z,spanContext:w,name:J,kind:V,links:R,parentSpanContext:X,attributes:B,startTime:Q.startTime,spanProcessor:this._spanProcessor,spanLimits:this._spanLimits,recordEndMetrics:I})}startActiveSpan(J,Q,Z,$){let q,W,X;if(arguments.length<2)return;else if(arguments.length===2)X=Q;else if(arguments.length===3)q=Q,X=Z;else q=Q,W=Z,X=$;let H=W??F.context.active(),Y=this.startSpan(J,q,H),V=F.trace.setSpan(H,Y);return F.context.with(V,X,void 0,Y)}getGeneralLimits(){return this._generalLimits}getSpanLimits(){return this._spanLimits}}PZ.Tracer=LZ});var xZ=K((bZ)=>{Object.defineProperty(bZ,"__esModule",{value:!0});bZ.MultiSpanProcessor=void 0;var d6=E();class TZ{_spanProcessors;constructor(J){this._spanProcessors=J}forceFlush(){let J=[];for(let Q of this._spanProcessors)J.push(Q.forceFlush());return new Promise((Q)=>{Promise.all(J).then(()=>{Q()}).catch((Z)=>{(0,d6.globalErrorHandler)(Z||Error("MultiSpanProcessor: forceFlush failed")),Q()})})}onStart(J,Q){for(let Z of this._spanProcessors)Z.onStart(J,Q)}onEnding(J){for(let Q of this._spanProcessors)if(Q.onEnding)Q.onEnding(J)}onEnd(J){for(let Q of this._spanProcessors)Q.onEnd(J)}shutdown(){let J=[];for(let Q of this._spanProcessors)J.push(Q.shutdown());return new Promise((Q,Z)=>{Promise.all(J).then(()=>{Q()},Z)})}}bZ.MultiSpanProcessor=TZ});var lZ=K((vZ)=>{Object.defineProperty(vZ,"__esModule",{value:!0});vZ.BasicTracerProvider=vZ.ForceFlushState=void 0;var y6=E(),S6=yZ(),v6=fZ(),g6=gJ(),l6=xZ(),m6=lJ(),o;(function(J){J[J.resolved=0]="resolved",J[J.timeout=1]="timeout",J[J.error=2]="error",J[J.unresolved=3]="unresolved"})(o=vZ.ForceFlushState||(vZ.ForceFlushState={}));class SZ{_config;_tracers=new Map;_resource;_activeSpanProcessor;constructor(J={}){let Q=(0,y6.merge)({},(0,g6.loadDefaultConfig)(),(0,m6.reconfigureLimits)(J));this._resource=Q.resource??(0,S6.defaultResource)(),this._config=Object.assign({},Q,{resource:this._resource});let Z=[];if(J.spanProcessors?.length)Z.push(...J.spanProcessors);this._activeSpanProcessor=new l6.MultiSpanProcessor(Z)}getTracer(J,Q,Z){let $=`${J}@${Q||""}:${Z?.schemaUrl||""}`;if(!this._tracers.has($))this._tracers.set($,new v6.Tracer({name:J,version:Q,schemaUrl:Z?.schemaUrl},this._config,this._resource,this._activeSpanProcessor));return this._tracers.get($)}forceFlush(){let J=this._config.forceFlushTimeoutMillis,Q=this._activeSpanProcessor._spanProcessors.map((Z)=>{return new Promise(($)=>{let q,W=setTimeout(()=>{$(Error(`Span processor did not completed within timeout period of ${J} ms`)),q=o.timeout},J);Z.forceFlush().then(()=>{if(clearTimeout(W),q!==o.timeout)q=o.resolved,$(q)}).catch((X)=>{clearTimeout(W),q=o.error,$(X)})})});return new Promise((Z,$)=>{Promise.all(Q).then((q)=>{let W=q.filter((X)=>X!==o.resolved);if(W.length>0)$(W);else Z()}).catch((q)=>$([q]))})}shutdown(){return this._activeSpanProcessor.shutdown()}}vZ.BasicTracerProvider=SZ});var pZ=K((uZ)=>{Object.defineProperty(uZ,"__esModule",{value:!0});uZ.ConsoleSpanExporter=void 0;var uJ=E();class mZ{export(J,Q){return this._sendSpans(J,Q)}shutdown(){return this._sendSpans([]),this.forceFlush()}forceFlush(){return Promise.resolve()}_exportInfo(J){return{resource:{attributes:J.resource.attributes},instrumentationScope:J.instrumentationScope,traceId:J.spanContext().traceId,parentSpanContext:J.parentSpanContext,traceState:J.spanContext().traceState?.serialize(),name:J.name,id:J.spanContext().spanId,kind:J.kind,timestamp:(0,uJ.hrTimeToMicroseconds)(J.startTime),duration:(0,uJ.hrTimeToMicroseconds)(J.duration),attributes:J.attributes,status:J.status,events:J.events,links:J.links}}_sendSpans(J,Q){for(let Z of J)console.dir(this._exportInfo(Z),{depth:3});if(Q)return Q({code:uJ.ExportResultCode.SUCCESS})}}uZ.ConsoleSpanExporter=mZ});var aZ=K((sZ)=>{Object.defineProperty(sZ,"__esModule",{value:!0});sZ.InMemorySpanExporter=void 0;var nZ=E();class iZ{_finishedSpans=[];_stopped=!1;export(J,Q){if(this._stopped)return Q({code:nZ.ExportResultCode.FAILED,error:Error("Exporter has been stopped")});this._finishedSpans.push(...J),setTimeout(()=>Q({code:nZ.ExportResultCode.SUCCESS}),0)}shutdown(){return this._stopped=!0,this._finishedSpans=[],this.forceFlush()}forceFlush(){return Promise.resolve()}reset(){this._finishedSpans=[]}getFinishedSpans(){return this._finishedSpans}}sZ.InMemorySpanExporter=iZ});var J0=K((tZ)=>{Object.defineProperty(tZ,"__esModule",{value:!0});tZ.SimpleSpanProcessor=void 0;var u6=M(),IJ=E();class rZ{_exporter;_shutdownOnce;_pendingExports;constructor(J){this._exporter=J,this._shutdownOnce=new IJ.BindOnceFuture(this._shutdown,this),this._pendingExports=new Set}async forceFlush(){if(await Promise.all(Array.from(this._pendingExports)),this._exporter.forceFlush)await this._exporter.forceFlush()}onStart(J,Q){}onEnd(J){if(this._shutdownOnce.isCalled)return;if((J.spanContext().traceFlags&u6.TraceFlags.SAMPLED)===0)return;let Q=this._doExport(J).catch((Z)=>(0,IJ.globalErrorHandler)(Z));this._pendingExports.add(Q),Q.finally(()=>this._pendingExports.delete(Q))}async _doExport(J){if(J.resource.asyncAttributesPending)await J.resource.waitForAsyncAttributes?.();let Q=await IJ.internal._export(this._exporter,[J]);if(Q.code!==IJ.ExportResultCode.SUCCESS)throw Q.error??Error(`SimpleSpanProcessor: span export failed (status ${Q})`)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return this._exporter.shutdown()}}tZ.SimpleSpanProcessor=rZ});var q0=K((Z0)=>{Object.defineProperty(Z0,"__esModule",{value:!0});Z0.NoopSpanProcessor=void 0;class Q0{onStart(J,Q){}onEnd(J){}shutdown(){return Promise.resolve()}forceFlush(){return Promise.resolve()}}Z0.NoopSpanProcessor=Q0});var cJ=K((A)=>{Object.defineProperty(A,"__esModule",{value:!0});A.SamplingDecision=A.TraceIdRatioBasedSampler=A.ParentBasedSampler=A.AlwaysOnSampler=A.AlwaysOffSampler=A.NoopSpanProcessor=A.SimpleSpanProcessor=A.InMemorySpanExporter=A.ConsoleSpanExporter=A.RandomIdGenerator=A.BatchSpanProcessor=A.BasicTracerProvider=void 0;var c6=lZ();Object.defineProperty(A,"BasicTracerProvider",{enumerable:!0,get:function(){return c6.BasicTracerProvider}});var W0=mJ();Object.defineProperty(A,"BatchSpanProcessor",{enumerable:!0,get:function(){return W0.BatchSpanProcessor}});Object.defineProperty(A,"RandomIdGenerator",{enumerable:!0,get:function(){return W0.RandomIdGenerator}});var p6=pZ();Object.defineProperty(A,"ConsoleSpanExporter",{enumerable:!0,get:function(){return p6.ConsoleSpanExporter}});var n6=aZ();Object.defineProperty(A,"InMemorySpanExporter",{enumerable:!0,get:function(){return n6.InMemorySpanExporter}});var i6=J0();Object.defineProperty(A,"SimpleSpanProcessor",{enumerable:!0,get:function(){return i6.SimpleSpanProcessor}});var s6=q0();Object.defineProperty(A,"NoopSpanProcessor",{enumerable:!0,get:function(){return s6.NoopSpanProcessor}});var o6=wJ();Object.defineProperty(A,"AlwaysOffSampler",{enumerable:!0,get:function(){return o6.AlwaysOffSampler}});var a6=VJ();Object.defineProperty(A,"AlwaysOnSampler",{enumerable:!0,get:function(){return a6.AlwaysOnSampler}});var r6=dJ();Object.defineProperty(A,"ParentBasedSampler",{enumerable:!0,get:function(){return r6.ParentBasedSampler}});var t6=yJ();Object.defineProperty(A,"TraceIdRatioBasedSampler",{enumerable:!0,get:function(){return t6.TraceIdRatioBasedSampler}});var e6=i();Object.defineProperty(A,"SamplingDecision",{enumerable:!0,get:function(){return e6.SamplingDecision}})});var H0=K((X0)=>{Object.defineProperty(X0,"__esModule",{value:!0});X0.NodeTracerProvider=void 0;var Q7=EQ(),Z7=cJ(),WJ=M(),pJ=E();function $7(J){if(J===null)return;if(J===void 0){let Q=new Q7.AsyncLocalStorageContextManager;Q.enable(),WJ.context.setGlobalContextManager(Q);return}J.enable(),WJ.context.setGlobalContextManager(J)}function q7(J){if(J===null)return;if(J===void 0){WJ.propagation.setGlobalPropagator(new pJ.CompositePropagator({propagators:[new pJ.W3CTraceContextPropagator,new pJ.W3CBaggagePropagator]}));return}WJ.propagation.setGlobalPropagator(J)}class z0 extends Z7.BasicTracerProvider{constructor(J={}){super(J)}register(J={}){WJ.trace.setGlobalTracerProvider(this),$7(J.contextManager),q7(J.propagator)}}X0.NodeTracerProvider=z0});var K0=K((k)=>{Object.defineProperty(k,"__esModule",{value:!0});k.TraceIdRatioBasedSampler=k.SimpleSpanProcessor=k.SamplingDecision=k.RandomIdGenerator=k.ParentBasedSampler=k.NoopSpanProcessor=k.InMemorySpanExporter=k.ConsoleSpanExporter=k.BatchSpanProcessor=k.BasicTracerProvider=k.AlwaysOnSampler=k.AlwaysOffSampler=k.NodeTracerProvider=void 0;var W7=H0();Object.defineProperty(k,"NodeTracerProvider",{enumerable:!0,get:function(){return W7.NodeTracerProvider}});var L=cJ();Object.defineProperty(k,"AlwaysOffSampler",{enumerable:!0,get:function(){return L.AlwaysOffSampler}});Object.defineProperty(k,"AlwaysOnSampler",{enumerable:!0,get:function(){return L.AlwaysOnSampler}});Object.defineProperty(k,"BasicTracerProvider",{enumerable:!0,get:function(){return L.BasicTracerProvider}});Object.defineProperty(k,"BatchSpanProcessor",{enumerable:!0,get:function(){return L.BatchSpanProcessor}});Object.defineProperty(k,"ConsoleSpanExporter",{enumerable:!0,get:function(){return L.ConsoleSpanExporter}});Object.defineProperty(k,"InMemorySpanExporter",{enumerable:!0,get:function(){return L.InMemorySpanExporter}});Object.defineProperty(k,"NoopSpanProcessor",{enumerable:!0,get:function(){return L.NoopSpanProcessor}});Object.defineProperty(k,"ParentBasedSampler",{enumerable:!0,get:function(){return L.ParentBasedSampler}});Object.defineProperty(k,"RandomIdGenerator",{enumerable:!0,get:function(){return L.RandomIdGenerator}});Object.defineProperty(k,"SamplingDecision",{enumerable:!0,get:function(){return L.SamplingDecision}});Object.defineProperty(k,"SimpleSpanProcessor",{enumerable:!0,get:function(){return L.SimpleSpanProcessor}});Object.defineProperty(k,"TraceIdRatioBasedSampler",{enumerable:!0,get:function(){return L.TraceIdRatioBasedSampler}})});var a0=d(K0(),1);var MJ=(J)=>J!==void 0&&!(Array.isArray(J)&&J.length===0);var HJ=d(M(),1);var v;(function(J){J[J.UNSPECIFIED=0]="UNSPECIFIED",J[J.TRACE=1]="TRACE",J[J.TRACE2=2]="TRACE2",J[J.TRACE3=3]="TRACE3",J[J.TRACE4=4]="TRACE4",J[J.DEBUG=5]="DEBUG",J[J.DEBUG2=6]="DEBUG2",J[J.DEBUG3=7]="DEBUG3",J[J.DEBUG4=8]="DEBUG4",J[J.INFO=9]="INFO",J[J.INFO2=10]="INFO2",J[J.INFO3=11]="INFO3",J[J.INFO4=12]="INFO4",J[J.WARN=13]="WARN",J[J.WARN2=14]="WARN2",J[J.WARN3=15]="WARN3",J[J.WARN4=16]="WARN4",J[J.ERROR=17]="ERROR",J[J.ERROR2=18]="ERROR2",J[J.ERROR3=19]="ERROR3",J[J.ERROR4=20]="ERROR4",J[J.FATAL=21]="FATAL",J[J.FATAL2=22]="FATAL2",J[J.FATAL3=23]="FATAL3",J[J.FATAL4=24]="FATAL4"})(v||(v={}));class zJ{emit(J){}}var XJ=new zJ;var YJ=Symbol.for("io.opentelemetry.js.api.logs"),a=globalThis;function G0(J,Q,Z){return($)=>$===J?Q:Z}var nJ=1;class w0{getLogger(J,Q,Z){return new zJ}}var AJ=new w0;class iJ{constructor(J,Q,Z,$){this._provider=J,this.name=Q,this.version=Z,this.options=$}emit(J){this._getLogger().emit(J)}_getLogger(){if(this._delegate)return this._delegate;let J=this._provider._getDelegateLogger(this.name,this.version,this.options);if(!J)return XJ;return this._delegate=J,this._delegate}}class RJ{getLogger(J,Q,Z){var $;return($=this._getDelegateLogger(J,Q,Z))!==null&&$!==void 0?$:new iJ(this,J,Q,Z)}_getDelegate(){var J;return(J=this._delegate)!==null&&J!==void 0?J:AJ}_setDelegate(J){this._delegate=J}_getDelegateLogger(J,Q,Z){var $;return($=this._delegate)===null||$===void 0?void 0:$.getLogger(J,Q,Z)}}class CJ{constructor(){this._proxyLoggerProvider=new RJ}static getInstance(){if(!this._instance)this._instance=new CJ;return this._instance}setGlobalLoggerProvider(J){if(a[YJ])return this.getLoggerProvider();return a[YJ]=G0(nJ,J,AJ),this._proxyLoggerProvider._setDelegate(J),J}getLoggerProvider(){var J,Q;return(Q=(J=a[YJ])===null||J===void 0?void 0:J.call(a,nJ))!==null&&Q!==void 0?Q:this._proxyLoggerProvider}getLogger(J,Q,Z){return this.getLoggerProvider().getLogger(J,Q,Z)}disable(){delete a[YJ],this._proxyLoggerProvider=new RJ}}var l8=CJ.getInstance();var j0=d(yZ(),1),F0=d(E(),1);var T=d(M(),1);var f=d(M(),1),oJ=d(E(),1),C=d(AQ(),1);function V0(J){return sJ(J,new WeakSet)}function sJ(J,Q){if(J==null)return!0;if(typeof J==="string"||typeof J==="number"||typeof J==="boolean")return!0;if(J instanceof Uint8Array)return!0;if(typeof J==="object"){if(Q.has(J))return!1;if(Q.add(J),Array.isArray(J))return J.every(($)=>sJ($,Q));let Z=J;if(Z.constructor!==Object&&Z.constructor!==void 0)return!1;return Object.values(Z).every(($)=>sJ($,Q))}return!1}class aJ{hrTime;hrTimeObserved;spanContext;resource;instrumentationScope;attributes={};_severityText;_severityNumber;_body;_eventName;_attributesCount=0;_droppedAttributesCount=0;_isReadonly=!1;_logRecordLimits;set severityText(J){if(this._isLogRecordReadonly())return;this._severityText=J}get severityText(){return this._severityText}set severityNumber(J){if(this._isLogRecordReadonly())return;this._severityNumber=J}get severityNumber(){return this._severityNumber}set body(J){if(this._isLogRecordReadonly())return;this._body=J}get body(){return this._body}get eventName(){return this._eventName}set eventName(J){if(this._isLogRecordReadonly())return;this._eventName=J}get droppedAttributesCount(){return this._droppedAttributesCount}constructor(J,Q,Z){let{timestamp:$,observedTimestamp:q,eventName:W,severityNumber:X,severityText:H,body:Y,attributes:V={},exception:R,context:z}=Z,U=Date.now();if(this.hrTime=oJ.timeInputToHrTime($??U),this.hrTimeObserved=oJ.timeInputToHrTime(q??U),z){let I=f.trace.getSpanContext(z);if(I&&f.isSpanContextValid(I))this.spanContext=I}if(this.severityNumber=X,this.severityText=H,this.body=Y,this.resource=J.resource,this.instrumentationScope=Q,this._logRecordLimits=J.logRecordLimits,this._eventName=W,this.setAttributes(V),R!=null)this._setException(R)}setAttribute(J,Q){if(this._isLogRecordReadonly())return this;if(J.length===0)return f.diag.warn(`Invalid attribute key: ${J}`),this;if(!V0(Q))return f.diag.warn(`Invalid attribute value set for key: ${J}`),this;let Z=!Object.prototype.hasOwnProperty.call(this.attributes,J);if(Z&&this._attributesCount>=this._logRecordLimits.attributeCountLimit){if(this._droppedAttributesCount++,this._droppedAttributesCount===1)f.diag.warn("Dropping extra attributes.");return this}if(this.attributes[J]=this._truncateToSize(Q),Z)this._attributesCount++;return this}setAttributes(J){for(let[Q,Z]of Object.entries(J))this.setAttribute(Q,Z);return this}setBody(J){return this.body=J,this}setEventName(J){return this.eventName=J,this}setSeverityNumber(J){return this.severityNumber=J,this}setSeverityText(J){return this.severityText=J,this}_makeReadonly(){this._isReadonly=!0}_truncateToSize(J){let Q=this._logRecordLimits.attributeValueLengthLimit;if(Q<=0)return f.diag.warn(`Attribute value limit must be positive, got ${Q}`),J;if(J==null)return J;if(typeof J==="string")return this._truncateToLimitUtil(J,Q);if(J instanceof Uint8Array)return J;if(Array.isArray(J))return J.map((Z)=>this._truncateToSize(Z));if(typeof J==="object"){let Z={};for(let[$,q]of Object.entries(J))Z[$]=this._truncateToSize(q);return Z}return J}_setException(J){let Q=!1;if(typeof J==="string"||typeof J==="number"){if(!Object.hasOwn(this.attributes,C.ATTR_EXCEPTION_MESSAGE))this.setAttribute(C.ATTR_EXCEPTION_MESSAGE,String(J));Q=!0}else if(J&&typeof J==="object"){let Z=J;if(Z.code){if(!Object.hasOwn(this.attributes,C.ATTR_EXCEPTION_TYPE))this.setAttribute(C.ATTR_EXCEPTION_TYPE,Z.code.toString());Q=!0}else if(Z.name){if(!Object.hasOwn(this.attributes,C.ATTR_EXCEPTION_TYPE))this.setAttribute(C.ATTR_EXCEPTION_TYPE,Z.name);Q=!0}if(Z.message){if(!Object.hasOwn(this.attributes,C.ATTR_EXCEPTION_MESSAGE))this.setAttribute(C.ATTR_EXCEPTION_MESSAGE,Z.message);Q=!0}if(Z.stack){if(!Object.hasOwn(this.attributes,C.ATTR_EXCEPTION_STACKTRACE))this.setAttribute(C.ATTR_EXCEPTION_STACKTRACE,Z.stack);Q=!0}}if(!Q)f.diag.warn(`Failed to record an exception ${J}`)}_truncateToLimitUtil(J,Q){if(J.length<=Q)return J;return J.substring(0,Q)}_isLogRecordReadonly(){if(this._isReadonly)f.diag.warn("Can not execute the operation on emitted log record");return this._isReadonly}}class rJ{instrumentationScope;_sharedState;_loggerConfig;constructor(J,Q){this.instrumentationScope=J,this._sharedState=Q,this._loggerConfig=this._sharedState.getLoggerConfig(this.instrumentationScope)}emit(J){let Q=this._loggerConfig,Z=J.context||T.context.active(),$=J.severityNumber??v.UNSPECIFIED;if($!==v.UNSPECIFIED&&$<Q.minimumSeverity)return;if(Q.traceBased){let W=T.trace.getSpanContext(Z);if(W&&T.isSpanContextValid(W)){if((W.traceFlags&T.TraceFlags.SAMPLED)!==T.TraceFlags.SAMPLED)return}}let q=new aJ(this._sharedState,this.instrumentationScope,{context:Z,...J});this._sharedState.activeProcessor.onEmit(q,Z),q._makeReadonly()}}class tJ{forceFlush(){return Promise.resolve()}onEmit(J,Q){}shutdown(){return Promise.resolve()}}var U0=d(E(),1);class eJ{processors;forceFlushTimeoutMillis;constructor(J,Q){this.processors=J,this.forceFlushTimeoutMillis=Q}async forceFlush(){let J=this.forceFlushTimeoutMillis;await Promise.all(this.processors.map((Q)=>U0.callWithTimeout(Q.forceFlush(),J)))}onEmit(J,Q){this.processors.forEach((Z)=>Z.onEmit(J,Q))}async shutdown(){await Promise.all(this.processors.map((J)=>J.shutdown()))}}function B0(J){return`${J.name}@${J.version||""}:${J.schemaUrl||""}`}var X7={disabled:!1,minimumSeverity:v.UNSPECIFIED,traceBased:!1},JQ=()=>({...X7});class QQ{loggers=new Map;activeProcessor;registeredLogRecordProcessors=[];resource;forceFlushTimeoutMillis;logRecordLimits;processors;_loggerConfigurator;_loggerConfigs=new Map;constructor(J,Q,Z,$,q){if(this.resource=J,this.forceFlushTimeoutMillis=Q,this.logRecordLimits=Z,this.processors=$,$.length>0)this.registeredLogRecordProcessors=$,this.activeProcessor=new eJ(this.registeredLogRecordProcessors,this.forceFlushTimeoutMillis);else this.activeProcessor=new tJ;this._loggerConfigurator=q??JQ}getLoggerConfig(J){let Q=B0(J),Z=this._loggerConfigs.get(Q);if(Z)return Z;return Z=this._loggerConfigurator(J),this._loggerConfigs.set(Q,Z),Z}}var Y7="unknown";class LJ{_shutdownOnce;_sharedState;constructor(J={}){let Q={resource:J.resource??j0.defaultResource(),forceFlushTimeoutMillis:J.forceFlushTimeoutMillis??30000,logRecordLimits:{attributeCountLimit:J.logRecordLimits?.attributeCountLimit??128,attributeValueLengthLimit:J.logRecordLimits?.attributeValueLengthLimit??1/0},loggerConfigurator:J.loggerConfigurator??JQ,processors:J.processors??[]};this._sharedState=new QQ(Q.resource,Q.forceFlushTimeoutMillis,Q.logRecordLimits,Q.processors,Q.loggerConfigurator),this._shutdownOnce=new F0.BindOnceFuture(this._shutdown,this)}getLogger(J,Q,Z){if(this._shutdownOnce.isCalled)return HJ.diag.warn("A shutdown LoggerProvider cannot provide a Logger"),XJ;if(!J)HJ.diag.warn("Logger requested without instrumentation scope name.");let $=J||Y7,q=`${$}@${Q||""}:${Z?.schemaUrl||""}`;if(!this._sharedState.loggers.has(q))this._sharedState.loggers.set(q,new rJ({name:$,version:Q,schemaUrl:Z?.schemaUrl},this._sharedState));return this._sharedState.loggers.get(q)}forceFlush(){if(this._shutdownOnce.isCalled)return HJ.diag.warn("invalid attempt to force flush after LoggerProvider shutdown"),this._shutdownOnce.promise;return this._sharedState.activeProcessor.forceFlush()}shutdown(){if(this._shutdownOnce.isCalled)return HJ.diag.warn("shutdown may only be called once per LoggerProvider"),this._shutdownOnce.promise;return this._shutdownOnce.call()}_shutdown(){return this._sharedState.activeProcessor.shutdown()}}class qQ extends O0()("@effect/opentelemetry/Logger/OtelLoggerProvider"){}var G7=g(function*(){let J=yield*qQ,Q=yield*A0,Z=J.getLogger("@effect/opentelemetry");return L0(($)=>{let q={fiberId:$.fiber.id},W=D0($.fiber.context,E0);if(h0(W))q.spanId=W.spanId,q.traceId=W.traceId;for(let[V,R]of Object.entries($.fiber.getRef(k0)))q[V]=ZQ(R);let X=$.date.getTime();for(let[V,R]of $.fiber.getRef(I0))q[`logSpan.${V}`]=`${X-R}ms`;let H=$Q($.message).map(ZQ),Y=N0(Q.currentTimeNanosUnsafe());Z.emit({body:H.length===1?H[0]:H,severityText:$.logLevel,severityNumber:C0($.logLevel),timestamp:Y,observedTimestamp:Y,attributes:q})})}),f0=(J)=>P0([G7],{mergeWithExisting:J.mergeWithExisting??!0}),T0=(J,Q)=>PJ(qQ,g(function*(){let Z=yield*ZJ;return yield*JJ(u(()=>new LJ({...Q??void 0,processors:$Q(J),resource:Z})),($)=>r(()=>$.forceFlush().then(()=>$.shutdown())).pipe(t,QJ,e(Q?.shutdownTimeout??3000)))}));var l=d(M(),1);var c;(function(J){J[J.DELTA=0]="DELTA",J[J.CUMULATIVE=1]="CUMULATIVE"})(c||(c={}));var P;(function(J){J.COUNTER="COUNTER",J.GAUGE="GAUGE",J.HISTOGRAM="HISTOGRAM",J.UP_DOWN_COUNTER="UP_DOWN_COUNTER",J.OBSERVABLE_COUNTER="OBSERVABLE_COUNTER",J.OBSERVABLE_GAUGE="OBSERVABLE_GAUGE",J.OBSERVABLE_UP_DOWN_COUNTER="OBSERVABLE_UP_DOWN_COUNTER"})(P||(P={}));var b;(function(J){J[J.HISTOGRAM=0]="HISTOGRAM",J[J.EXPONENTIAL_HISTOGRAM=1]="EXPONENTIAL_HISTOGRAM",J[J.GAUGE=2]="GAUGE",J[J.SUM=3]="SUM"})(b||(b={}));var V7="@effect/opentelemetry/Metrics";class zQ{resource;context;temporality;startTimes;startTimeNanos;previousExportTimeNanos;previousCounterState;previousHistogramState;previousFrequencyState;previousSummaryState;constructor(J,Q,Z="cumulative"){this.resource=J,this.context=Q,this.temporality=Z,this.startTimes=new Map,this.startTimeNanos=b0(),this.previousExportTimeNanos=this.startTimeNanos,this.previousCounterState=new Map,this.previousHistogramState=new Map,this.previousFrequencyState=new Map,this.previousSummaryState=new Map}startTimeFor(J,Q){if(this.startTimes.has(J))return this.startTimes.get(J);return this.startTimes.set(J,Q),Q}collect(J){let Q=x0(this.context),Z=b0(),$=[],q=new Map,W=(V)=>{$.push(V),q.set(V.descriptor.name,V)},X=this.temporality==="delta",H=X?c.DELTA:c.CUMULATIVE,Y=X?this.previousExportTimeNanos:this.startTimeNanos;for(let V=0,R=Q.length;V<R;V++){let z=Q[V],U=z.attributes?_0(Object.entries(z.attributes),{},(G,[w,B])=>{return G[w]=String(B),G}):{},I=U7(z.id,z.attributes);switch(z.type){case"Counter":{let G=z.state.count,w=G;if(X){let j=this.previousCounterState.get(I);if(j!==void 0)if(typeof G==="bigint"&&typeof j==="bigint"){if(w=G-j,w<0n)w=G}else{let y=Number(G),p=Number(j);if(w=y-p,w<0)w=y}this.previousCounterState.set(I,G)}let B=$J(z,U),D={startTime:this.startTimeFor(B.name,Y),endTime:Z,attributes:U,value:Number(w)};if(q.has(z.id))q.get(z.id).dataPoints.push(D);else W({dataPointType:b.SUM,descriptor:B,isMonotonic:z.state.incremental,aggregationTemporality:H,dataPoints:[D]});break}case"Gauge":{let G=$J(z,U),B={startTime:this.startTimeFor(G.name,this.startTimeNanos),endTime:Z,attributes:U,value:Number(z.state.value)};if(q.has(z.id))q.get(z.id).dataPoints.push(B);else W({dataPointType:b.GAUGE,descriptor:G,aggregationTemporality:c.CUMULATIVE,dataPoints:[B]});break}case"Histogram":{let G=z.state.buckets.length,w={boundaries:WQ(G-1),counts:WQ(G)},B=0,N=0;for(let[n,KJ]of z.state.buckets){if(B<G-1)w.boundaries[B]=n;w.counts[B]=KJ-N,N=KJ,B++}let D=z.state.count,j=z.state.sum,y=w.counts,p=z.state.min,fJ=z.state.max;if(X){let n=this.previousHistogramState.get(I);if(n!==void 0)D=z.state.count-n.count,j=z.state.sum-n.sum,y=w.counts.map((KJ,r0)=>Math.max(0,KJ-(n.bucketCounts[r0]??0)));this.previousHistogramState.set(I,{count:z.state.count,sum:z.state.sum,bucketCounts:w.counts.slice(),min:z.state.min,max:z.state.max})}let YQ=$J(z,U),HQ={startTime:this.startTimeFor(YQ.name,Y),endTime:Z,attributes:U,value:{buckets:{boundaries:w.boundaries,counts:y},count:D,min:p,max:fJ,sum:j}};if(q.has(z.id))q.get(z.id).dataPoints.push(HQ);else W({dataPointType:b.HISTOGRAM,descriptor:YQ,aggregationTemporality:H,dataPoints:[HQ]});break}case"Frequency":{let G=[],w=new Map;for(let[B,N]of z.state.occurrences){w.set(B,N);let D=N;if(X){let p=this.previousFrequencyState.get(I);if(p!==void 0){let fJ=p.get(B)??0;D=Math.max(0,N-fJ)}}let j=$J(z,U),y=this.startTimeFor(j.name,Y);G.push({startTime:y,endTime:Z,attributes:{...U,key:B},value:D})}if(X)this.previousFrequencyState.set(I,w);if(q.has(z.id))q.get(z.id).dataPoints.push(...G);else{let B=$J(z,U);W({dataPointType:b.SUM,descriptor:B,aggregationTemporality:H,isMonotonic:!0,dataPoints:G})}break}case"Summary":{let G=[{startTime:Y,endTime:Z,attributes:{...U,quantile:"min"},value:z.state.min}];for(let[j,y]of z.state.quantiles)G.push({startTime:Y,endTime:Z,attributes:{...U,quantile:j.toString()},value:y??0});G.push({startTime:Y,endTime:Z,attributes:{...U,quantile:"max"},value:z.state.max});let w=z.state.count,B=z.state.sum;if(X){let j=this.previousSummaryState.get(I);if(j!==void 0)w=z.state.count-j.count,B=z.state.sum-j.sum;this.previousSummaryState.set(I,{count:z.state.count,sum:z.state.sum})}let N={startTime:Y,endTime:Z,attributes:U,value:w},D={startTime:Y,endTime:Z,attributes:U,value:B};if(q.has(`${z.id}_quantiles`))q.get(`${z.id}_quantiles`).dataPoints.push(...G),q.get(`${z.id}_count`).dataPoints.push(N),q.get(`${z.id}_sum`).dataPoints.push(D);else{let j=$J(z,U);W({dataPointType:b.SUM,descriptor:{...j,name:`${j.name}_quantiles`},aggregationTemporality:H,isMonotonic:!1,dataPoints:G}),W({dataPointType:b.SUM,descriptor:{name:`${z.id}_count`,description:z.description??"",unit:"1",type:P.COUNTER,valueType:l.ValueType.INT,advice:{}},aggregationTemporality:H,isMonotonic:!0,dataPoints:[N]}),W({dataPointType:b.SUM,descriptor:{name:`${z.id}_sum`,description:z.description??"",unit:"1",type:P.COUNTER,valueType:l.ValueType.DOUBLE,advice:{}},aggregationTemporality:H,isMonotonic:!0,dataPoints:[D]})}break}}}if(X)this.previousExportTimeNanos=Z;return Promise.resolve({resourceMetrics:{resource:this.resource,scopeMetrics:[{scope:{name:V7},metrics:$}]},errors:[]})}}var U7=(J,Q)=>{if(Q===void 0||Object.keys(Q).length===0)return J;let Z=Object.entries(Q).sort(($,q)=>$[0].localeCompare(q[0]));return`${J}:${JSON.stringify(Z)}`},b0=()=>{let J=Date.now();return[Math.floor(J/1000),J%1000*1e6]},$J=(J,Q)=>{let Z=Q.unit??Q.time_unit??"1";return{name:J.id,description:J.description??"",unit:Z,type:B7(J),valueType:j7(J),advice:{}}},B7=(J)=>{switch(J.type){case"Histogram":return P.HISTOGRAM;case"Gauge":return P.OBSERVABLE_GAUGE;case"Frequency":return P.COUNTER;case"Counter":return J.state.incremental?P.COUNTER:P.UP_DOWN_COUNTER;case"Summary":return P.COUNTER}},j7=(J)=>{if(J.type==="Counter")return typeof J.state.count==="bigint"?l.ValueType.INT:l.ValueType.DOUBLE;else if(J.type==="Gauge")return typeof J.state.value==="bigint"?l.ValueType.INT:l.ValueType.DOUBLE;return l.ValueType.DOUBLE};var F7=(J)=>g(function*(){let Q=yield*ZJ,Z=yield*S0();return new zQ(Q,Z,J)}),h7=(J,Q,Z)=>JJ(u(()=>{let $=Q(),q=Array.isArray($)?$:[$];return q.forEach((W)=>W.setMetricProducer(J)),q}),($)=>r(()=>Promise.all($.map((q)=>q.shutdown()))).pipe(t,QJ,e(Z?.shutdownTimeout??3000))),v0=(J,Q)=>d0(y0(F7(Q?.temporality),(Z)=>h7(Z,J,Q)));var D7=(J,Q)=>PJ(s0,g(function*(){let Z=yield*ZJ;return yield*JJ(u(()=>{return new a0.NodeTracerProvider({...Q??void 0,resource:Z,spanProcessors:Array.isArray(J)?J:[J]})}),($)=>r(()=>$.forceFlush().then(()=>$.shutdown())).pipe(t,QJ,e(Q?.shutdownTimeout??3000)))})),a9=(J)=>l0(g(function*(){let Q=yield*c0(J)?J:u(J),Z=n0(Q.resource&&p0(Q.resource)),$=MJ(Q.spanProcessor)?XQ(o0,D7(Q.spanProcessor,{...Q.tracerConfig,shutdownTimeout:Q.shutdownTimeout})):NJ,q=MJ(Q.metricReader)?v0(g0(Q.metricReader),{shutdownTimeout:Q.shutdownTimeout,temporality:Q.metricTemporality}):NJ,W=MJ(Q.logRecordProcessor)?XQ(f0({mergeWithExisting:Q.loggerMergeWithExisting}),T0(Q.logRecordProcessor,{...Q.loggerProviderConfig,shutdownTimeout:Q.shutdownTimeout})):NJ;return m0($,q,W).pipe(u0(Z))})),r9=i0;export{D7 as layerTracerProvider,r9 as layerEmpty,a9 as layer};
|
|
2
|
+
import{Aq as i0,Cq as s0,Dq as o0,tq as E,uq as yZ,vq as N0,wq as ZQ,xq as ZJ,yq as p0,zq as n0}from"./chunk-n9xns8by.js";import{Eq as AQ}from"./chunk-y9q0hb7b.js";import{DG as QJ,GE as NJ,GF as y0,HE as PJ,JE as d0,KE as l0,LE as m0,ME as XQ,NE as u0,Pz as g0,RC as E0,UE as A0,WB as WQ,YB as $Q,_F as t,aG as e,dO as C0,eA as h0,hC as _0,jE as k0,kE as I0,kF as x0,mC as O0,mF as c0,mG as S0,mO as L0,nO as P0,qF as r,sC as D0,uF as u,vG as JJ,zF as g}from"./chunk-zs8kqdsf.js";import{AO as M}from"./chunk-zw815d68.js";import{BO as d,CO as K,FO as TJ}from"./chunk-7xm75w1e.js";var bJ=K((GQ)=>{Object.defineProperty(GQ,"__esModule",{value:!0});GQ.AbstractAsyncHooksContextManager=void 0;var t0=TJ("events"),e0=["addListener","on","once","prependListener","prependOnceListener"];class KQ{bind(J,Q){if(Q instanceof t0.EventEmitter)return this._bindEventEmitter(J,Q);if(typeof Q==="function")return this._bindFunction(J,Q);return Q}_bindFunction(J,Q){let Z=this,$=function(...q){return Z.with(J,()=>Q.apply(this,q))};return Object.defineProperty($,"length",{enumerable:!1,configurable:!0,writable:!1,value:Q.length}),$}_bindEventEmitter(J,Q){if(this._getPatchMap(Q)!==void 0)return Q;if(this._createPatchMap(Q),e0.forEach(($)=>{if(Q[$]===void 0)return;Q[$]=this._patchAddListener(Q,Q[$],J)}),typeof Q.removeListener==="function")Q.removeListener=this._patchRemoveListener(Q,Q.removeListener);if(typeof Q.off==="function")Q.off=this._patchRemoveListener(Q,Q.off);if(typeof Q.removeAllListeners==="function")Q.removeAllListeners=this._patchRemoveAllListeners(Q,Q.removeAllListeners);return Q}_patchRemoveListener(J,Q){let Z=this;return function($,q){let W=Z._getPatchMap(J)?.[$];if(W===void 0)return Q.call(this,$,q);let X=W.get(q);return Q.call(this,$,X||q)}}_patchRemoveAllListeners(J,Q){let Z=this;return function($){let q=Z._getPatchMap(J);if(q!==void 0){if(arguments.length===0)Z._createPatchMap(J);else if(q[$]!==void 0)delete q[$]}return Q.apply(this,arguments)}}_patchAddListener(J,Q,Z){let $=this;return function(q,W){if($._wrapped)return Q.call(this,q,W);let X=$._getPatchMap(J);if(X===void 0)X=$._createPatchMap(J);let H=X[q];if(H===void 0)H=new WeakMap,X[q]=H;let Y=$.bind(Z,W);H.set(W,Y),$._wrapped=!0;try{return Q.call(this,q,Y)}finally{$._wrapped=!1}}}_createPatchMap(J){let Q=Object.create(null);return J[this._kOtListeners]=Q,Q}_getPatchMap(J){return J[this._kOtListeners]}_kOtListeners=Symbol("OtListeners");_wrapped=!1}GQ.AbstractAsyncHooksContextManager=KQ});var jQ=K((UQ)=>{Object.defineProperty(UQ,"__esModule",{value:!0});UQ.AsyncHooksContextManager=void 0;var J6=M(),Q6=TJ("async_hooks"),Z6=bJ();class VQ extends Z6.AbstractAsyncHooksContextManager{_asyncHook;_contexts=new Map;_stack=[];constructor(){super();this._asyncHook=Q6.createHook({init:this._init.bind(this),before:this._before.bind(this),after:this._after.bind(this),destroy:this._destroy.bind(this),promiseResolve:this._destroy.bind(this)})}active(){return this._stack[this._stack.length-1]??J6.ROOT_CONTEXT}with(J,Q,Z,...$){this._enterContext(J);try{return Q.call(Z,...$)}finally{this._exitContext()}}enable(){return this._asyncHook.enable(),this}disable(){return this._asyncHook.disable(),this._contexts.clear(),this._stack=[],this}_init(J,Q){if(Q==="TIMERWRAP")return;let Z=this._stack[this._stack.length-1];if(Z!==void 0)this._contexts.set(J,Z)}_destroy(J){this._contexts.delete(J)}_before(J){let Q=this._contexts.get(J);if(Q!==void 0)this._enterContext(Q)}_after(){this._exitContext()}_enterContext(J){this._stack.push(J)}_exitContext(){this._stack.pop()}}UQ.AsyncHooksContextManager=VQ});var DQ=K((hQ)=>{Object.defineProperty(hQ,"__esModule",{value:!0});hQ.AsyncLocalStorageContextManager=void 0;var $6=M(),q6=TJ("async_hooks"),W6=bJ();class FQ extends W6.AbstractAsyncHooksContextManager{_asyncLocalStorage;constructor(){super();this._asyncLocalStorage=new q6.AsyncLocalStorage}active(){return this._asyncLocalStorage.getStore()??$6.ROOT_CONTEXT}with(J,Q,Z,...$){let q=Z==null?Q:Q.bind(Z);return this._asyncLocalStorage.run(J,q,...$)}enable(){return this}disable(){return this._asyncLocalStorage.disable(),this}}hQ.AsyncLocalStorageContextManager=FQ});var EQ=K((GJ)=>{Object.defineProperty(GJ,"__esModule",{value:!0});GJ.AsyncLocalStorageContextManager=GJ.AsyncHooksContextManager=void 0;var z6=jQ();Object.defineProperty(GJ,"AsyncHooksContextManager",{enumerable:!0,get:function(){return z6.AsyncHooksContextManager}});var X6=DQ();Object.defineProperty(GJ,"AsyncLocalStorageContextManager",{enumerable:!0,get:function(){return X6.AsyncLocalStorageContextManager}})});var MQ=K((kQ)=>{Object.defineProperty(kQ,"__esModule",{value:!0});kQ.ExceptionEventName=void 0;kQ.ExceptionEventName="exception"});var PQ=K((CQ)=>{Object.defineProperty(CQ,"__esModule",{value:!0});CQ.SpanImpl=void 0;var h=M(),O=E(),m=AQ(),H6=MQ();class RQ{_spanContext;kind;parentSpanContext;attributes={};links=[];events=[];startTime;resource;instrumentationScope;_droppedAttributesCount=0;_droppedEventsCount=0;_droppedLinksCount=0;_attributesCount=0;name;status={code:h.SpanStatusCode.UNSET};endTime=[0,0];_ended=!1;_duration=[-1,-1];_spanProcessor;_spanLimits;_attributeValueLengthLimit;_recordEndMetrics;_performanceStartTime;_performanceOffset;_startTimeProvided;constructor(J){let Q=Date.now();if(this._spanContext=J.spanContext,this._performanceStartTime=O.otperformance.now(),this._performanceOffset=Q-(this._performanceStartTime+O.otperformance.timeOrigin),this._startTimeProvided=J.startTime!=null,this._spanLimits=J.spanLimits,this._attributeValueLengthLimit=this._spanLimits.attributeValueLengthLimit??0,this._spanProcessor=J.spanProcessor,this.name=J.name,this.parentSpanContext=J.parentSpanContext,this.kind=J.kind,J.links)for(let Z of J.links)this.addLink(Z);if(this.startTime=this._getTime(J.startTime??Q),this.resource=J.resource,this.instrumentationScope=J.scope,this._recordEndMetrics=J.recordEndMetrics,J.attributes!=null)this.setAttributes(J.attributes);this._spanProcessor.onStart(this,J.context)}spanContext(){return this._spanContext}setAttribute(J,Q){if(Q==null||this._isSpanEnded())return this;if(J.length===0)return h.diag.warn(`Invalid attribute key: ${J}`),this;if(!(0,O.isAttributeValue)(Q))return h.diag.warn(`Invalid attribute value set for key: ${J}`),this;let{attributeCountLimit:Z}=this._spanLimits,$=!Object.prototype.hasOwnProperty.call(this.attributes,J);if(Z!==void 0&&this._attributesCount>=Z&&$)return this._droppedAttributesCount++,this;if(this.attributes[J]=this._truncateToSize(Q),$)this._attributesCount++;return this}setAttributes(J){for(let Q in J)if(Object.prototype.hasOwnProperty.call(J,Q))this.setAttribute(Q,J[Q]);return this}addEvent(J,Q,Z){if(this._isSpanEnded())return this;let{eventCountLimit:$}=this._spanLimits;if($===0)return h.diag.warn("No events allowed."),this._droppedEventsCount++,this;if($!==void 0&&this.events.length>=$){if(this._droppedEventsCount===0)h.diag.debug("Dropping extra events.");this.events.shift(),this._droppedEventsCount++}if((0,O.isTimeInput)(Q)){if(!(0,O.isTimeInput)(Z))Z=Q;Q=void 0}let q=(0,O.sanitizeAttributes)(Q),{attributePerEventCountLimit:W}=this._spanLimits,X={},H=0,Y=0;for(let V in q){if(!Object.prototype.hasOwnProperty.call(q,V))continue;let R=q[V];if(W!==void 0&&Y>=W){H++;continue}X[V]=this._truncateToSize(R),Y++}return this.events.push({name:J,attributes:X,time:this._getTime(Z),droppedAttributesCount:H}),this}addLink(J){if(this._isSpanEnded())return this;let{linkCountLimit:Q}=this._spanLimits;if(Q===0)return this._droppedLinksCount++,this;if(Q!==void 0&&this.links.length>=Q){if(this._droppedLinksCount===0)h.diag.debug("Dropping extra links.");this.links.shift(),this._droppedLinksCount++}let{attributePerLinkCountLimit:Z}=this._spanLimits,$=(0,O.sanitizeAttributes)(J.attributes),q={},W=0,X=0;for(let Y in $){if(!Object.prototype.hasOwnProperty.call($,Y))continue;let V=$[Y];if(Z!==void 0&&X>=Z){W++;continue}q[Y]=this._truncateToSize(V),X++}let H={context:J.context};if(X>0)H.attributes=q;if(W>0)H.droppedAttributesCount=W;return this.links.push(H),this}addLinks(J){for(let Q of J)this.addLink(Q);return this}setStatus(J){if(this._isSpanEnded())return this;if(J.code===h.SpanStatusCode.UNSET)return this;if(this.status.code===h.SpanStatusCode.OK)return this;let Q={code:J.code};if(J.code===h.SpanStatusCode.ERROR){if(typeof J.message==="string")Q.message=J.message;else if(J.message!=null)h.diag.warn(`Dropping invalid status.message of type '${typeof J.message}', expected 'string'`)}return this.status=Q,this}updateName(J){if(this._isSpanEnded())return this;return this.name=J,this}end(J){if(this._isSpanEnded()){h.diag.error(`${this.name} ${this._spanContext.traceId}-${this._spanContext.spanId} - You can only call end() on a span once.`);return}if(this.endTime=this._getTime(J),this._duration=(0,O.hrTimeDuration)(this.startTime,this.endTime),this._duration[0]<0)h.diag.warn("Inconsistent start and end time, startTime > endTime. Setting span duration to 0ms.",this.startTime,this.endTime),this.endTime=this.startTime.slice(),this._duration=[0,0];if(this._droppedEventsCount>0)h.diag.warn(`Dropped ${this._droppedEventsCount} events because eventCountLimit reached`);if(this._droppedLinksCount>0)h.diag.warn(`Dropped ${this._droppedLinksCount} links because linkCountLimit reached`);if(this._spanProcessor.onEnding)this._spanProcessor.onEnding(this);this._recordEndMetrics?.(),this._ended=!0,this._spanProcessor.onEnd(this)}_getTime(J){if(typeof J==="number"&&J<=O.otperformance.now())return(0,O.hrTime)(J+this._performanceOffset);if(typeof J==="number")return(0,O.millisToHrTime)(J);if(J instanceof Date)return(0,O.millisToHrTime)(J.getTime());if((0,O.isTimeInputHrTime)(J))return J;if(this._startTimeProvided)return(0,O.millisToHrTime)(Date.now());let Q=O.otperformance.now()-this._performanceStartTime;return(0,O.addHrTimes)(this.startTime,(0,O.millisToHrTime)(Q))}isRecording(){return this._ended===!1}recordException(J,Q){let Z={};if(typeof J==="string")Z[m.ATTR_EXCEPTION_MESSAGE]=J;else if(J){if(J.code)Z[m.ATTR_EXCEPTION_TYPE]=J.code.toString();else if(J.name)Z[m.ATTR_EXCEPTION_TYPE]=J.name;if(J.message)Z[m.ATTR_EXCEPTION_MESSAGE]=J.message;if(J.stack)Z[m.ATTR_EXCEPTION_STACKTRACE]=J.stack}if(Z[m.ATTR_EXCEPTION_TYPE]||Z[m.ATTR_EXCEPTION_MESSAGE])this.addEvent(H6.ExceptionEventName,Z,Q);else h.diag.warn(`Failed to record an exception ${J}`)}get duration(){return this._duration}get ended(){return this._ended}get droppedAttributesCount(){return this._droppedAttributesCount}get droppedEventsCount(){return this._droppedEventsCount}get droppedLinksCount(){return this._droppedLinksCount}_isSpanEnded(){if(this._ended){let J=Error(`Operation attempted on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`);h.diag.warn(`Cannot execute the operation on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`,J)}return this._ended}_truncateToLimitUtil(J,Q){if(J.length<=Q)return J;return J.substring(0,Q)}_truncateToSize(J){let Q=this._attributeValueLengthLimit;if(Q<=0)return h.diag.warn(`Attribute value limit must be positive, got ${Q}`),J;if(typeof J==="string")return this._truncateToLimitUtil(J,Q);if(Array.isArray(J))return J.map((Z)=>typeof Z==="string"?this._truncateToLimitUtil(Z,Q):Z);return J}}CQ.SpanImpl=RQ});var i=K((NQ)=>{Object.defineProperty(NQ,"__esModule",{value:!0});NQ.SamplingDecision=void 0;var K6;(function(J){J[J.NOT_RECORD=0]="NOT_RECORD",J[J.RECORD=1]="RECORD",J[J.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"})(K6=NQ.SamplingDecision||(NQ.SamplingDecision={}))});var wJ=K((TQ)=>{Object.defineProperty(TQ,"__esModule",{value:!0});TQ.AlwaysOffSampler=void 0;var G6=i();class fQ{shouldSample(){return{decision:G6.SamplingDecision.NOT_RECORD}}toString(){return"AlwaysOffSampler"}}TQ.AlwaysOffSampler=fQ});var VJ=K((xQ)=>{Object.defineProperty(xQ,"__esModule",{value:!0});xQ.AlwaysOnSampler=void 0;var w6=i();class _Q{shouldSample(){return{decision:w6.SamplingDecision.RECORD_AND_SAMPLED}}toString(){return"AlwaysOnSampler"}}xQ.AlwaysOnSampler=_Q});var dJ=K((vQ)=>{Object.defineProperty(vQ,"__esModule",{value:!0});vQ.ParentBasedSampler=void 0;var UJ=M(),V6=E(),yQ=wJ(),xJ=VJ();class SQ{_root;_remoteParentSampled;_remoteParentNotSampled;_localParentSampled;_localParentNotSampled;constructor(J){if(this._root=J.root,!this._root)(0,V6.globalErrorHandler)(Error("ParentBasedSampler must have a root sampler configured")),this._root=new xJ.AlwaysOnSampler;this._remoteParentSampled=J.remoteParentSampled??new xJ.AlwaysOnSampler,this._remoteParentNotSampled=J.remoteParentNotSampled??new yQ.AlwaysOffSampler,this._localParentSampled=J.localParentSampled??new xJ.AlwaysOnSampler,this._localParentNotSampled=J.localParentNotSampled??new yQ.AlwaysOffSampler}shouldSample(J,Q,Z,$,q,W){let X=UJ.trace.getSpanContext(J);if(!X||!(0,UJ.isSpanContextValid)(X))return this._root.shouldSample(J,Q,Z,$,q,W);if(X.isRemote){if(X.traceFlags&UJ.TraceFlags.SAMPLED)return this._remoteParentSampled.shouldSample(J,Q,Z,$,q,W);return this._remoteParentNotSampled.shouldSample(J,Q,Z,$,q,W)}if(X.traceFlags&UJ.TraceFlags.SAMPLED)return this._localParentSampled.shouldSample(J,Q,Z,$,q,W);return this._localParentNotSampled.shouldSample(J,Q,Z,$,q,W)}toString(){return`ParentBased{root=${this._root.toString()}, remoteParentSampled=${this._remoteParentSampled.toString()}, remoteParentNotSampled=${this._remoteParentNotSampled.toString()}, localParentSampled=${this._localParentSampled.toString()}, localParentNotSampled=${this._localParentNotSampled.toString()}}`}}vQ.ParentBasedSampler=SQ});var yJ=K((uQ)=>{Object.defineProperty(uQ,"__esModule",{value:!0});uQ.TraceIdRatioBasedSampler=void 0;var U6=M(),lQ=i();class mQ{_ratio;_upperBound;constructor(J=0){this._ratio=this._normalize(J),this._upperBound=Math.floor(this._ratio*4294967295)}shouldSample(J,Q){return{decision:(0,U6.isValidTraceId)(Q)&&this._accumulate(Q)<this._upperBound?lQ.SamplingDecision.RECORD_AND_SAMPLED:lQ.SamplingDecision.NOT_RECORD}}toString(){return`TraceIdRatioBased{${this._ratio}}`}_normalize(J){if(typeof J!=="number"||isNaN(J))return 0;return J>=1?1:J<=0?0:J}_accumulate(J){let Q=0;for(let Z=0;Z<J.length/8;Z++){let $=Z*8,q=parseInt(J.slice($,$+8),16);Q=(Q^q)>>>0}return Q}}uQ.TraceIdRatioBasedSampler=mQ});var gJ=K((oQ)=>{Object.defineProperty(oQ,"__esModule",{value:!0});oQ.buildSamplerFromEnv=oQ.loadDefaultConfig=void 0;var vJ=M(),_=E(),pQ=wJ(),SJ=VJ(),BJ=dJ(),nQ=yJ(),x;(function(J){J.AlwaysOff="always_off",J.AlwaysOn="always_on",J.ParentBasedAlwaysOff="parentbased_always_off",J.ParentBasedAlwaysOn="parentbased_always_on",J.ParentBasedTraceIdRatio="parentbased_traceidratio",J.TraceIdRatio="traceidratio"})(x||(x={}));var jJ=1;function B6(){return{sampler:sQ(),forceFlushTimeoutMillis:30000,generalLimits:{attributeValueLengthLimit:(0,_.getNumberFromEnv)("OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT")??1/0,attributeCountLimit:(0,_.getNumberFromEnv)("OTEL_ATTRIBUTE_COUNT_LIMIT")??128},spanLimits:{attributeValueLengthLimit:(0,_.getNumberFromEnv)("OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT")??1/0,attributeCountLimit:(0,_.getNumberFromEnv)("OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT")??128,linkCountLimit:(0,_.getNumberFromEnv)("OTEL_SPAN_LINK_COUNT_LIMIT")??128,eventCountLimit:(0,_.getNumberFromEnv)("OTEL_SPAN_EVENT_COUNT_LIMIT")??128,attributePerEventCountLimit:(0,_.getNumberFromEnv)("OTEL_SPAN_ATTRIBUTE_PER_EVENT_COUNT_LIMIT")??128,attributePerLinkCountLimit:(0,_.getNumberFromEnv)("OTEL_SPAN_ATTRIBUTE_PER_LINK_COUNT_LIMIT")??128}}}oQ.loadDefaultConfig=B6;function sQ(){let J=(0,_.getStringFromEnv)("OTEL_TRACES_SAMPLER")??x.ParentBasedAlwaysOn;switch(J){case x.AlwaysOn:return new SJ.AlwaysOnSampler;case x.AlwaysOff:return new pQ.AlwaysOffSampler;case x.ParentBasedAlwaysOn:return new BJ.ParentBasedSampler({root:new SJ.AlwaysOnSampler});case x.ParentBasedAlwaysOff:return new BJ.ParentBasedSampler({root:new pQ.AlwaysOffSampler});case x.TraceIdRatio:return new nQ.TraceIdRatioBasedSampler(iQ());case x.ParentBasedTraceIdRatio:return new BJ.ParentBasedSampler({root:new nQ.TraceIdRatioBasedSampler(iQ())});default:return vJ.diag.error(`OTEL_TRACES_SAMPLER value "${J}" invalid, defaulting to "${x.ParentBasedAlwaysOn}".`),new BJ.ParentBasedSampler({root:new SJ.AlwaysOnSampler})}}oQ.buildSamplerFromEnv=sQ;function iQ(){let J=(0,_.getNumberFromEnv)("OTEL_TRACES_SAMPLER_ARG");if(J==null)return vJ.diag.error(`OTEL_TRACES_SAMPLER_ARG is blank, defaulting to ${jJ}.`),jJ;if(J<0||J>1)return vJ.diag.error(`OTEL_TRACES_SAMPLER_ARG=${J} was given, but it is out of range ([0..1]), defaulting to ${jJ}.`),jJ;return J}});var lJ=K((tQ)=>{Object.defineProperty(tQ,"__esModule",{value:!0});tQ.reconfigureLimits=tQ.mergeConfig=tQ.DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT=tQ.DEFAULT_ATTRIBUTE_COUNT_LIMIT=void 0;var rQ=gJ(),FJ=E();tQ.DEFAULT_ATTRIBUTE_COUNT_LIMIT=128;tQ.DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT=1/0;function F6(J){let Q={sampler:(0,rQ.buildSamplerFromEnv)()},Z=(0,rQ.loadDefaultConfig)(),$=Object.assign({},Z,Q,J);return $.generalLimits=Object.assign({},Z.generalLimits,J.generalLimits||{}),$.spanLimits=Object.assign({},Z.spanLimits,J.spanLimits||{}),$}tQ.mergeConfig=F6;function h6(J){let Q=Object.assign({},J.spanLimits);return Q.attributeCountLimit=J.spanLimits?.attributeCountLimit??J.generalLimits?.attributeCountLimit??(0,FJ.getNumberFromEnv)("OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT")??(0,FJ.getNumberFromEnv)("OTEL_ATTRIBUTE_COUNT_LIMIT")??tQ.DEFAULT_ATTRIBUTE_COUNT_LIMIT,Q.attributeValueLengthLimit=J.spanLimits?.attributeValueLengthLimit??J.generalLimits?.attributeValueLengthLimit??(0,FJ.getNumberFromEnv)("OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT")??(0,FJ.getNumberFromEnv)("OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT")??tQ.DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT,Object.assign({},J,{spanLimits:Q})}tQ.reconfigureLimits=h6});var WZ=K(($Z)=>{Object.defineProperty($Z,"__esModule",{value:!0});$Z.BatchSpanProcessorBase=void 0;var s=M(),S=E();class ZZ{_maxExportBatchSize;_maxQueueSize;_scheduledDelayMillis;_exportTimeoutMillis;_exporter;_isExporting=!1;_finishedSpans=[];_timer;_shutdownOnce;_droppedSpansCount=0;constructor(J,Q){if(this._exporter=J,this._maxExportBatchSize=typeof Q?.maxExportBatchSize==="number"?Q.maxExportBatchSize:(0,S.getNumberFromEnv)("OTEL_BSP_MAX_EXPORT_BATCH_SIZE")??512,this._maxQueueSize=typeof Q?.maxQueueSize==="number"?Q.maxQueueSize:(0,S.getNumberFromEnv)("OTEL_BSP_MAX_QUEUE_SIZE")??2048,this._scheduledDelayMillis=typeof Q?.scheduledDelayMillis==="number"?Q.scheduledDelayMillis:(0,S.getNumberFromEnv)("OTEL_BSP_SCHEDULE_DELAY")??5000,this._exportTimeoutMillis=typeof Q?.exportTimeoutMillis==="number"?Q.exportTimeoutMillis:(0,S.getNumberFromEnv)("OTEL_BSP_EXPORT_TIMEOUT")??30000,this._shutdownOnce=new S.BindOnceFuture(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize)s.diag.warn("BatchSpanProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize"),this._maxExportBatchSize=this._maxQueueSize}forceFlush(){if(this._shutdownOnce.isCalled)return this._shutdownOnce.promise;return this._flushAll()}onStart(J,Q){}onEnd(J){if(this._shutdownOnce.isCalled)return;if((J.spanContext().traceFlags&s.TraceFlags.SAMPLED)===0)return;this._addToBuffer(J)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return Promise.resolve().then(()=>{return this.onShutdown()}).then(()=>{return this._flushAll()}).then(()=>{return this._exporter.shutdown()})}_addToBuffer(J){if(this._finishedSpans.length>=this._maxQueueSize){if(this._droppedSpansCount===0)s.diag.debug("maxQueueSize reached, dropping spans");this._droppedSpansCount++;return}if(this._droppedSpansCount>0)s.diag.warn(`Dropped ${this._droppedSpansCount} spans because maxQueueSize reached`),this._droppedSpansCount=0;this._finishedSpans.push(J),this._maybeStartTimer()}_flushAll(){return new Promise((J,Q)=>{let Z=[],$=Math.ceil(this._finishedSpans.length/this._maxExportBatchSize);for(let q=0,W=$;q<W;q++)Z.push(this._flushOneBatch());Promise.all(Z).then(()=>{J()}).catch(Q)})}_flushOneBatch(){if(this._clearTimer(),this._finishedSpans.length===0)return Promise.resolve();return new Promise((J,Q)=>{let Z=setTimeout(()=>{Q(Error("Timeout"))},this._exportTimeoutMillis);s.context.with((0,S.suppressTracing)(s.context.active()),()=>{let $;if(this._finishedSpans.length<=this._maxExportBatchSize)$=this._finishedSpans,this._finishedSpans=[];else $=this._finishedSpans.splice(0,this._maxExportBatchSize);let q=()=>this._exporter.export($,(X)=>{if(clearTimeout(Z),X.code===S.ExportResultCode.SUCCESS)J();else Q(X.error??Error("BatchSpanProcessor: span export failed"))}),W=null;for(let X=0,H=$.length;X<H;X++){let Y=$[X];if(Y.resource.asyncAttributesPending&&Y.resource.waitForAsyncAttributes)W??=[],W.push(Y.resource.waitForAsyncAttributes())}if(W===null)q();else Promise.all(W).then(q,(X)=>{(0,S.globalErrorHandler)(X),Q(X)})})})}_maybeStartTimer(){if(this._isExporting)return;let J=()=>{this._isExporting=!0,this._flushOneBatch().finally(()=>{if(this._isExporting=!1,this._finishedSpans.length>0)this._clearTimer(),this._maybeStartTimer()}).catch((Q)=>{this._isExporting=!1,(0,S.globalErrorHandler)(Q)})};if(this._finishedSpans.length>=this._maxExportBatchSize)return J();if(this._timer!==void 0)return;if(this._timer=setTimeout(()=>J(),this._scheduledDelayMillis),typeof this._timer!=="number")this._timer.unref()}_clearTimer(){if(this._timer!==void 0)clearTimeout(this._timer),this._timer=void 0}}$Z.BatchSpanProcessorBase=ZZ});var HZ=K((XZ)=>{Object.defineProperty(XZ,"__esModule",{value:!0});XZ.BatchSpanProcessor=void 0;var D6=WZ();class zZ extends D6.BatchSpanProcessorBase{onShutdown(){}}XZ.BatchSpanProcessor=zZ});var BZ=K((VZ)=>{Object.defineProperty(VZ,"__esModule",{value:!0});VZ.RandomIdGenerator=void 0;var E6=8,GZ=16;class wZ{generateTraceId=KZ(GZ);generateSpanId=KZ(E6)}VZ.RandomIdGenerator=wZ;var hJ=Buffer.allocUnsafe(GZ);function KZ(J){return function(){for(let Z=0;Z<J/4;Z++)hJ.writeUInt32BE(Math.random()*4294967296>>>0,Z*4);for(let Z=0;Z<J;Z++)if(hJ[Z]>0)break;else if(Z===J-1)hJ[J-1]=1;return hJ.toString("hex",0,J)}}});var jZ=K((OJ)=>{Object.defineProperty(OJ,"__esModule",{value:!0});OJ.RandomIdGenerator=OJ.BatchSpanProcessor=void 0;var k6=HZ();Object.defineProperty(OJ,"BatchSpanProcessor",{enumerable:!0,get:function(){return k6.BatchSpanProcessor}});var I6=BZ();Object.defineProperty(OJ,"RandomIdGenerator",{enumerable:!0,get:function(){return I6.RandomIdGenerator}})});var mJ=K((DJ)=>{Object.defineProperty(DJ,"__esModule",{value:!0});DJ.RandomIdGenerator=DJ.BatchSpanProcessor=void 0;var FZ=jZ();Object.defineProperty(DJ,"BatchSpanProcessor",{enumerable:!0,get:function(){return FZ.BatchSpanProcessor}});Object.defineProperty(DJ,"RandomIdGenerator",{enumerable:!0,get:function(){return FZ.RandomIdGenerator}})});var DZ=K((hZ)=>{Object.defineProperty(hZ,"__esModule",{value:!0});hZ.METRIC_OTEL_SDK_SPAN_STARTED=hZ.METRIC_OTEL_SDK_SPAN_LIVE=hZ.ATTR_OTEL_SPAN_SAMPLING_RESULT=hZ.ATTR_OTEL_SPAN_PARENT_ORIGIN=void 0;hZ.ATTR_OTEL_SPAN_PARENT_ORIGIN="otel.span.parent.origin";hZ.ATTR_OTEL_SPAN_SAMPLING_RESULT="otel.span.sampling_result";hZ.METRIC_OTEL_SDK_SPAN_LIVE="otel.sdk.span.live";hZ.METRIC_OTEL_SDK_SPAN_STARTED="otel.sdk.span.started"});var MZ=K((kZ)=>{Object.defineProperty(kZ,"__esModule",{value:!0});kZ.TracerMetrics=void 0;var EJ=i(),qJ=DZ();class EZ{startedSpans;liveSpans;constructor(J){this.startedSpans=J.createCounter(qJ.METRIC_OTEL_SDK_SPAN_STARTED,{unit:"{span}",description:"The number of created spans."}),this.liveSpans=J.createUpDownCounter(qJ.METRIC_OTEL_SDK_SPAN_LIVE,{unit:"{span}",description:"The number of currently live spans."})}startSpan(J,Q){let Z=N6(Q);if(this.startedSpans.add(1,{[qJ.ATTR_OTEL_SPAN_PARENT_ORIGIN]:P6(J),[qJ.ATTR_OTEL_SPAN_SAMPLING_RESULT]:Z}),Q===EJ.SamplingDecision.NOT_RECORD)return()=>{};let $={[qJ.ATTR_OTEL_SPAN_SAMPLING_RESULT]:Z};return this.liveSpans.add(1,$),()=>{this.liveSpans.add(-1,$)}}}kZ.TracerMetrics=EZ;function P6(J){if(!J)return"none";if(J.isRemote)return"remote";return"local"}function N6(J){switch(J){case EJ.SamplingDecision.RECORD_AND_SAMPLED:return"RECORD_AND_SAMPLE";case EJ.SamplingDecision.RECORD:return"RECORD_ONLY";case EJ.SamplingDecision.NOT_RECORD:return"DROP"}}});var CZ=K((AZ)=>{Object.defineProperty(AZ,"__esModule",{value:!0});AZ.VERSION=void 0;AZ.VERSION="2.6.1"});var fZ=K((PZ)=>{Object.defineProperty(PZ,"__esModule",{value:!0});PZ.Tracer=void 0;var F=M(),kJ=E(),f6=PQ(),T6=lJ(),b6=mJ(),_6=MZ(),x6=CZ();class LZ{_sampler;_generalLimits;_spanLimits;_idGenerator;instrumentationScope;_resource;_spanProcessor;_tracerMetrics;constructor(J,Q,Z,$){let q=(0,T6.mergeConfig)(Q);this._sampler=q.sampler,this._generalLimits=q.generalLimits,this._spanLimits=q.spanLimits,this._idGenerator=Q.idGenerator||new b6.RandomIdGenerator,this._resource=Z,this._spanProcessor=$,this.instrumentationScope=J;let W=q.meterProvider?q.meterProvider.getMeter("@opentelemetry/sdk-trace",x6.VERSION):F.createNoopMeter();this._tracerMetrics=new _6.TracerMetrics(W)}startSpan(J,Q={},Z=F.context.active()){if(Q.root)Z=F.trace.deleteSpan(Z);let $=F.trace.getSpan(Z);if((0,kJ.isTracingSuppressed)(Z))return F.diag.debug("Instrumentation suppressed, returning Noop Span"),F.trace.wrapSpanContext(F.INVALID_SPAN_CONTEXT);let q=$?.spanContext(),W=this._idGenerator.generateSpanId(),X,H,Y;if(!q||!F.trace.isSpanContextValid(q))H=this._idGenerator.generateTraceId();else H=q.traceId,Y=q.traceState,X=q;let V=Q.kind??F.SpanKind.INTERNAL,R=(Q.links??[]).map((D)=>{return{context:D.context,attributes:(0,kJ.sanitizeAttributes)(D.attributes)}}),z=(0,kJ.sanitizeAttributes)(Q.attributes),U=this._sampler.shouldSample(Z,H,J,V,z,R),I=this._tracerMetrics.startSpan(q,U.decision);Y=U.traceState??Y;let G=U.decision===F.SamplingDecision.RECORD_AND_SAMPLED?F.TraceFlags.SAMPLED:F.TraceFlags.NONE,w={traceId:H,spanId:W,traceFlags:G,traceState:Y};if(U.decision===F.SamplingDecision.NOT_RECORD)return F.diag.debug("Recording is off, propagating context in a non-recording span"),F.trace.wrapSpanContext(w);let B=(0,kJ.sanitizeAttributes)(Object.assign(z,U.attributes));return new f6.SpanImpl({resource:this._resource,scope:this.instrumentationScope,context:Z,spanContext:w,name:J,kind:V,links:R,parentSpanContext:X,attributes:B,startTime:Q.startTime,spanProcessor:this._spanProcessor,spanLimits:this._spanLimits,recordEndMetrics:I})}startActiveSpan(J,Q,Z,$){let q,W,X;if(arguments.length<2)return;else if(arguments.length===2)X=Q;else if(arguments.length===3)q=Q,X=Z;else q=Q,W=Z,X=$;let H=W??F.context.active(),Y=this.startSpan(J,q,H),V=F.trace.setSpan(H,Y);return F.context.with(V,X,void 0,Y)}getGeneralLimits(){return this._generalLimits}getSpanLimits(){return this._spanLimits}}PZ.Tracer=LZ});var xZ=K((bZ)=>{Object.defineProperty(bZ,"__esModule",{value:!0});bZ.MultiSpanProcessor=void 0;var d6=E();class TZ{_spanProcessors;constructor(J){this._spanProcessors=J}forceFlush(){let J=[];for(let Q of this._spanProcessors)J.push(Q.forceFlush());return new Promise((Q)=>{Promise.all(J).then(()=>{Q()}).catch((Z)=>{(0,d6.globalErrorHandler)(Z||Error("MultiSpanProcessor: forceFlush failed")),Q()})})}onStart(J,Q){for(let Z of this._spanProcessors)Z.onStart(J,Q)}onEnding(J){for(let Q of this._spanProcessors)if(Q.onEnding)Q.onEnding(J)}onEnd(J){for(let Q of this._spanProcessors)Q.onEnd(J)}shutdown(){let J=[];for(let Q of this._spanProcessors)J.push(Q.shutdown());return new Promise((Q,Z)=>{Promise.all(J).then(()=>{Q()},Z)})}}bZ.MultiSpanProcessor=TZ});var lZ=K((vZ)=>{Object.defineProperty(vZ,"__esModule",{value:!0});vZ.BasicTracerProvider=vZ.ForceFlushState=void 0;var y6=E(),S6=yZ(),v6=fZ(),g6=gJ(),l6=xZ(),m6=lJ(),o;(function(J){J[J.resolved=0]="resolved",J[J.timeout=1]="timeout",J[J.error=2]="error",J[J.unresolved=3]="unresolved"})(o=vZ.ForceFlushState||(vZ.ForceFlushState={}));class SZ{_config;_tracers=new Map;_resource;_activeSpanProcessor;constructor(J={}){let Q=(0,y6.merge)({},(0,g6.loadDefaultConfig)(),(0,m6.reconfigureLimits)(J));this._resource=Q.resource??(0,S6.defaultResource)(),this._config=Object.assign({},Q,{resource:this._resource});let Z=[];if(J.spanProcessors?.length)Z.push(...J.spanProcessors);this._activeSpanProcessor=new l6.MultiSpanProcessor(Z)}getTracer(J,Q,Z){let $=`${J}@${Q||""}:${Z?.schemaUrl||""}`;if(!this._tracers.has($))this._tracers.set($,new v6.Tracer({name:J,version:Q,schemaUrl:Z?.schemaUrl},this._config,this._resource,this._activeSpanProcessor));return this._tracers.get($)}forceFlush(){let J=this._config.forceFlushTimeoutMillis,Q=this._activeSpanProcessor._spanProcessors.map((Z)=>{return new Promise(($)=>{let q,W=setTimeout(()=>{$(Error(`Span processor did not completed within timeout period of ${J} ms`)),q=o.timeout},J);Z.forceFlush().then(()=>{if(clearTimeout(W),q!==o.timeout)q=o.resolved,$(q)}).catch((X)=>{clearTimeout(W),q=o.error,$(X)})})});return new Promise((Z,$)=>{Promise.all(Q).then((q)=>{let W=q.filter((X)=>X!==o.resolved);if(W.length>0)$(W);else Z()}).catch((q)=>$([q]))})}shutdown(){return this._activeSpanProcessor.shutdown()}}vZ.BasicTracerProvider=SZ});var pZ=K((uZ)=>{Object.defineProperty(uZ,"__esModule",{value:!0});uZ.ConsoleSpanExporter=void 0;var uJ=E();class mZ{export(J,Q){return this._sendSpans(J,Q)}shutdown(){return this._sendSpans([]),this.forceFlush()}forceFlush(){return Promise.resolve()}_exportInfo(J){return{resource:{attributes:J.resource.attributes},instrumentationScope:J.instrumentationScope,traceId:J.spanContext().traceId,parentSpanContext:J.parentSpanContext,traceState:J.spanContext().traceState?.serialize(),name:J.name,id:J.spanContext().spanId,kind:J.kind,timestamp:(0,uJ.hrTimeToMicroseconds)(J.startTime),duration:(0,uJ.hrTimeToMicroseconds)(J.duration),attributes:J.attributes,status:J.status,events:J.events,links:J.links}}_sendSpans(J,Q){for(let Z of J)console.dir(this._exportInfo(Z),{depth:3});if(Q)return Q({code:uJ.ExportResultCode.SUCCESS})}}uZ.ConsoleSpanExporter=mZ});var aZ=K((sZ)=>{Object.defineProperty(sZ,"__esModule",{value:!0});sZ.InMemorySpanExporter=void 0;var nZ=E();class iZ{_finishedSpans=[];_stopped=!1;export(J,Q){if(this._stopped)return Q({code:nZ.ExportResultCode.FAILED,error:Error("Exporter has been stopped")});this._finishedSpans.push(...J),setTimeout(()=>Q({code:nZ.ExportResultCode.SUCCESS}),0)}shutdown(){return this._stopped=!0,this._finishedSpans=[],this.forceFlush()}forceFlush(){return Promise.resolve()}reset(){this._finishedSpans=[]}getFinishedSpans(){return this._finishedSpans}}sZ.InMemorySpanExporter=iZ});var J0=K((tZ)=>{Object.defineProperty(tZ,"__esModule",{value:!0});tZ.SimpleSpanProcessor=void 0;var u6=M(),IJ=E();class rZ{_exporter;_shutdownOnce;_pendingExports;constructor(J){this._exporter=J,this._shutdownOnce=new IJ.BindOnceFuture(this._shutdown,this),this._pendingExports=new Set}async forceFlush(){if(await Promise.all(Array.from(this._pendingExports)),this._exporter.forceFlush)await this._exporter.forceFlush()}onStart(J,Q){}onEnd(J){if(this._shutdownOnce.isCalled)return;if((J.spanContext().traceFlags&u6.TraceFlags.SAMPLED)===0)return;let Q=this._doExport(J).catch((Z)=>(0,IJ.globalErrorHandler)(Z));this._pendingExports.add(Q),Q.finally(()=>this._pendingExports.delete(Q))}async _doExport(J){if(J.resource.asyncAttributesPending)await J.resource.waitForAsyncAttributes?.();let Q=await IJ.internal._export(this._exporter,[J]);if(Q.code!==IJ.ExportResultCode.SUCCESS)throw Q.error??Error(`SimpleSpanProcessor: span export failed (status ${Q})`)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return this._exporter.shutdown()}}tZ.SimpleSpanProcessor=rZ});var q0=K((Z0)=>{Object.defineProperty(Z0,"__esModule",{value:!0});Z0.NoopSpanProcessor=void 0;class Q0{onStart(J,Q){}onEnd(J){}shutdown(){return Promise.resolve()}forceFlush(){return Promise.resolve()}}Z0.NoopSpanProcessor=Q0});var cJ=K((A)=>{Object.defineProperty(A,"__esModule",{value:!0});A.SamplingDecision=A.TraceIdRatioBasedSampler=A.ParentBasedSampler=A.AlwaysOnSampler=A.AlwaysOffSampler=A.NoopSpanProcessor=A.SimpleSpanProcessor=A.InMemorySpanExporter=A.ConsoleSpanExporter=A.RandomIdGenerator=A.BatchSpanProcessor=A.BasicTracerProvider=void 0;var c6=lZ();Object.defineProperty(A,"BasicTracerProvider",{enumerable:!0,get:function(){return c6.BasicTracerProvider}});var W0=mJ();Object.defineProperty(A,"BatchSpanProcessor",{enumerable:!0,get:function(){return W0.BatchSpanProcessor}});Object.defineProperty(A,"RandomIdGenerator",{enumerable:!0,get:function(){return W0.RandomIdGenerator}});var p6=pZ();Object.defineProperty(A,"ConsoleSpanExporter",{enumerable:!0,get:function(){return p6.ConsoleSpanExporter}});var n6=aZ();Object.defineProperty(A,"InMemorySpanExporter",{enumerable:!0,get:function(){return n6.InMemorySpanExporter}});var i6=J0();Object.defineProperty(A,"SimpleSpanProcessor",{enumerable:!0,get:function(){return i6.SimpleSpanProcessor}});var s6=q0();Object.defineProperty(A,"NoopSpanProcessor",{enumerable:!0,get:function(){return s6.NoopSpanProcessor}});var o6=wJ();Object.defineProperty(A,"AlwaysOffSampler",{enumerable:!0,get:function(){return o6.AlwaysOffSampler}});var a6=VJ();Object.defineProperty(A,"AlwaysOnSampler",{enumerable:!0,get:function(){return a6.AlwaysOnSampler}});var r6=dJ();Object.defineProperty(A,"ParentBasedSampler",{enumerable:!0,get:function(){return r6.ParentBasedSampler}});var t6=yJ();Object.defineProperty(A,"TraceIdRatioBasedSampler",{enumerable:!0,get:function(){return t6.TraceIdRatioBasedSampler}});var e6=i();Object.defineProperty(A,"SamplingDecision",{enumerable:!0,get:function(){return e6.SamplingDecision}})});var H0=K((X0)=>{Object.defineProperty(X0,"__esModule",{value:!0});X0.NodeTracerProvider=void 0;var Q7=EQ(),Z7=cJ(),WJ=M(),pJ=E();function $7(J){if(J===null)return;if(J===void 0){let Q=new Q7.AsyncLocalStorageContextManager;Q.enable(),WJ.context.setGlobalContextManager(Q);return}J.enable(),WJ.context.setGlobalContextManager(J)}function q7(J){if(J===null)return;if(J===void 0){WJ.propagation.setGlobalPropagator(new pJ.CompositePropagator({propagators:[new pJ.W3CTraceContextPropagator,new pJ.W3CBaggagePropagator]}));return}WJ.propagation.setGlobalPropagator(J)}class z0 extends Z7.BasicTracerProvider{constructor(J={}){super(J)}register(J={}){WJ.trace.setGlobalTracerProvider(this),$7(J.contextManager),q7(J.propagator)}}X0.NodeTracerProvider=z0});var K0=K((k)=>{Object.defineProperty(k,"__esModule",{value:!0});k.TraceIdRatioBasedSampler=k.SimpleSpanProcessor=k.SamplingDecision=k.RandomIdGenerator=k.ParentBasedSampler=k.NoopSpanProcessor=k.InMemorySpanExporter=k.ConsoleSpanExporter=k.BatchSpanProcessor=k.BasicTracerProvider=k.AlwaysOnSampler=k.AlwaysOffSampler=k.NodeTracerProvider=void 0;var W7=H0();Object.defineProperty(k,"NodeTracerProvider",{enumerable:!0,get:function(){return W7.NodeTracerProvider}});var L=cJ();Object.defineProperty(k,"AlwaysOffSampler",{enumerable:!0,get:function(){return L.AlwaysOffSampler}});Object.defineProperty(k,"AlwaysOnSampler",{enumerable:!0,get:function(){return L.AlwaysOnSampler}});Object.defineProperty(k,"BasicTracerProvider",{enumerable:!0,get:function(){return L.BasicTracerProvider}});Object.defineProperty(k,"BatchSpanProcessor",{enumerable:!0,get:function(){return L.BatchSpanProcessor}});Object.defineProperty(k,"ConsoleSpanExporter",{enumerable:!0,get:function(){return L.ConsoleSpanExporter}});Object.defineProperty(k,"InMemorySpanExporter",{enumerable:!0,get:function(){return L.InMemorySpanExporter}});Object.defineProperty(k,"NoopSpanProcessor",{enumerable:!0,get:function(){return L.NoopSpanProcessor}});Object.defineProperty(k,"ParentBasedSampler",{enumerable:!0,get:function(){return L.ParentBasedSampler}});Object.defineProperty(k,"RandomIdGenerator",{enumerable:!0,get:function(){return L.RandomIdGenerator}});Object.defineProperty(k,"SamplingDecision",{enumerable:!0,get:function(){return L.SamplingDecision}});Object.defineProperty(k,"SimpleSpanProcessor",{enumerable:!0,get:function(){return L.SimpleSpanProcessor}});Object.defineProperty(k,"TraceIdRatioBasedSampler",{enumerable:!0,get:function(){return L.TraceIdRatioBasedSampler}})});var a0=d(K0(),1);var MJ=(J)=>J!==void 0&&!(Array.isArray(J)&&J.length===0);var HJ=d(M(),1);var v;(function(J){J[J.UNSPECIFIED=0]="UNSPECIFIED",J[J.TRACE=1]="TRACE",J[J.TRACE2=2]="TRACE2",J[J.TRACE3=3]="TRACE3",J[J.TRACE4=4]="TRACE4",J[J.DEBUG=5]="DEBUG",J[J.DEBUG2=6]="DEBUG2",J[J.DEBUG3=7]="DEBUG3",J[J.DEBUG4=8]="DEBUG4",J[J.INFO=9]="INFO",J[J.INFO2=10]="INFO2",J[J.INFO3=11]="INFO3",J[J.INFO4=12]="INFO4",J[J.WARN=13]="WARN",J[J.WARN2=14]="WARN2",J[J.WARN3=15]="WARN3",J[J.WARN4=16]="WARN4",J[J.ERROR=17]="ERROR",J[J.ERROR2=18]="ERROR2",J[J.ERROR3=19]="ERROR3",J[J.ERROR4=20]="ERROR4",J[J.FATAL=21]="FATAL",J[J.FATAL2=22]="FATAL2",J[J.FATAL3=23]="FATAL3",J[J.FATAL4=24]="FATAL4"})(v||(v={}));class zJ{emit(J){}}var XJ=new zJ;var YJ=Symbol.for("io.opentelemetry.js.api.logs"),a=globalThis;function G0(J,Q,Z){return($)=>$===J?Q:Z}var nJ=1;class w0{getLogger(J,Q,Z){return new zJ}}var AJ=new w0;class iJ{constructor(J,Q,Z,$){this._provider=J,this.name=Q,this.version=Z,this.options=$}emit(J){this._getLogger().emit(J)}_getLogger(){if(this._delegate)return this._delegate;let J=this._provider._getDelegateLogger(this.name,this.version,this.options);if(!J)return XJ;return this._delegate=J,this._delegate}}class RJ{getLogger(J,Q,Z){var $;return($=this._getDelegateLogger(J,Q,Z))!==null&&$!==void 0?$:new iJ(this,J,Q,Z)}_getDelegate(){var J;return(J=this._delegate)!==null&&J!==void 0?J:AJ}_setDelegate(J){this._delegate=J}_getDelegateLogger(J,Q,Z){var $;return($=this._delegate)===null||$===void 0?void 0:$.getLogger(J,Q,Z)}}class CJ{constructor(){this._proxyLoggerProvider=new RJ}static getInstance(){if(!this._instance)this._instance=new CJ;return this._instance}setGlobalLoggerProvider(J){if(a[YJ])return this.getLoggerProvider();return a[YJ]=G0(nJ,J,AJ),this._proxyLoggerProvider._setDelegate(J),J}getLoggerProvider(){var J,Q;return(Q=(J=a[YJ])===null||J===void 0?void 0:J.call(a,nJ))!==null&&Q!==void 0?Q:this._proxyLoggerProvider}getLogger(J,Q,Z){return this.getLoggerProvider().getLogger(J,Q,Z)}disable(){delete a[YJ],this._proxyLoggerProvider=new RJ}}var l8=CJ.getInstance();var j0=d(yZ(),1),F0=d(E(),1);var T=d(M(),1);var f=d(M(),1),oJ=d(E(),1),C=d(AQ(),1);function V0(J){return sJ(J,new WeakSet)}function sJ(J,Q){if(J==null)return!0;if(typeof J==="string"||typeof J==="number"||typeof J==="boolean")return!0;if(J instanceof Uint8Array)return!0;if(typeof J==="object"){if(Q.has(J))return!1;if(Q.add(J),Array.isArray(J))return J.every(($)=>sJ($,Q));let Z=J;if(Z.constructor!==Object&&Z.constructor!==void 0)return!1;return Object.values(Z).every(($)=>sJ($,Q))}return!1}class aJ{hrTime;hrTimeObserved;spanContext;resource;instrumentationScope;attributes={};_severityText;_severityNumber;_body;_eventName;_attributesCount=0;_droppedAttributesCount=0;_isReadonly=!1;_logRecordLimits;set severityText(J){if(this._isLogRecordReadonly())return;this._severityText=J}get severityText(){return this._severityText}set severityNumber(J){if(this._isLogRecordReadonly())return;this._severityNumber=J}get severityNumber(){return this._severityNumber}set body(J){if(this._isLogRecordReadonly())return;this._body=J}get body(){return this._body}get eventName(){return this._eventName}set eventName(J){if(this._isLogRecordReadonly())return;this._eventName=J}get droppedAttributesCount(){return this._droppedAttributesCount}constructor(J,Q,Z){let{timestamp:$,observedTimestamp:q,eventName:W,severityNumber:X,severityText:H,body:Y,attributes:V={},exception:R,context:z}=Z,U=Date.now();if(this.hrTime=oJ.timeInputToHrTime($??U),this.hrTimeObserved=oJ.timeInputToHrTime(q??U),z){let I=f.trace.getSpanContext(z);if(I&&f.isSpanContextValid(I))this.spanContext=I}if(this.severityNumber=X,this.severityText=H,this.body=Y,this.resource=J.resource,this.instrumentationScope=Q,this._logRecordLimits=J.logRecordLimits,this._eventName=W,this.setAttributes(V),R!=null)this._setException(R)}setAttribute(J,Q){if(this._isLogRecordReadonly())return this;if(J.length===0)return f.diag.warn(`Invalid attribute key: ${J}`),this;if(!V0(Q))return f.diag.warn(`Invalid attribute value set for key: ${J}`),this;let Z=!Object.prototype.hasOwnProperty.call(this.attributes,J);if(Z&&this._attributesCount>=this._logRecordLimits.attributeCountLimit){if(this._droppedAttributesCount++,this._droppedAttributesCount===1)f.diag.warn("Dropping extra attributes.");return this}if(this.attributes[J]=this._truncateToSize(Q),Z)this._attributesCount++;return this}setAttributes(J){for(let[Q,Z]of Object.entries(J))this.setAttribute(Q,Z);return this}setBody(J){return this.body=J,this}setEventName(J){return this.eventName=J,this}setSeverityNumber(J){return this.severityNumber=J,this}setSeverityText(J){return this.severityText=J,this}_makeReadonly(){this._isReadonly=!0}_truncateToSize(J){let Q=this._logRecordLimits.attributeValueLengthLimit;if(Q<=0)return f.diag.warn(`Attribute value limit must be positive, got ${Q}`),J;if(J==null)return J;if(typeof J==="string")return this._truncateToLimitUtil(J,Q);if(J instanceof Uint8Array)return J;if(Array.isArray(J))return J.map((Z)=>this._truncateToSize(Z));if(typeof J==="object"){let Z={};for(let[$,q]of Object.entries(J))Z[$]=this._truncateToSize(q);return Z}return J}_setException(J){let Q=!1;if(typeof J==="string"||typeof J==="number"){if(!Object.hasOwn(this.attributes,C.ATTR_EXCEPTION_MESSAGE))this.setAttribute(C.ATTR_EXCEPTION_MESSAGE,String(J));Q=!0}else if(J&&typeof J==="object"){let Z=J;if(Z.code){if(!Object.hasOwn(this.attributes,C.ATTR_EXCEPTION_TYPE))this.setAttribute(C.ATTR_EXCEPTION_TYPE,Z.code.toString());Q=!0}else if(Z.name){if(!Object.hasOwn(this.attributes,C.ATTR_EXCEPTION_TYPE))this.setAttribute(C.ATTR_EXCEPTION_TYPE,Z.name);Q=!0}if(Z.message){if(!Object.hasOwn(this.attributes,C.ATTR_EXCEPTION_MESSAGE))this.setAttribute(C.ATTR_EXCEPTION_MESSAGE,Z.message);Q=!0}if(Z.stack){if(!Object.hasOwn(this.attributes,C.ATTR_EXCEPTION_STACKTRACE))this.setAttribute(C.ATTR_EXCEPTION_STACKTRACE,Z.stack);Q=!0}}if(!Q)f.diag.warn(`Failed to record an exception ${J}`)}_truncateToLimitUtil(J,Q){if(J.length<=Q)return J;return J.substring(0,Q)}_isLogRecordReadonly(){if(this._isReadonly)f.diag.warn("Can not execute the operation on emitted log record");return this._isReadonly}}class rJ{instrumentationScope;_sharedState;_loggerConfig;constructor(J,Q){this.instrumentationScope=J,this._sharedState=Q,this._loggerConfig=this._sharedState.getLoggerConfig(this.instrumentationScope)}emit(J){let Q=this._loggerConfig,Z=J.context||T.context.active(),$=J.severityNumber??v.UNSPECIFIED;if($!==v.UNSPECIFIED&&$<Q.minimumSeverity)return;if(Q.traceBased){let W=T.trace.getSpanContext(Z);if(W&&T.isSpanContextValid(W)){if((W.traceFlags&T.TraceFlags.SAMPLED)!==T.TraceFlags.SAMPLED)return}}let q=new aJ(this._sharedState,this.instrumentationScope,{context:Z,...J});this._sharedState.activeProcessor.onEmit(q,Z),q._makeReadonly()}}class tJ{forceFlush(){return Promise.resolve()}onEmit(J,Q){}shutdown(){return Promise.resolve()}}var U0=d(E(),1);class eJ{processors;forceFlushTimeoutMillis;constructor(J,Q){this.processors=J,this.forceFlushTimeoutMillis=Q}async forceFlush(){let J=this.forceFlushTimeoutMillis;await Promise.all(this.processors.map((Q)=>U0.callWithTimeout(Q.forceFlush(),J)))}onEmit(J,Q){this.processors.forEach((Z)=>Z.onEmit(J,Q))}async shutdown(){await Promise.all(this.processors.map((J)=>J.shutdown()))}}function B0(J){return`${J.name}@${J.version||""}:${J.schemaUrl||""}`}var X7={disabled:!1,minimumSeverity:v.UNSPECIFIED,traceBased:!1},JQ=()=>({...X7});class QQ{loggers=new Map;activeProcessor;registeredLogRecordProcessors=[];resource;forceFlushTimeoutMillis;logRecordLimits;processors;_loggerConfigurator;_loggerConfigs=new Map;constructor(J,Q,Z,$,q){if(this.resource=J,this.forceFlushTimeoutMillis=Q,this.logRecordLimits=Z,this.processors=$,$.length>0)this.registeredLogRecordProcessors=$,this.activeProcessor=new eJ(this.registeredLogRecordProcessors,this.forceFlushTimeoutMillis);else this.activeProcessor=new tJ;this._loggerConfigurator=q??JQ}getLoggerConfig(J){let Q=B0(J),Z=this._loggerConfigs.get(Q);if(Z)return Z;return Z=this._loggerConfigurator(J),this._loggerConfigs.set(Q,Z),Z}}var Y7="unknown";class LJ{_shutdownOnce;_sharedState;constructor(J={}){let Q={resource:J.resource??j0.defaultResource(),forceFlushTimeoutMillis:J.forceFlushTimeoutMillis??30000,logRecordLimits:{attributeCountLimit:J.logRecordLimits?.attributeCountLimit??128,attributeValueLengthLimit:J.logRecordLimits?.attributeValueLengthLimit??1/0},loggerConfigurator:J.loggerConfigurator??JQ,processors:J.processors??[]};this._sharedState=new QQ(Q.resource,Q.forceFlushTimeoutMillis,Q.logRecordLimits,Q.processors,Q.loggerConfigurator),this._shutdownOnce=new F0.BindOnceFuture(this._shutdown,this)}getLogger(J,Q,Z){if(this._shutdownOnce.isCalled)return HJ.diag.warn("A shutdown LoggerProvider cannot provide a Logger"),XJ;if(!J)HJ.diag.warn("Logger requested without instrumentation scope name.");let $=J||Y7,q=`${$}@${Q||""}:${Z?.schemaUrl||""}`;if(!this._sharedState.loggers.has(q))this._sharedState.loggers.set(q,new rJ({name:$,version:Q,schemaUrl:Z?.schemaUrl},this._sharedState));return this._sharedState.loggers.get(q)}forceFlush(){if(this._shutdownOnce.isCalled)return HJ.diag.warn("invalid attempt to force flush after LoggerProvider shutdown"),this._shutdownOnce.promise;return this._sharedState.activeProcessor.forceFlush()}shutdown(){if(this._shutdownOnce.isCalled)return HJ.diag.warn("shutdown may only be called once per LoggerProvider"),this._shutdownOnce.promise;return this._shutdownOnce.call()}_shutdown(){return this._sharedState.activeProcessor.shutdown()}}class qQ extends O0()("@effect/opentelemetry/Logger/OtelLoggerProvider"){}var G7=g(function*(){let J=yield*qQ,Q=yield*A0,Z=J.getLogger("@effect/opentelemetry");return L0(($)=>{let q={fiberId:$.fiber.id},W=D0($.fiber.context,E0);if(h0(W))q.spanId=W.spanId,q.traceId=W.traceId;for(let[V,R]of Object.entries($.fiber.getRef(k0)))q[V]=ZQ(R);let X=$.date.getTime();for(let[V,R]of $.fiber.getRef(I0))q[`logSpan.${V}`]=`${X-R}ms`;let H=$Q($.message).map(ZQ),Y=N0(Q.currentTimeNanosUnsafe());Z.emit({body:H.length===1?H[0]:H,severityText:$.logLevel,severityNumber:C0($.logLevel),timestamp:Y,observedTimestamp:Y,attributes:q})})}),f0=(J)=>P0([G7],{mergeWithExisting:J.mergeWithExisting??!0}),T0=(J,Q)=>PJ(qQ,g(function*(){let Z=yield*ZJ;return yield*JJ(u(()=>new LJ({...Q??void 0,processors:$Q(J),resource:Z})),($)=>r(()=>$.forceFlush().then(()=>$.shutdown())).pipe(t,QJ,e(Q?.shutdownTimeout??3000)))}));var l=d(M(),1);var c;(function(J){J[J.DELTA=0]="DELTA",J[J.CUMULATIVE=1]="CUMULATIVE"})(c||(c={}));var P;(function(J){J.COUNTER="COUNTER",J.GAUGE="GAUGE",J.HISTOGRAM="HISTOGRAM",J.UP_DOWN_COUNTER="UP_DOWN_COUNTER",J.OBSERVABLE_COUNTER="OBSERVABLE_COUNTER",J.OBSERVABLE_GAUGE="OBSERVABLE_GAUGE",J.OBSERVABLE_UP_DOWN_COUNTER="OBSERVABLE_UP_DOWN_COUNTER"})(P||(P={}));var b;(function(J){J[J.HISTOGRAM=0]="HISTOGRAM",J[J.EXPONENTIAL_HISTOGRAM=1]="EXPONENTIAL_HISTOGRAM",J[J.GAUGE=2]="GAUGE",J[J.SUM=3]="SUM"})(b||(b={}));var V7="@effect/opentelemetry/Metrics";class zQ{resource;context;temporality;startTimes;startTimeNanos;previousExportTimeNanos;previousCounterState;previousHistogramState;previousFrequencyState;previousSummaryState;constructor(J,Q,Z="cumulative"){this.resource=J,this.context=Q,this.temporality=Z,this.startTimes=new Map,this.startTimeNanos=b0(),this.previousExportTimeNanos=this.startTimeNanos,this.previousCounterState=new Map,this.previousHistogramState=new Map,this.previousFrequencyState=new Map,this.previousSummaryState=new Map}startTimeFor(J,Q){if(this.startTimes.has(J))return this.startTimes.get(J);return this.startTimes.set(J,Q),Q}collect(J){let Q=x0(this.context),Z=b0(),$=[],q=new Map,W=(V)=>{$.push(V),q.set(V.descriptor.name,V)},X=this.temporality==="delta",H=X?c.DELTA:c.CUMULATIVE,Y=X?this.previousExportTimeNanos:this.startTimeNanos;for(let V=0,R=Q.length;V<R;V++){let z=Q[V],U=z.attributes?_0(Object.entries(z.attributes),{},(G,[w,B])=>{return G[w]=String(B),G}):{},I=U7(z.id,z.attributes);switch(z.type){case"Counter":{let G=z.state.count,w=G;if(X){let j=this.previousCounterState.get(I);if(j!==void 0)if(typeof G==="bigint"&&typeof j==="bigint"){if(w=G-j,w<0n)w=G}else{let y=Number(G),p=Number(j);if(w=y-p,w<0)w=y}this.previousCounterState.set(I,G)}let B=$J(z,U),D={startTime:this.startTimeFor(B.name,Y),endTime:Z,attributes:U,value:Number(w)};if(q.has(z.id))q.get(z.id).dataPoints.push(D);else W({dataPointType:b.SUM,descriptor:B,isMonotonic:z.state.incremental,aggregationTemporality:H,dataPoints:[D]});break}case"Gauge":{let G=$J(z,U),B={startTime:this.startTimeFor(G.name,this.startTimeNanos),endTime:Z,attributes:U,value:Number(z.state.value)};if(q.has(z.id))q.get(z.id).dataPoints.push(B);else W({dataPointType:b.GAUGE,descriptor:G,aggregationTemporality:c.CUMULATIVE,dataPoints:[B]});break}case"Histogram":{let G=z.state.buckets.length,w={boundaries:WQ(G-1),counts:WQ(G)},B=0,N=0;for(let[n,KJ]of z.state.buckets){if(B<G-1)w.boundaries[B]=n;w.counts[B]=KJ-N,N=KJ,B++}let D=z.state.count,j=z.state.sum,y=w.counts,p=z.state.min,fJ=z.state.max;if(X){let n=this.previousHistogramState.get(I);if(n!==void 0)D=z.state.count-n.count,j=z.state.sum-n.sum,y=w.counts.map((KJ,r0)=>Math.max(0,KJ-(n.bucketCounts[r0]??0)));this.previousHistogramState.set(I,{count:z.state.count,sum:z.state.sum,bucketCounts:w.counts.slice(),min:z.state.min,max:z.state.max})}let YQ=$J(z,U),HQ={startTime:this.startTimeFor(YQ.name,Y),endTime:Z,attributes:U,value:{buckets:{boundaries:w.boundaries,counts:y},count:D,min:p,max:fJ,sum:j}};if(q.has(z.id))q.get(z.id).dataPoints.push(HQ);else W({dataPointType:b.HISTOGRAM,descriptor:YQ,aggregationTemporality:H,dataPoints:[HQ]});break}case"Frequency":{let G=[],w=new Map;for(let[B,N]of z.state.occurrences){w.set(B,N);let D=N;if(X){let p=this.previousFrequencyState.get(I);if(p!==void 0){let fJ=p.get(B)??0;D=Math.max(0,N-fJ)}}let j=$J(z,U),y=this.startTimeFor(j.name,Y);G.push({startTime:y,endTime:Z,attributes:{...U,key:B},value:D})}if(X)this.previousFrequencyState.set(I,w);if(q.has(z.id))q.get(z.id).dataPoints.push(...G);else{let B=$J(z,U);W({dataPointType:b.SUM,descriptor:B,aggregationTemporality:H,isMonotonic:!0,dataPoints:G})}break}case"Summary":{let G=[{startTime:Y,endTime:Z,attributes:{...U,quantile:"min"},value:z.state.min}];for(let[j,y]of z.state.quantiles)G.push({startTime:Y,endTime:Z,attributes:{...U,quantile:j.toString()},value:y??0});G.push({startTime:Y,endTime:Z,attributes:{...U,quantile:"max"},value:z.state.max});let w=z.state.count,B=z.state.sum;if(X){let j=this.previousSummaryState.get(I);if(j!==void 0)w=z.state.count-j.count,B=z.state.sum-j.sum;this.previousSummaryState.set(I,{count:z.state.count,sum:z.state.sum})}let N={startTime:Y,endTime:Z,attributes:U,value:w},D={startTime:Y,endTime:Z,attributes:U,value:B};if(q.has(`${z.id}_quantiles`))q.get(`${z.id}_quantiles`).dataPoints.push(...G),q.get(`${z.id}_count`).dataPoints.push(N),q.get(`${z.id}_sum`).dataPoints.push(D);else{let j=$J(z,U);W({dataPointType:b.SUM,descriptor:{...j,name:`${j.name}_quantiles`},aggregationTemporality:H,isMonotonic:!1,dataPoints:G}),W({dataPointType:b.SUM,descriptor:{name:`${z.id}_count`,description:z.description??"",unit:"1",type:P.COUNTER,valueType:l.ValueType.INT,advice:{}},aggregationTemporality:H,isMonotonic:!0,dataPoints:[N]}),W({dataPointType:b.SUM,descriptor:{name:`${z.id}_sum`,description:z.description??"",unit:"1",type:P.COUNTER,valueType:l.ValueType.DOUBLE,advice:{}},aggregationTemporality:H,isMonotonic:!0,dataPoints:[D]})}break}}}if(X)this.previousExportTimeNanos=Z;return Promise.resolve({resourceMetrics:{resource:this.resource,scopeMetrics:[{scope:{name:V7},metrics:$}]},errors:[]})}}var U7=(J,Q)=>{if(Q===void 0||Object.keys(Q).length===0)return J;let Z=Object.entries(Q).sort(($,q)=>$[0].localeCompare(q[0]));return`${J}:${JSON.stringify(Z)}`},b0=()=>{let J=Date.now();return[Math.floor(J/1000),J%1000*1e6]},$J=(J,Q)=>{let Z=Q.unit??Q.time_unit??"1";return{name:J.id,description:J.description??"",unit:Z,type:B7(J),valueType:j7(J),advice:{}}},B7=(J)=>{switch(J.type){case"Histogram":return P.HISTOGRAM;case"Gauge":return P.OBSERVABLE_GAUGE;case"Frequency":return P.COUNTER;case"Counter":return J.state.incremental?P.COUNTER:P.UP_DOWN_COUNTER;case"Summary":return P.COUNTER}},j7=(J)=>{if(J.type==="Counter")return typeof J.state.count==="bigint"?l.ValueType.INT:l.ValueType.DOUBLE;else if(J.type==="Gauge")return typeof J.state.value==="bigint"?l.ValueType.INT:l.ValueType.DOUBLE;return l.ValueType.DOUBLE};var F7=(J)=>g(function*(){let Q=yield*ZJ,Z=yield*S0();return new zQ(Q,Z,J)}),h7=(J,Q,Z)=>JJ(u(()=>{let $=Q(),q=Array.isArray($)?$:[$];return q.forEach((W)=>W.setMetricProducer(J)),q}),($)=>r(()=>Promise.all($.map((q)=>q.shutdown()))).pipe(t,QJ,e(Z?.shutdownTimeout??3000))),v0=(J,Q)=>d0(y0(F7(Q?.temporality),(Z)=>h7(Z,J,Q)));var D7=(J,Q)=>PJ(s0,g(function*(){let Z=yield*ZJ;return yield*JJ(u(()=>{return new a0.NodeTracerProvider({...Q??void 0,resource:Z,spanProcessors:Array.isArray(J)?J:[J]})}),($)=>r(()=>$.forceFlush().then(()=>$.shutdown())).pipe(t,QJ,e(Q?.shutdownTimeout??3000)))})),a9=(J)=>l0(g(function*(){let Q=yield*c0(J)?J:u(J),Z=n0(Q.resource&&p0(Q.resource)),$=MJ(Q.spanProcessor)?XQ(o0,D7(Q.spanProcessor,{...Q.tracerConfig,shutdownTimeout:Q.shutdownTimeout})):NJ,q=MJ(Q.metricReader)?v0(g0(Q.metricReader),{shutdownTimeout:Q.shutdownTimeout,temporality:Q.metricTemporality}):NJ,W=MJ(Q.logRecordProcessor)?XQ(f0({mergeWithExisting:Q.loggerMergeWithExisting}),T0(Q.logRecordProcessor,{...Q.loggerProviderConfig,shutdownTimeout:Q.shutdownTimeout})):NJ;return m0($,q,W).pipe(u0(Z))})),r9=i0;export{D7 as layerTracerProvider,r9 as layerEmpty,a9 as layer};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{zO as D}from"./chunk-d07p6fpk.js";import{AO as C}from"./chunk-zw815d68.js";import{CO as z,FO as B}from"./chunk-7xm75w1e.js";var H=z((v)=>{Object.defineProperty(v,"__esModule",{value:!0});v.getMachineId=void 0;var E=B("fs"),F=D(),q=C();async function G(){try{return(await E.promises.readFile("/etc/hostid",{encoding:"utf8"})).trim()}catch(k){q.diag.debug(`error reading machine id: ${k}`)}try{return(await(0,F.execAsync)("kenv -q smbios.system.uuid")).stdout.trim()}catch(k){q.diag.debug(`error reading machine id: ${k}`)}return}v.getMachineId=G});export default H();
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{FO as o}from"./chunk-7xm75w1e.js";var i=(t)=>`standard-openapi: ${t}`,s=new Map,r=async(t)=>{let e=s.get(t);if(e)return e;let a;switch(t){case"valibot":a=(await import("./chunk-jrqb0jwy.js")).default();break;case"zod":a=(await import("./chunk-42p59wm4.js")).default();break;default:a=(await import("./chunk-yqbcnsa1.js")).default()}return s.set(t,a),a},d=async(t,e={})=>{let a=await r(t["~standard"].vendor),{components:n={},options:c}=e;return{schema:await a(t,{components:n,options:c}),components:Object.keys(n).length>0?n:void 0}};
|
|
3
|
+
export{i as Gg,d as Hg};
|