nolo-cli 0.264.0-alpha.2 → 0.266.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{chunk-LXP53WGF.js → chunk-05wkntba.js} +44 -40
- package/{chunk-XFYFMTOM.js → chunk-08ts2q1n.js} +9 -11
- package/{chromeCommands-MVEEIY4R.js → chunk-0a3m1n6h.js} +182 -238
- package/chunk-0gfvc7g8.js +13 -0
- package/{chunk-CF7PE763.js → chunk-0h0sncy4.js} +3 -4
- package/{chunk-3UH7SS4W.js → chunk-0nsxwrge.js} +232 -241
- package/chunk-0ra8cne4.js +11 -0
- package/{chunk-MRACVEPZ.js → chunk-0sgwk7am.js} +1 -3
- package/{chunk-PEXGRTTQ.js → chunk-0tsfn0dk.js} +44 -45
- package/{chunk-WOAZVUSN.js → chunk-0y8cbwzy.js} +26 -30
- package/chunk-12gz55kk.js +6 -0
- package/{chunk-GLKOYSRU.js → chunk-186gshgw.js} +3 -6
- package/chunk-19w4ss38.js +44 -0
- package/{chunk-RF576RYE.js → chunk-1cakzp6r.js} +23 -23
- package/chunk-1fbfwbzp.js +27 -0
- package/{chunk-4IVMDQBA.js → chunk-1fv9k8zt.js} +103 -68
- package/{chunk-Q5FJJ6XI.js → chunk-1js4cdzp.js} +11 -19
- package/{chunk-YECCIUYU.js → chunk-1nhx0er5.js} +63 -63
- package/chunk-1p152b7g.js +12 -0
- package/{chunk-HXEO5DNV.js → chunk-1ynbq3yr.js} +322 -353
- package/{chunk-6UBGXX2W.js → chunk-1zrg4h5n.js} +3 -4
- package/{chunk-Y5GCAMGP.js → chunk-2g6zsfq8.js} +1 -3
- package/chunk-2hekb0eh.js +17 -0
- package/chunk-2pj6qzq5.js +12 -0
- package/chunk-2tvd4jyp.js +226 -0
- package/chunk-2ygg7azv.js +846 -0
- package/chunk-33405wtv.js +50 -0
- package/chunk-34axejtd.js +30 -0
- package/{tableCommands-FCPDULSU.js → chunk-3700dvt3.js} +224 -276
- package/{pdf-KE3QI2V7.js → chunk-3j08t1nm.js} +12505 -10133
- package/chunk-3j9gq18v.js +111 -0
- package/{chunk-LYPJYBE5.js → chunk-3qfpcdkm.js} +486 -505
- package/{settingThunks-PNC7ZISV.js → chunk-3r2x7h64.js} +189 -272
- package/{agentGrantCommands-2VLLXGIU.js → chunk-3tbj5fxt.js} +61 -56
- package/chunk-40whhjj5.js +168 -0
- package/chunk-4301919y.js +7 -0
- package/chunk-43adz39e.js +77 -0
- package/{chunk-5ZUL4CUO.js → chunk-49v3zc4g.js} +1 -3
- package/chunk-4dd7mxkb.js +72 -0
- package/{chunk-BKP325XS.js → chunk-4hapfzpq.js} +66 -62
- package/chunk-4mm7dz0m.js +95 -0
- package/chunk-4pqxempz.js +440 -0
- package/chunk-4x9zf5pv.js +10 -0
- package/{chunk-CA7LGAHV.js → chunk-511q8qzv.js} +66 -57
- package/{chunk-U7OULUMF.js → chunk-53v9g0np.js} +49 -64
- package/chunk-572mg6q5.js +19 -0
- package/{chunk-QAW6BEWQ.js → chunk-57eyhmwr.js} +17173 -16165
- package/chunk-5hsr0zjm.js +156 -0
- package/chunk-5k883yyd.js +20 -0
- package/chunk-5m0wsee4.js +639 -0
- package/{memberThunks-NEZRAW5K.js → chunk-5r1sq2gt.js} +299 -373
- package/chunk-648rq4np.js +255 -0
- package/{chunk-IYRZKHA6.js → chunk-666yjw5c.js} +63 -86
- package/{chunk-4O22PGNQ.js → chunk-6cdcbmtp.js} +19 -19
- package/chunk-6dbyqcf7.js +59 -0
- package/{agentProviderCommands-2W3VXDLV.js → chunk-6e8mgp1x.js} +82 -105
- package/chunk-6n0pw7sx.js +44 -0
- package/chunk-6q1b7381.js +361 -0
- package/chunk-6sj756ry.js +23 -0
- package/{chunk-4UNN45DS.js → chunk-6t7a7zck.js} +14785 -14454
- package/chunk-6yarwtxh.js +776 -0
- package/chunk-708h542p.js +18 -0
- package/chunk-76f076t8.js +266 -0
- package/chunk-782rrrwv.js +523 -0
- package/{workloadLifecycle-P2SJVV3S.js → chunk-7gk330wp.js} +77 -84
- package/{chunk-EZKIRVLJ.js → chunk-7ks60vxy.js} +146 -128
- package/{chunk-FI4DPLR7.js → chunk-7mrqbxe8.js} +342 -228
- package/chunk-7sztayrd.js +169 -0
- package/chunk-7vgt2mxz.js +15 -0
- package/{localFirstLog-OIETGK66.js → chunk-7z8y4k6y.js} +0 -2
- package/{chunk-KDDXC2IH.js → chunk-82htft2m.js} +49 -11
- package/{updateDialogTitleAction-XOSLNRT3.js → chunk-88vrtxxg.js} +65 -137
- package/{chunk-LS5KAVFQ.js → chunk-8dtjbp79.js} +293 -229
- package/chunk-8fajbkaz.js +50 -0
- package/chunk-8m1ebxpw.js +65 -0
- package/{accountResolver-JYG5L7YP.js → chunk-8mgfeg0w.js} +37 -30
- package/{chunk-LPXBBC32.js → chunk-8myksy35.js} +156 -160
- package/{chunk-BMQ2MJUK.js → chunk-8nrj7dc7.js} +75 -66
- package/{commandRegistry-ENNFT77C.js → chunk-8t8x64ec.js} +228 -286
- package/chunk-8yj4pq79.js +458 -0
- package/{chunk-5MKPNTJP.js → chunk-8z6pepcx.js} +43 -48
- package/{chunk-UYQILGDR.js → chunk-90egc9vb.js} +122 -102
- package/{chunk-EODBQPRM.js → chunk-91q5dc5r.js} +10 -14
- package/{chunk-U6VC4MU4.js → chunk-96jtrqk1.js} +2 -4
- package/{chunk-H57T64RA.js → chunk-996j61av.js} +28 -31
- package/{chunk-Q6FKWH66.js → chunk-9cxgb9jy.js} +137 -243
- package/{chunk-2ZBPWX7N.js → chunk-9q1gbmet.js} +62 -104
- package/chunk-9qtjh73q.js +344 -0
- package/{chunk-SR57FDTX.js → chunk-9raka469.js} +72 -155
- package/{chunk-V6K5U4YE.js → chunk-9vh4v046.js} +32 -41
- package/{chunk-AGIM7IMJ.js → chunk-9yr1fy7j.js} +14 -49
- package/{chunk-FGFJUFPS.js → chunk-a16x0wt6.js} +11 -18
- package/chunk-a5b2rvzs.js +131 -0
- package/{chunk-7DPNBQSV.js → chunk-a7bz6nc3.js} +3 -4
- package/chunk-ac85azv9.js +29 -0
- package/{chunk-VXL2FZTP.js → chunk-ahhbkad4.js} +16 -20
- package/{chunk-37DGW762.js → chunk-anhksj2j.js} +16 -29
- package/{cliAuthorityBrokerServer-27C5YBYP.js → chunk-atvmx76t.js} +180 -186
- package/{chunk-E6A5NHDH.js → chunk-av2mzeqz.js} +16 -17
- package/chunk-avbwrb0z.js +614 -0
- package/chunk-avr6rqe5.js +544 -0
- package/{workContextQueryProjection-CACY5VFE.js → chunk-axx60d5a.js} +7 -7
- package/{chunk-EWQ3HGNZ.js → chunk-b00vzjkb.js} +30 -23
- package/chunk-b0m6ezxr.js +132 -0
- package/chunk-bbd5mgdt.js +47 -0
- package/chunk-bcecft0r.js +28 -0
- package/chunk-beyr4pyp.js +33 -0
- package/{chunk-BR3GT6MR.js → chunk-bge0cagn.js} +7 -18
- package/{offlineMarxistsAgentCommand-MFURGWHL.js → chunk-bh53zg3t.js} +33 -43
- package/chunk-bmx1cw89.js +37 -0
- package/chunk-br2195h4.js +22 -0
- package/chunk-bsqkwveq.js +56 -0
- package/{chunk-QAU6KM2U.js → chunk-c09s2z1m.js} +139 -98
- package/chunk-c235kypv.js +24636 -0
- package/{chunk-2JMYAH5O.js → chunk-c30j6pyh.js} +213 -256
- package/chunk-c3v6r6sq.js +29 -0
- package/{chunk-PDSXYHNI.js → chunk-c5z7qspt.js} +1177 -1196
- package/{chunk-GWB6AGME.js → chunk-c6jvz0mp.js} +34 -50
- package/{chunk-PRJ473FK.js → chunk-cd6h9qqs.js} +14 -12
- package/chunk-cdt0amyy.js +37 -0
- package/{chunk-2AJLG6PY.js → chunk-cfh6tfc3.js} +73 -86
- package/{chunk-WIVVNJUS.js → chunk-ch4ck1yz.js} +38 -68
- package/chunk-chtvrtp5.js +55 -0
- package/{chunk-EYLGAEB4.js → chunk-ckvz7abv.js} +170 -165
- package/{chunk-YZMNK53S.js → chunk-csf18m5w.js} +32 -25
- package/{chunk-C36L6ZID.js → chunk-cwnvf8dt.js} +2 -10
- package/chunk-cy7thb6n.js +19877 -0
- package/{dialogPortabilityCommands-YQJNB2KL.js → chunk-d61q9nah.js} +439 -487
- package/chunk-d6xdy0gp.js +142 -0
- package/{chunk-EBH4RFJ6.js → chunk-dh69vqbd.js} +6390 -6496
- package/{chunk-KJ4J2XQB.js → chunk-dj4ggbc6.js} +17 -19
- package/{chunk-LISC7BD4.js → chunk-djrrhbk3.js} +29 -37
- package/chunk-drqzzzvr.js +822 -0
- package/chunk-e1n7edjk.js +33 -0
- package/chunk-e3atr4hk.js +59 -0
- package/chunk-e9bn2aav.js +13 -0
- package/chunk-ed396rfq.js +87 -0
- package/chunk-eha8ggh6.js +10 -0
- package/{chunk-MALPQFGT.js → chunk-ek122zzt.js} +893 -948
- package/chunk-epnmvek4.js +22 -0
- package/{chunk-S25VJYXV.js → chunk-eqzvk3xm.js} +69 -80
- package/chunk-ex34n71b.js +2874 -0
- package/{chunk-56OAS5RZ.js → chunk-f3ad6q4h.js} +7 -11
- package/{chunk-3PVYUPXK.js → chunk-f8jepva1.js} +6 -7
- package/{chunk-GH34JXNV.js → chunk-f9yvy9t9.js} +114 -92
- package/chunk-fbdz4f0j.js +90 -0
- package/{chunk-J44TXB4J.js → chunk-fcsc2day.js} +216 -164
- package/chunk-fevdhnbh.js +19 -0
- package/chunk-fkrgqq8w.js +3300 -0
- package/{chunk-TSBJVMNW.js → chunk-fs3bvh2p.js} +42 -57
- package/chunk-fvwzyhah.js +134 -0
- package/chunk-g0mpxdp9.js +101 -0
- package/{chunk-LTQ6ECCF.js → chunk-g35f20d1.js} +450 -414
- package/{chunk-3L2WKC3W.js → chunk-g5fhtjqg.js} +13 -16
- package/{chunk-DBEOW57U.js → chunk-gcq01td7.js} +270 -227
- package/{chunk-ADMRXWXJ.js → chunk-ge97b11r.js} +121 -42
- package/chunk-ghjtgbkw.js +180 -0
- package/chunk-gkra36c1.js +16 -0
- package/chunk-gmz86t60.js +1000 -0
- package/{localDialogRead-GWGWSL5K.js → chunk-gszpesze.js} +5 -12
- package/chunk-gvsfec9m.js +16536 -0
- package/{chunk-QSJ3HFEF.js → chunk-h1hzmqph.js} +1 -3
- package/chunk-h30dg154.js +17 -0
- package/chunk-h3hkb7cw.js +241 -0
- package/chunk-h40py996.js +28 -0
- package/{chunk-47T3QP4V.js → chunk-h60gnewh.js} +112 -116
- package/{agentPullCommand-XEGOUYQT.js → chunk-hkwsv9xf.js} +33 -45
- package/chunk-hnyg0gwj.js +28 -0
- package/{chunk-KSV6T4AH.js → chunk-hqqqph5w.js} +12 -4
- package/{chunk-YQJEXXDK.js → chunk-hrngs1wy.js} +157 -246
- package/{chunk-LRLLWD4P.js → chunk-htf69s94.js} +14 -12
- package/chunk-j0yxesh3.js +83 -0
- package/{chunk-VF4K2QE6.js → chunk-j22t9g05.js} +3 -6
- package/{chunk-3R4AYHJR.js → chunk-j4a8m2zn.js} +5 -34
- package/chunk-j9p4jnwg.js +27 -0
- package/{chunk-R72QWIFO.js → chunk-jdycmfsm.js} +9 -9
- package/chunk-jdyvrne0.js +52 -0
- package/{spacePruneCommand-YKIEUIDQ.js → chunk-je0b66qf.js} +44 -62
- package/{chunk-HNMXYYJR.js → chunk-jec44fkj.js} +3 -4
- package/{chunk-526GLZJE.js → chunk-jf1ex00r.js} +107 -73
- package/chunk-jgqdec9b.js +31 -0
- package/{chunk-56GBUMO5.js → chunk-jkw9n4h5.js} +16 -25
- package/{chunk-7422ZLGL.js → chunk-jmnzdwjt.js} +867 -965
- package/chunk-jqq57s0a.js +58 -0
- package/{chunk-OKUSDVRS.js → chunk-jtkn5aj6.js} +27 -38
- package/chunk-jwvzn9r0.js +316 -0
- package/chunk-k1re0fc7.js +107 -0
- package/chunk-k2ep3rb2.js +103 -0
- package/{chunk-JEXVIMYZ.js → chunk-k6ycb24w.js} +5 -8
- package/{chunk-RI7SXDJW.js → chunk-kawvydbk.js} +383 -195
- package/chunk-kf2ghpzh.js +10 -0
- package/{chunk-S6FAHQDH.js → chunk-kgah9e46.js} +28 -59
- package/{chunk-T3MWVUBE.js → chunk-kjjepkvc.js} +71 -82
- package/chunk-kn4dgg4j.js +4113 -0
- package/{chunk-2LFYMWM3.js → chunk-kn5p91n8.js} +43 -53
- package/{chunk-MVOZ22RZ.js → chunk-kntqrbwc.js} +8 -12
- package/{chunk-I6YIA2TY.js → chunk-kq3vr7mx.js} +25 -20
- package/chunk-kz1x1d8n.js +15 -0
- package/{mcpLocalAuthorizeCommand-IKOFKY5U.js → chunk-m22e7tt2.js} +53 -71
- package/{chunk-ZNFJWEN4.js → chunk-m32rwr4d.js} +11 -8
- package/chunk-m39e9m18.js +93 -0
- package/{chunk-4D4QD7FT.js → chunk-m5518371.js} +64 -56
- package/{chunk-LHTXSC2E.js → chunk-mb5hnfyp.js} +9 -11
- package/chunk-mexet11v.js +11 -0
- package/chunk-mg2hgfgh.js +185 -0
- package/chunk-mmdhm4kx.js +10317 -0
- package/chunk-mz002yz8.js +2821 -0
- package/chunk-mzadqnyq.js +56 -0
- package/{chunk-VIDPVFP3.js → chunk-n3r1ebdm.js} +5 -6
- package/chunk-n438qea7.js +33 -0
- package/chunk-n5ffnhnb.js +93 -0
- package/chunk-nbvd87fy.js +9 -0
- package/{chunk-E36V7MPY.js → chunk-ndej7jc9.js} +53 -43
- package/{chunk-B767MA64.js → chunk-nen6rwe4.js} +62 -22
- package/chunk-nf06tr3v.js +16 -0
- package/chunk-ng8z355q.js +16 -0
- package/{chunk-4MEKE5D3.js → chunk-nhtxfv8k.js} +78 -63
- package/{runAgentClientLoop-2SFASHDS.js → chunk-nj62jscj.js} +132 -214
- package/{chunk-GBWGPTA7.js → chunk-nkryrkyp.js} +16 -19
- package/chunk-nmesxem8.js +197 -0
- package/{chunk-YR4J7RFS.js → chunk-nmq0qwbn.js} +117 -164
- package/chunk-nph8brvw.js +7 -0
- package/chunk-nr8fees9.js +10 -0
- package/{chunk-DFI7MVCQ.js → chunk-nvewvf7h.js} +1441 -1427
- package/{chunk-G7Y4GXTY.js → chunk-nyamhphs.js} +70 -79
- package/chunk-nz1c8tcg.js +111 -0
- package/{chunk-GPLUFN2E.js → chunk-nzc5yffh.js} +176 -217
- package/{chunk-G3SUCT4W.js → chunk-p1vg4bx8.js} +2 -4
- package/chunk-p3k3abe8.js +202 -0
- package/chunk-p4zy30q5.js +8 -0
- package/{chunk-ZJACPM5O.js → chunk-p6se1rx0.js} +102 -102
- package/chunk-p9dpshev.js +6968 -0
- package/chunk-pa42wxr0.js +116 -0
- package/{chunk-TA5QI4MM.js → chunk-paxthgqp.js} +56 -107
- package/{readlineWorkspace-ZH5FGDMI.js → chunk-pb35s8d9.js} +5395 -5786
- package/{chunk-XT6C2QZW.js → chunk-pbebzbcq.js} +8 -8
- package/chunk-pbx7e1mb.js +11 -0
- package/chunk-pe5czfn9.js +8 -0
- package/chunk-pextk1j4.js +62 -0
- package/chunk-pf5rywc6.js +575 -0
- package/chunk-pjfhd3fz.js +136 -0
- package/{chunk-ZCMAKAZM.js → chunk-pkhqb0fs.js} +118 -59
- package/chunk-pm5xb9jh.js +26 -0
- package/{chunk-Y3KGWZKF.js → chunk-ppdmmdkx.js} +110 -97
- package/chunk-pqp6y2hs.js +9 -0
- package/{chunk-QHEN7NZ7.js → chunk-ptz8fm2n.js} +12 -17
- package/{chunk-EUHMI5KG.js → chunk-pwqnvbt7.js} +65 -46
- package/chunk-pzr31nz7.js +12 -0
- package/{chunk-WWC7I6TA.js → chunk-q3cx89sw.js} +2 -4
- package/chunk-q5pe7be3.js +78 -0
- package/{chunk-ZHWTBHT3.js → chunk-q6zqbxp2.js} +418 -409
- package/chunk-q7r0e1p3.js +15 -0
- package/chunk-q8t2fecd.js +6 -0
- package/{chunk-2QAZCYOM.js → chunk-q94zx4d0.js} +721 -753
- package/{runtimeDoctorCommands-52MBG5JN.js → chunk-qarz1az1.js} +65 -85
- package/{chunk-4INJGWE3.js → chunk-qdcvr25b.js} +72 -53
- package/{streamAgentChatTurn-KOUWITHH.js → chunk-qxs27wfg.js} +1079 -1475
- package/{chunk-GIXWVN2W.js → chunk-r06ycjjr.js} +50 -47
- package/{chunk-63W5N6P3.js → chunk-r20jw5hb.js} +57 -38
- package/{chunk-I5BYFTYK.js → chunk-r7sfwdka.js} +1201 -1142
- package/{chunk-UMADT6B2.js → chunk-r9sp1yyb.js} +6 -8
- package/{handleSendMessageAction-FHGUFT2X.js → chunk-rbd2vgb3.js} +627 -757
- package/chunk-rc37js46.js +12 -0
- package/{chunk-5YI447UL.js → chunk-rmngk6r3.js} +67 -76
- package/chunk-rnhbnbrq.js +15 -0
- package/{chunk-WRHVVIGI.js → chunk-rsfnmrt5.js} +111 -131
- package/{chunk-YFSM2366.js → chunk-rvvn2rhj.js} +28 -22
- package/{chunk-4Y6CZ2N4.js → chunk-s0fpz7ht.js} +37 -33
- package/{chunk-VI4SWTUO.js → chunk-s1cqzb2r.js} +77 -65
- package/{chunk-6QDYSCPW.js → chunk-s8q81tda.js} +73 -65
- package/chunk-s9hy639e.js +6 -0
- package/{chunk-R5GO3YZP.js → chunk-s9vbwme8.js} +115 -106
- package/chunk-sger1m1b.js +20 -0
- package/chunk-spe6crvk.js +60 -0
- package/chunk-spwsrvh9.js +70 -0
- package/chunk-sr05zpk7.js +573 -0
- package/{chunk-M2EJHDJP.js → chunk-srncrd3f.js} +1 -12
- package/{chunk-QXHFIX7W.js → chunk-sry80bpx.js} +71 -53
- package/{chunk-PSCNXBYA.js → chunk-t6q69p83.js} +3 -4
- package/{chunk-UAD2WT54.js → chunk-t714r4q0.js} +9 -28
- package/chunk-t7vbraqe.js +42 -0
- package/{chunk-CVMMWN6P.js → chunk-td7653rr.js} +10 -20
- package/{chunk-3BQDF4QB.js → chunk-tmytcetz.js} +17 -21
- package/{chunk-AMWMV56B.js → chunk-tta4prwg.js} +16 -15
- package/chunk-tvh8azgq.js +4829 -0
- package/{chunk-ID4G2MAR.js → chunk-v08kbfm8.js} +10 -11
- package/{chunk-OKPOQGQJ.js → chunk-v1x702q8.js} +801 -852
- package/{chunk-KHCLMKZZ.js → chunk-v39fea91.js} +576 -247
- package/{chunk-OW765XBU.js → chunk-vejtd8p2.js} +3 -4
- package/chunk-vep7zkha.js +368 -0
- package/chunk-vfwn1k7n.js +142 -0
- package/chunk-vg68vxhx.js +20 -0
- package/chunk-vgcqgnsm.js +31 -0
- package/{chunk-NF64D32W.js → chunk-vnzyjdea.js} +1 -3
- package/{chunk-ZCLSM5AK.js → chunk-vqgtw1px.js} +800 -717
- package/chunk-vv1gr5xz.js +76 -0
- package/{spaceCommands-Z2CTQD6G.js → chunk-w1qeadpq.js} +176 -242
- package/chunk-w468ez1p.js +13 -0
- package/chunk-w49s0t79.js +14 -0
- package/{mcpLocalManageCommands-KUDZQRM4.js → chunk-w58zhfbn.js} +91 -93
- package/chunk-w5b74aq6.js +11 -0
- package/chunk-w7y41qyw.js +117 -0
- package/chunk-w820gg1w.js +4165 -0
- package/{chunk-DBJAJ4UD.js → chunk-wdsmaqmt.js} +399 -453
- package/{chunk-3EUW3WEO.js → chunk-wfvvnmmj.js} +1 -3
- package/{chunk-QY4NZCDA.js → chunk-wkr04bhk.js} +432 -651
- package/{chunk-KUG52IAP.js → chunk-ws402twv.js} +1 -3
- package/chunk-wzwh311q.js +164 -0
- package/{runtimeModeArgs-X7DL7PUN.js → chunk-x5vtgvwn.js} +6 -5
- package/{agentMachineCommands-COJD2KPZ.js → chunk-x8h2csmq.js} +152 -195
- package/{chunk-BAZCS5XG.js → chunk-x9zfjnrc.js} +59 -47
- package/{chunk-WTIJKWCI.js → chunk-xcarc2rf.js} +50 -56
- package/chunk-xf33gz0a.js +8 -0
- package/{chunk-PVFYPUIM.js → chunk-y7b3gwx1.js} +78 -71
- package/{memoryCommands-SVLAVFCV.js → chunk-y7sphmnh.js} +119 -95
- package/{agentListCommands-436FHOIT.js → chunk-ycvaafhc.js} +260 -374
- package/chunk-yd7zprb0.js +9 -0
- package/chunk-yfz3d27k.js +40 -0
- package/{chunk-MKR6KDD3.js → chunk-ykv9g3m4.js} +141 -125
- package/chunk-ystjgb9e.js +544 -0
- package/chunk-yysxn7ep.js +12 -0
- package/{chunk-AL3TYDIF.js → chunk-z17eyawk.js} +18 -16
- package/{machineCommands-RVB5OG2X.js → chunk-z17q416p.js} +442 -563
- package/chunk-z1n98pcf.js +12 -0
- package/{dialogTraceCommand-HWXGIGZX.js → chunk-z566jx5r.js} +292 -397
- package/chunk-zjxd6942.js +6 -0
- package/{versionChangeNotice-RFABJGJE.js → chunk-zk11x9y5.js} +7 -9
- package/{chunk-TEFD5E2D.js → chunk-zt73yc33.js} +48 -51
- package/chunk-zvs2fra1.js +5 -0
- package/{chunk-SVFFKLMR.js → chunk-zwee84rh.js} +117 -141
- package/chunk-zxgfqv72.js +8 -0
- package/index.js +53 -69
- package/package.json +4 -4
- package/_executeModel-YQNZNR2Y.js +0 -341
- package/action-UK3HXGXF.js +0 -30
- package/addContentAction-CAKFVBDM.js +0 -38
- package/addDialogAgentAction-KLJ2YWWM.js +0 -77
- package/agentDeleteCommand-S5FVPYKT.js +0 -523
- package/agentEmailCommands-ZEFMGVKM.js +0 -742
- package/agentRecordCommands-JZ35AC5A.js +0 -211
- package/agentRun-UIO43TUG.js +0 -251
- package/agentRunCommand-ATLKKD6O.js +0 -249
- package/agentRunControl-U2MV74WR.js +0 -211
- package/agentRuntimeLocal-P4MMGIR6.js +0 -189
- package/agentSlice-HHNKNNYM.js +0 -52
- package/appConfigCommands-W4JQHMOJ.js +0 -417
- package/appDeleteCommands-IXR47IAV.js +0 -183
- package/appDeployCommands-LB6DHDF4.js +0 -232
- package/appDeployStatusCommands-UQ6MJL6D.js +0 -204
- package/appGetCommands-M5JCTDDQ.js +0 -185
- package/appListCommands-TE3ZHE3I.js +0 -186
- package/appMigrateCommands-FOXH6R4B.js +0 -230
- package/appSourceCommands-3ACYB6I7.js +0 -279
- package/authCommand-I5OBJP5S.js +0 -66
- package/authCommands-I6KCGOCN.js +0 -54
- package/builtinSkillRegistry-MIXYSZUU.js +0 -35
- package/chromeOpsCommands-IZRCYDSW.js +0 -579
- package/chunk-24BICQPB.js +0 -25
- package/chunk-2E4BYAUE.js +0 -69
- package/chunk-2O72G3U2.js +0 -17157
- package/chunk-2OROOEOQ.js +0 -229
- package/chunk-2R6M34JP.js +0 -27225
- package/chunk-2SXN7LAY.js +0 -15
- package/chunk-35JIFLIG.js +0 -30
- package/chunk-3VXVE2LF.js +0 -12
- package/chunk-4DBTBNTX.js +0 -477
- package/chunk-4JH2UMJR.js +0 -40
- package/chunk-4RUQ2PFX.js +0 -432
- package/chunk-4SN6J65J.js +0 -38
- package/chunk-5MMAK75Q.js +0 -15
- package/chunk-6NYQHXMV.js +0 -1737
- package/chunk-6R4IY46J.js +0 -14
- package/chunk-7E6YXSFZ.js +0 -441
- package/chunk-7K4J76JQ.js +0 -917
- package/chunk-7LR2IFUH.js +0 -100
- package/chunk-AETZ7AD6.js +0 -274
- package/chunk-ATNTHIZI.js +0 -13
- package/chunk-BPB3T5EU.js +0 -791
- package/chunk-BV3FLP2L.js +0 -133
- package/chunk-BVYHE6QD.js +0 -110
- package/chunk-BWJLEN6X.js +0 -1388
- package/chunk-CHOZJMJS.js +0 -78
- package/chunk-D2LTQAGN.js +0 -464
- package/chunk-DALXH7BG.js +0 -3392
- package/chunk-DBCWXGOC.js +0 -15210
- package/chunk-DLXL4NSL.js +0 -1179
- package/chunk-DSBRIUX5.js +0 -23
- package/chunk-DWLEOOGR.js +0 -8
- package/chunk-E2KZNP6C.js +0 -13
- package/chunk-E5JV4DCB.js +0 -272
- package/chunk-EUGTFFO6.js +0 -42
- package/chunk-FBNVJ2TO.js +0 -294
- package/chunk-FGXG6OLW.js +0 -34
- package/chunk-G22P2J7O.js +0 -1775
- package/chunk-HEVRQGGH.js +0 -106
- package/chunk-HHXF57CL.js +0 -180
- package/chunk-HI5RS2O4.js +0 -2109
- package/chunk-HJTI7RZV.js +0 -94
- package/chunk-HRWRIPTB.js +0 -531
- package/chunk-HYCVEESH.js +0 -2824
- package/chunk-I42VC5KR.js +0 -15
- package/chunk-IB5AR52X.js +0 -15
- package/chunk-IIRJ4P4I.js +0 -24
- package/chunk-IT3ZZRJE.js +0 -12
- package/chunk-IV6VUVLJ.js +0 -88
- package/chunk-J42X32PV.js +0 -472
- package/chunk-JDMWYVUF.js +0 -449
- package/chunk-JKVOKKMQ.js +0 -53
- package/chunk-JRTNUU5Z.js +0 -54
- package/chunk-K7HLFORE.js +0 -226
- package/chunk-KGBASAB5.js +0 -74
- package/chunk-KGKTN2NX.js +0 -25
- package/chunk-KX6YBIHG.js +0 -8
- package/chunk-KYHNSSL2.js +0 -62
- package/chunk-KZO2MTVM.js +0 -140
- package/chunk-LKZPX6YH.js +0 -0
- package/chunk-LLP2NDED.js +0 -201
- package/chunk-LOFRSJX2.js +0 -47
- package/chunk-M75RM77T.js +0 -3970
- package/chunk-MDAYRIP7.js +0 -1889
- package/chunk-MI6HRMCK.js +0 -25
- package/chunk-MTNQNLSE.js +0 -1029
- package/chunk-NH4PUEWK.js +0 -762
- package/chunk-NHLLXINQ.js +0 -8
- package/chunk-NTUNHTJV.js +0 -40
- package/chunk-OJKUU3LP.js +0 -67
- package/chunk-OQH3TAB7.js +0 -299
- package/chunk-P62DHV4F.js +0 -443
- package/chunk-PHIERFHT.js +0 -574
- package/chunk-PKDFU6MY.js +0 -102
- package/chunk-PL5RKESU.js +0 -40
- package/chunk-PSJJBBWV.js +0 -42
- package/chunk-QKM55LP2.js +0 -739
- package/chunk-QQ56R7KS.js +0 -88
- package/chunk-QYPE3TS3.js +0 -43
- package/chunk-REAE2SZK.js +0 -62
- package/chunk-RGQ4UUWZ.js +0 -208
- package/chunk-RIRFHJTW.js +0 -353
- package/chunk-RYMLMTPZ.js +0 -547
- package/chunk-SSGTV4FC.js +0 -303
- package/chunk-SVKWZ3EG.js +0 -607
- package/chunk-T7KODHYS.js +0 -317
- package/chunk-TGVVE5BA.js +0 -3085
- package/chunk-TKLBBR7P.js +0 -779
- package/chunk-TZXPT53C.js +0 -8
- package/chunk-U67V476Y.js +0 -35
- package/chunk-UEILX4EV.js +0 -15
- package/chunk-VIWDGTDA.js +0 -8
- package/chunk-VXUQWCEZ.js +0 -138
- package/chunk-W5GKF5ZW.js +0 -32
- package/chunk-WDWZPASX.js +0 -29
- package/chunk-WX266G2C.js +0 -9594
- package/chunk-YCITCYSJ.js +0 -356
- package/chunk-Z3KTXWWB.js +0 -76
- package/chunk-ZC3CMUKU.js +0 -322
- package/chunk-ZSZBHRLP.js +0 -1710
- package/chunk-ZV7ZY46L.js +0 -1343
- package/cliAgentConfigHelpers-WB2S7PDO.js +0 -47
- package/cliAuthorityBrokerClient-3SKOA7OZ.js +0 -23
- package/cliAuthorityBrokerProcess-BMBVXPKU.js +0 -24
- package/cliAuthorityStoreDriver-6FE3BJNB.js +0 -20
- package/cliEnvHelpers-7V5ZWUJA.js +0 -34
- package/cliExecutor-N3445G2Z.js +0 -45
- package/cliLocalAgentRecordReader-QKKRK53P.js +0 -113
- package/cloudAutomationCommands-S52NKCLL.js +0 -310
- package/contentThunks-ERA42OXW.js +0 -100
- package/cooldownCommands-ZFDAL4MR.js +0 -79
- package/createAgentAutomationAction-DMD2VDPI.js +0 -173
- package/createDialogAction-3SPOJQAK.js +0 -87
- package/createPageAction-AVXUMZVT.js +0 -91
- package/cursorProvider-2RACMEMF.js +0 -6123
- package/db-LTHLW7QA.js +0 -178
- package/dbSlice-WNUHTF4C.js +0 -76
- package/deleteDbKey-KV6MYBAI.js +0 -87
- package/desktopFolderProjects-4POAMVJN.js +0 -45
- package/dialogCommands-4MOLJW4G.js +0 -165
- package/dialogMessageRecord-2HJTEXQX.js +0 -7
- package/dialogNotifyCommand-YL2GFKLO.js +0 -45
- package/dialogSlice-Q7H2YVNO.js +0 -200
- package/dialogUsageCommand-IO2BQKL2.js +0 -31
- package/docCreateCommands-OYLRBK2M.js +0 -255
- package/docDeleteCommands-3NF6QPJU.js +0 -226
- package/docReadCommands-CBAERJAP.js +0 -184
- package/docStore-GWPFDV6Y.js +0 -89
- package/docUpdateCommands-BAMCGX6F.js +0 -326
- package/ebookDownloaderAgentCommand-NOIZ6U7Y.js +0 -675
- package/fetchMessages-P7FSCSXV.js +0 -19
- package/getPricing-KNXVEIUI.js +0 -40
- package/hostCredentialCreate-2VEYBXJV.js +0 -402
- package/i18n-SAK6DDY4.js +0 -51
- package/keys-FXEGMKSG.js +0 -183
- package/legacyMigration-TF4SYJCZ.js +0 -19
- package/levelAuthorityStore-L5SVDM5O.js +0 -10
- package/localAutomationCommands-XSK7SM7I.js +0 -199
- package/localAutomationRuntime-5WBO7HGQ.js +0 -61
- package/localRecall-BDYKXB46.js +0 -17
- package/localRuntimeAdapter-Y6H6XRIH.js +0 -310
- package/localRuntimeAuthority-Q5C2KWGF.js +0 -45
- package/localRuntimeDb-MM3DINZM.js +0 -12
- package/machineInfo-HNPJHQFU.js +0 -14
- package/machineWsRunDispatch-Y5SJGCEE.js +0 -228
- package/models-TOXYINNM.js +0 -10
- package/oauthTokenStore-RUYNYALS.js +0 -24
- package/overlay-JA3SPVUS.js +0 -15
- package/parityCommands-5OCBPVES.js +0 -613
- package/processSpawn-6GEO77KV.js +0 -11
- package/profileConfig-KOWK4HOG.js +0 -49
- package/projectArchive-WE3VVPZ2.js +0 -132
- package/providerPresetApply-YCVSP2WX.js +0 -235
- package/providerRegistry-26PAUYH2.js +0 -24
- package/read-D4WYJQJQ.js +0 -32
- package/readDocTool-3S3OQFOH.js +0 -22
- package/rememberExplicit-ZPI6KK5M.js +0 -16
- package/remove-AHRMUDMH.js +0 -32
- package/removeDialogAgentAction-AALRBFSA.js +0 -81
- package/secretCommands-2PSS3QNZ.js +0 -24
- package/setDialogExtraReferencesAction-SLHQ3GYL.js +0 -39
- package/setPrimaryDialogAgentAction-XKCSGJ7M.js +0 -96
- package/skillDiscovery-IUEZZG2B.js +0 -29
- package/skillSummaryMarker-62UW7HI7.js +0 -9
- package/slateToRenderMarkdown-R3X74MCX.js +0 -7
- package/slateUtils-ESQAJ6RN.js +0 -19
- package/store-WSAVTR32.js +0 -50
- package/switchDialogAgentAction-YJIWQGIR.js +0 -70
- package/tombstones-FQQMEDOW.js +0 -32
- package/toolApiClient-FVXTIIEN.js +0 -42
- package/tools-WN4AVSNS.js +0 -147
- package/tuiRestart-LU2BDLAW.js +0 -50
- package/tuiSummaryLlmCaller-Z2ZVBIGN.js +0 -53
- package/updateCommands-4QP7WJLA.js +0 -63
- package/usageCommand-AZX7D3LB.js +0 -31
- package/usageRebuildCommand-XV5QQCHK.js +0 -623
- package/userDataMerge-HT2ZVHBJ.js +0 -13
- package/windowsSelfUpdate-5OFKSW6Y.js +0 -14
- package/workContext-ZAW6VXT7.js +0 -18
- package/workContextAccess-VU5I4LKZ.js +0 -11
- package/workContextWriteNotice-YCSSMHN4.js +0 -7
- /package/{chunk-BYXBJQAS.js → chunk-0bcc25vg.js} +0 -0
|
@@ -1,74 +1,72 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
} from "./chunk-BAZCS5XG.js";
|
|
4
|
-
import {
|
|
5
|
-
accumulateToolCallDelta,
|
|
6
|
-
createThinkParserState,
|
|
7
|
-
createToolCallAccumulator,
|
|
8
|
-
createToolCallTextParserState,
|
|
2
|
+
longestTagPrefixLength,
|
|
9
3
|
extractThinkContent,
|
|
10
|
-
|
|
4
|
+
createThinkParserState,
|
|
5
|
+
processThinkChunk,
|
|
11
6
|
flushThinkParser,
|
|
12
|
-
|
|
13
|
-
longestTagPrefixLength,
|
|
7
|
+
createToolCallTextParserState,
|
|
14
8
|
processContentChunkWithToolCallStripping,
|
|
15
|
-
|
|
16
|
-
|
|
9
|
+
flushToolCallTextParserIntoCallback,
|
|
10
|
+
createToolCallAccumulator,
|
|
11
|
+
accumulateToolCallDelta,
|
|
12
|
+
finalizeAccumulatedToolCalls
|
|
13
|
+
} from "./chunk-jkw9n4h5.js";
|
|
17
14
|
import {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
15
|
+
PLATFORM_HOSTED_KIMI_PROVIDER,
|
|
16
|
+
isPlatformKimiProviderModel,
|
|
17
|
+
hostedKimiLegacyThinkingOverride,
|
|
18
|
+
resolvePlatformEffectiveModel,
|
|
19
|
+
NOLO_CLIENT_VERSION_HEADER,
|
|
20
|
+
usesMimoThinkingWire
|
|
21
|
+
} from "./chunk-fkrgqq8w.js";
|
|
22
|
+
import {
|
|
23
|
+
clampReasoningEffort
|
|
24
|
+
} from "./chunk-kawvydbk.js";
|
|
25
|
+
import {
|
|
26
|
+
isAgentCredentialShared,
|
|
27
|
+
resolveOutboundProxyApiKey,
|
|
28
|
+
resolvePlatformServerUrl,
|
|
29
|
+
resolveClientVersion,
|
|
30
|
+
resolvePlatformAuthToken,
|
|
31
|
+
canUsePlatformChatProvider2,
|
|
32
|
+
hasDirectOpenAiCompatibleProvider2,
|
|
33
|
+
resolveAgentRuntimeLocation,
|
|
34
|
+
resolveProviderTransportDecision,
|
|
35
|
+
buildProviderExecutionPlan
|
|
36
|
+
} from "./chunk-90egc9vb.js";
|
|
37
|
+
import {
|
|
38
|
+
clipCompactText
|
|
39
|
+
} from "./chunk-vqgtw1px.js";
|
|
40
|
+
import {
|
|
41
|
+
resolveToolImagePolicy
|
|
42
|
+
} from "./chunk-x9zfjnrc.js";
|
|
43
|
+
import {
|
|
44
|
+
sanitizeForOutbound,
|
|
22
45
|
getUsageRequestOptions,
|
|
23
46
|
hasImageParts,
|
|
24
|
-
resolveReasoningReplayOptions,
|
|
25
|
-
sanitizeForOutbound,
|
|
26
|
-
shouldStripReasoningContentForOutbound,
|
|
27
47
|
toOpenAiCompatibleMessages,
|
|
28
|
-
|
|
29
|
-
|
|
48
|
+
shouldStripReasoningContentForOutbound,
|
|
49
|
+
resolveReasoningReplayOptions,
|
|
50
|
+
toResponsesTools,
|
|
51
|
+
convertMessagesToResponsesInput,
|
|
52
|
+
extractTextFromResponseOutput,
|
|
53
|
+
extractToolCallsFromResponseOutput,
|
|
54
|
+
applyFunctionToolReasoningCompatibility
|
|
55
|
+
} from "./chunk-nvewvf7h.js";
|
|
30
56
|
import {
|
|
31
57
|
collectStablePromptPrefix,
|
|
32
58
|
stablePromptCacheKey
|
|
33
|
-
} from "./chunk-
|
|
34
|
-
import {
|
|
35
|
-
isMeaningfulChatCompletionOutput,
|
|
36
|
-
isMeaningfulResponsesOutput
|
|
37
|
-
} from "./chunk-H57T64RA.js";
|
|
38
|
-
import {
|
|
39
|
-
clipCompactText
|
|
40
|
-
} from "./chunk-5MMAK75Q.js";
|
|
59
|
+
} from "./chunk-1fv9k8zt.js";
|
|
41
60
|
import {
|
|
42
61
|
estimateTokenCount
|
|
43
|
-
} from "./chunk-
|
|
62
|
+
} from "./chunk-t6q69p83.js";
|
|
44
63
|
import {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
resolveAgentRuntimeLocation,
|
|
49
|
-
resolveClientVersion,
|
|
50
|
-
resolvePlatformAuthToken,
|
|
51
|
-
resolvePlatformServerUrl,
|
|
52
|
-
resolveProviderTransportDecision
|
|
53
|
-
} from "./chunk-UYQILGDR.js";
|
|
54
|
-
import {
|
|
55
|
-
isAgentCredentialShared,
|
|
56
|
-
resolveOutboundProxyApiKey
|
|
57
|
-
} from "./chunk-KGKTN2NX.js";
|
|
58
|
-
import {
|
|
59
|
-
clampReasoningEffort
|
|
60
|
-
} from "./chunk-RI7SXDJW.js";
|
|
64
|
+
isMeaningfulChatCompletionOutput,
|
|
65
|
+
isMeaningfulResponsesOutput
|
|
66
|
+
} from "./chunk-996j61av.js";
|
|
61
67
|
import {
|
|
62
68
|
isRecord
|
|
63
|
-
} from "./chunk-
|
|
64
|
-
import {
|
|
65
|
-
NOLO_CLIENT_VERSION_HEADER,
|
|
66
|
-
PLATFORM_HOSTED_KIMI_PROVIDER,
|
|
67
|
-
hostedKimiLegacyThinkingOverride,
|
|
68
|
-
isPlatformKimiProviderModel,
|
|
69
|
-
resolvePlatformEffectiveModel,
|
|
70
|
-
usesMimoThinkingWire
|
|
71
|
-
} from "./chunk-G22P2J7O.js";
|
|
69
|
+
} from "./chunk-ws402twv.js";
|
|
72
70
|
|
|
73
71
|
// packages/ai/token/sseUsageExtract.ts
|
|
74
72
|
var TOKEN_FIELDS = [
|
|
@@ -79,14 +77,14 @@ var TOKEN_FIELDS = [
|
|
|
79
77
|
"total_tokens"
|
|
80
78
|
];
|
|
81
79
|
function hasUsageTokens(value) {
|
|
82
|
-
if (!value || typeof value !== "object")
|
|
80
|
+
if (!value || typeof value !== "object")
|
|
81
|
+
return false;
|
|
83
82
|
const record = value;
|
|
84
|
-
return TOKEN_FIELDS.some(
|
|
85
|
-
(field) => typeof record[field] === "number" && Number.isFinite(record[field])
|
|
86
|
-
);
|
|
83
|
+
return TOKEN_FIELDS.some((field) => typeof record[field] === "number" && Number.isFinite(record[field]));
|
|
87
84
|
}
|
|
88
85
|
function extractUsageFromSsePayload(parsed) {
|
|
89
|
-
if (!parsed || typeof parsed !== "object")
|
|
86
|
+
if (!parsed || typeof parsed !== "object")
|
|
87
|
+
return;
|
|
90
88
|
const payload = parsed;
|
|
91
89
|
const topLevel = payload.usage;
|
|
92
90
|
if (topLevel && typeof topLevel === "object" && hasUsageTokens(topLevel)) {
|
|
@@ -101,229 +99,30 @@ function extractUsageFromSsePayload(parsed) {
|
|
|
101
99
|
}
|
|
102
100
|
}
|
|
103
101
|
}
|
|
104
|
-
return
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
// packages/core/chat/providerFailureMessage.ts
|
|
108
|
-
var RAW_BODY_CLIP = 400;
|
|
109
|
-
function describeProviderFailure(args) {
|
|
110
|
-
const clipped = clipCompactText(JSON.stringify(args.body) ?? "", RAW_BODY_CLIP, "\u2026");
|
|
111
|
-
const error = isRecord(args.body) ? args.body.error : void 0;
|
|
112
|
-
const nestedMessage = isRecord(error) ? error.message : void 0;
|
|
113
|
-
const flatMessage = isRecord(args.body) ? args.body.message : void 0;
|
|
114
|
-
const message = nestedMessage ?? flatMessage;
|
|
115
|
-
if (typeof message === "string" && message) return `${message} | ${clipped}`;
|
|
116
|
-
const looksLikeCompletion = isRecord(args.body) && Array.isArray(args.body.choices) && error === void 0;
|
|
117
|
-
if (looksLikeCompletion) {
|
|
118
|
-
const imageHint = args.hadImageParts ? "\uFF1B\u8BE5\u8BF7\u6C42\u5E26\u4E86\u56FE\u7247\uFF0C\u591A\u534A\u662F\u8FD9\u4E2A\u6A21\u578B\u6216\u8FD9\u6761\u7F51\u5173\u8DEF\u7531\u4E0D\u63A5\u53D7\u56FE\u7247\u8F93\u5165" : "";
|
|
119
|
-
return `\u4E0A\u6E38\u62D2\u7EDD\u4E86\u8BF7\u6C42\u4F46\u6CA1\u7ED9\u9519\u8BEF\u4FE1\u606F\uFF08\u54CD\u5E94\u4F53\u662F\u4E00\u4E2A\u7A7A\u7684 chat.completion\uFF09${imageHint} | ${clipped}`;
|
|
120
|
-
}
|
|
121
|
-
return clipped;
|
|
122
|
-
}
|
|
123
|
-
function providerHttpFailure(args) {
|
|
124
|
-
let body = args.raw;
|
|
125
|
-
try {
|
|
126
|
-
body = JSON.parse(args.raw);
|
|
127
|
-
} catch {
|
|
128
|
-
}
|
|
129
|
-
return new Error(
|
|
130
|
-
`${args.label} failed: HTTP ${args.status} ${describeProviderFailure({
|
|
131
|
-
body,
|
|
132
|
-
hadImageParts: hasImageParts(args.messages)
|
|
133
|
-
})}`
|
|
134
|
-
);
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
// packages/agent-runtime/deepseekDsmlParser.ts
|
|
138
|
-
var DSML_OPEN = "<\uFF5C\uFF5CDSML\uFF5C\uFF5Ctool_calls>";
|
|
139
|
-
var DSML_CLOSE = "</\uFF5C\uFF5CDSML\uFF5C\uFF5Ctool_calls>";
|
|
140
|
-
var DSML_INVOKE_RE = /<||DSML||invoke\s+name="([^"]+)">([\s\S]*?)<\/||DSML||invoke>/g;
|
|
141
|
-
var DSML_PARAMETER_RE = /<||DSML||parameter\s+([^>]+)>([\s\S]*?)<\/||DSML||parameter>/g;
|
|
142
|
-
function createDsmlParserState() {
|
|
143
|
-
return { mode: "content", buffer: "" };
|
|
144
|
-
}
|
|
145
|
-
function parseAttributes(raw) {
|
|
146
|
-
return {
|
|
147
|
-
name: raw.match(/(?:^|\s)name="([^"]+)"/)?.[1],
|
|
148
|
-
stringFlag: raw.match(/(?:^|\s)string="(true|false)"/)?.[1]
|
|
149
|
-
};
|
|
150
|
-
}
|
|
151
|
-
function decode(value) {
|
|
152
|
-
return value.replace(/"/g, '"').replace(/'/g, "'").replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&");
|
|
153
|
-
}
|
|
154
|
-
function parseValue(value) {
|
|
155
|
-
try {
|
|
156
|
-
return JSON.parse(value);
|
|
157
|
-
} catch {
|
|
158
|
-
return value;
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
function parseCalls(text) {
|
|
162
|
-
const calls = [];
|
|
163
|
-
for (const match of text.matchAll(DSML_INVOKE_RE)) {
|
|
164
|
-
const args = {};
|
|
165
|
-
for (const parameter of match[2].matchAll(DSML_PARAMETER_RE)) {
|
|
166
|
-
const attrs = parseAttributes(parameter[1]);
|
|
167
|
-
if (!attrs.name) continue;
|
|
168
|
-
const value = decode(parameter[2]);
|
|
169
|
-
args[attrs.name] = attrs.stringFlag === "true" ? value : attrs.stringFlag === "false" ? parseValue(value) : value;
|
|
170
|
-
}
|
|
171
|
-
const name = match[1];
|
|
172
|
-
if (name === "readFile" && args.path === void 0 && args.file !== void 0) {
|
|
173
|
-
args.path = args.file;
|
|
174
|
-
delete args.file;
|
|
175
|
-
}
|
|
176
|
-
calls.push({ name, arguments: JSON.stringify(args) });
|
|
177
|
-
}
|
|
178
|
-
return calls;
|
|
179
|
-
}
|
|
180
|
-
function pushDsmlChunk(chunk, state) {
|
|
181
|
-
state.buffer += chunk;
|
|
182
|
-
let content = "";
|
|
183
|
-
const toolCalls = [];
|
|
184
|
-
while (true) {
|
|
185
|
-
if (state.mode === "content") {
|
|
186
|
-
const index = state.buffer.indexOf(DSML_OPEN);
|
|
187
|
-
if (index < 0) {
|
|
188
|
-
const keep = longestTagPrefixLength(state.buffer, DSML_OPEN);
|
|
189
|
-
content += state.buffer.slice(0, state.buffer.length - keep);
|
|
190
|
-
state.buffer = state.buffer.slice(state.buffer.length - keep);
|
|
191
|
-
break;
|
|
192
|
-
}
|
|
193
|
-
content += state.buffer.slice(0, index);
|
|
194
|
-
state.buffer = state.buffer.slice(index + DSML_OPEN.length);
|
|
195
|
-
state.mode = "dsml";
|
|
196
|
-
} else {
|
|
197
|
-
const index = state.buffer.indexOf(DSML_CLOSE);
|
|
198
|
-
if (index < 0) break;
|
|
199
|
-
toolCalls.push(...parseCalls(state.buffer.slice(0, index)));
|
|
200
|
-
state.buffer = state.buffer.slice(index + DSML_CLOSE.length);
|
|
201
|
-
state.mode = "content";
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
return { content, toolCalls };
|
|
205
|
-
}
|
|
206
|
-
function finishDsml(state) {
|
|
207
|
-
const result = { content: "", toolCalls: [] };
|
|
208
|
-
if (state.mode === "dsml") result.toolCalls.push(...parseCalls(state.buffer));
|
|
209
|
-
else result.content = state.buffer;
|
|
210
|
-
state.mode = "content";
|
|
211
|
-
state.buffer = "";
|
|
212
|
-
return result;
|
|
213
|
-
}
|
|
214
|
-
function parseDsml(text) {
|
|
215
|
-
const state = createDsmlParserState();
|
|
216
|
-
const chunk = pushDsmlChunk(text, state);
|
|
217
|
-
const tail = finishDsml(state);
|
|
218
|
-
return { content: chunk.content + tail.content, toolCalls: [...chunk.toolCalls, ...tail.toolCalls] };
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
// packages/agent-runtime/responsesToolCallAccumulator.ts
|
|
222
|
-
function normalizeResponsesToolArguments(value) {
|
|
223
|
-
if (typeof value === "string") return value;
|
|
224
|
-
if (value && typeof value === "object") {
|
|
225
|
-
try {
|
|
226
|
-
return JSON.stringify(value);
|
|
227
|
-
} catch {
|
|
228
|
-
return void 0;
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
return void 0;
|
|
232
|
-
}
|
|
233
|
-
function createResponsesToolAccumulator() {
|
|
234
|
-
return /* @__PURE__ */ new Map();
|
|
235
|
-
}
|
|
236
|
-
function keyOf(event) {
|
|
237
|
-
return typeof event?.item_id === "string" && event.item_id ? event.item_id : typeof event?.item?.id === "string" && event.item.id ? event.item.id : typeof event?.item?.call_id === "string" && event.item.call_id ? event.item.call_id : typeof event?.call_id === "string" && event.call_id ? event.call_id : "";
|
|
238
|
-
}
|
|
239
|
-
function shortFingerprint(value) {
|
|
240
|
-
let hash = 2166136261;
|
|
241
|
-
for (let i = 0; i < value.length; i++) {
|
|
242
|
-
hash ^= value.charCodeAt(i);
|
|
243
|
-
hash = Math.imul(hash, 16777619);
|
|
244
|
-
}
|
|
245
|
-
return (hash >>> 0).toString(16).padStart(8, "0");
|
|
246
|
-
}
|
|
247
|
-
function parsesAsJsonObject(value) {
|
|
248
|
-
try {
|
|
249
|
-
const parsed = JSON.parse(value);
|
|
250
|
-
return parsed !== null && typeof parsed === "object";
|
|
251
|
-
} catch {
|
|
252
|
-
return false;
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
function applyResponsesToolEvent(calls, event) {
|
|
256
|
-
const key = keyOf(event);
|
|
257
|
-
if (!key) return;
|
|
258
|
-
const item = event?.item;
|
|
259
|
-
const id = item?.call_id || item?.id || event?.call_id || key;
|
|
260
|
-
const current = calls.get(key) ?? { id, name: "", arguments: "", sawDelta: false };
|
|
261
|
-
if (typeof item?.name === "string" && item.name) current.name = item.name;
|
|
262
|
-
const applySnapshot = (next) => {
|
|
263
|
-
if (!current.sawDelta) {
|
|
264
|
-
current.arguments = next;
|
|
265
|
-
return;
|
|
266
|
-
}
|
|
267
|
-
if (next.startsWith(current.arguments)) {
|
|
268
|
-
current.arguments = next;
|
|
269
|
-
} else if (current.arguments.startsWith(next)) {
|
|
270
|
-
} else {
|
|
271
|
-
if (!parsesAsJsonObject(current.arguments) && parsesAsJsonObject(next)) {
|
|
272
|
-
console.warn(
|
|
273
|
-
`[responses-tool-call] adopting parsable snapshot over unparsable accumulation (accumulated length=${current.arguments.length}, fingerprint=${shortFingerprint(current.arguments)}; snapshot length=${next.length}, fingerprint=${shortFingerprint(next)})`
|
|
274
|
-
);
|
|
275
|
-
current.arguments = next;
|
|
276
|
-
return;
|
|
277
|
-
}
|
|
278
|
-
console.warn(
|
|
279
|
-
`[responses-tool-call] conflicting arguments snapshot (accumulated length=${current.arguments.length}, fingerprint=${shortFingerprint(current.arguments)}; snapshot length=${next.length}, fingerprint=${shortFingerprint(next)})`
|
|
280
|
-
);
|
|
281
|
-
}
|
|
282
|
-
};
|
|
283
|
-
const itemArguments = normalizeResponsesToolArguments(item?.arguments);
|
|
284
|
-
if (itemArguments !== void 0) applySnapshot(itemArguments);
|
|
285
|
-
const eventArguments = normalizeResponsesToolArguments(event?.arguments);
|
|
286
|
-
if (eventArguments !== void 0) applySnapshot(eventArguments);
|
|
287
|
-
if (typeof event?.delta === "string") {
|
|
288
|
-
current.sawDelta = true;
|
|
289
|
-
current.arguments += event.delta;
|
|
290
|
-
}
|
|
291
|
-
calls.set(key, current);
|
|
292
|
-
}
|
|
293
|
-
function addResponsesToolCall(calls, call) {
|
|
294
|
-
const key = call.id;
|
|
295
|
-
calls.set(key, {
|
|
296
|
-
id: call.id,
|
|
297
|
-
name: call.function.name,
|
|
298
|
-
arguments: call.function.arguments,
|
|
299
|
-
sawDelta: false
|
|
300
|
-
});
|
|
301
|
-
}
|
|
302
|
-
function finalizeResponsesToolCalls(calls) {
|
|
303
|
-
return [...calls.values()].filter((call) => call.name).map((call) => ({
|
|
304
|
-
id: call.id,
|
|
305
|
-
type: "function",
|
|
306
|
-
function: { name: call.name, arguments: call.arguments }
|
|
307
|
-
}));
|
|
102
|
+
return;
|
|
308
103
|
}
|
|
309
104
|
|
|
310
105
|
// packages/agent-runtime/processChatCompletionDelta.ts
|
|
311
106
|
function observeFirstMeaningfulChatCompletionDelta(state) {
|
|
312
|
-
if (!state.onMeaningfulDelta || state.sawMeaningfulDelta)
|
|
107
|
+
if (!state.onMeaningfulDelta || state.sawMeaningfulDelta)
|
|
108
|
+
return;
|
|
313
109
|
state.sawMeaningfulDelta = true;
|
|
314
110
|
state.onMeaningfulDelta();
|
|
315
111
|
}
|
|
316
112
|
function extractChatCompletionStreamError(parsed) {
|
|
317
113
|
const raw = parsed?.error;
|
|
318
|
-
if (!raw)
|
|
114
|
+
if (!raw)
|
|
115
|
+
return null;
|
|
319
116
|
if (typeof raw === "string") {
|
|
320
117
|
return raw.trim() ? { message: raw.trim() } : null;
|
|
321
118
|
}
|
|
322
|
-
if (typeof raw !== "object")
|
|
119
|
+
if (typeof raw !== "object")
|
|
120
|
+
return null;
|
|
323
121
|
const message = typeof raw.msg === "string" && raw.msg.trim() ? raw.msg.trim() : typeof raw.message === "string" && raw.message.trim() ? raw.message.trim() : "";
|
|
324
|
-
const code = typeof raw.code === "string" && raw.code.trim() ? raw.code.trim() : typeof raw.type === "string" && raw.type.trim() ? raw.type.trim() :
|
|
325
|
-
const detail = typeof raw.detail === "string" && raw.detail.trim() ? raw.detail.trim() :
|
|
326
|
-
if (!message && !code)
|
|
122
|
+
const code = typeof raw.code === "string" && raw.code.trim() ? raw.code.trim() : typeof raw.type === "string" && raw.type.trim() ? raw.type.trim() : undefined;
|
|
123
|
+
const detail = typeof raw.detail === "string" && raw.detail.trim() ? raw.detail.trim() : undefined;
|
|
124
|
+
if (!message && !code)
|
|
125
|
+
return null;
|
|
327
126
|
return {
|
|
328
127
|
message: message || "upstream stream error",
|
|
329
128
|
...code ? { code } : {},
|
|
@@ -332,12 +131,13 @@ function extractChatCompletionStreamError(parsed) {
|
|
|
332
131
|
}
|
|
333
132
|
function throwIfChatCompletionStreamFailed(state) {
|
|
334
133
|
const failure = state.streamError;
|
|
335
|
-
if (!failure)
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
)
|
|
339
|
-
|
|
340
|
-
if (failure.detail)
|
|
134
|
+
if (!failure)
|
|
135
|
+
return;
|
|
136
|
+
const error = new Error(failure.code ? `${failure.message} (${failure.code})` : failure.message);
|
|
137
|
+
if (failure.code)
|
|
138
|
+
error.code = failure.code;
|
|
139
|
+
if (failure.detail)
|
|
140
|
+
error.detail = failure.detail;
|
|
341
141
|
throw error;
|
|
342
142
|
}
|
|
343
143
|
function applyChatCompletionDelta(parsed, state) {
|
|
@@ -354,7 +154,8 @@ function applyChatCompletionDelta(parsed, state) {
|
|
|
354
154
|
state.finishReason = rawFinishReason;
|
|
355
155
|
}
|
|
356
156
|
const delta = parsed?.choices?.[0]?.delta;
|
|
357
|
-
if (!delta || typeof delta !== "object")
|
|
157
|
+
if (!delta || typeof delta !== "object")
|
|
158
|
+
return false;
|
|
358
159
|
if (isMeaningfulChatCompletionOutput(delta)) {
|
|
359
160
|
observeFirstMeaningfulChatCompletionDelta(state);
|
|
360
161
|
}
|
|
@@ -368,15 +169,12 @@ function applyChatCompletionDelta(parsed, state) {
|
|
|
368
169
|
}
|
|
369
170
|
const textChunk = typeof delta.content === "string" ? delta.content : "";
|
|
370
171
|
if (textChunk) {
|
|
371
|
-
const { cleanedContent, state: newState } = processContentChunkWithToolCallStripping(
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
(name, arguments_) => accumulateToolCallDelta(state.accumulatedToolCalls, [
|
|
375
|
-
{ index: state.accumulatedToolCalls.slots.length, type: "function", function: { name, arguments: arguments_ } }
|
|
376
|
-
])
|
|
377
|
-
);
|
|
172
|
+
const { cleanedContent, state: newState } = processContentChunkWithToolCallStripping(textChunk, state.toolCallTextState, (name, arguments_) => accumulateToolCallDelta(state.accumulatedToolCalls, [
|
|
173
|
+
{ index: state.accumulatedToolCalls.slots.length, type: "function", function: { name, arguments: arguments_ } }
|
|
174
|
+
]));
|
|
378
175
|
state.toolCallTextState = newState;
|
|
379
|
-
if (!cleanedContent)
|
|
176
|
+
if (!cleanedContent)
|
|
177
|
+
return true;
|
|
380
178
|
const parsedChunk = processThinkChunk(cleanedContent, state.thinkState);
|
|
381
179
|
state.thinkState = parsedChunk.state;
|
|
382
180
|
if (parsedChunk.content) {
|
|
@@ -391,12 +189,9 @@ function applyChatCompletionDelta(parsed, state) {
|
|
|
391
189
|
return true;
|
|
392
190
|
}
|
|
393
191
|
function flushChatCompletionStream(state) {
|
|
394
|
-
const { residualContent, state: tcState } = flushToolCallTextParserIntoCallback(
|
|
395
|
-
state.
|
|
396
|
-
|
|
397
|
-
{ index: state.accumulatedToolCalls.slots.length, type: "function", function: { name, arguments: arguments_ } }
|
|
398
|
-
])
|
|
399
|
-
);
|
|
192
|
+
const { residualContent, state: tcState } = flushToolCallTextParserIntoCallback(state.toolCallTextState, (name, arguments_) => accumulateToolCallDelta(state.accumulatedToolCalls, [
|
|
193
|
+
{ index: state.accumulatedToolCalls.slots.length, type: "function", function: { name, arguments: arguments_ } }
|
|
194
|
+
]));
|
|
400
195
|
state.toolCallTextState = tcState;
|
|
401
196
|
const flushed = flushThinkParser(state.thinkState);
|
|
402
197
|
state.thinkState = flushed.state;
|
|
@@ -411,17 +206,44 @@ function flushChatCompletionStream(state) {
|
|
|
411
206
|
}
|
|
412
207
|
}
|
|
413
208
|
|
|
209
|
+
// packages/core/chat/providerFailureMessage.ts
|
|
210
|
+
var RAW_BODY_CLIP = 400;
|
|
211
|
+
function describeProviderFailure(args) {
|
|
212
|
+
const clipped = clipCompactText(JSON.stringify(args.body) ?? "", RAW_BODY_CLIP, "…");
|
|
213
|
+
const error = isRecord(args.body) ? args.body.error : undefined;
|
|
214
|
+
const nestedMessage = isRecord(error) ? error.message : undefined;
|
|
215
|
+
const flatMessage = isRecord(args.body) ? args.body.message : undefined;
|
|
216
|
+
const message = nestedMessage ?? flatMessage;
|
|
217
|
+
if (typeof message === "string" && message)
|
|
218
|
+
return `${message} | ${clipped}`;
|
|
219
|
+
const looksLikeCompletion = isRecord(args.body) && Array.isArray(args.body.choices) && error === undefined;
|
|
220
|
+
if (looksLikeCompletion) {
|
|
221
|
+
const imageHint = args.hadImageParts ? ";该请求带了图片,多半是这个模型或这条网关路由不接受图片输入" : "";
|
|
222
|
+
return `上游拒绝了请求但没给错误信息(响应体是一个空的 chat.completion)${imageHint} | ${clipped}`;
|
|
223
|
+
}
|
|
224
|
+
return clipped;
|
|
225
|
+
}
|
|
226
|
+
function providerHttpFailure(args) {
|
|
227
|
+
let body = args.raw;
|
|
228
|
+
try {
|
|
229
|
+
body = JSON.parse(args.raw);
|
|
230
|
+
} catch {}
|
|
231
|
+
return new Error(`${args.label} failed: HTTP ${args.status} ${describeProviderFailure({
|
|
232
|
+
body,
|
|
233
|
+
hadImageParts: hasImageParts(args.messages)
|
|
234
|
+
})}`);
|
|
235
|
+
}
|
|
236
|
+
|
|
414
237
|
// packages/agent-runtime/sseFrames.ts
|
|
415
238
|
async function* readSseFrames(response, signal) {
|
|
416
239
|
const reader = response.body?.getReader();
|
|
417
240
|
if (!reader) {
|
|
418
241
|
throw new Error("SSE response did not include a readable body.");
|
|
419
242
|
}
|
|
420
|
-
const decoder = new TextDecoder
|
|
243
|
+
const decoder = new TextDecoder;
|
|
421
244
|
let buffer = "";
|
|
422
245
|
const cancelOnAbort = () => {
|
|
423
|
-
|
|
424
|
-
});
|
|
246
|
+
reader.cancel(signal?.reason).catch(() => {});
|
|
425
247
|
};
|
|
426
248
|
signal?.addEventListener("abort", cancelOnAbort, { once: true });
|
|
427
249
|
try {
|
|
@@ -429,7 +251,8 @@ async function* readSseFrames(response, signal) {
|
|
|
429
251
|
while (true) {
|
|
430
252
|
const { done, value } = await reader.read();
|
|
431
253
|
signal?.throwIfAborted();
|
|
432
|
-
if (done)
|
|
254
|
+
if (done)
|
|
255
|
+
break;
|
|
433
256
|
buffer += decoder.decode(value, { stream: true });
|
|
434
257
|
let boundary = findSseFrameBoundary(buffer);
|
|
435
258
|
while (boundary) {
|
|
@@ -448,55 +271,66 @@ async function* readSseFrames(response, signal) {
|
|
|
448
271
|
boundary = findSseFrameBoundary(buffer);
|
|
449
272
|
}
|
|
450
273
|
}
|
|
451
|
-
if (buffer.trim())
|
|
274
|
+
if (buffer.trim())
|
|
275
|
+
yield buffer;
|
|
452
276
|
} finally {
|
|
453
277
|
signal?.removeEventListener("abort", cancelOnAbort);
|
|
454
278
|
try {
|
|
455
279
|
await reader.cancel();
|
|
456
|
-
} catch {
|
|
457
|
-
}
|
|
280
|
+
} catch {}
|
|
458
281
|
try {
|
|
459
282
|
reader.releaseLock();
|
|
460
|
-
} catch {
|
|
461
|
-
}
|
|
283
|
+
} catch {}
|
|
462
284
|
}
|
|
463
285
|
}
|
|
464
286
|
function findSseFrameBoundary(buffer) {
|
|
465
|
-
const lfLf = buffer.indexOf(
|
|
466
|
-
|
|
467
|
-
|
|
287
|
+
const lfLf = buffer.indexOf(`
|
|
288
|
+
|
|
289
|
+
`);
|
|
290
|
+
const crLfCrLf = buffer.indexOf(`\r
|
|
291
|
+
\r
|
|
292
|
+
`);
|
|
293
|
+
if (lfLf === -1 && crLfCrLf === -1)
|
|
294
|
+
return null;
|
|
468
295
|
const useLf = lfLf !== -1 && (crLfCrLf === -1 || lfLf < crLfCrLf);
|
|
469
296
|
return useLf ? { index: lfLf, separatorLength: 2 } : { index: crLfCrLf, separatorLength: 4 };
|
|
470
297
|
}
|
|
471
298
|
async function* streamSseDataValues(response, parse) {
|
|
472
299
|
const reader = response.body?.getReader();
|
|
473
|
-
if (!reader)
|
|
474
|
-
|
|
300
|
+
if (!reader)
|
|
301
|
+
return;
|
|
302
|
+
const decoder = new TextDecoder;
|
|
475
303
|
let buffer = "";
|
|
476
304
|
while (true) {
|
|
477
305
|
const { done, value } = await reader.read();
|
|
478
|
-
if (done)
|
|
306
|
+
if (done)
|
|
307
|
+
break;
|
|
479
308
|
buffer += decoder.decode(value, { stream: true });
|
|
480
|
-
const lines = buffer.split(
|
|
309
|
+
const lines = buffer.split(`
|
|
310
|
+
`);
|
|
481
311
|
buffer = lines.pop() ?? "";
|
|
482
312
|
for (const line of lines) {
|
|
483
313
|
const parsed = parse(line);
|
|
484
|
-
if (parsed)
|
|
314
|
+
if (parsed)
|
|
315
|
+
yield parsed;
|
|
485
316
|
}
|
|
486
317
|
}
|
|
487
318
|
const remaining = decoder.decode();
|
|
488
319
|
if (remaining) {
|
|
489
320
|
buffer += remaining;
|
|
490
|
-
const lines = buffer.split(
|
|
321
|
+
const lines = buffer.split(`
|
|
322
|
+
`);
|
|
491
323
|
buffer = lines.pop() ?? "";
|
|
492
324
|
for (const line of lines) {
|
|
493
325
|
const parsed = parse(line);
|
|
494
|
-
if (parsed)
|
|
326
|
+
if (parsed)
|
|
327
|
+
yield parsed;
|
|
495
328
|
}
|
|
496
329
|
}
|
|
497
330
|
if (buffer.trim()) {
|
|
498
331
|
const parsed = parse(buffer);
|
|
499
|
-
if (parsed)
|
|
332
|
+
if (parsed)
|
|
333
|
+
yield parsed;
|
|
500
334
|
}
|
|
501
335
|
}
|
|
502
336
|
async function readSseDataValues(response, parse) {
|
|
@@ -507,8 +341,185 @@ async function readSseDataValues(response, parse) {
|
|
|
507
341
|
return values;
|
|
508
342
|
}
|
|
509
343
|
|
|
344
|
+
// packages/agent-runtime/responsesToolCallAccumulator.ts
|
|
345
|
+
function normalizeResponsesToolArguments(value) {
|
|
346
|
+
if (typeof value === "string")
|
|
347
|
+
return value;
|
|
348
|
+
if (value && typeof value === "object") {
|
|
349
|
+
try {
|
|
350
|
+
return JSON.stringify(value);
|
|
351
|
+
} catch {
|
|
352
|
+
return;
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
return;
|
|
356
|
+
}
|
|
357
|
+
function createResponsesToolAccumulator() {
|
|
358
|
+
return new Map;
|
|
359
|
+
}
|
|
360
|
+
function keyOf(event) {
|
|
361
|
+
return typeof event?.item_id === "string" && event.item_id ? event.item_id : typeof event?.item?.id === "string" && event.item.id ? event.item.id : typeof event?.item?.call_id === "string" && event.item.call_id ? event.item.call_id : typeof event?.call_id === "string" && event.call_id ? event.call_id : "";
|
|
362
|
+
}
|
|
363
|
+
function shortFingerprint(value) {
|
|
364
|
+
let hash = 2166136261;
|
|
365
|
+
for (let i = 0;i < value.length; i++) {
|
|
366
|
+
hash ^= value.charCodeAt(i);
|
|
367
|
+
hash = Math.imul(hash, 16777619);
|
|
368
|
+
}
|
|
369
|
+
return (hash >>> 0).toString(16).padStart(8, "0");
|
|
370
|
+
}
|
|
371
|
+
function parsesAsJsonObject(value) {
|
|
372
|
+
try {
|
|
373
|
+
const parsed = JSON.parse(value);
|
|
374
|
+
return parsed !== null && typeof parsed === "object";
|
|
375
|
+
} catch {
|
|
376
|
+
return false;
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
function applyResponsesToolEvent(calls, event) {
|
|
380
|
+
const key = keyOf(event);
|
|
381
|
+
if (!key)
|
|
382
|
+
return;
|
|
383
|
+
const item = event?.item;
|
|
384
|
+
const id = item?.call_id || item?.id || event?.call_id || key;
|
|
385
|
+
const current = calls.get(key) ?? { id, name: "", arguments: "", sawDelta: false };
|
|
386
|
+
if (typeof item?.name === "string" && item.name)
|
|
387
|
+
current.name = item.name;
|
|
388
|
+
const applySnapshot = (next) => {
|
|
389
|
+
if (!current.sawDelta) {
|
|
390
|
+
current.arguments = next;
|
|
391
|
+
return;
|
|
392
|
+
}
|
|
393
|
+
if (next.startsWith(current.arguments)) {
|
|
394
|
+
current.arguments = next;
|
|
395
|
+
} else if (current.arguments.startsWith(next)) {} else {
|
|
396
|
+
if (!parsesAsJsonObject(current.arguments) && parsesAsJsonObject(next)) {
|
|
397
|
+
console.warn(`[responses-tool-call] adopting parsable snapshot over unparsable accumulation (accumulated length=${current.arguments.length}, fingerprint=${shortFingerprint(current.arguments)}; snapshot length=${next.length}, fingerprint=${shortFingerprint(next)})`);
|
|
398
|
+
current.arguments = next;
|
|
399
|
+
return;
|
|
400
|
+
}
|
|
401
|
+
console.warn(`[responses-tool-call] conflicting arguments snapshot (accumulated length=${current.arguments.length}, fingerprint=${shortFingerprint(current.arguments)}; snapshot length=${next.length}, fingerprint=${shortFingerprint(next)})`);
|
|
402
|
+
}
|
|
403
|
+
};
|
|
404
|
+
const itemArguments = normalizeResponsesToolArguments(item?.arguments);
|
|
405
|
+
if (itemArguments !== undefined)
|
|
406
|
+
applySnapshot(itemArguments);
|
|
407
|
+
const eventArguments = normalizeResponsesToolArguments(event?.arguments);
|
|
408
|
+
if (eventArguments !== undefined)
|
|
409
|
+
applySnapshot(eventArguments);
|
|
410
|
+
if (typeof event?.delta === "string") {
|
|
411
|
+
current.sawDelta = true;
|
|
412
|
+
current.arguments += event.delta;
|
|
413
|
+
}
|
|
414
|
+
calls.set(key, current);
|
|
415
|
+
}
|
|
416
|
+
function addResponsesToolCall(calls, call) {
|
|
417
|
+
const key = call.id;
|
|
418
|
+
calls.set(key, {
|
|
419
|
+
id: call.id,
|
|
420
|
+
name: call.function.name,
|
|
421
|
+
arguments: call.function.arguments,
|
|
422
|
+
sawDelta: false
|
|
423
|
+
});
|
|
424
|
+
}
|
|
425
|
+
function finalizeResponsesToolCalls(calls) {
|
|
426
|
+
return [...calls.values()].filter((call) => call.name).map((call) => ({
|
|
427
|
+
id: call.id,
|
|
428
|
+
type: "function",
|
|
429
|
+
function: { name: call.name, arguments: call.arguments }
|
|
430
|
+
}));
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
// packages/agent-runtime/deepseekDsmlParser.ts
|
|
434
|
+
var DSML_OPEN = "<||DSML||tool_calls>";
|
|
435
|
+
var DSML_CLOSE = "</||DSML||tool_calls>";
|
|
436
|
+
var DSML_INVOKE_RE = /<||DSML||invoke\s+name="([^"]+)">([\s\S]*?)<\/||DSML||invoke>/g;
|
|
437
|
+
var DSML_PARAMETER_RE = /<||DSML||parameter\s+([^>]+)>([\s\S]*?)<\/||DSML||parameter>/g;
|
|
438
|
+
function createDsmlParserState() {
|
|
439
|
+
return { mode: "content", buffer: "" };
|
|
440
|
+
}
|
|
441
|
+
function parseAttributes(raw) {
|
|
442
|
+
return {
|
|
443
|
+
name: raw.match(/(?:^|\s)name="([^"]+)"/)?.[1],
|
|
444
|
+
stringFlag: raw.match(/(?:^|\s)string="(true|false)"/)?.[1]
|
|
445
|
+
};
|
|
446
|
+
}
|
|
447
|
+
function decode(value) {
|
|
448
|
+
return value.replace(/"/g, '"').replace(/'/g, "'").replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&");
|
|
449
|
+
}
|
|
450
|
+
function parseValue(value) {
|
|
451
|
+
try {
|
|
452
|
+
return JSON.parse(value);
|
|
453
|
+
} catch {
|
|
454
|
+
return value;
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
function parseCalls(text) {
|
|
458
|
+
const calls = [];
|
|
459
|
+
for (const match of text.matchAll(DSML_INVOKE_RE)) {
|
|
460
|
+
const args = {};
|
|
461
|
+
for (const parameter of match[2].matchAll(DSML_PARAMETER_RE)) {
|
|
462
|
+
const attrs = parseAttributes(parameter[1]);
|
|
463
|
+
if (!attrs.name)
|
|
464
|
+
continue;
|
|
465
|
+
const value = decode(parameter[2]);
|
|
466
|
+
args[attrs.name] = attrs.stringFlag === "true" ? value : attrs.stringFlag === "false" ? parseValue(value) : value;
|
|
467
|
+
}
|
|
468
|
+
const name = match[1];
|
|
469
|
+
if (name === "readFile" && args.path === undefined && args.file !== undefined) {
|
|
470
|
+
args.path = args.file;
|
|
471
|
+
delete args.file;
|
|
472
|
+
}
|
|
473
|
+
calls.push({ name, arguments: JSON.stringify(args) });
|
|
474
|
+
}
|
|
475
|
+
return calls;
|
|
476
|
+
}
|
|
477
|
+
function pushDsmlChunk(chunk, state) {
|
|
478
|
+
state.buffer += chunk;
|
|
479
|
+
let content = "";
|
|
480
|
+
const toolCalls = [];
|
|
481
|
+
while (true) {
|
|
482
|
+
if (state.mode === "content") {
|
|
483
|
+
const index = state.buffer.indexOf(DSML_OPEN);
|
|
484
|
+
if (index < 0) {
|
|
485
|
+
const keep = longestTagPrefixLength(state.buffer, DSML_OPEN);
|
|
486
|
+
content += state.buffer.slice(0, state.buffer.length - keep);
|
|
487
|
+
state.buffer = state.buffer.slice(state.buffer.length - keep);
|
|
488
|
+
break;
|
|
489
|
+
}
|
|
490
|
+
content += state.buffer.slice(0, index);
|
|
491
|
+
state.buffer = state.buffer.slice(index + DSML_OPEN.length);
|
|
492
|
+
state.mode = "dsml";
|
|
493
|
+
} else {
|
|
494
|
+
const index = state.buffer.indexOf(DSML_CLOSE);
|
|
495
|
+
if (index < 0)
|
|
496
|
+
break;
|
|
497
|
+
toolCalls.push(...parseCalls(state.buffer.slice(0, index)));
|
|
498
|
+
state.buffer = state.buffer.slice(index + DSML_CLOSE.length);
|
|
499
|
+
state.mode = "content";
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
return { content, toolCalls };
|
|
503
|
+
}
|
|
504
|
+
function finishDsml(state) {
|
|
505
|
+
const result = { content: "", toolCalls: [] };
|
|
506
|
+
if (state.mode === "dsml")
|
|
507
|
+
result.toolCalls.push(...parseCalls(state.buffer));
|
|
508
|
+
else
|
|
509
|
+
result.content = state.buffer;
|
|
510
|
+
state.mode = "content";
|
|
511
|
+
state.buffer = "";
|
|
512
|
+
return result;
|
|
513
|
+
}
|
|
514
|
+
function parseDsml(text) {
|
|
515
|
+
const state = createDsmlParserState();
|
|
516
|
+
const chunk = pushDsmlChunk(text, state);
|
|
517
|
+
const tail = finishDsml(state);
|
|
518
|
+
return { content: chunk.content + tail.content, toolCalls: [...chunk.toolCalls, ...tail.toolCalls] };
|
|
519
|
+
}
|
|
520
|
+
|
|
510
521
|
// packages/agent-runtime/platformChatProvider.ts
|
|
511
|
-
|
|
522
|
+
class PlatformStreamInterruptedError extends Error {
|
|
512
523
|
code = "PLATFORM_STREAM_INTERRUPTED";
|
|
513
524
|
name = "PlatformStreamInterrupted";
|
|
514
525
|
phase;
|
|
@@ -520,10 +531,7 @@ var PlatformStreamInterruptedError = class extends Error {
|
|
|
520
531
|
sawFinishReason;
|
|
521
532
|
elapsedMs;
|
|
522
533
|
constructor(args) {
|
|
523
|
-
super(
|
|
524
|
-
args.message ?? `Platform LLM stream interrupted (${args.phase}, frames=${args.frameCount ?? 0}, chars=${args.textChars ?? 0})`,
|
|
525
|
-
args.cause !== void 0 ? { cause: args.cause } : void 0
|
|
526
|
-
);
|
|
534
|
+
super(args.message ?? `Platform LLM stream interrupted (${args.phase}, frames=${args.frameCount ?? 0}, chars=${args.textChars ?? 0})`, args.cause !== undefined ? { cause: args.cause } : undefined);
|
|
527
535
|
this.name = "PlatformStreamInterrupted";
|
|
528
536
|
this.phase = args.phase;
|
|
529
537
|
this.httpStatus = args.httpStatus ?? (args.phase === "streaming" ? 200 : 0);
|
|
@@ -533,11 +541,11 @@ var PlatformStreamInterruptedError = class extends Error {
|
|
|
533
541
|
this.sawUsage = args.sawUsage ?? false;
|
|
534
542
|
this.sawFinishReason = args.sawFinishReason ?? false;
|
|
535
543
|
this.elapsedMs = args.elapsedMs ?? 0;
|
|
536
|
-
if (args.cause !==
|
|
544
|
+
if (args.cause !== undefined && this.cause === undefined) {
|
|
537
545
|
this.cause = args.cause;
|
|
538
546
|
}
|
|
539
547
|
}
|
|
540
|
-
}
|
|
548
|
+
}
|
|
541
549
|
function isAbortOrTimeoutError(error) {
|
|
542
550
|
if (typeof DOMException !== "undefined" && error instanceof DOMException) {
|
|
543
551
|
return error.name === "AbortError" || error.name === "TimeoutError";
|
|
@@ -549,7 +557,8 @@ function isAbortOrTimeoutError(error) {
|
|
|
549
557
|
}
|
|
550
558
|
var CHAT_PROXY_PATH = "/api/v1/chat";
|
|
551
559
|
function shouldDisableThinking(providerConfig) {
|
|
552
|
-
if (!usesMimoThinkingWire(providerConfig.provider, providerConfig.model, providerConfig.endpoint))
|
|
560
|
+
if (!usesMimoThinkingWire(providerConfig.provider, providerConfig.model, providerConfig.endpoint))
|
|
561
|
+
return false;
|
|
553
562
|
const effort = providerConfig.requestOptions.reasoning_effort;
|
|
554
563
|
return effort === "none" || effort === "off" || !effort && providerConfig.enableThinking !== true;
|
|
555
564
|
}
|
|
@@ -566,13 +575,13 @@ function toResponsesRequestOptions(options) {
|
|
|
566
575
|
next.reasoning = { effort: reasoningEffort };
|
|
567
576
|
delete next.reasoning_effort;
|
|
568
577
|
}
|
|
569
|
-
if (next.max_tokens !==
|
|
578
|
+
if (next.max_tokens !== undefined) {
|
|
570
579
|
next.max_output_tokens = next.max_tokens;
|
|
571
580
|
delete next.max_tokens;
|
|
572
581
|
}
|
|
573
582
|
return next;
|
|
574
583
|
}
|
|
575
|
-
async function
|
|
584
|
+
async function resolvePlatformChatProviderConfig2(args) {
|
|
576
585
|
const plan = await buildProviderExecutionPlan({
|
|
577
586
|
agentConfig: args.agentConfig,
|
|
578
587
|
env: args.env,
|
|
@@ -621,12 +630,9 @@ async function resolvePlatformChatProviderConfig(args) {
|
|
|
621
630
|
...plan.clientVersion ? { clientVersion: plan.clientVersion } : {}
|
|
622
631
|
};
|
|
623
632
|
}
|
|
624
|
-
function
|
|
633
|
+
function buildPlatformChatCompletionRequest2(args) {
|
|
625
634
|
if (!args.providerConfig.authToken?.trim()) {
|
|
626
|
-
throw Object.assign(
|
|
627
|
-
new Error("desktop platform provider failed: AUTH_NO_TOKEN"),
|
|
628
|
-
{ code: "AUTH_NO_TOKEN", authCode: "AUTH_NO_TOKEN", stage: "provider" }
|
|
629
|
-
);
|
|
635
|
+
throw Object.assign(new Error("desktop platform provider failed: AUTH_NO_TOKEN"), { code: "AUTH_NO_TOKEN", authCode: "AUTH_NO_TOKEN", stage: "provider" });
|
|
630
636
|
}
|
|
631
637
|
const usesResponsesApi = isResponsesEndpoint(args.providerConfig.endpoint);
|
|
632
638
|
const requestOptions = usesResponsesApi ? toResponsesRequestOptions(args.providerConfig.requestOptions) : { ...args.providerConfig.requestOptions };
|
|
@@ -634,48 +640,32 @@ function buildPlatformChatCompletionRequest(args) {
|
|
|
634
640
|
const effort = requestOptions.reasoning_effort;
|
|
635
641
|
if (!usesResponsesApi && typeof effort === "string" && effort && provider === PLATFORM_HOSTED_KIMI_PROVIDER && usageProvider === "baseten" && isPlatformKimiProviderModel(provider, resolvePlatformEffectiveModel(model))) {
|
|
636
642
|
const clamped = clampReasoningEffort(effort, provider, model);
|
|
637
|
-
if (clamped)
|
|
638
|
-
|
|
643
|
+
if (clamped)
|
|
644
|
+
requestOptions.reasoning_effort = clamped;
|
|
645
|
+
else
|
|
646
|
+
delete requestOptions.reasoning_effort;
|
|
639
647
|
}
|
|
640
648
|
const disableThinking = !usesResponsesApi && shouldDisableThinking(args.providerConfig);
|
|
641
649
|
if (disableThinking && ["none", "off"].includes(String(requestOptions.reasoning_effort))) {
|
|
642
650
|
delete requestOptions.reasoning_effort;
|
|
643
651
|
}
|
|
644
|
-
const shouldStripReasoning = !usesResponsesApi && shouldStripReasoningContentForOutbound(
|
|
645
|
-
|
|
646
|
-
args.providerConfig.model
|
|
647
|
-
);
|
|
648
|
-
const reasoningReplayOptions = resolveReasoningReplayOptions(
|
|
649
|
-
args.providerConfig.provider,
|
|
650
|
-
args.providerConfig.model,
|
|
651
|
-
shouldStripReasoning
|
|
652
|
-
);
|
|
652
|
+
const shouldStripReasoning = !usesResponsesApi && shouldStripReasoningContentForOutbound(args.providerConfig.provider, args.providerConfig.model);
|
|
653
|
+
const reasoningReplayOptions = resolveReasoningReplayOptions(args.providerConfig.provider, args.providerConfig.model, shouldStripReasoning);
|
|
653
654
|
const sanitizedMessages = sanitizeForOutbound(args.messages, args.tools);
|
|
654
655
|
const proxyApiKey = resolveOutboundProxyApiKey(args.providerConfig);
|
|
655
656
|
const body = {
|
|
656
657
|
model: args.providerConfig.model,
|
|
657
658
|
...usesResponsesApi ? {
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
provider: args.providerConfig.usageProvider ?? args.providerConfig.provider,
|
|
666
|
-
model: args.providerConfig.model,
|
|
667
|
-
customProviderUrl: args.providerConfig.endpoint,
|
|
668
|
-
hasVision: args.providerConfig.hasVision
|
|
669
|
-
}),
|
|
670
|
-
// 占位必须在**这一层**注入,不能只交给 responsesHelpers:
|
|
671
|
-
// `toOpenAiCompatibleMessages` 会用 preserveAgentStateFields 重建对象,
|
|
672
|
-
// 而非枚举 Symbol 标记(DOWNGRADED_TOOL_TURN_ORIGIN)不会跟着走,
|
|
673
|
-
// 所以「整体降级成纯文本的工具轮」到了 Responses 转换器那里已经认不出来。
|
|
674
|
-
// 在这里注入后,转换器只需读非空 reasoning_content 这条既有真值路径。
|
|
675
|
-
...reasoningReplayOptions
|
|
659
|
+
input: convertMessagesToResponsesInput(toOpenAiCompatibleMessages(sanitizedMessages, {
|
|
660
|
+
...resolveToolImagePolicy({
|
|
661
|
+
routeKind: "platform",
|
|
662
|
+
provider: args.providerConfig.usageProvider ?? args.providerConfig.provider,
|
|
663
|
+
model: args.providerConfig.model,
|
|
664
|
+
customProviderUrl: args.providerConfig.endpoint,
|
|
665
|
+
hasVision: args.providerConfig.hasVision
|
|
676
666
|
}),
|
|
677
|
-
reasoningReplayOptions
|
|
678
|
-
)
|
|
667
|
+
...reasoningReplayOptions
|
|
668
|
+
}), reasoningReplayOptions)
|
|
679
669
|
} : {
|
|
680
670
|
messages: toOpenAiCompatibleMessages(sanitizedMessages, {
|
|
681
671
|
...resolveToolImagePolicy({
|
|
@@ -699,35 +689,17 @@ function buildPlatformChatCompletionRequest(args) {
|
|
|
699
689
|
...usesResponsesApi ? {} : { tool_choice: "auto" }
|
|
700
690
|
} : {},
|
|
701
691
|
...disableThinking ? { thinking: { type: "disabled" } } : {},
|
|
702
|
-
...!usesResponsesApi ? hostedKimiLegacyThinkingOverride(
|
|
703
|
-
|
|
692
|
+
...!usesResponsesApi ? hostedKimiLegacyThinkingOverride(args.providerConfig.provider, args.providerConfig.model, args.providerConfig.enableThinking, args.providerConfig.requestOptions.reasoning_effort) : undefined,
|
|
693
|
+
prompt_cache_key: stablePromptCacheKey([
|
|
704
694
|
args.providerConfig.model,
|
|
705
|
-
|
|
706
|
-
args.
|
|
707
|
-
)
|
|
708
|
-
// 缓存路由亲和提示:托管上游是多副本共享池,前缀缓存是节点本地的,
|
|
709
|
-
// 请求落到另一副本就整条 miss(实测占该线全部 miss token 的 52%,
|
|
710
|
-
// 依据见 promptCacheKey.ts)。键只取跨轮稳定的部分(model + system 稳定
|
|
711
|
-
// 前缀 + 工具定义),历史增长不参与,否则键每轮都变等于没有键。
|
|
712
|
-
// 已实测 RunInfra 接受该字段且不破坏既有命中;效果待上线后按
|
|
713
|
-
// promptCacheKey.ts 末尾的口径复测。
|
|
714
|
-
prompt_cache_key: stablePromptCacheKey(
|
|
715
|
-
[
|
|
716
|
-
args.providerConfig.model,
|
|
717
|
-
// 只从消息里取:本 builder 只拿得到 providerConfig,没有 agentConfig,
|
|
718
|
-
// agent prompt 早已由 localLoop 的 buildMessages 拼进 system 稳定前缀,
|
|
719
|
-
// 所以 sanitizedMessages 里的 system 就是完整取材,无需 fallback。
|
|
720
|
-
collectStablePromptPrefix(sanitizedMessages),
|
|
721
|
-
args.tools ?? []
|
|
722
|
-
],
|
|
723
|
-
"nolo-chat"
|
|
724
|
-
),
|
|
695
|
+
collectStablePromptPrefix(sanitizedMessages),
|
|
696
|
+
args.tools ?? []
|
|
697
|
+
], "nolo-chat"),
|
|
725
698
|
url: args.providerConfig.endpoint,
|
|
726
699
|
provider: args.providerConfig.provider,
|
|
727
700
|
agentKey: args.providerConfig.agentKey,
|
|
728
701
|
...args.dialogId?.trim() ? { dialogId: args.dialogId.trim() } : {},
|
|
729
702
|
...args.providerConfig.apiSource ? { apiSource: args.providerConfig.apiSource } : {},
|
|
730
|
-
// Overwrite any same-named request option; undefined is omitted on the wire.
|
|
731
703
|
KEY: proxyApiKey,
|
|
732
704
|
...args.providerConfig.apiKeyHeader ? { apiKeyHeader: args.providerConfig.apiKeyHeader } : {}
|
|
733
705
|
};
|
|
@@ -740,20 +712,7 @@ function buildPlatformChatCompletionRequest(args) {
|
|
|
740
712
|
"Content-Type": "application/json",
|
|
741
713
|
Authorization: `Bearer ${args.providerConfig.authToken}`,
|
|
742
714
|
...args.requestId ? { "x-request-id": args.requestId } : {},
|
|
743
|
-
// 流式请求显式放弃压缩协商。实测记录(2026-09-01,glm-5-3-flash 经
|
|
744
|
-
// nolo.chat):某个时间窗内 SSE 响应带 content-encoding: gzip 返回,
|
|
745
|
-
// 整条流被攒成 1 个 chunk,首字节 = 总生成时长(5.8/10.6/16.3s);
|
|
746
|
-
// 同一分钟交替发起的 identity 请求为 123-138 chunks、首字节
|
|
747
|
-
// 1.2-3.6s。即压缩中间件一旦介入,流式的首个输出收益归零。
|
|
748
|
-
// 该窗口之后线上不再压缩 SSE(同一探针 6/6 未压缩),具体是哪一跳
|
|
749
|
-
// 压的没有定论;边缘侧已把流式路径排除出 encode
|
|
750
|
-
// (configureCaddyProxy.sh),这里是不依赖任何中间跳行为的客户端兜底
|
|
751
|
-
// ——用户侧本地代理同样可能压。SSE 正文只有几十 KB,放弃压缩的带宽
|
|
752
|
-
// 代价可忽略。
|
|
753
715
|
...args.stream ? { "Accept-Encoding": "identity" } : {},
|
|
754
|
-
// 客户端版本闸门第 2 层:与鉴权头同处一处统一注入,避免某条命令路径
|
|
755
|
-
// 漏发。server 据此拒绝「该客户端认不了 wire 的托管模型」;不发这个头
|
|
756
|
-
// 的旧客户端在 server 侧 fail-open(已知局限)。
|
|
757
716
|
...args.providerConfig.clientVersion ? {
|
|
758
717
|
[NOLO_CLIENT_VERSION_HEADER]: args.providerConfig.clientVersion
|
|
759
718
|
} : {}
|
|
@@ -775,7 +734,7 @@ function extractJsonObjects(raw) {
|
|
|
775
734
|
let start = -1;
|
|
776
735
|
let inString = false;
|
|
777
736
|
let escaped = false;
|
|
778
|
-
for (let index = 0;
|
|
737
|
+
for (let index = 0;index < raw.length; index += 1) {
|
|
779
738
|
const char = raw[index];
|
|
780
739
|
if (inString) {
|
|
781
740
|
if (escaped) {
|
|
@@ -792,31 +751,35 @@ function extractJsonObjects(raw) {
|
|
|
792
751
|
continue;
|
|
793
752
|
}
|
|
794
753
|
if (char === "{") {
|
|
795
|
-
if (depth === 0)
|
|
754
|
+
if (depth === 0)
|
|
755
|
+
start = index;
|
|
796
756
|
depth += 1;
|
|
797
757
|
continue;
|
|
798
758
|
}
|
|
799
|
-
if (char !== "}" || depth === 0)
|
|
759
|
+
if (char !== "}" || depth === 0)
|
|
760
|
+
continue;
|
|
800
761
|
depth -= 1;
|
|
801
762
|
if (depth === 0 && start >= 0) {
|
|
802
763
|
const parsed = tryParseJson(raw.slice(start, index + 1));
|
|
803
|
-
if (parsed)
|
|
764
|
+
if (parsed)
|
|
765
|
+
objects.push(parsed);
|
|
804
766
|
start = -1;
|
|
805
767
|
}
|
|
806
768
|
}
|
|
807
769
|
return objects;
|
|
808
770
|
}
|
|
809
|
-
function
|
|
771
|
+
function parsePlatformChatCompletionData2(raw) {
|
|
810
772
|
const direct = tryParseJson(raw.trim());
|
|
811
|
-
if (direct)
|
|
773
|
+
if (direct)
|
|
774
|
+
return direct;
|
|
812
775
|
const objects = extractJsonObjects(raw);
|
|
813
776
|
return objects.find((object) => Array.isArray(object?.choices)) ?? objects[0] ?? {};
|
|
814
777
|
}
|
|
815
|
-
function
|
|
778
|
+
function parsePlatformChatCompletionResponse2(args) {
|
|
816
779
|
const hasCompletionsShape = Array.isArray(args.data?.choices);
|
|
817
780
|
if (!hasCompletionsShape && isResponsesEndpoint(args.providerConfig.endpoint)) {
|
|
818
|
-
const
|
|
819
|
-
const dsml = parseDsml(
|
|
781
|
+
const rawContent = extractTextFromResponseOutput(args.data);
|
|
782
|
+
const dsml = parseDsml(rawContent);
|
|
820
783
|
const tool_calls = extractToolCallsFromResponseOutput(args.data);
|
|
821
784
|
const normalizedToolCalls = tool_calls.length > 0 ? tool_calls : dsml.toolCalls.map((call, index) => ({
|
|
822
785
|
id: buildDsmlToolCallId(tool_calls.length, index),
|
|
@@ -844,18 +807,20 @@ function parsePlatformChatCompletionResponse(args) {
|
|
|
844
807
|
...Array.isArray(choiceMessage?.tool_calls) ? { tool_calls: choiceMessage.tool_calls } : {},
|
|
845
808
|
...reasoning ? { reasoning_content: reasoning } : typeof choiceMessage?.reasoning_content === "string" && choiceMessage.reasoning_content ? { reasoning_content: choiceMessage.reasoning_content } : {},
|
|
846
809
|
...typeof rawFinishReason === "string" && rawFinishReason.length > 0 ? { finish_reason: rawFinishReason } : {},
|
|
847
|
-
// 非流式:完整的 200 JSON body 即证明调用走完,见 AgentRuntimeResult。
|
|
848
810
|
stream_complete: true,
|
|
849
811
|
usage: args.data?.usage,
|
|
850
812
|
trace: args.trace
|
|
851
813
|
};
|
|
852
814
|
}
|
|
853
815
|
function processPlatformChatSseEvent(event, state) {
|
|
854
|
-
for (const line of event.split(
|
|
816
|
+
for (const line of event.split(`
|
|
817
|
+
`)) {
|
|
855
818
|
const trimmed = line.trim();
|
|
856
|
-
if (!trimmed.startsWith("data:"))
|
|
819
|
+
if (!trimmed.startsWith("data:"))
|
|
820
|
+
continue;
|
|
857
821
|
const payload = trimmed.slice(5).trim();
|
|
858
|
-
if (!payload)
|
|
822
|
+
if (!payload)
|
|
823
|
+
continue;
|
|
859
824
|
if (payload === "[DONE]") {
|
|
860
825
|
state.sawDone = true;
|
|
861
826
|
return;
|
|
@@ -888,7 +853,8 @@ function processPlatformChatSseEvent(event, state) {
|
|
|
888
853
|
}
|
|
889
854
|
if (!state.streamError) {
|
|
890
855
|
const responsesError = extractChatCompletionStreamError(parsed);
|
|
891
|
-
if (responsesError)
|
|
856
|
+
if (responsesError)
|
|
857
|
+
state.streamError = responsesError;
|
|
892
858
|
}
|
|
893
859
|
const eventType = typeof parsed?.type === "string" ? parsed.type : "";
|
|
894
860
|
if (eventType === "response.output_text.delta" && typeof parsed?.delta === "string") {
|
|
@@ -932,26 +898,26 @@ function processPlatformChatSseEvent(event, state) {
|
|
|
932
898
|
}
|
|
933
899
|
}
|
|
934
900
|
}
|
|
935
|
-
async function
|
|
901
|
+
async function readPlatformChatSseCompletion2(args) {
|
|
936
902
|
const startedAtMs = Date.now();
|
|
937
903
|
let frameCount = 0;
|
|
938
904
|
const state = {
|
|
939
905
|
content: "",
|
|
940
906
|
reasoning: "",
|
|
941
|
-
usage:
|
|
942
|
-
billing:
|
|
907
|
+
usage: undefined,
|
|
908
|
+
billing: undefined,
|
|
943
909
|
usesResponsesApi: args.usesResponsesApi,
|
|
944
910
|
onTextDelta: args.onTextDelta,
|
|
945
911
|
onReasoningDelta: args.onReasoningDelta,
|
|
946
912
|
...args.onMeaningfulDelta ? { onMeaningfulDelta: args.onMeaningfulDelta } : {},
|
|
947
|
-
completedResponsesPayload:
|
|
913
|
+
completedResponsesPayload: undefined,
|
|
948
914
|
responsesToolCalls: createResponsesToolAccumulator(),
|
|
949
915
|
dsmlToolCallState: createDsmlParserState(),
|
|
950
|
-
streamError:
|
|
916
|
+
streamError: undefined,
|
|
951
917
|
accumulatedToolCalls: createToolCallAccumulator(),
|
|
952
918
|
thinkState: createThinkParserState(),
|
|
953
919
|
toolCallTextState: createToolCallTextParserState(),
|
|
954
|
-
finishReason:
|
|
920
|
+
finishReason: undefined,
|
|
955
921
|
sawDone: false,
|
|
956
922
|
sawResponseCompleted: false
|
|
957
923
|
};
|
|
@@ -959,7 +925,8 @@ async function readPlatformChatSseCompletion(args) {
|
|
|
959
925
|
for await (const frame of readSseFrames(args.response)) {
|
|
960
926
|
frameCount += 1;
|
|
961
927
|
processPlatformChatSseEvent(frame, state);
|
|
962
|
-
if (state.sawDone)
|
|
928
|
+
if (state.sawDone)
|
|
929
|
+
break;
|
|
963
930
|
}
|
|
964
931
|
} catch (cause) {
|
|
965
932
|
if (cause instanceof PlatformStreamInterruptedError) {
|
|
@@ -997,7 +964,8 @@ async function readPlatformChatSseCompletion(args) {
|
|
|
997
964
|
function: { name: call.name, arguments: call.arguments }
|
|
998
965
|
});
|
|
999
966
|
}
|
|
1000
|
-
if (dsml.content)
|
|
967
|
+
if (dsml.content)
|
|
968
|
+
state.content += dsml.content;
|
|
1001
969
|
}
|
|
1002
970
|
throwIfChatCompletionStreamFailed(state);
|
|
1003
971
|
const streamComplete = state.sawDone || state.sawResponseCompleted || Boolean(state.usage) || Boolean(state.finishReason);
|
|
@@ -1012,20 +980,16 @@ async function readPlatformChatSseCompletion(args) {
|
|
|
1012
980
|
type: "function",
|
|
1013
981
|
function: { name: call.name, arguments: call.arguments }
|
|
1014
982
|
}));
|
|
1015
|
-
const completionsToolCalls = finalizeAccumulatedToolCalls(
|
|
1016
|
-
|
|
1017
|
-
);
|
|
1018
|
-
const tool_calls2 = completedToolCalls.length > 0 ? completedToolCalls : normalizedDsmlCalls.length > 0 ? normalizedDsmlCalls : completionsToolCalls.length > 0 ? completionsToolCalls : finalizeResponsesToolCalls(state.responsesToolCalls);
|
|
1019
|
-
const finalUsage2 = mergeBillingIntoUsage(state.usage, state.billing);
|
|
983
|
+
const completionsToolCalls = finalizeAccumulatedToolCalls(state.accumulatedToolCalls);
|
|
984
|
+
const tool_calls = completedToolCalls.length > 0 ? completedToolCalls : normalizedDsmlCalls.length > 0 ? normalizedDsmlCalls : completionsToolCalls.length > 0 ? completionsToolCalls : finalizeResponsesToolCalls(state.responsesToolCalls);
|
|
985
|
+
const finalUsage = mergeBillingIntoUsage(state.usage, state.billing);
|
|
1020
986
|
return {
|
|
1021
987
|
content: normalizedFinal.content || state.content,
|
|
1022
988
|
...state.reasoning ? { reasoning_content: state.reasoning } : {},
|
|
1023
|
-
...
|
|
1024
|
-
...
|
|
989
|
+
...tool_calls.length > 0 ? { tool_calls } : {},
|
|
990
|
+
...finalUsage ? { usage: finalUsage } : {},
|
|
1025
991
|
...streamComplete ? { stream_complete: true } : {},
|
|
1026
992
|
...streamTruncated ? { streamTruncated: true } : {},
|
|
1027
|
-
// finish_reason 供 executePlatformChatCompletion 穿透给 localLoop 的
|
|
1028
|
-
// 空轮/截断判定;此前 reader 从不回传,流式路径恒缺。
|
|
1029
993
|
...state.finishReason ? { finish_reason: state.finishReason } : {}
|
|
1030
994
|
};
|
|
1031
995
|
}
|
|
@@ -1042,17 +1006,19 @@ async function readPlatformChatSseCompletion(args) {
|
|
|
1042
1006
|
};
|
|
1043
1007
|
}
|
|
1044
1008
|
function mergeBillingIntoUsage(usage, billing) {
|
|
1045
|
-
if (!billing)
|
|
1046
|
-
|
|
1009
|
+
if (!billing)
|
|
1010
|
+
return usage;
|
|
1011
|
+
if (!usage)
|
|
1012
|
+
return billing;
|
|
1047
1013
|
return { ...usage, ...billing };
|
|
1048
1014
|
}
|
|
1049
|
-
function
|
|
1050
|
-
return
|
|
1015
|
+
function canUsePlatformChatProvider(env) {
|
|
1016
|
+
return canUsePlatformChatProvider2(env);
|
|
1051
1017
|
}
|
|
1052
|
-
function
|
|
1053
|
-
return
|
|
1018
|
+
function hasDirectOpenAiCompatibleProvider(env) {
|
|
1019
|
+
return hasDirectOpenAiCompatibleProvider2(env);
|
|
1054
1020
|
}
|
|
1055
|
-
function
|
|
1021
|
+
function shouldUsePlatformChatProvider2(env, agentConfig) {
|
|
1056
1022
|
if (!agentConfig) {
|
|
1057
1023
|
return resolveProviderTransportDecision({
|
|
1058
1024
|
agentConfig: { key: "default-platform" },
|
|
@@ -1070,7 +1036,7 @@ function shouldUsePlatformChatProvider(env, agentConfig) {
|
|
|
1070
1036
|
}).transport === "proxy";
|
|
1071
1037
|
}
|
|
1072
1038
|
function describePlatformRequestBudget(args) {
|
|
1073
|
-
const request =
|
|
1039
|
+
const request = buildPlatformChatCompletionRequest2({ ...args, messages: [] });
|
|
1074
1040
|
const body = JSON.parse(request.init.body);
|
|
1075
1041
|
return {
|
|
1076
1042
|
toolSchemaTokens: estimateTokenCount(JSON.stringify(body.tools ?? [])),
|
|
@@ -1078,24 +1044,4 @@ function describePlatformRequestBudget(args) {
|
|
|
1078
1044
|
};
|
|
1079
1045
|
}
|
|
1080
1046
|
|
|
1081
|
-
export {
|
|
1082
|
-
throwIfChatCompletionStreamFailed,
|
|
1083
|
-
applyChatCompletionDelta,
|
|
1084
|
-
flushChatCompletionStream,
|
|
1085
|
-
providerHttpFailure,
|
|
1086
|
-
readSseFrames,
|
|
1087
|
-
readSseDataValues,
|
|
1088
|
-
createResponsesToolAccumulator,
|
|
1089
|
-
applyResponsesToolEvent,
|
|
1090
|
-
finalizeResponsesToolCalls,
|
|
1091
|
-
PlatformStreamInterruptedError,
|
|
1092
|
-
resolvePlatformChatProviderConfig,
|
|
1093
|
-
buildPlatformChatCompletionRequest,
|
|
1094
|
-
parsePlatformChatCompletionData,
|
|
1095
|
-
parsePlatformChatCompletionResponse,
|
|
1096
|
-
readPlatformChatSseCompletion,
|
|
1097
|
-
canUsePlatformChatProvider2 as canUsePlatformChatProvider,
|
|
1098
|
-
hasDirectOpenAiCompatibleProvider2 as hasDirectOpenAiCompatibleProvider,
|
|
1099
|
-
shouldUsePlatformChatProvider,
|
|
1100
|
-
describePlatformRequestBudget
|
|
1101
|
-
};
|
|
1047
|
+
export { throwIfChatCompletionStreamFailed, applyChatCompletionDelta, flushChatCompletionStream, providerHttpFailure, readSseFrames, readSseDataValues, createResponsesToolAccumulator, applyResponsesToolEvent, finalizeResponsesToolCalls, PlatformStreamInterruptedError, resolvePlatformChatProviderConfig2, buildPlatformChatCompletionRequest2, parsePlatformChatCompletionData2, parsePlatformChatCompletionResponse2, readPlatformChatSseCompletion2, canUsePlatformChatProvider, hasDirectOpenAiCompatibleProvider, shouldUsePlatformChatProvider2, describePlatformRequestBudget };
|