@desplega.ai/agent-swarm 2.13.5 → 2.14.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/acp-adapter-7jv7w8jh.js +17 -0
- package/dist/{acp-targets-w8dbs4nr.js → acp-targets-0ebmg3et.js} +10 -10
- package/dist/{actions-8zrcbjrx.js → actions-0ds9dx6c.js} +63 -42
- package/dist/{agent-fs-provision-cbt2ttds.js → agent-fs-provision-zpbxa9jc.js} +4 -4
- package/dist/{amp-adapter-8x6zp8w4.js → amp-adapter-awh5nn7a.js} +3 -3
- package/dist/{anthropic-messages-vdd1zmha.js → anthropic-messages-gtgp9r85.js} +17 -17
- package/dist/{app-zfa9dwjw.js → app-nzejkvpp.js} +10 -10
- package/dist/{approval-notifications-rv92zmza.js → approval-notifications-hbqtb2w3.js} +11 -11
- package/dist/{assistant-q7s7rm1q.js → assistant-1paft129.js} +42 -37
- package/dist/{boot-args-schema-g27kpzr1.js → boot-args-schema-zs435mfx.js} +1 -1
- package/dist/{boot-reembed-1mjs52nt.js → boot-reembed-7xq2qgg4.js} +1 -1
- package/dist/{boot-reembed-m62dpdkg.js → boot-reembed-91qrd4mz.js} +1 -1
- package/dist/{boot-scrub-sweep-ss1vcamw.js → boot-scrub-sweep-3h5xscw6.js} +2 -2
- package/dist/{boot-seeds-hwnvgbb3.js → boot-seeds-xkxqa8zc.js} +4 -4
- package/dist/{boxd-y0szhp0g.js → boxd-464x3w4m.js} +4 -4
- package/dist/{claude-adapter-0rjmbhjk.js → claude-adapter-6d8eyf2f.js} +12 -13
- package/dist/{claude-managed-adapter-6k032agg.js → claude-managed-adapter-jzxcaf9m.js} +4 -4
- package/dist/{claude-managed-setup-6czvve8q.js → claude-managed-setup-5fcx0qh3.js} +10 -10
- package/dist/{claude-sdk-session-pr0znb81.js → claude-sdk-session-11vhz1hc.js} +12720 -13882
- package/dist/{cli-kr0jpw9c.js → cli-02ba8qx5.js} +1 -1
- package/dist/{cli-ywy8yz6t.js → cli-08gfvs58.js} +2 -2
- package/dist/{cli-0qt3epg4.js → cli-0dkpdvnn.js} +10 -10
- package/dist/{cli-s8dhq7rj.js → cli-0mq8kxfx.js} +5 -5
- package/dist/{cli-ybte1fqc.js → cli-0nvqg1hb.js} +1 -1
- package/dist/{cli-f9xw9pr4.js → cli-0qyfna7a.js} +5 -5
- package/dist/cli-0vxbrxr3.js +1006 -0
- package/dist/{cli-ehg90jd1.js → cli-132h67ps.js} +64 -59
- package/dist/{cli-f7b9nyvk.js → cli-1e13gvfn.js} +17 -17
- package/dist/cli-1hj68b3h.js +30 -0
- package/dist/{cli-srktrbby.js → cli-1zbj28py.js} +1 -1
- package/dist/{cli-q41qar56.js → cli-20mkgwev.js} +173 -46
- package/dist/{cli-v09eza21.js → cli-288k5ep1.js} +15 -15
- package/dist/{cli-abby987g.js → cli-2n7qdqfv.js} +3 -3
- package/dist/{cli-kezzteka.js → cli-2r62jy9s.js} +1 -1
- package/dist/{cli-qmx8bnt4.js → cli-3179w2rz.js} +2 -2
- package/dist/cli-3a3hm1z8.js +15 -0
- package/dist/cli-3bagv8rt.js +37 -0
- package/dist/{cli-zxa1vmx7.js → cli-3bcsc3m7.js} +2 -2
- package/dist/{cli-j69pzrrz.js → cli-3g0vbq46.js} +5 -5
- package/dist/{cli-69szn7w7.js → cli-3ktfe5jx.js} +71 -47
- package/dist/{cli-69zzpjgh.js → cli-44r66df2.js} +1 -1
- package/dist/{cli-grbngev5.js → cli-466jjrwe.js} +11 -2
- package/dist/{cli-1jq2em7b.js → cli-4y2bekkn.js} +10 -9
- package/dist/cli-547fsc36.js +15 -0
- package/dist/{cli-6p8p2e6r.js → cli-5pyes68e.js} +1278 -23
- package/dist/{cli-ewk3sg68.js → cli-5t00r6c9.js} +3 -3
- package/dist/{cli-wzecestt.js → cli-5xjdft4s.js} +4063 -1835
- package/dist/{cli-4dyzzkfb.js → cli-643skca1.js} +954 -180
- package/dist/{cli-vr4eyq6p.js → cli-6a77m17n.js} +540 -412
- package/dist/{cli-v41kn3cd.js → cli-6prwz0zn.js} +4427 -5566
- package/dist/{cli-ks06cd0n.js → cli-6xrbpj5j.js} +8 -8
- package/dist/{cli-meydjstb.js → cli-6yhjqd6k.js} +4965 -69
- package/dist/{cli-bvamr9g0.js → cli-727sq1f9.js} +4 -4
- package/dist/{cli-snxhtehz.js → cli-7abeph0b.js} +7 -8
- package/dist/{cli-ty3gha1p.js → cli-7b9bwrfg.js} +2 -2
- package/dist/{cli-vbge4rsp.js → cli-7dwsn9y5.js} +4 -4
- package/dist/{cli-1kvcsd2f.js → cli-7qkbab03.js} +76 -8
- package/dist/{cli-8b4rpnwj.js → cli-7svwhw1a.js} +1 -1
- package/dist/{cli-jdq3jmny.js → cli-83kf2y60.js} +8 -10
- package/dist/{cli-tgc1kgg3.js → cli-84wxwt3z.js} +1 -1
- package/dist/{cli-sejvnjvw.js → cli-8crn0510.js} +1 -1
- package/dist/{cli-19d6v8er.js → cli-8kemtj1r.js} +172 -18
- package/dist/{cli-qrvk9nka.js → cli-967jrz7j.js} +40 -26
- package/dist/{cli-cp163xga.js → cli-976m0zcw.js} +72 -50
- package/dist/{cli-887vhew6.js → cli-98sea4d9.js} +2716 -2643
- package/dist/{cli-xh5fpmg8.js → cli-9txap41q.js} +101 -18
- package/dist/{cli-nrt048ys.js → cli-aktk3qt6.js} +40 -3
- package/dist/{cli-t0n9svkb.js → cli-b70cpf8f.js} +12 -7
- package/dist/{cli-2ap1the6.js → cli-by7s3n4p.js} +1 -1
- package/dist/{cli-tt7dkwjj.js → cli-byzq8xht.js} +7 -7
- package/dist/{cli-55h8m1x3.js → cli-d1zkys4j.js} +150 -99
- package/dist/cli-dr6x9qdk.js +15 -0
- package/dist/cli-dt931hb8.js +9740 -0
- package/dist/{cli-emdfd8fh.js → cli-dy754erz.js} +9 -1
- package/dist/{cli-2wzkvfgm.js → cli-e1wprqnd.js} +3 -3
- package/dist/{cli-pedm2kht.js → cli-e2wzzw17.js} +2 -2
- package/dist/{cli-1jx0srjt.js → cli-e9p9h14n.js} +1921 -80
- package/dist/{cli-evy3egte.js → cli-eaqxkeq0.js} +14 -103
- package/dist/{cli-he5nxaa8.js → cli-etykr11s.js} +3062 -728
- package/dist/{cli-3vw6dd4g.js → cli-f07sgaax.js} +2 -2
- package/dist/{cli-z1vam71h.js → cli-fe8he9cy.js} +2 -2
- package/dist/{cli-94gx6ze9.js → cli-h0edykd1.js} +1 -1
- package/dist/cli-h5cveb69.js +15 -0
- package/dist/{cli-5tq15aa7.js → cli-hamdfjtx.js} +2 -2
- package/dist/{cli-kwj3131p.js → cli-hh5m39pt.js} +1 -1
- package/dist/{cli-tvyt8w6n.js → cli-j8fmn3wv.js} +11 -11
- package/dist/cli-jngvszex.js +1514 -0
- package/dist/{cli-9n6g14vs.js → cli-k791mabe.js} +6 -6
- package/dist/{cli-6msnpj1z.js → cli-k9m8fckz.js} +10 -10
- package/dist/{cli-2vp0z049.js → cli-kz8rar0g.js} +1 -1
- package/dist/{cli-94mxerrp.js → cli-n15fhd43.js} +1 -1
- package/dist/{cli-htb5bpz2.js → cli-nmdy8bzf.js} +10 -3
- package/dist/{cli-t9pzz2eq.js → cli-ntmjzyte.js} +4 -1
- package/dist/{cli-avax5mp9.js → cli-ny8f5g7t.js} +19 -7
- package/dist/cli-p0g0erm9.js +15 -0
- package/dist/{cli-n79j1vxc.js → cli-pgdqhdkw.js} +4 -4
- package/dist/cli-ph1jce1b.js +16 -0
- package/dist/{cli-ced4azn1.js → cli-phantfg3.js} +771 -401
- package/dist/{cli-ebpq3c5z.js → cli-rb1z91g8.js} +10221 -1397
- package/dist/{cli-a49frv85.js → cli-redtbppc.js} +1 -1
- package/dist/{cli-cmbb2t8a.js → cli-s7bfz1ye.js} +15 -15
- package/dist/{cli-8pd1t17c.js → cli-sf5kp73f.js} +18 -18
- package/dist/{cli-zbbtp02a.js → cli-sq32dgfe.js} +1837 -7206
- package/dist/{cli-k0nebh10.js → cli-tbrjvrrg.js} +1 -1
- package/dist/{cli-4gaf3tx5.js → cli-tdd9dvw6.js} +1 -1
- package/dist/{cli-7ypg8hka.js → cli-tjrrabez.js} +3 -3
- package/dist/{cli-q1h041y8.js → cli-tkrp183j.js} +11 -11
- package/dist/{cli-srre41gb.js → cli-trvtxwzt.js} +2 -2
- package/dist/{cli-ffn0a515.js → cli-v1rhq77v.js} +68 -25
- package/dist/{cli-t879ww0y.js → cli-v3jxx8dv.js} +2 -2
- package/dist/{cli-b42yfn17.js → cli-v84kb7af.js} +14 -14
- package/dist/{cli-sa02jsqt.js → cli-vp2ksaq9.js} +1 -1
- package/dist/{cli-b0m3bg0f.js → cli-vrb8pvrf.js} +6 -6
- package/dist/cli-vxxdf2ma.js +15 -0
- package/dist/{cli-x2adbg4j.js → cli-w81s97bn.js} +1 -1
- package/dist/{cli-4vynxtrb.js → cli-wkzrknpt.js} +10 -3
- package/dist/{cli-fw67mnyc.js → cli-wqpvfq2m.js} +1 -1
- package/dist/{cli-prz1p3ft.js → cli-wsh5vfa7.js} +9 -9
- package/dist/{cli-hd5bm1e1.js → cli-wtwe8vng.js} +45 -45
- package/dist/{cli-34fygf87.js → cli-ww8wxfzx.js} +2 -2
- package/dist/{cli-e8trbfx1.js → cli-x80zagf5.js} +1 -1
- package/dist/{cli-zntvmqmm.js → cli-xd6ntv7x.js} +2 -2
- package/dist/{cli-vcpyttcw.js → cli-xmc2nrtv.js} +1 -1
- package/dist/{cli-z40t85ms.js → cli-ytgtqsy9.js} +1 -1
- package/dist/{cli-r3dxpmyt.js → cli-yvnnyjxm.js} +1 -1
- package/dist/{cli-zzq96q57.js → cli-z0c98h7h.js} +2450 -554
- package/dist/{cli-ryem5cfq.js → cli-z0effej1.js} +217 -27
- package/dist/{cli-0h8skzss.js → cli-zcb64xzv.js} +4 -3
- package/dist/{cli-5web09sb.js → cli-zdkcp8p0.js} +8 -10
- package/dist/{cli-z3x7h79n.js → cli-zgsd2w2k.js} +20 -22
- package/dist/{cli-7r9tvk8v.js → cli-zmfs06hg.js} +15 -9
- package/dist/{cli-3860pmrq.js → cli-zvsy4abb.js} +4 -4
- package/dist/{cli-5n9w2xzx.js → cli-zyf288rw.js} +2 -2
- package/dist/cli.js +64 -65
- package/dist/{codex-adapter-bn7eaxk5.js → codex-adapter-seht4h9t.js} +9 -9
- package/dist/{codex-hook-nnmezjg9.js → codex-hook-w5nmtrn2.js} +3 -3
- package/dist/{codex-login-ktfg1cxk.js → codex-login-67qarfcg.js} +1 -1
- package/dist/{codex-session-runner-j1e9hffc.js → codex-session-runner-tq95x3gq.js} +10 -10
- package/dist/{commands-amhpafrr.js → commands-0awwqxq5.js} +3 -3
- package/dist/{controller-tw7g10j2.js → controller-hgjx521c.js} +4 -4
- package/dist/{controllers-connect-2ssqz7f4.js → controllers-connect-j4kdmhfj.js} +28 -29
- package/dist/core-8fw1gwg7.js +41 -0
- package/dist/{cursor-adapter-d6knjmwa.js → cursor-adapter-0rg8wk6j.js} +2 -2
- package/dist/{db-fd6xxm77.js → db-8xs2js3s.js} +3 -3
- package/dist/{db-sc59379z.js → db-dd6hj211.js} +4 -2
- package/dist/{devin-adapter-3bp6rape.js → devin-adapter-tn1twrha.js} +1 -1
- package/dist/{devtools-qxfgbsqz.js → devtools-b8qts77k.js} +1 -1
- package/dist/{dispatcher-a2gdqz8c.js → dispatcher-v7drd034.js} +24 -25
- package/dist/{docker-a59g3ebm.js → docker-6007r2fj.js} +2 -2
- package/dist/dsh-adapter-ah8npj2x.js +11 -0
- package/dist/{e2b-qnxyfea6.js → e2b-hg80w0qr.js} +3 -3
- package/dist/{e2b-cn7cvjqy.js → e2b-z1g7vpz6.js} +16 -5
- package/dist/{easter-egg-3d-a0pphy71.js → easter-egg-3d-8n4w3s9k.js} +1 -1
- package/dist/{embedding-space-qepzrach.js → embedding-space-0p921zt3.js} +13 -23
- package/dist/{embeddings-d7vr881x.js → embeddings-9s7kbrc6.js} +1 -1
- package/dist/emscripten-module-Q67P5WYC-3sde6cre.js +2458 -0
- package/dist/{event-bus-7gbsr0g4.js → event-bus-pawddp92.js} +1 -1
- package/dist/{execute-6afts2bn.js → execute-x0fy9j0m.js} +1 -1
- package/dist/{external-channel-881zq1x4.js → external-channel-ktfvn29c.js} +2 -2
- package/dist/ffi-cbfmmtqk.js +85 -0
- package/dist/fx-adapter-15vjxvgm.js +20 -0
- package/dist/getMachineId-bsd-2rd3pnz7.js +36 -0
- package/dist/getMachineId-bsd-3p48mkt1.js +36 -0
- package/dist/{getMachineId-bsd-637a7rbk.js → getMachineId-bsd-bk6tmeen.js} +5 -5
- package/dist/getMachineId-bsd-pssqgwmm.js +37 -0
- package/dist/getMachineId-bsd-v218x3xd.js +36 -0
- package/dist/getMachineId-bsd-wbxcazef.js +36 -0
- package/dist/getMachineId-bsd-x0942pbz.js +36 -0
- package/dist/getMachineId-darwin-5qsy4qcg.js +36 -0
- package/dist/getMachineId-darwin-6v7zsshx.js +37 -0
- package/dist/getMachineId-darwin-fcc3fjag.js +36 -0
- package/dist/getMachineId-darwin-pg84hftj.js +36 -0
- package/dist/{getMachineId-darwin-9vytrcnn.js → getMachineId-darwin-tyyevt26.js} +5 -5
- package/dist/getMachineId-darwin-wagmbf0d.js +36 -0
- package/dist/getMachineId-darwin-zvkmwr3y.js +36 -0
- package/dist/{getMachineId-linux-mkzsvyyz.js → getMachineId-linux-2ncg1epd.js} +3 -3
- package/dist/getMachineId-linux-2tmt2ptc.js +29 -0
- package/dist/getMachineId-linux-empwyp2y.js +29 -0
- package/dist/getMachineId-linux-fanqd45b.js +29 -0
- package/dist/getMachineId-linux-h6fyga0x.js +29 -0
- package/dist/getMachineId-linux-tbhgz1k9.js +29 -0
- package/dist/getMachineId-linux-zrbyw7dt.js +29 -0
- package/dist/getMachineId-unsupported-29g9dkgv.js +19 -0
- package/dist/getMachineId-unsupported-8xfq8djv.js +19 -0
- package/dist/getMachineId-unsupported-8y9cag1p.js +19 -0
- package/dist/getMachineId-unsupported-a6sjrm02.js +19 -0
- package/dist/getMachineId-unsupported-bp3w7ds0.js +19 -0
- package/dist/{getMachineId-unsupported-4cfs2n11.js → getMachineId-unsupported-sj6fk8sw.js} +3 -3
- package/dist/getMachineId-unsupported-v0p5gdxp.js +19 -0
- package/dist/getMachineId-win-hc996p0x.js +38 -0
- package/dist/{getMachineId-win-154s3qma.js → getMachineId-win-msq9ad87.js} +6 -6
- package/dist/getMachineId-win-tajyqwd6.js +38 -0
- package/dist/getMachineId-win-tzc163da.js +38 -0
- package/dist/getMachineId-win-xdaa0mgq.js +38 -0
- package/dist/getMachineId-win-xk6p98m5.js +38 -0
- package/dist/getMachineId-win-xtk658fm.js +38 -0
- package/dist/{google-generative-ai-sw77egmr.js → google-generative-ai-nzndg246.js} +1 -1
- package/dist/{google-vertex-rrw93g8h.js → google-vertex-ragh3nnw.js} +1 -1
- package/dist/grok-adapter-77httan0.js +20 -0
- package/dist/handlers-c1jp5b6h.js +39 -0
- package/dist/heartbeat-5yaj6dym.js +49 -0
- package/dist/{hook-a7eh6zty.js → hook-2jttae8s.js} +13 -14
- package/dist/hook-c99nycyh.js +21 -0
- package/dist/{http-6aw5wanc.js → http-7y9dbfrr.js} +870 -219
- package/dist/{index-kzdqn3dd.js → index-6g9rdcrj.js} +3036 -758
- package/dist/index-7dwh9kxh.js +41 -0
- package/dist/{index-ym9fgxad.js → index-8p03vx1h.js} +8 -8
- package/dist/{index-maddg9ys.js → index-cw8nxnba.js} +4330 -15375
- package/dist/{index-yq9hhhhy.js → index-dm7c6hw5.js} +28 -29
- package/dist/index-fqf82sbk.js +10584 -0
- package/dist/{index-126v2d0t.js → index-g7rthzrv.js} +11 -2923
- package/dist/{index-z2g9469g.js → index-h9xnzfhx.js} +114 -33
- package/dist/{index-42jq9yy3.js → index-jvfp0j47.js} +516 -10
- package/dist/{index-3j803vnb.js → index-q60mhcpd.js} +25094 -20637
- package/dist/index-qxcfv8vq.js +17 -0
- package/dist/{index-rz8ve510.js → index-t274qhhs.js} +6 -6
- package/dist/{index-kdmkfjt7.js → index-t4n9z755.js} +3491 -2487
- package/dist/{index-7dgxveck.js → index-tcegcysh.js} +5 -5
- package/dist/{index-whysn1wf.js → index-tn1m3q9b.js} +3 -3
- package/dist/index-wp9tarbt.js +43 -0
- package/dist/{index-xhad0n8m.js → index-xhp7yp3t.js} +1 -1
- package/dist/index-z6np2405.js +38 -0
- package/dist/{k8s-36gfn847.js → k8s-mr1r12th.js} +2 -2
- package/dist/{keepalive-zhbmztqw.js → keepalive-7eyb8y4t.js} +4 -5
- package/dist/lead-50cgn8s1.js +81 -0
- package/dist/{maintenance-rsp0591h.js → maintenance-tdrd8nwv.js} +1 -1
- package/dist/module-ES6BEMUI-6htewwha.js +1210 -0
- package/dist/{node-0as4n1ef.js → node-gbx1t3pa.js} +1 -1
- package/dist/{node-rxte5hc6.js → node-jkdd5w7m.js} +1 -1
- package/dist/{oauth-refresh-sweep-w3cqmxq7.js → oauth-refresh-sweep-f4c7g37h.js} +3 -4
- package/dist/{object-webhooks-331hay92.js → object-webhooks-p190rdxp.js} +7 -7
- package/dist/{onboard-n2w80m2n.js → onboard-56h4sks6.js} +12 -10
- package/dist/{opencode-adapter-z98127cz.js → opencode-adapter-xg3yxfr0.js} +8 -8
- package/dist/{otel-impl-xsk35tvf.js → otel-impl-kepzgm4n.js} +36360 -9179
- package/dist/{pending-2e6trkxd.js → pending-xgv316w0.js} +25 -26
- package/dist/{pi-mono-adapter-wh6yndtm.js → pi-mono-adapter-txe0syzb.js} +19 -22
- package/dist/{pricing-refresh-9355dj1t.js → pricing-refresh-041zpyhf.js} +2 -2
- package/dist/{rbac-roles-8eajw4s6.js → rbac-roles-8f3jbcaf.js} +2 -2
- package/dist/{rbac-roles-58y3m912.js → rbac-roles-cw7rrw5b.js} +3 -3
- package/dist/{render-v2-7gskkmd4.js → render-v2-2ezw4mzt.js} +10 -10
- package/dist/{resume-0drnmpja.js → resume-p14wdx8m.js} +13 -13
- package/dist/{runtime-d2tcmqte.js → runtime-he7c9g1r.js} +1 -1
- package/dist/{session-access-0ztys6bd.js → session-access-8jvq86fj.js} +5 -5
- package/dist/{session-source-backfill-cdm5s046.js → session-source-backfill-6fe3hcgb.js} +3 -3
- package/dist/{setup-pqwb9tcc.js → setup-6v0bn4r1.js} +15 -6
- package/dist/thread-buffer-8860v1ta.js +40 -0
- package/dist/{token-util-pjgekqxr.js → token-util-hnzceyn9.js} +1 -1
- package/dist/{token-pgr2w4s3.js → token-xnc02n6w.js} +21 -14
- package/dist/{tree-visibility-rwz67mje.js → tree-visibility-g1a8ff4r.js} +2 -2
- package/dist/{user-merge-jobs-mxrhamwt.js → user-merge-jobs-vjsps179.js} +3 -3
- package/dist/{virtual-modules-71y1gsmg.js → virtual-modules-mreda4fp.js} +3 -3
- package/dist/{work-objects-3k4ykt9j.js → work-objects-hfw15e35.js} +29 -33
- package/dist/{worker-follow-up-y0h64xpr.js → worker-follow-up-gbaz2ydz.js} +24 -25
- package/dist/worker-hkm8ftqp.js +81 -0
- package/dist/{x-d27jj7z7.js → x-k29vmskt.js} +2 -2
- package/openapi.json +303 -20
- package/package.json +45 -45
- package/src/apps/definition.ts +76 -24
- package/src/apps/row-store.ts +67 -0
- package/src/apps/script-types.ts +131 -21
- package/src/apps/store.ts +4 -1
- package/src/be/db/model-profiles.ts +103 -12
- package/src/be/db/script-runs.ts +33 -0
- package/src/be/db/slack-card-groups.ts +147 -0
- package/src/be/db/slack-trees.ts +26 -0
- package/src/be/db/task-idempotency.ts +63 -0
- package/src/be/db/tasks/read.ts +7 -0
- package/src/be/db/tasks/write.ts +4 -2
- package/src/be/db/workflow-idempotency.ts +6 -1
- package/src/be/db/workflows/read.ts +79 -0
- package/src/be/db.ts +65 -151
- package/src/be/improvements.ts +24 -2
- package/src/be/mcp-proxy.ts +45 -11
- package/src/be/memory/embedding-space.ts +10 -20
- package/src/be/memory/index.ts +35 -0
- package/src/be/memory/providers/openai-embedding.ts +10 -0
- package/src/be/migrations/348_task_deferred_until.sql +4 -0
- package/src/be/migrations/354_durable_objects.sql +9 -0
- package/src/be/migrations/356_slack_outcome_card_groups.sql +14 -0
- package/src/be/migrations/357_task_idempotency_keys.sql +27 -0
- package/src/be/migrations/362_favorites_app.sql +36 -0
- package/src/be/model-group-resolution.ts +134 -0
- package/src/be/model-tier-resolution.ts +120 -17
- package/src/be/model-validation.ts +9 -1
- package/src/be/repo-checked-update.ts +58 -5
- package/src/be/requester-timezone.ts +10 -0
- package/src/be/runtime-pools/routing.ts +22 -8
- package/src/be/script-connections.ts +5 -1
- package/src/be/script-credential-broker.ts +29 -2
- package/src/be/scripts/durable.ts +204 -0
- package/src/be/scripts/extract-schema.ts +36 -4
- package/src/be/scripts/run-credential.ts +1 -8
- package/src/be/scripts/typecheck.ts +32 -7
- package/src/be/seed-scripts/catalog/memory-eval.ts +11 -2
- package/src/be/seed-scripts/catalog/tool-usage.ts +27 -8
- package/src/be/swarm-config-guard.ts +104 -14
- package/src/be/users.ts +33 -12
- package/src/comb/review-batch.ts +16 -5
- package/src/commands/context-preamble.ts +237 -0
- package/src/commands/e2b.ts +14 -0
- package/src/commands/entrypoint-mcp-config.ts +231 -0
- package/src/commands/onboard/agent-fs-version.ts +1 -1
- package/src/commands/onboard/compose-generator.ts +2 -1
- package/src/commands/onboard/env-generator.ts +16 -7
- package/src/commands/runner.ts +23 -7
- package/src/commands/setup.tsx +17 -3
- package/src/extensions/contract-types.generated.ts +1 -1
- package/src/hooks/hook.ts +8 -2
- package/src/hooks/native-tool-hooks.ts +4 -2
- package/src/http/apps.ts +82 -42
- package/src/http/comb.ts +21 -5
- package/src/http/config.ts +8 -4
- package/src/http/db-query.ts +8 -2
- package/src/http/heartbeat.ts +5 -0
- package/src/http/index.ts +12 -6
- package/src/http/kv.ts +7 -5
- package/src/http/mcp-oauth.ts +16 -0
- package/src/http/mcp-servers.ts +43 -3
- package/src/http/memory.ts +28 -1
- package/src/http/metrics.ts +11 -4
- package/src/http/onboarding.ts +12 -1
- package/src/http/operator-actor.ts +3 -8
- package/src/http/poll.ts +20 -1
- package/src/http/repos.ts +30 -12
- package/src/http/request-principal.ts +27 -1
- package/src/http/schedules.ts +59 -11
- package/src/http/script-connection-proxy.ts +3 -1
- package/src/http/script-runs.ts +21 -10
- package/src/http/scripts.ts +177 -26
- package/src/http/session-cost-recompute.ts +9 -4
- package/src/http/skills.ts +70 -0
- package/src/http/status.ts +2 -0
- package/src/http/tasks.ts +103 -15
- package/src/http/trackers/jira.ts +18 -3
- package/src/http/trackers/linear.ts +3 -0
- package/src/kv-limits.ts +2 -0
- package/src/kv-reserved-namespaces.ts +25 -2
- package/src/prompts/base-prompt.ts +10 -6
- package/src/prompts/session-templates.ts +52 -3
- package/src/prompts/session-turns.ts +30 -0
- package/src/providers/acp-targets.ts +1 -1
- package/src/providers/amp-adapter.ts +11 -9
- package/src/providers/claude-managed-adapter.ts +14 -0
- package/src/providers/claude-sdk-session.ts +14 -1
- package/src/providers/cursor-adapter.ts +1 -1
- package/src/providers/dsh-adapter.ts +1 -1
- package/src/providers/opencode-adapter.ts +3 -5
- package/src/providers/runtime-dependencies.ts +11 -8
- package/src/rbac/legacy-policy.ts +7 -0
- package/src/rbac/permissions.ts +27 -0
- package/src/realtime/browser.generated.txt +1 -1
- package/src/scheduler/schedule-task.ts +1 -0
- package/src/scheduler/scheduler.ts +36 -18
- package/src/script-workflows/executor.ts +37 -8
- package/src/script-workflows/supervisor.ts +14 -0
- package/src/scripts-runtime/ctx.ts +5 -1
- package/src/scripts-runtime/durable-object-base.ts +19 -0
- package/src/scripts-runtime/eval-harness.ts +46 -1
- package/src/scripts-runtime/executors/native.ts +13 -1
- package/src/scripts-runtime/executors/quickjs-bundle.ts +20 -1
- package/src/scripts-runtime/executors/quickjs-prelude.ts +40 -1
- package/src/scripts-runtime/executors/quickjs-runner.ts +26 -3
- package/src/scripts-runtime/executors/quickjs-worker.ts +2 -1
- package/src/scripts-runtime/executors/types.ts +26 -0
- package/src/scripts-runtime/extract-signature.ts +96 -1
- package/src/scripts-runtime/loader.ts +11 -5
- package/src/scripts-runtime/mcp-client.ts +1 -1
- package/src/scripts-runtime/sdk-allowlist.ts +1 -0
- package/src/scripts-runtime/swarm-config.ts +7 -0
- package/src/scripts-runtime/swarm-sdk.ts +4 -1
- package/src/scripts-runtime/types/stdlib.d.ts +19 -0
- package/src/scripts-runtime/types/swarm-extension.d.ts +3 -0
- package/src/scripts-runtime/types/swarm-sdk.d.ts +19 -0
- package/src/slack/actions.ts +24 -0
- package/src/slack/assistant.ts +8 -0
- package/src/slack/blocks.ts +35 -0
- package/src/slack/channel-activity.ts +7 -0
- package/src/slack/config.ts +4 -0
- package/src/slack/enrich.ts +46 -54
- package/src/slack/files.ts +173 -23
- package/src/slack/handlers.test.ts +17 -19
- package/src/slack/handlers.ts +15 -14
- package/src/slack/render-v2.ts +265 -19
- package/src/slack/responses.ts +62 -5
- package/src/slack/session-mirror.ts +10 -5
- package/src/slack/task-output.ts +25 -14
- package/src/slack/templates.ts +9 -0
- package/src/slack/thread-participants.ts +64 -24
- package/src/slack/watcher.ts +4 -4
- package/src/slack/work-objects.ts +1 -1
- package/src/stdio.ts +5 -0
- package/src/tasks/follow-up-gate.ts +142 -38
- package/src/tasks/worker-follow-up.ts +126 -37
- package/src/tests/agents-list-model-display.test.ts +4 -0
- package/src/tests/amp-adapter.test.ts +57 -9
- package/src/tests/apps-script-types.test.ts +63 -16
- package/src/tests/apps-sort-order.test.ts +87 -0
- package/src/tests/base-prompt.test.ts +36 -2
- package/src/tests/bedrock-model-groups.test.ts +4 -0
- package/src/tests/channel-activity.test.ts +9 -0
- package/src/tests/chatgpt-subscription-model-groups.test.ts +4 -0
- package/src/tests/claude-hook-output.test.ts +2 -0
- package/src/tests/claude-managed-adapter.test.ts +15 -3
- package/src/tests/claude-sdk-stderr.test.ts +28 -0
- package/src/tests/codex-gpt6-release.test.ts +4 -0
- package/src/tests/comb-review-batch.test.ts +17 -4
- package/src/tests/comb-status.test.ts +1 -0
- package/src/tests/db-client.test.ts +11 -5
- package/src/tests/db-retention-defaults.test.ts +28 -3
- package/src/tests/db-task-read-contract.test.ts +1 -0
- package/src/tests/db-task-write-contract.test.ts +2 -2
- package/src/tests/defer-task.test.ts +23 -1
- package/src/tests/dsh-adapter.test.ts +1 -1
- package/src/tests/e2b-dispatch.test.ts +13 -1
- package/src/tests/entrypoint-mcp-config.test.ts +642 -0
- package/src/tests/entrypoint-repo-autoclone-args.test.ts +10 -0
- package/src/tests/fixtures/onboard/content.env.txt +2 -2
- package/src/tests/fixtures/onboard/dev.env.txt +2 -2
- package/src/tests/fixtures/onboard/full-all.env.txt +2 -2
- package/src/tests/fixtures/onboard/full.env.txt +2 -2
- package/src/tests/fixtures/onboard/research.env.txt +2 -2
- package/src/tests/fixtures/onboard/solo.env.txt +2 -2
- package/src/tests/fixtures/runner-missing-dependency.ts +2 -1
- package/src/tests/follow-up-gate-shadow.test.ts +268 -10
- package/src/tests/fx-adapter.test.ts +4 -5
- package/src/tests/hook-mcp-config-precedence.test.ts +59 -0
- package/src/tests/hook-ping-me-order.test.ts +1 -0
- package/src/tests/hook-runtime-close.test.ts +1 -0
- package/src/tests/improvements-payload.test.ts +2 -2
- package/src/tests/linear-outbound-sync.test.ts +59 -25
- package/src/tests/model-groups-live-catalog.test.ts +4 -0
- package/src/tests/oauth-credential-bindings.test.ts +8 -3
- package/src/tests/oauth-refresh-failure.test.ts +15 -3
- package/src/tests/onboard-env.test.ts +1 -1
- package/src/tests/openai-compatible-providers.test.ts +5 -0
- package/src/tests/openapi-route-headers.test.ts +2 -1
- package/src/tests/operator-actor-keyless.test.ts +103 -0
- package/src/tests/opus-5-5-registry.test.ts +4 -0
- package/src/tests/profile-tier-alias.test.ts +9 -3
- package/src/tests/provider-runtime-dependencies.test.ts +26 -15
- package/src/tests/routing-affinity-inventory.test.ts +11 -0
- package/src/tests/runner-context-preamble.test.ts +202 -0
- package/src/tests/runner-repo-clone-args.test.ts +125 -0
- package/src/tests/scheduler-occurrence.test.ts +60 -9
- package/src/tests/script-connections-mcp.test.ts +6 -3
- package/src/tests/script-connections.test.ts +4 -0
- package/src/tests/scripts-namespaces.test.ts +3 -1
- package/src/tests/secret-scrubber.test.ts +8 -2
- package/src/tests/session-cost-recompute-unit.test.ts +39 -0
- package/src/tests/session-costs-recompute-all-providers.test.ts +6 -3
- package/src/tests/session-route-posture.test.ts +7 -1
- package/src/tests/slack-file-tools-attachments.test.ts +14 -9
- package/src/tests/slack-identity-resolution.test.ts +10 -3
- package/src/tests/slack-inline-output.test.ts +10 -8
- package/src/tests/slack-render-v2.test.ts +9 -4
- package/src/tests/slack-steering.test.ts +8 -2
- package/src/tests/slack-thread-participants.test.ts +11 -1
- package/src/tests/sonnet-5-5-registry.test.ts +4 -0
- package/src/tests/swarm-config-encryption.test.ts +5 -8
- package/src/tests/ui-spec-script-actions-config.test.ts +7 -3
- package/src/tests/workflow-system-one-extraction.test.ts +21 -0
- package/src/tests/workflow-triggers-v2.test.ts +35 -11
- package/src/tests/workflow-wait-filter.test.ts +7 -7
- package/src/tests/worktree-reaper.test.ts +15 -4
- package/src/tools/app-patch.ts +6 -2
- package/src/tools/app-upsert.ts +8 -4
- package/src/tools/defer-task.ts +17 -77
- package/src/tools/kv/kv-get.ts +2 -0
- package/src/tools/kv/kv-list.ts +11 -5
- package/src/tools/kv/kv-set.ts +1 -3
- package/src/tools/repos/update-repo.ts +37 -19
- package/src/tools/schedules/create-schedule.ts +20 -3
- package/src/tools/schedules/patch-schedule.ts +30 -4
- package/src/tools/schedules/run-schedule-now.ts +21 -1
- package/src/tools/schedules/update-schedule.ts +30 -4
- package/src/tools/script-apis.ts +9 -4
- package/src/tools/script-common.ts +2 -2
- package/src/tools/script-run.ts +8 -0
- package/src/tools/script-upsert.ts +1 -1
- package/src/tools/send-task.ts +17 -3
- package/src/tools/slack-download-file.ts +15 -12
- package/src/tools/slack-post.ts +14 -3
- package/src/tools/slack-read.ts +3 -1
- package/src/tools/slack-reply.ts +22 -2
- package/src/tools/slack-start-thread.ts +8 -1
- package/src/tools/slack-upload-file.ts +99 -96
- package/src/tools/swarm-config/set-config.ts +3 -1
- package/src/tools/swarm-x.ts +0 -2
- package/src/tools/task-action.ts +16 -3
- package/src/tools/utils.ts +4 -1
- package/src/types.ts +18 -2
- package/src/utils/amp-models.ts +20 -4
- package/src/utils/constants.ts +20 -0
- package/src/utils/deferral-time.ts +61 -0
- package/src/utils/request-auth-context.ts +15 -16
- package/src/utils/secret-scrubber.ts +7 -5
- package/src/workflows/engine.ts +42 -19
- package/src/workflows/executors/agent-task.ts +13 -2
- package/src/workflows/executors/code-match.ts +11 -31
- package/src/workflows/executors/script.ts +13 -0
- package/src/workflows/executors/swarm-script.ts +0 -2
- package/src/workflows/executors/system-one-extraction.ts +9 -6
- package/src/workflows/executors/wait.ts +1 -1
- package/src/workflows/foreach-driver.ts +11 -13
- package/src/workflows/input.ts +24 -1
- package/src/workflows/model-validation.ts +13 -1
- package/src/workflows/node-timeout.ts +18 -0
- package/src/workflows/predicate-sandbox.ts +171 -0
- package/src/workflows/retry-poller.ts +3 -2
- package/src/workflows/triggers.ts +21 -11
- package/src/workflows/wait-filter.ts +14 -192
- package/src/x/composio.ts +10 -1
- package/templates/skills/apps/SKILL.md +4 -2
- package/templates/skills/apps/content.md +4 -2
- package/templates/skills/code-quality/content.md +4 -4
- package/templates/skills/heartbeat-runbook/content.md +1 -0
- package/templates/skills/scheduled-task-resilience/SKILL.md +2 -0
- package/templates/skills/scheduled-task-resilience/content.md +2 -0
- package/templates/skills/slack-interaction/content.md +4 -0
- package/templates/skills/swarm-docs/content.md +8 -0
- package/templates/skills/swarm-scripts/SKILL.md +44 -0
- package/templates/skills/swarm-scripts/content.md +44 -0
- package/dist/acp-adapter-tbt61zkm.js +0 -17
- package/dist/cli-5ss6qqt9.js +0 -45
- package/dist/cli-b9ygp1kz.js +0 -459
- package/dist/cli-dzzh58sy.js +0 -6996
- package/dist/cli-j9ccfveb.js +0 -1849
- package/dist/cli-kj0hyr43.js +0 -51
- package/dist/cli-m8f4379k.js +0 -173
- package/dist/cli-mna6pmfx.js +0 -1485
- package/dist/cli-r8ddn0hf.js +0 -25583
- package/dist/core-bwp98v4w.js +0 -42
- package/dist/dsh-adapter-43ygwqn7.js +0 -9
- package/dist/fx-adapter-cr2hq17y.js +0 -20
- package/dist/grok-adapter-ayddnbsc.js +0 -20
- package/dist/handlers-7ghs84x2.js +0 -41
- package/dist/heartbeat-4c022m6a.js +0 -50
- package/dist/hook-4k84x499.js +0 -22
- package/dist/index-dtt0d634.js +0 -44
- package/dist/index-hmszyqkk.js +0 -42
- package/dist/index-j6rm1rtn.js +0 -39
- package/dist/index-rwwhsmjg.js +0 -13
- package/dist/index-t56y945n.js +0 -4
- package/dist/index-vfemrwwk.js +0 -10002
- package/dist/lead-g2j4q39z.js +0 -83
- package/dist/thread-buffer-epx3san4.js +0 -42
- package/dist/worker-09gqn9xy.js +0 -83
- package/dist/{azure-openai-responses-jeaas6x0.js → azure-openai-responses-e76k86gf.js} +4 -4
- package/dist/{openai-codex-responses-70g39cgz.js → openai-codex-responses-z2h941b8.js} +4 -4
- package/dist/{openai-completions-cv3hp4h5.js → openai-completions-5bxdkeg9.js} +4 -4
- package/dist/{openai-responses-trsvnks6.js → openai-responses-dzf3e8r5.js} +4 -4
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
ampPinCatalogError,
|
|
4
4
|
ampModelError,
|
|
5
5
|
init_amp_models
|
|
6
|
-
} from "./cli-
|
|
6
|
+
} from "./cli-nmdy8bzf.js";
|
|
7
7
|
import {
|
|
8
8
|
ALL_TOOLS,
|
|
9
9
|
init_tool_config
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
applyProviderQuotaReport,
|
|
15
15
|
scrubProviderQuotaReport,
|
|
16
16
|
init_provider_account_telemetry
|
|
17
|
-
} from "./cli-
|
|
17
|
+
} from "./cli-wqpvfq2m.js";
|
|
18
18
|
import {
|
|
19
19
|
CODEX_AUTH_FAILURE_BENCH_THRESHOLD,
|
|
20
20
|
CODEX_AUTH_FAILURE_BENCH_MS,
|
|
@@ -42,11 +42,11 @@ import {
|
|
|
42
42
|
init_identity_field_budget,
|
|
43
43
|
contentSha256,
|
|
44
44
|
init_profile_sync
|
|
45
|
-
} from "./cli-
|
|
45
|
+
} from "./cli-8kemtj1r.js";
|
|
46
46
|
import {
|
|
47
47
|
isSlackConfigured,
|
|
48
48
|
init_config5
|
|
49
|
-
} from "./cli-
|
|
49
|
+
} from "./cli-ntmjzyte.js";
|
|
50
50
|
import {
|
|
51
51
|
isSteeringEnabled2,
|
|
52
52
|
init_steering_enabled
|
|
@@ -61,28 +61,6 @@ import {
|
|
|
61
61
|
codexPlanFromClaim,
|
|
62
62
|
init_subscription_plans
|
|
63
63
|
} from "./cli-nh7x3133.js";
|
|
64
|
-
import {
|
|
65
|
-
activeModelBlock,
|
|
66
|
-
init_model_rate_limit_windows,
|
|
67
|
-
CREDENTIAL_SELECTION_STRATEGIES,
|
|
68
|
-
keyUsageFromWindows,
|
|
69
|
-
keyPaceFromWindows,
|
|
70
|
-
init_key_usage,
|
|
71
|
-
getModelAwareCredentialVars,
|
|
72
|
-
deriveProviderFromKeyType,
|
|
73
|
-
keySuffix,
|
|
74
|
-
splitCredentialPool,
|
|
75
|
-
selectCredential,
|
|
76
|
-
init_credentials2
|
|
77
|
-
} from "./cli-x2adbg4j.js";
|
|
78
|
-
import {
|
|
79
|
-
registerTemplate,
|
|
80
|
-
getAllTemplateDefinitions,
|
|
81
|
-
init_registry3,
|
|
82
|
-
configureDbResolver,
|
|
83
|
-
init_resolver,
|
|
84
|
-
init_session_templates
|
|
85
|
-
} from "./cli-nrt048ys.js";
|
|
86
64
|
import {
|
|
87
65
|
getOpenRouterAttributionHeaders,
|
|
88
66
|
init_openrouter_base_url
|
|
@@ -127,12 +105,34 @@ import {
|
|
|
127
105
|
SUPERSEDED_WORKFLOW_TASK_REASON,
|
|
128
106
|
PageThemeTokensSchema,
|
|
129
107
|
init_types5
|
|
130
|
-
} from "./cli-
|
|
108
|
+
} from "./cli-zmfs06hg.js";
|
|
109
|
+
import {
|
|
110
|
+
activeModelBlock,
|
|
111
|
+
init_model_rate_limit_windows,
|
|
112
|
+
CREDENTIAL_SELECTION_STRATEGIES,
|
|
113
|
+
keyUsageFromWindows,
|
|
114
|
+
keyPaceFromWindows,
|
|
115
|
+
init_key_usage,
|
|
116
|
+
getModelAwareCredentialVars,
|
|
117
|
+
deriveProviderFromKeyType,
|
|
118
|
+
keySuffix,
|
|
119
|
+
splitCredentialPool,
|
|
120
|
+
selectCredential,
|
|
121
|
+
init_credentials2
|
|
122
|
+
} from "./cli-w81s97bn.js";
|
|
123
|
+
import {
|
|
124
|
+
registerTemplate,
|
|
125
|
+
getAllTemplateDefinitions,
|
|
126
|
+
init_registry3,
|
|
127
|
+
configureDbResolver,
|
|
128
|
+
init_resolver,
|
|
129
|
+
init_session_templates
|
|
130
|
+
} from "./cli-aktk3qt6.js";
|
|
131
131
|
import {
|
|
132
132
|
setRuntimeModelCatalog,
|
|
133
133
|
runtimeHarnessSections,
|
|
134
134
|
init_runtime_model_catalog
|
|
135
|
-
} from "./cli-
|
|
135
|
+
} from "./cli-7svwhw1a.js";
|
|
136
136
|
import {
|
|
137
137
|
init_zod
|
|
138
138
|
} from "./cli-96234j5w.js";
|
|
@@ -153,6 +153,10 @@ import {
|
|
|
153
153
|
literal2,
|
|
154
154
|
exports_iso
|
|
155
155
|
} from "./cli-qrzq3hvg.js";
|
|
156
|
+
import {
|
|
157
|
+
realtimeBus,
|
|
158
|
+
init_bus
|
|
159
|
+
} from "./cli-syfdvhkc.js";
|
|
156
160
|
import {
|
|
157
161
|
isEnvFlagEnabled,
|
|
158
162
|
init_env_flag
|
|
@@ -160,15 +164,12 @@ import {
|
|
|
160
164
|
import {
|
|
161
165
|
init_package,
|
|
162
166
|
package_default
|
|
163
|
-
} from "./cli-
|
|
167
|
+
} from "./cli-wtwe8vng.js";
|
|
164
168
|
import {
|
|
165
169
|
getNodeEnv,
|
|
170
|
+
isDevOrTestNodeEnv,
|
|
166
171
|
init_node_env
|
|
167
172
|
} from "./cli-rgeadyvq.js";
|
|
168
|
-
import {
|
|
169
|
-
realtimeBus,
|
|
170
|
-
init_bus
|
|
171
|
-
} from "./cli-syfdvhkc.js";
|
|
172
173
|
import {
|
|
173
174
|
chatgptSubscriptionModelId,
|
|
174
175
|
isAlias,
|
|
@@ -191,7 +192,7 @@ import {
|
|
|
191
192
|
registerVolatileSecret,
|
|
192
193
|
registerSensitiveKeyName,
|
|
193
194
|
init_secret_scrubber
|
|
194
|
-
} from "./cli-
|
|
195
|
+
} from "./cli-7qkbab03.js";
|
|
195
196
|
import {
|
|
196
197
|
__toCommonJS,
|
|
197
198
|
__commonJS,
|
|
@@ -5317,9 +5318,8 @@ function getCurrentRunProvenance() {
|
|
|
5317
5318
|
const auth = getCurrentRequestAuth();
|
|
5318
5319
|
if (auth?.kind !== "agent")
|
|
5319
5320
|
return null;
|
|
5320
|
-
const sourceStepId = auth
|
|
5321
|
-
|
|
5322
|
-
return sourceStepId || sourceScriptRunId ? { sourceStepId, sourceScriptRunId } : null;
|
|
5321
|
+
const { sourceStepId, sourceScriptRunId, objectChain, depth } = auth;
|
|
5322
|
+
return sourceStepId || sourceScriptRunId || objectChain !== undefined || depth ? { sourceStepId, sourceScriptRunId, objectChain, depth } : null;
|
|
5323
5323
|
}
|
|
5324
5324
|
var requestAuth, authStorage;
|
|
5325
5325
|
var init_request_auth_context = __esm(() => {
|
|
@@ -5751,7 +5751,7 @@ var init_telemetry = __esm(() => {
|
|
|
5751
5751
|
// src/telemetry-identity.ts
|
|
5752
5752
|
async function loadUserRole(userId) {
|
|
5753
5753
|
try {
|
|
5754
|
-
const { getUserGrant } = await import("./rbac-roles-
|
|
5754
|
+
const { getUserGrant } = await import("./rbac-roles-cw7rrw5b.js");
|
|
5755
5755
|
const grant = await getUserGrant(userId);
|
|
5756
5756
|
const role = grant.grantsAll ? "admin" : "member";
|
|
5757
5757
|
const user = await getDbClient2().get("SELECT json_extract(metadata, '$.jobFunction') AS jobFunction FROM users WHERE id = ? AND json_valid(metadata)", [userId]);
|
|
@@ -6639,7 +6639,7 @@ function scheduleApprovalCardUpdates(approvals) {
|
|
|
6639
6639
|
const posted = approvals.filter((approval) => approval.notificationChannels?.some((n) => n.channel === "slack" && n.messageTs));
|
|
6640
6640
|
if (posted.length === 0)
|
|
6641
6641
|
return;
|
|
6642
|
-
getDbClient2().afterCommit(() => import("./approval-notifications-
|
|
6642
|
+
getDbClient2().afterCommit(() => import("./approval-notifications-hbqtb2w3.js").then(({ updateResolvedApprovalCards }) => updateResolvedApprovalCards(posted)).catch((err) => console.error("[HITL] Slack card update not run:", scrubSecrets(err instanceof Error ? err.message : String(err)))));
|
|
6643
6643
|
}
|
|
6644
6644
|
var init_approvals = __esm(() => {
|
|
6645
6645
|
init_secret_scrubber();
|
|
@@ -6966,8 +6966,12 @@ var init_legacy_policy = __esm(() => {
|
|
|
6966
6966
|
"memory.write.consolidated": leadOnly,
|
|
6967
6967
|
"memory.read.any": leadOrOperatorOrUser,
|
|
6968
6968
|
"memory.delete.any": memoryDelete,
|
|
6969
|
+
"memory.reembed": leadOrOperatorOrUser,
|
|
6969
6970
|
"channel.delete": leadOnly,
|
|
6970
6971
|
"repo.merge-policy.write": leadOrOperatorOrUser,
|
|
6972
|
+
"repo.exec-config.write": leadOrOperatorOrUser,
|
|
6973
|
+
"repo.delete": leadOrOperatorOrUser,
|
|
6974
|
+
"heartbeat.trigger": leadOrOperatorOrUser,
|
|
6971
6975
|
"integration.kapso.manage": leadOnly,
|
|
6972
6976
|
"integration.chat.manage": leadOnly,
|
|
6973
6977
|
"integration.chat.post": leadOnly,
|
|
@@ -7009,6 +7013,7 @@ var init_legacy_policy = __esm(() => {
|
|
|
7009
7013
|
"mcp-server.stdio.write": leadOrOperatorOrUser,
|
|
7010
7014
|
"mcp-server.read.secrets": leadOnly,
|
|
7011
7015
|
"mcp-oauth.authorize.any": anyAuthenticated,
|
|
7016
|
+
"mcp-oauth.manage": leadOrOperatorOrUser,
|
|
7012
7017
|
"kv.write.any": leadOrOwnNamespace,
|
|
7013
7018
|
"comb.presence": operatorOrUser,
|
|
7014
7019
|
"fs.join.own": anyAuthenticated,
|
|
@@ -7030,6 +7035,7 @@ var init_legacy_policy = __esm(() => {
|
|
|
7030
7035
|
"script.api.delete": leadOnly,
|
|
7031
7036
|
"schedule.deferral.update.any": leadOrResourceOwner,
|
|
7032
7037
|
"schedule.target.update.any": leadOrResourceOwner,
|
|
7038
|
+
"schedule.run.any": leadOrResourceOwner,
|
|
7033
7039
|
"runtime_pool.write": operatorOrUser,
|
|
7034
7040
|
"runtime_pool.bind": leadOrOperatorOrUser,
|
|
7035
7041
|
"runtime_controller.write": operatorOrUser,
|
|
@@ -7197,6 +7203,10 @@ var init_permissions = __esm(() => {
|
|
|
7197
7203
|
description: "List every agent's memories, beyond the caller's own and swarm-scoped entries (lead, operator, or user).",
|
|
7198
7204
|
namespace: "memory"
|
|
7199
7205
|
},
|
|
7206
|
+
"memory.reembed": {
|
|
7207
|
+
description: "Start a background re-embed of stored memories (lead, operator, or user), all agents' or one agent's.",
|
|
7208
|
+
namespace: "memory"
|
|
7209
|
+
},
|
|
7200
7210
|
"memory.delete.any": {
|
|
7201
7211
|
description: "Delete a memory entry: own agent-scoped entries; swarm-scoped entries as lead, operator, or user; any entry as operator or user.",
|
|
7202
7212
|
namespace: "memory"
|
|
@@ -7209,6 +7219,18 @@ var init_permissions = __esm(() => {
|
|
|
7209
7219
|
description: "Change a repo's merge policy (the allowMerge guideline or the mergePolicy record), which tells agents whether they may merge a PR themselves and which PRs the swarm may auto-merge.",
|
|
7210
7220
|
namespace: "repo"
|
|
7211
7221
|
},
|
|
7222
|
+
"repo.exec-config.write": {
|
|
7223
|
+
description: "Change a repo's url, clonePath or hooks, or create a repo with hooks enabled. Workers clone the url into clonePath and run the hook install there.",
|
|
7224
|
+
namespace: "repo"
|
|
7225
|
+
},
|
|
7226
|
+
"repo.delete": {
|
|
7227
|
+
description: "Delete a repo record and the guidelines and merge policy it holds.",
|
|
7228
|
+
namespace: "repo"
|
|
7229
|
+
},
|
|
7230
|
+
"heartbeat.trigger": {
|
|
7231
|
+
description: "Run the heartbeat sweep or the heartbeat checklist check on demand.",
|
|
7232
|
+
namespace: "heartbeat"
|
|
7233
|
+
},
|
|
7212
7234
|
"integration.kapso.manage": {
|
|
7213
7235
|
description: "Register or unregister a Kapso inbound number.",
|
|
7214
7236
|
namespace: "integration"
|
|
@@ -7373,6 +7395,10 @@ var init_permissions = __esm(() => {
|
|
|
7373
7395
|
description: "Start an MCP-server OAuth authorize flow for a caller-supplied user scope.",
|
|
7374
7396
|
namespace: "mcp-oauth"
|
|
7375
7397
|
},
|
|
7398
|
+
"mcp-oauth.manage": {
|
|
7399
|
+
description: "Refresh or revoke an MCP server's OAuth token, or register its OAuth client by hand.",
|
|
7400
|
+
namespace: "mcp-oauth"
|
|
7401
|
+
},
|
|
7376
7402
|
"kv.write.any": {
|
|
7377
7403
|
description: "Write another agent's task:agent: KV namespace, or a lead-only family (usecase:*).",
|
|
7378
7404
|
namespace: "kv"
|
|
@@ -7457,6 +7483,10 @@ var init_permissions = __esm(() => {
|
|
|
7457
7483
|
description: "Change what a schedule the caller did not create runs (its target, task template, workflow, script, script args or params).",
|
|
7458
7484
|
namespace: "schedule"
|
|
7459
7485
|
},
|
|
7486
|
+
"schedule.run.any": {
|
|
7487
|
+
description: "Run a schedule the caller did not create now, as its creator.",
|
|
7488
|
+
namespace: "schedule"
|
|
7489
|
+
},
|
|
7460
7490
|
"runtime_pool.write": {
|
|
7461
7491
|
description: "Create, update, or delete runtime pools (image, provider kind, placement).",
|
|
7462
7492
|
namespace: "runtime_pool"
|
|
@@ -8776,7 +8806,7 @@ async function applyCliSupport(resolution, harness, cliVersion) {
|
|
|
8776
8806
|
return { ...resolution, resolvedModel: fallback, modelSource };
|
|
8777
8807
|
}
|
|
8778
8808
|
async function resolveClaimProfile(name, source, harness) {
|
|
8779
|
-
const isTask = source === "profile:task";
|
|
8809
|
+
const isTask = source === "profile:task" || source === "profile:group";
|
|
8780
8810
|
const profile = await getModelProfileByName(name);
|
|
8781
8811
|
if (!profile) {
|
|
8782
8812
|
return isTask ? { modelUnsupported: `[model-profile-missing] Model profile "${name}" no longer exists.` } : null;
|
|
@@ -8818,18 +8848,40 @@ async function resolveClaimProfile(name, source, harness) {
|
|
|
8818
8848
|
resolution
|
|
8819
8849
|
};
|
|
8820
8850
|
}
|
|
8821
|
-
async function resolveTierAlias(resolved, task, harness) {
|
|
8851
|
+
async function resolveTierAlias(resolved, task, agentId, harness, includeRepoSecrets) {
|
|
8822
8852
|
const tier = parseModelTier(task.modelTier);
|
|
8823
8853
|
if (!resolved || "harnessMismatch" in resolved || !tier || !harness)
|
|
8824
8854
|
return null;
|
|
8825
|
-
const
|
|
8855
|
+
const seeded = `${harness}-${tier}`;
|
|
8826
8856
|
if (resolved.modelSource === "worker-env" || resolved.modelSource === "tier-config") {
|
|
8827
|
-
console.log(`[model-tier] deprecated: ${resolved.modelSource} override for ${
|
|
8857
|
+
console.log(`[model-tier] deprecated: ${resolved.modelSource} override for ${seeded}; edit profile ${seeded} instead`);
|
|
8828
8858
|
return null;
|
|
8829
8859
|
}
|
|
8830
8860
|
if (resolved.modelSource !== "tier-default")
|
|
8831
8861
|
return null;
|
|
8832
|
-
const
|
|
8862
|
+
const group = await resolveGroupForAgent(tier, agentId, {
|
|
8863
|
+
vcsRepo: task.vcsRepo,
|
|
8864
|
+
includeRepoSecrets
|
|
8865
|
+
});
|
|
8866
|
+
let name = seeded;
|
|
8867
|
+
let picked = null;
|
|
8868
|
+
if (group.kind === "resolved") {
|
|
8869
|
+
picked = await resolveClaimProfile(group.member, "profile:tier-alias", harness);
|
|
8870
|
+
if (picked && "profile" in picked) {
|
|
8871
|
+
name = group.member;
|
|
8872
|
+
const untouched = group.onHarness.length === 1 && group.onHarness[0] === seeded;
|
|
8873
|
+
if (!untouched) {
|
|
8874
|
+
picked = { ...picked, resolution: { ...picked.resolution, modelSource: "profile:group" } };
|
|
8875
|
+
}
|
|
8876
|
+
if (group.member !== seeded) {
|
|
8877
|
+
await logGroupResolution(task.id, agentId, tier, group.member, group.skipped);
|
|
8878
|
+
}
|
|
8879
|
+
}
|
|
8880
|
+
}
|
|
8881
|
+
if (!picked || !("profile" in picked)) {
|
|
8882
|
+
picked = await resolveClaimProfile(seeded, "profile:tier-alias", harness);
|
|
8883
|
+
name = seeded;
|
|
8884
|
+
}
|
|
8833
8885
|
if (!picked || !("profile" in picked))
|
|
8834
8886
|
return picked;
|
|
8835
8887
|
if (isHarnessModelJudged(harness) && harnessModelMismatch(picked.resolution.resolvedModel, harness, (await loadResolutionCatalog()).catalog)) {
|
|
@@ -8838,14 +8890,41 @@ async function resolveTierAlias(resolved, task, harness) {
|
|
|
8838
8890
|
}
|
|
8839
8891
|
return picked;
|
|
8840
8892
|
}
|
|
8893
|
+
async function logGroupResolution(taskId, agentId, group, member, skipped) {
|
|
8894
|
+
await createLogEntry2({
|
|
8895
|
+
eventType: "task_model_group_resolved",
|
|
8896
|
+
taskId,
|
|
8897
|
+
agentId,
|
|
8898
|
+
newValue: member,
|
|
8899
|
+
metadata: { group, member, skipped }
|
|
8900
|
+
});
|
|
8901
|
+
}
|
|
8902
|
+
async function resolveClaimGroup(group, task, agentId, harness, includeRepoSecrets) {
|
|
8903
|
+
const resolution = await resolveGroupForAgent(group, agentId, {
|
|
8904
|
+
vcsRepo: task.vcsRepo,
|
|
8905
|
+
includeRepoSecrets
|
|
8906
|
+
});
|
|
8907
|
+
if (resolution.kind === "missing") {
|
|
8908
|
+
return { modelUnsupported: `[model-group-missing] Model group "${group}" no longer exists.` };
|
|
8909
|
+
}
|
|
8910
|
+
if (resolution.kind === "none") {
|
|
8911
|
+
return { modelUnsupported: groupUnavailableMessage(group, harness, resolution.skipped) };
|
|
8912
|
+
}
|
|
8913
|
+
if (resolution.skipped.length > 0) {
|
|
8914
|
+
console.log(`[model-group] task ${task.id}: ${group} → ${resolution.member} (skipped: ${formatGroupSkips(resolution.skipped)})`);
|
|
8915
|
+
}
|
|
8916
|
+
await logGroupResolution(task.id, agentId, group, resolution.member, resolution.skipped);
|
|
8917
|
+
return await resolveClaimProfile(resolution.member, "profile:group", harness);
|
|
8918
|
+
}
|
|
8841
8919
|
async function recordClaimModelResolution(task, agent, { includeRepoSecrets = true } = {}) {
|
|
8842
8920
|
const harnessProvider = agent.harnessProvider ?? agent.provider ?? null;
|
|
8843
8921
|
if (!task.model?.trim()) {
|
|
8844
8922
|
const taskProfile = task.profile?.trim();
|
|
8845
|
-
const
|
|
8923
|
+
const taskGroup = taskProfile ? undefined : task.modelGroup?.trim();
|
|
8924
|
+
const agentDefault = taskProfile || taskGroup || parseModelTier(task.modelTier) ? null : await getAgentDefaultProfileName(agent.id);
|
|
8846
8925
|
const repoKeys = agentDefault ? await repoModelOverrideKeys(task.vcsRepo, { includeSecrets: includeRepoSecrets }) : new Set;
|
|
8847
8926
|
const defaultProfile = repoKeys.has("MODEL_OVERRIDE") ? null : agentDefault;
|
|
8848
|
-
const picked = taskProfile ? await resolveClaimProfile(taskProfile, "profile:task", harnessProvider) : defaultProfile ? await resolveClaimProfile(defaultProfile, "profile:agent-default", harnessProvider) : null;
|
|
8927
|
+
const picked = taskProfile ? await resolveClaimProfile(taskProfile, "profile:task", harnessProvider) : taskGroup ? await resolveClaimGroup(taskGroup, task, agent.id, harnessProvider, includeRepoSecrets) : defaultProfile ? await resolveClaimProfile(defaultProfile, "profile:agent-default", harnessProvider) : null;
|
|
8849
8928
|
if (picked && "modelUnsupported" in picked)
|
|
8850
8929
|
return { modelUnsupported: picked.modelUnsupported };
|
|
8851
8930
|
if (picked) {
|
|
@@ -8874,7 +8953,7 @@ async function recordClaimModelResolution(task, agent, { includeRepoSecrets = tr
|
|
|
8874
8953
|
harnessProvider,
|
|
8875
8954
|
workerOverrides: await getAgentModelTierOverrides(agent.id)
|
|
8876
8955
|
});
|
|
8877
|
-
const alias = await resolveTierAlias(resolvedTier, task, harnessProvider);
|
|
8956
|
+
const alias = await resolveTierAlias(resolvedTier, task, agent.id, harnessProvider, includeRepoSecrets);
|
|
8878
8957
|
if (alias && "modelUnsupported" in alias)
|
|
8879
8958
|
return { modelUnsupported: alias.modelUnsupported };
|
|
8880
8959
|
if (alias) {
|
|
@@ -8922,6 +9001,7 @@ var init_model_tier_resolution = __esm(() => {
|
|
|
8922
9001
|
init_model_profiles();
|
|
8923
9002
|
init_harness_model_support();
|
|
8924
9003
|
init_model_catalog_store();
|
|
9004
|
+
init_model_group_resolution();
|
|
8925
9005
|
init_model_tier_keys();
|
|
8926
9006
|
init_modelsdev_cache();
|
|
8927
9007
|
init_model_tier_keys();
|
|
@@ -8973,6 +9053,9 @@ async function poolTaskRunsOnHarness(task, harness) {
|
|
|
8973
9053
|
const profile = await getModelProfileByName(profileName);
|
|
8974
9054
|
return !profile || !harness || profile.harness === harness;
|
|
8975
9055
|
}
|
|
9056
|
+
const groupName = task?.modelGroup?.trim();
|
|
9057
|
+
if (groupName)
|
|
9058
|
+
return await groupHasMemberOnHarness(groupName, harness);
|
|
8976
9059
|
const model = taskModelPin(task ?? {})?.trim();
|
|
8977
9060
|
if (!model)
|
|
8978
9061
|
return true;
|
|
@@ -9058,6 +9141,7 @@ var init_model_validation2 = __esm(() => {
|
|
|
9058
9141
|
init_db4();
|
|
9059
9142
|
init_model_profiles();
|
|
9060
9143
|
init_model_catalog_store();
|
|
9144
|
+
init_model_group_resolution();
|
|
9061
9145
|
init_model_tier_resolution();
|
|
9062
9146
|
FREE_FORM_HARNESSES = new Set(["acp", "devin", "dsh", "cursor"]);
|
|
9063
9147
|
CONTEXT_SUFFIX_RE = /\[1m\]$/i;
|
|
@@ -9268,6 +9352,76 @@ var init_model_profile_check = __esm(() => {
|
|
|
9268
9352
|
STATE_RANK = { pass: 0, unverified: 1, warn: 2, fail: 3 };
|
|
9269
9353
|
});
|
|
9270
9354
|
|
|
9355
|
+
// src/be/model-group-resolution.ts
|
|
9356
|
+
async function modelGroupMemberHarnesses(group) {
|
|
9357
|
+
const rows = await getDbClient2().query(`SELECT m.profileName AS profile, p.harness AS harness
|
|
9358
|
+
FROM model_groups g
|
|
9359
|
+
LEFT JOIN model_group_members m ON m.groupId = g.id
|
|
9360
|
+
LEFT JOIN model_profiles p ON p.name = m.profileName
|
|
9361
|
+
WHERE g.name = ?
|
|
9362
|
+
ORDER BY m.position`, [group.trim()]);
|
|
9363
|
+
if (rows.length === 0)
|
|
9364
|
+
return null;
|
|
9365
|
+
return rows.flatMap((row) => row.profile && row.harness ? [{ profile: row.profile, harness: row.harness }] : []);
|
|
9366
|
+
}
|
|
9367
|
+
function firstFailingCheck(result) {
|
|
9368
|
+
const row = result.profiles[0]?.checks.find((check) => check.state === "fail");
|
|
9369
|
+
if (!row)
|
|
9370
|
+
return "failed the profile check";
|
|
9371
|
+
return row.detail ? `${row.check}: ${row.detail}` : row.check;
|
|
9372
|
+
}
|
|
9373
|
+
async function resolveGroupForAgent(group, agentId, options = {}) {
|
|
9374
|
+
const members = await modelGroupMemberHarnesses(group);
|
|
9375
|
+
if (!members)
|
|
9376
|
+
return { kind: "missing" };
|
|
9377
|
+
const agent = await getAgentById2(agentId);
|
|
9378
|
+
const harness = agent?.harnessProvider ?? agent?.provider ?? null;
|
|
9379
|
+
const skipped = [];
|
|
9380
|
+
const from = options.startAfter ? members.findIndex((member) => member.profile === options.startAfter) + 1 : 0;
|
|
9381
|
+
for (let index = from;index < members.length; index++) {
|
|
9382
|
+
const member = members[index];
|
|
9383
|
+
if (options.skip?.has(member.profile))
|
|
9384
|
+
continue;
|
|
9385
|
+
if (member.harness !== harness) {
|
|
9386
|
+
if (options.sameHarnessOnly)
|
|
9387
|
+
continue;
|
|
9388
|
+
skipped.push({ profile: member.profile, reason: `harness: runs on ${member.harness}` });
|
|
9389
|
+
continue;
|
|
9390
|
+
}
|
|
9391
|
+
const result = await checkProfileForAgent(agentId, member.profile, {
|
|
9392
|
+
vcsRepo: options.vcsRepo,
|
|
9393
|
+
includeRepoSecrets: options.includeRepoSecrets,
|
|
9394
|
+
fallbacks: false
|
|
9395
|
+
});
|
|
9396
|
+
if (result?.ok) {
|
|
9397
|
+
const onHarness = members.filter((m) => m.harness === harness).map((m) => m.profile);
|
|
9398
|
+
return { kind: "resolved", member: member.profile, index, skipped, onHarness };
|
|
9399
|
+
}
|
|
9400
|
+
skipped.push({
|
|
9401
|
+
profile: member.profile,
|
|
9402
|
+
reason: result ? firstFailingCheck(result) : "not found"
|
|
9403
|
+
});
|
|
9404
|
+
}
|
|
9405
|
+
return { kind: "none", skipped };
|
|
9406
|
+
}
|
|
9407
|
+
function formatGroupSkips(skipped) {
|
|
9408
|
+
return skipped.map((skip) => `${skip.profile} (${skip.reason})`).join(", ");
|
|
9409
|
+
}
|
|
9410
|
+
function groupUnavailableMessage(group, harness, skipped) {
|
|
9411
|
+
const where = harness ? `this ${harness} agent` : "this agent";
|
|
9412
|
+
return `[model-group-unavailable] no member of "${group}" runs on ${where}${skipped.length > 0 ? `: ${formatGroupSkips(skipped)}` : ""}`;
|
|
9413
|
+
}
|
|
9414
|
+
async function groupHasMemberOnHarness(group, harness) {
|
|
9415
|
+
if (!harness)
|
|
9416
|
+
return true;
|
|
9417
|
+
const members = await modelGroupMemberHarnesses(group);
|
|
9418
|
+
return !members || members.some((member) => member.harness === harness);
|
|
9419
|
+
}
|
|
9420
|
+
var init_model_group_resolution = __esm(() => {
|
|
9421
|
+
init_db4();
|
|
9422
|
+
init_model_profile_check();
|
|
9423
|
+
});
|
|
9424
|
+
|
|
9271
9425
|
// src/utils/provider-metadata.ts
|
|
9272
9426
|
function parseProviderMeta(rawProvider, rawMeta) {
|
|
9273
9427
|
if (!rawMeta || !rawProvider)
|
|
@@ -9585,6 +9739,7 @@ function rowToAgentTask(row) {
|
|
|
9585
9739
|
resolvedEffort: ReasoningEffortSchema.safeParse(row.resolvedEffort).success ? row.resolvedEffort : undefined,
|
|
9586
9740
|
profile: row.profile ?? undefined,
|
|
9587
9741
|
resolvedProfile: row.resolvedProfile ?? undefined,
|
|
9742
|
+
modelGroup: row.modelGroup ?? undefined,
|
|
9588
9743
|
fallbackHops: parseFallbackHops(row.fallbackHops),
|
|
9589
9744
|
scheduleId: row.scheduleId ?? undefined,
|
|
9590
9745
|
workflowRunId: row.workflowRunId ?? undefined,
|
|
@@ -9606,6 +9761,7 @@ function rowToAgentTask(row) {
|
|
|
9606
9761
|
progress: row.progress ?? undefined,
|
|
9607
9762
|
wasPaused: !!row.was_paused,
|
|
9608
9763
|
deferredAt: row.deferredAt ?? undefined,
|
|
9764
|
+
deferredUntil: row.deferredUntil ?? undefined,
|
|
9609
9765
|
credentialKeySuffix: row.credentialKeySuffix ?? undefined,
|
|
9610
9766
|
credentialKeyType: row.credentialKeyType ?? undefined,
|
|
9611
9767
|
requestedByUserId: row.requestedByUserId ?? undefined,
|
|
@@ -9646,6 +9802,7 @@ function rowToAgentTaskSummary(row) {
|
|
|
9646
9802
|
resolvedEffort: ReasoningEffortSchema.safeParse(row.resolvedEffort).success ? row.resolvedEffort : undefined,
|
|
9647
9803
|
profile: row.profile ?? undefined,
|
|
9648
9804
|
resolvedProfile: row.resolvedProfile ?? undefined,
|
|
9805
|
+
modelGroup: row.modelGroup ?? undefined,
|
|
9649
9806
|
provider: row.provider ?? undefined,
|
|
9650
9807
|
requestedByUserId: row.requestedByUserId ?? undefined,
|
|
9651
9808
|
progress: row.progress ?? undefined,
|
|
@@ -10622,6 +10779,7 @@ var init_read = __esm(() => {
|
|
|
10622
10779
|
agent_tasks.scheduleId, agent_tasks.model, agent_tasks.modelTier,
|
|
10623
10780
|
agent_tasks.resolvedModel, agent_tasks.modelSource, agent_tasks.modelAlias, agent_tasks.effort,
|
|
10624
10781
|
agent_tasks.resolvedEffort, agent_tasks.profile, agent_tasks.resolvedProfile,
|
|
10782
|
+
agent_tasks.modelGroup,
|
|
10625
10783
|
agent_tasks.provider, agent_tasks.requestedByUserId, agent_tasks.progress,
|
|
10626
10784
|
agent_tasks.createdAt, agent_tasks.lastUpdatedAt, agent_tasks.finishedAt,
|
|
10627
10785
|
agent_tasks.statusKind, agent_tasks.peakContextPercent`,
|
|
@@ -10861,6 +11019,9 @@ async function repoModelOverrideKeys(vcsRepo, { includeSecrets = true } = {}) {
|
|
|
10861
11019
|
return new Set(rows.map((row) => row.key));
|
|
10862
11020
|
}
|
|
10863
11021
|
async function taskProfileError(check) {
|
|
11022
|
+
const group = check.modelGroup?.trim();
|
|
11023
|
+
if (group)
|
|
11024
|
+
return await taskModelGroupError({ ...check, modelGroup: group });
|
|
10864
11025
|
const name = check.profile?.trim();
|
|
10865
11026
|
if (!name)
|
|
10866
11027
|
return null;
|
|
@@ -10881,9 +11042,46 @@ async function taskProfileError(check) {
|
|
|
10881
11042
|
return null;
|
|
10882
11043
|
return formatProfileCheckFailures(result);
|
|
10883
11044
|
}
|
|
11045
|
+
async function taskModelGroupError(check) {
|
|
11046
|
+
if (check.model?.trim() || check.modelTier?.trim() || check.profile?.trim()) {
|
|
11047
|
+
return "Pass `modelGroup`, or `model`/`modelTier`/`profile`, not both.";
|
|
11048
|
+
}
|
|
11049
|
+
if (!check.agentId) {
|
|
11050
|
+
return await modelGroupMemberHarnesses(check.modelGroup) ? null : unknownModelGroupMessage(check.modelGroup);
|
|
11051
|
+
}
|
|
11052
|
+
const resolution = await resolveGroupForAgent(check.modelGroup, check.agentId, {
|
|
11053
|
+
vcsRepo: check.vcsRepo
|
|
11054
|
+
});
|
|
11055
|
+
if (resolution.kind === "missing")
|
|
11056
|
+
return unknownModelGroupMessage(check.modelGroup);
|
|
11057
|
+
if (resolution.kind === "resolved")
|
|
11058
|
+
return null;
|
|
11059
|
+
const agent = await getAgentById2(check.agentId);
|
|
11060
|
+
return groupUnavailableMessage(check.modelGroup, agent?.harnessProvider ?? agent?.provider, resolution.skipped);
|
|
11061
|
+
}
|
|
11062
|
+
function unknownModelGroupMessage(name) {
|
|
11063
|
+
return `Unknown model group "${name}". List groups with GET /api/model-groups.`;
|
|
11064
|
+
}
|
|
11065
|
+
function modelGroupRefError(error) {
|
|
11066
|
+
const message = error instanceof Error ? error.message : "";
|
|
11067
|
+
return message.includes("model-group-missing:");
|
|
11068
|
+
}
|
|
10884
11069
|
async function scheduleProfileUpdate(existing, patch) {
|
|
10885
11070
|
const profile = patch.profile === undefined ? undefined : patch.profile?.trim() || null;
|
|
11071
|
+
const modelGroup = patch.modelGroup === undefined ? undefined : patch.modelGroup?.trim() || null;
|
|
10886
11072
|
const agentId = patch.targetAgentId !== undefined ? patch.targetAgentId : existing.targetAgentId;
|
|
11073
|
+
if (modelGroup) {
|
|
11074
|
+
const error = await taskProfileError({
|
|
11075
|
+
modelGroup,
|
|
11076
|
+
profile,
|
|
11077
|
+
model: patch.model,
|
|
11078
|
+
modelTier: patch.modelTier,
|
|
11079
|
+
agentId
|
|
11080
|
+
});
|
|
11081
|
+
if (error)
|
|
11082
|
+
return { error };
|
|
11083
|
+
return { fields: { modelGroup, profile: null, model: null, modelTier: null } };
|
|
11084
|
+
}
|
|
10887
11085
|
if (profile) {
|
|
10888
11086
|
const error = await taskProfileError({
|
|
10889
11087
|
profile,
|
|
@@ -10893,18 +11091,24 @@ async function scheduleProfileUpdate(existing, patch) {
|
|
|
10893
11091
|
});
|
|
10894
11092
|
if (error)
|
|
10895
11093
|
return { error };
|
|
10896
|
-
return { fields: { profile, model: null, modelTier: null } };
|
|
11094
|
+
return { fields: { profile, modelGroup: null, model: null, modelTier: null } };
|
|
10897
11095
|
}
|
|
10898
|
-
if (patch.model?.trim() || patch.modelTier?.trim()
|
|
10899
|
-
return { fields: { profile: null } };
|
|
11096
|
+
if (patch.model?.trim() || patch.modelTier?.trim()) {
|
|
11097
|
+
return { fields: { profile: null, modelGroup: null } };
|
|
10900
11098
|
}
|
|
11099
|
+
const cleared = {
|
|
11100
|
+
...profile === null ? { profile: null } : {},
|
|
11101
|
+
...modelGroup === null ? { modelGroup: null } : {}
|
|
11102
|
+
};
|
|
10901
11103
|
const agentChanged = patch.targetAgentId !== undefined && patch.targetAgentId !== existing.targetAgentId;
|
|
10902
|
-
if (agentChanged
|
|
10903
|
-
const
|
|
11104
|
+
if (agentChanged) {
|
|
11105
|
+
const keptProfile = profile === null ? null : existing.profile;
|
|
11106
|
+
const keptGroup = modelGroup === null ? null : existing.modelGroup;
|
|
11107
|
+
const error = keptGroup ? await taskProfileError({ modelGroup: keptGroup, agentId }) : keptProfile ? await taskProfileError({ profile: keptProfile, agentId }) : null;
|
|
10904
11108
|
if (error)
|
|
10905
11109
|
return { error };
|
|
10906
11110
|
}
|
|
10907
|
-
return { fields:
|
|
11111
|
+
return { fields: cleared };
|
|
10908
11112
|
}
|
|
10909
11113
|
function effectiveOverride(row) {
|
|
10910
11114
|
if (!row)
|
|
@@ -10923,7 +11127,9 @@ var MODEL_PROFILE_CONFIG_KEY = "MODEL_PROFILE", unreadableAllowlists, TASK_HOLDS
|
|
|
10923
11127
|
WHERE j.value = model_profiles.name AND o.name <> model_profiles.name)`, MAX_MODEL_PROFILE_FALLBACKS = 10;
|
|
10924
11128
|
var init_model_profiles = __esm(() => {
|
|
10925
11129
|
init_types5();
|
|
11130
|
+
init_model_group_resolution();
|
|
10926
11131
|
init_model_profile_check();
|
|
11132
|
+
init_agents();
|
|
10927
11133
|
init_runtime2();
|
|
10928
11134
|
init_read();
|
|
10929
11135
|
unreadableAllowlists = new WeakSet;
|
|
@@ -11787,6 +11993,17 @@ async function slackThreadHasBotReplySince(channelId, threadTs, since, taskId) {
|
|
|
11787
11993
|
) AS found`, [channelId, threadTs, since, taskId]);
|
|
11788
11994
|
return !!row?.found;
|
|
11789
11995
|
}
|
|
11996
|
+
async function slackThreadHasAgentReplyOnTasksSince(channelId, threadTs, since, agentId, taskIds) {
|
|
11997
|
+
if (taskIds.length === 0)
|
|
11998
|
+
return false;
|
|
11999
|
+
const row = await getDbClient2().get(`SELECT EXISTS (
|
|
12000
|
+
SELECT 1 FROM slack_messages reply
|
|
12001
|
+
WHERE reply.channel_id = ? AND reply.thread_ts = ? AND reply.created_at >= ?
|
|
12002
|
+
AND reply.kind = 'agent' AND reply.created_by = ?
|
|
12003
|
+
AND reply.task_id IN (${taskIds.map(() => "?").join(", ")})
|
|
12004
|
+
) AS found`, [channelId, threadTs, since, agentId, ...taskIds]);
|
|
12005
|
+
return !!row?.found;
|
|
12006
|
+
}
|
|
11790
12007
|
function slackOutcomeWindowParams(window2) {
|
|
11791
12008
|
return [window2.finishedAfter, Number(window2.delegationEnabled), window2.closureActiveAfter];
|
|
11792
12009
|
}
|
|
@@ -12509,7 +12726,7 @@ async function completeTask2(id, output, options) {
|
|
|
12509
12726
|
}
|
|
12510
12727
|
}
|
|
12511
12728
|
if (completed && options?.deferredAt) {
|
|
12512
|
-
completed = await getDbClient2().get("UPDATE agent_tasks SET deferredAt = ?, lastUpdatedAt = strftime('%Y-%m-%dT%H:%M:%fZ', 'now') WHERE id = ? RETURNING *", [options.deferredAt, id]);
|
|
12729
|
+
completed = await getDbClient2().get("UPDATE agent_tasks SET deferredAt = ?, deferredUntil = ?, lastUpdatedAt = strftime('%Y-%m-%dT%H:%M:%fZ', 'now') WHERE id = ? RETURNING *", [options.deferredAt, options.deferredUntil ?? null, id]);
|
|
12513
12730
|
}
|
|
12514
12731
|
if (completed) {
|
|
12515
12732
|
await dependencies3.reconcileTaskPullRequestAttachments(id, completed.agentId, [
|
|
@@ -12539,7 +12756,7 @@ async function completeTask2(id, output, options) {
|
|
|
12539
12756
|
});
|
|
12540
12757
|
} catch {}
|
|
12541
12758
|
getDbClient2().afterCommit(() => {
|
|
12542
|
-
import("./event-bus-
|
|
12759
|
+
import("./event-bus-pawddp92.js").then(({ workflowEventBus }) => {
|
|
12543
12760
|
workflowEventBus.emit("task.completed", {
|
|
12544
12761
|
taskId: id,
|
|
12545
12762
|
previousStatus: oldTask.status,
|
|
@@ -12596,7 +12813,7 @@ async function failTask2(id, reason, opts = {}) {
|
|
|
12596
12813
|
});
|
|
12597
12814
|
} catch {}
|
|
12598
12815
|
getDbClient2().afterCommit(() => {
|
|
12599
|
-
import("./event-bus-
|
|
12816
|
+
import("./event-bus-pawddp92.js").then(({ workflowEventBus }) => {
|
|
12600
12817
|
workflowEventBus.emit("task.failed", {
|
|
12601
12818
|
taskId: id,
|
|
12602
12819
|
previousStatus: oldTask.status,
|
|
@@ -12679,7 +12896,7 @@ async function cancelTask2(id, reason, options = {}) {
|
|
|
12679
12896
|
});
|
|
12680
12897
|
} catch {}
|
|
12681
12898
|
getDbClient2().afterCommit(() => {
|
|
12682
|
-
import("./event-bus-
|
|
12899
|
+
import("./event-bus-pawddp92.js").then(({ workflowEventBus }) => {
|
|
12683
12900
|
workflowEventBus.emit("task.cancelled", {
|
|
12684
12901
|
taskId: id,
|
|
12685
12902
|
previousStatus: oldTask.status,
|
|
@@ -12692,7 +12909,7 @@ async function cancelTask2(id, reason, options = {}) {
|
|
|
12692
12909
|
if (row.source === "schedule" && row.taskType === "deferred" && row.parentTaskId) {
|
|
12693
12910
|
getDbClient2().afterCommit(async () => {
|
|
12694
12911
|
try {
|
|
12695
|
-
const { createWorkerTaskFollowUp } = await import("./worker-follow-up-
|
|
12912
|
+
const { createWorkerTaskFollowUp } = await import("./worker-follow-up-gbaz2ydz.js");
|
|
12696
12913
|
await createWorkerTaskFollowUp({
|
|
12697
12914
|
task: rowToAgentTask(row),
|
|
12698
12915
|
status: "failed",
|
|
@@ -12741,7 +12958,7 @@ async function skipTask2(id, reason, opts = {}) {
|
|
|
12741
12958
|
});
|
|
12742
12959
|
} catch {}
|
|
12743
12960
|
getDbClient2().afterCommit(() => {
|
|
12744
|
-
import("./event-bus-
|
|
12961
|
+
import("./event-bus-pawddp92.js").then(({ workflowEventBus }) => {
|
|
12745
12962
|
workflowEventBus.emit("task.skipped", {
|
|
12746
12963
|
taskId: id,
|
|
12747
12964
|
failureReason: skipReason,
|
|
@@ -12800,7 +13017,7 @@ async function supersedeTask2(id, args) {
|
|
|
12800
13017
|
});
|
|
12801
13018
|
} catch {}
|
|
12802
13019
|
getDbClient2().afterCommit(() => {
|
|
12803
|
-
import("./event-bus-
|
|
13020
|
+
import("./event-bus-pawddp92.js").then(({ workflowEventBus }) => {
|
|
12804
13021
|
workflowEventBus.emit("task.superseded", {
|
|
12805
13022
|
taskId: id,
|
|
12806
13023
|
reason: args.reason,
|
|
@@ -13036,7 +13253,7 @@ async function updateTaskProgress2(id, progress) {
|
|
|
13036
13253
|
});
|
|
13037
13254
|
} catch {}
|
|
13038
13255
|
getDbClient2().afterCommit(() => {
|
|
13039
|
-
import("./event-bus-
|
|
13256
|
+
import("./event-bus-pawddp92.js").then(({ workflowEventBus }) => {
|
|
13040
13257
|
workflowEventBus.emit("task.progress", {
|
|
13041
13258
|
taskId: id,
|
|
13042
13259
|
progress: scrubbedProgress,
|
|
@@ -13135,6 +13352,9 @@ function sortKeys(value) {
|
|
|
13135
13352
|
return Object.fromEntries(Object.entries(value).filter(([, nested]) => nested !== undefined).sort(([left], [right]) => left < right ? -1 : left > right ? 1 : 0).map(([key, nested]) => [key, sortKeys(nested)]));
|
|
13136
13353
|
}
|
|
13137
13354
|
function workflowRequestFingerprint(operation, body) {
|
|
13355
|
+
return requestFingerprint(operation, body);
|
|
13356
|
+
}
|
|
13357
|
+
function requestFingerprint(operation, body) {
|
|
13138
13358
|
return sha256(`${operation}
|
|
13139
13359
|
${JSON.stringify(sortKeys(body ?? null))}`);
|
|
13140
13360
|
}
|
|
@@ -13620,7 +13840,7 @@ function emitRunFinished(runId, workflowId, status) {
|
|
|
13620
13840
|
}
|
|
13621
13841
|
function emitBusEventAfterCommit(event, payload) {
|
|
13622
13842
|
getDbClient2().afterCommit(() => {
|
|
13623
|
-
import("./event-bus-
|
|
13843
|
+
import("./event-bus-pawddp92.js").then(({ workflowEventBus }) => {
|
|
13624
13844
|
workflowEventBus.emit(event, payload);
|
|
13625
13845
|
}).catch((err) => console.error(`[db] ${event} event not emitted:`, scrubSecrets(err instanceof Error ? err.message : String(err))));
|
|
13626
13846
|
});
|
|
@@ -13708,6 +13928,49 @@ var init_workflow_runs = __esm(() => {
|
|
|
13708
13928
|
};
|
|
13709
13929
|
});
|
|
13710
13930
|
|
|
13931
|
+
// src/be/db/workflows/read.ts
|
|
13932
|
+
function rowToWorkflow(row) {
|
|
13933
|
+
return {
|
|
13934
|
+
id: row.id,
|
|
13935
|
+
key: row.key,
|
|
13936
|
+
name: row.name,
|
|
13937
|
+
description: row.description ?? undefined,
|
|
13938
|
+
enabled: row.enabled === 1,
|
|
13939
|
+
definition: JSON.parse(row.definition),
|
|
13940
|
+
triggers: JSON.parse(row.triggers),
|
|
13941
|
+
cooldown: row.cooldown ? JSON.parse(row.cooldown) : undefined,
|
|
13942
|
+
input: row.input ? JSON.parse(row.input) : undefined,
|
|
13943
|
+
triggerSchema: row.triggerSchema ? JSON.parse(row.triggerSchema) : undefined,
|
|
13944
|
+
params: JSON.parse(row.params),
|
|
13945
|
+
requiredParams: JSON.parse(row.requiredParams),
|
|
13946
|
+
requires: JSON.parse(row.requires),
|
|
13947
|
+
dir: row.dir ?? undefined,
|
|
13948
|
+
vcsRepo: row.vcs_repo ?? undefined,
|
|
13949
|
+
createdByAgentId: row.createdByAgentId ?? undefined,
|
|
13950
|
+
updatedByAgentId: row.updatedByAgentId ?? undefined,
|
|
13951
|
+
createdAt: normalizeDateRequired(row.createdAt),
|
|
13952
|
+
lastUpdatedAt: normalizeDateRequired(row.lastUpdatedAt),
|
|
13953
|
+
createdBy: row.created_by ?? undefined,
|
|
13954
|
+
updatedBy: row.updated_by ?? undefined
|
|
13955
|
+
};
|
|
13956
|
+
}
|
|
13957
|
+
async function getWorkflowsByEventName2(eventName) {
|
|
13958
|
+
const rows = await getDbClient2().query(`SELECT w.* FROM workflows w
|
|
13959
|
+
WHERE w.enabled = 1
|
|
13960
|
+
AND EXISTS (
|
|
13961
|
+
SELECT 1 FROM json_each(w.triggers) AS t
|
|
13962
|
+
WHERE t.type = 'object'
|
|
13963
|
+
AND json_extract(t.value, '$.type') = 'event'
|
|
13964
|
+
AND json_extract(t.value, '$.eventName') = ?
|
|
13965
|
+
)
|
|
13966
|
+
ORDER BY w.lastUpdatedAt DESC`, [eventName]);
|
|
13967
|
+
return rows.map(rowToWorkflow);
|
|
13968
|
+
}
|
|
13969
|
+
var init_read2 = __esm(() => {
|
|
13970
|
+
init_date_utils();
|
|
13971
|
+
init_runtime2();
|
|
13972
|
+
});
|
|
13973
|
+
|
|
13711
13974
|
// src/integrations/chat-sdk/schema.ts
|
|
13712
13975
|
function forbiddenKeyIssues(value, ctx) {
|
|
13713
13976
|
for (const key of FORBIDDEN_ADAPTER_KEYS) {
|
|
@@ -14081,6 +14344,53 @@ function isApiDrainingResponse(response) {
|
|
|
14081
14344
|
var API_DRAINING_HEADER = "X-Swarm-Draining", API_DRAIN_MAX_MS_LIMIT = 120000;
|
|
14082
14345
|
var init_api_drain2 = () => {};
|
|
14083
14346
|
|
|
14347
|
+
// src/utils/deferral-time.ts
|
|
14348
|
+
function isValidTimezone(zone) {
|
|
14349
|
+
if (typeof zone !== "string" || !zone)
|
|
14350
|
+
return false;
|
|
14351
|
+
try {
|
|
14352
|
+
new Intl.DateTimeFormat("en-US", { timeZone: zone });
|
|
14353
|
+
return true;
|
|
14354
|
+
} catch {
|
|
14355
|
+
return false;
|
|
14356
|
+
}
|
|
14357
|
+
}
|
|
14358
|
+
function partsInTz(date, tz) {
|
|
14359
|
+
const fmt = new Intl.DateTimeFormat("en-US", {
|
|
14360
|
+
timeZone: tz,
|
|
14361
|
+
year: "numeric",
|
|
14362
|
+
month: "2-digit",
|
|
14363
|
+
day: "2-digit",
|
|
14364
|
+
hour: "2-digit",
|
|
14365
|
+
minute: "2-digit",
|
|
14366
|
+
timeZoneName: "short",
|
|
14367
|
+
hourCycle: "h23"
|
|
14368
|
+
});
|
|
14369
|
+
const parts = Object.fromEntries(fmt.formatToParts(date).map((p) => [p.type, p.value]));
|
|
14370
|
+
return {
|
|
14371
|
+
year: parts.year,
|
|
14372
|
+
month: parts.month,
|
|
14373
|
+
day: parts.day,
|
|
14374
|
+
hour: parts.hour,
|
|
14375
|
+
minute: parts.minute,
|
|
14376
|
+
abbreviation: parts.timeZoneName
|
|
14377
|
+
};
|
|
14378
|
+
}
|
|
14379
|
+
function formatDeferralDateTime(target, now, tz, labelZone = false) {
|
|
14380
|
+
const zone = isValidTimezone(tz) ? tz : "UTC";
|
|
14381
|
+
const t = partsInTz(target, zone);
|
|
14382
|
+
const time = `${t.hour}:${t.minute}${labelZone ? ` ${t.abbreviation}` : ""}`;
|
|
14383
|
+
const n = partsInTz(now, zone);
|
|
14384
|
+
if (t.year === n.year && t.month === n.month && t.day === n.day)
|
|
14385
|
+
return { date: "today", time };
|
|
14386
|
+
const tm = partsInTz(new Date(now.getTime() + 86400000), zone);
|
|
14387
|
+
if (t.year === tm.year && t.month === tm.month && t.day === tm.day) {
|
|
14388
|
+
return { date: "tomorrow", time };
|
|
14389
|
+
}
|
|
14390
|
+
return { date: `${t.month}-${t.day}`, time };
|
|
14391
|
+
}
|
|
14392
|
+
var init_deferral_time = () => {};
|
|
14393
|
+
|
|
14084
14394
|
// src/utils/enabled-tools.ts
|
|
14085
14395
|
function parseEnabledTools(value) {
|
|
14086
14396
|
if (value === undefined)
|
|
@@ -14145,6 +14455,14 @@ var init_task_tool_manifest = __esm(() => {
|
|
|
14145
14455
|
function teamsSdkEnvKeysSql() {
|
|
14146
14456
|
return TEAMS_SDK_ENV_KEYS.map((key) => `'${key}'`).join(", ");
|
|
14147
14457
|
}
|
|
14458
|
+
function isApiProcessControlEnvKey(key) {
|
|
14459
|
+
const name = key.toUpperCase();
|
|
14460
|
+
return API_PROCESS_CONTROL_ENV_KEYS.has(name) || API_PROCESS_CONTROL_ENV_PREFIXES.some((prefix) => name.startsWith(prefix));
|
|
14461
|
+
}
|
|
14462
|
+
function invalidConfigKeyError(key) {
|
|
14463
|
+
return ["=", "\x00", "\r", `
|
|
14464
|
+
`].some((char) => key.includes(char)) ? `Invalid config key '${JSON.stringify(key).slice(1, -1)}' (must not contain '=', NUL, CR or LF)` : null;
|
|
14465
|
+
}
|
|
14148
14466
|
function isApiOnlyConfigKey(key) {
|
|
14149
14467
|
return API_ONLY_CONFIG_KEYS.has(key);
|
|
14150
14468
|
}
|
|
@@ -14160,7 +14478,7 @@ function isHumanOnlyConfigKey(key) {
|
|
|
14160
14478
|
return HUMAN_ONLY_CONFIG_KEYS.has(key.toUpperCase());
|
|
14161
14479
|
}
|
|
14162
14480
|
function humanOnlyConfigKeyError(key) {
|
|
14163
|
-
return `
|
|
14481
|
+
return `Changing key '${key}' requires a user token or dashboard user session. With RBAC enabled, the user must be an admin. Agents and the shared API key cannot change it.`;
|
|
14164
14482
|
}
|
|
14165
14483
|
function humanOnlyConfigKeyPageError(key) {
|
|
14166
14484
|
return `Key '${key}' cannot be changed from a page session. Change it from the dashboard or with a user token.`;
|
|
@@ -14182,6 +14500,16 @@ function booleanValidators(keys) {
|
|
|
14182
14500
|
}
|
|
14183
14501
|
]));
|
|
14184
14502
|
}
|
|
14503
|
+
function scheduleIdsValidator(key) {
|
|
14504
|
+
const message = `Invalid ${key} (must be comma-separated schedule UUIDs)`;
|
|
14505
|
+
return {
|
|
14506
|
+
[key]: (value) => {
|
|
14507
|
+
if (typeof value !== "string")
|
|
14508
|
+
return message;
|
|
14509
|
+
return parseFollowUpGateScheduleIds(value).every(isFollowUpGateScheduleId) ? null : message;
|
|
14510
|
+
}
|
|
14511
|
+
};
|
|
14512
|
+
}
|
|
14185
14513
|
function enumValidator(key, options) {
|
|
14186
14514
|
const listed = options.filter(Boolean).join(", ");
|
|
14187
14515
|
const message = `Invalid ${key} value (must be one of: ${listed}${options.includes("") ? ", or empty" : ""})`;
|
|
@@ -14283,6 +14611,16 @@ function validateDockerPidsLimit(value) {
|
|
|
14283
14611
|
const limit = value.trim();
|
|
14284
14612
|
return !limit || /^[1-9]\d*$/.test(limit) && Number.isSafeInteger(Number(limit)) ? null : "Invalid DOCKER_PIDS_LIMIT (must be a positive integer, or empty)";
|
|
14285
14613
|
}
|
|
14614
|
+
function validateWorkflowInputEnvAllowlist(value) {
|
|
14615
|
+
if (typeof value !== "string")
|
|
14616
|
+
return "WORKFLOW_INPUT_ENV_ALLOWLIST must be a string";
|
|
14617
|
+
for (const name of value.split(",").map((part) => part.trim())) {
|
|
14618
|
+
if (name !== "" && !/^[A-Za-z_][A-Za-z0-9_]*$/.test(name)) {
|
|
14619
|
+
return `WORKFLOW_INPUT_ENV_ALLOWLIST: "${name}" is not an env var name (use comma-separated NAME values)`;
|
|
14620
|
+
}
|
|
14621
|
+
}
|
|
14622
|
+
return null;
|
|
14623
|
+
}
|
|
14286
14624
|
function validateConfigValue(key, value) {
|
|
14287
14625
|
if (isTierConfigKey(key))
|
|
14288
14626
|
return validateTierConfigValue(key.toUpperCase(), value);
|
|
@@ -14295,6 +14633,9 @@ function validateConfigEntry(entry) {
|
|
|
14295
14633
|
if ((entry.scope === "agent" || entry.scope === "repo") && !entry.scopeId) {
|
|
14296
14634
|
return "Agent/repo scope requires scopeId";
|
|
14297
14635
|
}
|
|
14636
|
+
const keyError = invalidConfigKeyError(entry.key);
|
|
14637
|
+
if (keyError)
|
|
14638
|
+
return keyError;
|
|
14298
14639
|
if (isReservedConfigKey(entry.key))
|
|
14299
14640
|
return reservedKeyError(entry.key).message;
|
|
14300
14641
|
if (isInternalConfigKey(entry.key))
|
|
@@ -14304,7 +14645,7 @@ function validateConfigEntry(entry) {
|
|
|
14304
14645
|
function validateExportToEnv(key, exportToEnv) {
|
|
14305
14646
|
return exportToEnv === true && isEnvExportRestrictedKey(key) ? envExportRestrictedError(key) : null;
|
|
14306
14647
|
}
|
|
14307
|
-
var TEAMS_SDK_ENV_KEYS, RESERVED_KEYS, API_ONLY_CONFIG_KEYS, INTERNAL_CONFIG_KEYS, HUMAN_ONLY_CONFIG_KEYS, BOOLEAN_LITERALS, MAX_DB_RETENTION_DAYS = 1e6, DB_RETENTION_TUNING_BOUNDS, APPS_JSON_COLUMN_MAX_BYTES_BOUNDS, CODEX_OAUTH_KEEP_WARM_MAX_AGE_HOURS_BOUNDS, SCHEDULER_INTERVAL_MS_BOUNDS, SYSTEM_ONE_DEFAULT_PROVIDER_OPTIONS, SYSTEM_ONE_EXTRACT_DEFAULT_PROVIDER_OPTIONS, validateControllerTokenTtlDays, validateControllerGraceSec, VALIDATED_KEYS;
|
|
14648
|
+
var TEAMS_SDK_ENV_KEYS, RESERVED_KEYS, API_PROCESS_CONTROL_ENV_KEYS, API_PROCESS_CONTROL_ENV_PREFIXES, API_ONLY_CONFIG_KEYS, INTERNAL_CONFIG_KEYS, HUMAN_ONLY_CONFIG_KEYS, BOOLEAN_LITERALS, MAX_DB_RETENTION_DAYS = 1e6, DB_RETENTION_TUNING_BOUNDS, APPS_JSON_COLUMN_MAX_BYTES_BOUNDS, APPS_DEFINITION_LIMIT_BOUNDS, CODEX_OAUTH_KEEP_WARM_MAX_AGE_HOURS_BOUNDS, SCHEDULER_INTERVAL_MS_BOUNDS, SYSTEM_ONE_DEFAULT_PROVIDER_OPTIONS, SYSTEM_ONE_EXTRACT_DEFAULT_PROVIDER_OPTIONS, validateControllerTokenTtlDays, validateControllerGraceSec, VALIDATED_KEYS;
|
|
14308
14649
|
var init_swarm_config_guard = __esm(() => {
|
|
14309
14650
|
init_schema();
|
|
14310
14651
|
init_telemetry_ranking();
|
|
@@ -14315,6 +14656,7 @@ var init_swarm_config_guard = __esm(() => {
|
|
|
14315
14656
|
init_api_drain2();
|
|
14316
14657
|
init_company_profile();
|
|
14317
14658
|
init_config_env_export();
|
|
14659
|
+
init_deferral_time();
|
|
14318
14660
|
init_egress_guard();
|
|
14319
14661
|
init_enabled_tools();
|
|
14320
14662
|
init_follow_up_gate_schedule_ids();
|
|
@@ -14343,8 +14685,24 @@ var init_swarm_config_guard = __esm(() => {
|
|
|
14343
14685
|
"GITHUB_URL",
|
|
14344
14686
|
"GITHUB_API_URL",
|
|
14345
14687
|
"GITHUB_APP_INSTALLATION_ID",
|
|
14346
|
-
"GITHUB_APP_REPO_OWNERS"
|
|
14688
|
+
"GITHUB_APP_REPO_OWNERS",
|
|
14689
|
+
"OPENCODE_SDK_PATH",
|
|
14690
|
+
"SCRIPT_API_BASE_URL"
|
|
14691
|
+
]);
|
|
14692
|
+
API_PROCESS_CONTROL_ENV_KEYS = new Set([
|
|
14693
|
+
"PATH",
|
|
14694
|
+
"HOME",
|
|
14695
|
+
"SHELL",
|
|
14696
|
+
"ENV",
|
|
14697
|
+
"NODE_ENV",
|
|
14698
|
+
"NODE_OPTIONS",
|
|
14699
|
+
"NODE_PATH",
|
|
14700
|
+
"BUN_OPTIONS",
|
|
14701
|
+
"GCONV_PATH",
|
|
14702
|
+
"GLIBC_TUNABLES",
|
|
14703
|
+
"CLAUDE_BINARY"
|
|
14347
14704
|
]);
|
|
14705
|
+
API_PROCESS_CONTROL_ENV_PREFIXES = ["LD_", "DYLD_", "BASH_", "BUN_INSPECT"];
|
|
14348
14706
|
API_ONLY_CONFIG_KEYS = new Set([
|
|
14349
14707
|
"API_AGENT_FS_API_KEY",
|
|
14350
14708
|
"SLACK_SIGNING_SECRET",
|
|
@@ -14355,7 +14713,10 @@ var init_swarm_config_guard = __esm(() => {
|
|
|
14355
14713
|
"runtime_owner_id",
|
|
14356
14714
|
TELEMETRY_RANKING_KEY
|
|
14357
14715
|
]);
|
|
14358
|
-
HUMAN_ONLY_CONFIG_KEYS = new Set([
|
|
14716
|
+
HUMAN_ONLY_CONFIG_KEYS = new Set([
|
|
14717
|
+
UI_SPEC_SCRIPT_ACTIONS_KEY,
|
|
14718
|
+
"WORKFLOW_INPUT_ENV_ALLOWLIST"
|
|
14719
|
+
]);
|
|
14359
14720
|
BOOLEAN_LITERALS = ["true", "false", "1", "0"];
|
|
14360
14721
|
DB_RETENTION_TUNING_BOUNDS = {
|
|
14361
14722
|
DB_RETENTION_TICK_BUDGET_MS: { min: 1000, max: 300000 },
|
|
@@ -14363,6 +14724,7 @@ var init_swarm_config_guard = __esm(() => {
|
|
|
14363
14724
|
DB_RETENTION_MAX_STATEMENT_MS: { min: 25, max: 5000 }
|
|
14364
14725
|
};
|
|
14365
14726
|
APPS_JSON_COLUMN_MAX_BYTES_BOUNDS = { min: 1024, max: 16777216 };
|
|
14727
|
+
APPS_DEFINITION_LIMIT_BOUNDS = { min: 1, max: 1000 };
|
|
14366
14728
|
CODEX_OAUTH_KEEP_WARM_MAX_AGE_HOURS_BOUNDS = { min: 1, max: 216 };
|
|
14367
14729
|
SCHEDULER_INTERVAL_MS_BOUNDS = { min: 1, max: 2147483647 };
|
|
14368
14730
|
SYSTEM_ONE_DEFAULT_PROVIDER_OPTIONS = [
|
|
@@ -14376,6 +14738,8 @@ var init_swarm_config_guard = __esm(() => {
|
|
|
14376
14738
|
validateControllerTokenTtlDays = boundedIntegerValidators(["RUNTIME_CONTROLLER_TOKEN_TTL_DAYS"], 1, 3650).RUNTIME_CONTROLLER_TOKEN_TTL_DAYS;
|
|
14377
14739
|
validateControllerGraceSec = boundedIntegerValidators(["RUNTIME_CONTROLLER_GRACE_SEC"], 0, 86400).RUNTIME_CONTROLLER_GRACE_SEC;
|
|
14378
14740
|
VALIDATED_KEYS = {
|
|
14741
|
+
SLACK_DEFAULT_TIMEZONE: (value) => isValidTimezone(value) ? null : "SLACK_DEFAULT_TIMEZONE must be a valid IANA timezone",
|
|
14742
|
+
WORKFLOW_INPUT_ENV_ALLOWLIST: validateWorkflowInputEnvAllowlist,
|
|
14379
14743
|
[UI_SPEC_SCRIPT_ACTIONS_KEY]: validateScriptActionAllowlist,
|
|
14380
14744
|
...booleanValidators(["RUNTIME_POOLS_ENABLED", "DOCKER_HARDENED"]),
|
|
14381
14745
|
DOCKER_RUNTIME: validateDockerRuntime,
|
|
@@ -14474,13 +14838,9 @@ var init_swarm_config_guard = __esm(() => {
|
|
|
14474
14838
|
...enumValidator("MODEL_WINDOW_EXHAUSTED_POLICY", ["fail", "fallback"]),
|
|
14475
14839
|
...enumValidator("CREDENTIAL_SELECTION_STRATEGY", [...CREDENTIAL_SELECTION_STRATEGIES]),
|
|
14476
14840
|
...enumValidator("HEARTBEAT_CHECKLIST_GATE_MODE", ["shadow", "enforce"]),
|
|
14477
|
-
...enumValidator("FOLLOW_UP_GATE_MODE", ["off", "shadow"]),
|
|
14478
|
-
FOLLOW_UP_GATE_SCHEDULE_IDS
|
|
14479
|
-
|
|
14480
|
-
if (typeof value !== "string")
|
|
14481
|
-
return message;
|
|
14482
|
-
return parseFollowUpGateScheduleIds(value).every(isFollowUpGateScheduleId) ? null : message;
|
|
14483
|
-
},
|
|
14841
|
+
...enumValidator("FOLLOW_UP_GATE_MODE", ["off", "shadow", "enforce"]),
|
|
14842
|
+
...scheduleIdsValidator("FOLLOW_UP_GATE_SCHEDULE_IDS"),
|
|
14843
|
+
...scheduleIdsValidator("FOLLOW_UP_GATE_ENFORCE_SCHEDULE_IDS"),
|
|
14484
14844
|
...enumValidator("SYSTEM_ONE_DEFAULT_PROVIDER", [...SYSTEM_ONE_DEFAULT_PROVIDER_OPTIONS]),
|
|
14485
14845
|
...enumValidator("SYSTEM_ONE_EXTRACT_DEFAULT_PROVIDER", [
|
|
14486
14846
|
...SYSTEM_ONE_EXTRACT_DEFAULT_PROVIDER_OPTIONS
|
|
@@ -14542,6 +14902,7 @@ var init_swarm_config_guard = __esm(() => {
|
|
|
14542
14902
|
"CHAT_SDK_ENABLED",
|
|
14543
14903
|
"SLACK_RENDER_V2",
|
|
14544
14904
|
"SLACK_RENDER_V2_TASK_TREE_ENABLED",
|
|
14905
|
+
"SLACK_REPLY_FOOTER_ENABLED",
|
|
14545
14906
|
"SLACK_RENDER_V2_DELEGATION",
|
|
14546
14907
|
"SLACK_BLOCK_EXTERNAL_CHANNELS",
|
|
14547
14908
|
"GITHUB_DISABLE",
|
|
@@ -14622,6 +14983,7 @@ var init_swarm_config_guard = __esm(() => {
|
|
|
14622
14983
|
], 1),
|
|
14623
14984
|
...boundedIntegerValidatorsFor(DB_RETENTION_TUNING_BOUNDS),
|
|
14624
14985
|
...boundedIntegerValidators(["APPS_JSON_COLUMN_MAX_BYTES"], APPS_JSON_COLUMN_MAX_BYTES_BOUNDS.min, APPS_JSON_COLUMN_MAX_BYTES_BOUNDS.max),
|
|
14986
|
+
...boundedIntegerValidators(["APPS_MAX_MODELS", "APPS_MAX_COLUMNS_PER_MODEL", "APPS_MAX_ACTIONS"], APPS_DEFINITION_LIMIT_BOUNDS.min, APPS_DEFINITION_LIMIT_BOUNDS.max),
|
|
14625
14987
|
...boundedIntegerValidators(["SCHEDULER_INTERVAL_MS"], SCHEDULER_INTERVAL_MS_BOUNDS.min, SCHEDULER_INTERVAL_MS_BOUNDS.max),
|
|
14626
14988
|
...enumValidator("WORKTREE_REAPER_MODE", ["off", "dry-run", "on"]),
|
|
14627
14989
|
...boundedIntegerValidators(["WORKTREE_TTL_HOURS"], 1, 2160),
|
|
@@ -15471,7 +15833,7 @@ var sleep2 = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
|
15471
15833
|
var init_sleep = () => {};
|
|
15472
15834
|
|
|
15473
15835
|
// node_modules/openai/version.mjs
|
|
15474
|
-
var VERSION = "6.
|
|
15836
|
+
var VERSION = "6.49.0";
|
|
15475
15837
|
var init_version = () => {};
|
|
15476
15838
|
|
|
15477
15839
|
// node_modules/openai/internal/detect-platform.mjs
|
|
@@ -16159,7 +16521,7 @@ var levelNumbers, parseLogLevel = (maybeLevel, sourceName, client) => {
|
|
|
16159
16521
|
if (details.headers) {
|
|
16160
16522
|
details.headers = Object.fromEntries((details.headers instanceof Headers ? [...details.headers] : Object.entries(details.headers)).map(([name, value]) => [
|
|
16161
16523
|
name,
|
|
16162
|
-
name.toLowerCase() === "authorization" || name.toLowerCase() === "api-key" || name.toLowerCase() === "x-api-key" || name.toLowerCase() === "cookie" || name.toLowerCase() === "set-cookie" ? "***" : value
|
|
16524
|
+
name.toLowerCase() === "authorization" || name.toLowerCase() === "api-key" || name.toLowerCase() === "x-api-key" || name.toLowerCase() === "x-amz-security-token" || name.toLowerCase() === "cookie" || name.toLowerCase() === "set-cookie" ? "***" : value
|
|
16163
16525
|
]));
|
|
16164
16526
|
}
|
|
16165
16527
|
if ("retryOfRequestLogID" in details) {
|
|
@@ -16361,14 +16723,45 @@ var init_streaming = __esm(() => {
|
|
|
16361
16723
|
let consumed = false;
|
|
16362
16724
|
async function* iterLines() {
|
|
16363
16725
|
const lineDecoder = new LineDecoder;
|
|
16364
|
-
const
|
|
16365
|
-
|
|
16366
|
-
|
|
16726
|
+
const reader = readableStream.getReader();
|
|
16727
|
+
let closed = false;
|
|
16728
|
+
let cancelPromise;
|
|
16729
|
+
const cancel = () => {
|
|
16730
|
+
cancelPromise ?? (cancelPromise = reader.cancel());
|
|
16731
|
+
cancelPromise.catch(() => {});
|
|
16732
|
+
};
|
|
16733
|
+
controller.signal.addEventListener("abort", cancel, { once: true });
|
|
16734
|
+
try {
|
|
16735
|
+
if (controller.signal.aborted) {
|
|
16736
|
+
cancel();
|
|
16737
|
+
return;
|
|
16738
|
+
}
|
|
16739
|
+
while (true) {
|
|
16740
|
+
const { value: chunk, done } = await reader.read();
|
|
16741
|
+
if (done) {
|
|
16742
|
+
closed = true;
|
|
16743
|
+
break;
|
|
16744
|
+
}
|
|
16745
|
+
if (controller.signal.aborted)
|
|
16746
|
+
return;
|
|
16747
|
+
for (const line of lineDecoder.decode(chunk)) {
|
|
16748
|
+
if (controller.signal.aborted)
|
|
16749
|
+
return;
|
|
16750
|
+
yield line;
|
|
16751
|
+
}
|
|
16752
|
+
}
|
|
16753
|
+
if (controller.signal.aborted)
|
|
16754
|
+
return;
|
|
16755
|
+
for (const line of lineDecoder.flush()) {
|
|
16756
|
+
if (controller.signal.aborted)
|
|
16757
|
+
return;
|
|
16367
16758
|
yield line;
|
|
16368
16759
|
}
|
|
16369
|
-
}
|
|
16370
|
-
|
|
16371
|
-
|
|
16760
|
+
} finally {
|
|
16761
|
+
controller.signal.removeEventListener("abort", cancel);
|
|
16762
|
+
if (!closed)
|
|
16763
|
+
cancel();
|
|
16764
|
+
reader.releaseLock();
|
|
16372
16765
|
}
|
|
16373
16766
|
}
|
|
16374
16767
|
async function* iterator() {
|
|
@@ -16386,7 +16779,7 @@ var init_streaming = __esm(() => {
|
|
|
16386
16779
|
}
|
|
16387
16780
|
done = true;
|
|
16388
16781
|
} catch (e) {
|
|
16389
|
-
if (isAbortError(e))
|
|
16782
|
+
if (controller.signal.aborted || isAbortError(e))
|
|
16390
16783
|
return;
|
|
16391
16784
|
throw e;
|
|
16392
16785
|
} finally {
|
|
@@ -16766,13 +17159,17 @@ class WorkloadIdentityAuth {
|
|
|
16766
17159
|
throw APIError.generate(response.status, body, `Token exchange failed with status ${response.status}`, response.headers);
|
|
16767
17160
|
}
|
|
16768
17161
|
const tokenResponse = await response.json();
|
|
16769
|
-
|
|
17162
|
+
if (typeof tokenResponse !== "object" || tokenResponse === null || !("access_token" in tokenResponse) || typeof tokenResponse.access_token !== "string" || tokenResponse.access_token.trim().length === 0) {
|
|
17163
|
+
throw new OpenAIError("Token exchange response missing 'access_token' field");
|
|
17164
|
+
}
|
|
17165
|
+
const accessToken = tokenResponse.access_token;
|
|
17166
|
+
const expiresIn = tokenResponse.expires_in ?? 3600;
|
|
16770
17167
|
const expiresAt = Date.now() + expiresIn * 1000;
|
|
16771
17168
|
this.cachedToken = {
|
|
16772
|
-
token:
|
|
17169
|
+
token: accessToken,
|
|
16773
17170
|
expiresAt
|
|
16774
17171
|
};
|
|
16775
|
-
return
|
|
17172
|
+
return accessToken;
|
|
16776
17173
|
}
|
|
16777
17174
|
isTokenExpired(cachedToken) {
|
|
16778
17175
|
return Date.now() >= cachedToken.expiresAt;
|
|
@@ -16797,7 +17194,88 @@ var init_workload_identity_auth = __esm(() => {
|
|
|
16797
17194
|
};
|
|
16798
17195
|
});
|
|
16799
17196
|
|
|
17197
|
+
// node_modules/openai/internal/headers.mjs
|
|
17198
|
+
function* iterateHeaders(headers) {
|
|
17199
|
+
if (!headers)
|
|
17200
|
+
return;
|
|
17201
|
+
if (brand_privateNullableHeaders in headers) {
|
|
17202
|
+
const { values, nulls } = headers;
|
|
17203
|
+
yield* values.entries();
|
|
17204
|
+
for (const name of nulls) {
|
|
17205
|
+
yield [name, null];
|
|
17206
|
+
}
|
|
17207
|
+
return;
|
|
17208
|
+
}
|
|
17209
|
+
let shouldClear = false;
|
|
17210
|
+
let iter;
|
|
17211
|
+
if (headers instanceof Headers) {
|
|
17212
|
+
iter = headers.entries();
|
|
17213
|
+
} else if (isReadonlyArray(headers)) {
|
|
17214
|
+
iter = headers;
|
|
17215
|
+
} else {
|
|
17216
|
+
shouldClear = true;
|
|
17217
|
+
iter = Object.entries(headers ?? {});
|
|
17218
|
+
}
|
|
17219
|
+
for (let row of iter) {
|
|
17220
|
+
const name = row[0];
|
|
17221
|
+
if (typeof name !== "string")
|
|
17222
|
+
throw new TypeError("expected header name to be a string");
|
|
17223
|
+
const values = isReadonlyArray(row[1]) ? row[1] : [row[1]];
|
|
17224
|
+
let didClear = false;
|
|
17225
|
+
for (const value of values) {
|
|
17226
|
+
if (value === undefined)
|
|
17227
|
+
continue;
|
|
17228
|
+
if (shouldClear && !didClear) {
|
|
17229
|
+
didClear = true;
|
|
17230
|
+
yield [name, null];
|
|
17231
|
+
}
|
|
17232
|
+
yield [name, value];
|
|
17233
|
+
}
|
|
17234
|
+
}
|
|
17235
|
+
}
|
|
17236
|
+
var brand_privateNullableHeaders, httpTokenHeaderName, buildHeaders = (newHeaders) => {
|
|
17237
|
+
const targetHeaders = new Headers;
|
|
17238
|
+
const nullHeaders = new Set;
|
|
17239
|
+
for (const headers of newHeaders) {
|
|
17240
|
+
const seenHeaders = new Set;
|
|
17241
|
+
for (const [name, value] of iterateHeaders(headers)) {
|
|
17242
|
+
if (!httpTokenHeaderName.test(name)) {
|
|
17243
|
+
throw new TypeError(`Header name must be a valid HTTP token ["${name}"]`);
|
|
17244
|
+
}
|
|
17245
|
+
const lowerName = name.toLowerCase();
|
|
17246
|
+
if (!seenHeaders.has(lowerName)) {
|
|
17247
|
+
targetHeaders.delete(lowerName);
|
|
17248
|
+
seenHeaders.add(lowerName);
|
|
17249
|
+
}
|
|
17250
|
+
if (value === null) {
|
|
17251
|
+
targetHeaders.delete(lowerName);
|
|
17252
|
+
nullHeaders.add(lowerName);
|
|
17253
|
+
} else {
|
|
17254
|
+
targetHeaders.append(lowerName, value);
|
|
17255
|
+
nullHeaders.delete(lowerName);
|
|
17256
|
+
}
|
|
17257
|
+
}
|
|
17258
|
+
}
|
|
17259
|
+
return { [brand_privateNullableHeaders]: true, values: targetHeaders, nulls: nullHeaders };
|
|
17260
|
+
};
|
|
17261
|
+
var init_headers = __esm(() => {
|
|
17262
|
+
init_values();
|
|
17263
|
+
brand_privateNullableHeaders = /* @__PURE__ */ Symbol("brand.privateNullableHeaders");
|
|
17264
|
+
httpTokenHeaderName = /^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/;
|
|
17265
|
+
});
|
|
17266
|
+
|
|
16800
17267
|
// node_modules/openai/internal/uploads.mjs
|
|
17268
|
+
function toStreamingFile(data, name, options) {
|
|
17269
|
+
if (!name) {
|
|
17270
|
+
throw new TypeError("toStreamingFile requires a non-empty file name");
|
|
17271
|
+
}
|
|
17272
|
+
return {
|
|
17273
|
+
[brand_privateStreamingFile]: true,
|
|
17274
|
+
data,
|
|
17275
|
+
name,
|
|
17276
|
+
...options?.type ? { type: options.type } : {}
|
|
17277
|
+
};
|
|
17278
|
+
}
|
|
16801
17279
|
function makeFile(fileBits, fileName, options) {
|
|
16802
17280
|
checkFileSupport();
|
|
16803
17281
|
return new File(fileBits, fileName ?? "unknown_file", options);
|
|
@@ -16825,7 +17303,108 @@ function supportsFormData(fetchObject) {
|
|
|
16825
17303
|
supportsFormDataMap.set(fetch2, promise);
|
|
16826
17304
|
return promise;
|
|
16827
17305
|
}
|
|
16828
|
-
|
|
17306
|
+
async function* iterateMultipartBody(body, boundary) {
|
|
17307
|
+
for await (const { key, value } of iterateFormEntries(body)) {
|
|
17308
|
+
yield encodeUTF8(`--${boundary}\r
|
|
17309
|
+
`);
|
|
17310
|
+
if (isUploadable(value)) {
|
|
17311
|
+
const filename = getStreamingFileName(value);
|
|
17312
|
+
const type = getStreamingFileType(value);
|
|
17313
|
+
yield encodeUTF8(`Content-Disposition: form-data; name="${escapeHeaderValue(key)}"; filename="${escapeHeaderValue(filename)}"\r
|
|
17314
|
+
` + `Content-Type: ${type}\r
|
|
17315
|
+
\r
|
|
17316
|
+
`);
|
|
17317
|
+
yield* iterateBytes(getStreamingFileData(value));
|
|
17318
|
+
} else {
|
|
17319
|
+
yield encodeUTF8(`Content-Disposition: form-data; name="${escapeHeaderValue(key)}"\r
|
|
17320
|
+
\r
|
|
17321
|
+
${String(value)}`);
|
|
17322
|
+
}
|
|
17323
|
+
yield encodeUTF8(`\r
|
|
17324
|
+
`);
|
|
17325
|
+
}
|
|
17326
|
+
yield encodeUTF8(`--${boundary}--\r
|
|
17327
|
+
`);
|
|
17328
|
+
}
|
|
17329
|
+
async function* iterateFormEntries(body) {
|
|
17330
|
+
if (!body || typeof body !== "object")
|
|
17331
|
+
return;
|
|
17332
|
+
for (const [key, value] of Object.entries(body)) {
|
|
17333
|
+
yield* iterateFormValue(key, value);
|
|
17334
|
+
}
|
|
17335
|
+
}
|
|
17336
|
+
async function* iterateFormValue(key, value) {
|
|
17337
|
+
if (value === undefined)
|
|
17338
|
+
return;
|
|
17339
|
+
if (value == null) {
|
|
17340
|
+
throw new TypeError(`Received null for "${key}"; to pass null in FormData, you must use the string 'null'`);
|
|
17341
|
+
}
|
|
17342
|
+
if (typeof value === "string" || typeof value === "number" || typeof value === "boolean" || isUploadable(value)) {
|
|
17343
|
+
yield { key, value };
|
|
17344
|
+
} else if (Array.isArray(value)) {
|
|
17345
|
+
for (const entry of value) {
|
|
17346
|
+
yield* iterateFormValue(key + "[]", entry);
|
|
17347
|
+
}
|
|
17348
|
+
} else if (typeof value === "object") {
|
|
17349
|
+
for (const [name, prop] of Object.entries(value)) {
|
|
17350
|
+
yield* iterateFormValue(`${key}[${name}]`, prop);
|
|
17351
|
+
}
|
|
17352
|
+
} else {
|
|
17353
|
+
throw new TypeError(`Invalid value given to form, expected a string, number, boolean, object, Array, File or Blob but got ${value} instead`);
|
|
17354
|
+
}
|
|
17355
|
+
}
|
|
17356
|
+
function getStreamingFileName(value) {
|
|
17357
|
+
return isStreamingFile(value) ? value.name : getName(value) ?? "unknown_file";
|
|
17358
|
+
}
|
|
17359
|
+
function getStreamingFileType(value) {
|
|
17360
|
+
if (isStreamingFile(value))
|
|
17361
|
+
return value.type || "application/octet-stream";
|
|
17362
|
+
if (isNamedBlob(value) && value.type)
|
|
17363
|
+
return value.type;
|
|
17364
|
+
if (value instanceof Response)
|
|
17365
|
+
return value.headers.get("content-type") || "application/octet-stream";
|
|
17366
|
+
return "application/octet-stream";
|
|
17367
|
+
}
|
|
17368
|
+
function getStreamingFileData(value) {
|
|
17369
|
+
if (isStreamingFile(value))
|
|
17370
|
+
return value.data;
|
|
17371
|
+
return value;
|
|
17372
|
+
}
|
|
17373
|
+
async function* iterateBytes(value) {
|
|
17374
|
+
if (typeof value === "string") {
|
|
17375
|
+
yield encodeUTF8(value);
|
|
17376
|
+
} else if (ArrayBuffer.isView(value)) {
|
|
17377
|
+
yield new Uint8Array(value.buffer, value.byteOffset, value.byteLength);
|
|
17378
|
+
} else if (value instanceof ArrayBuffer) {
|
|
17379
|
+
yield new Uint8Array(value);
|
|
17380
|
+
} else if (value instanceof Response) {
|
|
17381
|
+
if (value.body) {
|
|
17382
|
+
yield* iterateBytes(value.body);
|
|
17383
|
+
} else {
|
|
17384
|
+
yield* iterateBytes(await value.blob());
|
|
17385
|
+
}
|
|
17386
|
+
} else if (value instanceof Blob) {
|
|
17387
|
+
if (typeof value.stream === "function") {
|
|
17388
|
+
yield* iterateBytes(value.stream());
|
|
17389
|
+
} else {
|
|
17390
|
+
yield new Uint8Array(await value.arrayBuffer());
|
|
17391
|
+
}
|
|
17392
|
+
} else if (isReadableStream(value)) {
|
|
17393
|
+
for await (const chunk of ReadableStreamToAsyncIterable(value)) {
|
|
17394
|
+
yield* iterateBytes(chunk);
|
|
17395
|
+
}
|
|
17396
|
+
} else if (isAsyncIterable(value)) {
|
|
17397
|
+
for await (const chunk of value) {
|
|
17398
|
+
yield* iterateBytes(chunk);
|
|
17399
|
+
}
|
|
17400
|
+
} else {
|
|
17401
|
+
throw new TypeError(`Invalid streaming file chunk: ${String(value)}`);
|
|
17402
|
+
}
|
|
17403
|
+
}
|
|
17404
|
+
function escapeHeaderValue(value) {
|
|
17405
|
+
return value.replace(/["\\\r\n]/g, (character) => encodeURIComponent(character));
|
|
17406
|
+
}
|
|
17407
|
+
var brand_privateStreamingFile, checkFileSupport = () => {
|
|
16829
17408
|
if (typeof File === "undefined") {
|
|
16830
17409
|
const { process: process2 } = globalThis;
|
|
16831
17410
|
const isOldNode = typeof process2?.versions?.node === "string" && parseInt(process2.versions.node.split(".")) < 20;
|
|
@@ -16834,8 +17413,14 @@ var checkFileSupport = () => {
|
|
|
16834
17413
|
}, isAsyncIterable = (value) => value != null && typeof value === "object" && typeof value[Symbol.asyncIterator] === "function", maybeMultipartFormRequestOptions = async (opts, fetch2) => {
|
|
16835
17414
|
if (!hasUploadableValue(opts.body))
|
|
16836
17415
|
return opts;
|
|
17416
|
+
if (hasStreamingUploadableValue(opts.body)) {
|
|
17417
|
+
return createStreamingFormRequestOptions(opts);
|
|
17418
|
+
}
|
|
16837
17419
|
return { ...opts, body: await createForm(opts.body, fetch2) };
|
|
16838
17420
|
}, multipartFormRequestOptions = async (opts, fetch2) => {
|
|
17421
|
+
if (hasStreamingUploadableValue(opts.body)) {
|
|
17422
|
+
return createStreamingFormRequestOptions(opts);
|
|
17423
|
+
}
|
|
16839
17424
|
return { ...opts, body: await createForm(opts.body, fetch2) };
|
|
16840
17425
|
}, supportsFormDataMap, createForm = async (body, fetch2) => {
|
|
16841
17426
|
if (!await supportsFormData(fetch2)) {
|
|
@@ -16844,7 +17429,19 @@ var checkFileSupport = () => {
|
|
|
16844
17429
|
const form = new FormData;
|
|
16845
17430
|
await Promise.all(Object.entries(body || {}).map(([key, value]) => addFormValue(form, key, value)));
|
|
16846
17431
|
return form;
|
|
16847
|
-
}, isNamedBlob = (value) => value instanceof Blob && ("name" in value), isUploadable = (value) => typeof value === "object" && value !== null && (value instanceof Response || isAsyncIterable(value) || isNamedBlob(value)),
|
|
17432
|
+
}, isNamedBlob = (value) => value instanceof Blob && ("name" in value), isReadableStream = (value) => typeof value === "object" && value !== null && ("getReader" in value) && typeof value.getReader === "function", isStreamingFile = (value) => typeof value === "object" && value !== null && (brand_privateStreamingFile in value), isUploadable = (value) => typeof value === "object" && value !== null && (value instanceof Response || isAsyncIterable(value) || isReadableStream(value) || isStreamingFile(value) || isNamedBlob(value)), hasStreamingUploadableValue = (value) => {
|
|
17433
|
+
if (isStreamingFile(value) || isAsyncIterable(value) || isReadableStream(value))
|
|
17434
|
+
return true;
|
|
17435
|
+
if (Array.isArray(value))
|
|
17436
|
+
return value.some(hasStreamingUploadableValue);
|
|
17437
|
+
if (value && typeof value === "object" && !isNamedBlob(value) && !(value instanceof Response)) {
|
|
17438
|
+
for (const k in value) {
|
|
17439
|
+
if (hasStreamingUploadableValue(value[k]))
|
|
17440
|
+
return true;
|
|
17441
|
+
}
|
|
17442
|
+
}
|
|
17443
|
+
return false;
|
|
17444
|
+
}, hasUploadableValue = (value) => {
|
|
16848
17445
|
if (isUploadable(value))
|
|
16849
17446
|
return true;
|
|
16850
17447
|
if (Array.isArray(value))
|
|
@@ -16856,6 +17453,14 @@ var checkFileSupport = () => {
|
|
|
16856
17453
|
}
|
|
16857
17454
|
}
|
|
16858
17455
|
return false;
|
|
17456
|
+
}, createStreamingFormRequestOptions = (opts) => {
|
|
17457
|
+
const boundary = `openai-${Math.random().toString(36).slice(2)}`;
|
|
17458
|
+
const body = ReadableStreamFrom(iterateMultipartBody(opts.body, boundary));
|
|
17459
|
+
return {
|
|
17460
|
+
...opts,
|
|
17461
|
+
body,
|
|
17462
|
+
headers: buildHeaders([{ "content-type": `multipart/form-data; boundary=${boundary}` }, opts.headers])
|
|
17463
|
+
};
|
|
16859
17464
|
}, addFormValue = async (form, key, value) => {
|
|
16860
17465
|
if (value === undefined)
|
|
16861
17466
|
return;
|
|
@@ -16879,7 +17484,10 @@ var checkFileSupport = () => {
|
|
|
16879
17484
|
}
|
|
16880
17485
|
};
|
|
16881
17486
|
var init_uploads = __esm(() => {
|
|
17487
|
+
init_headers();
|
|
16882
17488
|
init_shims();
|
|
17489
|
+
init_bytes();
|
|
17490
|
+
brand_privateStreamingFile = /* @__PURE__ */ Symbol("brand.privateStreamingFile");
|
|
16883
17491
|
supportsFormDataMap = /* @__PURE__ */ new WeakMap;
|
|
16884
17492
|
});
|
|
16885
17493
|
|
|
@@ -16938,6 +17546,7 @@ var init_to_file = __esm(() => {
|
|
|
16938
17546
|
|
|
16939
17547
|
// node_modules/openai/core/uploads.mjs
|
|
16940
17548
|
var init_uploads2 = __esm(() => {
|
|
17549
|
+
init_uploads();
|
|
16941
17550
|
init_to_file();
|
|
16942
17551
|
});
|
|
16943
17552
|
|
|
@@ -17155,6 +17764,7 @@ class EventStream {
|
|
|
17155
17764
|
_EventStream_resolveEndPromise.set(this, () => {});
|
|
17156
17765
|
_EventStream_rejectEndPromise.set(this, () => {});
|
|
17157
17766
|
_EventStream_listeners.set(this, {});
|
|
17767
|
+
_EventStream_abortListeners.set(this, []);
|
|
17158
17768
|
_EventStream_ended.set(this, false);
|
|
17159
17769
|
_EventStream_errored.set(this, false);
|
|
17160
17770
|
_EventStream_aborted.set(this, false);
|
|
@@ -17172,8 +17782,13 @@ class EventStream {
|
|
|
17172
17782
|
}
|
|
17173
17783
|
_run(executor) {
|
|
17174
17784
|
setTimeout(() => {
|
|
17175
|
-
|
|
17176
|
-
|
|
17785
|
+
Promise.resolve().then(executor).then(() => {
|
|
17786
|
+
try {
|
|
17787
|
+
this._emitFinal();
|
|
17788
|
+
} catch (error) {
|
|
17789
|
+
__classPrivateFieldGet(this, _EventStream_instances, "m", _EventStream_handleError).call(this, error);
|
|
17790
|
+
return;
|
|
17791
|
+
}
|
|
17177
17792
|
this._emit("end");
|
|
17178
17793
|
}, __classPrivateFieldGet(this, _EventStream_instances, "m", _EventStream_handleError).bind(this));
|
|
17179
17794
|
}, 0);
|
|
@@ -17196,6 +17811,17 @@ class EventStream {
|
|
|
17196
17811
|
abort() {
|
|
17197
17812
|
this.controller.abort();
|
|
17198
17813
|
}
|
|
17814
|
+
_listenForAbort(signal) {
|
|
17815
|
+
if (!signal || this.ended)
|
|
17816
|
+
return;
|
|
17817
|
+
if (signal.aborted) {
|
|
17818
|
+
this.controller.abort();
|
|
17819
|
+
return;
|
|
17820
|
+
}
|
|
17821
|
+
const listener = () => this.controller.abort();
|
|
17822
|
+
signal.addEventListener("abort", listener, { once: true });
|
|
17823
|
+
__classPrivateFieldGet(this, _EventStream_abortListeners, "f").push({ signal, listener });
|
|
17824
|
+
}
|
|
17199
17825
|
on(event, listener) {
|
|
17200
17826
|
const listeners = __classPrivateFieldGet(this, _EventStream_listeners, "f")[event] || (__classPrivateFieldGet(this, _EventStream_listeners, "f")[event] = []);
|
|
17201
17827
|
listeners.push({ listener });
|
|
@@ -17223,6 +17849,90 @@ class EventStream {
|
|
|
17223
17849
|
this.once(event, resolve);
|
|
17224
17850
|
});
|
|
17225
17851
|
}
|
|
17852
|
+
events(event) {
|
|
17853
|
+
const pushQueue = [];
|
|
17854
|
+
const readQueue = [];
|
|
17855
|
+
let ended = this.ended;
|
|
17856
|
+
let failure;
|
|
17857
|
+
let failureDelivered = false;
|
|
17858
|
+
const doneResult = () => ({ value: undefined, done: true });
|
|
17859
|
+
const finishReaders = () => {
|
|
17860
|
+
while (readQueue.length) {
|
|
17861
|
+
readQueue.shift().resolve(doneResult());
|
|
17862
|
+
}
|
|
17863
|
+
};
|
|
17864
|
+
const rejectReader = () => {
|
|
17865
|
+
if (!failure || failureDelivered || !readQueue.length)
|
|
17866
|
+
return;
|
|
17867
|
+
failureDelivered = true;
|
|
17868
|
+
readQueue.shift().reject(failure);
|
|
17869
|
+
};
|
|
17870
|
+
const cleanup = () => {
|
|
17871
|
+
this.off(event, onEvent);
|
|
17872
|
+
this.off("end", onEnd);
|
|
17873
|
+
if (event !== "error")
|
|
17874
|
+
this.off("error", onFailure);
|
|
17875
|
+
if (event !== "abort")
|
|
17876
|
+
this.off("abort", onFailure);
|
|
17877
|
+
};
|
|
17878
|
+
const onEvent = (...args) => {
|
|
17879
|
+
if (ended)
|
|
17880
|
+
return;
|
|
17881
|
+
const reader = readQueue.shift();
|
|
17882
|
+
if (reader) {
|
|
17883
|
+
reader.resolve({ value: args, done: false });
|
|
17884
|
+
} else {
|
|
17885
|
+
pushQueue.push(args);
|
|
17886
|
+
}
|
|
17887
|
+
};
|
|
17888
|
+
const onFailure = (error) => {
|
|
17889
|
+
failure = error;
|
|
17890
|
+
if (!pushQueue.length)
|
|
17891
|
+
rejectReader();
|
|
17892
|
+
};
|
|
17893
|
+
const onEnd = () => {
|
|
17894
|
+
ended = true;
|
|
17895
|
+
cleanup();
|
|
17896
|
+
if (!pushQueue.length) {
|
|
17897
|
+
rejectReader();
|
|
17898
|
+
finishReaders();
|
|
17899
|
+
}
|
|
17900
|
+
};
|
|
17901
|
+
if (!ended) {
|
|
17902
|
+
this.on(event, onEvent);
|
|
17903
|
+
this.on("end", onEnd);
|
|
17904
|
+
if (event !== "error")
|
|
17905
|
+
this.on("error", onFailure);
|
|
17906
|
+
if (event !== "abort")
|
|
17907
|
+
this.on("abort", onFailure);
|
|
17908
|
+
}
|
|
17909
|
+
return {
|
|
17910
|
+
next: () => {
|
|
17911
|
+
const value = pushQueue.shift();
|
|
17912
|
+
if (value)
|
|
17913
|
+
return Promise.resolve({ value, done: false });
|
|
17914
|
+
if (failure && !failureDelivered) {
|
|
17915
|
+
failureDelivered = true;
|
|
17916
|
+
return Promise.reject(failure);
|
|
17917
|
+
}
|
|
17918
|
+
if (ended)
|
|
17919
|
+
return Promise.resolve(doneResult());
|
|
17920
|
+
return new Promise((resolve, reject) => {
|
|
17921
|
+
readQueue.push({ resolve, reject });
|
|
17922
|
+
});
|
|
17923
|
+
},
|
|
17924
|
+
return: () => {
|
|
17925
|
+
ended = true;
|
|
17926
|
+
pushQueue.length = 0;
|
|
17927
|
+
cleanup();
|
|
17928
|
+
finishReaders();
|
|
17929
|
+
return Promise.resolve(doneResult());
|
|
17930
|
+
},
|
|
17931
|
+
[Symbol.asyncIterator]() {
|
|
17932
|
+
return this;
|
|
17933
|
+
}
|
|
17934
|
+
};
|
|
17935
|
+
}
|
|
17226
17936
|
async done() {
|
|
17227
17937
|
__classPrivateFieldSet(this, _EventStream_catchingPromiseCreated, true, "f");
|
|
17228
17938
|
await __classPrivateFieldGet(this, _EventStream_endPromise, "f");
|
|
@@ -17232,6 +17942,7 @@ class EventStream {
|
|
|
17232
17942
|
return;
|
|
17233
17943
|
}
|
|
17234
17944
|
if (event === "end") {
|
|
17945
|
+
__classPrivateFieldGet(this, _EventStream_instances, "m", _EventStream_removeAbortListeners).call(this);
|
|
17235
17946
|
__classPrivateFieldSet(this, _EventStream_ended, true, "f");
|
|
17236
17947
|
__classPrivateFieldGet(this, _EventStream_resolveEndPromise, "f").call(this);
|
|
17237
17948
|
}
|
|
@@ -17262,11 +17973,15 @@ class EventStream {
|
|
|
17262
17973
|
}
|
|
17263
17974
|
_emitFinal() {}
|
|
17264
17975
|
}
|
|
17265
|
-
var _EventStream_instances, _EventStream_connectedPromise, _EventStream_resolveConnectedPromise, _EventStream_rejectConnectedPromise, _EventStream_endPromise, _EventStream_resolveEndPromise, _EventStream_rejectEndPromise, _EventStream_listeners, _EventStream_ended, _EventStream_errored, _EventStream_aborted, _EventStream_catchingPromiseCreated, _EventStream_handleError;
|
|
17976
|
+
var _EventStream_instances, _EventStream_connectedPromise, _EventStream_resolveConnectedPromise, _EventStream_rejectConnectedPromise, _EventStream_endPromise, _EventStream_resolveEndPromise, _EventStream_rejectEndPromise, _EventStream_listeners, _EventStream_abortListeners, _EventStream_ended, _EventStream_errored, _EventStream_aborted, _EventStream_catchingPromiseCreated, _EventStream_removeAbortListeners, _EventStream_handleError;
|
|
17266
17977
|
var init_EventStream = __esm(() => {
|
|
17267
17978
|
init_tslib();
|
|
17268
17979
|
init_error2();
|
|
17269
|
-
_EventStream_connectedPromise = new WeakMap, _EventStream_resolveConnectedPromise = new WeakMap, _EventStream_rejectConnectedPromise = new WeakMap, _EventStream_endPromise = new WeakMap, _EventStream_resolveEndPromise = new WeakMap, _EventStream_rejectEndPromise = new WeakMap, _EventStream_listeners = new WeakMap, _EventStream_ended = new WeakMap, _EventStream_errored = new WeakMap, _EventStream_aborted = new WeakMap, _EventStream_catchingPromiseCreated = new WeakMap, _EventStream_instances = new WeakSet,
|
|
17980
|
+
_EventStream_connectedPromise = new WeakMap, _EventStream_resolveConnectedPromise = new WeakMap, _EventStream_rejectConnectedPromise = new WeakMap, _EventStream_endPromise = new WeakMap, _EventStream_resolveEndPromise = new WeakMap, _EventStream_rejectEndPromise = new WeakMap, _EventStream_listeners = new WeakMap, _EventStream_abortListeners = new WeakMap, _EventStream_ended = new WeakMap, _EventStream_errored = new WeakMap, _EventStream_aborted = new WeakMap, _EventStream_catchingPromiseCreated = new WeakMap, _EventStream_instances = new WeakSet, _EventStream_removeAbortListeners = function _EventStream_removeAbortListeners() {
|
|
17981
|
+
for (const { signal, listener } of __classPrivateFieldGet(this, _EventStream_abortListeners, "f").splice(0)) {
|
|
17982
|
+
signal.removeEventListener("abort", listener);
|
|
17983
|
+
}
|
|
17984
|
+
}, _EventStream_handleError = function _EventStream_handleError(error) {
|
|
17270
17985
|
__classPrivateFieldSet(this, _EventStream_errored, true, "f");
|
|
17271
17986
|
if (error instanceof Error && error.name === "AbortError") {
|
|
17272
17987
|
error = new APIUserAbortError;
|
|
@@ -17294,10 +18009,58 @@ function isRunnableFunctionWithParse(fn) {
|
|
|
17294
18009
|
var init_RunnableFunction = () => {};
|
|
17295
18010
|
|
|
17296
18011
|
// node_modules/openai/lib/AbstractChatCompletionRunner.mjs
|
|
18012
|
+
function normalizeToolCallIds(chatCompletion) {
|
|
18013
|
+
for (const choice of chatCompletion.choices) {
|
|
18014
|
+
for (const toolCall of choice.message.tool_calls ?? []) {
|
|
18015
|
+
if (!toolCall.id) {
|
|
18016
|
+
toolCall.id = `call_${uuid4()}`;
|
|
18017
|
+
}
|
|
18018
|
+
}
|
|
18019
|
+
}
|
|
18020
|
+
}
|
|
18021
|
+
function toRequestMessage(message) {
|
|
18022
|
+
if (!isAssistantMessage(message))
|
|
18023
|
+
return message;
|
|
18024
|
+
const requestMessage = { role: "assistant" };
|
|
18025
|
+
if (message.audio != null)
|
|
18026
|
+
requestMessage.audio = { id: message.audio.id };
|
|
18027
|
+
if (message.content !== undefined)
|
|
18028
|
+
requestMessage.content = message.content;
|
|
18029
|
+
if (message.function_call != null)
|
|
18030
|
+
requestMessage.function_call = message.function_call;
|
|
18031
|
+
if (message.name !== undefined)
|
|
18032
|
+
requestMessage.name = message.name;
|
|
18033
|
+
if (message.refusal != null)
|
|
18034
|
+
requestMessage.refusal = message.refusal;
|
|
18035
|
+
if (message.tool_calls !== undefined) {
|
|
18036
|
+
requestMessage.tool_calls = message.tool_calls.map((toolCall) => {
|
|
18037
|
+
if (toolCall.type === "custom") {
|
|
18038
|
+
return {
|
|
18039
|
+
id: toolCall.id,
|
|
18040
|
+
type: toolCall.type,
|
|
18041
|
+
custom: {
|
|
18042
|
+
input: toolCall.custom.input,
|
|
18043
|
+
name: toolCall.custom.name
|
|
18044
|
+
}
|
|
18045
|
+
};
|
|
18046
|
+
}
|
|
18047
|
+
return {
|
|
18048
|
+
id: toolCall.id,
|
|
18049
|
+
type: toolCall.type,
|
|
18050
|
+
function: {
|
|
18051
|
+
arguments: toolCall.function.arguments,
|
|
18052
|
+
name: toolCall.function.name
|
|
18053
|
+
}
|
|
18054
|
+
};
|
|
18055
|
+
});
|
|
18056
|
+
}
|
|
18057
|
+
return requestMessage;
|
|
18058
|
+
}
|
|
17297
18059
|
var _AbstractChatCompletionRunner_instances, _AbstractChatCompletionRunner_getFinalContent, _AbstractChatCompletionRunner_getFinalMessage, _AbstractChatCompletionRunner_getFinalFunctionToolCall, _AbstractChatCompletionRunner_getFinalFunctionToolCallResult, _AbstractChatCompletionRunner_calculateTotalUsage, _AbstractChatCompletionRunner_validateParams, _AbstractChatCompletionRunner_stringifyFunctionCallResult, DEFAULT_MAX_CHAT_COMPLETIONS = 10, AbstractChatCompletionRunner;
|
|
17298
18060
|
var init_AbstractChatCompletionRunner = __esm(() => {
|
|
17299
18061
|
init_tslib();
|
|
17300
18062
|
init_error2();
|
|
18063
|
+
init_uuid();
|
|
17301
18064
|
init_parser();
|
|
17302
18065
|
init_chatCompletionUtils();
|
|
17303
18066
|
init_EventStream();
|
|
@@ -17310,6 +18073,7 @@ var init_AbstractChatCompletionRunner = __esm(() => {
|
|
|
17310
18073
|
this.messages = [];
|
|
17311
18074
|
}
|
|
17312
18075
|
_addChatCompletion(chatCompletion) {
|
|
18076
|
+
normalizeToolCallIds(chatCompletion);
|
|
17313
18077
|
this._chatCompletions.push(chatCompletion);
|
|
17314
18078
|
this._emit("chatCompletion", chatCompletion);
|
|
17315
18079
|
const message = chatCompletion.choices[0]?.message;
|
|
@@ -17385,12 +18149,7 @@ var init_AbstractChatCompletionRunner = __esm(() => {
|
|
|
17385
18149
|
}
|
|
17386
18150
|
}
|
|
17387
18151
|
async _createChatCompletion(client, params, options) {
|
|
17388
|
-
|
|
17389
|
-
if (signal) {
|
|
17390
|
-
if (signal.aborted)
|
|
17391
|
-
this.controller.abort();
|
|
17392
|
-
signal.addEventListener("abort", () => this.controller.abort());
|
|
17393
|
-
}
|
|
18152
|
+
this._listenForAbort(options?.signal);
|
|
17394
18153
|
__classPrivateFieldGet(this, _AbstractChatCompletionRunner_instances, "m", _AbstractChatCompletionRunner_validateParams).call(this, params);
|
|
17395
18154
|
const chatCompletion = await client.chat.completions.create({ ...params, stream: false }, { ...options, signal: this.controller.signal });
|
|
17396
18155
|
this._connected();
|
|
@@ -17402,11 +18161,12 @@ var init_AbstractChatCompletionRunner = __esm(() => {
|
|
|
17402
18161
|
}
|
|
17403
18162
|
return await this._createChatCompletion(client, params, options);
|
|
17404
18163
|
}
|
|
17405
|
-
async _runTools(client, params, options) {
|
|
18164
|
+
async _runTools(client, params, runner, options) {
|
|
17406
18165
|
const role = "tool";
|
|
17407
|
-
const { tool_choice = "auto", stream, ...restParams } = params;
|
|
18166
|
+
const { tool_choice = "auto", stream, toolContext: inputToolContext, ...restParams } = params;
|
|
18167
|
+
const toolContext = inputToolContext;
|
|
17408
18168
|
const singleFunctionToCall = typeof tool_choice !== "string" && tool_choice.type === "function" && tool_choice?.function?.name;
|
|
17409
|
-
const { maxChatCompletions = DEFAULT_MAX_CHAT_COMPLETIONS } = options || {};
|
|
18169
|
+
const { maxChatCompletions = DEFAULT_MAX_CHAT_COMPLETIONS, afterCompletion } = options || {};
|
|
17410
18170
|
const inputTools = params.tools.map((tool) => {
|
|
17411
18171
|
if (isAutoParsableTool(tool)) {
|
|
17412
18172
|
if (!tool.$callback) {
|
|
@@ -17444,50 +18204,74 @@ var init_AbstractChatCompletionRunner = __esm(() => {
|
|
|
17444
18204
|
for (const message of params.messages) {
|
|
17445
18205
|
this._addMessage(message, false);
|
|
17446
18206
|
}
|
|
18207
|
+
const runToolCall = async (toolCall) => {
|
|
18208
|
+
if (toolCall.type !== "function")
|
|
18209
|
+
return { message: undefined, functionCalled: false };
|
|
18210
|
+
const tool_call_id = toolCall.id;
|
|
18211
|
+
const { name, arguments: args } = toolCall.function;
|
|
18212
|
+
const fn = functionsByName[name];
|
|
18213
|
+
if (!fn) {
|
|
18214
|
+
const content = `Invalid tool_call: ${JSON.stringify(name)}. Available options are: ${Object.keys(functionsByName).map((name) => JSON.stringify(name)).join(", ")}. Please try again`;
|
|
18215
|
+
return { message: { role, tool_call_id, content }, functionCalled: false };
|
|
18216
|
+
}
|
|
18217
|
+
if (singleFunctionToCall && singleFunctionToCall !== name) {
|
|
18218
|
+
const content = `Invalid tool_call: ${JSON.stringify(name)}. ${JSON.stringify(singleFunctionToCall)} requested. Please try again`;
|
|
18219
|
+
return { message: { role, tool_call_id, content }, functionCalled: false };
|
|
18220
|
+
}
|
|
18221
|
+
let rawContent;
|
|
18222
|
+
if (isRunnableFunctionWithParse(fn)) {
|
|
18223
|
+
let parsed;
|
|
18224
|
+
try {
|
|
18225
|
+
parsed = await fn.parse(args);
|
|
18226
|
+
} catch (error) {
|
|
18227
|
+
const content = error instanceof Error ? error.message : String(error);
|
|
18228
|
+
return { message: { role, tool_call_id, content }, functionCalled: false };
|
|
18229
|
+
}
|
|
18230
|
+
rawContent = await fn.function(parsed, runner, toolContext);
|
|
18231
|
+
} else {
|
|
18232
|
+
rawContent = await fn.function(args, runner, toolContext);
|
|
18233
|
+
}
|
|
18234
|
+
const content = __classPrivateFieldGet(this, _AbstractChatCompletionRunner_instances, "m", _AbstractChatCompletionRunner_stringifyFunctionCallResult).call(this, rawContent);
|
|
18235
|
+
return { message: { role, tool_call_id, content }, functionCalled: true };
|
|
18236
|
+
};
|
|
17447
18237
|
for (let i = 0;i < maxChatCompletions; ++i) {
|
|
17448
18238
|
const chatCompletion = await this._createChatCompletion(client, {
|
|
17449
18239
|
...restParams,
|
|
17450
18240
|
tool_choice,
|
|
17451
18241
|
tools,
|
|
17452
|
-
messages:
|
|
18242
|
+
messages: this.messages.map(toRequestMessage)
|
|
17453
18243
|
}, options);
|
|
17454
18244
|
const message = chatCompletion.choices[0]?.message;
|
|
17455
18245
|
if (!message) {
|
|
17456
18246
|
throw new OpenAIError(`missing message in ChatCompletion response`);
|
|
17457
18247
|
}
|
|
17458
18248
|
if (!message.tool_calls?.length) {
|
|
18249
|
+
await afterCompletion?.(chatCompletion, runner);
|
|
17459
18250
|
return;
|
|
17460
18251
|
}
|
|
17461
|
-
|
|
17462
|
-
|
|
17463
|
-
|
|
17464
|
-
|
|
17465
|
-
|
|
17466
|
-
|
|
17467
|
-
|
|
17468
|
-
|
|
17469
|
-
|
|
17470
|
-
continue;
|
|
17471
|
-
} else if (singleFunctionToCall && singleFunctionToCall !== name) {
|
|
17472
|
-
const content = `Invalid tool_call: ${JSON.stringify(name)}. ${JSON.stringify(singleFunctionToCall)} requested. Please try again`;
|
|
17473
|
-
this._addMessage({ role, tool_call_id, content });
|
|
17474
|
-
continue;
|
|
18252
|
+
if (singleFunctionToCall || params.parallel_tool_calls === false) {
|
|
18253
|
+
for (const toolCall of message.tool_calls) {
|
|
18254
|
+
const result = await runToolCall(toolCall);
|
|
18255
|
+
if (result.message)
|
|
18256
|
+
this._addMessage(result.message);
|
|
18257
|
+
if (singleFunctionToCall && result.functionCalled) {
|
|
18258
|
+
await afterCompletion?.(chatCompletion, runner);
|
|
18259
|
+
return;
|
|
18260
|
+
}
|
|
17475
18261
|
}
|
|
17476
|
-
|
|
17477
|
-
|
|
17478
|
-
|
|
17479
|
-
|
|
17480
|
-
|
|
17481
|
-
this._addMessage({ role, tool_call_id, content });
|
|
17482
|
-
continue;
|
|
18262
|
+
} else {
|
|
18263
|
+
const results = await Promise.allSettled(message.tool_calls.map(runToolCall));
|
|
18264
|
+
for (const result of results) {
|
|
18265
|
+
if (result.status === "rejected")
|
|
18266
|
+
throw result.reason;
|
|
17483
18267
|
}
|
|
17484
|
-
const
|
|
17485
|
-
|
|
17486
|
-
|
|
17487
|
-
|
|
17488
|
-
return;
|
|
18268
|
+
for (const result of results) {
|
|
18269
|
+
if (result.status === "fulfilled" && result.value.message) {
|
|
18270
|
+
this._addMessage(result.value.message);
|
|
18271
|
+
}
|
|
17489
18272
|
}
|
|
17490
18273
|
}
|
|
18274
|
+
await afterCompletion?.(chatCompletion, runner);
|
|
17491
18275
|
}
|
|
17492
18276
|
return;
|
|
17493
18277
|
}
|
|
@@ -17512,7 +18296,12 @@ var init_AbstractChatCompletionRunner = __esm(() => {
|
|
|
17512
18296
|
for (let i = this.messages.length - 1;i >= 0; i--) {
|
|
17513
18297
|
const message = this.messages[i];
|
|
17514
18298
|
if (isAssistantMessage(message) && message?.tool_calls?.length) {
|
|
17515
|
-
|
|
18299
|
+
for (let j = message.tool_calls.length - 1;j >= 0; j--) {
|
|
18300
|
+
const toolCall = message.tool_calls[j];
|
|
18301
|
+
if (toolCall?.type === "function") {
|
|
18302
|
+
return toolCall.function;
|
|
18303
|
+
}
|
|
18304
|
+
}
|
|
17516
18305
|
}
|
|
17517
18306
|
}
|
|
17518
18307
|
return;
|
|
@@ -17559,7 +18348,7 @@ var init_ChatCompletionRunner = __esm(() => {
|
|
|
17559
18348
|
...options,
|
|
17560
18349
|
headers: { ...options?.headers, "X-Stainless-Helper-Method": "runTools" }
|
|
17561
18350
|
};
|
|
17562
|
-
runner._run(() => runner._runTools(client, params, opts));
|
|
18351
|
+
runner._run(() => runner._runTools(client, params, runner, opts));
|
|
17563
18352
|
return runner;
|
|
17564
18353
|
}
|
|
17565
18354
|
_addMessage(message, emit = true) {
|
|
@@ -17781,16 +18570,41 @@ var init_streaming2 = __esm(() => {
|
|
|
17781
18570
|
});
|
|
17782
18571
|
|
|
17783
18572
|
// node_modules/openai/lib/ChatCompletionStream.mjs
|
|
17784
|
-
function
|
|
18573
|
+
function makeChatCompletionReadableStreamMessageChunk(chunk, message, toolCallIds) {
|
|
18574
|
+
const payload = {
|
|
18575
|
+
type: "message",
|
|
18576
|
+
message,
|
|
18577
|
+
...toolCallIds ? { tool_call_ids: toolCallIds } : {}
|
|
18578
|
+
};
|
|
18579
|
+
return {
|
|
18580
|
+
id: chunk.id,
|
|
18581
|
+
choices: [],
|
|
18582
|
+
created: chunk.created,
|
|
18583
|
+
model: chunk.model,
|
|
18584
|
+
object: `${CHAT_COMPLETION_READABLE_STREAM_MESSAGE_PREFIX}${JSON.stringify(payload)}`
|
|
18585
|
+
};
|
|
18586
|
+
}
|
|
18587
|
+
function isChatCompletionReadableStreamMessage(item) {
|
|
18588
|
+
return "type" in item && item.type === "message" && "message" in item || "object" in item && typeof item.object === "string" && item.object.startsWith(CHAT_COMPLETION_READABLE_STREAM_MESSAGE_PREFIX);
|
|
18589
|
+
}
|
|
18590
|
+
function getChatCompletionReadableStreamMessage(item) {
|
|
18591
|
+
if ("type" in item) {
|
|
18592
|
+
return item;
|
|
18593
|
+
}
|
|
18594
|
+
return JSON.parse(item.object.slice(CHAT_COMPLETION_READABLE_STREAM_MESSAGE_PREFIX.length));
|
|
18595
|
+
}
|
|
18596
|
+
function finalizeChatCompletion(snapshot, params, audioDoneChoiceIndexes) {
|
|
17785
18597
|
const { id, choices, created, model, system_fingerprint, ...rest } = snapshot;
|
|
17786
18598
|
const completion = {
|
|
17787
18599
|
...rest,
|
|
17788
18600
|
id,
|
|
17789
18601
|
choices: choices.map(({ message, finish_reason, index, logprobs, ...choiceRest }) => {
|
|
17790
|
-
|
|
18602
|
+
const { content = null, function_call, tool_calls, audio, ...messageRest } = message;
|
|
18603
|
+
const finishReason = finish_reason ?? (audioDoneChoiceIndexes.has(index) && isCompleteAudio(audio) ? "stop" : null);
|
|
18604
|
+
if (!finishReason) {
|
|
17791
18605
|
throw new OpenAIError(`missing finish_reason for choice ${index}`);
|
|
17792
18606
|
}
|
|
17793
|
-
const
|
|
18607
|
+
const audioResponse = audio ? { audio } : {};
|
|
17794
18608
|
const role = message.role;
|
|
17795
18609
|
if (!role) {
|
|
17796
18610
|
throw new OpenAIError(`missing role for choice ${index}`);
|
|
@@ -17806,12 +18620,13 @@ function finalizeChatCompletion(snapshot, params) {
|
|
|
17806
18620
|
return {
|
|
17807
18621
|
...choiceRest,
|
|
17808
18622
|
message: {
|
|
18623
|
+
...audioResponse,
|
|
17809
18624
|
content,
|
|
17810
18625
|
function_call: { arguments: args, name },
|
|
17811
18626
|
role,
|
|
17812
18627
|
refusal: message.refusal ?? null
|
|
17813
18628
|
},
|
|
17814
|
-
finish_reason,
|
|
18629
|
+
finish_reason: finishReason,
|
|
17815
18630
|
index,
|
|
17816
18631
|
logprobs
|
|
17817
18632
|
};
|
|
@@ -17820,20 +18635,17 @@ function finalizeChatCompletion(snapshot, params) {
|
|
|
17820
18635
|
return {
|
|
17821
18636
|
...choiceRest,
|
|
17822
18637
|
index,
|
|
17823
|
-
finish_reason,
|
|
18638
|
+
finish_reason: finishReason,
|
|
17824
18639
|
logprobs,
|
|
17825
18640
|
message: {
|
|
17826
18641
|
...messageRest,
|
|
18642
|
+
...audioResponse,
|
|
17827
18643
|
role,
|
|
17828
18644
|
content,
|
|
17829
18645
|
refusal: message.refusal ?? null,
|
|
17830
18646
|
tool_calls: tool_calls.map((tool_call, i) => {
|
|
17831
18647
|
const { function: fn, type, id, ...toolRest } = tool_call;
|
|
17832
18648
|
const { arguments: args, name, ...fnRest } = fn || {};
|
|
17833
|
-
if (id == null) {
|
|
17834
|
-
throw new OpenAIError(`missing choices[${index}].tool_calls[${i}].id
|
|
17835
|
-
${str2(snapshot)}`);
|
|
17836
|
-
}
|
|
17837
18649
|
if (type == null) {
|
|
17838
18650
|
throw new OpenAIError(`missing choices[${index}].tool_calls[${i}].type
|
|
17839
18651
|
${str2(snapshot)}`);
|
|
@@ -17846,15 +18658,20 @@ ${str2(snapshot)}`);
|
|
|
17846
18658
|
throw new OpenAIError(`missing choices[${index}].tool_calls[${i}].function.arguments
|
|
17847
18659
|
${str2(snapshot)}`);
|
|
17848
18660
|
}
|
|
17849
|
-
return {
|
|
18661
|
+
return {
|
|
18662
|
+
...toolRest,
|
|
18663
|
+
id: id || `call_${uuid4()}`,
|
|
18664
|
+
type,
|
|
18665
|
+
function: { ...fnRest, name, arguments: args }
|
|
18666
|
+
};
|
|
17850
18667
|
})
|
|
17851
18668
|
}
|
|
17852
18669
|
};
|
|
17853
18670
|
}
|
|
17854
18671
|
return {
|
|
17855
18672
|
...choiceRest,
|
|
17856
|
-
message: { ...messageRest, content, role, refusal: message.refusal ?? null },
|
|
17857
|
-
finish_reason,
|
|
18673
|
+
message: { ...messageRest, ...audioResponse, content, role, refusal: message.refusal ?? null },
|
|
18674
|
+
finish_reason: finishReason,
|
|
17858
18675
|
index,
|
|
17859
18676
|
logprobs
|
|
17860
18677
|
};
|
|
@@ -17866,6 +18683,9 @@ ${str2(snapshot)}`);
|
|
|
17866
18683
|
};
|
|
17867
18684
|
return maybeParseChatCompletion(completion, params);
|
|
17868
18685
|
}
|
|
18686
|
+
function isCompleteAudio(audio) {
|
|
18687
|
+
return audio?.id != null && audio.data != null && audio.transcript != null && audio.expires_at != null;
|
|
18688
|
+
}
|
|
17869
18689
|
function str2(x) {
|
|
17870
18690
|
return JSON.stringify(x);
|
|
17871
18691
|
}
|
|
@@ -17873,11 +18693,12 @@ function assertIsEmpty(obj) {
|
|
|
17873
18693
|
return;
|
|
17874
18694
|
}
|
|
17875
18695
|
function assertNever(_x) {}
|
|
17876
|
-
var _ChatCompletionStream_instances, _ChatCompletionStream_params, _ChatCompletionStream_choiceEventStates, _ChatCompletionStream_currentChatCompletionSnapshot, _ChatCompletionStream_beginRequest, _ChatCompletionStream_getChoiceEventState, _ChatCompletionStream_addChunk, _ChatCompletionStream_emitToolCallDoneEvent, _ChatCompletionStream_emitContentDoneEvents, _ChatCompletionStream_endRequest, _ChatCompletionStream_getAutoParseableResponseFormat, _ChatCompletionStream_accumulateChatCompletion, ChatCompletionStream;
|
|
18696
|
+
var _ChatCompletionStream_instances, _ChatCompletionStream_params, _ChatCompletionStream_audioDoneChoiceIndexes, _ChatCompletionStream_choiceEventStates, _ChatCompletionStream_currentChatCompletionSnapshot, _ChatCompletionStream_beginRequest, _ChatCompletionStream_getChoiceEventState, _ChatCompletionStream_addChunk, _ChatCompletionStream_emitToolCallDoneEvent, _ChatCompletionStream_emitContentDoneEvents, _ChatCompletionStream_endRequest, _ChatCompletionStream_getAutoParseableResponseFormat, _ChatCompletionStream_accumulateChatCompletion, CHAT_COMPLETION_READABLE_STREAM_MESSAGE_PREFIX = "chat.completion.chunk.message:", ChatCompletionStream;
|
|
17877
18697
|
var init_ChatCompletionStream = __esm(() => {
|
|
17878
18698
|
init_tslib();
|
|
17879
18699
|
init_parser2();
|
|
17880
18700
|
init_error2();
|
|
18701
|
+
init_uuid();
|
|
17881
18702
|
init_parser();
|
|
17882
18703
|
init_streaming2();
|
|
17883
18704
|
init_AbstractChatCompletionRunner();
|
|
@@ -17886,9 +18707,11 @@ var init_ChatCompletionStream = __esm(() => {
|
|
|
17886
18707
|
super();
|
|
17887
18708
|
_ChatCompletionStream_instances.add(this);
|
|
17888
18709
|
_ChatCompletionStream_params.set(this, undefined);
|
|
18710
|
+
_ChatCompletionStream_audioDoneChoiceIndexes.set(this, undefined);
|
|
17889
18711
|
_ChatCompletionStream_choiceEventStates.set(this, undefined);
|
|
17890
18712
|
_ChatCompletionStream_currentChatCompletionSnapshot.set(this, undefined);
|
|
17891
18713
|
__classPrivateFieldSet(this, _ChatCompletionStream_params, params, "f");
|
|
18714
|
+
__classPrivateFieldSet(this, _ChatCompletionStream_audioDoneChoiceIndexes, new Set, "f");
|
|
17892
18715
|
__classPrivateFieldSet(this, _ChatCompletionStream_choiceEventStates, [], "f");
|
|
17893
18716
|
}
|
|
17894
18717
|
get currentChatCompletionSnapshot() {
|
|
@@ -17906,12 +18729,7 @@ var init_ChatCompletionStream = __esm(() => {
|
|
|
17906
18729
|
}
|
|
17907
18730
|
async _createChatCompletion(client, params, options) {
|
|
17908
18731
|
super._createChatCompletion;
|
|
17909
|
-
|
|
17910
|
-
if (signal) {
|
|
17911
|
-
if (signal.aborted)
|
|
17912
|
-
this.controller.abort();
|
|
17913
|
-
signal.addEventListener("abort", () => this.controller.abort());
|
|
17914
|
-
}
|
|
18732
|
+
this._listenForAbort(options?.signal);
|
|
17915
18733
|
__classPrivateFieldGet(this, _ChatCompletionStream_instances, "m", _ChatCompletionStream_beginRequest).call(this);
|
|
17916
18734
|
const stream = await client.chat.completions.create({ ...params, stream: true }, { ...options, signal: this.controller.signal });
|
|
17917
18735
|
this._connected();
|
|
@@ -17924,31 +18742,52 @@ var init_ChatCompletionStream = __esm(() => {
|
|
|
17924
18742
|
return this._addChatCompletion(__classPrivateFieldGet(this, _ChatCompletionStream_instances, "m", _ChatCompletionStream_endRequest).call(this));
|
|
17925
18743
|
}
|
|
17926
18744
|
async _fromReadableStream(readableStream, options) {
|
|
17927
|
-
|
|
17928
|
-
if (signal) {
|
|
17929
|
-
if (signal.aborted)
|
|
17930
|
-
this.controller.abort();
|
|
17931
|
-
signal.addEventListener("abort", () => this.controller.abort());
|
|
17932
|
-
}
|
|
18745
|
+
this._listenForAbort(options?.signal);
|
|
17933
18746
|
__classPrivateFieldGet(this, _ChatCompletionStream_instances, "m", _ChatCompletionStream_beginRequest).call(this);
|
|
17934
18747
|
this._connected();
|
|
17935
18748
|
const stream = Stream.fromReadableStream(readableStream, this.controller);
|
|
17936
18749
|
let chatId;
|
|
17937
|
-
for await (const
|
|
17938
|
-
if (
|
|
18750
|
+
for await (const item of stream) {
|
|
18751
|
+
if (isChatCompletionReadableStreamMessage(item)) {
|
|
18752
|
+
const message = getChatCompletionReadableStreamMessage(item);
|
|
18753
|
+
if (__classPrivateFieldGet(this, _ChatCompletionStream_currentChatCompletionSnapshot, "f")) {
|
|
18754
|
+
const toolCalls = __classPrivateFieldGet(this, _ChatCompletionStream_currentChatCompletionSnapshot, "f").choices[0]?.message.tool_calls;
|
|
18755
|
+
for (const [index, id] of message.tool_call_ids?.entries() ?? []) {
|
|
18756
|
+
const toolCall = toolCalls?.[index];
|
|
18757
|
+
if (toolCall && id) {
|
|
18758
|
+
toolCall.id = id;
|
|
18759
|
+
}
|
|
18760
|
+
}
|
|
18761
|
+
this._addChatCompletion(__classPrivateFieldGet(this, _ChatCompletionStream_instances, "m", _ChatCompletionStream_endRequest).call(this));
|
|
18762
|
+
chatId = undefined;
|
|
18763
|
+
}
|
|
18764
|
+
this._addMessage(message.message);
|
|
18765
|
+
continue;
|
|
18766
|
+
}
|
|
18767
|
+
const chunk = item;
|
|
18768
|
+
if (chatId && chunk.id && chatId !== chunk.id) {
|
|
17939
18769
|
this._addChatCompletion(__classPrivateFieldGet(this, _ChatCompletionStream_instances, "m", _ChatCompletionStream_endRequest).call(this));
|
|
17940
18770
|
}
|
|
17941
18771
|
__classPrivateFieldGet(this, _ChatCompletionStream_instances, "m", _ChatCompletionStream_addChunk).call(this, chunk);
|
|
17942
|
-
|
|
18772
|
+
if (chunk.id)
|
|
18773
|
+
chatId = chunk.id;
|
|
17943
18774
|
}
|
|
17944
18775
|
if (stream.controller.signal?.aborted) {
|
|
17945
18776
|
throw new APIUserAbortError;
|
|
17946
18777
|
}
|
|
17947
|
-
|
|
18778
|
+
if (__classPrivateFieldGet(this, _ChatCompletionStream_currentChatCompletionSnapshot, "f")) {
|
|
18779
|
+
return this._addChatCompletion(__classPrivateFieldGet(this, _ChatCompletionStream_instances, "m", _ChatCompletionStream_endRequest).call(this));
|
|
18780
|
+
}
|
|
18781
|
+
const lastChatCompletion = this._chatCompletions[this._chatCompletions.length - 1];
|
|
18782
|
+
if (lastChatCompletion) {
|
|
18783
|
+
return lastChatCompletion;
|
|
18784
|
+
}
|
|
18785
|
+
throw new OpenAIError(`request ended without sending any chunks`);
|
|
17948
18786
|
}
|
|
17949
|
-
[(_ChatCompletionStream_params = new WeakMap, _ChatCompletionStream_choiceEventStates = new WeakMap, _ChatCompletionStream_currentChatCompletionSnapshot = new WeakMap, _ChatCompletionStream_instances = new WeakSet, _ChatCompletionStream_beginRequest = function _ChatCompletionStream_beginRequest2() {
|
|
18787
|
+
[(_ChatCompletionStream_params = new WeakMap, _ChatCompletionStream_audioDoneChoiceIndexes = new WeakMap, _ChatCompletionStream_choiceEventStates = new WeakMap, _ChatCompletionStream_currentChatCompletionSnapshot = new WeakMap, _ChatCompletionStream_instances = new WeakSet, _ChatCompletionStream_beginRequest = function _ChatCompletionStream_beginRequest2() {
|
|
17950
18788
|
if (this.ended)
|
|
17951
18789
|
return;
|
|
18790
|
+
__classPrivateFieldSet(this, _ChatCompletionStream_audioDoneChoiceIndexes, new Set, "f");
|
|
17952
18791
|
__classPrivateFieldSet(this, _ChatCompletionStream_currentChatCompletionSnapshot, undefined, "f");
|
|
17953
18792
|
}, _ChatCompletionStream_getChoiceEventState = function _ChatCompletionStream_getChoiceEventState2(choice) {
|
|
17954
18793
|
let state = __classPrivateFieldGet(this, _ChatCompletionStream_choiceEventStates, "f")[choice.index];
|
|
@@ -17972,17 +18811,18 @@ var init_ChatCompletionStream = __esm(() => {
|
|
|
17972
18811
|
this._emit("chunk", chunk, completion);
|
|
17973
18812
|
for (const choice of chunk.choices) {
|
|
17974
18813
|
const choiceSnapshot = completion.choices[choice.index];
|
|
17975
|
-
|
|
17976
|
-
|
|
18814
|
+
const { delta } = choice;
|
|
18815
|
+
if (delta?.content != null && choiceSnapshot.message?.role === "assistant" && choiceSnapshot.message?.content) {
|
|
18816
|
+
this._emit("content", delta.content, choiceSnapshot.message.content);
|
|
17977
18817
|
this._emit("content.delta", {
|
|
17978
|
-
delta:
|
|
18818
|
+
delta: delta.content,
|
|
17979
18819
|
snapshot: choiceSnapshot.message.content,
|
|
17980
18820
|
parsed: choiceSnapshot.message.parsed
|
|
17981
18821
|
});
|
|
17982
18822
|
}
|
|
17983
|
-
if (
|
|
18823
|
+
if (delta?.refusal != null && choiceSnapshot.message?.role === "assistant" && choiceSnapshot.message?.refusal) {
|
|
17984
18824
|
this._emit("refusal.delta", {
|
|
17985
|
-
delta:
|
|
18825
|
+
delta: delta.refusal,
|
|
17986
18826
|
snapshot: choiceSnapshot.message.refusal
|
|
17987
18827
|
});
|
|
17988
18828
|
}
|
|
@@ -18005,7 +18845,7 @@ var init_ChatCompletionStream = __esm(() => {
|
|
|
18005
18845
|
__classPrivateFieldGet(this, _ChatCompletionStream_instances, "m", _ChatCompletionStream_emitToolCallDoneEvent).call(this, choiceSnapshot, state.current_tool_call_index);
|
|
18006
18846
|
}
|
|
18007
18847
|
}
|
|
18008
|
-
for (const toolCall of
|
|
18848
|
+
for (const toolCall of delta?.tool_calls ?? []) {
|
|
18009
18849
|
if (state.current_tool_call_index !== toolCall.index) {
|
|
18010
18850
|
__classPrivateFieldGet(this, _ChatCompletionStream_instances, "m", _ChatCompletionStream_emitContentDoneEvents).call(this, choiceSnapshot);
|
|
18011
18851
|
if (state.current_tool_call_index != null) {
|
|
@@ -18014,7 +18854,7 @@ var init_ChatCompletionStream = __esm(() => {
|
|
|
18014
18854
|
}
|
|
18015
18855
|
state.current_tool_call_index = toolCall.index;
|
|
18016
18856
|
}
|
|
18017
|
-
for (const toolCallDelta of
|
|
18857
|
+
for (const toolCallDelta of delta?.tool_calls ?? []) {
|
|
18018
18858
|
const toolCallSnapshot = choiceSnapshot.message.tool_calls?.[toolCallDelta.index];
|
|
18019
18859
|
if (!toolCallSnapshot?.type) {
|
|
18020
18860
|
continue;
|
|
@@ -18085,9 +18925,11 @@ var init_ChatCompletionStream = __esm(() => {
|
|
|
18085
18925
|
if (!snapshot) {
|
|
18086
18926
|
throw new OpenAIError(`request ended without sending any chunks`);
|
|
18087
18927
|
}
|
|
18928
|
+
const audioDoneChoiceIndexes = __classPrivateFieldGet(this, _ChatCompletionStream_audioDoneChoiceIndexes, "f");
|
|
18929
|
+
__classPrivateFieldSet(this, _ChatCompletionStream_audioDoneChoiceIndexes, new Set, "f");
|
|
18088
18930
|
__classPrivateFieldSet(this, _ChatCompletionStream_currentChatCompletionSnapshot, undefined, "f");
|
|
18089
18931
|
__classPrivateFieldSet(this, _ChatCompletionStream_choiceEventStates, [], "f");
|
|
18090
|
-
return finalizeChatCompletion(snapshot, __classPrivateFieldGet(this, _ChatCompletionStream_params, "f"));
|
|
18932
|
+
return finalizeChatCompletion(snapshot, __classPrivateFieldGet(this, _ChatCompletionStream_params, "f"), audioDoneChoiceIndexes);
|
|
18091
18933
|
}, _ChatCompletionStream_getAutoParseableResponseFormat = function _ChatCompletionStream_getAutoParseableResponseFormat2() {
|
|
18092
18934
|
const responseFormat = __classPrivateFieldGet(this, _ChatCompletionStream_params, "f")?.response_format;
|
|
18093
18935
|
if (isAutoParsableResponseFormat(responseFormat)) {
|
|
@@ -18095,7 +18937,7 @@ var init_ChatCompletionStream = __esm(() => {
|
|
|
18095
18937
|
}
|
|
18096
18938
|
return null;
|
|
18097
18939
|
}, _ChatCompletionStream_accumulateChatCompletion = function _ChatCompletionStream_accumulateChatCompletion2(chunk) {
|
|
18098
|
-
var _a, _b, _c, _d;
|
|
18940
|
+
var _a, _b, _c, _d, _e;
|
|
18099
18941
|
let snapshot = __classPrivateFieldGet(this, _ChatCompletionStream_currentChatCompletionSnapshot, "f");
|
|
18100
18942
|
const { choices, ...rest } = chunk;
|
|
18101
18943
|
if (!snapshot) {
|
|
@@ -18103,7 +18945,7 @@ var init_ChatCompletionStream = __esm(() => {
|
|
|
18103
18945
|
...rest,
|
|
18104
18946
|
choices: []
|
|
18105
18947
|
}, "f");
|
|
18106
|
-
} else {
|
|
18948
|
+
} else if (chunk.id) {
|
|
18107
18949
|
Object.assign(snapshot, rest);
|
|
18108
18950
|
}
|
|
18109
18951
|
for (const { delta, finish_reason, index, logprobs = null, ...other } of chunk.choices) {
|
|
@@ -18142,14 +18984,30 @@ var init_ChatCompletionStream = __esm(() => {
|
|
|
18142
18984
|
Object.assign(choice, other);
|
|
18143
18985
|
if (!delta)
|
|
18144
18986
|
continue;
|
|
18145
|
-
|
|
18987
|
+
__classPrivateFieldGet(this, _ChatCompletionStream_audioDoneChoiceIndexes, "f").delete(index);
|
|
18988
|
+
const { audio, content, refusal, function_call, role, tool_calls, ...rest } = delta;
|
|
18146
18989
|
assertIsEmpty(rest);
|
|
18147
18990
|
Object.assign(choice.message, rest);
|
|
18991
|
+
if (audio?.expires_at != null && audio.id == null && audio.data == null && audio.transcript == null && content == null && refusal == null && function_call == null && role == null && tool_calls == null && Object.keys(rest).length === 0) {
|
|
18992
|
+
__classPrivateFieldGet(this, _ChatCompletionStream_audioDoneChoiceIndexes, "f").add(index);
|
|
18993
|
+
}
|
|
18148
18994
|
if (refusal) {
|
|
18149
18995
|
choice.message.refusal = (choice.message.refusal || "") + refusal;
|
|
18150
18996
|
}
|
|
18151
18997
|
if (role)
|
|
18152
18998
|
choice.message.role = role;
|
|
18999
|
+
if (audio) {
|
|
19000
|
+
const audioSnapshot = (_c = choice.message).audio ?? (_c.audio = {});
|
|
19001
|
+
if (audio.id != null)
|
|
19002
|
+
audioSnapshot.id = audio.id;
|
|
19003
|
+
if (audio.data != null)
|
|
19004
|
+
audioSnapshot.data = (audioSnapshot.data ?? "") + audio.data;
|
|
19005
|
+
if (audio.transcript != null) {
|
|
19006
|
+
audioSnapshot.transcript = (audioSnapshot.transcript ?? "") + audio.transcript;
|
|
19007
|
+
}
|
|
19008
|
+
if (audio.expires_at != null)
|
|
19009
|
+
audioSnapshot.expires_at = audio.expires_at;
|
|
19010
|
+
}
|
|
18153
19011
|
if (function_call) {
|
|
18154
19012
|
if (!choice.message.function_call) {
|
|
18155
19013
|
choice.message.function_call = function_call;
|
|
@@ -18157,7 +19015,7 @@ var init_ChatCompletionStream = __esm(() => {
|
|
|
18157
19015
|
if (function_call.name)
|
|
18158
19016
|
choice.message.function_call.name = function_call.name;
|
|
18159
19017
|
if (function_call.arguments) {
|
|
18160
|
-
(
|
|
19018
|
+
(_d = choice.message.function_call).arguments ?? (_d.arguments = "");
|
|
18161
19019
|
choice.message.function_call.arguments += function_call.arguments;
|
|
18162
19020
|
}
|
|
18163
19021
|
}
|
|
@@ -18165,14 +19023,14 @@ var init_ChatCompletionStream = __esm(() => {
|
|
|
18165
19023
|
if (content) {
|
|
18166
19024
|
choice.message.content = (choice.message.content || "") + content;
|
|
18167
19025
|
if (!choice.message.refusal && __classPrivateFieldGet(this, _ChatCompletionStream_instances, "m", _ChatCompletionStream_getAutoParseableResponseFormat).call(this)) {
|
|
18168
|
-
choice.message.parsed = partialParse(choice.message.content);
|
|
19026
|
+
choice.message.parsed = choice.message.content.trim() ? partialParse(choice.message.content) : null;
|
|
18169
19027
|
}
|
|
18170
19028
|
}
|
|
18171
19029
|
if (tool_calls) {
|
|
18172
19030
|
if (!choice.message.tool_calls)
|
|
18173
19031
|
choice.message.tool_calls = [];
|
|
18174
19032
|
for (const { index, id, type, function: fn, ...rest } of tool_calls) {
|
|
18175
|
-
const tool_call = (
|
|
19033
|
+
const tool_call = (_e = choice.message.tool_calls)[index] ?? (_e[index] = {});
|
|
18176
19034
|
Object.assign(tool_call, rest);
|
|
18177
19035
|
if (id)
|
|
18178
19036
|
tool_call.id = id;
|
|
@@ -18253,19 +19111,95 @@ var init_ChatCompletionStream = __esm(() => {
|
|
|
18253
19111
|
var ChatCompletionStreamingRunner;
|
|
18254
19112
|
var init_ChatCompletionStreamingRunner = __esm(() => {
|
|
18255
19113
|
init_ChatCompletionStream();
|
|
19114
|
+
init_error2();
|
|
19115
|
+
init_streaming2();
|
|
19116
|
+
init_chatCompletionUtils();
|
|
18256
19117
|
ChatCompletionStreamingRunner = class ChatCompletionStreamingRunner extends ChatCompletionStream {
|
|
18257
19118
|
static fromReadableStream(stream) {
|
|
18258
19119
|
const runner = new ChatCompletionStreamingRunner(null);
|
|
18259
19120
|
runner._run(() => runner._fromReadableStream(stream));
|
|
18260
19121
|
return runner;
|
|
18261
19122
|
}
|
|
19123
|
+
toReadableStream() {
|
|
19124
|
+
const pushQueue = [];
|
|
19125
|
+
const readQueue = [];
|
|
19126
|
+
let done = false;
|
|
19127
|
+
let lastChunk;
|
|
19128
|
+
let toolCallIds;
|
|
19129
|
+
const pushEvent = (event) => {
|
|
19130
|
+
const reader = readQueue.shift();
|
|
19131
|
+
if (reader) {
|
|
19132
|
+
reader.resolve(event);
|
|
19133
|
+
} else {
|
|
19134
|
+
pushQueue.push(event);
|
|
19135
|
+
}
|
|
19136
|
+
};
|
|
19137
|
+
this.on("chunk", (chunk) => {
|
|
19138
|
+
lastChunk = chunk;
|
|
19139
|
+
pushEvent(chunk);
|
|
19140
|
+
});
|
|
19141
|
+
this.on("message", (message) => {
|
|
19142
|
+
if (isAssistantMessage(message)) {
|
|
19143
|
+
toolCallIds = message.tool_calls?.map((toolCall) => toolCall.id);
|
|
19144
|
+
return;
|
|
19145
|
+
}
|
|
19146
|
+
if (isToolMessage(message)) {
|
|
19147
|
+
if (!lastChunk) {
|
|
19148
|
+
throw new OpenAIError("cannot serialize a tool message before receiving any chunks");
|
|
19149
|
+
}
|
|
19150
|
+
pushEvent(makeChatCompletionReadableStreamMessageChunk(lastChunk, message, toolCallIds));
|
|
19151
|
+
}
|
|
19152
|
+
});
|
|
19153
|
+
this.on("end", () => {
|
|
19154
|
+
done = true;
|
|
19155
|
+
for (const reader of readQueue) {
|
|
19156
|
+
reader.resolve(undefined);
|
|
19157
|
+
}
|
|
19158
|
+
readQueue.length = 0;
|
|
19159
|
+
});
|
|
19160
|
+
this.on("abort", (err) => {
|
|
19161
|
+
done = true;
|
|
19162
|
+
for (const reader of readQueue) {
|
|
19163
|
+
reader.reject(err);
|
|
19164
|
+
}
|
|
19165
|
+
readQueue.length = 0;
|
|
19166
|
+
});
|
|
19167
|
+
this.on("error", (err) => {
|
|
19168
|
+
done = true;
|
|
19169
|
+
for (const reader of readQueue) {
|
|
19170
|
+
reader.reject(err);
|
|
19171
|
+
}
|
|
19172
|
+
readQueue.length = 0;
|
|
19173
|
+
});
|
|
19174
|
+
const iterator = () => ({
|
|
19175
|
+
next: async () => {
|
|
19176
|
+
if (!pushQueue.length) {
|
|
19177
|
+
if (done) {
|
|
19178
|
+
return { value: undefined, done: true };
|
|
19179
|
+
}
|
|
19180
|
+
return new Promise((resolve, reject) => readQueue.push({ resolve, reject })).then((event) => event ? { value: event, done: false } : { value: undefined, done: true });
|
|
19181
|
+
}
|
|
19182
|
+
const event = pushQueue.shift();
|
|
19183
|
+
if (!event) {
|
|
19184
|
+
return { value: undefined, done: true };
|
|
19185
|
+
}
|
|
19186
|
+
return { value: event, done: false };
|
|
19187
|
+
},
|
|
19188
|
+
return: async () => {
|
|
19189
|
+
this.abort();
|
|
19190
|
+
return { value: undefined, done: true };
|
|
19191
|
+
}
|
|
19192
|
+
});
|
|
19193
|
+
const stream = new Stream(iterator, this.controller);
|
|
19194
|
+
return stream.toReadableStream();
|
|
19195
|
+
}
|
|
18262
19196
|
static runTools(client, params, options) {
|
|
18263
19197
|
const runner = new ChatCompletionStreamingRunner(params);
|
|
18264
19198
|
const opts = {
|
|
18265
19199
|
...options,
|
|
18266
19200
|
headers: { ...options?.headers, "X-Stainless-Helper-Method": "runTools" }
|
|
18267
19201
|
};
|
|
18268
|
-
runner._run(() => runner._runTools(client, params, opts));
|
|
19202
|
+
runner._run(() => runner._runTools(client, params, runner, opts));
|
|
18269
19203
|
return runner;
|
|
18270
19204
|
}
|
|
18271
19205
|
};
|
|
@@ -18597,6 +19531,12 @@ var init_spend_alerts = __esm(() => {
|
|
|
18597
19531
|
__security: { adminAPIKeyAuth: true }
|
|
18598
19532
|
});
|
|
18599
19533
|
}
|
|
19534
|
+
retrieve(alertID, options) {
|
|
19535
|
+
return this._client.get(path3`/organization/spend_alerts/${alertID}`, {
|
|
19536
|
+
...options,
|
|
19537
|
+
__security: { adminAPIKeyAuth: true }
|
|
19538
|
+
});
|
|
19539
|
+
}
|
|
18600
19540
|
update(alertID, body, options) {
|
|
18601
19541
|
return this._client.post(path3`/organization/spend_alerts/${alertID}`, {
|
|
18602
19542
|
body,
|
|
@@ -18616,6 +19556,33 @@ var init_spend_alerts = __esm(() => {
|
|
|
18616
19556
|
};
|
|
18617
19557
|
});
|
|
18618
19558
|
|
|
19559
|
+
// node_modules/openai/resources/admin/organization/spend-limit.mjs
|
|
19560
|
+
var SpendLimit;
|
|
19561
|
+
var init_spend_limit = __esm(() => {
|
|
19562
|
+
init_resource();
|
|
19563
|
+
SpendLimit = class SpendLimit extends APIResource {
|
|
19564
|
+
retrieve(options) {
|
|
19565
|
+
return this._client.get("/organization/spend_limit", {
|
|
19566
|
+
...options,
|
|
19567
|
+
__security: { adminAPIKeyAuth: true }
|
|
19568
|
+
});
|
|
19569
|
+
}
|
|
19570
|
+
update(body, options) {
|
|
19571
|
+
return this._client.post("/organization/spend_limit", {
|
|
19572
|
+
body,
|
|
19573
|
+
...options,
|
|
19574
|
+
__security: { adminAPIKeyAuth: true }
|
|
19575
|
+
});
|
|
19576
|
+
}
|
|
19577
|
+
delete(options) {
|
|
19578
|
+
return this._client.delete("/organization/spend_limit", {
|
|
19579
|
+
...options,
|
|
19580
|
+
__security: { adminAPIKeyAuth: true }
|
|
19581
|
+
});
|
|
19582
|
+
}
|
|
19583
|
+
};
|
|
19584
|
+
});
|
|
19585
|
+
|
|
18619
19586
|
// node_modules/openai/resources/admin/organization/usage.mjs
|
|
18620
19587
|
var Usage;
|
|
18621
19588
|
var init_usage = __esm(() => {
|
|
@@ -19008,41 +19975,6 @@ var init_roles3 = __esm(() => {
|
|
|
19008
19975
|
};
|
|
19009
19976
|
});
|
|
19010
19977
|
|
|
19011
|
-
// node_modules/openai/resources/admin/organization/projects/service-accounts.mjs
|
|
19012
|
-
var ServiceAccounts;
|
|
19013
|
-
var init_service_accounts = __esm(() => {
|
|
19014
|
-
init_resource();
|
|
19015
|
-
init_pagination();
|
|
19016
|
-
init_path();
|
|
19017
|
-
ServiceAccounts = class ServiceAccounts extends APIResource {
|
|
19018
|
-
create(projectID, body, options) {
|
|
19019
|
-
return this._client.post(path3`/organization/projects/${projectID}/service_accounts`, {
|
|
19020
|
-
body,
|
|
19021
|
-
...options,
|
|
19022
|
-
__security: { adminAPIKeyAuth: true }
|
|
19023
|
-
});
|
|
19024
|
-
}
|
|
19025
|
-
retrieve(serviceAccountID, params, options) {
|
|
19026
|
-
const { project_id } = params;
|
|
19027
|
-
return this._client.get(path3`/organization/projects/${project_id}/service_accounts/${serviceAccountID}`, {
|
|
19028
|
-
...options,
|
|
19029
|
-
__security: { adminAPIKeyAuth: true }
|
|
19030
|
-
});
|
|
19031
|
-
}
|
|
19032
|
-
update(serviceAccountID, params, options) {
|
|
19033
|
-
const { project_id, ...body } = params;
|
|
19034
|
-
return this._client.post(path3`/organization/projects/${project_id}/service_accounts/${serviceAccountID}`, { body, ...options, __security: { adminAPIKeyAuth: true } });
|
|
19035
|
-
}
|
|
19036
|
-
list(projectID, query = {}, options) {
|
|
19037
|
-
return this._client.getAPIList(path3`/organization/projects/${projectID}/service_accounts`, ConversationCursorPage, { query, ...options, __security: { adminAPIKeyAuth: true } });
|
|
19038
|
-
}
|
|
19039
|
-
delete(serviceAccountID, params, options) {
|
|
19040
|
-
const { project_id } = params;
|
|
19041
|
-
return this._client.delete(path3`/organization/projects/${project_id}/service_accounts/${serviceAccountID}`, { ...options, __security: { adminAPIKeyAuth: true } });
|
|
19042
|
-
}
|
|
19043
|
-
};
|
|
19044
|
-
});
|
|
19045
|
-
|
|
19046
19978
|
// node_modules/openai/resources/admin/organization/projects/spend-alerts.mjs
|
|
19047
19979
|
var SpendAlerts2;
|
|
19048
19980
|
var init_spend_alerts2 = __esm(() => {
|
|
@@ -19057,6 +19989,13 @@ var init_spend_alerts2 = __esm(() => {
|
|
|
19057
19989
|
__security: { adminAPIKeyAuth: true }
|
|
19058
19990
|
});
|
|
19059
19991
|
}
|
|
19992
|
+
retrieve(alertID, params, options) {
|
|
19993
|
+
const { project_id } = params;
|
|
19994
|
+
return this._client.get(path3`/organization/projects/${project_id}/spend_alerts/${alertID}`, {
|
|
19995
|
+
...options,
|
|
19996
|
+
__security: { adminAPIKeyAuth: true }
|
|
19997
|
+
});
|
|
19998
|
+
}
|
|
19060
19999
|
update(alertID, params, options) {
|
|
19061
20000
|
const { project_id, ...body } = params;
|
|
19062
20001
|
return this._client.post(path3`/organization/projects/${project_id}/spend_alerts/${alertID}`, {
|
|
@@ -19078,6 +20017,34 @@ var init_spend_alerts2 = __esm(() => {
|
|
|
19078
20017
|
};
|
|
19079
20018
|
});
|
|
19080
20019
|
|
|
20020
|
+
// node_modules/openai/resources/admin/organization/projects/spend-limit.mjs
|
|
20021
|
+
var SpendLimit2;
|
|
20022
|
+
var init_spend_limit2 = __esm(() => {
|
|
20023
|
+
init_resource();
|
|
20024
|
+
init_path();
|
|
20025
|
+
SpendLimit2 = class SpendLimit2 extends APIResource {
|
|
20026
|
+
retrieve(projectID, options) {
|
|
20027
|
+
return this._client.get(path3`/organization/projects/${projectID}/spend_limit`, {
|
|
20028
|
+
...options,
|
|
20029
|
+
__security: { adminAPIKeyAuth: true }
|
|
20030
|
+
});
|
|
20031
|
+
}
|
|
20032
|
+
update(projectID, body, options) {
|
|
20033
|
+
return this._client.post(path3`/organization/projects/${projectID}/spend_limit`, {
|
|
20034
|
+
body,
|
|
20035
|
+
...options,
|
|
20036
|
+
__security: { adminAPIKeyAuth: true }
|
|
20037
|
+
});
|
|
20038
|
+
}
|
|
20039
|
+
delete(projectID, options) {
|
|
20040
|
+
return this._client.delete(path3`/organization/projects/${projectID}/spend_limit`, {
|
|
20041
|
+
...options,
|
|
20042
|
+
__security: { adminAPIKeyAuth: true }
|
|
20043
|
+
});
|
|
20044
|
+
}
|
|
20045
|
+
};
|
|
20046
|
+
});
|
|
20047
|
+
|
|
19081
20048
|
// node_modules/openai/resources/admin/organization/projects/groups/roles.mjs
|
|
19082
20049
|
var Roles4;
|
|
19083
20050
|
var init_roles4 = __esm(() => {
|
|
@@ -19156,6 +20123,61 @@ var init_groups2 = __esm(() => {
|
|
|
19156
20123
|
Groups2.Roles = Roles4;
|
|
19157
20124
|
});
|
|
19158
20125
|
|
|
20126
|
+
// node_modules/openai/resources/admin/organization/projects/service-accounts/api-keys.mjs
|
|
20127
|
+
var APIKeys2;
|
|
20128
|
+
var init_api_keys3 = __esm(() => {
|
|
20129
|
+
init_resource();
|
|
20130
|
+
init_path();
|
|
20131
|
+
APIKeys2 = class APIKeys2 extends APIResource {
|
|
20132
|
+
create(serviceAccountID, params, options) {
|
|
20133
|
+
const { project_id, ...body } = params;
|
|
20134
|
+
return this._client.post(path3`/organization/projects/${project_id}/service_accounts/${serviceAccountID}/api_keys`, { body, ...options, __security: { adminAPIKeyAuth: true } });
|
|
20135
|
+
}
|
|
20136
|
+
};
|
|
20137
|
+
});
|
|
20138
|
+
|
|
20139
|
+
// node_modules/openai/resources/admin/organization/projects/service-accounts/service-accounts.mjs
|
|
20140
|
+
var ServiceAccounts;
|
|
20141
|
+
var init_service_accounts = __esm(() => {
|
|
20142
|
+
init_resource();
|
|
20143
|
+
init_api_keys3();
|
|
20144
|
+
init_api_keys3();
|
|
20145
|
+
init_pagination();
|
|
20146
|
+
init_path();
|
|
20147
|
+
ServiceAccounts = class ServiceAccounts extends APIResource {
|
|
20148
|
+
constructor() {
|
|
20149
|
+
super(...arguments);
|
|
20150
|
+
this.apiKeys = new APIKeys2(this._client);
|
|
20151
|
+
}
|
|
20152
|
+
create(projectID, body, options) {
|
|
20153
|
+
return this._client.post(path3`/organization/projects/${projectID}/service_accounts`, {
|
|
20154
|
+
body,
|
|
20155
|
+
...options,
|
|
20156
|
+
__security: { adminAPIKeyAuth: true }
|
|
20157
|
+
});
|
|
20158
|
+
}
|
|
20159
|
+
retrieve(serviceAccountID, params, options) {
|
|
20160
|
+
const { project_id } = params;
|
|
20161
|
+
return this._client.get(path3`/organization/projects/${project_id}/service_accounts/${serviceAccountID}`, {
|
|
20162
|
+
...options,
|
|
20163
|
+
__security: { adminAPIKeyAuth: true }
|
|
20164
|
+
});
|
|
20165
|
+
}
|
|
20166
|
+
update(serviceAccountID, params, options) {
|
|
20167
|
+
const { project_id, ...body } = params;
|
|
20168
|
+
return this._client.post(path3`/organization/projects/${project_id}/service_accounts/${serviceAccountID}`, { body, ...options, __security: { adminAPIKeyAuth: true } });
|
|
20169
|
+
}
|
|
20170
|
+
list(projectID, query = {}, options) {
|
|
20171
|
+
return this._client.getAPIList(path3`/organization/projects/${projectID}/service_accounts`, ConversationCursorPage, { query, ...options, __security: { adminAPIKeyAuth: true } });
|
|
20172
|
+
}
|
|
20173
|
+
delete(serviceAccountID, params, options) {
|
|
20174
|
+
const { project_id } = params;
|
|
20175
|
+
return this._client.delete(path3`/organization/projects/${project_id}/service_accounts/${serviceAccountID}`, { ...options, __security: { adminAPIKeyAuth: true } });
|
|
20176
|
+
}
|
|
20177
|
+
};
|
|
20178
|
+
ServiceAccounts.APIKeys = APIKeys2;
|
|
20179
|
+
});
|
|
20180
|
+
|
|
19159
20181
|
// node_modules/openai/resources/admin/organization/projects/users/roles.mjs
|
|
19160
20182
|
var Roles5;
|
|
19161
20183
|
var init_roles5 = __esm(() => {
|
|
@@ -19259,12 +20281,14 @@ var init_projects = __esm(() => {
|
|
|
19259
20281
|
init_rate_limits();
|
|
19260
20282
|
init_roles3();
|
|
19261
20283
|
init_roles3();
|
|
19262
|
-
init_service_accounts();
|
|
19263
|
-
init_service_accounts();
|
|
19264
20284
|
init_spend_alerts2();
|
|
19265
20285
|
init_spend_alerts2();
|
|
20286
|
+
init_spend_limit2();
|
|
20287
|
+
init_spend_limit2();
|
|
19266
20288
|
init_groups2();
|
|
19267
20289
|
init_groups2();
|
|
20290
|
+
init_service_accounts();
|
|
20291
|
+
init_service_accounts();
|
|
19268
20292
|
init_users2();
|
|
19269
20293
|
init_users2();
|
|
19270
20294
|
init_pagination();
|
|
@@ -19281,6 +20305,7 @@ var init_projects = __esm(() => {
|
|
|
19281
20305
|
this.groups = new Groups2(this._client);
|
|
19282
20306
|
this.roles = new Roles3(this._client);
|
|
19283
20307
|
this.dataRetention = new DataRetention2(this._client);
|
|
20308
|
+
this.spendLimit = new SpendLimit2(this._client);
|
|
19284
20309
|
this.spendAlerts = new SpendAlerts2(this._client);
|
|
19285
20310
|
this.certificates = new Certificates2(this._client);
|
|
19286
20311
|
}
|
|
@@ -19327,6 +20352,7 @@ var init_projects = __esm(() => {
|
|
|
19327
20352
|
Projects.Groups = Groups2;
|
|
19328
20353
|
Projects.Roles = Roles3;
|
|
19329
20354
|
Projects.DataRetention = DataRetention2;
|
|
20355
|
+
Projects.SpendLimit = SpendLimit2;
|
|
19330
20356
|
Projects.SpendAlerts = SpendAlerts2;
|
|
19331
20357
|
Projects.Certificates = Certificates2;
|
|
19332
20358
|
});
|
|
@@ -19426,6 +20452,8 @@ var init_organization = __esm(() => {
|
|
|
19426
20452
|
init_roles();
|
|
19427
20453
|
init_spend_alerts();
|
|
19428
20454
|
init_spend_alerts();
|
|
20455
|
+
init_spend_limit();
|
|
20456
|
+
init_spend_limit();
|
|
19429
20457
|
init_usage();
|
|
19430
20458
|
init_usage();
|
|
19431
20459
|
init_groups();
|
|
@@ -19445,6 +20473,7 @@ var init_organization = __esm(() => {
|
|
|
19445
20473
|
this.groups = new Groups(this._client);
|
|
19446
20474
|
this.roles = new Roles(this._client);
|
|
19447
20475
|
this.dataRetention = new DataRetention(this._client);
|
|
20476
|
+
this.spendLimit = new SpendLimit(this._client);
|
|
19448
20477
|
this.spendAlerts = new SpendAlerts(this._client);
|
|
19449
20478
|
this.certificates = new Certificates(this._client);
|
|
19450
20479
|
this.projects = new Projects(this._client);
|
|
@@ -19458,6 +20487,7 @@ var init_organization = __esm(() => {
|
|
|
19458
20487
|
Organization.Groups = Groups;
|
|
19459
20488
|
Organization.Roles = Roles;
|
|
19460
20489
|
Organization.DataRetention = DataRetention;
|
|
20490
|
+
Organization.SpendLimit = SpendLimit;
|
|
19461
20491
|
Organization.SpendAlerts = SpendAlerts;
|
|
19462
20492
|
Organization.Certificates = Certificates;
|
|
19463
20493
|
Organization.Projects = Projects;
|
|
@@ -19478,72 +20508,6 @@ var init_admin = __esm(() => {
|
|
|
19478
20508
|
Admin.Organization = Organization;
|
|
19479
20509
|
});
|
|
19480
20510
|
|
|
19481
|
-
// node_modules/openai/internal/headers.mjs
|
|
19482
|
-
function* iterateHeaders(headers) {
|
|
19483
|
-
if (!headers)
|
|
19484
|
-
return;
|
|
19485
|
-
if (brand_privateNullableHeaders in headers) {
|
|
19486
|
-
const { values, nulls } = headers;
|
|
19487
|
-
yield* values.entries();
|
|
19488
|
-
for (const name of nulls) {
|
|
19489
|
-
yield [name, null];
|
|
19490
|
-
}
|
|
19491
|
-
return;
|
|
19492
|
-
}
|
|
19493
|
-
let shouldClear = false;
|
|
19494
|
-
let iter;
|
|
19495
|
-
if (headers instanceof Headers) {
|
|
19496
|
-
iter = headers.entries();
|
|
19497
|
-
} else if (isReadonlyArray(headers)) {
|
|
19498
|
-
iter = headers;
|
|
19499
|
-
} else {
|
|
19500
|
-
shouldClear = true;
|
|
19501
|
-
iter = Object.entries(headers ?? {});
|
|
19502
|
-
}
|
|
19503
|
-
for (let row of iter) {
|
|
19504
|
-
const name = row[0];
|
|
19505
|
-
if (typeof name !== "string")
|
|
19506
|
-
throw new TypeError("expected header name to be a string");
|
|
19507
|
-
const values = isReadonlyArray(row[1]) ? row[1] : [row[1]];
|
|
19508
|
-
let didClear = false;
|
|
19509
|
-
for (const value of values) {
|
|
19510
|
-
if (value === undefined)
|
|
19511
|
-
continue;
|
|
19512
|
-
if (shouldClear && !didClear) {
|
|
19513
|
-
didClear = true;
|
|
19514
|
-
yield [name, null];
|
|
19515
|
-
}
|
|
19516
|
-
yield [name, value];
|
|
19517
|
-
}
|
|
19518
|
-
}
|
|
19519
|
-
}
|
|
19520
|
-
var brand_privateNullableHeaders, buildHeaders = (newHeaders) => {
|
|
19521
|
-
const targetHeaders = new Headers;
|
|
19522
|
-
const nullHeaders = new Set;
|
|
19523
|
-
for (const headers of newHeaders) {
|
|
19524
|
-
const seenHeaders = new Set;
|
|
19525
|
-
for (const [name, value] of iterateHeaders(headers)) {
|
|
19526
|
-
const lowerName = name.toLowerCase();
|
|
19527
|
-
if (!seenHeaders.has(lowerName)) {
|
|
19528
|
-
targetHeaders.delete(name);
|
|
19529
|
-
seenHeaders.add(lowerName);
|
|
19530
|
-
}
|
|
19531
|
-
if (value === null) {
|
|
19532
|
-
targetHeaders.delete(name);
|
|
19533
|
-
nullHeaders.add(lowerName);
|
|
19534
|
-
} else {
|
|
19535
|
-
targetHeaders.append(name, value);
|
|
19536
|
-
nullHeaders.delete(lowerName);
|
|
19537
|
-
}
|
|
19538
|
-
}
|
|
19539
|
-
}
|
|
19540
|
-
return { [brand_privateNullableHeaders]: true, values: targetHeaders, nulls: nullHeaders };
|
|
19541
|
-
};
|
|
19542
|
-
var init_headers = __esm(() => {
|
|
19543
|
-
init_values();
|
|
19544
|
-
brand_privateNullableHeaders = /* @__PURE__ */ Symbol("brand.privateNullableHeaders");
|
|
19545
|
-
});
|
|
19546
|
-
|
|
19547
20511
|
// node_modules/openai/resources/audio/speech.mjs
|
|
19548
20512
|
var Speech;
|
|
19549
20513
|
var init_speech = __esm(() => {
|
|
@@ -19831,6 +20795,131 @@ var init_chatkit = __esm(() => {
|
|
|
19831
20795
|
ChatKit.Threads = Threads;
|
|
19832
20796
|
});
|
|
19833
20797
|
|
|
20798
|
+
// node_modules/openai/resources/beta/responses/input-items.mjs
|
|
20799
|
+
var InputItems;
|
|
20800
|
+
var init_input_items = __esm(() => {
|
|
20801
|
+
init_resource();
|
|
20802
|
+
init_pagination();
|
|
20803
|
+
init_headers();
|
|
20804
|
+
init_path();
|
|
20805
|
+
InputItems = class InputItems extends APIResource {
|
|
20806
|
+
list(responseID, params = {}, options) {
|
|
20807
|
+
const { betas, ...query } = params ?? {};
|
|
20808
|
+
return this._client.getAPIList(path3`/responses/${responseID}/input_items?beta=true`, CursorPage, {
|
|
20809
|
+
query,
|
|
20810
|
+
...options,
|
|
20811
|
+
headers: buildHeaders([
|
|
20812
|
+
{ ...betas?.toString() != null ? { "openai-beta": betas?.toString() } : undefined },
|
|
20813
|
+
options?.headers
|
|
20814
|
+
]),
|
|
20815
|
+
__security: { bearerAuth: true }
|
|
20816
|
+
});
|
|
20817
|
+
}
|
|
20818
|
+
};
|
|
20819
|
+
});
|
|
20820
|
+
|
|
20821
|
+
// node_modules/openai/resources/beta/responses/input-tokens.mjs
|
|
20822
|
+
var InputTokens;
|
|
20823
|
+
var init_input_tokens = __esm(() => {
|
|
20824
|
+
init_resource();
|
|
20825
|
+
init_headers();
|
|
20826
|
+
InputTokens = class InputTokens extends APIResource {
|
|
20827
|
+
count(params = {}, options) {
|
|
20828
|
+
const { betas, ...body } = params ?? {};
|
|
20829
|
+
return this._client.post("/responses/input_tokens?beta=true", {
|
|
20830
|
+
body,
|
|
20831
|
+
...options,
|
|
20832
|
+
headers: buildHeaders([
|
|
20833
|
+
{ ...betas?.toString() != null ? { "openai-beta": betas?.toString() } : undefined },
|
|
20834
|
+
options?.headers
|
|
20835
|
+
]),
|
|
20836
|
+
__security: { bearerAuth: true }
|
|
20837
|
+
});
|
|
20838
|
+
}
|
|
20839
|
+
};
|
|
20840
|
+
});
|
|
20841
|
+
|
|
20842
|
+
// node_modules/openai/resources/beta/responses/responses.mjs
|
|
20843
|
+
var Responses;
|
|
20844
|
+
var init_responses = __esm(() => {
|
|
20845
|
+
init_resource();
|
|
20846
|
+
init_input_items();
|
|
20847
|
+
init_input_items();
|
|
20848
|
+
init_input_tokens();
|
|
20849
|
+
init_input_tokens();
|
|
20850
|
+
init_headers();
|
|
20851
|
+
init_path();
|
|
20852
|
+
Responses = class Responses extends APIResource {
|
|
20853
|
+
constructor() {
|
|
20854
|
+
super(...arguments);
|
|
20855
|
+
this.inputItems = new InputItems(this._client);
|
|
20856
|
+
this.inputTokens = new InputTokens(this._client);
|
|
20857
|
+
}
|
|
20858
|
+
create(params, options) {
|
|
20859
|
+
const { betas, ...body } = params;
|
|
20860
|
+
return this._client.post("/responses?beta=true", {
|
|
20861
|
+
body,
|
|
20862
|
+
...options,
|
|
20863
|
+
headers: buildHeaders([
|
|
20864
|
+
{ ...betas?.toString() != null ? { "openai-beta": betas?.toString() } : undefined },
|
|
20865
|
+
options?.headers
|
|
20866
|
+
]),
|
|
20867
|
+
stream: params.stream ?? false,
|
|
20868
|
+
__security: { bearerAuth: true }
|
|
20869
|
+
});
|
|
20870
|
+
}
|
|
20871
|
+
retrieve(responseID, params = {}, options) {
|
|
20872
|
+
const { betas, ...query } = params ?? {};
|
|
20873
|
+
return this._client.get(path3`/responses/${responseID}?beta=true`, {
|
|
20874
|
+
query,
|
|
20875
|
+
...options,
|
|
20876
|
+
headers: buildHeaders([
|
|
20877
|
+
{ ...betas?.toString() != null ? { "openai-beta": betas?.toString() } : undefined },
|
|
20878
|
+
options?.headers
|
|
20879
|
+
]),
|
|
20880
|
+
stream: params?.stream ?? false,
|
|
20881
|
+
__security: { bearerAuth: true }
|
|
20882
|
+
});
|
|
20883
|
+
}
|
|
20884
|
+
delete(responseID, params = {}, options) {
|
|
20885
|
+
const { betas } = params ?? {};
|
|
20886
|
+
return this._client.delete(path3`/responses/${responseID}?beta=true`, {
|
|
20887
|
+
...options,
|
|
20888
|
+
headers: buildHeaders([
|
|
20889
|
+
{ Accept: "*/*", ...betas?.toString() != null ? { "openai-beta": betas?.toString() } : undefined },
|
|
20890
|
+
options?.headers
|
|
20891
|
+
]),
|
|
20892
|
+
__security: { bearerAuth: true }
|
|
20893
|
+
});
|
|
20894
|
+
}
|
|
20895
|
+
cancel(responseID, params = {}, options) {
|
|
20896
|
+
const { betas } = params ?? {};
|
|
20897
|
+
return this._client.post(path3`/responses/${responseID}/cancel?beta=true`, {
|
|
20898
|
+
...options,
|
|
20899
|
+
headers: buildHeaders([
|
|
20900
|
+
{ ...betas?.toString() != null ? { "openai-beta": betas?.toString() } : undefined },
|
|
20901
|
+
options?.headers
|
|
20902
|
+
]),
|
|
20903
|
+
__security: { bearerAuth: true }
|
|
20904
|
+
});
|
|
20905
|
+
}
|
|
20906
|
+
compact(params, options) {
|
|
20907
|
+
const { betas, ...body } = params;
|
|
20908
|
+
return this._client.post("/responses/compact?beta=true", {
|
|
20909
|
+
body,
|
|
20910
|
+
...options,
|
|
20911
|
+
headers: buildHeaders([
|
|
20912
|
+
{ ...betas?.toString() != null ? { "openai-beta": betas?.toString() } : undefined },
|
|
20913
|
+
options?.headers
|
|
20914
|
+
]),
|
|
20915
|
+
__security: { bearerAuth: true }
|
|
20916
|
+
});
|
|
20917
|
+
}
|
|
20918
|
+
};
|
|
20919
|
+
Responses.InputItems = InputItems;
|
|
20920
|
+
Responses.InputTokens = InputTokens;
|
|
20921
|
+
});
|
|
20922
|
+
|
|
19834
20923
|
// node_modules/openai/resources/beta/threads/messages.mjs
|
|
19835
20924
|
var Messages2;
|
|
19836
20925
|
var init_messages2 = __esm(() => {
|
|
@@ -19986,11 +21075,12 @@ var init_AssistantStream = __esm(() => {
|
|
|
19986
21075
|
const readQueue = [];
|
|
19987
21076
|
let done = false;
|
|
19988
21077
|
this.on("event", (event) => {
|
|
21078
|
+
const eventCopy = structuredClone(event);
|
|
19989
21079
|
const reader = readQueue.shift();
|
|
19990
21080
|
if (reader) {
|
|
19991
|
-
reader.resolve(
|
|
21081
|
+
reader.resolve(eventCopy);
|
|
19992
21082
|
} else {
|
|
19993
|
-
pushQueue.push(
|
|
21083
|
+
pushQueue.push(eventCopy);
|
|
19994
21084
|
}
|
|
19995
21085
|
});
|
|
19996
21086
|
this.on("end", () => {
|
|
@@ -20037,12 +21127,7 @@ var init_AssistantStream = __esm(() => {
|
|
|
20037
21127
|
return runner;
|
|
20038
21128
|
}
|
|
20039
21129
|
async _fromReadableStream(readableStream, options) {
|
|
20040
|
-
|
|
20041
|
-
if (signal) {
|
|
20042
|
-
if (signal.aborted)
|
|
20043
|
-
this.controller.abort();
|
|
20044
|
-
signal.addEventListener("abort", () => this.controller.abort());
|
|
20045
|
-
}
|
|
21130
|
+
this._listenForAbort(options?.signal);
|
|
20046
21131
|
this._connected();
|
|
20047
21132
|
const stream = Stream.fromReadableStream(readableStream, this.controller);
|
|
20048
21133
|
for await (const event of stream) {
|
|
@@ -20066,12 +21151,7 @@ var init_AssistantStream = __esm(() => {
|
|
|
20066
21151
|
return runner;
|
|
20067
21152
|
}
|
|
20068
21153
|
async _createToolAssistantStream(run, runId, params, options) {
|
|
20069
|
-
|
|
20070
|
-
if (signal) {
|
|
20071
|
-
if (signal.aborted)
|
|
20072
|
-
this.controller.abort();
|
|
20073
|
-
signal.addEventListener("abort", () => this.controller.abort());
|
|
20074
|
-
}
|
|
21154
|
+
this._listenForAbort(options?.signal);
|
|
20075
21155
|
const body = { ...params, stream: true };
|
|
20076
21156
|
const stream = await run.submitToolOutputs(runId, body, {
|
|
20077
21157
|
...options,
|
|
@@ -20129,12 +21209,7 @@ var init_AssistantStream = __esm(() => {
|
|
|
20129
21209
|
return __classPrivateFieldGet(this, _AssistantStream_finalRun, "f");
|
|
20130
21210
|
}
|
|
20131
21211
|
async _createThreadAssistantStream(thread, params, options) {
|
|
20132
|
-
|
|
20133
|
-
if (signal) {
|
|
20134
|
-
if (signal.aborted)
|
|
20135
|
-
this.controller.abort();
|
|
20136
|
-
signal.addEventListener("abort", () => this.controller.abort());
|
|
20137
|
-
}
|
|
21212
|
+
this._listenForAbort(options?.signal);
|
|
20138
21213
|
const body = { ...params, stream: true };
|
|
20139
21214
|
const stream = await thread.createAndRun(body, { ...options, signal: this.controller.signal });
|
|
20140
21215
|
this._connected();
|
|
@@ -20147,12 +21222,7 @@ var init_AssistantStream = __esm(() => {
|
|
|
20147
21222
|
return this._addRun(__classPrivateFieldGet(this, _AssistantStream_instances, "m", _AssistantStream_endRequest).call(this));
|
|
20148
21223
|
}
|
|
20149
21224
|
async _createAssistantStream(run, threadId, params, options) {
|
|
20150
|
-
|
|
20151
|
-
if (signal) {
|
|
20152
|
-
if (signal.aborted)
|
|
20153
|
-
this.controller.abort();
|
|
20154
|
-
signal.addEventListener("abort", () => this.controller.abort());
|
|
20155
|
-
}
|
|
21225
|
+
this._listenForAbort(options?.signal);
|
|
20156
21226
|
const body = { ...params, stream: true };
|
|
20157
21227
|
const stream = await run.create(threadId, body, { ...options, signal: this.controller.signal });
|
|
20158
21228
|
this._connected();
|
|
@@ -20204,7 +21274,7 @@ var init_AssistantStream = __esm(() => {
|
|
|
20204
21274
|
}
|
|
20205
21275
|
const accEntry = accValue[index];
|
|
20206
21276
|
if (accEntry == null) {
|
|
20207
|
-
accValue
|
|
21277
|
+
accValue[index] = deltaEntry;
|
|
20208
21278
|
} else {
|
|
20209
21279
|
accValue[index] = this.accumulateDelta(accEntry, deltaEntry);
|
|
20210
21280
|
}
|
|
@@ -20691,18 +21761,22 @@ var init_beta = __esm(() => {
|
|
|
20691
21761
|
init_realtime();
|
|
20692
21762
|
init_chatkit();
|
|
20693
21763
|
init_chatkit();
|
|
21764
|
+
init_responses();
|
|
21765
|
+
init_responses();
|
|
20694
21766
|
init_threads2();
|
|
20695
21767
|
init_threads2();
|
|
20696
21768
|
Beta = class Beta extends APIResource {
|
|
20697
21769
|
constructor() {
|
|
20698
21770
|
super(...arguments);
|
|
20699
21771
|
this.realtime = new Realtime(this._client);
|
|
21772
|
+
this.responses = new Responses(this._client);
|
|
20700
21773
|
this.chatkit = new ChatKit(this._client);
|
|
20701
21774
|
this.assistants = new Assistants(this._client);
|
|
20702
21775
|
this.threads = new Threads2(this._client);
|
|
20703
21776
|
}
|
|
20704
21777
|
};
|
|
20705
21778
|
Beta.Realtime = Realtime;
|
|
21779
|
+
Beta.Responses = Responses;
|
|
20706
21780
|
Beta.ChatKit = ChatKit;
|
|
20707
21781
|
Beta.Assistants = Assistants;
|
|
20708
21782
|
Beta.Threads = Threads2;
|
|
@@ -21437,7 +22511,7 @@ var init_realtime2 = __esm(() => {
|
|
|
21437
22511
|
// node_modules/openai/lib/ResponsesParser.mjs
|
|
21438
22512
|
function maybeParseResponse(response, params) {
|
|
21439
22513
|
if (!params || !hasAutoParseableInput2(params)) {
|
|
21440
|
-
|
|
22514
|
+
const parsed = {
|
|
21441
22515
|
...response,
|
|
21442
22516
|
output_parsed: null,
|
|
21443
22517
|
output: response.output.map((item) => {
|
|
@@ -21460,23 +22534,25 @@ function maybeParseResponse(response, params) {
|
|
|
21460
22534
|
}
|
|
21461
22535
|
})
|
|
21462
22536
|
};
|
|
22537
|
+
if (needsOutputText(response, parsed)) {
|
|
22538
|
+
addOutputText(parsed);
|
|
22539
|
+
}
|
|
22540
|
+
return parsed;
|
|
21463
22541
|
}
|
|
21464
22542
|
return parseResponse(response, params);
|
|
21465
22543
|
}
|
|
21466
22544
|
function parseResponse(response, params) {
|
|
22545
|
+
const shouldParse = !response.status || response.status === "completed";
|
|
21467
22546
|
const output = response.output.map((item) => {
|
|
21468
22547
|
if (item.type === "function_call") {
|
|
21469
|
-
return {
|
|
21470
|
-
...item,
|
|
21471
|
-
parsed_arguments: parseToolCall2(params, item)
|
|
21472
|
-
};
|
|
22548
|
+
return shouldParse ? parseToolCall2(params, item) : { ...item, parsed_arguments: null };
|
|
21473
22549
|
}
|
|
21474
22550
|
if (item.type === "message") {
|
|
21475
22551
|
const content = item.content.map((content) => {
|
|
21476
22552
|
if (content.type === "output_text") {
|
|
21477
22553
|
return {
|
|
21478
22554
|
...content,
|
|
21479
|
-
parsed: parseTextFormat(params, content.text)
|
|
22555
|
+
parsed: shouldParse ? parseTextFormat(params, content.text) : null
|
|
21480
22556
|
};
|
|
21481
22557
|
}
|
|
21482
22558
|
return content;
|
|
@@ -21489,7 +22565,7 @@ function parseResponse(response, params) {
|
|
|
21489
22565
|
return item;
|
|
21490
22566
|
});
|
|
21491
22567
|
const parsed = Object.assign({}, response, { output });
|
|
21492
|
-
if (
|
|
22568
|
+
if (needsOutputText(response, parsed)) {
|
|
21493
22569
|
addOutputText(parsed);
|
|
21494
22570
|
}
|
|
21495
22571
|
Object.defineProperty(parsed, "output_parsed", {
|
|
@@ -21524,7 +22600,7 @@ function hasAutoParseableInput2(params) {
|
|
|
21524
22600
|
if (isAutoParsableResponseFormat(params.text?.format)) {
|
|
21525
22601
|
return true;
|
|
21526
22602
|
}
|
|
21527
|
-
return
|
|
22603
|
+
return Array.isArray(params.tools) && params.tools.some((tool) => isAutoParsableTool2(tool) || tool.type === "function" && tool.strict === true);
|
|
21528
22604
|
}
|
|
21529
22605
|
function isAutoParsableTool2(tool) {
|
|
21530
22606
|
return tool?.["$brand"] === "auto-parseable-tool";
|
|
@@ -21540,6 +22616,9 @@ function parseToolCall2(params, toolCall) {
|
|
|
21540
22616
|
parsed_arguments: isAutoParsableTool2(inputTool) ? inputTool.$parseRaw(toolCall.arguments) : inputTool?.strict ? JSON.parse(toolCall.arguments) : null
|
|
21541
22617
|
};
|
|
21542
22618
|
}
|
|
22619
|
+
function needsOutputText(response, target) {
|
|
22620
|
+
return !Object.getOwnPropertyDescriptor(response, "output_text") || target.output_text == null;
|
|
22621
|
+
}
|
|
21543
22622
|
function addOutputText(rsp) {
|
|
21544
22623
|
const texts = [];
|
|
21545
22624
|
for (const output of rsp.output) {
|
|
@@ -21559,16 +22638,411 @@ var init_ResponsesParser = __esm(() => {
|
|
|
21559
22638
|
init_parser();
|
|
21560
22639
|
});
|
|
21561
22640
|
|
|
22641
|
+
// node_modules/openai/lib/responses/ResponseAccumulator.mjs
|
|
22642
|
+
function accumulateResponse(event, snapshot) {
|
|
22643
|
+
if (!snapshot) {
|
|
22644
|
+
if (event.type !== "response.created") {
|
|
22645
|
+
throw new OpenAIError(`When snapshot hasn't been set yet, expected 'response.created' event, got ${event.type}`);
|
|
22646
|
+
}
|
|
22647
|
+
return cloneResponse(event.response);
|
|
22648
|
+
}
|
|
22649
|
+
switch (event.type) {
|
|
22650
|
+
case "response.output_item.added": {
|
|
22651
|
+
snapshot.output.push(structuredClone(event.item));
|
|
22652
|
+
if (event.item.type === "message") {
|
|
22653
|
+
addOutputText(snapshot);
|
|
22654
|
+
}
|
|
22655
|
+
break;
|
|
22656
|
+
}
|
|
22657
|
+
case "response.output_item.done": {
|
|
22658
|
+
getOutput(snapshot, event.output_index);
|
|
22659
|
+
snapshot.output[event.output_index] = structuredClone(event.item);
|
|
22660
|
+
if (event.item.type === "message") {
|
|
22661
|
+
addOutputText(snapshot);
|
|
22662
|
+
}
|
|
22663
|
+
break;
|
|
22664
|
+
}
|
|
22665
|
+
case "response.content_part.added": {
|
|
22666
|
+
const output = getOutput(snapshot, event.output_index);
|
|
22667
|
+
const type = output.type;
|
|
22668
|
+
const part = event.part;
|
|
22669
|
+
if (type === "message" && part.type !== "reasoning_text") {
|
|
22670
|
+
output.content.push(structuredClone(part));
|
|
22671
|
+
if (part.type === "output_text") {
|
|
22672
|
+
addOutputText(snapshot);
|
|
22673
|
+
}
|
|
22674
|
+
} else if (type === "reasoning" && part.type === "reasoning_text") {
|
|
22675
|
+
if (!output.content) {
|
|
22676
|
+
output.content = [];
|
|
22677
|
+
}
|
|
22678
|
+
output.content.push(structuredClone(part));
|
|
22679
|
+
}
|
|
22680
|
+
break;
|
|
22681
|
+
}
|
|
22682
|
+
case "response.content_part.done": {
|
|
22683
|
+
const output = getOutput(snapshot, event.output_index);
|
|
22684
|
+
const part = event.part;
|
|
22685
|
+
if (output.type === "message" && part.type !== "reasoning_text") {
|
|
22686
|
+
getContent(output.content, event.content_index);
|
|
22687
|
+
output.content[event.content_index] = structuredClone(part);
|
|
22688
|
+
if (part.type === "output_text") {
|
|
22689
|
+
addOutputText(snapshot);
|
|
22690
|
+
}
|
|
22691
|
+
} else if (output.type === "reasoning" && part.type === "reasoning_text") {
|
|
22692
|
+
const content = output.content;
|
|
22693
|
+
if (!content) {
|
|
22694
|
+
throw new OpenAIError(`missing content at index ${event.content_index}`);
|
|
22695
|
+
}
|
|
22696
|
+
getContent(content, event.content_index);
|
|
22697
|
+
content[event.content_index] = structuredClone(part);
|
|
22698
|
+
}
|
|
22699
|
+
break;
|
|
22700
|
+
}
|
|
22701
|
+
case "response.output_text.delta": {
|
|
22702
|
+
const output = getOutput(snapshot, event.output_index);
|
|
22703
|
+
if (output.type === "message") {
|
|
22704
|
+
const content = getContent(output.content, event.content_index);
|
|
22705
|
+
if (content.type !== "output_text") {
|
|
22706
|
+
throw new OpenAIError(`expected content to be 'output_text', got ${content.type}`);
|
|
22707
|
+
}
|
|
22708
|
+
content.text += event.delta;
|
|
22709
|
+
snapshot.output_text += event.delta;
|
|
22710
|
+
}
|
|
22711
|
+
break;
|
|
22712
|
+
}
|
|
22713
|
+
case "response.output_text.done": {
|
|
22714
|
+
const output = getOutput(snapshot, event.output_index);
|
|
22715
|
+
if (output.type === "message") {
|
|
22716
|
+
const content = getContent(output.content, event.content_index);
|
|
22717
|
+
if (content.type !== "output_text") {
|
|
22718
|
+
throw new OpenAIError(`expected content to be 'output_text', got ${content.type}`);
|
|
22719
|
+
}
|
|
22720
|
+
content.text = event.text;
|
|
22721
|
+
addOutputText(snapshot);
|
|
22722
|
+
}
|
|
22723
|
+
break;
|
|
22724
|
+
}
|
|
22725
|
+
case "response.output_text.annotation.added": {
|
|
22726
|
+
const output = getOutput(snapshot, event.output_index);
|
|
22727
|
+
if (output.type === "message") {
|
|
22728
|
+
const content = getContent(output.content, event.content_index);
|
|
22729
|
+
if (content.type !== "output_text") {
|
|
22730
|
+
throw new OpenAIError(`expected content to be 'output_text', got ${content.type}`);
|
|
22731
|
+
}
|
|
22732
|
+
content.annotations[event.annotation_index] = structuredClone(event.annotation);
|
|
22733
|
+
}
|
|
22734
|
+
break;
|
|
22735
|
+
}
|
|
22736
|
+
case "response.refusal.delta": {
|
|
22737
|
+
const output = getOutput(snapshot, event.output_index);
|
|
22738
|
+
if (output.type === "message") {
|
|
22739
|
+
const content = getContent(output.content, event.content_index);
|
|
22740
|
+
if (content.type !== "refusal") {
|
|
22741
|
+
throw new OpenAIError(`expected content to be 'refusal', got ${content.type}`);
|
|
22742
|
+
}
|
|
22743
|
+
content.refusal += event.delta;
|
|
22744
|
+
}
|
|
22745
|
+
break;
|
|
22746
|
+
}
|
|
22747
|
+
case "response.refusal.done": {
|
|
22748
|
+
const output = getOutput(snapshot, event.output_index);
|
|
22749
|
+
if (output.type === "message") {
|
|
22750
|
+
const content = getContent(output.content, event.content_index);
|
|
22751
|
+
if (content.type !== "refusal") {
|
|
22752
|
+
throw new OpenAIError(`expected content to be 'refusal', got ${content.type}`);
|
|
22753
|
+
}
|
|
22754
|
+
content.refusal = event.refusal;
|
|
22755
|
+
}
|
|
22756
|
+
break;
|
|
22757
|
+
}
|
|
22758
|
+
case "response.function_call_arguments.delta": {
|
|
22759
|
+
const output = getOutput(snapshot, event.output_index);
|
|
22760
|
+
if (output.type === "function_call") {
|
|
22761
|
+
output.arguments += event.delta;
|
|
22762
|
+
}
|
|
22763
|
+
break;
|
|
22764
|
+
}
|
|
22765
|
+
case "response.function_call_arguments.done": {
|
|
22766
|
+
const output = getOutput(snapshot, event.output_index);
|
|
22767
|
+
if (output.type === "function_call") {
|
|
22768
|
+
output.arguments = event.arguments;
|
|
22769
|
+
}
|
|
22770
|
+
break;
|
|
22771
|
+
}
|
|
22772
|
+
case "response.reasoning_text.delta": {
|
|
22773
|
+
const output = getOutput(snapshot, event.output_index);
|
|
22774
|
+
if (output.type === "reasoning") {
|
|
22775
|
+
if (!output.content) {
|
|
22776
|
+
throw new OpenAIError(`missing content at index ${event.content_index}`);
|
|
22777
|
+
}
|
|
22778
|
+
const content = getContent(output.content, event.content_index);
|
|
22779
|
+
if (content.type !== "reasoning_text") {
|
|
22780
|
+
throw new OpenAIError(`expected content to be 'reasoning_text', got ${content.type}`);
|
|
22781
|
+
}
|
|
22782
|
+
content.text += event.delta;
|
|
22783
|
+
}
|
|
22784
|
+
break;
|
|
22785
|
+
}
|
|
22786
|
+
case "response.reasoning_text.done": {
|
|
22787
|
+
const output = getOutput(snapshot, event.output_index);
|
|
22788
|
+
if (output.type === "reasoning") {
|
|
22789
|
+
if (!output.content) {
|
|
22790
|
+
throw new OpenAIError(`missing content at index ${event.content_index}`);
|
|
22791
|
+
}
|
|
22792
|
+
const content = getContent(output.content, event.content_index);
|
|
22793
|
+
if (content.type !== "reasoning_text") {
|
|
22794
|
+
throw new OpenAIError(`expected content to be 'reasoning_text', got ${content.type}`);
|
|
22795
|
+
}
|
|
22796
|
+
content.text = event.text;
|
|
22797
|
+
}
|
|
22798
|
+
break;
|
|
22799
|
+
}
|
|
22800
|
+
case "response.reasoning_summary_part.added": {
|
|
22801
|
+
const output = getOutput(snapshot, event.output_index);
|
|
22802
|
+
if (output.type === "reasoning") {
|
|
22803
|
+
output.summary.push(structuredClone(event.part));
|
|
22804
|
+
}
|
|
22805
|
+
break;
|
|
22806
|
+
}
|
|
22807
|
+
case "response.reasoning_summary_part.done": {
|
|
22808
|
+
const output = getOutput(snapshot, event.output_index);
|
|
22809
|
+
if (output.type === "reasoning") {
|
|
22810
|
+
getContent(output.summary, event.summary_index);
|
|
22811
|
+
output.summary[event.summary_index] = structuredClone(event.part);
|
|
22812
|
+
}
|
|
22813
|
+
break;
|
|
22814
|
+
}
|
|
22815
|
+
case "response.reasoning_summary_text.delta": {
|
|
22816
|
+
const output = getOutput(snapshot, event.output_index);
|
|
22817
|
+
if (output.type === "reasoning") {
|
|
22818
|
+
const part = getContent(output.summary, event.summary_index);
|
|
22819
|
+
part.text += event.delta;
|
|
22820
|
+
}
|
|
22821
|
+
break;
|
|
22822
|
+
}
|
|
22823
|
+
case "response.reasoning_summary_text.done": {
|
|
22824
|
+
const output = getOutput(snapshot, event.output_index);
|
|
22825
|
+
if (output.type === "reasoning") {
|
|
22826
|
+
const part = getContent(output.summary, event.summary_index);
|
|
22827
|
+
part.text = event.text;
|
|
22828
|
+
}
|
|
22829
|
+
break;
|
|
22830
|
+
}
|
|
22831
|
+
case "response.custom_tool_call_input.delta": {
|
|
22832
|
+
const output = getOutput(snapshot, event.output_index);
|
|
22833
|
+
if (output.type === "custom_tool_call") {
|
|
22834
|
+
output.input += event.delta;
|
|
22835
|
+
}
|
|
22836
|
+
break;
|
|
22837
|
+
}
|
|
22838
|
+
case "response.custom_tool_call_input.done": {
|
|
22839
|
+
const output = getOutput(snapshot, event.output_index);
|
|
22840
|
+
if (output.type === "custom_tool_call") {
|
|
22841
|
+
output.input = event.input;
|
|
22842
|
+
}
|
|
22843
|
+
break;
|
|
22844
|
+
}
|
|
22845
|
+
case "response.mcp_call_arguments.delta": {
|
|
22846
|
+
const output = getOutput(snapshot, event.output_index);
|
|
22847
|
+
if (output.type === "mcp_call") {
|
|
22848
|
+
output.arguments += event.delta;
|
|
22849
|
+
}
|
|
22850
|
+
break;
|
|
22851
|
+
}
|
|
22852
|
+
case "response.mcp_call_arguments.done": {
|
|
22853
|
+
const output = getOutput(snapshot, event.output_index);
|
|
22854
|
+
if (output.type === "mcp_call") {
|
|
22855
|
+
output.arguments = event.arguments;
|
|
22856
|
+
}
|
|
22857
|
+
break;
|
|
22858
|
+
}
|
|
22859
|
+
case "response.code_interpreter_call_code.delta": {
|
|
22860
|
+
const output = getOutput(snapshot, event.output_index);
|
|
22861
|
+
if (output.type === "code_interpreter_call") {
|
|
22862
|
+
output.code = (output.code ?? "") + event.delta;
|
|
22863
|
+
}
|
|
22864
|
+
break;
|
|
22865
|
+
}
|
|
22866
|
+
case "response.code_interpreter_call_code.done": {
|
|
22867
|
+
const output = getOutput(snapshot, event.output_index);
|
|
22868
|
+
if (output.type === "code_interpreter_call") {
|
|
22869
|
+
output.code = event.code;
|
|
22870
|
+
}
|
|
22871
|
+
break;
|
|
22872
|
+
}
|
|
22873
|
+
case "response.code_interpreter_call.in_progress": {
|
|
22874
|
+
const output = getOutput(snapshot, event.output_index);
|
|
22875
|
+
if (output.type === "code_interpreter_call") {
|
|
22876
|
+
output.status = "in_progress";
|
|
22877
|
+
}
|
|
22878
|
+
break;
|
|
22879
|
+
}
|
|
22880
|
+
case "response.code_interpreter_call.interpreting": {
|
|
22881
|
+
const output = getOutput(snapshot, event.output_index);
|
|
22882
|
+
if (output.type === "code_interpreter_call") {
|
|
22883
|
+
output.status = "interpreting";
|
|
22884
|
+
}
|
|
22885
|
+
break;
|
|
22886
|
+
}
|
|
22887
|
+
case "response.code_interpreter_call.completed": {
|
|
22888
|
+
const output = getOutput(snapshot, event.output_index);
|
|
22889
|
+
if (output.type === "code_interpreter_call") {
|
|
22890
|
+
output.status = "completed";
|
|
22891
|
+
}
|
|
22892
|
+
break;
|
|
22893
|
+
}
|
|
22894
|
+
case "response.file_search_call.in_progress": {
|
|
22895
|
+
const output = getOutput(snapshot, event.output_index);
|
|
22896
|
+
if (output.type === "file_search_call") {
|
|
22897
|
+
output.status = "in_progress";
|
|
22898
|
+
}
|
|
22899
|
+
break;
|
|
22900
|
+
}
|
|
22901
|
+
case "response.file_search_call.searching": {
|
|
22902
|
+
const output = getOutput(snapshot, event.output_index);
|
|
22903
|
+
if (output.type === "file_search_call") {
|
|
22904
|
+
output.status = "searching";
|
|
22905
|
+
}
|
|
22906
|
+
break;
|
|
22907
|
+
}
|
|
22908
|
+
case "response.file_search_call.completed": {
|
|
22909
|
+
const output = getOutput(snapshot, event.output_index);
|
|
22910
|
+
if (output.type === "file_search_call") {
|
|
22911
|
+
output.status = "completed";
|
|
22912
|
+
}
|
|
22913
|
+
break;
|
|
22914
|
+
}
|
|
22915
|
+
case "response.web_search_call.in_progress": {
|
|
22916
|
+
const output = getOutput(snapshot, event.output_index);
|
|
22917
|
+
if (output.type === "web_search_call") {
|
|
22918
|
+
output.status = "in_progress";
|
|
22919
|
+
}
|
|
22920
|
+
break;
|
|
22921
|
+
}
|
|
22922
|
+
case "response.web_search_call.searching": {
|
|
22923
|
+
const output = getOutput(snapshot, event.output_index);
|
|
22924
|
+
if (output.type === "web_search_call") {
|
|
22925
|
+
output.status = "searching";
|
|
22926
|
+
}
|
|
22927
|
+
break;
|
|
22928
|
+
}
|
|
22929
|
+
case "response.web_search_call.completed": {
|
|
22930
|
+
const output = getOutput(snapshot, event.output_index);
|
|
22931
|
+
if (output.type === "web_search_call") {
|
|
22932
|
+
output.status = "completed";
|
|
22933
|
+
}
|
|
22934
|
+
break;
|
|
22935
|
+
}
|
|
22936
|
+
case "response.image_generation_call.in_progress": {
|
|
22937
|
+
const output = getOutput(snapshot, event.output_index);
|
|
22938
|
+
if (output.type === "image_generation_call") {
|
|
22939
|
+
output.status = "in_progress";
|
|
22940
|
+
}
|
|
22941
|
+
break;
|
|
22942
|
+
}
|
|
22943
|
+
case "response.image_generation_call.generating": {
|
|
22944
|
+
const output = getOutput(snapshot, event.output_index);
|
|
22945
|
+
if (output.type === "image_generation_call") {
|
|
22946
|
+
output.status = "generating";
|
|
22947
|
+
}
|
|
22948
|
+
break;
|
|
22949
|
+
}
|
|
22950
|
+
case "response.image_generation_call.completed": {
|
|
22951
|
+
const output = getOutput(snapshot, event.output_index);
|
|
22952
|
+
if (output.type === "image_generation_call") {
|
|
22953
|
+
output.status = "completed";
|
|
22954
|
+
}
|
|
22955
|
+
break;
|
|
22956
|
+
}
|
|
22957
|
+
case "response.mcp_call.in_progress": {
|
|
22958
|
+
const output = getOutput(snapshot, event.output_index);
|
|
22959
|
+
if (output.type === "mcp_call") {
|
|
22960
|
+
output.status = "in_progress";
|
|
22961
|
+
}
|
|
22962
|
+
break;
|
|
22963
|
+
}
|
|
22964
|
+
case "response.mcp_call.completed": {
|
|
22965
|
+
const output = getOutput(snapshot, event.output_index);
|
|
22966
|
+
if (output.type === "mcp_call") {
|
|
22967
|
+
output.status = "completed";
|
|
22968
|
+
}
|
|
22969
|
+
break;
|
|
22970
|
+
}
|
|
22971
|
+
case "response.mcp_call.failed": {
|
|
22972
|
+
const output = getOutput(snapshot, event.output_index);
|
|
22973
|
+
if (output.type === "mcp_call") {
|
|
22974
|
+
output.status = "failed";
|
|
22975
|
+
}
|
|
22976
|
+
break;
|
|
22977
|
+
}
|
|
22978
|
+
case "response.created":
|
|
22979
|
+
case "response.queued":
|
|
22980
|
+
case "response.in_progress":
|
|
22981
|
+
case "response.completed":
|
|
22982
|
+
case "response.failed":
|
|
22983
|
+
case "response.incomplete": {
|
|
22984
|
+
snapshot = cloneResponse(event.response);
|
|
22985
|
+
break;
|
|
22986
|
+
}
|
|
22987
|
+
case "response.audio.delta":
|
|
22988
|
+
case "response.audio.done":
|
|
22989
|
+
case "response.audio.transcript.delta":
|
|
22990
|
+
case "response.audio.transcript.done":
|
|
22991
|
+
case "response.image_generation_call.partial_image":
|
|
22992
|
+
case "response.mcp_list_tools.in_progress":
|
|
22993
|
+
case "response.mcp_list_tools.completed":
|
|
22994
|
+
case "response.mcp_list_tools.failed":
|
|
22995
|
+
case "keepalive":
|
|
22996
|
+
case "error": {
|
|
22997
|
+
break;
|
|
22998
|
+
}
|
|
22999
|
+
default: {
|
|
23000
|
+
assertNever3(event);
|
|
23001
|
+
}
|
|
23002
|
+
}
|
|
23003
|
+
return snapshot;
|
|
23004
|
+
}
|
|
23005
|
+
function cloneResponse(response) {
|
|
23006
|
+
const snapshot = structuredClone(response);
|
|
23007
|
+
if (!Object.getOwnPropertyDescriptor(snapshot, "output_text") || snapshot.output_text == null) {
|
|
23008
|
+
addOutputText(snapshot);
|
|
23009
|
+
}
|
|
23010
|
+
return snapshot;
|
|
23011
|
+
}
|
|
23012
|
+
function getOutput(snapshot, outputIndex) {
|
|
23013
|
+
const output = snapshot.output[outputIndex];
|
|
23014
|
+
if (!output) {
|
|
23015
|
+
throw new OpenAIError(`missing output at index ${outputIndex}`);
|
|
23016
|
+
}
|
|
23017
|
+
return output;
|
|
23018
|
+
}
|
|
23019
|
+
function getContent(content, contentIndex) {
|
|
23020
|
+
const part = content[contentIndex];
|
|
23021
|
+
if (!part) {
|
|
23022
|
+
throw new OpenAIError(`missing content at index ${contentIndex}`);
|
|
23023
|
+
}
|
|
23024
|
+
return part;
|
|
23025
|
+
}
|
|
23026
|
+
function assertNever3(value) {
|
|
23027
|
+
throw new OpenAIError(`Unhandled response stream event: ${JSON.stringify(value)}`);
|
|
23028
|
+
}
|
|
23029
|
+
var init_ResponseAccumulator = __esm(() => {
|
|
23030
|
+
init_error2();
|
|
23031
|
+
init_ResponsesParser();
|
|
23032
|
+
});
|
|
23033
|
+
|
|
21562
23034
|
// node_modules/openai/lib/responses/ResponseStream.mjs
|
|
21563
23035
|
function finalizeResponse(snapshot, params) {
|
|
21564
23036
|
return maybeParseResponse(snapshot, params);
|
|
21565
23037
|
}
|
|
21566
|
-
var _ResponseStream_instances, _ResponseStream_params, _ResponseStream_currentResponseSnapshot, _ResponseStream_finalResponse, _ResponseStream_beginRequest, _ResponseStream_addEvent, _ResponseStream_endRequest,
|
|
23038
|
+
var _ResponseStream_instances, _ResponseStream_params, _ResponseStream_currentResponseSnapshot, _ResponseStream_finalResponse, _ResponseStream_beginRequest, _ResponseStream_addEvent, _ResponseStream_endRequest, ResponseStream;
|
|
21567
23039
|
var init_ResponseStream = __esm(() => {
|
|
21568
23040
|
init_tslib();
|
|
21569
23041
|
init_error2();
|
|
21570
23042
|
init_EventStream();
|
|
23043
|
+
init_ResponseAccumulator();
|
|
21571
23044
|
init_ResponsesParser();
|
|
23045
|
+
init_streaming2();
|
|
21572
23046
|
ResponseStream = class ResponseStream extends EventStream {
|
|
21573
23047
|
constructor(params) {
|
|
21574
23048
|
super();
|
|
@@ -21586,13 +23060,13 @@ var init_ResponseStream = __esm(() => {
|
|
|
21586
23060
|
}));
|
|
21587
23061
|
return runner;
|
|
21588
23062
|
}
|
|
23063
|
+
static fromReadableStream(stream) {
|
|
23064
|
+
const runner = new ResponseStream(null);
|
|
23065
|
+
runner._run(() => runner._fromReadableStream(stream));
|
|
23066
|
+
return runner;
|
|
23067
|
+
}
|
|
21589
23068
|
async _createOrRetrieveResponse(client, params, options) {
|
|
21590
|
-
|
|
21591
|
-
if (signal) {
|
|
21592
|
-
if (signal.aborted)
|
|
21593
|
-
this.controller.abort();
|
|
21594
|
-
signal.addEventListener("abort", () => this.controller.abort());
|
|
21595
|
-
}
|
|
23069
|
+
this._listenForAbort(options?.signal);
|
|
21596
23070
|
__classPrivateFieldGet(this, _ResponseStream_instances, "m", _ResponseStream_beginRequest).call(this);
|
|
21597
23071
|
let stream;
|
|
21598
23072
|
let starting_after = null;
|
|
@@ -21611,6 +23085,19 @@ var init_ResponseStream = __esm(() => {
|
|
|
21611
23085
|
}
|
|
21612
23086
|
return __classPrivateFieldGet(this, _ResponseStream_instances, "m", _ResponseStream_endRequest).call(this);
|
|
21613
23087
|
}
|
|
23088
|
+
async _fromReadableStream(readableStream, options) {
|
|
23089
|
+
this._listenForAbort(options?.signal);
|
|
23090
|
+
__classPrivateFieldGet(this, _ResponseStream_instances, "m", _ResponseStream_beginRequest).call(this);
|
|
23091
|
+
this._connected();
|
|
23092
|
+
const stream = Stream.fromReadableStream(readableStream, this.controller);
|
|
23093
|
+
for await (const event of stream) {
|
|
23094
|
+
__classPrivateFieldGet(this, _ResponseStream_instances, "m", _ResponseStream_addEvent).call(this, event, null);
|
|
23095
|
+
}
|
|
23096
|
+
if (stream.controller.signal?.aborted) {
|
|
23097
|
+
throw new APIUserAbortError;
|
|
23098
|
+
}
|
|
23099
|
+
return __classPrivateFieldGet(this, _ResponseStream_instances, "m", _ResponseStream_endRequest).call(this);
|
|
23100
|
+
}
|
|
21614
23101
|
[(_ResponseStream_params = new WeakMap, _ResponseStream_currentResponseSnapshot = new WeakMap, _ResponseStream_finalResponse = new WeakMap, _ResponseStream_instances = new WeakSet, _ResponseStream_beginRequest = function _ResponseStream_beginRequest2() {
|
|
21615
23102
|
if (this.ended)
|
|
21616
23103
|
return;
|
|
@@ -21623,7 +23110,8 @@ var init_ResponseStream = __esm(() => {
|
|
|
21623
23110
|
this._emit(name, event);
|
|
21624
23111
|
}
|
|
21625
23112
|
};
|
|
21626
|
-
const response = __classPrivateFieldGet(this,
|
|
23113
|
+
const response = accumulateResponse(event, __classPrivateFieldGet(this, _ResponseStream_currentResponseSnapshot, "f"));
|
|
23114
|
+
__classPrivateFieldSet(this, _ResponseStream_currentResponseSnapshot, response, "f");
|
|
21627
23115
|
maybeEmit("event", event);
|
|
21628
23116
|
switch (event.type) {
|
|
21629
23117
|
case "response.output_text.delta": {
|
|
@@ -21675,87 +23163,6 @@ var init_ResponseStream = __esm(() => {
|
|
|
21675
23163
|
const parsedResponse = finalizeResponse(snapshot, __classPrivateFieldGet(this, _ResponseStream_params, "f"));
|
|
21676
23164
|
__classPrivateFieldSet(this, _ResponseStream_finalResponse, parsedResponse, "f");
|
|
21677
23165
|
return parsedResponse;
|
|
21678
|
-
}, _ResponseStream_accumulateResponse = function _ResponseStream_accumulateResponse2(event) {
|
|
21679
|
-
let snapshot = __classPrivateFieldGet(this, _ResponseStream_currentResponseSnapshot, "f");
|
|
21680
|
-
if (!snapshot) {
|
|
21681
|
-
if (event.type !== "response.created") {
|
|
21682
|
-
throw new OpenAIError(`When snapshot hasn't been set yet, expected 'response.created' event, got ${event.type}`);
|
|
21683
|
-
}
|
|
21684
|
-
snapshot = __classPrivateFieldSet(this, _ResponseStream_currentResponseSnapshot, event.response, "f");
|
|
21685
|
-
return snapshot;
|
|
21686
|
-
}
|
|
21687
|
-
switch (event.type) {
|
|
21688
|
-
case "response.output_item.added": {
|
|
21689
|
-
snapshot.output.push(event.item);
|
|
21690
|
-
break;
|
|
21691
|
-
}
|
|
21692
|
-
case "response.content_part.added": {
|
|
21693
|
-
const output = snapshot.output[event.output_index];
|
|
21694
|
-
if (!output) {
|
|
21695
|
-
throw new OpenAIError(`missing output at index ${event.output_index}`);
|
|
21696
|
-
}
|
|
21697
|
-
const type = output.type;
|
|
21698
|
-
const part = event.part;
|
|
21699
|
-
if (type === "message" && part.type !== "reasoning_text") {
|
|
21700
|
-
output.content.push(part);
|
|
21701
|
-
} else if (type === "reasoning" && part.type === "reasoning_text") {
|
|
21702
|
-
if (!output.content) {
|
|
21703
|
-
output.content = [];
|
|
21704
|
-
}
|
|
21705
|
-
output.content.push(part);
|
|
21706
|
-
}
|
|
21707
|
-
break;
|
|
21708
|
-
}
|
|
21709
|
-
case "response.output_text.delta": {
|
|
21710
|
-
const output = snapshot.output[event.output_index];
|
|
21711
|
-
if (!output) {
|
|
21712
|
-
throw new OpenAIError(`missing output at index ${event.output_index}`);
|
|
21713
|
-
}
|
|
21714
|
-
if (output.type === "message") {
|
|
21715
|
-
const content = output.content[event.content_index];
|
|
21716
|
-
if (!content) {
|
|
21717
|
-
throw new OpenAIError(`missing content at index ${event.content_index}`);
|
|
21718
|
-
}
|
|
21719
|
-
if (content.type !== "output_text") {
|
|
21720
|
-
throw new OpenAIError(`expected content to be 'output_text', got ${content.type}`);
|
|
21721
|
-
}
|
|
21722
|
-
content.text += event.delta;
|
|
21723
|
-
}
|
|
21724
|
-
break;
|
|
21725
|
-
}
|
|
21726
|
-
case "response.function_call_arguments.delta": {
|
|
21727
|
-
const output = snapshot.output[event.output_index];
|
|
21728
|
-
if (!output) {
|
|
21729
|
-
throw new OpenAIError(`missing output at index ${event.output_index}`);
|
|
21730
|
-
}
|
|
21731
|
-
if (output.type === "function_call") {
|
|
21732
|
-
output.arguments += event.delta;
|
|
21733
|
-
}
|
|
21734
|
-
break;
|
|
21735
|
-
}
|
|
21736
|
-
case "response.reasoning_text.delta": {
|
|
21737
|
-
const output = snapshot.output[event.output_index];
|
|
21738
|
-
if (!output) {
|
|
21739
|
-
throw new OpenAIError(`missing output at index ${event.output_index}`);
|
|
21740
|
-
}
|
|
21741
|
-
if (output.type === "reasoning") {
|
|
21742
|
-
const content = output.content?.[event.content_index];
|
|
21743
|
-
if (!content) {
|
|
21744
|
-
throw new OpenAIError(`missing content at index ${event.content_index}`);
|
|
21745
|
-
}
|
|
21746
|
-
if (content.type !== "reasoning_text") {
|
|
21747
|
-
throw new OpenAIError(`expected content to be 'reasoning_text', got ${content.type}`);
|
|
21748
|
-
}
|
|
21749
|
-
content.text += event.delta;
|
|
21750
|
-
}
|
|
21751
|
-
break;
|
|
21752
|
-
}
|
|
21753
|
-
case "response.completed": {
|
|
21754
|
-
__classPrivateFieldSet(this, _ResponseStream_currentResponseSnapshot, event.response, "f");
|
|
21755
|
-
break;
|
|
21756
|
-
}
|
|
21757
|
-
}
|
|
21758
|
-
return snapshot;
|
|
21759
23166
|
}, Symbol.asyncIterator)]() {
|
|
21760
23167
|
const pushQueue = [];
|
|
21761
23168
|
const readQueue = [];
|
|
@@ -21817,12 +23224,12 @@ var init_ResponseStream = __esm(() => {
|
|
|
21817
23224
|
});
|
|
21818
23225
|
|
|
21819
23226
|
// node_modules/openai/resources/responses/input-items.mjs
|
|
21820
|
-
var
|
|
21821
|
-
var
|
|
23227
|
+
var InputItems2;
|
|
23228
|
+
var init_input_items2 = __esm(() => {
|
|
21822
23229
|
init_resource();
|
|
21823
23230
|
init_pagination();
|
|
21824
23231
|
init_path();
|
|
21825
|
-
|
|
23232
|
+
InputItems2 = class InputItems2 extends APIResource {
|
|
21826
23233
|
list(responseID, query = {}, options) {
|
|
21827
23234
|
return this._client.getAPIList(path3`/responses/${responseID}/input_items`, CursorPage, { query, ...options, __security: { bearerAuth: true } });
|
|
21828
23235
|
}
|
|
@@ -21830,10 +23237,10 @@ var init_input_items = __esm(() => {
|
|
|
21830
23237
|
});
|
|
21831
23238
|
|
|
21832
23239
|
// node_modules/openai/resources/responses/input-tokens.mjs
|
|
21833
|
-
var
|
|
21834
|
-
var
|
|
23240
|
+
var InputTokens2;
|
|
23241
|
+
var init_input_tokens2 = __esm(() => {
|
|
21835
23242
|
init_resource();
|
|
21836
|
-
|
|
23243
|
+
InputTokens2 = class InputTokens2 extends APIResource {
|
|
21837
23244
|
count(body = {}, options) {
|
|
21838
23245
|
return this._client.post("/responses/input_tokens", {
|
|
21839
23246
|
body,
|
|
@@ -21845,22 +23252,22 @@ var init_input_tokens = __esm(() => {
|
|
|
21845
23252
|
});
|
|
21846
23253
|
|
|
21847
23254
|
// node_modules/openai/resources/responses/responses.mjs
|
|
21848
|
-
var
|
|
21849
|
-
var
|
|
23255
|
+
var Responses2;
|
|
23256
|
+
var init_responses2 = __esm(() => {
|
|
21850
23257
|
init_ResponsesParser();
|
|
21851
23258
|
init_ResponseStream();
|
|
21852
23259
|
init_resource();
|
|
21853
|
-
|
|
21854
|
-
|
|
21855
|
-
|
|
21856
|
-
|
|
23260
|
+
init_input_items2();
|
|
23261
|
+
init_input_items2();
|
|
23262
|
+
init_input_tokens2();
|
|
23263
|
+
init_input_tokens2();
|
|
21857
23264
|
init_headers();
|
|
21858
23265
|
init_path();
|
|
21859
|
-
|
|
23266
|
+
Responses2 = class Responses2 extends APIResource {
|
|
21860
23267
|
constructor() {
|
|
21861
23268
|
super(...arguments);
|
|
21862
|
-
this.inputItems = new
|
|
21863
|
-
this.inputTokens = new
|
|
23269
|
+
this.inputItems = new InputItems2(this._client);
|
|
23270
|
+
this.inputTokens = new InputTokens2(this._client);
|
|
21864
23271
|
}
|
|
21865
23272
|
create(body, options) {
|
|
21866
23273
|
return this._client.post("/responses", {
|
|
@@ -21911,8 +23318,8 @@ var init_responses = __esm(() => {
|
|
|
21911
23318
|
return this._client.post("/responses/compact", { body, ...options, __security: { bearerAuth: true } });
|
|
21912
23319
|
}
|
|
21913
23320
|
};
|
|
21914
|
-
|
|
21915
|
-
|
|
23321
|
+
Responses2.InputItems = InputItems2;
|
|
23322
|
+
Responses2.InputTokens = InputTokens2;
|
|
21916
23323
|
});
|
|
21917
23324
|
|
|
21918
23325
|
// node_modules/openai/resources/skills/content.mjs
|
|
@@ -22541,7 +23948,7 @@ var init_resources = __esm(() => {
|
|
|
22541
23948
|
init_models();
|
|
22542
23949
|
init_moderations();
|
|
22543
23950
|
init_realtime2();
|
|
22544
|
-
|
|
23951
|
+
init_responses2();
|
|
22545
23952
|
init_skills();
|
|
22546
23953
|
init_uploads3();
|
|
22547
23954
|
init_vector_stores();
|
|
@@ -22551,9 +23958,28 @@ var init_resources = __esm(() => {
|
|
|
22551
23958
|
init_shared();
|
|
22552
23959
|
});
|
|
22553
23960
|
|
|
23961
|
+
// node_modules/openai/internal/provider.mjs
|
|
23962
|
+
function configureProvider(provider) {
|
|
23963
|
+
const definition = providerDefinitions.get(provider);
|
|
23964
|
+
if (!definition) {
|
|
23965
|
+
throw new Error("Invalid provider. Providers must be created with createProvider().");
|
|
23966
|
+
}
|
|
23967
|
+
return definition.configure();
|
|
23968
|
+
}
|
|
23969
|
+
var providerDefinitionsKey, providerGlobal, existingProviderDefinitions, providerDefinitions;
|
|
23970
|
+
var init_provider = __esm(() => {
|
|
23971
|
+
providerDefinitionsKey = Symbol.for("openai.node.providerDefinitions.v1");
|
|
23972
|
+
providerGlobal = globalThis;
|
|
23973
|
+
existingProviderDefinitions = providerGlobal[providerDefinitionsKey];
|
|
23974
|
+
providerDefinitions = existingProviderDefinitions ?? new WeakMap;
|
|
23975
|
+
if (!existingProviderDefinitions) {
|
|
23976
|
+
Object.defineProperty(providerGlobal, providerDefinitionsKey, { value: providerDefinitions });
|
|
23977
|
+
}
|
|
23978
|
+
});
|
|
23979
|
+
|
|
22554
23980
|
// node_modules/openai/client.mjs
|
|
22555
23981
|
class OpenAI2 {
|
|
22556
|
-
constructor(
|
|
23982
|
+
constructor(clientOptions = {}) {
|
|
22557
23983
|
_OpenAI_instances.add(this);
|
|
22558
23984
|
_OpenAI_encoder.set(this, undefined);
|
|
22559
23985
|
this.completions = new Completions2(this);
|
|
@@ -22572,13 +23998,22 @@ class OpenAI2 {
|
|
|
22572
23998
|
this.batches = new Batches(this);
|
|
22573
23999
|
this.uploads = new Uploads(this);
|
|
22574
24000
|
this.admin = new Admin(this);
|
|
22575
|
-
this.responses = new
|
|
24001
|
+
this.responses = new Responses2(this);
|
|
22576
24002
|
this.realtime = new Realtime2(this);
|
|
22577
24003
|
this.conversations = new Conversations(this);
|
|
22578
24004
|
this.evals = new Evals(this);
|
|
22579
24005
|
this.containers = new Containers(this);
|
|
22580
24006
|
this.skills = new Skills(this);
|
|
22581
24007
|
this.videos = new Videos(this);
|
|
24008
|
+
const provider = clientOptions.provider;
|
|
24009
|
+
if (provider) {
|
|
24010
|
+
const conflictingOptions = ["apiKey", "adminAPIKey", "workloadIdentity", "baseURL"].filter((key) => clientOptions[key] != null);
|
|
24011
|
+
if (conflictingOptions.length) {
|
|
24012
|
+
throw new OpenAIError(`The \`provider\` option cannot be used with ${conflictingOptions.map((key) => `\`${key}\``).join(", ")}. Configure authentication and the base URL through the provider instead.`);
|
|
24013
|
+
}
|
|
24014
|
+
}
|
|
24015
|
+
const { baseURL = provider ? null : readEnv("OPENAI_BASE_URL"), apiKey = provider ? null : readEnv("OPENAI_API_KEY") ?? null, adminAPIKey = provider ? null : readEnv("OPENAI_ADMIN_KEY") ?? null, organization = provider ? null : readEnv("OPENAI_ORG_ID") ?? null, project = provider ? null : readEnv("OPENAI_PROJECT_ID") ?? null, webhookSecret = readEnv("OPENAI_WEBHOOK_SECRET") ?? null, workloadIdentity, ...opts } = clientOptions;
|
|
24016
|
+
const providerRuntime = provider ? configureProvider(provider) : undefined;
|
|
22582
24017
|
const options = {
|
|
22583
24018
|
apiKey,
|
|
22584
24019
|
adminAPIKey,
|
|
@@ -22586,13 +24021,14 @@ class OpenAI2 {
|
|
|
22586
24021
|
project,
|
|
22587
24022
|
webhookSecret,
|
|
22588
24023
|
workloadIdentity,
|
|
24024
|
+
provider,
|
|
22589
24025
|
...opts,
|
|
22590
|
-
baseURL: baseURL || `https://api.openai.com/v1`
|
|
24026
|
+
baseURL: providerRuntime?.baseURL ?? (baseURL || `https://api.openai.com/v1`)
|
|
22591
24027
|
};
|
|
22592
24028
|
if (apiKey && workloadIdentity) {
|
|
22593
24029
|
throw new OpenAIError("The `apiKey` and `workloadIdentity` options are mutually exclusive");
|
|
22594
24030
|
}
|
|
22595
|
-
if (!apiKey && !adminAPIKey && !workloadIdentity) {
|
|
24031
|
+
if (!providerRuntime && !apiKey && !adminAPIKey && !workloadIdentity) {
|
|
22596
24032
|
throw new OpenAIError("Missing credentials. Please pass an `apiKey`, `workloadIdentity`, `adminAPIKey`, or set the `OPENAI_API_KEY` or `OPENAI_ADMIN_KEY` environment variable.");
|
|
22597
24033
|
}
|
|
22598
24034
|
if (!options.dangerouslyAllowBrowser && isRunningInBrowser()) {
|
|
@@ -22617,7 +24053,7 @@ https://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety
|
|
|
22617
24053
|
this.maxRetries = options.maxRetries ?? 2;
|
|
22618
24054
|
this.fetch = options.fetch ?? getDefaultFetch();
|
|
22619
24055
|
__classPrivateFieldSet(this, _OpenAI_encoder, FallbackEncoder, "f");
|
|
22620
|
-
const customHeadersEnv = readEnv("OPENAI_CUSTOM_HEADERS");
|
|
24056
|
+
const customHeadersEnv = provider ? undefined : readEnv("OPENAI_CUSTOM_HEADERS");
|
|
22621
24057
|
if (customHeadersEnv) {
|
|
22622
24058
|
const parsed = {};
|
|
22623
24059
|
for (const line of customHeadersEnv.split(`
|
|
@@ -22630,6 +24066,7 @@ https://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety
|
|
|
22630
24066
|
options.defaultHeaders = buildHeaders([parsed, options.defaultHeaders]);
|
|
22631
24067
|
}
|
|
22632
24068
|
this._options = options;
|
|
24069
|
+
this._provider = providerRuntime;
|
|
22633
24070
|
if (workloadIdentity) {
|
|
22634
24071
|
this._workloadIdentityAuth = new WorkloadIdentityAuth(workloadIdentity, this.fetch);
|
|
22635
24072
|
}
|
|
@@ -22640,7 +24077,9 @@ https://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety
|
|
|
22640
24077
|
this.webhookSecret = webhookSecret;
|
|
22641
24078
|
}
|
|
22642
24079
|
withOptions(options) {
|
|
22643
|
-
const
|
|
24080
|
+
const inheritedProvider = this._options.provider;
|
|
24081
|
+
const provider = options.provider ?? inheritedProvider;
|
|
24082
|
+
const inheritedOptions = {
|
|
22644
24083
|
...this._options,
|
|
22645
24084
|
baseURL: this.baseURL,
|
|
22646
24085
|
maxRetries: this.maxRetries,
|
|
@@ -22654,8 +24093,23 @@ https://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety
|
|
|
22654
24093
|
workloadIdentity: this._options.workloadIdentity,
|
|
22655
24094
|
organization: this.organization,
|
|
22656
24095
|
project: this.project,
|
|
22657
|
-
webhookSecret: this.webhookSecret
|
|
22658
|
-
|
|
24096
|
+
webhookSecret: this.webhookSecret
|
|
24097
|
+
};
|
|
24098
|
+
if (provider) {
|
|
24099
|
+
delete inheritedOptions.apiKey;
|
|
24100
|
+
delete inheritedOptions.adminAPIKey;
|
|
24101
|
+
delete inheritedOptions.workloadIdentity;
|
|
24102
|
+
delete inheritedOptions.baseURL;
|
|
24103
|
+
if (provider !== inheritedProvider) {
|
|
24104
|
+
delete inheritedOptions.organization;
|
|
24105
|
+
delete inheritedOptions.project;
|
|
24106
|
+
delete inheritedOptions.defaultHeaders;
|
|
24107
|
+
}
|
|
24108
|
+
}
|
|
24109
|
+
const client = new this.constructor({
|
|
24110
|
+
...inheritedOptions,
|
|
24111
|
+
...options,
|
|
24112
|
+
provider
|
|
22659
24113
|
});
|
|
22660
24114
|
return client;
|
|
22661
24115
|
}
|
|
@@ -22714,6 +24168,8 @@ https://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety
|
|
|
22714
24168
|
return APIError.generate(status, error, message, headers);
|
|
22715
24169
|
}
|
|
22716
24170
|
async _callApiKey() {
|
|
24171
|
+
if (this._provider)
|
|
24172
|
+
return false;
|
|
22717
24173
|
const apiKey = this._options.apiKey;
|
|
22718
24174
|
if (typeof apiKey !== "function")
|
|
22719
24175
|
return false;
|
|
@@ -22745,6 +24201,8 @@ https://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety
|
|
|
22745
24201
|
return url.toString();
|
|
22746
24202
|
}
|
|
22747
24203
|
async prepareOptions(options) {
|
|
24204
|
+
if (this._provider)
|
|
24205
|
+
return;
|
|
22748
24206
|
const security = options.__security ?? { bearerAuth: true };
|
|
22749
24207
|
if (security.bearerAuth) {
|
|
22750
24208
|
await this._callApiKey();
|
|
@@ -22784,7 +24242,9 @@ https://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety
|
|
|
22784
24242
|
const { req, url, timeout } = await this.buildRequest(options, {
|
|
22785
24243
|
retryCount: maxRetries - retriesRemaining
|
|
22786
24244
|
});
|
|
24245
|
+
const hasStreamingBody = options.__metadata?.["hasStreamingBody"] === true;
|
|
22787
24246
|
await this.prepareRequest(req, { url, options });
|
|
24247
|
+
await this._provider?.prepareRequest?.(req, { url, options });
|
|
22788
24248
|
const requestLogID = "log_" + (Math.random() * (1 << 24) | 0).toString(16).padStart(6, "0");
|
|
22789
24249
|
const retryLogStr = retryOfRequestLogID === undefined ? "" : `, retryOf: ${retryOfRequestLogID}`;
|
|
22790
24250
|
const startTime = Date.now();
|
|
@@ -22808,7 +24268,7 @@ https://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety
|
|
|
22808
24268
|
throw new APIUserAbortError;
|
|
22809
24269
|
}
|
|
22810
24270
|
const isTimeout = isAbortError(response) || /timed? ?out/i.test(String(response) + ("cause" in response ? String(response.cause) : ""));
|
|
22811
|
-
if (retriesRemaining) {
|
|
24271
|
+
if (retriesRemaining && !hasStreamingBody) {
|
|
22812
24272
|
loggerFor(this).info(`[${requestLogID}] connection ${isTimeout ? "timed out" : "failed"} - ${retryMessage}`);
|
|
22813
24273
|
loggerFor(this).debug(`[${requestLogID}] connection ${isTimeout ? "timed out" : "failed"} (${retryMessage})`, formatRequestDetails({
|
|
22814
24274
|
retryOfRequestLogID,
|
|
@@ -22818,8 +24278,9 @@ https://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety
|
|
|
22818
24278
|
}));
|
|
22819
24279
|
return this.retryRequest(options, retriesRemaining, retryOfRequestLogID ?? requestLogID);
|
|
22820
24280
|
}
|
|
22821
|
-
|
|
22822
|
-
loggerFor(this).
|
|
24281
|
+
const terminalMessage = hasStreamingBody ? "error; streaming body cannot be retried" : "error; no more retries left";
|
|
24282
|
+
loggerFor(this).info(`[${requestLogID}] connection ${isTimeout ? "timed out" : "failed"} - ${terminalMessage}`);
|
|
24283
|
+
loggerFor(this).debug(`[${requestLogID}] connection ${isTimeout ? "timed out" : "failed"} (${terminalMessage})`, formatRequestDetails({
|
|
22823
24284
|
retryOfRequestLogID,
|
|
22824
24285
|
url,
|
|
22825
24286
|
durationMs: headersTime - startTime,
|
|
@@ -22851,7 +24312,7 @@ https://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety
|
|
|
22851
24312
|
}, retriesRemaining, retryOfRequestLogID ?? requestLogID);
|
|
22852
24313
|
}
|
|
22853
24314
|
const shouldRetry = await this.shouldRetry(response);
|
|
22854
|
-
if (retriesRemaining && shouldRetry) {
|
|
24315
|
+
if (retriesRemaining && shouldRetry && !hasStreamingBody) {
|
|
22855
24316
|
const retryMessage = `retrying, ${retriesRemaining} attempts remaining`;
|
|
22856
24317
|
await CancelReadableStream(response.body);
|
|
22857
24318
|
loggerFor(this).info(`${responseInfo} - ${retryMessage}`);
|
|
@@ -22864,7 +24325,7 @@ https://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety
|
|
|
22864
24325
|
}));
|
|
22865
24326
|
return this.retryRequest(options, retriesRemaining, retryOfRequestLogID ?? requestLogID, response.headers);
|
|
22866
24327
|
}
|
|
22867
|
-
const retryMessage = shouldRetry ? `error; no more retries left` : `error; not retryable`;
|
|
24328
|
+
const retryMessage = shouldRetry ? hasStreamingBody ? `error; streaming body cannot be retried` : `error; no more retries left` : `error; not retryable`;
|
|
22868
24329
|
loggerFor(this).info(`${responseInfo} - ${retryMessage}`);
|
|
22869
24330
|
const errText = await response.text().catch((err) => castToError(err).message);
|
|
22870
24331
|
const errJSON = safeJSON(errText);
|
|
@@ -23027,19 +24488,25 @@ https://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety
|
|
|
23027
24488
|
"OpenAI-Organization": this.organization,
|
|
23028
24489
|
"OpenAI-Project": this.project
|
|
23029
24490
|
},
|
|
23030
|
-
await this.authHeaders(options, options.__security ?? { bearerAuth: true }),
|
|
24491
|
+
this._provider ? undefined : await this.authHeaders(options, options.__security ?? { bearerAuth: true }),
|
|
23031
24492
|
this._options.defaultHeaders,
|
|
23032
24493
|
bodyHeaders,
|
|
23033
24494
|
options.headers
|
|
23034
24495
|
]);
|
|
23035
|
-
this.
|
|
24496
|
+
if (!this._provider) {
|
|
24497
|
+
this.validateHeaders(headers, options.__security ?? { bearerAuth: true });
|
|
24498
|
+
}
|
|
23036
24499
|
return headers.values;
|
|
23037
24500
|
}
|
|
23038
24501
|
_makeAbort(controller) {
|
|
23039
24502
|
return () => controller.abort();
|
|
23040
24503
|
}
|
|
23041
|
-
buildBody({ options
|
|
24504
|
+
buildBody({ options }) {
|
|
24505
|
+
const { body, headers: rawHeaders } = options;
|
|
23042
24506
|
if (!body) {
|
|
24507
|
+
if (body === undefined && "body" in options) {
|
|
24508
|
+
return { ...__classPrivateFieldGet(this, _OpenAI_encoder, "f").call(this, { body, headers: buildHeaders([rawHeaders]) }), isStreamingBody: false };
|
|
24509
|
+
}
|
|
23043
24510
|
return { bodyHeaders: undefined, body: undefined, isStreamingBody: false };
|
|
23044
24511
|
}
|
|
23045
24512
|
const headers = buildHeaders([rawHeaders]);
|
|
@@ -23118,18 +24585,19 @@ var init_client = __esm(() => {
|
|
|
23118
24585
|
init_fine_tuning();
|
|
23119
24586
|
init_graders2();
|
|
23120
24587
|
init_realtime2();
|
|
23121
|
-
|
|
24588
|
+
init_responses2();
|
|
23122
24589
|
init_skills();
|
|
23123
24590
|
init_uploads3();
|
|
23124
24591
|
init_vector_stores();
|
|
23125
24592
|
init_webhooks();
|
|
23126
24593
|
init_detect_platform();
|
|
23127
24594
|
init_headers();
|
|
24595
|
+
init_provider();
|
|
23128
24596
|
init_env();
|
|
23129
24597
|
init_log();
|
|
23130
24598
|
init_values();
|
|
23131
24599
|
_a2 = OpenAI2, _OpenAI_encoder = new WeakMap, _OpenAI_instances = new WeakSet, _OpenAI_baseURLOverridden = function _OpenAI_baseURLOverridden() {
|
|
23132
|
-
return this.baseURL !== "https://api.openai.com/v1";
|
|
24600
|
+
return this._provider !== undefined || this.baseURL !== "https://api.openai.com/v1";
|
|
23133
24601
|
};
|
|
23134
24602
|
OpenAI2.OpenAI = _a2;
|
|
23135
24603
|
OpenAI2.DEFAULT_TIMEOUT = 600000;
|
|
@@ -23148,6 +24616,7 @@ var init_client = __esm(() => {
|
|
|
23148
24616
|
OpenAI2.UnprocessableEntityError = UnprocessableEntityError;
|
|
23149
24617
|
OpenAI2.InvalidWebhookSignatureError = InvalidWebhookSignatureError;
|
|
23150
24618
|
OpenAI2.toFile = toFile;
|
|
24619
|
+
OpenAI2.toStreamingFile = toStreamingFile;
|
|
23151
24620
|
OpenAI2.Completions = Completions2;
|
|
23152
24621
|
OpenAI2.Chat = Chat;
|
|
23153
24622
|
OpenAI2.Embeddings = Embeddings;
|
|
@@ -23164,7 +24633,7 @@ var init_client = __esm(() => {
|
|
|
23164
24633
|
OpenAI2.Batches = Batches;
|
|
23165
24634
|
OpenAI2.Uploads = Uploads;
|
|
23166
24635
|
OpenAI2.Admin = Admin;
|
|
23167
|
-
OpenAI2.Responses =
|
|
24636
|
+
OpenAI2.Responses = Responses2;
|
|
23168
24637
|
OpenAI2.Realtime = Realtime2;
|
|
23169
24638
|
OpenAI2.Conversations = Conversations;
|
|
23170
24639
|
OpenAI2.Evals = Evals;
|
|
@@ -23193,6 +24662,16 @@ var init_azure = __esm(() => {
|
|
|
23193
24662
|
]);
|
|
23194
24663
|
});
|
|
23195
24664
|
|
|
24665
|
+
// node_modules/openai/bedrock.mjs
|
|
24666
|
+
var init_bedrock = __esm(() => {
|
|
24667
|
+
init_error2();
|
|
24668
|
+
init_client();
|
|
24669
|
+
init_headers();
|
|
24670
|
+
init_utils2();
|
|
24671
|
+
init_ResponsesParser();
|
|
24672
|
+
init_resources();
|
|
24673
|
+
});
|
|
24674
|
+
|
|
23196
24675
|
// node_modules/openai/index.mjs
|
|
23197
24676
|
var init_openai2 = __esm(() => {
|
|
23198
24677
|
init_client();
|
|
@@ -23202,6 +24681,444 @@ var init_openai2 = __esm(() => {
|
|
|
23202
24681
|
init_pagination();
|
|
23203
24682
|
init_error();
|
|
23204
24683
|
init_azure();
|
|
24684
|
+
init_bedrock();
|
|
24685
|
+
});
|
|
24686
|
+
|
|
24687
|
+
// node_modules/oauth4webapi/build/index.js
|
|
24688
|
+
function CodedTypeError(message, code, cause) {
|
|
24689
|
+
const err = new TypeError(message, { cause });
|
|
24690
|
+
Object.assign(err, { code });
|
|
24691
|
+
return err;
|
|
24692
|
+
}
|
|
24693
|
+
function buf(input) {
|
|
24694
|
+
if (typeof input === "string") {
|
|
24695
|
+
return encoder.encode(input);
|
|
24696
|
+
}
|
|
24697
|
+
return decoder.decode(input);
|
|
24698
|
+
}
|
|
24699
|
+
function b64u(input) {
|
|
24700
|
+
if (typeof input === "string") {
|
|
24701
|
+
return decodeBase64Url(input);
|
|
24702
|
+
}
|
|
24703
|
+
return encodeBase64Url(input);
|
|
24704
|
+
}
|
|
24705
|
+
function OPE(message, code, cause) {
|
|
24706
|
+
return new OperationProcessingError(message, { code, cause });
|
|
24707
|
+
}
|
|
24708
|
+
function assertString(input, it, code, cause) {
|
|
24709
|
+
try {
|
|
24710
|
+
if (typeof input !== "string") {
|
|
24711
|
+
throw CodedTypeError(`${it} must be a string`, ERR_INVALID_ARG_TYPE, cause);
|
|
24712
|
+
}
|
|
24713
|
+
if (input.length === 0) {
|
|
24714
|
+
throw CodedTypeError(`${it} must not be empty`, ERR_INVALID_ARG_VALUE, cause);
|
|
24715
|
+
}
|
|
24716
|
+
} catch (err) {
|
|
24717
|
+
if (code) {
|
|
24718
|
+
throw OPE(err.message, code, cause);
|
|
24719
|
+
}
|
|
24720
|
+
throw err;
|
|
24721
|
+
}
|
|
24722
|
+
}
|
|
24723
|
+
function randomBytes5() {
|
|
24724
|
+
return b64u(crypto.getRandomValues(new Uint8Array(32)));
|
|
24725
|
+
}
|
|
24726
|
+
function generateRandomCodeVerifier() {
|
|
24727
|
+
return randomBytes5();
|
|
24728
|
+
}
|
|
24729
|
+
function generateRandomState() {
|
|
24730
|
+
return randomBytes5();
|
|
24731
|
+
}
|
|
24732
|
+
async function calculatePKCECodeChallenge(codeVerifier) {
|
|
24733
|
+
assertString(codeVerifier, "codeVerifier");
|
|
24734
|
+
return b64u(await crypto.subtle.digest("SHA-256", buf(codeVerifier)));
|
|
24735
|
+
}
|
|
24736
|
+
var USER_AGENT, ERR_INVALID_ARG_VALUE = "ERR_INVALID_ARG_VALUE", ERR_INVALID_ARG_TYPE = "ERR_INVALID_ARG_TYPE", allowInsecureRequests, clockSkew, clockTolerance, customFetch, modifyAssertion, jweDecrypt, jwksCache, encoder, decoder, encodeBase64Url, decodeBase64Url, OperationProcessingError, URLParse, tokenMatch = "[a-zA-Z0-9!#$%&\\'\\*\\+\\-\\.\\^_`\\|~]+", token68Match = "[a-zA-Z0-9\\-\\._\\~\\+\\/]+={0,2}", quotedMatch = '"((?:[^"\\\\]|\\\\[\\s\\S])*)"', quotedParamMatcher, paramMatcher, schemeRE, quotedParamRE, unquotedParamRE, token68ParamRE, skipSubjectCheck, idTokenClaims, jwtRefs, branded, nopkce, expectNoNonce, skipAuthTimeCheck, skipStateCheck, expectNoState, _nodiscoverycheck, _expectedIssuer;
|
|
24737
|
+
var init_build = __esm(() => {
|
|
24738
|
+
if (typeof navigator === "undefined" || !navigator.userAgent?.startsWith?.("Mozilla/5.0 ")) {
|
|
24739
|
+
const NAME = "oauth4webapi";
|
|
24740
|
+
const VERSION = "v3.8.8";
|
|
24741
|
+
USER_AGENT = `${NAME}/${VERSION}`;
|
|
24742
|
+
}
|
|
24743
|
+
allowInsecureRequests = Symbol();
|
|
24744
|
+
clockSkew = Symbol();
|
|
24745
|
+
clockTolerance = Symbol();
|
|
24746
|
+
customFetch = Symbol();
|
|
24747
|
+
modifyAssertion = Symbol();
|
|
24748
|
+
jweDecrypt = Symbol();
|
|
24749
|
+
jwksCache = Symbol();
|
|
24750
|
+
encoder = new TextEncoder;
|
|
24751
|
+
decoder = new TextDecoder;
|
|
24752
|
+
if (Uint8Array.prototype.toBase64) {
|
|
24753
|
+
encodeBase64Url = (input) => {
|
|
24754
|
+
if (input instanceof ArrayBuffer) {
|
|
24755
|
+
input = new Uint8Array(input);
|
|
24756
|
+
}
|
|
24757
|
+
return input.toBase64({ alphabet: "base64url", omitPadding: true });
|
|
24758
|
+
};
|
|
24759
|
+
} else {
|
|
24760
|
+
const CHUNK_SIZE = 32768;
|
|
24761
|
+
encodeBase64Url = (input) => {
|
|
24762
|
+
if (input instanceof ArrayBuffer) {
|
|
24763
|
+
input = new Uint8Array(input);
|
|
24764
|
+
}
|
|
24765
|
+
const arr = [];
|
|
24766
|
+
for (let i = 0;i < input.byteLength; i += CHUNK_SIZE) {
|
|
24767
|
+
arr.push(String.fromCharCode.apply(null, input.subarray(i, i + CHUNK_SIZE)));
|
|
24768
|
+
}
|
|
24769
|
+
return btoa(arr.join("")).replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_");
|
|
24770
|
+
};
|
|
24771
|
+
}
|
|
24772
|
+
if (Uint8Array.fromBase64) {
|
|
24773
|
+
decodeBase64Url = (input) => {
|
|
24774
|
+
try {
|
|
24775
|
+
return Uint8Array.fromBase64(input, { alphabet: "base64url" });
|
|
24776
|
+
} catch (cause) {
|
|
24777
|
+
throw CodedTypeError("The input to be decoded is not correctly encoded.", ERR_INVALID_ARG_VALUE, cause);
|
|
24778
|
+
}
|
|
24779
|
+
};
|
|
24780
|
+
} else {
|
|
24781
|
+
decodeBase64Url = (input) => {
|
|
24782
|
+
try {
|
|
24783
|
+
const binary = atob(input.replace(/-/g, "+").replace(/_/g, "/").replace(/\s/g, ""));
|
|
24784
|
+
const bytes = new Uint8Array(binary.length);
|
|
24785
|
+
for (let i = 0;i < binary.length; i++) {
|
|
24786
|
+
bytes[i] = binary.charCodeAt(i);
|
|
24787
|
+
}
|
|
24788
|
+
return bytes;
|
|
24789
|
+
} catch (cause) {
|
|
24790
|
+
throw CodedTypeError("The input to be decoded is not correctly encoded.", ERR_INVALID_ARG_VALUE, cause);
|
|
24791
|
+
}
|
|
24792
|
+
};
|
|
24793
|
+
}
|
|
24794
|
+
OperationProcessingError = class OperationProcessingError extends Error {
|
|
24795
|
+
code;
|
|
24796
|
+
constructor(message, options) {
|
|
24797
|
+
super(message, options);
|
|
24798
|
+
this.name = this.constructor.name;
|
|
24799
|
+
if (options?.code) {
|
|
24800
|
+
this.code = options?.code;
|
|
24801
|
+
}
|
|
24802
|
+
Error.captureStackTrace?.(this, this.constructor);
|
|
24803
|
+
}
|
|
24804
|
+
};
|
|
24805
|
+
URLParse = URL.parse ? (url, base) => URL.parse(url, base) : (url, base) => {
|
|
24806
|
+
try {
|
|
24807
|
+
return new URL(url, base);
|
|
24808
|
+
} catch {
|
|
24809
|
+
return null;
|
|
24810
|
+
}
|
|
24811
|
+
};
|
|
24812
|
+
quotedParamMatcher = "(" + tokenMatch + ")\\s*=\\s*" + quotedMatch;
|
|
24813
|
+
paramMatcher = "(" + tokenMatch + ")\\s*=\\s*(" + tokenMatch + ")";
|
|
24814
|
+
schemeRE = new RegExp("^[,\\s]*(" + tokenMatch + ")");
|
|
24815
|
+
quotedParamRE = new RegExp("^[,\\s]*" + quotedParamMatcher + "[,\\s]*(.*)");
|
|
24816
|
+
unquotedParamRE = new RegExp("^[,\\s]*" + paramMatcher + "[,\\s]*(.*)");
|
|
24817
|
+
token68ParamRE = new RegExp("^(" + token68Match + ")(?:$|[,\\s])(.*)");
|
|
24818
|
+
skipSubjectCheck = Symbol();
|
|
24819
|
+
idTokenClaims = new WeakMap;
|
|
24820
|
+
jwtRefs = new WeakMap;
|
|
24821
|
+
branded = new WeakSet;
|
|
24822
|
+
nopkce = Symbol();
|
|
24823
|
+
expectNoNonce = Symbol();
|
|
24824
|
+
skipAuthTimeCheck = Symbol();
|
|
24825
|
+
skipStateCheck = Symbol();
|
|
24826
|
+
expectNoState = Symbol();
|
|
24827
|
+
_nodiscoverycheck = Symbol();
|
|
24828
|
+
_expectedIssuer = Symbol();
|
|
24829
|
+
});
|
|
24830
|
+
|
|
24831
|
+
// src/oauth/mcp-wrapper.ts
|
|
24832
|
+
function isInvalidClientError(message) {
|
|
24833
|
+
return /invalid_client\b/i.test(message);
|
|
24834
|
+
}
|
|
24835
|
+
function publicEndpointSsrfOptions() {
|
|
24836
|
+
const dev = isDevOrTestNodeEnv() || process.env.ALLOW_PRIVATE_NETWORK_URLS === "true";
|
|
24837
|
+
return {
|
|
24838
|
+
allowPrivateHosts: dev,
|
|
24839
|
+
allowInsecure: dev
|
|
24840
|
+
};
|
|
24841
|
+
}
|
|
24842
|
+
function mcpOAuthSsrfOptions() {
|
|
24843
|
+
return {
|
|
24844
|
+
allowPrivateHosts: isEnvFlagEnabled("MCP_OAUTH_ALLOW_PRIVATE_HOSTS", false),
|
|
24845
|
+
allowInsecure: isDevOrTestNodeEnv()
|
|
24846
|
+
};
|
|
24847
|
+
}
|
|
24848
|
+
async function safeFetch(url, init, timeoutMs = DEFAULT_FETCH_TIMEOUT_MS) {
|
|
24849
|
+
return createSsrfGuardedFetch(mcpOAuthSsrfOptions())(url, {
|
|
24850
|
+
...init,
|
|
24851
|
+
signal: init?.signal ?? AbortSignal.timeout(timeoutMs)
|
|
24852
|
+
});
|
|
24853
|
+
}
|
|
24854
|
+
async function discoverProtectedResourceMetadata(resourceUrl) {
|
|
24855
|
+
const base = new URL(resourceUrl);
|
|
24856
|
+
const wellKnown = new URL("/.well-known/oauth-protected-resource", base).toString();
|
|
24857
|
+
try {
|
|
24858
|
+
const res = await safeFetch(wellKnown, {
|
|
24859
|
+
headers: { Accept: "application/json" }
|
|
24860
|
+
});
|
|
24861
|
+
if (res.ok) {
|
|
24862
|
+
return await res.json();
|
|
24863
|
+
}
|
|
24864
|
+
} catch {}
|
|
24865
|
+
try {
|
|
24866
|
+
const probe = await safeFetch(resourceUrl, { method: "HEAD" });
|
|
24867
|
+
const wwwAuth = probe.headers.get("www-authenticate");
|
|
24868
|
+
if (wwwAuth) {
|
|
24869
|
+
const match = /resource_metadata="([^"]+)"/i.exec(wwwAuth);
|
|
24870
|
+
if (match) {
|
|
24871
|
+
const metaRes = await safeFetch(match[1], {
|
|
24872
|
+
headers: { Accept: "application/json" }
|
|
24873
|
+
});
|
|
24874
|
+
if (metaRes.ok) {
|
|
24875
|
+
return await metaRes.json();
|
|
24876
|
+
}
|
|
24877
|
+
}
|
|
24878
|
+
}
|
|
24879
|
+
} catch {}
|
|
24880
|
+
return null;
|
|
24881
|
+
}
|
|
24882
|
+
async function discoverAuthorizationServerMetadata(issuer) {
|
|
24883
|
+
const issuerUrl = new URL(issuer);
|
|
24884
|
+
const candidates = [
|
|
24885
|
+
new URL("/.well-known/oauth-authorization-server", issuerUrl).toString(),
|
|
24886
|
+
new URL("/.well-known/openid-configuration", issuerUrl).toString()
|
|
24887
|
+
];
|
|
24888
|
+
let lastError = null;
|
|
24889
|
+
for (const candidate of candidates) {
|
|
24890
|
+
try {
|
|
24891
|
+
const res = await safeFetch(candidate, {
|
|
24892
|
+
headers: { Accept: "application/json" }
|
|
24893
|
+
});
|
|
24894
|
+
if (res.ok) {
|
|
24895
|
+
return await res.json();
|
|
24896
|
+
}
|
|
24897
|
+
lastError = new Error(`Metadata fetch ${candidate} → ${res.status}`);
|
|
24898
|
+
} catch (err) {
|
|
24899
|
+
lastError = err instanceof Error ? err : new Error(String(err));
|
|
24900
|
+
}
|
|
24901
|
+
}
|
|
24902
|
+
throw lastError ?? new Error(`Authorization server metadata not found at ${issuer}`);
|
|
24903
|
+
}
|
|
24904
|
+
function normalizeTokenEndpointAuthMethod(value) {
|
|
24905
|
+
return KNOWN_TOKEN_ENDPOINT_AUTH_METHODS.includes(value ?? "") ? value : DEFAULT_TOKEN_ENDPOINT_AUTH_METHOD;
|
|
24906
|
+
}
|
|
24907
|
+
function resolveAdvertisedTokenEndpointAuthMethod(value, source) {
|
|
24908
|
+
if (value == null || value === "")
|
|
24909
|
+
return DEFAULT_TOKEN_ENDPOINT_AUTH_METHOD;
|
|
24910
|
+
if (!KNOWN_TOKEN_ENDPOINT_AUTH_METHODS.includes(value)) {
|
|
24911
|
+
throw new UnsupportedTokenEndpointAuthMethodError(value, source);
|
|
24912
|
+
}
|
|
24913
|
+
return value;
|
|
24914
|
+
}
|
|
24915
|
+
function authMethodForStoredClient(value) {
|
|
24916
|
+
if (value == null || value === "")
|
|
24917
|
+
return "client_secret_post";
|
|
24918
|
+
return normalizeTokenEndpointAuthMethod(value);
|
|
24919
|
+
}
|
|
24920
|
+
function selectDcrTokenEndpointAuthMethod(supportedMethods) {
|
|
24921
|
+
if (!supportedMethods || supportedMethods.length === 0) {
|
|
24922
|
+
return DEFAULT_TOKEN_ENDPOINT_AUTH_METHOD;
|
|
24923
|
+
}
|
|
24924
|
+
for (const method of KNOWN_TOKEN_ENDPOINT_AUTH_METHODS) {
|
|
24925
|
+
if (supportedMethods.includes(method))
|
|
24926
|
+
return method;
|
|
24927
|
+
}
|
|
24928
|
+
throw new UnsupportedTokenEndpointAuthMethodError(supportedMethods.join(", "), "advertises only");
|
|
24929
|
+
}
|
|
24930
|
+
function formUrlEncodeComponent(value) {
|
|
24931
|
+
return new URLSearchParams({ v: value }).toString().slice(2);
|
|
24932
|
+
}
|
|
24933
|
+
function redactSentCredentials(text, sent) {
|
|
24934
|
+
let out = scrubSecrets(text);
|
|
24935
|
+
for (const value of sent) {
|
|
24936
|
+
if (!value)
|
|
24937
|
+
continue;
|
|
24938
|
+
for (const shape of new Set([value, formUrlEncodeComponent(value)])) {
|
|
24939
|
+
out = out.split(shape).join("[REDACTED]");
|
|
24940
|
+
}
|
|
24941
|
+
}
|
|
24942
|
+
return out;
|
|
24943
|
+
}
|
|
24944
|
+
function applyClientAuthentication(method, clientId, clientSecret, body, headers) {
|
|
24945
|
+
if (method === "client_secret_basic" && clientSecret) {
|
|
24946
|
+
const encodedSecret = formUrlEncodeComponent(clientSecret);
|
|
24947
|
+
const credentials = `${formUrlEncodeComponent(clientId)}:${encodedSecret}`;
|
|
24948
|
+
const encoded = Buffer.from(credentials).toString("base64");
|
|
24949
|
+
registerVolatileSecret(encoded, "mcp_oauth_basic_credential");
|
|
24950
|
+
headers.Authorization = `Basic ${encoded}`;
|
|
24951
|
+
return [clientSecret, encodedSecret, encoded, credentials];
|
|
24952
|
+
}
|
|
24953
|
+
body.set("client_id", clientId);
|
|
24954
|
+
if (method === "client_secret_post" && clientSecret) {
|
|
24955
|
+
body.set("client_secret", clientSecret);
|
|
24956
|
+
return [clientSecret, formUrlEncodeComponent(clientSecret)];
|
|
24957
|
+
}
|
|
24958
|
+
return [];
|
|
24959
|
+
}
|
|
24960
|
+
async function registerClient(registrationEndpoint, req) {
|
|
24961
|
+
const res = await safeFetch(registrationEndpoint, {
|
|
24962
|
+
method: "POST",
|
|
24963
|
+
headers: {
|
|
24964
|
+
"Content-Type": "application/json",
|
|
24965
|
+
Accept: "application/json"
|
|
24966
|
+
},
|
|
24967
|
+
body: JSON.stringify(req)
|
|
24968
|
+
});
|
|
24969
|
+
if (!res.ok) {
|
|
24970
|
+
const body = await res.text().catch(() => "");
|
|
24971
|
+
throw new Error(`Dynamic client registration failed (${res.status}): ${body}`);
|
|
24972
|
+
}
|
|
24973
|
+
return await res.json();
|
|
24974
|
+
}
|
|
24975
|
+
async function buildAuthorizeUrl(input) {
|
|
24976
|
+
const state = input.state ?? generateRandomState();
|
|
24977
|
+
const codeVerifier = generateRandomCodeVerifier();
|
|
24978
|
+
const codeChallenge = await calculatePKCECodeChallenge(codeVerifier);
|
|
24979
|
+
const url = new URL(input.authorizeUrl);
|
|
24980
|
+
url.searchParams.set("response_type", "code");
|
|
24981
|
+
url.searchParams.set("client_id", input.clientId);
|
|
24982
|
+
url.searchParams.set("redirect_uri", input.redirectUri);
|
|
24983
|
+
if (input.scopes.length > 0) {
|
|
24984
|
+
url.searchParams.set("scope", input.scopes.join(" "));
|
|
24985
|
+
}
|
|
24986
|
+
url.searchParams.set("state", state);
|
|
24987
|
+
url.searchParams.set("code_challenge", codeChallenge);
|
|
24988
|
+
url.searchParams.set("code_challenge_method", "S256");
|
|
24989
|
+
url.searchParams.set("resource", input.resource);
|
|
24990
|
+
if (input.extraParams) {
|
|
24991
|
+
const RESERVED = new Set([
|
|
24992
|
+
"response_type",
|
|
24993
|
+
"client_id",
|
|
24994
|
+
"redirect_uri",
|
|
24995
|
+
"scope",
|
|
24996
|
+
"state",
|
|
24997
|
+
"code_challenge",
|
|
24998
|
+
"code_challenge_method",
|
|
24999
|
+
"resource"
|
|
25000
|
+
]);
|
|
25001
|
+
for (const [k, v] of Object.entries(input.extraParams)) {
|
|
25002
|
+
if (RESERVED.has(k.toLowerCase())) {
|
|
25003
|
+
console.warn(`[mcp-oauth] extraParams key "${k}" is reserved and skipped`);
|
|
25004
|
+
continue;
|
|
25005
|
+
}
|
|
25006
|
+
url.searchParams.set(k, v);
|
|
25007
|
+
}
|
|
25008
|
+
}
|
|
25009
|
+
return { url: url.toString(), state, codeVerifier, codeChallenge };
|
|
25010
|
+
}
|
|
25011
|
+
async function exchangeCodeForTokens(input) {
|
|
25012
|
+
if (input.clientSecret)
|
|
25013
|
+
registerVolatileSecret(input.clientSecret, "mcp_oauth_client_secret");
|
|
25014
|
+
const method = normalizeTokenEndpointAuthMethod(input.tokenEndpointAuthMethod);
|
|
25015
|
+
const body = new URLSearchParams({
|
|
25016
|
+
grant_type: "authorization_code",
|
|
25017
|
+
code: input.code,
|
|
25018
|
+
redirect_uri: input.redirectUri,
|
|
25019
|
+
code_verifier: input.codeVerifier,
|
|
25020
|
+
resource: input.resource
|
|
25021
|
+
});
|
|
25022
|
+
const headers = {
|
|
25023
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
|
25024
|
+
Accept: "application/json"
|
|
25025
|
+
};
|
|
25026
|
+
const sentCredentials = applyClientAuthentication(method, input.clientId, input.clientSecret, body, headers);
|
|
25027
|
+
const res = await safeFetch(input.tokenUrl, {
|
|
25028
|
+
method: "POST",
|
|
25029
|
+
headers,
|
|
25030
|
+
body: body.toString()
|
|
25031
|
+
});
|
|
25032
|
+
if (!res.ok) {
|
|
25033
|
+
const text = await res.text().catch(() => "");
|
|
25034
|
+
throw new Error(`Token exchange failed (${res.status}): ${redactSentCredentials(text, [
|
|
25035
|
+
...sentCredentials,
|
|
25036
|
+
input.code,
|
|
25037
|
+
input.codeVerifier
|
|
25038
|
+
])}`);
|
|
25039
|
+
}
|
|
25040
|
+
return await res.json();
|
|
25041
|
+
}
|
|
25042
|
+
async function refreshMcpToken(input) {
|
|
25043
|
+
if (input.clientSecret)
|
|
25044
|
+
registerVolatileSecret(input.clientSecret, "mcp_oauth_client_secret");
|
|
25045
|
+
registerVolatileSecret(input.refreshToken, "mcp_oauth_refresh_token");
|
|
25046
|
+
const method = normalizeTokenEndpointAuthMethod(input.tokenEndpointAuthMethod);
|
|
25047
|
+
const body = new URLSearchParams({
|
|
25048
|
+
grant_type: "refresh_token",
|
|
25049
|
+
refresh_token: input.refreshToken,
|
|
25050
|
+
resource: input.resource
|
|
25051
|
+
});
|
|
25052
|
+
if (input.scopes && input.scopes.length > 0)
|
|
25053
|
+
body.set("scope", input.scopes.join(" "));
|
|
25054
|
+
const headers = {
|
|
25055
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
|
25056
|
+
Accept: "application/json"
|
|
25057
|
+
};
|
|
25058
|
+
const sentCredentials = applyClientAuthentication(method, input.clientId, input.clientSecret, body, headers);
|
|
25059
|
+
const res = await safeFetch(input.tokenUrl, {
|
|
25060
|
+
method: "POST",
|
|
25061
|
+
headers,
|
|
25062
|
+
body: body.toString()
|
|
25063
|
+
});
|
|
25064
|
+
if (!res.ok) {
|
|
25065
|
+
const text = await res.text().catch(() => "");
|
|
25066
|
+
throw new Error(`Token refresh failed (${res.status}): ${redactSentCredentials(text, [
|
|
25067
|
+
...sentCredentials,
|
|
25068
|
+
input.refreshToken
|
|
25069
|
+
])}`);
|
|
25070
|
+
}
|
|
25071
|
+
return await res.json();
|
|
25072
|
+
}
|
|
25073
|
+
async function revokeMcpToken(input) {
|
|
25074
|
+
if (input.clientSecret)
|
|
25075
|
+
registerVolatileSecret(input.clientSecret, "mcp_oauth_client_secret");
|
|
25076
|
+
registerVolatileSecret(input.token, "mcp_oauth_revoked_token");
|
|
25077
|
+
const method = normalizeTokenEndpointAuthMethod(input.tokenEndpointAuthMethod);
|
|
25078
|
+
const body = new URLSearchParams({ token: input.token });
|
|
25079
|
+
if (input.tokenTypeHint)
|
|
25080
|
+
body.set("token_type_hint", input.tokenTypeHint);
|
|
25081
|
+
const headers = {
|
|
25082
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
|
25083
|
+
Accept: "application/json"
|
|
25084
|
+
};
|
|
25085
|
+
const sentCredentials = applyClientAuthentication(method, input.clientId, input.clientSecret, body, headers);
|
|
25086
|
+
const res = await safeFetch(input.revocationUrl, {
|
|
25087
|
+
method: "POST",
|
|
25088
|
+
headers,
|
|
25089
|
+
body: body.toString()
|
|
25090
|
+
});
|
|
25091
|
+
if (!res.ok && res.status !== 200 && res.status !== 204) {
|
|
25092
|
+
const text = await res.text().catch(() => "");
|
|
25093
|
+
throw new Error(`Token revocation failed (${res.status}): ${redactSentCredentials(text, [
|
|
25094
|
+
...sentCredentials,
|
|
25095
|
+
input.token
|
|
25096
|
+
])}`);
|
|
25097
|
+
}
|
|
25098
|
+
}
|
|
25099
|
+
function computeExpiresAt(expiresInSeconds) {
|
|
25100
|
+
if (!expiresInSeconds || expiresInSeconds <= 0)
|
|
25101
|
+
return null;
|
|
25102
|
+
return new Date(Date.now() + expiresInSeconds * 1000).toISOString();
|
|
25103
|
+
}
|
|
25104
|
+
var DEFAULT_FETCH_TIMEOUT_MS = 15000, KNOWN_TOKEN_ENDPOINT_AUTH_METHODS, DEFAULT_TOKEN_ENDPOINT_AUTH_METHOD = "client_secret_basic", UnsupportedTokenEndpointAuthMethodError;
|
|
25105
|
+
var init_mcp_wrapper = __esm(() => {
|
|
25106
|
+
init_build();
|
|
25107
|
+
init_egress_guard();
|
|
25108
|
+
init_env_flag();
|
|
25109
|
+
init_node_env();
|
|
25110
|
+
init_secret_scrubber();
|
|
25111
|
+
KNOWN_TOKEN_ENDPOINT_AUTH_METHODS = [
|
|
25112
|
+
"client_secret_basic",
|
|
25113
|
+
"client_secret_post",
|
|
25114
|
+
"none"
|
|
25115
|
+
];
|
|
25116
|
+
UnsupportedTokenEndpointAuthMethodError = class UnsupportedTokenEndpointAuthMethodError extends Error {
|
|
25117
|
+
constructor(value, source) {
|
|
25118
|
+
super(`Authorization server ${source} token_endpoint_auth_method "${value}", which agent-swarm cannot perform. ` + `Supported methods: ${KNOWN_TOKEN_ENDPOINT_AUTH_METHODS.join(", ")}. ` + `Register a client manually via POST /api/mcp-oauth/:id/manual-client with a supported method.`);
|
|
25119
|
+
this.name = "UnsupportedTokenEndpointAuthMethodError";
|
|
25120
|
+
}
|
|
25121
|
+
};
|
|
23205
25122
|
});
|
|
23206
25123
|
|
|
23207
25124
|
// src/be/memory/constants.ts
|
|
@@ -23279,7 +25196,7 @@ function noteEmbeddingSuccess() {
|
|
|
23279
25196
|
const report = (what) => (err) => {
|
|
23280
25197
|
console.error(`[memory] ${what} backfill after embeddings recovered failed:`, err.message);
|
|
23281
25198
|
};
|
|
23282
|
-
backfill2 = import("./embedding-space-
|
|
25199
|
+
backfill2 = import("./embedding-space-0p921zt3.js").then(({ runEmbeddingMaintenance }) => runEmbeddingMaintenance({ backfill: true })).catch(report("Embedding")).finally(() => {
|
|
23283
25200
|
backfill2 = null;
|
|
23284
25201
|
});
|
|
23285
25202
|
}
|
|
@@ -23370,10 +25287,12 @@ class OpenAIEmbeddingProvider {
|
|
|
23370
25287
|
return null;
|
|
23371
25288
|
if (!this.client) {
|
|
23372
25289
|
const baseURL = this.baseURL;
|
|
25290
|
+
const endpoint = embeddingEndpoint2(baseURL ?? null);
|
|
23373
25291
|
this.client = new OpenAI2({
|
|
23374
25292
|
baseURL,
|
|
23375
25293
|
apiKey: this.apiKey,
|
|
23376
|
-
defaultHeaders: getOpenRouterAttributionHeaders(baseURL ?? "")
|
|
25294
|
+
defaultHeaders: getOpenRouterAttributionHeaders(baseURL ?? ""),
|
|
25295
|
+
fetch: endpoint && !endpoint.fromDeployment ? createSsrfGuardedFetch(publicEndpointSsrfOptions()) : undefined
|
|
23377
25296
|
});
|
|
23378
25297
|
}
|
|
23379
25298
|
return this.client;
|
|
@@ -23482,10 +25401,13 @@ class OpenAIEmbeddingProvider {
|
|
|
23482
25401
|
var MAX_EMBEDDING_INPUT_CHARS = 24000, MIN_EMBEDDING_INPUT_CHARS = 1000, MAX_BATCH_REQUEST_CHARS = 200000;
|
|
23483
25402
|
var init_openai_embedding = __esm(() => {
|
|
23484
25403
|
init_openai2();
|
|
25404
|
+
init_mcp_wrapper();
|
|
23485
25405
|
init_credentials2();
|
|
25406
|
+
init_egress_guard();
|
|
23486
25407
|
init_openrouter_base_url();
|
|
23487
25408
|
init_constants2();
|
|
23488
25409
|
init_embedding_recovery();
|
|
25410
|
+
init_memory();
|
|
23489
25411
|
});
|
|
23490
25412
|
|
|
23491
25413
|
// src/be/memory/key-paths.ts
|
|
@@ -23995,7 +25917,7 @@ function applyEditMode(mode, currentContent, fields) {
|
|
|
23995
25917
|
}
|
|
23996
25918
|
return currentContent.slice(0, first) + fields.newString + currentContent.slice(first + fields.oldString.length);
|
|
23997
25919
|
}
|
|
23998
|
-
function
|
|
25920
|
+
function computeExpiresAt2(source, key) {
|
|
23999
25921
|
const ttlDays = isLearningKey(key) ? LEARNING_TTL_DAYS : TTL_DEFAULTS[tierSource(source, key)];
|
|
24000
25922
|
if (ttlDays == null)
|
|
24001
25923
|
return null;
|
|
@@ -24224,7 +26146,7 @@ class SqliteMemoryStore {
|
|
|
24224
26146
|
const id = crypto.randomUUID();
|
|
24225
26147
|
const now = new Date().toISOString();
|
|
24226
26148
|
const key = input.key ?? `${input.scope}/${input.source}/${id}`;
|
|
24227
|
-
const expiresAt =
|
|
26149
|
+
const expiresAt = computeExpiresAt2(input.source, key);
|
|
24228
26150
|
const name = scrubSecrets(input.name);
|
|
24229
26151
|
const content = scrubSecrets(input.content);
|
|
24230
26152
|
const summary = input.summary == null ? null : scrubSecrets(input.summary);
|
|
@@ -24750,7 +26672,7 @@ class SqliteMemoryStore {
|
|
|
24750
26672
|
throw new Error(`key "${input.newKey}" is already used in this scope`);
|
|
24751
26673
|
}
|
|
24752
26674
|
const resetExpiry = moving && (isLongtermKey(input.newKey) || isLearningKey(row.key) !== isLearningKey(input.newKey));
|
|
24753
|
-
const expiresAt = resetExpiry ?
|
|
26675
|
+
const expiresAt = resetExpiry ? computeExpiresAt2(row.source, input.newKey) : row.expiresAt;
|
|
24754
26676
|
const now = new Date().toISOString();
|
|
24755
26677
|
const versionIntent = moving ? `${input.intent} [key ${row.key ?? "(none)"} -> ${input.newKey}]` : input.intent;
|
|
24756
26678
|
let nextVersion = previousVersion + 1;
|
|
@@ -25174,7 +27096,27 @@ function getMemoryStore2() {
|
|
|
25174
27096
|
}
|
|
25175
27097
|
return memoryStore;
|
|
25176
27098
|
}
|
|
25177
|
-
|
|
27099
|
+
function setDeploymentEnvReader2(read) {
|
|
27100
|
+
readDeploymentEnv = read;
|
|
27101
|
+
}
|
|
27102
|
+
function embeddingEndpoint2(embeddingBaseUrl = process.env.EMBEDDING_API_BASE_URL || null) {
|
|
27103
|
+
if (embeddingBaseUrl) {
|
|
27104
|
+
return {
|
|
27105
|
+
baseUrl: embeddingBaseUrl,
|
|
27106
|
+
fromDeployment: embeddingBaseUrl === readDeploymentEnv("EMBEDDING_API_BASE_URL")
|
|
27107
|
+
};
|
|
27108
|
+
}
|
|
27109
|
+
const openAiBaseUrl = process.env.OPENAI_BASE_URL;
|
|
27110
|
+
if (!openAiBaseUrl)
|
|
27111
|
+
return null;
|
|
27112
|
+
return {
|
|
27113
|
+
baseUrl: openAiBaseUrl,
|
|
27114
|
+
fromDeployment: openAiBaseUrl === readDeploymentEnv("OPENAI_BASE_URL")
|
|
27115
|
+
};
|
|
27116
|
+
}
|
|
27117
|
+
var embeddingProvider = null, memoryStore = null, readDeploymentEnv = () => {
|
|
27118
|
+
return;
|
|
27119
|
+
};
|
|
25178
27120
|
var init_memory = () => {};
|
|
25179
27121
|
|
|
25180
27122
|
// src/be/scripts/embeddings.ts
|
|
@@ -25848,7 +27790,7 @@ async function loadSecretRegistry() {
|
|
|
25848
27790
|
result.failed += 1;
|
|
25849
27791
|
}
|
|
25850
27792
|
try {
|
|
25851
|
-
const { loadRuntimeControllerSecrets } = await import("./db-
|
|
27793
|
+
const { loadRuntimeControllerSecrets } = await import("./db-8xs2js3s.js");
|
|
25852
27794
|
const loaded = await loadRuntimeControllerSecrets();
|
|
25853
27795
|
result.runtimeController = loaded.count;
|
|
25854
27796
|
result.failed += loaded.failed;
|
|
@@ -26009,7 +27951,7 @@ async function requestSteering(args) {
|
|
|
26009
27951
|
}
|
|
26010
27952
|
const requestedMode = args.mode ?? "queue";
|
|
26011
27953
|
const onUnsupported = args.onUnsupported ?? "degrade";
|
|
26012
|
-
const { dispatchPre, extensionIdForAgent } = await import("./dispatcher-
|
|
27954
|
+
const { dispatchPre, extensionIdForAgent } = await import("./dispatcher-v7drd034.js");
|
|
26013
27955
|
const preSteer = await dispatchPre("pre.task.steer", {
|
|
26014
27956
|
task,
|
|
26015
27957
|
message: args.message,
|
|
@@ -26218,6 +28160,24 @@ async function setScriptRunFollowUpGuard2(runId, decision) {
|
|
|
26218
28160
|
runId
|
|
26219
28161
|
]);
|
|
26220
28162
|
}
|
|
28163
|
+
function scriptRunFilterSql(opts) {
|
|
28164
|
+
const conditions = [];
|
|
28165
|
+
const params = [];
|
|
28166
|
+
const columns = [
|
|
28167
|
+
["status", opts?.status],
|
|
28168
|
+
["agentId", opts?.agentId],
|
|
28169
|
+
["scriptName", opts?.scriptName],
|
|
28170
|
+
["objectScriptId", opts?.objectScriptId],
|
|
28171
|
+
["objectId", opts?.objectId]
|
|
28172
|
+
];
|
|
28173
|
+
for (const [column, value] of columns) {
|
|
28174
|
+
if (!value)
|
|
28175
|
+
continue;
|
|
28176
|
+
conditions.push(`${column} = ?`);
|
|
28177
|
+
params.push(value);
|
|
28178
|
+
}
|
|
28179
|
+
return { conditions, params };
|
|
28180
|
+
}
|
|
26221
28181
|
var init_script_runs = __esm(() => {
|
|
26222
28182
|
init_sealed_json();
|
|
26223
28183
|
init_runtime2();
|
|
@@ -26583,6 +28543,7 @@ __export(exports_db, {
|
|
|
26583
28543
|
getWorkflowRunStepsByRunId: () => getWorkflowRunStepsByRunId2,
|
|
26584
28544
|
getWorkflowVersion: () => getWorkflowVersion2,
|
|
26585
28545
|
getWorkflowVersions: () => getWorkflowVersions2,
|
|
28546
|
+
getWorkflowsByEventName: () => getWorkflowsByEventName2,
|
|
26586
28547
|
getWorkflowsByScheduleId: () => getWorkflowsByScheduleId2,
|
|
26587
28548
|
giveUpStaleChatRelays: () => giveUpStaleChatRelays2,
|
|
26588
28549
|
hasBudgetRefusalNotificationToday: () => hasBudgetRefusalNotificationToday2,
|
|
@@ -28140,10 +30101,10 @@ async function createTaskExtended2(task, options) {
|
|
|
28140
30101
|
vcsProvider, vcsRepo, vcsEventType, vcsNumber, vcsCommentId, vcsAuthor, vcsUrl,
|
|
28141
30102
|
vcsInstallationId, vcsNodeId,
|
|
28142
30103
|
agentmailInboxId, agentmailMessageId, agentmailThreadId,
|
|
28143
|
-
mentionMessageId, mentionChannelId, dir, parentTaskId, dispatchedByTaskId, model, modelTier, effort, profile, fallbackHops, scheduleId,
|
|
30104
|
+
mentionMessageId, mentionChannelId, dir, parentTaskId, dispatchedByTaskId, model, modelTier, effort, profile, modelGroup, fallbackHops, scheduleId,
|
|
28144
30105
|
workflowRunId, workflowRunStepId, outputSchema, followUpConfig, requestedByUserId, requestedByUserIdInherited, contextKey, routingAffinity, swarmVersion, createdAt, lastUpdatedAt, created_by, updated_by, isHumanFree,
|
|
28145
30106
|
sourceStepId, sourceScriptRunId
|
|
28146
|
-
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING *`, [
|
|
30107
|
+
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING *`, [
|
|
28147
30108
|
id,
|
|
28148
30109
|
insertKey,
|
|
28149
30110
|
options?.agentId ?? null,
|
|
@@ -28186,6 +30147,7 @@ async function createTaskExtended2(task, options) {
|
|
|
28186
30147
|
options?.modelTier ?? null,
|
|
28187
30148
|
options?.effort ?? null,
|
|
28188
30149
|
options?.profile?.trim() || null,
|
|
30150
|
+
options?.modelGroup?.trim() || null,
|
|
28189
30151
|
options?.fallbackHops?.length ? JSON.stringify(options.fallbackHops) : null,
|
|
28190
30152
|
options?.scheduleId ?? null,
|
|
28191
30153
|
options?.workflowRunId ?? null,
|
|
@@ -28254,7 +30216,7 @@ async function createTaskExtended2(task, options) {
|
|
|
28254
30216
|
priority: row.priority
|
|
28255
30217
|
}, (task) => task !== null, row.requestedByUserId);
|
|
28256
30218
|
getDbClient2().afterCommit(() => {
|
|
28257
|
-
import("./event-bus-
|
|
30219
|
+
import("./event-bus-pawddp92.js").then(({ workflowEventBus }) => {
|
|
28258
30220
|
workflowEventBus.emit("task.created", {
|
|
28259
30221
|
taskId: row.id,
|
|
28260
30222
|
task: row.task,
|
|
@@ -28336,7 +30298,7 @@ async function releaseTask2(taskId, wakeSnapshot) {
|
|
|
28336
30298
|
} catch {}
|
|
28337
30299
|
if (isRuntimePoolsEnabled() && !wakeSnapshot)
|
|
28338
30300
|
getDbClient2().afterCommit(() => {
|
|
28339
|
-
import("./event-bus-
|
|
30301
|
+
import("./event-bus-pawddp92.js").then(({ workflowEventBus }) => workflowEventBus.emit("task.unassigned", { taskId })).catch((error) => console.error("[db] Routing event failed:", scrubSecrets(String(error))));
|
|
28340
30302
|
});
|
|
28341
30303
|
}
|
|
28342
30304
|
return row ? rowToAgentTask(row) : null;
|
|
@@ -28406,7 +30368,7 @@ async function rejectTask2(taskId, agentId, reason) {
|
|
|
28406
30368
|
} catch {}
|
|
28407
30369
|
if (isRuntimePoolsEnabled())
|
|
28408
30370
|
getDbClient2().afterCommit(() => {
|
|
28409
|
-
import("./event-bus-
|
|
30371
|
+
import("./event-bus-pawddp92.js").then(({ workflowEventBus }) => workflowEventBus.emit("task.unassigned", { taskId })).catch((error) => console.error("[db] Routing event failed:", scrubSecrets(String(error))));
|
|
28410
30372
|
});
|
|
28411
30373
|
}
|
|
28412
30374
|
return row ? rowToAgentTask(row) : null;
|
|
@@ -29790,6 +31752,7 @@ function rowToScheduledTask(row) {
|
|
|
29790
31752
|
model: row.model ?? undefined,
|
|
29791
31753
|
modelTier: parseModelTier(row.modelTier) ?? undefined,
|
|
29792
31754
|
profile: row.profile ?? undefined,
|
|
31755
|
+
modelGroup: row.modelGroup ?? undefined,
|
|
29793
31756
|
scheduleType: row.scheduleType,
|
|
29794
31757
|
targetType: row.targetType,
|
|
29795
31758
|
workflowId: row.workflowId ?? undefined,
|
|
@@ -29880,11 +31843,11 @@ async function createScheduledTask2(data) {
|
|
|
29880
31843
|
id, "key", name, description, cronExpression, intervalMs, taskTemplate,
|
|
29881
31844
|
taskType, tags, priority, targetAgentId, enabled, nextRunAt,
|
|
29882
31845
|
createdByAgentId, parentTaskId, requestedDelayMs, requestedRunAt,
|
|
29883
|
-
timezone, model, modelTier, profile, scheduleType,
|
|
31846
|
+
timezone, model, modelTier, profile, modelGroup, scheduleType,
|
|
29884
31847
|
targetType, workflowId, scriptName, scriptArgs, params, requiredParams, requires,
|
|
29885
31848
|
createdAt, lastUpdatedAt,
|
|
29886
31849
|
created_by, updated_by, updatedByAgentId
|
|
29887
|
-
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING *`, [
|
|
31850
|
+
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING *`, [
|
|
29888
31851
|
id,
|
|
29889
31852
|
normalizeAssetKey(data.key ?? defaultAssetKey("schedule", id)),
|
|
29890
31853
|
data.name,
|
|
@@ -29906,6 +31869,7 @@ async function createScheduledTask2(data) {
|
|
|
29906
31869
|
data.model ?? null,
|
|
29907
31870
|
data.modelTier ?? null,
|
|
29908
31871
|
data.profile ?? null,
|
|
31872
|
+
data.modelGroup ?? null,
|
|
29909
31873
|
data.scheduleType ?? "recurring",
|
|
29910
31874
|
data.targetType ?? "agent-task",
|
|
29911
31875
|
data.workflowId ?? null,
|
|
@@ -30007,6 +31971,10 @@ async function updateScheduledTask2(id, data) {
|
|
|
30007
31971
|
updates.push("profile = ?");
|
|
30008
31972
|
params.push(data.profile);
|
|
30009
31973
|
}
|
|
31974
|
+
if (data.modelGroup !== undefined) {
|
|
31975
|
+
updates.push("modelGroup = ?");
|
|
31976
|
+
params.push(data.modelGroup);
|
|
31977
|
+
}
|
|
30010
31978
|
if (data.scheduleType !== undefined) {
|
|
30011
31979
|
updates.push("scheduleType = ?");
|
|
30012
31980
|
params.push(data.scheduleType);
|
|
@@ -30069,7 +32037,7 @@ async function deleteScheduledTask2(id) {
|
|
|
30069
32037
|
const parent = await getTaskById2(deferred.parentTaskId);
|
|
30070
32038
|
if (!parent?.deferredAt)
|
|
30071
32039
|
return;
|
|
30072
|
-
const { createWorkerTaskFollowUp } = await import("./worker-follow-up-
|
|
32040
|
+
const { createWorkerTaskFollowUp } = await import("./worker-follow-up-gbaz2ydz.js");
|
|
30073
32041
|
await createWorkerTaskFollowUp({
|
|
30074
32042
|
task: parent,
|
|
30075
32043
|
status: "failed",
|
|
@@ -30173,39 +32141,6 @@ function autoEncryptLegacyPlaintextSecrets2(database, dbPath, options = {}) {
|
|
|
30173
32141
|
function maskSecrets2(configs) {
|
|
30174
32142
|
return configs.map((c) => c.isSecret ? { ...c, value: MASKED_SECRET_VALUE } : c);
|
|
30175
32143
|
}
|
|
30176
|
-
function writeEnvFile(configs) {
|
|
30177
|
-
const { readFileSync, writeFileSync } = __require("node:fs");
|
|
30178
|
-
const byPath = new Map;
|
|
30179
|
-
for (const config of configs) {
|
|
30180
|
-
if (!config.envPath)
|
|
30181
|
-
continue;
|
|
30182
|
-
const existing = byPath.get(config.envPath) ?? [];
|
|
30183
|
-
existing.push(config);
|
|
30184
|
-
byPath.set(config.envPath, existing);
|
|
30185
|
-
}
|
|
30186
|
-
for (const [envPath, entries] of byPath) {
|
|
30187
|
-
let lines = [];
|
|
30188
|
-
try {
|
|
30189
|
-
const content = readFileSync(envPath, "utf-8");
|
|
30190
|
-
lines = content.split(`
|
|
30191
|
-
`);
|
|
30192
|
-
} catch {}
|
|
30193
|
-
for (const entry of entries) {
|
|
30194
|
-
const prefix = `${entry.key}=`;
|
|
30195
|
-
const lineIndex = lines.findIndex((l) => l.startsWith(prefix));
|
|
30196
|
-
const newLine = `${entry.key}=${entry.value}`;
|
|
30197
|
-
if (lineIndex >= 0) {
|
|
30198
|
-
lines[lineIndex] = newLine;
|
|
30199
|
-
} else {
|
|
30200
|
-
lines.push(newLine);
|
|
30201
|
-
}
|
|
30202
|
-
}
|
|
30203
|
-
const output = `${lines.filter((l) => l !== "").join(`
|
|
30204
|
-
`)}
|
|
30205
|
-
`;
|
|
30206
|
-
writeFileSync(envPath, output, "utf-8");
|
|
30207
|
-
}
|
|
30208
|
-
}
|
|
30209
32144
|
async function getSwarmConfigs2(filters) {
|
|
30210
32145
|
const conditions = [];
|
|
30211
32146
|
const params = [];
|
|
@@ -30231,7 +32166,7 @@ async function getInjectableGlobalConfigs2() {
|
|
|
30231
32166
|
WHERE scope = 'global'
|
|
30232
32167
|
AND UPPER(key) NOT IN ('API_KEY', 'SECRETS_ENCRYPTION_KEY', 'CORS_ALLOW_ANY_ORIGIN', 'EXTENSION_ALLOW_LEAD_ACTIVATION', 'CHAT_SDK_API_URL_OVERRIDES', ${teamsSdkEnvKeysSql()})
|
|
30233
32168
|
ORDER BY key ASC`);
|
|
30234
|
-
return rows.filter((row) => !isInternalConfigKey(row.key)).map(rowToSwarmConfig);
|
|
32169
|
+
return rows.filter((row) => !isInternalConfigKey(row.key) && !isApiProcessControlEnvKey(row.key) && !invalidConfigKeyError(row.key)).map(rowToSwarmConfig);
|
|
30235
32170
|
}
|
|
30236
32171
|
async function getSwarmConfigById2(id) {
|
|
30237
32172
|
const row = await getDbClient2().get("SELECT * FROM swarm_config WHERE id = ?", [
|
|
@@ -30253,6 +32188,9 @@ async function getSwarmConfigLookupById2(id) {
|
|
|
30253
32188
|
};
|
|
30254
32189
|
}
|
|
30255
32190
|
async function upsertSwarmConfig2(data) {
|
|
32191
|
+
const keyError = invalidConfigKeyError(data.key);
|
|
32192
|
+
if (keyError)
|
|
32193
|
+
throw new Error(keyError);
|
|
30256
32194
|
if (isReservedConfigKey(data.key)) {
|
|
30257
32195
|
throw reservedKeyError(data.key);
|
|
30258
32196
|
}
|
|
@@ -30304,13 +32242,6 @@ async function upsertSwarmConfig2(data) {
|
|
|
30304
32242
|
if (!row)
|
|
30305
32243
|
throw new Error("Failed to upsert swarm config");
|
|
30306
32244
|
const config = rowToSwarmConfig(row);
|
|
30307
|
-
if (config.envPath) {
|
|
30308
|
-
try {
|
|
30309
|
-
writeEnvFile([config]);
|
|
30310
|
-
} catch (e) {
|
|
30311
|
-
console.error(`Failed to write env file ${config.envPath}:`, e);
|
|
30312
|
-
}
|
|
30313
|
-
}
|
|
30314
32245
|
if (config.isSecret) {
|
|
30315
32246
|
registerStoredSecret(config.value, configSecretName(config.key));
|
|
30316
32247
|
registerSensitiveKeyName(config.key);
|
|
@@ -30658,31 +32589,6 @@ async function getRecentFailedCount2(hours = 24) {
|
|
|
30658
32589
|
WHERE status = 'failed' AND finishedAt > ?`, [since]);
|
|
30659
32590
|
return row?.count ?? 0;
|
|
30660
32591
|
}
|
|
30661
|
-
function rowToWorkflow(row) {
|
|
30662
|
-
return {
|
|
30663
|
-
id: row.id,
|
|
30664
|
-
key: row.key,
|
|
30665
|
-
name: row.name,
|
|
30666
|
-
description: row.description ?? undefined,
|
|
30667
|
-
enabled: row.enabled === 1,
|
|
30668
|
-
definition: JSON.parse(row.definition),
|
|
30669
|
-
triggers: JSON.parse(row.triggers),
|
|
30670
|
-
cooldown: row.cooldown ? JSON.parse(row.cooldown) : undefined,
|
|
30671
|
-
input: row.input ? JSON.parse(row.input) : undefined,
|
|
30672
|
-
triggerSchema: row.triggerSchema ? JSON.parse(row.triggerSchema) : undefined,
|
|
30673
|
-
params: JSON.parse(row.params),
|
|
30674
|
-
requiredParams: JSON.parse(row.requiredParams),
|
|
30675
|
-
requires: JSON.parse(row.requires),
|
|
30676
|
-
dir: row.dir ?? undefined,
|
|
30677
|
-
vcsRepo: row.vcs_repo ?? undefined,
|
|
30678
|
-
createdByAgentId: row.createdByAgentId ?? undefined,
|
|
30679
|
-
updatedByAgentId: row.updatedByAgentId ?? undefined,
|
|
30680
|
-
createdAt: normalizeDateRequired(row.createdAt),
|
|
30681
|
-
lastUpdatedAt: normalizeDateRequired(row.lastUpdatedAt),
|
|
30682
|
-
createdBy: row.created_by ?? undefined,
|
|
30683
|
-
updatedBy: row.updated_by ?? undefined
|
|
30684
|
-
};
|
|
30685
|
-
}
|
|
30686
32592
|
async function createWorkflow2(data, source) {
|
|
30687
32593
|
const id = crypto.randomUUID();
|
|
30688
32594
|
const row = await getDbClient2().get(`INSERT INTO workflows (id, "key", name, description, definition, triggers, cooldown, input, triggerSchema, params, requiredParams, requires, dir, vcs_repo, createdByAgentId, updatedByAgentId, created_by, updated_by, enabled)
|
|
@@ -34154,6 +36060,9 @@ function parseJsonColumn(value) {
|
|
|
34154
36060
|
}
|
|
34155
36061
|
function rowToScriptRun(row) {
|
|
34156
36062
|
return {
|
|
36063
|
+
objectScriptId: row.objectScriptId ?? undefined,
|
|
36064
|
+
objectId: row.objectId == null ? undefined : scrubSecrets(row.objectId),
|
|
36065
|
+
objectMethod: row.objectMethod ?? undefined,
|
|
34157
36066
|
id: row.id,
|
|
34158
36067
|
agentId: row.agentId,
|
|
34159
36068
|
scriptName: row.scriptName ?? undefined,
|
|
@@ -34174,6 +36083,9 @@ function rowToScriptRun(row) {
|
|
|
34174
36083
|
}
|
|
34175
36084
|
function rowToScriptRunListItem(row) {
|
|
34176
36085
|
return {
|
|
36086
|
+
objectScriptId: row.objectScriptId ?? undefined,
|
|
36087
|
+
objectId: row.objectId == null ? undefined : scrubSecrets(row.objectId),
|
|
36088
|
+
objectMethod: row.objectMethod ?? undefined,
|
|
34177
36089
|
id: row.id,
|
|
34178
36090
|
agentId: row.agentId,
|
|
34179
36091
|
scriptName: row.scriptName ?? undefined,
|
|
@@ -34229,8 +36141,8 @@ async function recordInlineScriptRun2(data) {
|
|
|
34229
36141
|
const row = await client.get(`INSERT INTO script_runs
|
|
34230
36142
|
(id, agentId, scriptName, source, sourceHash, args, kind, status, output, error,
|
|
34231
36143
|
startedAt, finishedAt, requestedByUserId, created_by, updated_by, apiEndpointId,
|
|
34232
|
-
sourceStepId, parentScriptRunId)
|
|
34233
|
-
VALUES (?, ?, ?, '', ?, ?, 'inline', ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
36144
|
+
sourceStepId, parentScriptRunId, objectScriptId, objectId, objectMethod)
|
|
36145
|
+
VALUES (?, ?, ?, '', ?, ?, 'inline', ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
34234
36146
|
RETURNING *`, [
|
|
34235
36147
|
data.id,
|
|
34236
36148
|
data.agentId,
|
|
@@ -34247,7 +36159,10 @@ async function recordInlineScriptRun2(data) {
|
|
|
34247
36159
|
data.createdBy ?? null,
|
|
34248
36160
|
data.apiEndpointId ?? null,
|
|
34249
36161
|
provenance?.sourceStepId ?? null,
|
|
34250
|
-
provenance?.sourceScriptRunId ?? null
|
|
36162
|
+
provenance?.sourceScriptRunId ?? null,
|
|
36163
|
+
data.objectScriptId ?? null,
|
|
36164
|
+
data.objectId ?? null,
|
|
36165
|
+
data.objectMethod ?? null
|
|
34251
36166
|
]);
|
|
34252
36167
|
if (!row)
|
|
34253
36168
|
throw new Error("Failed to record inline script run");
|
|
@@ -34263,20 +36178,8 @@ async function getScriptRunByIdempotencyKey2(idempotencyKey) {
|
|
|
34263
36178
|
return row ? rowToScriptRun(row) : null;
|
|
34264
36179
|
}
|
|
34265
36180
|
async function listScriptRuns2(opts) {
|
|
34266
|
-
const conditions =
|
|
34267
|
-
const params = [];
|
|
34268
|
-
if (opts?.status) {
|
|
34269
|
-
conditions.push("status = ?");
|
|
34270
|
-
params.push(opts.status);
|
|
34271
|
-
}
|
|
34272
|
-
if (opts?.agentId) {
|
|
34273
|
-
conditions.push("agentId = ?");
|
|
34274
|
-
params.push(opts.agentId);
|
|
34275
|
-
}
|
|
34276
|
-
if (opts?.scriptName) {
|
|
34277
|
-
conditions.push("scriptName = ?");
|
|
34278
|
-
params.push(opts.scriptName);
|
|
34279
|
-
}
|
|
36181
|
+
const { conditions, params: filterParams } = scriptRunFilterSql(opts);
|
|
36182
|
+
const params = [...filterParams];
|
|
34280
36183
|
const limit = opts?.limit ?? 50;
|
|
34281
36184
|
const offset = opts?.offset ?? 0;
|
|
34282
36185
|
params.push(limit, offset);
|
|
@@ -34293,27 +36196,17 @@ async function listScriptRuns2(opts) {
|
|
|
34293
36196
|
error,
|
|
34294
36197
|
last_heartbeat_at,
|
|
34295
36198
|
idempotencyKey,
|
|
34296
|
-
requestedByUserId
|
|
36199
|
+
requestedByUserId,
|
|
36200
|
+
objectScriptId,
|
|
36201
|
+
objectId,
|
|
36202
|
+
objectMethod
|
|
34297
36203
|
FROM script_runs ${where}
|
|
34298
36204
|
ORDER BY startedAt DESC
|
|
34299
36205
|
LIMIT ? OFFSET ?`, params);
|
|
34300
36206
|
return rows.map(rowToScriptRunListItem);
|
|
34301
36207
|
}
|
|
34302
36208
|
async function countScriptRuns2(opts) {
|
|
34303
|
-
const conditions =
|
|
34304
|
-
const params = [];
|
|
34305
|
-
if (opts?.status) {
|
|
34306
|
-
conditions.push("status = ?");
|
|
34307
|
-
params.push(opts.status);
|
|
34308
|
-
}
|
|
34309
|
-
if (opts?.agentId) {
|
|
34310
|
-
conditions.push("agentId = ?");
|
|
34311
|
-
params.push(opts.agentId);
|
|
34312
|
-
}
|
|
34313
|
-
if (opts?.scriptName) {
|
|
34314
|
-
conditions.push("scriptName = ?");
|
|
34315
|
-
params.push(opts.scriptName);
|
|
34316
|
-
}
|
|
36209
|
+
const { conditions, params } = scriptRunFilterSql(opts);
|
|
34317
36210
|
const where = conditions.length > 0 ? `WHERE ${conditions.join(" AND ")}` : "";
|
|
34318
36211
|
const row = await getDbClient2().get(`SELECT COUNT(*) AS count FROM script_runs ${where}`, params);
|
|
34319
36212
|
return row?.count ?? 0;
|
|
@@ -34491,6 +36384,7 @@ var init_db4 = __esm(() => {
|
|
|
34491
36384
|
init_workflow_idempotency();
|
|
34492
36385
|
init_workflow_run_definitions();
|
|
34493
36386
|
init_workflow_runs();
|
|
36387
|
+
init_read2();
|
|
34494
36388
|
init_scrub_json();
|
|
34495
36389
|
init_sealed_json();
|
|
34496
36390
|
init_secret_registry();
|
|
@@ -34504,9 +36398,11 @@ var init_db4 = __esm(() => {
|
|
|
34504
36398
|
init_approvals();
|
|
34505
36399
|
init_context_versions();
|
|
34506
36400
|
init_script_runs();
|
|
36401
|
+
init_script_runs();
|
|
34507
36402
|
init_session_moves();
|
|
34508
36403
|
init_skill_audit();
|
|
34509
36404
|
init_workflow_run_definitions();
|
|
36405
|
+
init_read2();
|
|
34510
36406
|
init_runtime2();
|
|
34511
36407
|
init_read();
|
|
34512
36408
|
init_write();
|
|
@@ -34514,7 +36410,7 @@ var init_db4 = __esm(() => {
|
|
|
34514
36410
|
configureAgentDependencies({
|
|
34515
36411
|
createLogEntry: (entry) => createLogEntry2(entry),
|
|
34516
36412
|
installSystemDefaultSkillsForAgent: (agentId) => installSystemDefaultSkillsForAgent2(agentId),
|
|
34517
|
-
resolvePendingImportAssignments: async (agent) => (await import("./pending-
|
|
36413
|
+
resolvePendingImportAssignments: async (agent) => (await import("./pending-xgv316w0.js")).resolvePendingImportAssignments(agent)
|
|
34518
36414
|
});
|
|
34519
36415
|
configureTaskWriteDependencies({
|
|
34520
36416
|
createLogEntry: (...args) => createLogEntry2(...args),
|
|
@@ -34564,4 +36460,4 @@ var init_db4 = __esm(() => {
|
|
|
34564
36460
|
};
|
|
34565
36461
|
});
|
|
34566
36462
|
|
|
34567
|
-
export { auditAssetKeys, init_asset_key_audit, CredentialBindingSchema, placeholderForConfigKey, CredentialBroker, defaultCredentialBindings, isPrivateAddress, assertUrlSafe, EgressDeniedError, createGuardedFetch, createSsrfGuardedFetch, parseEgressAllowlist, init_egress_guard, init_credential_broker, encryptSecret, decryptSecret, init_secrets_cipher, getEncryptionKey, init_key_bootstrap, init_crypto, withLoopPath, bindLoopPath, startEventLoopLagProbe, stopEventLoopLagProbe, init_event_loop_lag, DbTransactionDeadlineError, isInTransaction, init_db_client, breaksJsonValidity, scrubJsonValue, foldHexCopies, init_scrub_json, sealJson, openSealedJson, init_sealed_json, getPromptTemplateDefaultDrift, init_default_drift, init_templates2, init_templates3, wasDbCreatedThisBoot, isSqliteVecAvailable2, resolveSqliteVecExtensionPath2, __resetSqliteVecExtensionPathCacheForTests2, initDb2, getDb2, closeDb2, getDbClient2, init_runtime2, SessionCostConflictError2, insertSessionCost2, slackContextKey, chatSdkContextKey, chatThreadOfContextKey, agentmailContextKey, githubContextKey, gitlabContextKey, azureDevOpsContextKey, azureDevOpsWorkItemContextKey, bitbucketContextKey, linearContextKey, buildJiraContextKey, scheduleContextKey, workflowContextKey, agentContextKey, pageContextKey, APP_SESSION_KEY_PATTERN, appSessionContextKey, init_context_key, sessionSourceKey, sourceOfKey, SOURCE_GROUPS_READ_ONLY, sourceMoveError, init_source_key, TaskCreationBlockedError, TaskRoutingAuthorizationError, init_errors2, checkSlackRoutingCoherence, init_slack_routing, init_catalog, catalog_default, COMPANY_TEAM_SIZES, COMPANY_USE_CASES, USER_FUNCTIONS, reportedUseCase, reportedUserFunction, init_company_profile, mapTriggerSurface, init_telemetry_context, TELEMETRY_PROXY_ORIGIN, normalizeOrgWebsite, orgLogoUrl, isFilledOrgLogoUrl, init_org_website, beginRequestAuthScope, setRequestAuth, getRequestAuth, getCurrentRequestAuth, runWithoutRequestAuth, authUserId, authUser, isOperatorAuth, getCurrentRequestUserId, getCurrentRunProvenance, init_request_auth_context, setTelemetryIngestObserver, isTelemetryEnabled, _resolveIntegrationType, _resolveIntegrationProvider, initTelemetry, setTelemetryRoleResolver, setTelemetryFunctionResolver, isTelemetryReady, track, trackRelayed, telemetry, emitIntegrationConnected, init_telemetry, isRbacEnabled, decideAdmission, decideToolAdmission, grantLeadEquivalence, revokeLeadEquivalence, init_elevated_agents, LEGACY_RULES, setAuditSink, clearAuditSink, can, init_can, PermissionVerbSchema, init_rbac, randomChars, init_short_id, CHAT_SDK_ADAPTER_NAMES, CHAT_SDK_ADAPTER_SCHEMAS, ChatSdkAdaptersDraftSchema, firstIssueText, isAdapterEntryEnabled, init_schema, TELEMETRY_RANKING_KEY, PUBLIC_RANKING_ENABLED_KEY, RANKING_CATEGORIES, readTelemetryRanking, rankingFormSchema, buildListing, init_telemetry_ranking, resolveQuickJSPoolSize, init_quickjs_pool_config, SLACK_REACTION_DEFAULTS, SLACK_REACTION_CONFIG_KEYS, reactionName, isSlackIconConfigKey, reactionStatusIcon, iconPrefix, completedStatusIcon, init_reaction_shortcode, UI_SPEC_SCRIPT_ACTIONS_KEY, parseScriptActionAllowlist, init_script_allowlist, API_DRAINING_HEADER, API_DRAIN_MAX_MS_LIMIT, isApiDrainingResponse, init_api_drain2, isEnvExportRestrictedKey, init_config_env_export, parseEnabledTools, init_enabled_tools, parseFollowUpGateScheduleIds, isFollowUpGateScheduleId, init_follow_up_gate_schedule_ids, parseTaskToolManifest, CHAT_TASK_ONLY_TOOLS, isChatSdkTask, selectTaskTools, init_task_tool_manifest, tierConfigKey, init_model_tier_keys, isApiOnlyConfigKey, isInternalConfigKey, internalConfigKeyError, isHumanOnlyConfigKey, humanOnlyConfigKeyError, humanOnlyConfigKeyPageError, isReservedConfigKey, reservedKeyError, MAX_DB_RETENTION_DAYS, DB_RETENTION_TUNING_BOUNDS, APPS_JSON_COLUMN_MAX_BYTES_BOUNDS, CODEX_OAUTH_KEEP_WARM_MAX_AGE_HOURS_BOUNDS, SCHEDULER_INTERVAL_MS_BOUNDS, validateRuntimeTokenTtlHours, validateControllerTokenTtlDays, validateControllerGraceSec, validateConfigValue, validateConfigEntry, validateExportToEnv, init_swarm_config_guard, cachedUserRole, cachedUserFunction, invalidateTelemetryUserRole, configureOrgDomainPersistence, recomputeOrgDomain, scheduleOrgDomainRecompute, init_telemetry_identity, resolveTriggerSurface, emitTaskTelemetry, init_telemetry_trigger, MASKED_SECRET_VALUE, init_config_secrets, HeartbeatExpiryError, init_heartbeat_expiry, isEffectiveOutputSchema, init_output_schema, isRuntimePoolsEnabled, init_runtime_pools_flag, normalizeDate, normalizeDateRequired, init_date_utils, rowToAgent, updateAgentCredentialState2, updateAgentCredentialMissing2, AgentDeletedError2, isAgentDeleted2, createAgent2, getAgentById2, EXTENSION_AGENT_ROLE2, NOT_EXTENSION_AGENT_SQL2, isExtensionAgent2, extensionAgentAssignmentError2, ReservedAgentRoleError2, reservedRoleViolation2, ExtensionAgentAssignmentError2, getAllAgents2, getAgentStatusCounts2, getLeadAgent2, updateAgentStatus2, updateAgentMaxTasks2, updateAgentProvider2, setAgentHarnessProvider2, updateAgentCredStatus2, listAgentsWithCredStatusByProvider2, getAgentHarnessProviders2, updateAgentActivity2, MAX_EMPTY_POLLS2, incrementEmptyPollCount2, resetEmptyPollCount2, shouldBlockPolling2, deleteAgent2, getActiveTaskCount2, hasCapacity2, getRemainingCapacity2, updateAgentStatusFromCapacity2, isPoolAffinityEnforcementEnabled2, buildRoutingAffinityFromAgent2, isAgentEligibleForTask2, getAgentDailyTaskCounts2, init_agents, closeSlackTreeIfSettled, getSlackThreadsOfTasks, slackThreadHasBotReplySince, slackThreadHasOutcomeWork, observeSlackTreeVisibility, getSlackProcessingThreads, init_slack_trees, WorkflowReplayStateError, init_workflow_replay, getWorkflowRunTriggeredByAgentId, getWorkflowRunSummary, getWorkflowRunStepsSlimByRunId, WORKFLOW_RUN_TREE_MAX_DEPTH, WorkflowRunTreeError, getRunLineageBlock, getWorkflowRunTreeIds, getWorkflowRunStatus, getOpenWorkflowTreeTaskIds, getTaskIdsWithDependents, workflowRunTreeHasOpenWork, getWorkflowRunTree, cancelOpenWorkflowTreeSteps, disarmWorkflowTreeRetries, cancelLiveWorkflowTreeRuns, getChildWorkflowRunId, isParentStepAttemptCurrent, getRunningSubWorkflowSteps, getWorkflowRunParent, getWorkflowRunLineage, getSettledChildRunParentSteps, emitRunFinished, createForeachChildSteps, createForeachAttemptSteps, init_workflow_runs, OpenAI2, init_openai2, LEARNING_TTL_DAYS, LEARNING_DUPLICATE_MIN_SIMILARITY, CANDIDATE_SET_MULTIPLIER, isGraphExpansionEnabled, EMBEDDING_DIMENSIONS, init_constants2, LONGTERM_ROOT, LEARNINGS_ROOT, MEMORY_KEY_PATTERN, MEMORY_KEY_PATTERN_MESSAGE, MEMORY_KEY_MAX_LENGTH, isLongtermKey, longtermKeyError, isConsolidatedKey, consolidatedKeyMessage, resolveStoreKey, init_key_paths, computeScore, rerank, init_reranker, isReviewTaskId, dropReviewTaskCompletions, init_review_recall_filter, searchMemoryCandidates, init_search_candidates, memorySearchReader, init_search_reader, rowToCandidate, init_sqlite_store, getEmbeddingProvider2, resetEmbeddingProvider2, getMemoryStore2, init_memory, embeddingProvider2, computeScriptEmbedding2, writeScriptEmbedding2, embedScript2, searchScripts2, reembedAllScripts2, init_embeddings, upsertScriptByName, getScript, getGlobalScriptContentHashes, getScriptById, getScriptVersion, listScripts, listScriptVersions, deleteScript, touchScratchScriptLastUsed, restoreScratchScriptLastUsedIfUnchanged, createScriptApi, listScriptApisForScript, getScriptApiById, getScriptApiSecret, updateScriptApi, rotateScriptApiSecret, deleteScriptApi, recordScriptApiUsage, init_db3, oauthSecretName, registerStoredSecret, loadSecretRegistry, init_secret_registry, getDefaultAuthorizationIdForProvider, getOAuthApp, getOAuthAppById, getOAuthAppIdByProvider, createOAuthApp, updateOAuthAppById, upsertOAuthApp, listAuthorizationsForApp, getAuthorizationById, upsertAuthorization, updateAuthorizationTokens, updateAuthorizationIdentity, deleteAuthorizationById, deleteAuthorizationsForApp, createOAuthPending, consumeOAuthPending, gcOAuthPending, markAuthorizationRefreshFailed, hasOAuthTokens, getOAuthTokens, listAuthorizationSweepRows, listKeepAliveAuthorizations, deleteOAuthTokens, acquireOAuthRefreshLock, releaseOAuthRefreshLock, init_oauth, normalizeVcsRepo, vcsRepoName, vcsRepoUrlMatches, init_vcs_repo_match, taskModelPin, resumedTaskModelSelection, init_model_pin, normalizeModelKey, init_pricing_normalize, buildModelsDevSeedRows, seedPricingFromModelsDev, init_seed_pricing, buildCatalogEntries, replaceModelCatalog, touchModelCatalogCheckedAt, countModelCatalog, getModelCatalogMeta, updateModelCatalogMeta, upsertModelCatalogOverlay, deleteModelCatalogOverlay, expireMatchedOverlays, applyOverlayPricingRows, reloadModelsCatalog, loadModelsCatalog, init_model_catalog_store, listHarnessModelSupport, recordHarnessModelSupport, agentRanModel, getAgentHarnessCliVersion, setAgentHarnessCliVersion, init_harness_model_support, sanitizeModelTierOverrides, parseModelTierOverridesHeader, modelTierOverridesDiffer, setAgentModelTierOverrides, previewModelTiers, recordClaimModelResolution, init_model_tier_resolution, harnessModelErrorFor, poolTaskRunsOnHarness, explicitModelError, explicitModelErrorForAgent, init_model_validation2, runtimeReadsRepoSecrets, configPools, checkProfileForAgent, formatProfileCheckFailures, init_model_profile_check, startTaskSearchBackfill, stopTaskSearchBackfill, init_search_index, rowToAgentTask, getTaskById2, getChildTasks2, TASK_LINEAGE_LIMITS2, getTaskLineage2, hasNonTerminalResumeChild2, SUPERSEDED_RESUME_REPAIR_WINDOW_MS2, getSupersededTasksWithoutResume2, getSupersededTasksWithUnsettledDependents2, hasNonTerminalRerouteDecisionChild2, getTasksByAgentId2, getTasksDispatchedFrom2, getAgentCurrentTask2, getTasksByStatus2, findTaskByVcs2, findActiveTasksByVcs2, findTaskByGitHub2, readableSessionCondition, getAllTasks2, getTasksCount2, getTaskStats2, getCompletedSlackTasks2, getPendingSlackRelayTasks2, markSlackRelayAttempted2, markSlackRelayDelivered2, markFinalizedSlackRelaysDelivered2, getPendingChatRelayTasks2, giveUpStaleChatRelays2, markChatRelayAttempted2, recordChatRelayError2, markChatRelayDelivered2, markChatRelayGivenUp2, getRecentlyFinishedWorkerTasks2, markTasksNotified2, resetTasksNotified2, getInProgressSlackTasks2, getSlackTasksMissingTree2, getInProgressTasksByContextKey2, isLinearTrackerContextKey2, findExistingLinearTrackerContextWork2, getLatestTaskByContextKey2, getLatestScriptRunStepTaskByContextKey2, getAgentWorkingOnThread2, getLatestActiveTaskInThread2, getLatestLeadTaskInThread2, getAgentWorkingOnContextKey2, getLatestTaskByContextKeyPrefix2, getLatestActiveTaskByContextKey2, getLatestLeadTaskByContextKey2, getFirstTaskInThread2, getMostRecentTaskInThread2, findCompletedTasksInThread2, findRecentFailedTaskInThread2, countAgentDispatchesInThread2, findRecentCancelledTaskInThread2, init_read, MODEL_PROFILE_CONFIG_KEY, hasUnreadableCredentialAllowlist, listModelProfiles, getModelProfileByName, createModelProfile, updateModelProfile, TASK_HOLDS_PROFILE_SQL, repairWindowStart, modelProfileReferences, modelProfileRefError, isModelNameTakenError, deleteModelProfile, MAX_MODEL_PROFILE_FALLBACKS, modelProfileFallbacksError, taskProfileError, scheduleProfileUpdate, init_model_profiles, SESSION_ACTIVITY_REFRESH_MIN_INTERVAL_MS2, refreshActiveSessionOnActivity2, getActiveSessionById, init_active_sessions, STEERING_MOVED_ERROR, SteeringRequestError, SteeringBlockedError, isSteeringEnabled, getTaskSteeringFields, getTaskSteeringFieldsForTasks, promotePendingSteeringForTask, markSteeringUndeliverable, carryUnhandledSteering, requestSteering, init_steering2, onTaskStarted, init_task_lifecycle_events, listApprovalRequestSummaries2, getPendingApprovalVoteState2, recordApprovalVotes2, getPendingApprovalsForTasks2, approvalCancellationNotificationKey, listUndeliveredCancelledApprovalRequestIds, init_approvals, computeContentHash2, createContextVersion2, getLatestContextVersion2, getContextVersion2, getContextVersionHistory2, AssetKeyMovesBlockedError2, assertAssetKeyMovesAllowed2, moveTaskChainKeyInTx2, moveSessionChains, moveKeyFavorites, listPrefixRoots, listSharedPrefixRoots, init_session_moves, getSessionGroupKey, sessionSummaryQuery, getSessionReadState, getSessionTree, triageSessionList, init_session_tree, setHumanFreeQueueListener, reclassifyTaskHumanFree, drainHumanFreeReclassifyQueue, init_human_free, channelTopic, addWorkerSubscription, removeWorkerSubscription, listSubscribedWorkerAgents, init_channels, publishWorkerNudge, init_worker_nudges, createTask2, getPendingTaskForAgent2, assignUnassignedTaskPending2, startTask2, updateTaskClaudeSessionId2, recordTaskProviderIfUnset2, updateTaskTitle2, updateTaskTags2, setTaskTitleIfUnset2, completeTask2, failTask2, overwriteTerminalTaskResultText2, cancelTask2, skipTask2, supersedeTask2, markWorkflowStepTaskSuperseded2, settleSupersededTaskDependents2, backfillSupersedeTaskResumeTaskId2, pauseTask2, resumeTask2, getPausedTasksForAgent2, getOrphanedInProgressTasksForAgent2, resetOrphanedInProgressTasksForAgent2, getRecentlyCancelledTasksForAgent2, deleteTask2, updateTaskProgress2, init_write, quoteSqlIdentifier, USER_REFERENCE_COLUMNS_SQL, userReferenceRewriteSql, WORKFLOW_CONTEXT_REQUESTER_SQL, init_user_references, IdempotencyKeyTakenError, workflowRequestFingerprint, findAcceptedWorkflowOperation, assertWorkflowIdempotencyKeyUnused, recordAcceptedWorkflowOperation, init_workflow_idempotency, PINNED_WORKFLOW_KEYS2, toPinnedDefinition2, pinWorkflowDefinition2, getRunWorkflow2, deleteOrphanedRunDefinitions, init_workflow_run_definitions, recordKeySeatMismatch2, recordKeyValidation2, retirePoolKeyStatus, init_api_keys, getScriptRunExecutionArgs2, getScriptRunFollowUpGuard2, setScriptRunFollowUpGuard2, setSkillUpdatedBy2, literalPrefixPattern2, getSlackRenderV2ActivatedAt2, ensureSlackRenderV2Activation2, getSlackDelegationActivatedAt2, ensureSlackDelegationActivation2, isPendingSlackMessage2, isSettledSlackMessage2, recordSlackMessage2, reserveSlackMessage2, bindSlackMessageTimestamp2, updateSlackMessageRecord2, markSlackTreeRendered2, deleteSlackMessageRecord2, getSlackTreeMessage2, getSlackTreeMessageByThread2, getSlackOutcomeMessage2, getResolvableDeferralOutcomes2, markSlackDeferralResolved2, noteSlackOutcomeDeliveryFailure2, abandonSlackOutcomeDelivery2, getSlackTreeMessages2, getSlackMessageByChannelTs2, getSlackTasksInThread2, listSlackThreadsAwaitingHuman2, isSlackThreadAwaitingHuman2, markTaskSlackReplySent2, setSlackMessageTracking2, updateTaskVcs2, insertTaskAttachment2, recordTaskPullRequestAttachments2, getAssetKeyMappingByProvider2, upsertAssetKeyMapping2, getAssetKeyMapping2, listAssetSummaries2, moveAssetKey2, deleteTaskAttachment2, replaceTaskAttachment2, getTaskAttachments2, createSteeringMessage2, getSteeringMessagesForTask2, getSteeringMessageById2, getPendingSteeringForTask2, getPendingSteeringForAgent2, markSteeringDelivered2, markSteeringHandled2, markSteeringPromoted2, cancelPendingSteeringForTask2, hasPendingSteering2, getAgentWithTasks2, getAllAgentsWithTasks2, createLogEntry2, getLogsByAgentId2, getLogsByTaskId2, getLogsByTaskIdAndEventType2, getLogsByTaskIdChronological2, getLogsByEventType2, getAllLogs2, findRecentSimilarTasks2, createTaskExtended2, claimTask2, releaseTask2, acceptTask2, rejectTask2, moveTaskToBacklog2, moveTaskFromBacklog2, promoteDraftTask2, refreshDraftTaskLease2, promoteAbandonedDraftTasks2, releaseStaleReviewingTasks2, releaseStaleOfferedTasksForOfflineAgents2, getOfferedTasksForAgent2, claimOfferedTask2, getUnassignedTasksCount2, getUnassignedTaskIds2, getUnassignedTaskIdsForAgent2, checkDependencies2, getDependentTasks2, cascadeFailDependents2, updateAgentProfile2, updateAgentName2, createChannel2, getMessageById2, getChannelById2, getChannelByName2, getAllChannels2, deleteChannel2, postMessage2, getChannelMessages2, updateReadState2, getLastReadAt2, getUnreadMessages2, getMentionsForAgent2, getInboxSummary2, claimMentions2, releaseMentionProcessing2, releaseStaleMentionProcessing2, createService2, getServiceById2, getServiceByAgentAndName2, getServicesByAgentId2, getAllServices2, updateServiceStatus2, deleteService2, upsertService2, deleteServicesByAgentId2, createSessionLogs2, getSessionLogsByTaskId2, getSessionLogsBySession2, createSessionCost2, getSessionCostsByTaskId2, getSessionCostsByAgentId2, getAllSessionCosts2, getSessionCostsFiltered2, UNATTRIBUTED_USER_ID2, getSessionCostSummary2, getAttributionByPerson2, getDashboardCostSummary2, createInboxMessage2, getInboxMessageById2, getUnreadInboxMessages2, claimInboxMessages2, markInboxMessageRead2, markInboxMessageResponded2, markInboxMessageDelegated2, releaseStaleProcessingInbox2, getConcurrentContext2, getScheduledTasks2, getScheduledTaskById2, getScheduledTaskByName2, createScheduledTask2, updateScheduledTask2, deleteScheduledTask2, getDueScheduledTasks2, autoEncryptLegacyPlaintextSecrets2, maskSecrets2, getSwarmConfigs2, getInjectableGlobalConfigs2, getSwarmConfigById2, getSwarmConfigLookupById2, upsertSwarmConfig2, emitBuiltInIntegrationConnectedOnce2, deleteSwarmConfig2, deleteSwarmConfigByKey2, getResolvedConfig2, getSwarmRepos2, getSwarmRepoById2, getSwarmRepoByName2, getSwarmRepoByUrl2, createSwarmRepo2, updateSwarmRepo2, deleteSwarmRepo2, getAgentMailInboxMapping2, getAgentMailInboxMappingsByAgent2, getAllAgentMailInboxMappings2, createAgentMailInboxMapping2, deleteAgentMailInboxMapping2, findTaskByAgentMailThread2, insertActiveSession2, deleteActiveSession2, deleteActiveSessionById2, getActiveSessions2, heartbeatActiveSession2, cleanupStaleSessions2, cleanupAgentSessions2, updateActiveSessionProviderSessionId2, getActiveSessionForTask2, reassociateSessionLogs2, getStalledInProgressTasks2, getStalePinnedResumes2, failPendingResumeIfUnclaimed2, getIdleWorkersWithCapacity2, getUnassignedPoolTasks2, getStaleUnassignedAffinityTasks2, getRecentFailedTasks2, getRecentCompletedCount2, getRecentFailedCount2, createWorkflow2, getWorkflow2, listWorkflows2, updateWorkflow2, deleteWorkflow2, getWorkflowsByScheduleId2, createWorkflowRun2, getWorkflowRun2, updateWorkflowRun2, listWorkflowRuns2, countWorkflowRuns2, listWorkflowRunsPage2, createWorkflowRunStep2, getWorkflowRunStep2, updateWorkflowRunStep2, getWorkflowRunStepsByRunId2, getStuckWorkflowRuns2, getLastSuccessfulRun2, getLastRunStart2, getRetryableSteps2, getCompletedStepNodeIds2, getTaskByWorkflowRunStepId2, detachTaskFromWorkflowRunStep2, getStepByIdempotencyKey2, getStepCountForNode2, getLatestStepForNode2, getCurrentStepForNode2, createWorkflowVersion2, getWorkflowVersions2, getWorkflowVersion2, createAppVersion2, getAppVersions2, getAppVersion2, createPage2, getPage2, getPageBySlug2, getLatestPageBySlug2, listPagesByAgent2, listAllPages2, countAllPages2, countPagesByAgent2, updatePage2, deletePage2, incrementPageViewCount2, createPageVersion2, getPageVersions2, getPageVersion2, createMetric2, getMetric2, getMetricBySlug2, listMetricsByAgent2, listAllMetrics2, countAllMetrics2, countMetricsByAgent2, updateMetric2, deleteMetric2, createMetricVersion2, getMetricVersions2, getMetricVersion2, getPromptTemplates2, getPromptTemplateById2, upsertPromptTemplate2, deletePromptTemplate2, resetPromptTemplateToDefault2, getPromptTemplateHistory2, resolvePromptTemplate2, checkoutPromptTemplate2, getAllChannelActivityCursors2, getChannelActivityCursor2, upsertChannelActivityCursor2, createApprovalRequest2, getApprovalRequestById2, resolveApprovalRequest2, cancelApprovalRequestById2, cancelPendingApprovalRequestsForRun2, listCancelledApprovalRequestsForRun2, listCancelledApprovalRequestsForStep2, claimApprovalCancellationNotification2, completeApprovalCancellationNotificationClaim2, releaseApprovalCancellationNotificationClaim2, updateApprovalRequestNotifications2, listApprovalRequests2, getStuckApprovalRuns2, getApprovalRequestByStepId2, getExpiredPendingApprovals2, getStaleApprovalRequests2, createWaitState2, getWaitStateById2, getWaitStateByStepId2, getDueWaitStates2, getPendingEventWaitNames2, getPendingWaitsByEvent2, resolveWaitState2, getStuckWaitRuns2, SKILL_FILE_LIMITS2, normalizeSkillFilePath2, createSkill2, updateSkill2, listSkillFileManifest2, getSkillFiles2, getSkillFile2, upsertSkillFile2, upsertSkillFiles2, deleteSkillFile2, deleteSkill2, getSkillById2, getSkillByName2, listSkills2, searchSkills2, installSkill2, getSystemDefaultSkills2, installSystemDefaultSkillsForAgent2, uninstallSkill2, getAgentSkills2, toggleAgentSkill2, createMcpServer2, emitMcpServerConnectedTelemetry2, updateMcpServer2, deleteMcpServer2, getMcpServerById2, getMcpServerByName2, listMcpServers2, installMcpServer2, uninstallMcpServer2, getAgentMcpServers2, createContextSnapshot2, getContextSnapshotsByTaskId2, getContextSnapshotsBySessionId2, getContextSummaryByTaskId2, getAvailableKeyIndices2, recordKeyUsage2, setApiKeyPlan2, markKeyRateLimited2, recordKeyAuthFailure2, recordKeyRateLimitWindows2, setApiKeyName2, clearKeyRateLimit2, getKeyStatuses2, getKeyCostSummary2, getUserById2, getAllUsers2, createUser2, updateUser2, deleteUser2, listInboxState2, upsertInboxState2, listFavorites2, listUserFavorites2, getFavoriteItemIdSet2, setFavorite2, setUserFavorite2, withFavoriteFlags2, listTaskTemplates2, getRootTaskChain2, listRecentSessions2, countSessions2, getBudget2, getBudgets2, upsertBudget2, deleteBudget2, getAllPricingRows2, getPricingRows2, getActivePricingRow2, insertPricingRow2, deletePricingRow2, getDailySpendForAgent2, getDailySpendGlobal2, getDailySpendForUser2, recordBudgetRefusalNotification2, getBudgetRefusalNotification2, getRecentBudgetRefusalNotifications2, hasBudgetRefusalNotificationToday2, setBudgetRefusalFollowUpTaskId2, getLiveAgentCounts2, getReadyAgentCounts2, getInstanceActivity2, getSwarmMetrics2, hasFirstCompletedTask2, getKv2, sweepExpiredKv2, sweepExpiredKvPrefix2, upsertKv2, claimKv2, deleteKv2, KvTypeCollisionError2, incrKv2, kvPrefixUpperBound2, listKv2, countKv2, createScriptRun2, recordInlineScriptRun2, getScriptRun2, getScriptRunByIdempotencyKey2, listScriptRuns2, countScriptRuns2, countActiveScriptRuns2, updateScriptRun2, updateScriptRunIfNotTerminal2, updateScriptRunIfRunning2, getRunningScriptRuns2, getScriptRunJournalStep2, upsertScriptRunJournalStep2, listScriptRunJournalSteps2, countScriptRunJournalSteps2, countScriptRunJournalAgentTaskSteps2, exports_db, init_db4 };
|
|
36463
|
+
export { auditAssetKeys, init_asset_key_audit, CredentialBindingSchema, placeholderForConfigKey, CredentialBroker, defaultCredentialBindings, isPrivateAddress, assertUrlSafe, EgressDeniedError, createGuardedFetch, createSsrfGuardedFetch, parseEgressAllowlist, init_egress_guard, init_credential_broker, encryptSecret, decryptSecret, init_secrets_cipher, getEncryptionKey, init_key_bootstrap, init_crypto, withLoopPath, bindLoopPath, startEventLoopLagProbe, stopEventLoopLagProbe, init_event_loop_lag, DbTransactionDeadlineError, isInTransaction, init_db_client, breaksJsonValidity, scrubJsonValue, foldHexCopies, init_scrub_json, sealJson, openSealedJson, init_sealed_json, getPromptTemplateDefaultDrift, init_default_drift, init_templates2, init_templates3, wasDbCreatedThisBoot, isSqliteVecAvailable2, resolveSqliteVecExtensionPath2, __resetSqliteVecExtensionPathCacheForTests2, initDb2, getDb2, closeDb2, getDbClient2, init_runtime2, SessionCostConflictError2, insertSessionCost2, slackContextKey, chatSdkContextKey, chatThreadOfContextKey, agentmailContextKey, githubContextKey, gitlabContextKey, azureDevOpsContextKey, azureDevOpsWorkItemContextKey, bitbucketContextKey, linearContextKey, buildJiraContextKey, scheduleContextKey, workflowContextKey, agentContextKey, pageContextKey, APP_SESSION_KEY_PATTERN, appSessionContextKey, init_context_key, sessionSourceKey, sourceOfKey, SOURCE_GROUPS_READ_ONLY, sourceMoveError, init_source_key, TaskCreationBlockedError, TaskRoutingAuthorizationError, init_errors2, checkSlackRoutingCoherence, init_slack_routing, init_catalog, catalog_default, COMPANY_TEAM_SIZES, COMPANY_USE_CASES, USER_FUNCTIONS, reportedUseCase, reportedUserFunction, init_company_profile, mapTriggerSurface, init_telemetry_context, TELEMETRY_PROXY_ORIGIN, normalizeOrgWebsite, orgLogoUrl, isFilledOrgLogoUrl, init_org_website, beginRequestAuthScope, setRequestAuth, getRequestAuth, getCurrentRequestAuth, runWithoutRequestAuth, authUserId, authUser, isOperatorAuth, getCurrentRequestUserId, getCurrentRunProvenance, init_request_auth_context, setTelemetryIngestObserver, isTelemetryEnabled, _resolveIntegrationType, _resolveIntegrationProvider, initTelemetry, setTelemetryRoleResolver, setTelemetryFunctionResolver, isTelemetryReady, track, trackRelayed, telemetry, emitIntegrationConnected, init_telemetry, isRbacEnabled, decideAdmission, decideToolAdmission, grantLeadEquivalence, revokeLeadEquivalence, init_elevated_agents, LEGACY_RULES, setAuditSink, clearAuditSink, can, init_can, PermissionVerbSchema, init_rbac, randomChars, init_short_id, CHAT_SDK_ADAPTER_NAMES, CHAT_SDK_ADAPTER_SCHEMAS, ChatSdkAdaptersDraftSchema, firstIssueText, isAdapterEntryEnabled, init_schema, TELEMETRY_RANKING_KEY, PUBLIC_RANKING_ENABLED_KEY, RANKING_CATEGORIES, readTelemetryRanking, rankingFormSchema, buildListing, init_telemetry_ranking, resolveQuickJSPoolSize, init_quickjs_pool_config, SLACK_REACTION_DEFAULTS, SLACK_REACTION_CONFIG_KEYS, reactionName, isSlackIconConfigKey, reactionStatusIcon, iconPrefix, completedStatusIcon, init_reaction_shortcode, UI_SPEC_SCRIPT_ACTIONS_KEY, parseScriptActionAllowlist, init_script_allowlist, API_DRAINING_HEADER, API_DRAIN_MAX_MS_LIMIT, isApiDrainingResponse, init_api_drain2, isEnvExportRestrictedKey, init_config_env_export, isValidTimezone, formatDeferralDateTime, init_deferral_time, parseEnabledTools, init_enabled_tools, parseFollowUpGateScheduleIds, isFollowUpGateScheduleId, init_follow_up_gate_schedule_ids, parseTaskToolManifest, CHAT_TASK_ONLY_TOOLS, isChatSdkTask, selectTaskTools, init_task_tool_manifest, tierConfigKey, init_model_tier_keys, isApiOnlyConfigKey, isInternalConfigKey, internalConfigKeyError, isHumanOnlyConfigKey, humanOnlyConfigKeyError, humanOnlyConfigKeyPageError, isReservedConfigKey, reservedKeyError, MAX_DB_RETENTION_DAYS, DB_RETENTION_TUNING_BOUNDS, APPS_JSON_COLUMN_MAX_BYTES_BOUNDS, APPS_DEFINITION_LIMIT_BOUNDS, CODEX_OAUTH_KEEP_WARM_MAX_AGE_HOURS_BOUNDS, SCHEDULER_INTERVAL_MS_BOUNDS, validateRuntimeTokenTtlHours, validateControllerTokenTtlDays, validateControllerGraceSec, validateConfigValue, validateConfigEntry, validateExportToEnv, init_swarm_config_guard, cachedUserRole, cachedUserFunction, invalidateTelemetryUserRole, configureOrgDomainPersistence, recomputeOrgDomain, scheduleOrgDomainRecompute, init_telemetry_identity, resolveTriggerSurface, emitTaskTelemetry, init_telemetry_trigger, MASKED_SECRET_VALUE, init_config_secrets, HeartbeatExpiryError, init_heartbeat_expiry, isEffectiveOutputSchema, init_output_schema, isRuntimePoolsEnabled, init_runtime_pools_flag, normalizeDate, normalizeDateRequired, init_date_utils, rowToAgent, updateAgentCredentialState2, updateAgentCredentialMissing2, AgentDeletedError2, isAgentDeleted2, createAgent2, getAgentById2, EXTENSION_AGENT_ROLE2, NOT_EXTENSION_AGENT_SQL2, isExtensionAgent2, extensionAgentAssignmentError2, ReservedAgentRoleError2, reservedRoleViolation2, ExtensionAgentAssignmentError2, getAllAgents2, getAgentStatusCounts2, getLeadAgent2, updateAgentStatus2, updateAgentMaxTasks2, updateAgentProvider2, setAgentHarnessProvider2, updateAgentCredStatus2, listAgentsWithCredStatusByProvider2, getAgentHarnessProviders2, updateAgentActivity2, MAX_EMPTY_POLLS2, incrementEmptyPollCount2, resetEmptyPollCount2, shouldBlockPolling2, deleteAgent2, getActiveTaskCount2, hasCapacity2, getRemainingCapacity2, updateAgentStatusFromCapacity2, isPoolAffinityEnforcementEnabled2, buildRoutingAffinityFromAgent2, isAgentEligibleForTask2, getAgentDailyTaskCounts2, init_agents, closeSlackTreeIfSettled, getSlackThreadsOfTasks, slackThreadHasBotReplySince, slackThreadHasAgentReplyOnTasksSince, slackThreadHasOutcomeWork, observeSlackTreeVisibility, getSlackProcessingThreads, init_slack_trees, WorkflowReplayStateError, init_workflow_replay, getWorkflowRunTriggeredByAgentId, getWorkflowRunSummary, getWorkflowRunStepsSlimByRunId, WORKFLOW_RUN_TREE_MAX_DEPTH, WorkflowRunTreeError, getRunLineageBlock, getWorkflowRunTreeIds, getWorkflowRunStatus, getOpenWorkflowTreeTaskIds, getTaskIdsWithDependents, workflowRunTreeHasOpenWork, getWorkflowRunTree, cancelOpenWorkflowTreeSteps, disarmWorkflowTreeRetries, cancelLiveWorkflowTreeRuns, getChildWorkflowRunId, isParentStepAttemptCurrent, getRunningSubWorkflowSteps, getWorkflowRunParent, getWorkflowRunLineage, getSettledChildRunParentSteps, emitRunFinished, createForeachChildSteps, createForeachAttemptSteps, init_workflow_runs, OpenAI2, init_openai2, generateRandomCodeVerifier, generateRandomState, calculatePKCECodeChallenge, init_build, isInvalidClientError, publicEndpointSsrfOptions, mcpOAuthSsrfOptions, discoverProtectedResourceMetadata, discoverAuthorizationServerMetadata, normalizeTokenEndpointAuthMethod, resolveAdvertisedTokenEndpointAuthMethod, authMethodForStoredClient, selectDcrTokenEndpointAuthMethod, registerClient, buildAuthorizeUrl, exchangeCodeForTokens, refreshMcpToken, revokeMcpToken, computeExpiresAt, init_mcp_wrapper, LEARNING_TTL_DAYS, LEARNING_DUPLICATE_MIN_SIMILARITY, CANDIDATE_SET_MULTIPLIER, isGraphExpansionEnabled, EMBEDDING_DIMENSIONS, init_constants2, LONGTERM_ROOT, LEARNINGS_ROOT, MEMORY_KEY_PATTERN, MEMORY_KEY_PATTERN_MESSAGE, MEMORY_KEY_MAX_LENGTH, isLongtermKey, longtermKeyError, isConsolidatedKey, consolidatedKeyMessage, resolveStoreKey, init_key_paths, computeScore, rerank, init_reranker, isReviewTaskId, dropReviewTaskCompletions, init_review_recall_filter, searchMemoryCandidates, init_search_candidates, memorySearchReader, init_search_reader, rowToCandidate, init_sqlite_store, getEmbeddingProvider2, resetEmbeddingProvider2, getMemoryStore2, setDeploymentEnvReader2, embeddingEndpoint2, init_memory, embeddingProvider2, computeScriptEmbedding2, writeScriptEmbedding2, embedScript2, searchScripts2, reembedAllScripts2, init_embeddings, upsertScriptByName, getScript, getGlobalScriptContentHashes, getScriptById, getScriptVersion, listScripts, listScriptVersions, deleteScript, touchScratchScriptLastUsed, restoreScratchScriptLastUsedIfUnchanged, createScriptApi, listScriptApisForScript, getScriptApiById, getScriptApiSecret, updateScriptApi, rotateScriptApiSecret, deleteScriptApi, recordScriptApiUsage, init_db3, oauthSecretName, registerStoredSecret, loadSecretRegistry, init_secret_registry, getDefaultAuthorizationIdForProvider, getOAuthApp, getOAuthAppById, getOAuthAppIdByProvider, createOAuthApp, updateOAuthAppById, upsertOAuthApp, listAuthorizationsForApp, getAuthorizationById, upsertAuthorization, updateAuthorizationTokens, updateAuthorizationIdentity, deleteAuthorizationById, deleteAuthorizationsForApp, createOAuthPending, consumeOAuthPending, gcOAuthPending, markAuthorizationRefreshFailed, hasOAuthTokens, getOAuthTokens, listAuthorizationSweepRows, listKeepAliveAuthorizations, deleteOAuthTokens, acquireOAuthRefreshLock, releaseOAuthRefreshLock, init_oauth, normalizeVcsRepo, vcsRepoName, vcsRepoUrlMatches, init_vcs_repo_match, taskModelPin, resumedTaskModelSelection, init_model_pin, normalizeModelKey, init_pricing_normalize, buildModelsDevSeedRows, seedPricingFromModelsDev, init_seed_pricing, buildCatalogEntries, replaceModelCatalog, touchModelCatalogCheckedAt, countModelCatalog, getModelCatalogMeta, updateModelCatalogMeta, upsertModelCatalogOverlay, deleteModelCatalogOverlay, expireMatchedOverlays, applyOverlayPricingRows, reloadModelsCatalog, loadModelsCatalog, init_model_catalog_store, listHarnessModelSupport, recordHarnessModelSupport, agentRanModel, getAgentHarnessCliVersion, setAgentHarnessCliVersion, init_harness_model_support, sanitizeModelTierOverrides, parseModelTierOverridesHeader, modelTierOverridesDiffer, setAgentModelTierOverrides, previewModelTiers, recordClaimModelResolution, init_model_tier_resolution, harnessModelErrorFor, poolTaskRunsOnHarness, explicitModelError, explicitModelErrorForAgent, init_model_validation2, runtimeReadsRepoSecrets, vcsRepoId, configPools, checkProfileForAgent, formatProfileCheckFailures, init_model_profile_check, firstFailingCheck, resolveGroupForAgent, init_model_group_resolution, startTaskSearchBackfill, stopTaskSearchBackfill, init_search_index, rowToAgentTask, getTaskById2, getChildTasks2, TASK_LINEAGE_LIMITS2, getTaskLineage2, hasNonTerminalResumeChild2, SUPERSEDED_RESUME_REPAIR_WINDOW_MS2, getSupersededTasksWithoutResume2, getSupersededTasksWithUnsettledDependents2, hasNonTerminalRerouteDecisionChild2, getTasksByAgentId2, getTasksDispatchedFrom2, getAgentCurrentTask2, getTasksByStatus2, findTaskByVcs2, findActiveTasksByVcs2, findTaskByGitHub2, readableSessionCondition, getAllTasks2, getTasksCount2, getTaskStats2, getCompletedSlackTasks2, getPendingSlackRelayTasks2, markSlackRelayAttempted2, markSlackRelayDelivered2, markFinalizedSlackRelaysDelivered2, getPendingChatRelayTasks2, giveUpStaleChatRelays2, markChatRelayAttempted2, recordChatRelayError2, markChatRelayDelivered2, markChatRelayGivenUp2, getRecentlyFinishedWorkerTasks2, markTasksNotified2, resetTasksNotified2, getInProgressSlackTasks2, getSlackTasksMissingTree2, getInProgressTasksByContextKey2, isLinearTrackerContextKey2, findExistingLinearTrackerContextWork2, getLatestTaskByContextKey2, getLatestScriptRunStepTaskByContextKey2, getAgentWorkingOnThread2, getLatestActiveTaskInThread2, getLatestLeadTaskInThread2, getAgentWorkingOnContextKey2, getLatestTaskByContextKeyPrefix2, getLatestActiveTaskByContextKey2, getLatestLeadTaskByContextKey2, getFirstTaskInThread2, getMostRecentTaskInThread2, findCompletedTasksInThread2, findRecentFailedTaskInThread2, countAgentDispatchesInThread2, findRecentCancelledTaskInThread2, init_read, MODEL_PROFILE_CONFIG_KEY, hasUnreadableCredentialAllowlist, listModelProfiles, getModelProfileByName, createModelProfile, updateModelProfile, TASK_HOLDS_PROFILE_SQL, repairWindowStart, modelProfileReferences, modelProfileRefError, isModelNameTakenError, deleteModelProfile, MAX_MODEL_PROFILE_FALLBACKS, modelProfileFallbacksError, taskProfileError, modelGroupRefError, scheduleProfileUpdate, init_model_profiles, SESSION_ACTIVITY_REFRESH_MIN_INTERVAL_MS2, refreshActiveSessionOnActivity2, getActiveSessionById, init_active_sessions, STEERING_MOVED_ERROR, SteeringRequestError, SteeringBlockedError, isSteeringEnabled, getTaskSteeringFields, getTaskSteeringFieldsForTasks, promotePendingSteeringForTask, markSteeringUndeliverable, carryUnhandledSteering, requestSteering, init_steering2, onTaskStarted, init_task_lifecycle_events, listApprovalRequestSummaries2, getPendingApprovalVoteState2, recordApprovalVotes2, getPendingApprovalsForTasks2, approvalCancellationNotificationKey, listUndeliveredCancelledApprovalRequestIds, init_approvals, computeContentHash2, createContextVersion2, getLatestContextVersion2, getContextVersion2, getContextVersionHistory2, AssetKeyMovesBlockedError2, assertAssetKeyMovesAllowed2, moveTaskChainKeyInTx2, moveSessionChains, moveKeyFavorites, listPrefixRoots, listSharedPrefixRoots, init_session_moves, getSessionGroupKey, sessionSummaryQuery, getSessionReadState, getSessionTree, triageSessionList, init_session_tree, setHumanFreeQueueListener, reclassifyTaskHumanFree, drainHumanFreeReclassifyQueue, init_human_free, channelTopic, addWorkerSubscription, removeWorkerSubscription, listSubscribedWorkerAgents, init_channels, publishWorkerNudge, init_worker_nudges, createTask2, getPendingTaskForAgent2, assignUnassignedTaskPending2, startTask2, updateTaskClaudeSessionId2, recordTaskProviderIfUnset2, updateTaskTitle2, updateTaskTags2, setTaskTitleIfUnset2, completeTask2, failTask2, overwriteTerminalTaskResultText2, cancelTask2, skipTask2, supersedeTask2, markWorkflowStepTaskSuperseded2, settleSupersededTaskDependents2, backfillSupersedeTaskResumeTaskId2, pauseTask2, resumeTask2, getPausedTasksForAgent2, getOrphanedInProgressTasksForAgent2, resetOrphanedInProgressTasksForAgent2, getRecentlyCancelledTasksForAgent2, deleteTask2, updateTaskProgress2, init_write, quoteSqlIdentifier, USER_REFERENCE_COLUMNS_SQL, userReferenceRewriteSql, WORKFLOW_CONTEXT_REQUESTER_SQL, init_user_references, IdempotencyKeyTakenError, sha256, workflowRequestFingerprint, requestFingerprint, findAcceptedWorkflowOperation, assertWorkflowIdempotencyKeyUnused, recordAcceptedWorkflowOperation, init_workflow_idempotency, PINNED_WORKFLOW_KEYS2, toPinnedDefinition2, pinWorkflowDefinition2, getRunWorkflow2, deleteOrphanedRunDefinitions, init_workflow_run_definitions, getWorkflowsByEventName2, recordKeySeatMismatch2, recordKeyValidation2, retirePoolKeyStatus, init_api_keys, getScriptRunExecutionArgs2, getScriptRunFollowUpGuard2, setScriptRunFollowUpGuard2, setSkillUpdatedBy2, literalPrefixPattern2, getSlackRenderV2ActivatedAt2, ensureSlackRenderV2Activation2, getSlackDelegationActivatedAt2, ensureSlackDelegationActivation2, isPendingSlackMessage2, isSettledSlackMessage2, recordSlackMessage2, reserveSlackMessage2, bindSlackMessageTimestamp2, updateSlackMessageRecord2, markSlackTreeRendered2, deleteSlackMessageRecord2, getSlackTreeMessage2, getSlackTreeMessageByThread2, getSlackOutcomeMessage2, getResolvableDeferralOutcomes2, markSlackDeferralResolved2, noteSlackOutcomeDeliveryFailure2, abandonSlackOutcomeDelivery2, getSlackTreeMessages2, getSlackMessageByChannelTs2, getSlackTasksInThread2, listSlackThreadsAwaitingHuman2, isSlackThreadAwaitingHuman2, markTaskSlackReplySent2, setSlackMessageTracking2, updateTaskVcs2, insertTaskAttachment2, recordTaskPullRequestAttachments2, getAssetKeyMappingByProvider2, upsertAssetKeyMapping2, getAssetKeyMapping2, listAssetSummaries2, moveAssetKey2, deleteTaskAttachment2, replaceTaskAttachment2, getTaskAttachments2, createSteeringMessage2, getSteeringMessagesForTask2, getSteeringMessageById2, getPendingSteeringForTask2, getPendingSteeringForAgent2, markSteeringDelivered2, markSteeringHandled2, markSteeringPromoted2, cancelPendingSteeringForTask2, hasPendingSteering2, getAgentWithTasks2, getAllAgentsWithTasks2, createLogEntry2, getLogsByAgentId2, getLogsByTaskId2, getLogsByTaskIdAndEventType2, getLogsByTaskIdChronological2, getLogsByEventType2, getAllLogs2, findRecentSimilarTasks2, createTaskExtended2, claimTask2, releaseTask2, acceptTask2, rejectTask2, moveTaskToBacklog2, moveTaskFromBacklog2, promoteDraftTask2, refreshDraftTaskLease2, promoteAbandonedDraftTasks2, releaseStaleReviewingTasks2, releaseStaleOfferedTasksForOfflineAgents2, getOfferedTasksForAgent2, claimOfferedTask2, getUnassignedTasksCount2, getUnassignedTaskIds2, getUnassignedTaskIdsForAgent2, checkDependencies2, getDependentTasks2, cascadeFailDependents2, updateAgentProfile2, updateAgentName2, createChannel2, getMessageById2, getChannelById2, getChannelByName2, getAllChannels2, deleteChannel2, postMessage2, getChannelMessages2, updateReadState2, getLastReadAt2, getUnreadMessages2, getMentionsForAgent2, getInboxSummary2, claimMentions2, releaseMentionProcessing2, releaseStaleMentionProcessing2, createService2, getServiceById2, getServiceByAgentAndName2, getServicesByAgentId2, getAllServices2, updateServiceStatus2, deleteService2, upsertService2, deleteServicesByAgentId2, createSessionLogs2, getSessionLogsByTaskId2, getSessionLogsBySession2, createSessionCost2, getSessionCostsByTaskId2, getSessionCostsByAgentId2, getAllSessionCosts2, getSessionCostsFiltered2, UNATTRIBUTED_USER_ID2, getSessionCostSummary2, getAttributionByPerson2, getDashboardCostSummary2, createInboxMessage2, getInboxMessageById2, getUnreadInboxMessages2, claimInboxMessages2, markInboxMessageRead2, markInboxMessageResponded2, markInboxMessageDelegated2, releaseStaleProcessingInbox2, getConcurrentContext2, getScheduledTasks2, getScheduledTaskById2, getScheduledTaskByName2, createScheduledTask2, updateScheduledTask2, deleteScheduledTask2, getDueScheduledTasks2, autoEncryptLegacyPlaintextSecrets2, maskSecrets2, getSwarmConfigs2, getInjectableGlobalConfigs2, getSwarmConfigById2, getSwarmConfigLookupById2, upsertSwarmConfig2, emitBuiltInIntegrationConnectedOnce2, deleteSwarmConfig2, deleteSwarmConfigByKey2, getResolvedConfig2, getSwarmRepos2, getSwarmRepoById2, getSwarmRepoByName2, getSwarmRepoByUrl2, createSwarmRepo2, updateSwarmRepo2, deleteSwarmRepo2, getAgentMailInboxMapping2, getAgentMailInboxMappingsByAgent2, getAllAgentMailInboxMappings2, createAgentMailInboxMapping2, deleteAgentMailInboxMapping2, findTaskByAgentMailThread2, insertActiveSession2, deleteActiveSession2, deleteActiveSessionById2, getActiveSessions2, heartbeatActiveSession2, cleanupStaleSessions2, cleanupAgentSessions2, updateActiveSessionProviderSessionId2, getActiveSessionForTask2, reassociateSessionLogs2, getStalledInProgressTasks2, getStalePinnedResumes2, failPendingResumeIfUnclaimed2, getIdleWorkersWithCapacity2, getUnassignedPoolTasks2, getStaleUnassignedAffinityTasks2, getRecentFailedTasks2, getRecentCompletedCount2, getRecentFailedCount2, createWorkflow2, getWorkflow2, listWorkflows2, updateWorkflow2, deleteWorkflow2, getWorkflowsByScheduleId2, createWorkflowRun2, getWorkflowRun2, updateWorkflowRun2, listWorkflowRuns2, countWorkflowRuns2, listWorkflowRunsPage2, createWorkflowRunStep2, getWorkflowRunStep2, updateWorkflowRunStep2, getWorkflowRunStepsByRunId2, getStuckWorkflowRuns2, getLastSuccessfulRun2, getLastRunStart2, getRetryableSteps2, getCompletedStepNodeIds2, getTaskByWorkflowRunStepId2, detachTaskFromWorkflowRunStep2, getStepByIdempotencyKey2, getStepCountForNode2, getLatestStepForNode2, getCurrentStepForNode2, createWorkflowVersion2, getWorkflowVersions2, getWorkflowVersion2, createAppVersion2, getAppVersions2, getAppVersion2, createPage2, getPage2, getPageBySlug2, getLatestPageBySlug2, listPagesByAgent2, listAllPages2, countAllPages2, countPagesByAgent2, updatePage2, deletePage2, incrementPageViewCount2, createPageVersion2, getPageVersions2, getPageVersion2, createMetric2, getMetric2, getMetricBySlug2, listMetricsByAgent2, listAllMetrics2, countAllMetrics2, countMetricsByAgent2, updateMetric2, deleteMetric2, createMetricVersion2, getMetricVersions2, getMetricVersion2, getPromptTemplates2, getPromptTemplateById2, upsertPromptTemplate2, deletePromptTemplate2, resetPromptTemplateToDefault2, getPromptTemplateHistory2, resolvePromptTemplate2, checkoutPromptTemplate2, getAllChannelActivityCursors2, getChannelActivityCursor2, upsertChannelActivityCursor2, createApprovalRequest2, getApprovalRequestById2, resolveApprovalRequest2, cancelApprovalRequestById2, cancelPendingApprovalRequestsForRun2, listCancelledApprovalRequestsForRun2, listCancelledApprovalRequestsForStep2, claimApprovalCancellationNotification2, completeApprovalCancellationNotificationClaim2, releaseApprovalCancellationNotificationClaim2, updateApprovalRequestNotifications2, listApprovalRequests2, getStuckApprovalRuns2, getApprovalRequestByStepId2, getExpiredPendingApprovals2, getStaleApprovalRequests2, createWaitState2, getWaitStateById2, getWaitStateByStepId2, getDueWaitStates2, getPendingEventWaitNames2, getPendingWaitsByEvent2, resolveWaitState2, getStuckWaitRuns2, SKILL_FILE_LIMITS2, normalizeSkillFilePath2, createSkill2, updateSkill2, listSkillFileManifest2, getSkillFiles2, getSkillFile2, upsertSkillFile2, upsertSkillFiles2, deleteSkillFile2, deleteSkill2, getSkillById2, getSkillByName2, listSkills2, searchSkills2, installSkill2, getSystemDefaultSkills2, installSystemDefaultSkillsForAgent2, uninstallSkill2, getAgentSkills2, toggleAgentSkill2, createMcpServer2, emitMcpServerConnectedTelemetry2, updateMcpServer2, deleteMcpServer2, getMcpServerById2, getMcpServerByName2, listMcpServers2, installMcpServer2, uninstallMcpServer2, getAgentMcpServers2, createContextSnapshot2, getContextSnapshotsByTaskId2, getContextSnapshotsBySessionId2, getContextSummaryByTaskId2, getAvailableKeyIndices2, recordKeyUsage2, setApiKeyPlan2, markKeyRateLimited2, recordKeyAuthFailure2, recordKeyRateLimitWindows2, setApiKeyName2, clearKeyRateLimit2, getKeyStatuses2, getKeyCostSummary2, getUserById2, getAllUsers2, createUser2, updateUser2, deleteUser2, listInboxState2, upsertInboxState2, listFavorites2, listUserFavorites2, getFavoriteItemIdSet2, setFavorite2, setUserFavorite2, withFavoriteFlags2, listTaskTemplates2, getRootTaskChain2, listRecentSessions2, countSessions2, getBudget2, getBudgets2, upsertBudget2, deleteBudget2, getAllPricingRows2, getPricingRows2, getActivePricingRow2, insertPricingRow2, deletePricingRow2, getDailySpendForAgent2, getDailySpendGlobal2, getDailySpendForUser2, recordBudgetRefusalNotification2, getBudgetRefusalNotification2, getRecentBudgetRefusalNotifications2, hasBudgetRefusalNotificationToday2, setBudgetRefusalFollowUpTaskId2, getLiveAgentCounts2, getReadyAgentCounts2, getInstanceActivity2, getSwarmMetrics2, hasFirstCompletedTask2, getKv2, sweepExpiredKv2, sweepExpiredKvPrefix2, upsertKv2, claimKv2, deleteKv2, KvTypeCollisionError2, incrKv2, kvPrefixUpperBound2, listKv2, countKv2, createScriptRun2, recordInlineScriptRun2, getScriptRun2, getScriptRunByIdempotencyKey2, listScriptRuns2, countScriptRuns2, countActiveScriptRuns2, updateScriptRun2, updateScriptRunIfNotTerminal2, updateScriptRunIfRunning2, getRunningScriptRuns2, getScriptRunJournalStep2, upsertScriptRunJournalStep2, listScriptRunJournalSteps2, countScriptRunJournalSteps2, countScriptRunJournalAgentTaskSteps2, exports_db, init_db4 };
|