@opencode-ai/core 0.0.0-next-17293
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -0
- package/dist/account/sql.js +35 -0
- package/dist/agent.js +101 -0
- package/dist/aisdk-native.js +10 -0
- package/dist/aisdk.js +17 -0
- package/dist/app.js +19 -0
- package/dist/bus.js +103 -0
- package/dist/catalog.js +98 -0
- package/dist/chunks/permission-015h7azv.js +427 -0
- package/dist/chunks/permission-02dbfq60.js +18 -0
- package/dist/chunks/permission-04kwjb53.js +192 -0
- package/dist/chunks/permission-06jas3ts.js +117 -0
- package/dist/chunks/permission-08m6gcy4.js +126 -0
- package/dist/chunks/permission-0c101nc9.js +116 -0
- package/dist/chunks/permission-0cgt0xh2.js +18 -0
- package/dist/chunks/permission-0cm1xtm8.js +85 -0
- package/dist/chunks/permission-0emnz988.js +130 -0
- package/dist/chunks/permission-0f48qthw.js +32 -0
- package/dist/chunks/permission-0kvmztkf.js +31 -0
- package/dist/chunks/permission-0w91d2d0.js +72 -0
- package/dist/chunks/permission-0zr7btsm.js +203 -0
- package/dist/chunks/permission-0zz82cjq.js +17 -0
- package/dist/chunks/permission-10xtr3be.js +34 -0
- package/dist/chunks/permission-14dbm5wf.js +90 -0
- package/dist/chunks/permission-18pv8fg3.js +98 -0
- package/dist/chunks/permission-1c00jchy.js +64 -0
- package/dist/chunks/permission-1cxqkg6x.js +63 -0
- package/dist/chunks/permission-1e2ryyac.js +42 -0
- package/dist/chunks/permission-1fb7bmpf.js +15 -0
- package/dist/chunks/permission-1kvtxahz.js +175 -0
- package/dist/chunks/permission-1q4v9p9k.js +70 -0
- package/dist/chunks/permission-1wcz8fvj.js +16 -0
- package/dist/chunks/permission-1xksxgzs.js +24 -0
- package/dist/chunks/permission-1zxa6y0n.js +578 -0
- package/dist/chunks/permission-25pxtba7.js +13 -0
- package/dist/chunks/permission-26arpb2f.js +65 -0
- package/dist/chunks/permission-2806rrqb.js +615 -0
- package/dist/chunks/permission-2g1pqmbp.js +253 -0
- package/dist/chunks/permission-2nkse5ac.js +62 -0
- package/dist/chunks/permission-2nmyybe0.js +21 -0
- package/dist/chunks/permission-2qdvkq1m.js +223 -0
- package/dist/chunks/permission-2qdx6zz3.js +16 -0
- package/dist/chunks/permission-2zyawa45.js +73 -0
- package/dist/chunks/permission-325xrcef.js +286 -0
- package/dist/chunks/permission-37rcj8p3.js +187 -0
- package/dist/chunks/permission-3c4nztf9.js +11 -0
- package/dist/chunks/permission-3e69n02a.js +14 -0
- package/dist/chunks/permission-3g3rpp2x.js +17 -0
- package/dist/chunks/permission-3mfgaav1.js +321 -0
- package/dist/chunks/permission-3q6gbwmd.js +26 -0
- package/dist/chunks/permission-3thh6229.js +18 -0
- package/dist/chunks/permission-3vh42rcr.js +35 -0
- package/dist/chunks/permission-3w0f1yxt.js +64 -0
- package/dist/chunks/permission-3w3ybtfd.js +109 -0
- package/dist/chunks/permission-42xz94rv.js +78 -0
- package/dist/chunks/permission-470a55pw.js +91 -0
- package/dist/chunks/permission-476jw5d9.js +65 -0
- package/dist/chunks/permission-47rh966y.js +194 -0
- package/dist/chunks/permission-47ty4mvs.js +18 -0
- package/dist/chunks/permission-4b2tz2m9.js +22 -0
- package/dist/chunks/permission-4bk5angc.js +355 -0
- package/dist/chunks/permission-4s2xwh5d.js +91 -0
- package/dist/chunks/permission-4szcs9x3.js +94 -0
- package/dist/chunks/permission-4zfy2va0.js +173 -0
- package/dist/chunks/permission-4zzdwbaz.js +18 -0
- package/dist/chunks/permission-50jxp3hw.js +35 -0
- package/dist/chunks/permission-52jzav25.js +13 -0
- package/dist/chunks/permission-56p2m126.js +31 -0
- package/dist/chunks/permission-57tzwnz4.js +107 -0
- package/dist/chunks/permission-5a5ch9ts.js +31 -0
- package/dist/chunks/permission-5m82aax9.js +150 -0
- package/dist/chunks/permission-5p2sx24b.js +56 -0
- package/dist/chunks/permission-5pfeh60c.js +154 -0
- package/dist/chunks/permission-5rs65q6p.js +65 -0
- package/dist/chunks/permission-5sgbvx3z.js +83 -0
- package/dist/chunks/permission-5va1yh78.js +23 -0
- package/dist/chunks/permission-6628r0j2.js +162 -0
- package/dist/chunks/permission-69qrqpw0.js +15 -0
- package/dist/chunks/permission-6ctn5n86.js +342 -0
- package/dist/chunks/permission-6jdj5f9n.js +9 -0
- package/dist/chunks/permission-6jtjggv5.js +248 -0
- package/dist/chunks/permission-6k7y0zvr.js +87 -0
- package/dist/chunks/permission-6sc9h3ca.js +116 -0
- package/dist/chunks/permission-6v88ksgf.js +82 -0
- package/dist/chunks/permission-6xc82ex6.js +136 -0
- package/dist/chunks/permission-6yt963b8.js +29 -0
- package/dist/chunks/permission-706a4azd.js +292 -0
- package/dist/chunks/permission-707etsmq.js +174 -0
- package/dist/chunks/permission-71jckxbv.js +36 -0
- package/dist/chunks/permission-77madsw4.js +214 -0
- package/dist/chunks/permission-7mpw7j43.js +287 -0
- package/dist/chunks/permission-7mrpdsq5.js +229 -0
- package/dist/chunks/permission-7n9qwqk4.js +14 -0
- package/dist/chunks/permission-7wadkhey.js +175 -0
- package/dist/chunks/permission-7wcmqxrc.js +50 -0
- package/dist/chunks/permission-7wee78f9.js +408 -0
- package/dist/chunks/permission-849eva8b.js +205 -0
- package/dist/chunks/permission-857g7h76.js +41 -0
- package/dist/chunks/permission-85wgk4kd.js +139 -0
- package/dist/chunks/permission-88jbfw8z.js +41 -0
- package/dist/chunks/permission-8m0qaa0v.js +99 -0
- package/dist/chunks/permission-8nn8kqcn.js +25 -0
- package/dist/chunks/permission-8sj3ajy5.js +58 -0
- package/dist/chunks/permission-8w2n8x74.js +64 -0
- package/dist/chunks/permission-8w9tzfz1.js +14 -0
- package/dist/chunks/permission-8wv04gvy.js +115 -0
- package/dist/chunks/permission-8ywqk2j9.js +50 -0
- package/dist/chunks/permission-906y0b6d.js +13 -0
- package/dist/chunks/permission-93qdgxxd.js +30 -0
- package/dist/chunks/permission-999qd968.js +84 -0
- package/dist/chunks/permission-9avt6sfe.js +124 -0
- package/dist/chunks/permission-9dct5xhx.js +21 -0
- package/dist/chunks/permission-9e8kfd6p.js +239 -0
- package/dist/chunks/permission-9f0rnpkn.js +16 -0
- package/dist/chunks/permission-9pygavrm.js +145 -0
- package/dist/chunks/permission-9q1hedyj.js +468 -0
- package/dist/chunks/permission-9r0qzhnf.js +34 -0
- package/dist/chunks/permission-9rdqpzw3.js +115 -0
- package/dist/chunks/permission-9sdtsapf.js +30 -0
- package/dist/chunks/permission-a02svayp.js +10 -0
- package/dist/chunks/permission-a2yyszsy.js +75 -0
- package/dist/chunks/permission-a3xgesk5.js +174 -0
- package/dist/chunks/permission-a65h300v.js +155 -0
- package/dist/chunks/permission-a6ndeaxw.js +162 -0
- package/dist/chunks/permission-a7aazggv.js +110 -0
- package/dist/chunks/permission-a83yvq99.js +5 -0
- package/dist/chunks/permission-a9h3q0q9.js +130 -0
- package/dist/chunks/permission-aftdh555.js +147 -0
- package/dist/chunks/permission-aks7qxgd.js +112 -0
- package/dist/chunks/permission-anrqexna.js +111 -0
- package/dist/chunks/permission-ans8s2g6.js +230 -0
- package/dist/chunks/permission-at95jcnb.js +77 -0
- package/dist/chunks/permission-ayevdmef.js +25 -0
- package/dist/chunks/permission-ayfwnm78.js +18 -0
- package/dist/chunks/permission-b02txbh8.js +22 -0
- package/dist/chunks/permission-b3hvtezn.js +88 -0
- package/dist/chunks/permission-b92sdcjk.js +99 -0
- package/dist/chunks/permission-bbqs2y60.js +14 -0
- package/dist/chunks/permission-bha9y19b.js +168 -0
- package/dist/chunks/permission-brsh5f65.js +146 -0
- package/dist/chunks/permission-bxdhjb3y.js +107 -0
- package/dist/chunks/permission-byab506k.js +14 -0
- package/dist/chunks/permission-c5md9thr.js +106 -0
- package/dist/chunks/permission-c77ad0vh.js +16 -0
- package/dist/chunks/permission-c8dztf94.js +90 -0
- package/dist/chunks/permission-cd4w01s5.js +30 -0
- package/dist/chunks/permission-cgvnqv92.js +27 -0
- package/dist/chunks/permission-chtvf7xd.js +310 -0
- package/dist/chunks/permission-cm67rqy2.js +22 -0
- package/dist/chunks/permission-csanxt95.js +99 -0
- package/dist/chunks/permission-cz3dkvcz.js +16 -0
- package/dist/chunks/permission-d076mabj.js +683 -0
- package/dist/chunks/permission-d0n9nbkk.js +70 -0
- package/dist/chunks/permission-d4a2h60z.js +222 -0
- package/dist/chunks/permission-d5t1sv80.js +103 -0
- package/dist/chunks/permission-d6s8p2vk.js +157 -0
- package/dist/chunks/permission-d6vvk673.js +149 -0
- package/dist/chunks/permission-dbah77c1.js +17 -0
- package/dist/chunks/permission-ddn74qps.js +37 -0
- package/dist/chunks/permission-df3v2q6j.js +77 -0
- package/dist/chunks/permission-dhcq6c44.js +14 -0
- package/dist/chunks/permission-dhphtf1x.js +45 -0
- package/dist/chunks/permission-dht5baf0.js +16 -0
- package/dist/chunks/permission-dppgrtwb.js +126 -0
- package/dist/chunks/permission-e1z9a0ts.js +69 -0
- package/dist/chunks/permission-e2mxwc51.js +109 -0
- package/dist/chunks/permission-ed4jjjcc.js +171 -0
- package/dist/chunks/permission-ehj9csmv.js +6 -0
- package/dist/chunks/permission-erj4j75s.js +129 -0
- package/dist/chunks/permission-eyk9wdct.js +61 -0
- package/dist/chunks/permission-ezs3tagn.js +54 -0
- package/dist/chunks/permission-ezvn03y4.js +12 -0
- package/dist/chunks/permission-f05p34aa.js +80 -0
- package/dist/chunks/permission-f0sqeedm.js +68 -0
- package/dist/chunks/permission-f1ge3yjy.js +179 -0
- package/dist/chunks/permission-f26x8jzg.js +301 -0
- package/dist/chunks/permission-f4cp4g4a.js +17 -0
- package/dist/chunks/permission-f6fn40ps.js +81 -0
- package/dist/chunks/permission-f84sxdqn.js +49 -0
- package/dist/chunks/permission-f9e3yxsz.js +72 -0
- package/dist/chunks/permission-faypg4r1.js +13 -0
- package/dist/chunks/permission-fj3fqzqb.js +175 -0
- package/dist/chunks/permission-fm1nvm5g.js +32 -0
- package/dist/chunks/permission-fmyre8m1.js +24 -0
- package/dist/chunks/permission-g7k9te92.js +15 -0
- package/dist/chunks/permission-g9yygpzr.js +80 -0
- package/dist/chunks/permission-gcay93cp.js +14 -0
- package/dist/chunks/permission-gd2xppx8.js +14 -0
- package/dist/chunks/permission-gd5xeqc2.js +32 -0
- package/dist/chunks/permission-ghm4673n.js +27 -0
- package/dist/chunks/permission-ghwjy7my.js +41 -0
- package/dist/chunks/permission-gm8kdh5e.js +39 -0
- package/dist/chunks/permission-gs6njsxc.js +332 -0
- package/dist/chunks/permission-gvyf4y9v.js +601 -0
- package/dist/chunks/permission-gxp1x3zs.js +21 -0
- package/dist/chunks/permission-gy500k2r.js +17 -0
- package/dist/chunks/permission-h487ttse.js +112 -0
- package/dist/chunks/permission-h8ecejt5.js +106 -0
- package/dist/chunks/permission-ha4enwv8.js +722 -0
- package/dist/chunks/permission-hkcvyz4t.js +142 -0
- package/dist/chunks/permission-hr2x6e6g.js +107 -0
- package/dist/chunks/permission-hy0hzg1s.js +234 -0
- package/dist/chunks/permission-hzeg9cfr.js +49 -0
- package/dist/chunks/permission-j07kk359.js +21 -0
- package/dist/chunks/permission-j2hktz7g.js +205 -0
- package/dist/chunks/permission-j32ayx7z.js +86 -0
- package/dist/chunks/permission-jcd3zvtj.js +75 -0
- package/dist/chunks/permission-jm82nbh8.js +259 -0
- package/dist/chunks/permission-jssy2dr3.js +18 -0
- package/dist/chunks/permission-jsvyv3zx.js +1467 -0
- package/dist/chunks/permission-jve7t217.js +28 -0
- package/dist/chunks/permission-k59zb4v2.js +274 -0
- package/dist/chunks/permission-kg1345f7.js +63 -0
- package/dist/chunks/permission-khnqrbwa.js +179 -0
- package/dist/chunks/permission-kpdbz7gn.js +16 -0
- package/dist/chunks/permission-kxy11nzk.js +24 -0
- package/dist/chunks/permission-kyyqvx4s.js +13 -0
- package/dist/chunks/permission-m01ryvbe.js +22 -0
- package/dist/chunks/permission-m8cbvarh.js +19 -0
- package/dist/chunks/permission-ma07p6tt.js +83 -0
- package/dist/chunks/permission-ma60vzgv.js +13 -0
- package/dist/chunks/permission-mf0hyk7z.js +18 -0
- package/dist/chunks/permission-mwceq5am.js +102 -0
- package/dist/chunks/permission-mya790jh.js +72 -0
- package/dist/chunks/permission-n3m50c2t.js +15 -0
- package/dist/chunks/permission-n59ptmzm.js +155 -0
- package/dist/chunks/permission-n6t016aw.js +153 -0
- package/dist/chunks/permission-n9rwdya5.js +375 -0
- package/dist/chunks/permission-nesb2rcz.js +18 -0
- package/dist/chunks/permission-nkm1m8dz.js +25 -0
- package/dist/chunks/permission-nr76rjj3.js +46 -0
- package/dist/chunks/permission-nsc0c3zb.js +14 -0
- package/dist/chunks/permission-nv7zjdpe.js +56 -0
- package/dist/chunks/permission-nzrjycs5.js +21 -0
- package/dist/chunks/permission-p2ry9sj0.js +121 -0
- package/dist/chunks/permission-pf0ndnmr.js +183 -0
- package/dist/chunks/permission-pfqehjmy.js +18 -0
- package/dist/chunks/permission-ph1me6ah.js +156 -0
- package/dist/chunks/permission-pq4b4pqk.js +29 -0
- package/dist/chunks/permission-prf9bavk.js +96 -0
- package/dist/chunks/permission-prg6vhnf.js +41 -0
- package/dist/chunks/permission-q4r4pzs4.js +207 -0
- package/dist/chunks/permission-qa8qg9jd.js +276 -0
- package/dist/chunks/permission-qaarhjrp.js +19 -0
- package/dist/chunks/permission-qc167nrn.js +29 -0
- package/dist/chunks/permission-qde5933h.js +260 -0
- package/dist/chunks/permission-qe0d689s.js +18 -0
- package/dist/chunks/permission-qe9kfb7t.js +92 -0
- package/dist/chunks/permission-qnjh8g89.js +692 -0
- package/dist/chunks/permission-qnk5fbz4.js +183 -0
- package/dist/chunks/permission-qp95y4jb.js +13 -0
- package/dist/chunks/permission-qyfd1tbv.js +295 -0
- package/dist/chunks/permission-r3k9abhd.js +34 -0
- package/dist/chunks/permission-r5ce0emk.js +405 -0
- package/dist/chunks/permission-r8f4w671.js +17 -0
- package/dist/chunks/permission-rdfev9jy.js +12 -0
- package/dist/chunks/permission-rmgfhn2t.js +380 -0
- package/dist/chunks/permission-rnfxxvxb.js +120 -0
- package/dist/chunks/permission-rqswsgbs.js +105 -0
- package/dist/chunks/permission-rr5phte9.js +777 -0
- package/dist/chunks/permission-rt6yg6j2.js +338 -0
- package/dist/chunks/permission-rvfvac9x.js +18 -0
- package/dist/chunks/permission-ryap75b3.js +261 -0
- package/dist/chunks/permission-s27a5c5r.js +272 -0
- package/dist/chunks/permission-s6by3cc4.js +71 -0
- package/dist/chunks/permission-s7jy4mh3.js +73 -0
- package/dist/chunks/permission-s7whb9gt.js +31 -0
- package/dist/chunks/permission-se76j685.js +13 -0
- package/dist/chunks/permission-sem2g21k.js +8 -0
- package/dist/chunks/permission-smpeg8c9.js +18 -0
- package/dist/chunks/permission-spc2jgzw.js +271 -0
- package/dist/chunks/permission-szax8zgv.js +251 -0
- package/dist/chunks/permission-szjq6xea.js +57 -0
- package/dist/chunks/permission-t1xz8esh.js +115 -0
- package/dist/chunks/permission-t2j2ttmx.js +51 -0
- package/dist/chunks/permission-tcn24h1d.js +52 -0
- package/dist/chunks/permission-tdm3rp2k.js +49 -0
- package/dist/chunks/permission-tenv3kfs.js +83 -0
- package/dist/chunks/permission-thstd87d.js +21 -0
- package/dist/chunks/permission-tmb1f636.js +28 -0
- package/dist/chunks/permission-ts4t4v20.js +97 -0
- package/dist/chunks/permission-ttxf0gsy.js +0 -0
- package/dist/chunks/permission-tvmhrvfj.js +4 -0
- package/dist/chunks/permission-tyh0a1hs.js +124 -0
- package/dist/chunks/permission-v2adqbbe.js +19 -0
- package/dist/chunks/permission-v5s1ymsp.js +160 -0
- package/dist/chunks/permission-v972xay6.js +14 -0
- package/dist/chunks/permission-v9bfv94f.js +41 -0
- package/dist/chunks/permission-v9zc0ymn.js +169 -0
- package/dist/chunks/permission-vh4z0rtm.js +151 -0
- package/dist/chunks/permission-vvd6rh5t.js +47 -0
- package/dist/chunks/permission-vynn1k31.js +257 -0
- package/dist/chunks/permission-vz49gck1.js +309 -0
- package/dist/chunks/permission-vz89hfgr.js +116 -0
- package/dist/chunks/permission-w4678h5q.js +127 -0
- package/dist/chunks/permission-wd268jeg.js +83 -0
- package/dist/chunks/permission-we2zmhe4.js +74 -0
- package/dist/chunks/permission-wf37p1a1.js +266 -0
- package/dist/chunks/permission-wj4sxzqa.js +38 -0
- package/dist/chunks/permission-wmxdh12w.js +13 -0
- package/dist/chunks/permission-wps8gh8n.js +18 -0
- package/dist/chunks/permission-wt193r4g.js +130 -0
- package/dist/chunks/permission-wvha5myg.js +178 -0
- package/dist/chunks/permission-wwdwn09j.js +41 -0
- package/dist/chunks/permission-wwntjmk1.js +13 -0
- package/dist/chunks/permission-wx89ywv3.js +104 -0
- package/dist/chunks/permission-wyqjaaa5.js +17 -0
- package/dist/chunks/permission-x4q807cx.js +26 -0
- package/dist/chunks/permission-x89fqk1b.js +214 -0
- package/dist/chunks/permission-xd1cg062.js +171 -0
- package/dist/chunks/permission-xd8vz63e.js +398 -0
- package/dist/chunks/permission-xfd1xnk3.js +49 -0
- package/dist/chunks/permission-xfrawapx.js +75 -0
- package/dist/chunks/permission-xgv25zxy.js +16 -0
- package/dist/chunks/permission-xwftk1fd.js +18 -0
- package/dist/chunks/permission-y0x38cee.js +28 -0
- package/dist/chunks/permission-y1d74x2z.js +206 -0
- package/dist/chunks/permission-y1tgg8ry.js +324 -0
- package/dist/chunks/permission-y4beh62e.js +192 -0
- package/dist/chunks/permission-y67x6rf6.js +19 -0
- package/dist/chunks/permission-y76hsvs9.js +39 -0
- package/dist/chunks/permission-y8rs54ne.js +16 -0
- package/dist/chunks/permission-yjjxtbjv.js +33 -0
- package/dist/chunks/permission-yjwwrq2w.js +36 -0
- package/dist/chunks/permission-yrqrg4vp.js +17 -0
- package/dist/chunks/permission-z47nswr2.js +16 -0
- package/dist/chunks/permission-z4nw170e.js +283 -0
- package/dist/chunks/permission-z5ystmxz.js +74 -0
- package/dist/chunks/permission-z66vzcey.js +470 -0
- package/dist/chunks/permission-zbqqnp0n.js +75 -0
- package/dist/chunks/permission-zdkg1k91.js +23 -0
- package/dist/chunks/permission-zfxc0ze5.js +123 -0
- package/dist/chunks/permission-zr271bqv.js +103 -0
- package/dist/chunks/permission-zsf8rs93.js +20 -0
- package/dist/chunks/permission-zt25ybqs.js +370 -0
- package/dist/chunks/permission-zthe9zqc.js +36 -0
- package/dist/chunks/permission-zvvp2xr4.js +99 -0
- package/dist/chunks/permission-zxzx89zt.js +585 -0
- package/dist/codemode/catalog.js +13 -0
- package/dist/codemode/instructions.js +15 -0
- package/dist/codemode/tool.js +12 -0
- package/dist/command.js +140 -0
- package/dist/config/markdown.js +13 -0
- package/dist/config/normalize.js +27 -0
- package/dist/config/plugin/agent.js +136 -0
- package/dist/config/plugin/command.js +128 -0
- package/dist/config/plugin/instruction.js +92 -0
- package/dist/config/plugin/policy.js +117 -0
- package/dist/config/plugin/provider.js +116 -0
- package/dist/config/plugin/reference.js +120 -0
- package/dist/config/plugin/skill-file.js +109 -0
- package/dist/config/plugin/skill.js +139 -0
- package/dist/config/plugin/source.js +122 -0
- package/dist/config/plugin/websearch.js +116 -0
- package/dist/config/variable.js +11 -0
- package/dist/config.js +129 -0
- package/dist/credential/sql.js +8 -0
- package/dist/credential.js +87 -0
- package/dist/database/database.js +82 -0
- package/dist/database/drizzle/effect-sqlite/driver.js +27 -0
- package/dist/database/drizzle/effect-sqlite/index.js +36 -0
- package/dist/database/drizzle/effect-sqlite/migrator.js +20 -0
- package/dist/database/drizzle/effect-sqlite/session.js +22 -0
- package/dist/database/drizzle/index.js +42 -0
- package/dist/database/drizzle/internal/drizzle-utils.js +19 -0
- package/dist/database/drizzle/sqlite-core/effect/count.js +7 -0
- package/dist/database/drizzle/sqlite-core/effect/db.js +17 -0
- package/dist/database/drizzle/sqlite-core/effect/delete.js +8 -0
- package/dist/database/drizzle/sqlite-core/effect/index.js +59 -0
- package/dist/database/drizzle/sqlite-core/effect/insert.js +10 -0
- package/dist/database/drizzle/sqlite-core/effect/query.js +9 -0
- package/dist/database/drizzle/sqlite-core/effect/raw.js +7 -0
- package/dist/database/drizzle/sqlite-core/effect/select.js +10 -0
- package/dist/database/drizzle/sqlite-core/effect/session.js +25 -0
- package/dist/database/drizzle/sqlite-core/effect/update.js +10 -0
- package/dist/database/drizzle/up-migrations/effect-sqlite.js +9 -0
- package/dist/database/drizzle/up-migrations/sqlite.js +14 -0
- package/dist/database/drizzle/up-migrations/utils.js +9 -0
- package/dist/database/drizzle.js +43 -0
- package/dist/database/migration/20260127222353_familiar_lady_ursula.js +7 -0
- package/dist/database/migration/20260211171708_add_project_commands.js +7 -0
- package/dist/database/migration/20260213144116_wakeful_the_professor.js +7 -0
- package/dist/database/migration/20260225215848_workspace.js +7 -0
- package/dist/database/migration/20260227213759_add_session_workspace_id.js +7 -0
- package/dist/database/migration/20260228203230_blue_harpoon.js +7 -0
- package/dist/database/migration/20260303231226_add_workspace_fields.js +7 -0
- package/dist/database/migration/20260309230000_move_org_to_state.js +7 -0
- package/dist/database/migration/20260312043431_session_message_cursor.js +7 -0
- package/dist/database/migration/20260323234822_events.js +7 -0
- package/dist/database/migration/20260410174513_workspace-name.js +7 -0
- package/dist/database/migration/20260413175956_chief_energizer.js +7 -0
- package/dist/database/migration/20260423070820_add_icon_url_override.js +7 -0
- package/dist/database/migration/20260427172553_slow_nightmare.js +7 -0
- package/dist/database/migration/20260428004200_add_session_path.js +7 -0
- package/dist/database/migration/20260501142318_next_venus.js +7 -0
- package/dist/database/migration/20260504145000_add_sync_owner.js +7 -0
- package/dist/database/migration/20260507164347_add_workspace_time.js +7 -0
- package/dist/database/migration/20260510033149_session_usage.js +7 -0
- package/dist/database/migration/20260511000411_data_migration_state.js +7 -0
- package/dist/database/migration/20260511173437_session-metadata.js +7 -0
- package/dist/database/migration/20260601010001_normalize_storage_paths.js +7 -0
- package/dist/database/migration/20260601202201_amazing_prowler.js +7 -0
- package/dist/database/migration/20260602002951_lowly_union_jack.js +7 -0
- package/dist/database/migration/20260602182828_add_project_directories.js +7 -0
- package/dist/database/migration/20260603001617_session_message_projection_indexes.js +7 -0
- package/dist/database/migration/20260603040000_session_message_projection_order.js +7 -0
- package/dist/database/migration/20260603141458_session_input_inbox.js +7 -0
- package/dist/database/migration/20260603160727_jittery_ezekiel_stane.js +7 -0
- package/dist/database/migration/20260604172448_event_sourced_session_input.js +7 -0
- package/dist/database/migration/20260605003541_add_session_context_snapshot.js +7 -0
- package/dist/database/migration/20260605042240_add_context_epoch_agent.js +7 -0
- package/dist/database/migration/20260611035744_credential.js +7 -0
- package/dist/database/migration/20260611192811_lush_chimera.js +7 -0
- package/dist/database/migration/20260612174303_project_dir_strategy.js +7 -0
- package/dist/database/migration/20260622142730_simplify_session_context_epoch.js +7 -0
- package/dist/database/migration/20260622170816_reset_v2_session_state.js +7 -0
- package/dist/database/migration/20260622202450_simplify_session_input.js +7 -0
- package/dist/database/migration/20260804233008_loose_psylocke.js +7 -0
- package/dist/database/migration/20260805200742_import_legacy_credentials.js +9 -0
- package/dist/database/migration/20260808023530_workspace_domain.js +7 -0
- package/dist/database/migration/20260811161259_execution_claim_attempts.js +7 -0
- package/dist/database/migration.gen.js +49 -0
- package/dist/database/migration.js +55 -0
- package/dist/database/path.js +14 -0
- package/dist/database/schema.gen.js +7 -0
- package/dist/database/schema.sql.js +7 -0
- package/dist/database/sqlite.bun.js +78 -0
- package/dist/database/sqlite.js +13 -0
- package/dist/database/sqlite.node.js +74 -0
- package/dist/database/sqlite.workerd.js +128 -0
- package/dist/database/v1-migration.bun.js +739 -0
- package/dist/database/v1-migration.js +7 -0
- package/dist/database/v1-migration.noop.js +16 -0
- package/dist/effect/app-node-builder.js +340 -0
- package/dist/effect/app-node-platform.js +11 -0
- package/dist/effect/keyed-mutex.js +11 -0
- package/dist/environment/driver.js +12 -0
- package/dist/environment/environment.js +93 -0
- package/dist/environment/exec-defaults.js +10 -0
- package/dist/environment/files.js +17 -0
- package/dist/environment/index.js +113 -0
- package/dist/environment/local.js +10 -0
- package/dist/environment/memory.js +10 -0
- package/dist/event/sql.js +9 -0
- package/dist/event-logger.js +104 -0
- package/dist/file-mutation.js +98 -0
- package/dist/file.js +9 -0
- package/dist/filesystem/fff.bun.js +23 -0
- package/dist/filesystem/fff.js +7 -0
- package/dist/filesystem/fff.node.js +24 -0
- package/dist/filesystem/ignore.js +58 -0
- package/dist/filesystem/location-watcher.js +118 -0
- package/dist/filesystem/protected.js +13 -0
- package/dist/filesystem/search.js +108 -0
- package/dist/filesystem/watcher-binding.js +7 -0
- package/dist/filesystem/watcher.js +33 -0
- package/dist/filesystem.js +122 -0
- package/dist/form.js +124 -0
- package/dist/formatter/builtins.js +8 -0
- package/dist/formatter.js +120 -0
- package/dist/generate.js +107 -0
- package/dist/git.js +24 -0
- package/dist/github-copilot/chat/convert-to-openai-compatible-chat-messages.js +7 -0
- package/dist/github-copilot/chat/get-response-metadata.js +7 -0
- package/dist/github-copilot/chat/map-openai-compatible-finish-reason.js +7 -0
- package/dist/github-copilot/chat/openai-compatible-api-types.js +0 -0
- package/dist/github-copilot/chat/openai-compatible-chat-language-model.js +13 -0
- package/dist/github-copilot/chat/openai-compatible-chat-options.js +7 -0
- package/dist/github-copilot/chat/openai-compatible-metadata-extractor.js +0 -0
- package/dist/github-copilot/chat/openai-compatible-prepare-tools.js +7 -0
- package/dist/github-copilot/copilot-provider.js +67 -0
- package/dist/github-copilot/models.js +11 -0
- package/dist/github-copilot/openai-compatible-error.js +9 -0
- package/dist/github-copilot/responses/convert-to-openai-responses-input.js +8 -0
- package/dist/github-copilot/responses/map-openai-responses-finish-reason.js +7 -0
- package/dist/github-copilot/responses/openai-config.js +0 -0
- package/dist/github-copilot/responses/openai-error.js +9 -0
- package/dist/github-copilot/responses/openai-responses-api-types.js +0 -0
- package/dist/github-copilot/responses/openai-responses-language-model.js +17 -0
- package/dist/github-copilot/responses/openai-responses-prepare-tools.js +12 -0
- package/dist/github-copilot/responses/openai-responses-settings.js +0 -0
- package/dist/github-copilot/responses/tool/code-interpreter.js +15 -0
- package/dist/github-copilot/responses/tool/file-search.js +11 -0
- package/dist/github-copilot/responses/tool/image-generation.js +9 -0
- package/dist/github-copilot/responses/tool/local-shell.js +9 -0
- package/dist/github-copilot/responses/tool/web-search-preview.js +7 -0
- package/dist/github-copilot/responses/tool/web-search.js +7 -0
- package/dist/id/id.js +15 -0
- package/dist/image/photon-wasm.bun.js +8 -0
- package/dist/image/photon-wasm.node.js +8 -0
- package/dist/image/photon.js +208 -0
- package/dist/image.js +137 -0
- package/dist/instruction-discovery.js +100 -0
- package/dist/instructions/builtins.js +88 -0
- package/dist/instructions/index.js +45 -0
- package/dist/integration/connection.js +13 -0
- package/dist/integration.js +127 -0
- package/dist/job.js +15 -0
- package/dist/kv/sql.js +8 -0
- package/dist/kv.js +77 -0
- package/dist/location-mutation.js +92 -0
- package/dist/location-service-map.js +86 -0
- package/dist/location-services.js +319 -0
- package/dist/location.js +93 -0
- package/dist/mcp/client.js +13 -0
- package/dist/mcp/index.js +167 -0
- package/dist/mcp/instructions.js +163 -0
- package/dist/mcp/oauth.js +20 -0
- package/dist/mime.js +9 -0
- package/dist/model-resolver.js +115 -0
- package/dist/model.js +30 -0
- package/dist/models-dev.js +103 -0
- package/dist/oauth/page.js +13 -0
- package/dist/permission/saved.js +94 -0
- package/dist/permission/sql.js +11 -0
- package/dist/permission.js +142 -0
- package/dist/plugin/agent.js +107 -0
- package/dist/plugin/command.js +84 -0
- package/dist/plugin/hooks.js +12 -0
- package/dist/plugin/host.js +190 -0
- package/dist/plugin/internal.js +278 -0
- package/dist/plugin/models-dev.js +90 -0
- package/dist/plugin/plan.js +89 -0
- package/dist/plugin/promise.js +151 -0
- package/dist/plugin/provider/alibaba.js +8 -0
- package/dist/plugin/provider/amazon-bedrock.js +8 -0
- package/dist/plugin/provider/anthropic.js +8 -0
- package/dist/plugin/provider/azure.js +121 -0
- package/dist/plugin/provider/cerebras.js +8 -0
- package/dist/plugin/provider/cloudflare-ai-gateway.js +122 -0
- package/dist/plugin/provider/cloudflare-workers-ai.js +122 -0
- package/dist/plugin/provider/cohere.js +8 -0
- package/dist/plugin/provider/configured.js +119 -0
- package/dist/plugin/provider/deepinfra.js +8 -0
- package/dist/plugin/provider/dynamic.js +7 -0
- package/dist/plugin/provider/factory.js +7 -0
- package/dist/plugin/provider/gateway.js +8 -0
- package/dist/plugin/provider/github-copilot.js +100 -0
- package/dist/plugin/provider/gitlab.js +9 -0
- package/dist/plugin/provider/google-vertex.js +8 -0
- package/dist/plugin/provider/groq.js +8 -0
- package/dist/plugin/provider/kilo.js +8 -0
- package/dist/plugin/provider/llmgateway.js +91 -0
- package/dist/plugin/provider/mistral.js +8 -0
- package/dist/plugin/provider/nvidia.js +8 -0
- package/dist/plugin/provider/openai-compatible.js +7 -0
- package/dist/plugin/provider/openai.js +93 -0
- package/dist/plugin/provider/opencode.js +106 -0
- package/dist/plugin/provider/openrouter.js +9 -0
- package/dist/plugin/provider/perplexity.js +8 -0
- package/dist/plugin/provider/sap-ai-core.js +8 -0
- package/dist/plugin/provider/snowflake-cortex.js +10 -0
- package/dist/plugin/provider/togetherai.js +8 -0
- package/dist/plugin/provider/venice.js +8 -0
- package/dist/plugin/provider/vercel.js +8 -0
- package/dist/plugin/provider/xai.js +91 -0
- package/dist/plugin/provider/zenmux.js +8 -0
- package/dist/plugin/provider.js +157 -0
- package/dist/plugin/runtime.js +195 -0
- package/dist/plugin/sdk.js +92 -0
- package/dist/plugin/skill.js +143 -0
- package/dist/plugin/supervisor.js +285 -0
- package/dist/plugin/system-prompt.js +21 -0
- package/dist/plugin/variant.js +13 -0
- package/dist/plugin/warming.js +117 -0
- package/dist/plugin/websearch/exa.js +13 -0
- package/dist/plugin/websearch/firecrawl.js +14 -0
- package/dist/plugin/websearch/index.js +13 -0
- package/dist/plugin/websearch/mcp.js +14 -0
- package/dist/plugin/websearch/parallel.js +14 -0
- package/dist/plugin.js +199 -0
- package/dist/project/copy-strategies.js +85 -0
- package/dist/project/copy.js +119 -0
- package/dist/project/directories.js +88 -0
- package/dist/project/schema.js +22 -0
- package/dist/project/sql.js +14 -0
- package/dist/project.js +100 -0
- package/dist/provider.js +31 -0
- package/dist/pty/protocol.js +45 -0
- package/dist/pty/pty.bun.js +28 -0
- package/dist/pty/pty.js +0 -0
- package/dist/pty/pty.node.js +30 -0
- package/dist/pty/schema.js +7 -0
- package/dist/pty/ticket.js +118 -0
- package/dist/pty.js +137 -0
- package/dist/question.js +111 -0
- package/dist/reference/instructions.js +93 -0
- package/dist/reference.js +101 -0
- package/dist/repository-cache.js +34 -0
- package/dist/repository.js +29 -0
- package/dist/ripgrep/binary.js +8 -0
- package/dist/ripgrep.js +100 -0
- package/dist/schema.js +21 -0
- package/dist/session/compaction.js +161 -0
- package/dist/session/context.js +291 -0
- package/dist/session/error.js +21 -0
- package/dist/session/event.js +7 -0
- package/dist/session/execution/restart.js +186 -0
- package/dist/session/execution.js +130 -0
- package/dist/session/generate-node.js +297 -0
- package/dist/session/generate.js +9 -0
- package/dist/session/history.js +92 -0
- package/dist/session/info.js +92 -0
- package/dist/session/instruction-entry.js +90 -0
- package/dist/session/instruction-state.js +35 -0
- package/dist/session/instructions.js +105 -0
- package/dist/session/message-updater.js +11 -0
- package/dist/session/message.js +7 -0
- package/dist/session/model-headers.js +11 -0
- package/dist/session/model-http.js +11 -0
- package/dist/session/model-request.js +305 -0
- package/dist/session/pending.js +142 -0
- package/dist/session/projector.js +104 -0
- package/dist/session/prompt-cache-diagnostics.js +11 -0
- package/dist/session/prompt-cache-key.js +10 -0
- package/dist/session/revert.js +127 -0
- package/dist/session/run-coordinator.js +9 -0
- package/dist/session/runner/index.js +100 -0
- package/dist/session/runner/llm.js +305 -0
- package/dist/session/runner/max-steps.js +7 -0
- package/dist/session/runner/model.js +113 -0
- package/dist/session/runner/publish-llm-event.js +9 -0
- package/dist/session/runner/retry.js +93 -0
- package/dist/session/runner/to-llm-message.js +7 -0
- package/dist/session/schema.js +11 -0
- package/dist/session/sql.js +21 -0
- package/dist/session/store.js +104 -0
- package/dist/session/title.js +123 -0
- package/dist/session/to-session-error.js +116 -0
- package/dist/session/transfer.js +454 -0
- package/dist/session/usage.js +15 -0
- package/dist/session.js +218 -0
- package/dist/shell/parse.js +11 -0
- package/dist/shell/parser-wasm.bun.js +10 -0
- package/dist/shell/parser-wasm.node.js +13 -0
- package/dist/shell/select.js +26 -0
- package/dist/shell.js +136 -0
- package/dist/skill/discovery.js +12 -0
- package/dist/skill/instructions.js +110 -0
- package/dist/skill.js +129 -0
- package/dist/snapshot.js +124 -0
- package/dist/state.js +13 -0
- package/dist/tool/http-body.js +7 -0
- package/dist/tool/mcp.js +166 -0
- package/dist/tool/plugin/edit.js +152 -0
- package/dist/tool/plugin/file-diff.js +7 -0
- package/dist/tool/plugin/glob.js +126 -0
- package/dist/tool/plugin/grep.js +126 -0
- package/dist/tool/plugin/patch.js +155 -0
- package/dist/tool/plugin/question.js +121 -0
- package/dist/tool/plugin/read.js +127 -0
- package/dist/tool/plugin/shell.js +191 -0
- package/dist/tool/plugin/skill.js +118 -0
- package/dist/tool/plugin/subagent.js +190 -0
- package/dist/tool/plugin/webfetch.js +124 -0
- package/dist/tool/plugin/websearch.js +119 -0
- package/dist/tool/plugin/write.js +154 -0
- package/dist/tool/read-filesystem.js +126 -0
- package/dist/tool/runtime.js +11 -0
- package/dist/tool-output.js +127 -0
- package/dist/tool.js +164 -0
- package/dist/types/account/sql.d.ts +325 -0
- package/dist/types/agent.d.ts +119 -0
- package/dist/types/aisdk-native.d.ts +13 -0
- package/dist/types/aisdk.d.ts +52 -0
- package/dist/types/app.d.ts +13 -0
- package/dist/types/bus.d.ts +93 -0
- package/dist/types/catalog.d.ts +49 -0
- package/dist/types/codemode/catalog.d.ts +23 -0
- package/dist/types/codemode/instructions.d.ts +6 -0
- package/dist/types/codemode/tool.d.ts +58 -0
- package/dist/types/command.d.ts +103 -0
- package/dist/types/config/markdown.d.ts +5 -0
- package/dist/types/config/normalize.d.ts +15 -0
- package/dist/types/config/plugin/agent.d.ts +5 -0
- package/dist/types/config/plugin/command.d.ts +4 -0
- package/dist/types/config/plugin/instruction.d.ts +7 -0
- package/dist/types/config/plugin/policy.d.ts +3 -0
- package/dist/types/config/plugin/provider.d.ts +3 -0
- package/dist/types/config/plugin/reference.d.ts +5 -0
- package/dist/types/config/plugin/skill-file.d.ts +15 -0
- package/dist/types/config/plugin/skill.d.ts +8 -0
- package/dist/types/config/plugin/source.d.ts +25 -0
- package/dist/types/config/plugin/websearch.d.ts +3 -0
- package/dist/types/config/variable.d.ts +60 -0
- package/dist/types/config.d.ts +44 -0
- package/dist/types/credential/sql.d.ts +169 -0
- package/dist/types/credential.d.ts +82 -0
- package/dist/types/database/database.d.ts +23 -0
- package/dist/types/database/drizzle/effect-sqlite/driver.d.ts +43 -0
- package/dist/types/database/drizzle/effect-sqlite/index.d.ts +3 -0
- package/dist/types/database/drizzle/effect-sqlite/migrator.d.ts +4 -0
- package/dist/types/database/drizzle/effect-sqlite/session.d.ts +47 -0
- package/dist/types/database/drizzle/index.d.ts +5 -0
- package/dist/types/database/drizzle/internal/drizzle-utils.d.ts +20 -0
- package/dist/types/database/drizzle/sqlite-core/effect/count.d.ts +20 -0
- package/dist/types/database/drizzle/sqlite-core/effect/db.d.ts +82 -0
- package/dist/types/database/drizzle/sqlite-core/effect/delete.d.ts +69 -0
- package/dist/types/database/drizzle/sqlite-core/effect/index.d.ts +9 -0
- package/dist/types/database/drizzle/sqlite-core/effect/insert.d.ts +95 -0
- package/dist/types/database/drizzle/sqlite-core/effect/query.d.ts +63 -0
- package/dist/types/database/drizzle/sqlite-core/effect/raw.d.ts +32 -0
- package/dist/types/database/drizzle/sqlite-core/effect/select.d.ts +64 -0
- package/dist/types/database/drizzle/sqlite-core/effect/session.d.ts +88 -0
- package/dist/types/database/drizzle/sqlite-core/effect/update.d.ts +90 -0
- package/dist/types/database/drizzle/up-migrations/effect-sqlite.d.ts +8 -0
- package/dist/types/database/drizzle/up-migrations/sqlite.d.ts +53 -0
- package/dist/types/database/drizzle/up-migrations/utils.d.ts +21 -0
- package/dist/types/database/drizzle.d.ts +1 -0
- package/dist/types/database/migration/20260127222353_familiar_lady_ursula.d.ts +3 -0
- package/dist/types/database/migration/20260211171708_add_project_commands.d.ts +3 -0
- package/dist/types/database/migration/20260213144116_wakeful_the_professor.d.ts +3 -0
- package/dist/types/database/migration/20260225215848_workspace.d.ts +3 -0
- package/dist/types/database/migration/20260227213759_add_session_workspace_id.d.ts +3 -0
- package/dist/types/database/migration/20260228203230_blue_harpoon.d.ts +3 -0
- package/dist/types/database/migration/20260303231226_add_workspace_fields.d.ts +3 -0
- package/dist/types/database/migration/20260309230000_move_org_to_state.d.ts +3 -0
- package/dist/types/database/migration/20260312043431_session_message_cursor.d.ts +3 -0
- package/dist/types/database/migration/20260323234822_events.d.ts +3 -0
- package/dist/types/database/migration/20260410174513_workspace-name.d.ts +3 -0
- package/dist/types/database/migration/20260413175956_chief_energizer.d.ts +3 -0
- package/dist/types/database/migration/20260423070820_add_icon_url_override.d.ts +3 -0
- package/dist/types/database/migration/20260427172553_slow_nightmare.d.ts +3 -0
- package/dist/types/database/migration/20260428004200_add_session_path.d.ts +3 -0
- package/dist/types/database/migration/20260501142318_next_venus.d.ts +3 -0
- package/dist/types/database/migration/20260504145000_add_sync_owner.d.ts +3 -0
- package/dist/types/database/migration/20260507164347_add_workspace_time.d.ts +3 -0
- package/dist/types/database/migration/20260510033149_session_usage.d.ts +3 -0
- package/dist/types/database/migration/20260511000411_data_migration_state.d.ts +3 -0
- package/dist/types/database/migration/20260511173437_session-metadata.d.ts +3 -0
- package/dist/types/database/migration/20260601010001_normalize_storage_paths.d.ts +3 -0
- package/dist/types/database/migration/20260601202201_amazing_prowler.d.ts +3 -0
- package/dist/types/database/migration/20260602002951_lowly_union_jack.d.ts +3 -0
- package/dist/types/database/migration/20260602182828_add_project_directories.d.ts +3 -0
- package/dist/types/database/migration/20260603001617_session_message_projection_indexes.d.ts +3 -0
- package/dist/types/database/migration/20260603040000_session_message_projection_order.d.ts +3 -0
- package/dist/types/database/migration/20260603141458_session_input_inbox.d.ts +3 -0
- package/dist/types/database/migration/20260603160727_jittery_ezekiel_stane.d.ts +3 -0
- package/dist/types/database/migration/20260604172448_event_sourced_session_input.d.ts +3 -0
- package/dist/types/database/migration/20260605003541_add_session_context_snapshot.d.ts +3 -0
- package/dist/types/database/migration/20260605042240_add_context_epoch_agent.d.ts +3 -0
- package/dist/types/database/migration/20260611035744_credential.d.ts +3 -0
- package/dist/types/database/migration/20260611192811_lush_chimera.d.ts +3 -0
- package/dist/types/database/migration/20260612174303_project_dir_strategy.d.ts +3 -0
- package/dist/types/database/migration/20260622142730_simplify_session_context_epoch.d.ts +3 -0
- package/dist/types/database/migration/20260622170816_reset_v2_session_state.d.ts +3 -0
- package/dist/types/database/migration/20260622202450_simplify_session_input.d.ts +3 -0
- package/dist/types/database/migration/20260804233008_loose_psylocke.d.ts +3 -0
- package/dist/types/database/migration/20260805200742_import_legacy_credentials.d.ts +5 -0
- package/dist/types/database/migration/20260808023530_workspace_domain.d.ts +3 -0
- package/dist/types/database/migration/20260811161259_execution_claim_attempts.d.ts +3 -0
- package/dist/types/database/migration.d.ts +13 -0
- package/dist/types/database/migration.gen.d.ts +2 -0
- package/dist/types/database/path.d.ts +68 -0
- package/dist/types/database/schema.gen.d.ts +3 -0
- package/dist/types/database/schema.sql.d.ts +4 -0
- package/dist/types/database/sqlite.bun.d.ts +14 -0
- package/dist/types/database/sqlite.d.ts +20 -0
- package/dist/types/database/sqlite.node.d.ts +16 -0
- package/dist/types/database/sqlite.workerd.d.ts +29 -0
- package/dist/types/database/v1-migration.bun.d.ts +71 -0
- package/dist/types/database/v1-migration.d.ts +2 -0
- package/dist/types/database/v1-migration.noop.d.ts +11 -0
- package/dist/types/effect/app-node-builder.d.ts +3 -0
- package/dist/types/effect/app-node-platform.d.ts +4 -0
- package/dist/types/effect/keyed-mutex.d.ts +19 -0
- package/dist/types/environment/driver.d.ts +7 -0
- package/dist/types/environment/environment.d.ts +12 -0
- package/dist/types/environment/exec-defaults.d.ts +4 -0
- package/dist/types/environment/files.d.ts +60 -0
- package/dist/types/environment/index.d.ts +10 -0
- package/dist/types/environment/local.d.ts +13 -0
- package/dist/types/environment/memory.d.ts +8 -0
- package/dist/types/event/sql.d.ts +158 -0
- package/dist/types/event-logger.d.ts +5 -0
- package/dist/types/file-mutation.d.ts +40 -0
- package/dist/types/file.d.ts +9 -0
- package/dist/types/filesystem/fff.bun.d.ts +7 -0
- package/dist/types/filesystem/fff.d.ts +60 -0
- package/dist/types/filesystem/fff.node.d.ts +4 -0
- package/dist/types/filesystem/ignore.d.ts +2 -0
- package/dist/types/filesystem/location-watcher.d.ts +8 -0
- package/dist/types/filesystem/protected.d.ts +6 -0
- package/dist/types/filesystem/search.d.ts +20 -0
- package/dist/types/filesystem/watcher-binding.d.ts +1 -0
- package/dist/types/filesystem/watcher.d.ts +105 -0
- package/dist/types/filesystem.d.ts +130 -0
- package/dist/types/form.d.ts +450 -0
- package/dist/types/formatter/builtins.d.ts +18 -0
- package/dist/types/formatter.d.ts +9 -0
- package/dist/types/generate.d.ts +28 -0
- package/dist/types/git.d.ts +133 -0
- package/dist/types/github-copilot/chat/convert-to-openai-compatible-chat-messages.d.ts +3 -0
- package/dist/types/github-copilot/chat/get-response-metadata.d.ts +9 -0
- package/dist/types/github-copilot/chat/map-openai-compatible-finish-reason.d.ts +2 -0
- package/dist/types/github-copilot/chat/openai-compatible-api-types.d.ts +48 -0
- package/dist/types/github-copilot/chat/openai-compatible-chat-language-model.d.ts +135 -0
- package/dist/types/github-copilot/chat/openai-compatible-chat-options.d.ts +9 -0
- package/dist/types/github-copilot/chat/openai-compatible-metadata-extractor.d.ts +43 -0
- package/dist/types/github-copilot/chat/openai-compatible-prepare-tools.d.ts +21 -0
- package/dist/types/github-copilot/copilot-provider.d.ts +36 -0
- package/dist/types/github-copilot/models.d.ts +3 -0
- package/dist/types/github-copilot/openai-compatible-error.d.ts +16 -0
- package/dist/types/github-copilot/responses/convert-to-openai-responses-input.d.ts +19 -0
- package/dist/types/github-copilot/responses/map-openai-responses-finish-reason.d.ts +5 -0
- package/dist/types/github-copilot/responses/openai-config.d.ts +20 -0
- package/dist/types/github-copilot/responses/openai-error.d.ts +11 -0
- package/dist/types/github-copilot/responses/openai-responses-api-types.d.ts +185 -0
- package/dist/types/github-copilot/responses/openai-responses-language-model.d.ts +205 -0
- package/dist/types/github-copilot/responses/openai-responses-prepare-tools.d.ts +24 -0
- package/dist/types/github-copilot/responses/openai-responses-settings.d.ts +1 -0
- package/dist/types/github-copilot/responses/tool/code-interpreter.d.ts +86 -0
- package/dist/types/github-copilot/responses/tool/file-search.d.ts +95 -0
- package/dist/types/github-copilot/responses/tool/image-generation.d.ts +42 -0
- package/dist/types/github-copilot/responses/tool/local-shell.d.ts +14 -0
- package/dist/types/github-copilot/responses/tool/web-search-preview.d.ts +15 -0
- package/dist/types/github-copilot/responses/tool/web-search.d.ts +18 -0
- package/dist/types/id/id.d.ts +19 -0
- package/dist/types/image/photon-wasm.bun.d.ts +2 -0
- package/dist/types/image/photon-wasm.node.d.ts +2 -0
- package/dist/types/image/photon.d.ts +24 -0
- package/dist/types/image.d.ts +35 -0
- package/dist/types/instruction-discovery.d.ts +73 -0
- package/dist/types/instructions/builtins.d.ts +11 -0
- package/dist/types/instructions/index.d.ts +88 -0
- package/dist/types/integration/connection.d.ts +26 -0
- package/dist/types/integration.d.ts +1648 -0
- package/dist/types/job.d.ts +67 -0
- package/dist/types/kv/sql.d.ts +71 -0
- package/dist/types/kv.d.ts +12 -0
- package/dist/types/location-mutation.d.ts +48 -0
- package/dist/types/location-service-map.d.ts +9 -0
- package/dist/types/location-services.d.ts +52 -0
- package/dist/types/location.d.ts +14 -0
- package/dist/types/mcp/client.d.ts +277 -0
- package/dist/types/mcp/index.d.ts +224 -0
- package/dist/types/mcp/instructions.d.ts +13 -0
- package/dist/types/mcp/oauth.d.ts +86 -0
- package/dist/types/mime.d.ts +2 -0
- package/dist/types/model-resolver.d.ts +103 -0
- package/dist/types/model.d.ts +177 -0
- package/dist/types/models-dev.d.ts +33 -0
- package/dist/types/oauth/page.d.ts +15 -0
- package/dist/types/permission/saved.d.ts +40 -0
- package/dist/types/permission/sql.d.ts +103 -0
- package/dist/types/permission.d.ts +125 -0
- package/dist/types/plugin/agent.d.ts +2 -0
- package/dist/types/plugin/command.d.ts +3 -0
- package/dist/types/plugin/hooks.d.ts +31 -0
- package/dist/types/plugin/host.d.ts +280 -0
- package/dist/types/plugin/internal.d.ts +49 -0
- package/dist/types/plugin/models-dev.d.ts +3 -0
- package/dist/types/plugin/plan.d.ts +2 -0
- package/dist/types/plugin/promise.d.ts +13 -0
- package/dist/types/plugin/provider/alibaba.d.ts +1 -0
- package/dist/types/plugin/provider/amazon-bedrock.d.ts +1 -0
- package/dist/types/plugin/provider/anthropic.d.ts +1 -0
- package/dist/types/plugin/provider/azure.d.ts +1 -0
- package/dist/types/plugin/provider/cerebras.d.ts +1 -0
- package/dist/types/plugin/provider/cloudflare-ai-gateway.d.ts +1 -0
- package/dist/types/plugin/provider/cloudflare-workers-ai.d.ts +1 -0
- package/dist/types/plugin/provider/cohere.d.ts +1 -0
- package/dist/types/plugin/provider/configured.d.ts +5 -0
- package/dist/types/plugin/provider/deepinfra.d.ts +1 -0
- package/dist/types/plugin/provider/dynamic.d.ts +2 -0
- package/dist/types/plugin/provider/factory.d.ts +6 -0
- package/dist/types/plugin/provider/gateway.d.ts +1 -0
- package/dist/types/plugin/provider/github-copilot.d.ts +8 -0
- package/dist/types/plugin/provider/gitlab.d.ts +1 -0
- package/dist/types/plugin/provider/google-vertex.d.ts +1 -0
- package/dist/types/plugin/provider/groq.d.ts +1 -0
- package/dist/types/plugin/provider/kilo.d.ts +1 -0
- package/dist/types/plugin/provider/llmgateway.d.ts +2 -0
- package/dist/types/plugin/provider/mistral.d.ts +1 -0
- package/dist/types/plugin/provider/nvidia.d.ts +1 -0
- package/dist/types/plugin/provider/openai-compatible.d.ts +1 -0
- package/dist/types/plugin/provider/openai.d.ts +2 -0
- package/dist/types/plugin/provider/opencode.d.ts +4 -0
- package/dist/types/plugin/provider/openrouter.d.ts +1 -0
- package/dist/types/plugin/provider/perplexity.d.ts +1 -0
- package/dist/types/plugin/provider/sap-ai-core.d.ts +2 -0
- package/dist/types/plugin/provider/snowflake-cortex.d.ts +4 -0
- package/dist/types/plugin/provider/togetherai.d.ts +1 -0
- package/dist/types/plugin/provider/venice.d.ts +1 -0
- package/dist/types/plugin/provider/vercel.d.ts +1 -0
- package/dist/types/plugin/provider/xai.d.ts +2 -0
- package/dist/types/plugin/provider/zenmux.d.ts +1 -0
- package/dist/types/plugin/provider.d.ts +2 -0
- package/dist/types/plugin/runtime.d.ts +32 -0
- package/dist/types/plugin/sdk.d.ts +58 -0
- package/dist/types/plugin/skill.d.ts +6 -0
- package/dist/types/plugin/supervisor.d.ts +16 -0
- package/dist/types/plugin/system-prompt.d.ts +8 -0
- package/dist/types/plugin/variant.d.ts +10 -0
- package/dist/types/plugin/warming.d.ts +4 -0
- package/dist/types/plugin/websearch/exa.d.ts +5 -0
- package/dist/types/plugin/websearch/firecrawl.d.ts +5 -0
- package/dist/types/plugin/websearch/index.d.ts +1 -0
- package/dist/types/plugin/websearch/mcp.d.ts +9 -0
- package/dist/types/plugin/websearch/parallel.d.ts +5 -0
- package/dist/types/plugin.d.ts +15 -0
- package/dist/types/project/copy-strategies.d.ts +24 -0
- package/dist/types/project/copy.d.ts +96 -0
- package/dist/types/project/directories.d.ts +49 -0
- package/dist/types/project/schema.d.ts +68 -0
- package/dist/types/project/sql.d.ts +299 -0
- package/dist/types/project.d.ts +88 -0
- package/dist/types/provider.d.ts +77 -0
- package/dist/types/pty/protocol.d.ts +5 -0
- package/dist/types/pty/pty.bun.d.ts +4 -0
- package/dist/types/pty/pty.d.ts +22 -0
- package/dist/types/pty/pty.node.d.ts +3 -0
- package/dist/types/pty/schema.d.ts +1 -0
- package/dist/types/pty/ticket.d.ts +24 -0
- package/dist/types/pty.d.ts +87 -0
- package/dist/types/question.d.ts +105 -0
- package/dist/types/reference/instructions.d.ts +10 -0
- package/dist/types/reference.d.ts +64 -0
- package/dist/types/repository-cache.d.ts +71 -0
- package/dist/types/repository.d.ts +50 -0
- package/dist/types/ripgrep/binary.d.ts +11 -0
- package/dist/types/ripgrep.d.ts +50 -0
- package/dist/types/schema.d.ts +45 -0
- package/dist/types/session/compaction.d.ts +39 -0
- package/dist/types/session/context.d.ts +44 -0
- package/dist/types/session/error.d.ts +56 -0
- package/dist/types/session/event.d.ts +2 -0
- package/dist/types/session/execution/restart.d.ts +43 -0
- package/dist/types/session/execution.d.ts +42 -0
- package/dist/types/session/generate-node.d.ts +9 -0
- package/dist/types/session/generate.d.ts +19 -0
- package/dist/types/session/history.d.ts +1097 -0
- package/dist/types/session/info.d.ts +3 -0
- package/dist/types/session/instruction-entry.d.ts +32 -0
- package/dist/types/session/instruction-state.d.ts +48 -0
- package/dist/types/session/instructions.d.ts +15 -0
- package/dist/types/session/message-updater.d.ts +18 -0
- package/dist/types/session/message.d.ts +2 -0
- package/dist/types/session/model-headers.d.ts +12 -0
- package/dist/types/session/model-http.d.ts +11 -0
- package/dist/types/session/model-request.d.ts +44 -0
- package/dist/types/session/pending.d.ts +380 -0
- package/dist/types/session/projector.d.ts +4 -0
- package/dist/types/session/prompt-cache-diagnostics.d.ts +29 -0
- package/dist/types/session/prompt-cache-key.d.ts +3 -0
- package/dist/types/session/revert.d.ts +36 -0
- package/dist/types/session/run-coordinator.d.ts +36 -0
- package/dist/types/session/runner/index.d.ts +19 -0
- package/dist/types/session/runner/llm.d.ts +3 -0
- package/dist/types/session/runner/max-steps.d.ts +1 -0
- package/dist/types/session/runner/model.d.ts +55 -0
- package/dist/types/session/runner/publish-llm-event.d.ts +256 -0
- package/dist/types/session/runner/retry.d.ts +18 -0
- package/dist/types/session/runner/to-llm-message.d.ts +5 -0
- package/dist/types/session/schema.d.ts +177 -0
- package/dist/types/session/sql.d.ts +1024 -0
- package/dist/types/session/store.d.ts +43 -0
- package/dist/types/session/title.d.ts +18 -0
- package/dist/types/session/to-session-error.d.ts +2 -0
- package/dist/types/session/transfer.d.ts +769 -0
- package/dist/types/session/usage.d.ts +13 -0
- package/dist/types/session.d.ts +327 -0
- package/dist/types/shell/parse.d.ts +9 -0
- package/dist/types/shell/parser-wasm.bun.d.ts +5 -0
- package/dist/types/shell/parser-wasm.node.d.ts +5 -0
- package/dist/types/shell/select.d.ts +25 -0
- package/dist/types/shell.d.ts +43 -0
- package/dist/types/skill/discovery.d.ts +10 -0
- package/dist/types/skill/instructions.d.ts +11 -0
- package/dist/types/skill.d.ts +83 -0
- package/dist/types/snapshot.d.ts +53 -0
- package/dist/types/state.d.ts +38 -0
- package/dist/types/tool/http-body.d.ts +3 -0
- package/dist/types/tool/mcp.d.ts +20 -0
- package/dist/types/tool/plugin/edit.d.ts +38 -0
- package/dist/types/tool/plugin/file-diff.d.ts +2 -0
- package/dist/types/tool/plugin/glob.d.ts +26 -0
- package/dist/types/tool/plugin/grep.d.ts +37 -0
- package/dist/types/tool/plugin/patch.d.ts +37 -0
- package/dist/types/tool/plugin/question.d.ts +32 -0
- package/dist/types/tool/plugin/read.d.ts +36 -0
- package/dist/types/tool/plugin/shell.d.ts +21 -0
- package/dist/types/tool/plugin/skill.d.ts +21 -0
- package/dist/types/tool/plugin/subagent.d.ts +27 -0
- package/dist/types/tool/plugin/webfetch.d.ts +21 -0
- package/dist/types/tool/plugin/websearch.d.ts +17 -0
- package/dist/types/tool/plugin/write.d.ts +32 -0
- package/dist/types/tool/read-filesystem.d.ts +100 -0
- package/dist/types/tool/runtime.d.ts +26 -0
- package/dist/types/tool-output.d.ts +16 -0
- package/dist/types/tool.d.ts +40 -0
- package/dist/types/util/array.d.ts +1 -0
- package/dist/types/util/binary.d.ts +7 -0
- package/dist/types/util/encode.d.ts +5 -0
- package/dist/types/util/error.d.ts +269 -0
- package/dist/types/util/identifier.d.ts +1 -0
- package/dist/types/util/iife.d.ts +1 -0
- package/dist/types/util/lazy.d.ts +1 -0
- package/dist/types/util/path.d.ts +4 -0
- package/dist/types/util/process-lock-ffi.bun.d.ts +12 -0
- package/dist/types/util/process-lock-ffi.node.d.ts +12 -0
- package/dist/types/util/process-lock.d.ts +20 -0
- package/dist/types/util/retry.d.ts +8 -0
- package/dist/types/util/slug.d.ts +3 -0
- package/dist/types/util/token.d.ts +2 -0
- package/dist/types/util/which.d.ts +1 -0
- package/dist/types/util/wildcard.d.ts +2 -0
- package/dist/types/v1/config/agent.d.ts +96 -0
- package/dist/types/v1/config/attachment.d.ts +18 -0
- package/dist/types/v1/config/command.d.ts +11 -0
- package/dist/types/v1/config/config.d.ts +1243 -0
- package/dist/types/v1/config/error.d.ts +1773 -0
- package/dist/types/v1/config/formatter.d.ts +15 -0
- package/dist/types/v1/config/layout.d.ts +4 -0
- package/dist/types/v1/config/lsp.d.ts +38 -0
- package/dist/types/v1/config/mcp.d.ts +56 -0
- package/dist/types/v1/config/migrate.d.ts +421 -0
- package/dist/types/v1/config/permission.d.ts +59 -0
- package/dist/types/v1/config/plugin.d.ts +6 -0
- package/dist/types/v1/config/provider-options.d.ts +11 -0
- package/dist/types/v1/config/provider.d.ts +112 -0
- package/dist/types/v1/config/server.d.ts +10 -0
- package/dist/types/v1/config/skills.d.ts +7 -0
- package/dist/types/v1/permission.d.ts +27 -0
- package/dist/types/vcs/git.d.ts +12 -0
- package/dist/types/vcs/hg.d.ts +13 -0
- package/dist/types/vcs/patch.d.ts +21 -0
- package/dist/types/vcs.d.ts +17 -0
- package/dist/types/websearch.d.ts +66 -0
- package/dist/types/wellknown/plugin.d.ts +4 -0
- package/dist/types/wellknown.d.ts +106 -0
- package/dist/types/workspace/driver.d.ts +54 -0
- package/dist/types/workspace/sql.d.ts +89 -0
- package/dist/types/workspace.d.ts +44 -0
- package/dist/util/array.js +14 -0
- package/dist/util/binary.js +43 -0
- package/dist/util/encode.js +57 -0
- package/dist/util/error.js +7 -0
- package/dist/util/identifier.js +7 -0
- package/dist/util/iife.js +7 -0
- package/dist/util/lazy.js +7 -0
- package/dist/util/path.js +42 -0
- package/dist/util/process-lock-ffi.bun.js +53 -0
- package/dist/util/process-lock-ffi.node.js +46 -0
- package/dist/util/process-lock.js +124 -0
- package/dist/util/retry.js +38 -0
- package/dist/util/slug.js +7 -0
- package/dist/util/token.js +9 -0
- package/dist/util/which.js +7 -0
- package/dist/util/wildcard.js +9 -0
- package/dist/v1/config/agent.js +11 -0
- package/dist/v1/config/attachment.js +12 -0
- package/dist/v1/config/command.js +9 -0
- package/dist/v1/config/config.js +24 -0
- package/dist/v1/config/error.js +18 -0
- package/dist/v1/config/formatter.js +11 -0
- package/dist/v1/config/layout.js +9 -0
- package/dist/v1/config/lsp.js +17 -0
- package/dist/v1/config/mcp.js +16 -0
- package/dist/v1/config/migrate.js +38 -0
- package/dist/v1/config/permission.js +15 -0
- package/dist/v1/config/plugin.js +11 -0
- package/dist/v1/config/provider-options.js +11 -0
- package/dist/v1/config/provider.js +14 -0
- package/dist/v1/config/server.js +10 -0
- package/dist/v1/config/skills.js +9 -0
- package/dist/v1/permission.js +51 -0
- package/dist/vcs/git.js +10 -0
- package/dist/vcs/hg.js +10 -0
- package/dist/vcs/patch.js +27 -0
- package/dist/vcs.js +97 -0
- package/dist/websearch.js +111 -0
- package/dist/wellknown/plugin.js +89 -0
- package/dist/wellknown.js +104 -0
- package/dist/workspace/driver.js +23 -0
- package/dist/workspace/sql.js +7 -0
- package/dist/workspace.js +86 -0
- package/package.json +146 -0
|
@@ -0,0 +1,1467 @@
|
|
|
1
|
+
import {
|
|
2
|
+
mapOpenAIResponseFinishReason
|
|
3
|
+
} from "./permission-m8cbvarh.js";
|
|
4
|
+
import {
|
|
5
|
+
convertToOpenAIResponsesInput
|
|
6
|
+
} from "./permission-ryap75b3.js";
|
|
7
|
+
import {
|
|
8
|
+
openaiFailedResponseHandler
|
|
9
|
+
} from "./permission-r8f4w671.js";
|
|
10
|
+
import {
|
|
11
|
+
prepareResponsesTools
|
|
12
|
+
} from "./permission-hkcvyz4t.js";
|
|
13
|
+
|
|
14
|
+
// src/github-copilot/responses/openai-responses-language-model.ts
|
|
15
|
+
import {
|
|
16
|
+
APICallError
|
|
17
|
+
} from "@ai-sdk/provider";
|
|
18
|
+
import {
|
|
19
|
+
combineHeaders,
|
|
20
|
+
createEventSourceResponseHandler,
|
|
21
|
+
createJsonResponseHandler,
|
|
22
|
+
generateId,
|
|
23
|
+
parseProviderOptions,
|
|
24
|
+
postJsonToApi
|
|
25
|
+
} from "@ai-sdk/provider-utils";
|
|
26
|
+
import { z } from "zod/v4";
|
|
27
|
+
var webSearchCallItem = z.object({
|
|
28
|
+
type: z.literal("web_search_call"),
|
|
29
|
+
id: z.string(),
|
|
30
|
+
status: z.string(),
|
|
31
|
+
action: z.discriminatedUnion("type", [
|
|
32
|
+
z.object({
|
|
33
|
+
type: z.literal("search"),
|
|
34
|
+
query: z.string().nullish()
|
|
35
|
+
}),
|
|
36
|
+
z.object({
|
|
37
|
+
type: z.literal("open_page"),
|
|
38
|
+
url: z.string()
|
|
39
|
+
}),
|
|
40
|
+
z.object({
|
|
41
|
+
type: z.literal("find"),
|
|
42
|
+
url: z.string(),
|
|
43
|
+
pattern: z.string()
|
|
44
|
+
})
|
|
45
|
+
]).nullish()
|
|
46
|
+
});
|
|
47
|
+
var fileSearchCallItem = z.object({
|
|
48
|
+
type: z.literal("file_search_call"),
|
|
49
|
+
id: z.string(),
|
|
50
|
+
queries: z.array(z.string()),
|
|
51
|
+
results: z.array(z.object({
|
|
52
|
+
attributes: z.record(z.string(), z.unknown()),
|
|
53
|
+
file_id: z.string(),
|
|
54
|
+
filename: z.string(),
|
|
55
|
+
score: z.number(),
|
|
56
|
+
text: z.string()
|
|
57
|
+
})).nullish()
|
|
58
|
+
});
|
|
59
|
+
var codeInterpreterCallItem = z.object({
|
|
60
|
+
type: z.literal("code_interpreter_call"),
|
|
61
|
+
id: z.string(),
|
|
62
|
+
code: z.string().nullable(),
|
|
63
|
+
container_id: z.string(),
|
|
64
|
+
outputs: z.array(z.discriminatedUnion("type", [
|
|
65
|
+
z.object({ type: z.literal("logs"), logs: z.string() }),
|
|
66
|
+
z.object({ type: z.literal("image"), url: z.string() })
|
|
67
|
+
])).nullable()
|
|
68
|
+
});
|
|
69
|
+
var localShellCallItem = z.object({
|
|
70
|
+
type: z.literal("local_shell_call"),
|
|
71
|
+
id: z.string(),
|
|
72
|
+
call_id: z.string(),
|
|
73
|
+
action: z.object({
|
|
74
|
+
type: z.literal("exec"),
|
|
75
|
+
command: z.array(z.string()),
|
|
76
|
+
timeout_ms: z.number().optional(),
|
|
77
|
+
user: z.string().optional(),
|
|
78
|
+
working_directory: z.string().optional(),
|
|
79
|
+
env: z.record(z.string(), z.string()).optional()
|
|
80
|
+
})
|
|
81
|
+
});
|
|
82
|
+
var imageGenerationCallItem = z.object({
|
|
83
|
+
type: z.literal("image_generation_call"),
|
|
84
|
+
id: z.string(),
|
|
85
|
+
result: z.string()
|
|
86
|
+
});
|
|
87
|
+
var TOP_LOGPROBS_MAX = 20;
|
|
88
|
+
var LOGPROBS_SCHEMA = z.array(z.object({
|
|
89
|
+
token: z.string(),
|
|
90
|
+
logprob: z.number(),
|
|
91
|
+
top_logprobs: z.array(z.object({
|
|
92
|
+
token: z.string(),
|
|
93
|
+
logprob: z.number()
|
|
94
|
+
}))
|
|
95
|
+
}));
|
|
96
|
+
|
|
97
|
+
class OpenAIResponsesLanguageModel {
|
|
98
|
+
specificationVersion = "v3";
|
|
99
|
+
modelId;
|
|
100
|
+
config;
|
|
101
|
+
constructor(modelId, config) {
|
|
102
|
+
this.modelId = modelId;
|
|
103
|
+
this.config = config;
|
|
104
|
+
}
|
|
105
|
+
supportedUrls = {
|
|
106
|
+
"image/*": [/^https?:\/\/.*$/],
|
|
107
|
+
"application/pdf": [/^https?:\/\/.*$/]
|
|
108
|
+
};
|
|
109
|
+
get provider() {
|
|
110
|
+
return this.config.provider;
|
|
111
|
+
}
|
|
112
|
+
async getArgs({
|
|
113
|
+
maxOutputTokens,
|
|
114
|
+
temperature,
|
|
115
|
+
stopSequences,
|
|
116
|
+
topP,
|
|
117
|
+
topK,
|
|
118
|
+
presencePenalty,
|
|
119
|
+
frequencyPenalty,
|
|
120
|
+
seed,
|
|
121
|
+
prompt,
|
|
122
|
+
providerOptions,
|
|
123
|
+
tools,
|
|
124
|
+
toolChoice,
|
|
125
|
+
responseFormat
|
|
126
|
+
}) {
|
|
127
|
+
const warnings = [];
|
|
128
|
+
const modelConfig = getResponsesModelConfig(this.modelId);
|
|
129
|
+
if (topK != null) {
|
|
130
|
+
warnings.push({ type: "unsupported", feature: "topK" });
|
|
131
|
+
}
|
|
132
|
+
if (seed != null) {
|
|
133
|
+
warnings.push({ type: "unsupported", feature: "seed" });
|
|
134
|
+
}
|
|
135
|
+
if (presencePenalty != null) {
|
|
136
|
+
warnings.push({
|
|
137
|
+
type: "unsupported",
|
|
138
|
+
feature: "presencePenalty"
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
if (frequencyPenalty != null) {
|
|
142
|
+
warnings.push({
|
|
143
|
+
type: "unsupported",
|
|
144
|
+
feature: "frequencyPenalty"
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
if (stopSequences != null) {
|
|
148
|
+
warnings.push({ type: "unsupported", feature: "stopSequences" });
|
|
149
|
+
}
|
|
150
|
+
const openaiOptions = await parseProviderOptions({
|
|
151
|
+
provider: "copilot",
|
|
152
|
+
providerOptions,
|
|
153
|
+
schema: openaiResponsesProviderOptionsSchema
|
|
154
|
+
});
|
|
155
|
+
const store = openaiOptions?.store ?? false;
|
|
156
|
+
const { input, warnings: inputWarnings } = await convertToOpenAIResponsesInput({
|
|
157
|
+
prompt,
|
|
158
|
+
systemMessageMode: modelConfig.systemMessageMode,
|
|
159
|
+
fileIdPrefixes: this.config.fileIdPrefixes,
|
|
160
|
+
store,
|
|
161
|
+
hasLocalShellTool: hasOpenAITool("openai.local_shell")
|
|
162
|
+
});
|
|
163
|
+
warnings.push(...inputWarnings);
|
|
164
|
+
const strictJsonSchema = openaiOptions?.strictJsonSchema ?? false;
|
|
165
|
+
let include = openaiOptions?.include;
|
|
166
|
+
function addInclude(key) {
|
|
167
|
+
if (include?.includes(key))
|
|
168
|
+
return;
|
|
169
|
+
include = include != null ? [...include, key] : [key];
|
|
170
|
+
}
|
|
171
|
+
addInclude("reasoning.encrypted_content");
|
|
172
|
+
function hasOpenAITool(id) {
|
|
173
|
+
return tools?.find((tool) => tool.type === "provider" && tool.id === id) != null;
|
|
174
|
+
}
|
|
175
|
+
const topLogprobs = typeof openaiOptions?.logprobs === "number" ? openaiOptions?.logprobs : openaiOptions?.logprobs === true ? TOP_LOGPROBS_MAX : undefined;
|
|
176
|
+
if (topLogprobs) {
|
|
177
|
+
addInclude("message.output_text.logprobs");
|
|
178
|
+
}
|
|
179
|
+
const webSearchToolName = tools?.find((tool) => tool.type === "provider" && (tool.id === "openai.web_search" || tool.id === "openai.web_search_preview"))?.name;
|
|
180
|
+
if (webSearchToolName) {
|
|
181
|
+
addInclude("web_search_call.action.sources");
|
|
182
|
+
}
|
|
183
|
+
if (hasOpenAITool("openai.code_interpreter")) {
|
|
184
|
+
addInclude("code_interpreter_call.outputs");
|
|
185
|
+
}
|
|
186
|
+
const baseArgs = {
|
|
187
|
+
model: this.modelId,
|
|
188
|
+
input,
|
|
189
|
+
temperature,
|
|
190
|
+
top_p: topP,
|
|
191
|
+
max_output_tokens: maxOutputTokens,
|
|
192
|
+
...(responseFormat?.type === "json" || openaiOptions?.textVerbosity) && {
|
|
193
|
+
text: {
|
|
194
|
+
...responseFormat?.type === "json" && {
|
|
195
|
+
format: responseFormat.schema != null ? {
|
|
196
|
+
type: "json_schema",
|
|
197
|
+
strict: strictJsonSchema,
|
|
198
|
+
name: responseFormat.name ?? "response",
|
|
199
|
+
description: responseFormat.description,
|
|
200
|
+
schema: responseFormat.schema
|
|
201
|
+
} : { type: "json_object" }
|
|
202
|
+
},
|
|
203
|
+
...openaiOptions?.textVerbosity && {
|
|
204
|
+
verbosity: openaiOptions.textVerbosity
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
},
|
|
208
|
+
max_tool_calls: openaiOptions?.maxToolCalls,
|
|
209
|
+
metadata: openaiOptions?.metadata,
|
|
210
|
+
parallel_tool_calls: openaiOptions?.parallelToolCalls,
|
|
211
|
+
previous_response_id: openaiOptions?.previousResponseId,
|
|
212
|
+
store,
|
|
213
|
+
user: openaiOptions?.user,
|
|
214
|
+
instructions: openaiOptions?.instructions,
|
|
215
|
+
service_tier: openaiOptions?.serviceTier,
|
|
216
|
+
include,
|
|
217
|
+
prompt_cache_key: openaiOptions?.promptCacheKey,
|
|
218
|
+
safety_identifier: openaiOptions?.safetyIdentifier,
|
|
219
|
+
top_logprobs: topLogprobs,
|
|
220
|
+
...modelConfig.isReasoningModel && (openaiOptions?.reasoningEffort != null || openaiOptions?.reasoningSummary != null) && {
|
|
221
|
+
reasoning: {
|
|
222
|
+
...openaiOptions?.reasoningEffort != null && {
|
|
223
|
+
effort: openaiOptions.reasoningEffort
|
|
224
|
+
},
|
|
225
|
+
...openaiOptions?.reasoningSummary != null && {
|
|
226
|
+
summary: openaiOptions.reasoningSummary
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
},
|
|
230
|
+
...modelConfig.requiredAutoTruncation && {
|
|
231
|
+
truncation: "auto"
|
|
232
|
+
}
|
|
233
|
+
};
|
|
234
|
+
if (modelConfig.isReasoningModel) {
|
|
235
|
+
if (baseArgs.temperature != null) {
|
|
236
|
+
baseArgs.temperature = undefined;
|
|
237
|
+
warnings.push({
|
|
238
|
+
type: "unsupported",
|
|
239
|
+
feature: "temperature",
|
|
240
|
+
details: "temperature is not supported for reasoning models"
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
if (baseArgs.top_p != null) {
|
|
244
|
+
baseArgs.top_p = undefined;
|
|
245
|
+
warnings.push({
|
|
246
|
+
type: "unsupported",
|
|
247
|
+
feature: "topP",
|
|
248
|
+
details: "topP is not supported for reasoning models"
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
} else {
|
|
252
|
+
if (openaiOptions?.reasoningEffort != null) {
|
|
253
|
+
warnings.push({
|
|
254
|
+
type: "unsupported",
|
|
255
|
+
feature: "reasoningEffort",
|
|
256
|
+
details: "reasoningEffort is not supported for non-reasoning models"
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
if (openaiOptions?.reasoningSummary != null) {
|
|
260
|
+
warnings.push({
|
|
261
|
+
type: "unsupported",
|
|
262
|
+
feature: "reasoningSummary",
|
|
263
|
+
details: "reasoningSummary is not supported for non-reasoning models"
|
|
264
|
+
});
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
if (openaiOptions?.serviceTier === "flex" && !modelConfig.supportsFlexProcessing) {
|
|
268
|
+
warnings.push({
|
|
269
|
+
type: "unsupported",
|
|
270
|
+
feature: "serviceTier",
|
|
271
|
+
details: "flex processing is only available for o3, o4-mini, and gpt-5 models"
|
|
272
|
+
});
|
|
273
|
+
baseArgs.service_tier = undefined;
|
|
274
|
+
}
|
|
275
|
+
if (openaiOptions?.serviceTier === "priority" && !modelConfig.supportsPriorityProcessing) {
|
|
276
|
+
warnings.push({
|
|
277
|
+
type: "unsupported",
|
|
278
|
+
feature: "serviceTier",
|
|
279
|
+
details: "priority processing is only available for supported models (gpt-4, gpt-5, gpt-5-mini, o3, o4-mini) and requires Enterprise access. gpt-5-nano is not supported"
|
|
280
|
+
});
|
|
281
|
+
baseArgs.service_tier = undefined;
|
|
282
|
+
}
|
|
283
|
+
const {
|
|
284
|
+
tools: openaiTools,
|
|
285
|
+
toolChoice: openaiToolChoice,
|
|
286
|
+
toolWarnings
|
|
287
|
+
} = prepareResponsesTools({
|
|
288
|
+
tools,
|
|
289
|
+
toolChoice,
|
|
290
|
+
strictJsonSchema
|
|
291
|
+
});
|
|
292
|
+
return {
|
|
293
|
+
webSearchToolName,
|
|
294
|
+
args: {
|
|
295
|
+
...baseArgs,
|
|
296
|
+
tools: openaiTools,
|
|
297
|
+
tool_choice: openaiToolChoice
|
|
298
|
+
},
|
|
299
|
+
warnings: [...warnings, ...toolWarnings]
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
async doGenerate(options) {
|
|
303
|
+
const { args: body, warnings, webSearchToolName } = await this.getArgs(options);
|
|
304
|
+
const url = this.config.url({
|
|
305
|
+
path: "/responses",
|
|
306
|
+
modelId: this.modelId
|
|
307
|
+
});
|
|
308
|
+
const {
|
|
309
|
+
responseHeaders,
|
|
310
|
+
value: response,
|
|
311
|
+
rawValue: rawResponse
|
|
312
|
+
} = await postJsonToApi({
|
|
313
|
+
url,
|
|
314
|
+
headers: combineHeaders(this.config.headers(), options.headers),
|
|
315
|
+
body,
|
|
316
|
+
failedResponseHandler: openaiFailedResponseHandler,
|
|
317
|
+
successfulResponseHandler: createJsonResponseHandler(z.object({
|
|
318
|
+
id: z.string(),
|
|
319
|
+
created_at: z.number(),
|
|
320
|
+
error: z.object({
|
|
321
|
+
code: z.string(),
|
|
322
|
+
message: z.string()
|
|
323
|
+
}).nullish(),
|
|
324
|
+
model: z.string(),
|
|
325
|
+
output: z.array(z.discriminatedUnion("type", [
|
|
326
|
+
z.object({
|
|
327
|
+
type: z.literal("message"),
|
|
328
|
+
role: z.literal("assistant"),
|
|
329
|
+
id: z.string(),
|
|
330
|
+
content: z.array(z.object({
|
|
331
|
+
type: z.literal("output_text"),
|
|
332
|
+
text: z.string(),
|
|
333
|
+
logprobs: LOGPROBS_SCHEMA.nullish(),
|
|
334
|
+
annotations: z.array(z.discriminatedUnion("type", [
|
|
335
|
+
z.object({
|
|
336
|
+
type: z.literal("url_citation"),
|
|
337
|
+
start_index: z.number(),
|
|
338
|
+
end_index: z.number(),
|
|
339
|
+
url: z.string(),
|
|
340
|
+
title: z.string()
|
|
341
|
+
}),
|
|
342
|
+
z.object({
|
|
343
|
+
type: z.literal("file_citation"),
|
|
344
|
+
file_id: z.string(),
|
|
345
|
+
filename: z.string().nullish(),
|
|
346
|
+
index: z.number().nullish(),
|
|
347
|
+
start_index: z.number().nullish(),
|
|
348
|
+
end_index: z.number().nullish(),
|
|
349
|
+
quote: z.string().nullish()
|
|
350
|
+
}),
|
|
351
|
+
z.object({
|
|
352
|
+
type: z.literal("container_file_citation")
|
|
353
|
+
})
|
|
354
|
+
]))
|
|
355
|
+
}))
|
|
356
|
+
}),
|
|
357
|
+
webSearchCallItem,
|
|
358
|
+
fileSearchCallItem,
|
|
359
|
+
codeInterpreterCallItem,
|
|
360
|
+
imageGenerationCallItem,
|
|
361
|
+
localShellCallItem,
|
|
362
|
+
z.object({
|
|
363
|
+
type: z.literal("function_call"),
|
|
364
|
+
call_id: z.string(),
|
|
365
|
+
name: z.string(),
|
|
366
|
+
arguments: z.string(),
|
|
367
|
+
id: z.string()
|
|
368
|
+
}),
|
|
369
|
+
z.object({
|
|
370
|
+
type: z.literal("computer_call"),
|
|
371
|
+
id: z.string(),
|
|
372
|
+
status: z.string().optional()
|
|
373
|
+
}),
|
|
374
|
+
z.object({
|
|
375
|
+
type: z.literal("reasoning"),
|
|
376
|
+
id: z.string(),
|
|
377
|
+
encrypted_content: z.string().nullish(),
|
|
378
|
+
summary: z.array(z.object({
|
|
379
|
+
type: z.literal("summary_text"),
|
|
380
|
+
text: z.string()
|
|
381
|
+
}))
|
|
382
|
+
})
|
|
383
|
+
])),
|
|
384
|
+
service_tier: z.string().nullish(),
|
|
385
|
+
incomplete_details: z.object({ reason: z.string() }).nullish(),
|
|
386
|
+
usage: usageSchema
|
|
387
|
+
})),
|
|
388
|
+
abortSignal: options.abortSignal,
|
|
389
|
+
fetch: this.config.fetch
|
|
390
|
+
});
|
|
391
|
+
if (response.error) {
|
|
392
|
+
throw new APICallError({
|
|
393
|
+
message: response.error.message,
|
|
394
|
+
url,
|
|
395
|
+
requestBodyValues: body,
|
|
396
|
+
statusCode: 400,
|
|
397
|
+
responseHeaders,
|
|
398
|
+
responseBody: rawResponse,
|
|
399
|
+
isRetryable: false
|
|
400
|
+
});
|
|
401
|
+
}
|
|
402
|
+
const content = [];
|
|
403
|
+
const logprobs = [];
|
|
404
|
+
let hasFunctionCall = false;
|
|
405
|
+
for (const part of response.output) {
|
|
406
|
+
switch (part.type) {
|
|
407
|
+
case "reasoning": {
|
|
408
|
+
if (part.summary.length === 0) {
|
|
409
|
+
part.summary.push({ type: "summary_text", text: "" });
|
|
410
|
+
}
|
|
411
|
+
for (const summary of part.summary) {
|
|
412
|
+
content.push({
|
|
413
|
+
type: "reasoning",
|
|
414
|
+
text: summary.text,
|
|
415
|
+
providerMetadata: {
|
|
416
|
+
copilot: {
|
|
417
|
+
itemId: part.id,
|
|
418
|
+
reasoningEncryptedContent: part.encrypted_content ?? null
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
});
|
|
422
|
+
}
|
|
423
|
+
break;
|
|
424
|
+
}
|
|
425
|
+
case "image_generation_call": {
|
|
426
|
+
content.push({
|
|
427
|
+
type: "tool-call",
|
|
428
|
+
toolCallId: part.id,
|
|
429
|
+
toolName: "image_generation",
|
|
430
|
+
input: "{}",
|
|
431
|
+
providerExecuted: true
|
|
432
|
+
});
|
|
433
|
+
content.push({
|
|
434
|
+
type: "tool-result",
|
|
435
|
+
toolCallId: part.id,
|
|
436
|
+
toolName: "image_generation",
|
|
437
|
+
result: {
|
|
438
|
+
result: part.result
|
|
439
|
+
}
|
|
440
|
+
});
|
|
441
|
+
break;
|
|
442
|
+
}
|
|
443
|
+
case "local_shell_call": {
|
|
444
|
+
content.push({
|
|
445
|
+
type: "tool-call",
|
|
446
|
+
toolCallId: part.call_id,
|
|
447
|
+
toolName: "local_shell",
|
|
448
|
+
input: JSON.stringify({ action: part.action }),
|
|
449
|
+
providerMetadata: {
|
|
450
|
+
copilot: {
|
|
451
|
+
itemId: part.id
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
});
|
|
455
|
+
break;
|
|
456
|
+
}
|
|
457
|
+
case "message": {
|
|
458
|
+
for (const contentPart of part.content) {
|
|
459
|
+
if (options.providerOptions?.copilot?.logprobs && contentPart.logprobs) {
|
|
460
|
+
logprobs.push(contentPart.logprobs);
|
|
461
|
+
}
|
|
462
|
+
content.push({
|
|
463
|
+
type: "text",
|
|
464
|
+
text: contentPart.text,
|
|
465
|
+
providerMetadata: {
|
|
466
|
+
copilot: {
|
|
467
|
+
itemId: part.id
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
});
|
|
471
|
+
for (const annotation of contentPart.annotations) {
|
|
472
|
+
if (annotation.type === "url_citation") {
|
|
473
|
+
content.push({
|
|
474
|
+
type: "source",
|
|
475
|
+
sourceType: "url",
|
|
476
|
+
id: this.config.generateId?.() ?? generateId(),
|
|
477
|
+
url: annotation.url,
|
|
478
|
+
title: annotation.title
|
|
479
|
+
});
|
|
480
|
+
} else if (annotation.type === "file_citation") {
|
|
481
|
+
content.push({
|
|
482
|
+
type: "source",
|
|
483
|
+
sourceType: "document",
|
|
484
|
+
id: this.config.generateId?.() ?? generateId(),
|
|
485
|
+
mediaType: "text/plain",
|
|
486
|
+
title: annotation.quote ?? annotation.filename ?? "Document",
|
|
487
|
+
filename: annotation.filename ?? annotation.file_id
|
|
488
|
+
});
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
break;
|
|
493
|
+
}
|
|
494
|
+
case "function_call": {
|
|
495
|
+
hasFunctionCall = true;
|
|
496
|
+
content.push({
|
|
497
|
+
type: "tool-call",
|
|
498
|
+
toolCallId: part.call_id,
|
|
499
|
+
toolName: part.name,
|
|
500
|
+
input: part.arguments,
|
|
501
|
+
providerMetadata: {
|
|
502
|
+
copilot: {
|
|
503
|
+
itemId: part.id
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
});
|
|
507
|
+
break;
|
|
508
|
+
}
|
|
509
|
+
case "web_search_call": {
|
|
510
|
+
content.push({
|
|
511
|
+
type: "tool-call",
|
|
512
|
+
toolCallId: part.id,
|
|
513
|
+
toolName: webSearchToolName ?? "web_search",
|
|
514
|
+
input: JSON.stringify({ action: part.action }),
|
|
515
|
+
providerExecuted: true
|
|
516
|
+
});
|
|
517
|
+
content.push({
|
|
518
|
+
type: "tool-result",
|
|
519
|
+
toolCallId: part.id,
|
|
520
|
+
toolName: webSearchToolName ?? "web_search",
|
|
521
|
+
result: { status: part.status }
|
|
522
|
+
});
|
|
523
|
+
break;
|
|
524
|
+
}
|
|
525
|
+
case "computer_call": {
|
|
526
|
+
content.push({
|
|
527
|
+
type: "tool-call",
|
|
528
|
+
toolCallId: part.id,
|
|
529
|
+
toolName: "computer_use",
|
|
530
|
+
input: "",
|
|
531
|
+
providerExecuted: true
|
|
532
|
+
});
|
|
533
|
+
content.push({
|
|
534
|
+
type: "tool-result",
|
|
535
|
+
toolCallId: part.id,
|
|
536
|
+
toolName: "computer_use",
|
|
537
|
+
result: {
|
|
538
|
+
type: "computer_use_tool_result",
|
|
539
|
+
status: part.status || "completed"
|
|
540
|
+
}
|
|
541
|
+
});
|
|
542
|
+
break;
|
|
543
|
+
}
|
|
544
|
+
case "file_search_call": {
|
|
545
|
+
content.push({
|
|
546
|
+
type: "tool-call",
|
|
547
|
+
toolCallId: part.id,
|
|
548
|
+
toolName: "file_search",
|
|
549
|
+
input: "{}",
|
|
550
|
+
providerExecuted: true
|
|
551
|
+
});
|
|
552
|
+
content.push({
|
|
553
|
+
type: "tool-result",
|
|
554
|
+
toolCallId: part.id,
|
|
555
|
+
toolName: "file_search",
|
|
556
|
+
result: {
|
|
557
|
+
queries: part.queries,
|
|
558
|
+
results: part.results?.map((result) => ({
|
|
559
|
+
attributes: result.attributes,
|
|
560
|
+
fileId: result.file_id,
|
|
561
|
+
filename: result.filename,
|
|
562
|
+
score: result.score,
|
|
563
|
+
text: result.text
|
|
564
|
+
})) ?? null
|
|
565
|
+
}
|
|
566
|
+
});
|
|
567
|
+
break;
|
|
568
|
+
}
|
|
569
|
+
case "code_interpreter_call": {
|
|
570
|
+
content.push({
|
|
571
|
+
type: "tool-call",
|
|
572
|
+
toolCallId: part.id,
|
|
573
|
+
toolName: "code_interpreter",
|
|
574
|
+
input: JSON.stringify({
|
|
575
|
+
code: part.code,
|
|
576
|
+
containerId: part.container_id
|
|
577
|
+
}),
|
|
578
|
+
providerExecuted: true
|
|
579
|
+
});
|
|
580
|
+
content.push({
|
|
581
|
+
type: "tool-result",
|
|
582
|
+
toolCallId: part.id,
|
|
583
|
+
toolName: "code_interpreter",
|
|
584
|
+
result: {
|
|
585
|
+
outputs: part.outputs
|
|
586
|
+
}
|
|
587
|
+
});
|
|
588
|
+
break;
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
const providerMetadata = {
|
|
593
|
+
copilot: { responseId: response.id }
|
|
594
|
+
};
|
|
595
|
+
if (logprobs.length > 0) {
|
|
596
|
+
providerMetadata.copilot.logprobs = logprobs;
|
|
597
|
+
}
|
|
598
|
+
if (typeof response.service_tier === "string") {
|
|
599
|
+
providerMetadata.copilot.serviceTier = response.service_tier;
|
|
600
|
+
}
|
|
601
|
+
return {
|
|
602
|
+
content,
|
|
603
|
+
finishReason: {
|
|
604
|
+
unified: mapOpenAIResponseFinishReason({
|
|
605
|
+
finishReason: response.incomplete_details?.reason,
|
|
606
|
+
hasFunctionCall
|
|
607
|
+
}),
|
|
608
|
+
raw: response.incomplete_details?.reason
|
|
609
|
+
},
|
|
610
|
+
usage: {
|
|
611
|
+
inputTokens: {
|
|
612
|
+
total: response.usage.input_tokens,
|
|
613
|
+
noCache: response.usage.input_tokens_details?.cached_tokens != null ? response.usage.input_tokens - response.usage.input_tokens_details.cached_tokens : undefined,
|
|
614
|
+
cacheRead: response.usage.input_tokens_details?.cached_tokens ?? undefined,
|
|
615
|
+
cacheWrite: undefined
|
|
616
|
+
},
|
|
617
|
+
outputTokens: {
|
|
618
|
+
total: response.usage.output_tokens,
|
|
619
|
+
text: undefined,
|
|
620
|
+
reasoning: response.usage.output_tokens_details?.reasoning_tokens ?? undefined
|
|
621
|
+
},
|
|
622
|
+
raw: response.usage
|
|
623
|
+
},
|
|
624
|
+
request: { body },
|
|
625
|
+
response: {
|
|
626
|
+
id: response.id,
|
|
627
|
+
timestamp: new Date(response.created_at * 1000),
|
|
628
|
+
modelId: response.model,
|
|
629
|
+
headers: responseHeaders,
|
|
630
|
+
body: rawResponse
|
|
631
|
+
},
|
|
632
|
+
providerMetadata,
|
|
633
|
+
warnings
|
|
634
|
+
};
|
|
635
|
+
}
|
|
636
|
+
async doStream(options) {
|
|
637
|
+
const { args: body, warnings, webSearchToolName } = await this.getArgs(options);
|
|
638
|
+
const { responseHeaders, value: response } = await postJsonToApi({
|
|
639
|
+
url: this.config.url({
|
|
640
|
+
path: "/responses",
|
|
641
|
+
modelId: this.modelId
|
|
642
|
+
}),
|
|
643
|
+
headers: combineHeaders(this.config.headers(), options.headers),
|
|
644
|
+
body: {
|
|
645
|
+
...body,
|
|
646
|
+
stream: true
|
|
647
|
+
},
|
|
648
|
+
failedResponseHandler: openaiFailedResponseHandler,
|
|
649
|
+
successfulResponseHandler: createEventSourceResponseHandler(openaiResponsesChunkSchema),
|
|
650
|
+
abortSignal: options.abortSignal,
|
|
651
|
+
fetch: this.config.fetch
|
|
652
|
+
});
|
|
653
|
+
const self = this;
|
|
654
|
+
let finishReason = {
|
|
655
|
+
unified: "other",
|
|
656
|
+
raw: undefined
|
|
657
|
+
};
|
|
658
|
+
const usage = {
|
|
659
|
+
inputTokens: undefined,
|
|
660
|
+
outputTokens: undefined,
|
|
661
|
+
totalTokens: undefined,
|
|
662
|
+
reasoningTokens: undefined,
|
|
663
|
+
cachedInputTokens: undefined
|
|
664
|
+
};
|
|
665
|
+
const logprobs = [];
|
|
666
|
+
let responseId = null;
|
|
667
|
+
const ongoingToolCalls = {};
|
|
668
|
+
let hasFunctionCall = false;
|
|
669
|
+
const activeReasoning = {};
|
|
670
|
+
let currentReasoningOutputIndex = null;
|
|
671
|
+
let currentTextId = null;
|
|
672
|
+
let serviceTier;
|
|
673
|
+
return {
|
|
674
|
+
stream: response.pipeThrough(new TransformStream({
|
|
675
|
+
start(controller) {
|
|
676
|
+
controller.enqueue({ type: "stream-start", warnings });
|
|
677
|
+
},
|
|
678
|
+
transform(chunk, controller) {
|
|
679
|
+
if (options.includeRawChunks) {
|
|
680
|
+
controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
|
|
681
|
+
}
|
|
682
|
+
if (!chunk.success) {
|
|
683
|
+
finishReason = {
|
|
684
|
+
unified: "error",
|
|
685
|
+
raw: undefined
|
|
686
|
+
};
|
|
687
|
+
controller.enqueue({ type: "error", error: chunk.error });
|
|
688
|
+
return;
|
|
689
|
+
}
|
|
690
|
+
const value = chunk.value;
|
|
691
|
+
if (isResponseOutputItemAddedChunk(value)) {
|
|
692
|
+
if (value.item.type === "function_call") {
|
|
693
|
+
ongoingToolCalls[value.output_index] = {
|
|
694
|
+
toolName: value.item.name,
|
|
695
|
+
toolCallId: value.item.call_id
|
|
696
|
+
};
|
|
697
|
+
controller.enqueue({
|
|
698
|
+
type: "tool-input-start",
|
|
699
|
+
id: value.item.call_id,
|
|
700
|
+
toolName: value.item.name
|
|
701
|
+
});
|
|
702
|
+
} else if (value.item.type === "web_search_call") {
|
|
703
|
+
ongoingToolCalls[value.output_index] = {
|
|
704
|
+
toolName: webSearchToolName ?? "web_search",
|
|
705
|
+
toolCallId: value.item.id
|
|
706
|
+
};
|
|
707
|
+
controller.enqueue({
|
|
708
|
+
type: "tool-input-start",
|
|
709
|
+
id: value.item.id,
|
|
710
|
+
toolName: webSearchToolName ?? "web_search"
|
|
711
|
+
});
|
|
712
|
+
} else if (value.item.type === "computer_call") {
|
|
713
|
+
ongoingToolCalls[value.output_index] = {
|
|
714
|
+
toolName: "computer_use",
|
|
715
|
+
toolCallId: value.item.id
|
|
716
|
+
};
|
|
717
|
+
controller.enqueue({
|
|
718
|
+
type: "tool-input-start",
|
|
719
|
+
id: value.item.id,
|
|
720
|
+
toolName: "computer_use"
|
|
721
|
+
});
|
|
722
|
+
} else if (value.item.type === "code_interpreter_call") {
|
|
723
|
+
ongoingToolCalls[value.output_index] = {
|
|
724
|
+
toolName: "code_interpreter",
|
|
725
|
+
toolCallId: value.item.id,
|
|
726
|
+
codeInterpreter: {
|
|
727
|
+
containerId: value.item.container_id
|
|
728
|
+
}
|
|
729
|
+
};
|
|
730
|
+
controller.enqueue({
|
|
731
|
+
type: "tool-input-start",
|
|
732
|
+
id: value.item.id,
|
|
733
|
+
toolName: "code_interpreter"
|
|
734
|
+
});
|
|
735
|
+
controller.enqueue({
|
|
736
|
+
type: "tool-input-delta",
|
|
737
|
+
id: value.item.id,
|
|
738
|
+
delta: `{"containerId":"${value.item.container_id}","code":"`
|
|
739
|
+
});
|
|
740
|
+
} else if (value.item.type === "file_search_call") {
|
|
741
|
+
controller.enqueue({
|
|
742
|
+
type: "tool-call",
|
|
743
|
+
toolCallId: value.item.id,
|
|
744
|
+
toolName: "file_search",
|
|
745
|
+
input: "{}",
|
|
746
|
+
providerExecuted: true
|
|
747
|
+
});
|
|
748
|
+
} else if (value.item.type === "image_generation_call") {
|
|
749
|
+
controller.enqueue({
|
|
750
|
+
type: "tool-call",
|
|
751
|
+
toolCallId: value.item.id,
|
|
752
|
+
toolName: "image_generation",
|
|
753
|
+
input: "{}",
|
|
754
|
+
providerExecuted: true
|
|
755
|
+
});
|
|
756
|
+
} else if (value.item.type === "message") {
|
|
757
|
+
currentTextId = value.item.id;
|
|
758
|
+
controller.enqueue({
|
|
759
|
+
type: "text-start",
|
|
760
|
+
id: value.item.id,
|
|
761
|
+
providerMetadata: {
|
|
762
|
+
copilot: {
|
|
763
|
+
itemId: value.item.id
|
|
764
|
+
}
|
|
765
|
+
}
|
|
766
|
+
});
|
|
767
|
+
} else if (isResponseOutputItemAddedReasoningChunk(value)) {
|
|
768
|
+
if (activeReasoning[value.output_index]) {
|
|
769
|
+
currentReasoningOutputIndex = value.output_index;
|
|
770
|
+
return;
|
|
771
|
+
}
|
|
772
|
+
activeReasoning[value.output_index] = {
|
|
773
|
+
canonicalId: value.item.id,
|
|
774
|
+
encryptedContent: value.item.encrypted_content,
|
|
775
|
+
summaryParts: { 0: "active" }
|
|
776
|
+
};
|
|
777
|
+
currentReasoningOutputIndex = value.output_index;
|
|
778
|
+
controller.enqueue({
|
|
779
|
+
type: "reasoning-start",
|
|
780
|
+
id: `${value.item.id}:0`,
|
|
781
|
+
providerMetadata: {
|
|
782
|
+
copilot: {
|
|
783
|
+
itemId: value.item.id,
|
|
784
|
+
reasoningEncryptedContent: value.item.encrypted_content ?? null
|
|
785
|
+
}
|
|
786
|
+
}
|
|
787
|
+
});
|
|
788
|
+
}
|
|
789
|
+
} else if (isResponseOutputItemDoneChunk(value)) {
|
|
790
|
+
if (value.item.type === "function_call") {
|
|
791
|
+
ongoingToolCalls[value.output_index] = undefined;
|
|
792
|
+
hasFunctionCall = true;
|
|
793
|
+
controller.enqueue({
|
|
794
|
+
type: "tool-input-end",
|
|
795
|
+
id: value.item.call_id
|
|
796
|
+
});
|
|
797
|
+
controller.enqueue({
|
|
798
|
+
type: "tool-call",
|
|
799
|
+
toolCallId: value.item.call_id,
|
|
800
|
+
toolName: value.item.name,
|
|
801
|
+
input: value.item.arguments,
|
|
802
|
+
providerMetadata: {
|
|
803
|
+
copilot: {
|
|
804
|
+
itemId: value.item.id
|
|
805
|
+
}
|
|
806
|
+
}
|
|
807
|
+
});
|
|
808
|
+
} else if (value.item.type === "web_search_call") {
|
|
809
|
+
ongoingToolCalls[value.output_index] = undefined;
|
|
810
|
+
controller.enqueue({
|
|
811
|
+
type: "tool-input-end",
|
|
812
|
+
id: value.item.id
|
|
813
|
+
});
|
|
814
|
+
controller.enqueue({
|
|
815
|
+
type: "tool-call",
|
|
816
|
+
toolCallId: value.item.id,
|
|
817
|
+
toolName: "web_search",
|
|
818
|
+
input: JSON.stringify({ action: value.item.action }),
|
|
819
|
+
providerExecuted: true
|
|
820
|
+
});
|
|
821
|
+
controller.enqueue({
|
|
822
|
+
type: "tool-result",
|
|
823
|
+
toolCallId: value.item.id,
|
|
824
|
+
toolName: "web_search",
|
|
825
|
+
result: { status: value.item.status }
|
|
826
|
+
});
|
|
827
|
+
} else if (value.item.type === "computer_call") {
|
|
828
|
+
ongoingToolCalls[value.output_index] = undefined;
|
|
829
|
+
controller.enqueue({
|
|
830
|
+
type: "tool-input-end",
|
|
831
|
+
id: value.item.id
|
|
832
|
+
});
|
|
833
|
+
controller.enqueue({
|
|
834
|
+
type: "tool-call",
|
|
835
|
+
toolCallId: value.item.id,
|
|
836
|
+
toolName: "computer_use",
|
|
837
|
+
input: "",
|
|
838
|
+
providerExecuted: true
|
|
839
|
+
});
|
|
840
|
+
controller.enqueue({
|
|
841
|
+
type: "tool-result",
|
|
842
|
+
toolCallId: value.item.id,
|
|
843
|
+
toolName: "computer_use",
|
|
844
|
+
result: {
|
|
845
|
+
type: "computer_use_tool_result",
|
|
846
|
+
status: value.item.status || "completed"
|
|
847
|
+
}
|
|
848
|
+
});
|
|
849
|
+
} else if (value.item.type === "file_search_call") {
|
|
850
|
+
ongoingToolCalls[value.output_index] = undefined;
|
|
851
|
+
controller.enqueue({
|
|
852
|
+
type: "tool-result",
|
|
853
|
+
toolCallId: value.item.id,
|
|
854
|
+
toolName: "file_search",
|
|
855
|
+
result: {
|
|
856
|
+
queries: value.item.queries,
|
|
857
|
+
results: value.item.results?.map((result) => ({
|
|
858
|
+
attributes: result.attributes,
|
|
859
|
+
fileId: result.file_id,
|
|
860
|
+
filename: result.filename,
|
|
861
|
+
score: result.score,
|
|
862
|
+
text: result.text
|
|
863
|
+
})) ?? null
|
|
864
|
+
}
|
|
865
|
+
});
|
|
866
|
+
} else if (value.item.type === "code_interpreter_call") {
|
|
867
|
+
ongoingToolCalls[value.output_index] = undefined;
|
|
868
|
+
controller.enqueue({
|
|
869
|
+
type: "tool-result",
|
|
870
|
+
toolCallId: value.item.id,
|
|
871
|
+
toolName: "code_interpreter",
|
|
872
|
+
result: {
|
|
873
|
+
outputs: value.item.outputs
|
|
874
|
+
}
|
|
875
|
+
});
|
|
876
|
+
} else if (value.item.type === "image_generation_call") {
|
|
877
|
+
controller.enqueue({
|
|
878
|
+
type: "tool-result",
|
|
879
|
+
toolCallId: value.item.id,
|
|
880
|
+
toolName: "image_generation",
|
|
881
|
+
result: {
|
|
882
|
+
result: value.item.result
|
|
883
|
+
}
|
|
884
|
+
});
|
|
885
|
+
} else if (value.item.type === "local_shell_call") {
|
|
886
|
+
ongoingToolCalls[value.output_index] = undefined;
|
|
887
|
+
controller.enqueue({
|
|
888
|
+
type: "tool-call",
|
|
889
|
+
toolCallId: value.item.call_id,
|
|
890
|
+
toolName: "local_shell",
|
|
891
|
+
input: JSON.stringify({
|
|
892
|
+
action: {
|
|
893
|
+
type: "exec",
|
|
894
|
+
command: value.item.action.command,
|
|
895
|
+
timeoutMs: value.item.action.timeout_ms,
|
|
896
|
+
user: value.item.action.user,
|
|
897
|
+
workingDirectory: value.item.action.working_directory,
|
|
898
|
+
env: value.item.action.env
|
|
899
|
+
}
|
|
900
|
+
}),
|
|
901
|
+
providerMetadata: {
|
|
902
|
+
copilot: { itemId: value.item.id }
|
|
903
|
+
}
|
|
904
|
+
});
|
|
905
|
+
} else if (value.item.type === "message") {
|
|
906
|
+
if (currentTextId) {
|
|
907
|
+
controller.enqueue({
|
|
908
|
+
type: "text-end",
|
|
909
|
+
id: currentTextId
|
|
910
|
+
});
|
|
911
|
+
currentTextId = null;
|
|
912
|
+
}
|
|
913
|
+
} else if (isResponseOutputItemDoneReasoningChunk(value)) {
|
|
914
|
+
const activeReasoningPart = activeReasoning[value.output_index];
|
|
915
|
+
if (activeReasoningPart) {
|
|
916
|
+
for (const [summaryIndex, status] of Object.entries(activeReasoningPart.summaryParts)) {
|
|
917
|
+
if (status === "concluded")
|
|
918
|
+
continue;
|
|
919
|
+
controller.enqueue({
|
|
920
|
+
type: "reasoning-end",
|
|
921
|
+
id: `${activeReasoningPart.canonicalId}:${summaryIndex}`,
|
|
922
|
+
providerMetadata: {
|
|
923
|
+
copilot: {
|
|
924
|
+
itemId: value.item.id,
|
|
925
|
+
reasoningEncryptedContent: value.item.encrypted_content ?? null
|
|
926
|
+
}
|
|
927
|
+
}
|
|
928
|
+
});
|
|
929
|
+
}
|
|
930
|
+
delete activeReasoning[value.output_index];
|
|
931
|
+
if (currentReasoningOutputIndex === value.output_index) {
|
|
932
|
+
currentReasoningOutputIndex = null;
|
|
933
|
+
}
|
|
934
|
+
}
|
|
935
|
+
}
|
|
936
|
+
} else if (isResponseFunctionCallArgumentsDeltaChunk(value)) {
|
|
937
|
+
const toolCall = ongoingToolCalls[value.output_index];
|
|
938
|
+
if (toolCall != null) {
|
|
939
|
+
controller.enqueue({
|
|
940
|
+
type: "tool-input-delta",
|
|
941
|
+
id: toolCall.toolCallId,
|
|
942
|
+
delta: value.delta
|
|
943
|
+
});
|
|
944
|
+
}
|
|
945
|
+
} else if (isResponseImageGenerationCallPartialImageChunk(value)) {
|
|
946
|
+
controller.enqueue({
|
|
947
|
+
type: "tool-result",
|
|
948
|
+
toolCallId: value.item_id,
|
|
949
|
+
toolName: "image_generation",
|
|
950
|
+
result: {
|
|
951
|
+
result: value.partial_image_b64
|
|
952
|
+
}
|
|
953
|
+
});
|
|
954
|
+
} else if (isResponseCodeInterpreterCallCodeDeltaChunk(value)) {
|
|
955
|
+
const toolCall = ongoingToolCalls[value.output_index];
|
|
956
|
+
if (toolCall != null) {
|
|
957
|
+
controller.enqueue({
|
|
958
|
+
type: "tool-input-delta",
|
|
959
|
+
id: toolCall.toolCallId,
|
|
960
|
+
delta: JSON.stringify(value.delta).slice(1, -1)
|
|
961
|
+
});
|
|
962
|
+
}
|
|
963
|
+
} else if (isResponseCodeInterpreterCallCodeDoneChunk(value)) {
|
|
964
|
+
const toolCall = ongoingToolCalls[value.output_index];
|
|
965
|
+
if (toolCall != null) {
|
|
966
|
+
controller.enqueue({
|
|
967
|
+
type: "tool-input-delta",
|
|
968
|
+
id: toolCall.toolCallId,
|
|
969
|
+
delta: '"}'
|
|
970
|
+
});
|
|
971
|
+
controller.enqueue({
|
|
972
|
+
type: "tool-input-end",
|
|
973
|
+
id: toolCall.toolCallId
|
|
974
|
+
});
|
|
975
|
+
controller.enqueue({
|
|
976
|
+
type: "tool-call",
|
|
977
|
+
toolCallId: toolCall.toolCallId,
|
|
978
|
+
toolName: "code_interpreter",
|
|
979
|
+
input: JSON.stringify({
|
|
980
|
+
code: value.code,
|
|
981
|
+
containerId: toolCall.codeInterpreter.containerId
|
|
982
|
+
}),
|
|
983
|
+
providerExecuted: true
|
|
984
|
+
});
|
|
985
|
+
}
|
|
986
|
+
} else if (isResponseCreatedChunk(value)) {
|
|
987
|
+
responseId = value.response.id;
|
|
988
|
+
controller.enqueue({
|
|
989
|
+
type: "response-metadata",
|
|
990
|
+
id: value.response.id,
|
|
991
|
+
timestamp: new Date(value.response.created_at * 1000),
|
|
992
|
+
modelId: value.response.model
|
|
993
|
+
});
|
|
994
|
+
} else if (isTextDeltaChunk(value)) {
|
|
995
|
+
if (!currentTextId) {
|
|
996
|
+
currentTextId = value.item_id;
|
|
997
|
+
controller.enqueue({
|
|
998
|
+
type: "text-start",
|
|
999
|
+
id: currentTextId,
|
|
1000
|
+
providerMetadata: {
|
|
1001
|
+
copilot: { itemId: value.item_id }
|
|
1002
|
+
}
|
|
1003
|
+
});
|
|
1004
|
+
}
|
|
1005
|
+
controller.enqueue({
|
|
1006
|
+
type: "text-delta",
|
|
1007
|
+
id: currentTextId,
|
|
1008
|
+
delta: value.delta
|
|
1009
|
+
});
|
|
1010
|
+
if (options.providerOptions?.copilot?.logprobs && value.logprobs) {
|
|
1011
|
+
logprobs.push(value.logprobs);
|
|
1012
|
+
}
|
|
1013
|
+
} else if (isResponseReasoningSummaryPartAddedChunk(value)) {
|
|
1014
|
+
const activeItem = currentReasoningOutputIndex !== null ? activeReasoning[currentReasoningOutputIndex] : null;
|
|
1015
|
+
if (activeItem && value.summary_index > 0 && activeItem.summaryParts[value.summary_index] === undefined) {
|
|
1016
|
+
for (const [summaryIndex, status] of Object.entries(activeItem.summaryParts)) {
|
|
1017
|
+
if (status !== "can-conclude")
|
|
1018
|
+
continue;
|
|
1019
|
+
controller.enqueue({
|
|
1020
|
+
type: "reasoning-end",
|
|
1021
|
+
id: `${activeItem.canonicalId}:${summaryIndex}`,
|
|
1022
|
+
providerMetadata: {
|
|
1023
|
+
copilot: { itemId: activeItem.canonicalId }
|
|
1024
|
+
}
|
|
1025
|
+
});
|
|
1026
|
+
activeItem.summaryParts[Number(summaryIndex)] = "concluded";
|
|
1027
|
+
}
|
|
1028
|
+
activeItem.summaryParts[value.summary_index] = "active";
|
|
1029
|
+
controller.enqueue({
|
|
1030
|
+
type: "reasoning-start",
|
|
1031
|
+
id: `${activeItem.canonicalId}:${value.summary_index}`,
|
|
1032
|
+
providerMetadata: {
|
|
1033
|
+
copilot: {
|
|
1034
|
+
itemId: activeItem.canonicalId,
|
|
1035
|
+
reasoningEncryptedContent: activeItem.encryptedContent ?? null
|
|
1036
|
+
}
|
|
1037
|
+
}
|
|
1038
|
+
});
|
|
1039
|
+
}
|
|
1040
|
+
} else if (isResponseReasoningSummaryPartDoneChunk(value)) {
|
|
1041
|
+
const activeItem = currentReasoningOutputIndex !== null ? activeReasoning[currentReasoningOutputIndex] : null;
|
|
1042
|
+
if (!activeItem || activeItem.summaryParts[value.summary_index] !== "active")
|
|
1043
|
+
return;
|
|
1044
|
+
if (body.store === false) {
|
|
1045
|
+
activeItem.summaryParts[value.summary_index] = "can-conclude";
|
|
1046
|
+
return;
|
|
1047
|
+
}
|
|
1048
|
+
controller.enqueue({
|
|
1049
|
+
type: "reasoning-end",
|
|
1050
|
+
id: `${activeItem.canonicalId}:${value.summary_index}`,
|
|
1051
|
+
providerMetadata: {
|
|
1052
|
+
copilot: { itemId: activeItem.canonicalId }
|
|
1053
|
+
}
|
|
1054
|
+
});
|
|
1055
|
+
activeItem.summaryParts[value.summary_index] = "concluded";
|
|
1056
|
+
} else if (isResponseReasoningSummaryTextDeltaChunk(value)) {
|
|
1057
|
+
const activeItem = currentReasoningOutputIndex !== null ? activeReasoning[currentReasoningOutputIndex] : null;
|
|
1058
|
+
if (activeItem) {
|
|
1059
|
+
controller.enqueue({
|
|
1060
|
+
type: "reasoning-delta",
|
|
1061
|
+
id: `${activeItem.canonicalId}:${value.summary_index}`,
|
|
1062
|
+
delta: value.delta,
|
|
1063
|
+
providerMetadata: {
|
|
1064
|
+
copilot: {
|
|
1065
|
+
itemId: activeItem.canonicalId
|
|
1066
|
+
}
|
|
1067
|
+
}
|
|
1068
|
+
});
|
|
1069
|
+
}
|
|
1070
|
+
} else if (isResponseFinishedChunk(value)) {
|
|
1071
|
+
finishReason = {
|
|
1072
|
+
unified: mapOpenAIResponseFinishReason({
|
|
1073
|
+
finishReason: value.response.incomplete_details?.reason,
|
|
1074
|
+
hasFunctionCall
|
|
1075
|
+
}),
|
|
1076
|
+
raw: value.response.incomplete_details?.reason ?? undefined
|
|
1077
|
+
};
|
|
1078
|
+
usage.inputTokens = value.response.usage.input_tokens;
|
|
1079
|
+
usage.outputTokens = value.response.usage.output_tokens;
|
|
1080
|
+
usage.totalTokens = value.response.usage.input_tokens + value.response.usage.output_tokens;
|
|
1081
|
+
usage.reasoningTokens = value.response.usage.output_tokens_details?.reasoning_tokens ?? undefined;
|
|
1082
|
+
usage.cachedInputTokens = value.response.usage.input_tokens_details?.cached_tokens ?? undefined;
|
|
1083
|
+
if (typeof value.response.service_tier === "string") {
|
|
1084
|
+
serviceTier = value.response.service_tier;
|
|
1085
|
+
}
|
|
1086
|
+
} else if (isResponseAnnotationAddedChunk(value)) {
|
|
1087
|
+
if (value.annotation.type === "url_citation") {
|
|
1088
|
+
controller.enqueue({
|
|
1089
|
+
type: "source",
|
|
1090
|
+
sourceType: "url",
|
|
1091
|
+
id: self.config.generateId?.() ?? generateId(),
|
|
1092
|
+
url: value.annotation.url,
|
|
1093
|
+
title: value.annotation.title
|
|
1094
|
+
});
|
|
1095
|
+
} else if (value.annotation.type === "file_citation") {
|
|
1096
|
+
controller.enqueue({
|
|
1097
|
+
type: "source",
|
|
1098
|
+
sourceType: "document",
|
|
1099
|
+
id: self.config.generateId?.() ?? generateId(),
|
|
1100
|
+
mediaType: "text/plain",
|
|
1101
|
+
title: value.annotation.quote ?? value.annotation.filename ?? "Document",
|
|
1102
|
+
filename: value.annotation.filename ?? value.annotation.file_id
|
|
1103
|
+
});
|
|
1104
|
+
}
|
|
1105
|
+
} else if (isErrorChunk(value)) {
|
|
1106
|
+
controller.enqueue({ type: "error", error: value });
|
|
1107
|
+
}
|
|
1108
|
+
},
|
|
1109
|
+
flush(controller) {
|
|
1110
|
+
if (currentTextId) {
|
|
1111
|
+
controller.enqueue({ type: "text-end", id: currentTextId });
|
|
1112
|
+
currentTextId = null;
|
|
1113
|
+
}
|
|
1114
|
+
for (const activeItem of Object.values(activeReasoning)) {
|
|
1115
|
+
for (const [summaryIndex, status] of Object.entries(activeItem.summaryParts)) {
|
|
1116
|
+
if (status === "concluded")
|
|
1117
|
+
continue;
|
|
1118
|
+
controller.enqueue({
|
|
1119
|
+
type: "reasoning-end",
|
|
1120
|
+
id: `${activeItem.canonicalId}:${summaryIndex}`,
|
|
1121
|
+
providerMetadata: { copilot: { itemId: activeItem.canonicalId } }
|
|
1122
|
+
});
|
|
1123
|
+
}
|
|
1124
|
+
}
|
|
1125
|
+
const providerMetadata = {
|
|
1126
|
+
copilot: {
|
|
1127
|
+
responseId
|
|
1128
|
+
}
|
|
1129
|
+
};
|
|
1130
|
+
if (logprobs.length > 0) {
|
|
1131
|
+
providerMetadata.copilot.logprobs = logprobs;
|
|
1132
|
+
}
|
|
1133
|
+
if (serviceTier !== undefined) {
|
|
1134
|
+
providerMetadata.copilot.serviceTier = serviceTier;
|
|
1135
|
+
}
|
|
1136
|
+
controller.enqueue({
|
|
1137
|
+
type: "finish",
|
|
1138
|
+
finishReason,
|
|
1139
|
+
usage: {
|
|
1140
|
+
inputTokens: {
|
|
1141
|
+
total: usage.inputTokens,
|
|
1142
|
+
noCache: usage.inputTokens != null && usage.cachedInputTokens != null ? usage.inputTokens - usage.cachedInputTokens : undefined,
|
|
1143
|
+
cacheRead: usage.cachedInputTokens,
|
|
1144
|
+
cacheWrite: undefined
|
|
1145
|
+
},
|
|
1146
|
+
outputTokens: {
|
|
1147
|
+
total: usage.outputTokens,
|
|
1148
|
+
text: undefined,
|
|
1149
|
+
reasoning: usage.reasoningTokens
|
|
1150
|
+
},
|
|
1151
|
+
raw: {
|
|
1152
|
+
input_tokens: usage.inputTokens,
|
|
1153
|
+
output_tokens: usage.outputTokens,
|
|
1154
|
+
total_tokens: usage.totalTokens
|
|
1155
|
+
}
|
|
1156
|
+
},
|
|
1157
|
+
providerMetadata
|
|
1158
|
+
});
|
|
1159
|
+
}
|
|
1160
|
+
})),
|
|
1161
|
+
request: { body },
|
|
1162
|
+
response: { headers: responseHeaders }
|
|
1163
|
+
};
|
|
1164
|
+
}
|
|
1165
|
+
}
|
|
1166
|
+
var usageSchema = z.object({
|
|
1167
|
+
input_tokens: z.number(),
|
|
1168
|
+
input_tokens_details: z.object({ cached_tokens: z.number().nullish() }).nullish(),
|
|
1169
|
+
output_tokens: z.number(),
|
|
1170
|
+
output_tokens_details: z.object({ reasoning_tokens: z.number().nullish() }).nullish()
|
|
1171
|
+
});
|
|
1172
|
+
var textDeltaChunkSchema = z.object({
|
|
1173
|
+
type: z.literal("response.output_text.delta"),
|
|
1174
|
+
item_id: z.string(),
|
|
1175
|
+
delta: z.string(),
|
|
1176
|
+
logprobs: LOGPROBS_SCHEMA.nullish()
|
|
1177
|
+
});
|
|
1178
|
+
var errorChunkSchema = z.object({
|
|
1179
|
+
type: z.literal("error"),
|
|
1180
|
+
code: z.string(),
|
|
1181
|
+
message: z.string(),
|
|
1182
|
+
param: z.string().nullish(),
|
|
1183
|
+
sequence_number: z.number()
|
|
1184
|
+
});
|
|
1185
|
+
var responseFinishedChunkSchema = z.object({
|
|
1186
|
+
type: z.enum(["response.completed", "response.incomplete"]),
|
|
1187
|
+
response: z.object({
|
|
1188
|
+
incomplete_details: z.object({ reason: z.string() }).nullish(),
|
|
1189
|
+
usage: usageSchema,
|
|
1190
|
+
service_tier: z.string().nullish()
|
|
1191
|
+
})
|
|
1192
|
+
});
|
|
1193
|
+
var responseCreatedChunkSchema = z.object({
|
|
1194
|
+
type: z.literal("response.created"),
|
|
1195
|
+
response: z.object({
|
|
1196
|
+
id: z.string(),
|
|
1197
|
+
created_at: z.number(),
|
|
1198
|
+
model: z.string(),
|
|
1199
|
+
service_tier: z.string().nullish()
|
|
1200
|
+
})
|
|
1201
|
+
});
|
|
1202
|
+
var responseOutputItemAddedSchema = z.object({
|
|
1203
|
+
type: z.literal("response.output_item.added"),
|
|
1204
|
+
output_index: z.number(),
|
|
1205
|
+
item: z.discriminatedUnion("type", [
|
|
1206
|
+
z.object({
|
|
1207
|
+
type: z.literal("message"),
|
|
1208
|
+
id: z.string()
|
|
1209
|
+
}),
|
|
1210
|
+
z.object({
|
|
1211
|
+
type: z.literal("reasoning"),
|
|
1212
|
+
id: z.string(),
|
|
1213
|
+
encrypted_content: z.string().nullish()
|
|
1214
|
+
}),
|
|
1215
|
+
z.object({
|
|
1216
|
+
type: z.literal("function_call"),
|
|
1217
|
+
id: z.string(),
|
|
1218
|
+
call_id: z.string(),
|
|
1219
|
+
name: z.string(),
|
|
1220
|
+
arguments: z.string()
|
|
1221
|
+
}),
|
|
1222
|
+
z.object({
|
|
1223
|
+
type: z.literal("web_search_call"),
|
|
1224
|
+
id: z.string(),
|
|
1225
|
+
status: z.string(),
|
|
1226
|
+
action: z.object({
|
|
1227
|
+
type: z.literal("search"),
|
|
1228
|
+
query: z.string().optional()
|
|
1229
|
+
}).nullish()
|
|
1230
|
+
}),
|
|
1231
|
+
z.object({
|
|
1232
|
+
type: z.literal("computer_call"),
|
|
1233
|
+
id: z.string(),
|
|
1234
|
+
status: z.string()
|
|
1235
|
+
}),
|
|
1236
|
+
z.object({
|
|
1237
|
+
type: z.literal("file_search_call"),
|
|
1238
|
+
id: z.string()
|
|
1239
|
+
}),
|
|
1240
|
+
z.object({
|
|
1241
|
+
type: z.literal("image_generation_call"),
|
|
1242
|
+
id: z.string()
|
|
1243
|
+
}),
|
|
1244
|
+
z.object({
|
|
1245
|
+
type: z.literal("code_interpreter_call"),
|
|
1246
|
+
id: z.string(),
|
|
1247
|
+
container_id: z.string(),
|
|
1248
|
+
code: z.string().nullable(),
|
|
1249
|
+
outputs: z.array(z.discriminatedUnion("type", [
|
|
1250
|
+
z.object({ type: z.literal("logs"), logs: z.string() }),
|
|
1251
|
+
z.object({ type: z.literal("image"), url: z.string() })
|
|
1252
|
+
])).nullable(),
|
|
1253
|
+
status: z.string()
|
|
1254
|
+
})
|
|
1255
|
+
])
|
|
1256
|
+
});
|
|
1257
|
+
var responseOutputItemDoneSchema = z.object({
|
|
1258
|
+
type: z.literal("response.output_item.done"),
|
|
1259
|
+
output_index: z.number(),
|
|
1260
|
+
item: z.discriminatedUnion("type", [
|
|
1261
|
+
z.object({
|
|
1262
|
+
type: z.literal("message"),
|
|
1263
|
+
id: z.string()
|
|
1264
|
+
}),
|
|
1265
|
+
z.object({
|
|
1266
|
+
type: z.literal("reasoning"),
|
|
1267
|
+
id: z.string(),
|
|
1268
|
+
encrypted_content: z.string().nullish()
|
|
1269
|
+
}),
|
|
1270
|
+
z.object({
|
|
1271
|
+
type: z.literal("function_call"),
|
|
1272
|
+
id: z.string(),
|
|
1273
|
+
call_id: z.string(),
|
|
1274
|
+
name: z.string(),
|
|
1275
|
+
arguments: z.string(),
|
|
1276
|
+
status: z.literal("completed")
|
|
1277
|
+
}),
|
|
1278
|
+
codeInterpreterCallItem,
|
|
1279
|
+
imageGenerationCallItem,
|
|
1280
|
+
webSearchCallItem,
|
|
1281
|
+
fileSearchCallItem,
|
|
1282
|
+
localShellCallItem,
|
|
1283
|
+
z.object({
|
|
1284
|
+
type: z.literal("computer_call"),
|
|
1285
|
+
id: z.string(),
|
|
1286
|
+
status: z.literal("completed")
|
|
1287
|
+
})
|
|
1288
|
+
])
|
|
1289
|
+
});
|
|
1290
|
+
var responseFunctionCallArgumentsDeltaSchema = z.object({
|
|
1291
|
+
type: z.literal("response.function_call_arguments.delta"),
|
|
1292
|
+
item_id: z.string(),
|
|
1293
|
+
output_index: z.number(),
|
|
1294
|
+
delta: z.string()
|
|
1295
|
+
});
|
|
1296
|
+
var responseImageGenerationCallPartialImageSchema = z.object({
|
|
1297
|
+
type: z.literal("response.image_generation_call.partial_image"),
|
|
1298
|
+
item_id: z.string(),
|
|
1299
|
+
output_index: z.number(),
|
|
1300
|
+
partial_image_b64: z.string()
|
|
1301
|
+
});
|
|
1302
|
+
var responseCodeInterpreterCallCodeDeltaSchema = z.object({
|
|
1303
|
+
type: z.literal("response.code_interpreter_call_code.delta"),
|
|
1304
|
+
item_id: z.string(),
|
|
1305
|
+
output_index: z.number(),
|
|
1306
|
+
delta: z.string()
|
|
1307
|
+
});
|
|
1308
|
+
var responseCodeInterpreterCallCodeDoneSchema = z.object({
|
|
1309
|
+
type: z.literal("response.code_interpreter_call_code.done"),
|
|
1310
|
+
item_id: z.string(),
|
|
1311
|
+
output_index: z.number(),
|
|
1312
|
+
code: z.string()
|
|
1313
|
+
});
|
|
1314
|
+
var responseAnnotationAddedSchema = z.object({
|
|
1315
|
+
type: z.literal("response.output_text.annotation.added"),
|
|
1316
|
+
annotation: z.discriminatedUnion("type", [
|
|
1317
|
+
z.object({
|
|
1318
|
+
type: z.literal("url_citation"),
|
|
1319
|
+
url: z.string(),
|
|
1320
|
+
title: z.string()
|
|
1321
|
+
}),
|
|
1322
|
+
z.object({
|
|
1323
|
+
type: z.literal("file_citation"),
|
|
1324
|
+
file_id: z.string(),
|
|
1325
|
+
filename: z.string().nullish(),
|
|
1326
|
+
index: z.number().nullish(),
|
|
1327
|
+
start_index: z.number().nullish(),
|
|
1328
|
+
end_index: z.number().nullish(),
|
|
1329
|
+
quote: z.string().nullish()
|
|
1330
|
+
})
|
|
1331
|
+
])
|
|
1332
|
+
});
|
|
1333
|
+
var responseReasoningSummaryPartAddedSchema = z.object({
|
|
1334
|
+
type: z.literal("response.reasoning_summary_part.added"),
|
|
1335
|
+
item_id: z.string(),
|
|
1336
|
+
summary_index: z.number()
|
|
1337
|
+
});
|
|
1338
|
+
var responseReasoningSummaryTextDeltaSchema = z.object({
|
|
1339
|
+
type: z.literal("response.reasoning_summary_text.delta"),
|
|
1340
|
+
item_id: z.string(),
|
|
1341
|
+
summary_index: z.number(),
|
|
1342
|
+
delta: z.string()
|
|
1343
|
+
});
|
|
1344
|
+
var responseReasoningSummaryPartDoneSchema = z.object({
|
|
1345
|
+
type: z.literal("response.reasoning_summary_part.done"),
|
|
1346
|
+
item_id: z.string(),
|
|
1347
|
+
summary_index: z.number()
|
|
1348
|
+
});
|
|
1349
|
+
var openaiResponsesChunkSchema = z.union([
|
|
1350
|
+
textDeltaChunkSchema,
|
|
1351
|
+
responseFinishedChunkSchema,
|
|
1352
|
+
responseCreatedChunkSchema,
|
|
1353
|
+
responseOutputItemAddedSchema,
|
|
1354
|
+
responseOutputItemDoneSchema,
|
|
1355
|
+
responseFunctionCallArgumentsDeltaSchema,
|
|
1356
|
+
responseImageGenerationCallPartialImageSchema,
|
|
1357
|
+
responseCodeInterpreterCallCodeDeltaSchema,
|
|
1358
|
+
responseCodeInterpreterCallCodeDoneSchema,
|
|
1359
|
+
responseAnnotationAddedSchema,
|
|
1360
|
+
responseReasoningSummaryPartAddedSchema,
|
|
1361
|
+
responseReasoningSummaryPartDoneSchema,
|
|
1362
|
+
responseReasoningSummaryTextDeltaSchema,
|
|
1363
|
+
errorChunkSchema,
|
|
1364
|
+
z.object({ type: z.string() }).loose()
|
|
1365
|
+
]);
|
|
1366
|
+
function isTextDeltaChunk(chunk) {
|
|
1367
|
+
return chunk.type === "response.output_text.delta";
|
|
1368
|
+
}
|
|
1369
|
+
function isResponseOutputItemDoneChunk(chunk) {
|
|
1370
|
+
return chunk.type === "response.output_item.done";
|
|
1371
|
+
}
|
|
1372
|
+
function isResponseOutputItemDoneReasoningChunk(chunk) {
|
|
1373
|
+
return isResponseOutputItemDoneChunk(chunk) && chunk.item.type === "reasoning";
|
|
1374
|
+
}
|
|
1375
|
+
function isResponseFinishedChunk(chunk) {
|
|
1376
|
+
return chunk.type === "response.completed" || chunk.type === "response.incomplete";
|
|
1377
|
+
}
|
|
1378
|
+
function isResponseCreatedChunk(chunk) {
|
|
1379
|
+
return chunk.type === "response.created";
|
|
1380
|
+
}
|
|
1381
|
+
function isResponseFunctionCallArgumentsDeltaChunk(chunk) {
|
|
1382
|
+
return chunk.type === "response.function_call_arguments.delta";
|
|
1383
|
+
}
|
|
1384
|
+
function isResponseImageGenerationCallPartialImageChunk(chunk) {
|
|
1385
|
+
return chunk.type === "response.image_generation_call.partial_image";
|
|
1386
|
+
}
|
|
1387
|
+
function isResponseCodeInterpreterCallCodeDeltaChunk(chunk) {
|
|
1388
|
+
return chunk.type === "response.code_interpreter_call_code.delta";
|
|
1389
|
+
}
|
|
1390
|
+
function isResponseCodeInterpreterCallCodeDoneChunk(chunk) {
|
|
1391
|
+
return chunk.type === "response.code_interpreter_call_code.done";
|
|
1392
|
+
}
|
|
1393
|
+
function isResponseOutputItemAddedChunk(chunk) {
|
|
1394
|
+
return chunk.type === "response.output_item.added";
|
|
1395
|
+
}
|
|
1396
|
+
function isResponseOutputItemAddedReasoningChunk(chunk) {
|
|
1397
|
+
return isResponseOutputItemAddedChunk(chunk) && chunk.item.type === "reasoning";
|
|
1398
|
+
}
|
|
1399
|
+
function isResponseAnnotationAddedChunk(chunk) {
|
|
1400
|
+
return chunk.type === "response.output_text.annotation.added";
|
|
1401
|
+
}
|
|
1402
|
+
function isResponseReasoningSummaryPartAddedChunk(chunk) {
|
|
1403
|
+
return chunk.type === "response.reasoning_summary_part.added";
|
|
1404
|
+
}
|
|
1405
|
+
function isResponseReasoningSummaryPartDoneChunk(chunk) {
|
|
1406
|
+
return chunk.type === "response.reasoning_summary_part.done";
|
|
1407
|
+
}
|
|
1408
|
+
function isResponseReasoningSummaryTextDeltaChunk(chunk) {
|
|
1409
|
+
return chunk.type === "response.reasoning_summary_text.delta";
|
|
1410
|
+
}
|
|
1411
|
+
function isErrorChunk(chunk) {
|
|
1412
|
+
return chunk.type === "error";
|
|
1413
|
+
}
|
|
1414
|
+
function getResponsesModelConfig(modelId) {
|
|
1415
|
+
const supportsFlexProcessing = modelId.startsWith("o3") || modelId.startsWith("o4-mini") || modelId.startsWith("gpt-5") && !modelId.startsWith("gpt-5-chat");
|
|
1416
|
+
const supportsPriorityProcessing = modelId.startsWith("gpt-4") || modelId.startsWith("gpt-5-mini") || modelId.startsWith("gpt-5") && !modelId.startsWith("gpt-5-nano") && !modelId.startsWith("gpt-5-chat") || modelId.startsWith("o3") || modelId.startsWith("o4-mini");
|
|
1417
|
+
const defaults = {
|
|
1418
|
+
requiredAutoTruncation: false,
|
|
1419
|
+
systemMessageMode: "system",
|
|
1420
|
+
supportsFlexProcessing,
|
|
1421
|
+
supportsPriorityProcessing
|
|
1422
|
+
};
|
|
1423
|
+
if (modelId.startsWith("gpt-5-chat")) {
|
|
1424
|
+
return {
|
|
1425
|
+
...defaults,
|
|
1426
|
+
isReasoningModel: false
|
|
1427
|
+
};
|
|
1428
|
+
}
|
|
1429
|
+
if (modelId.startsWith("o") || modelId.startsWith("gpt-5") || modelId.startsWith("codex-") || modelId.startsWith("computer-use")) {
|
|
1430
|
+
if (modelId.startsWith("o1-mini") || modelId.startsWith("o1-preview")) {
|
|
1431
|
+
return {
|
|
1432
|
+
...defaults,
|
|
1433
|
+
isReasoningModel: true,
|
|
1434
|
+
systemMessageMode: "remove"
|
|
1435
|
+
};
|
|
1436
|
+
}
|
|
1437
|
+
return {
|
|
1438
|
+
...defaults,
|
|
1439
|
+
isReasoningModel: true,
|
|
1440
|
+
systemMessageMode: "developer"
|
|
1441
|
+
};
|
|
1442
|
+
}
|
|
1443
|
+
return {
|
|
1444
|
+
...defaults,
|
|
1445
|
+
isReasoningModel: false
|
|
1446
|
+
};
|
|
1447
|
+
}
|
|
1448
|
+
var openaiResponsesProviderOptionsSchema = z.object({
|
|
1449
|
+
include: z.array(z.enum(["reasoning.encrypted_content", "file_search_call.results", "message.output_text.logprobs"])).nullish(),
|
|
1450
|
+
instructions: z.string().nullish(),
|
|
1451
|
+
logprobs: z.union([z.boolean(), z.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
|
|
1452
|
+
maxToolCalls: z.number().nullish(),
|
|
1453
|
+
metadata: z.any().nullish(),
|
|
1454
|
+
parallelToolCalls: z.boolean().nullish(),
|
|
1455
|
+
previousResponseId: z.string().nullish(),
|
|
1456
|
+
promptCacheKey: z.string().nullish(),
|
|
1457
|
+
reasoningEffort: z.string().nullish(),
|
|
1458
|
+
reasoningSummary: z.string().nullish(),
|
|
1459
|
+
safetyIdentifier: z.string().nullish(),
|
|
1460
|
+
serviceTier: z.enum(["auto", "flex", "priority"]).nullish(),
|
|
1461
|
+
store: z.boolean().nullish(),
|
|
1462
|
+
strictJsonSchema: z.boolean().nullish(),
|
|
1463
|
+
textVerbosity: z.enum(["low", "medium", "high"]).nullish(),
|
|
1464
|
+
user: z.string().nullish()
|
|
1465
|
+
});
|
|
1466
|
+
|
|
1467
|
+
export { OpenAIResponsesLanguageModel };
|