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
package/chunk-ZV7ZY46L.js
DELETED
|
@@ -1,1343 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
MCP_CALL_TOOL_INPUT_SCHEMA,
|
|
3
|
-
MCP_LIST_TOOLS_INPUT_SCHEMA
|
|
4
|
-
} from "./chunk-CA7LGAHV.js";
|
|
5
|
-
import {
|
|
6
|
-
asRecordOrEmpty
|
|
7
|
-
} from "./chunk-KX6YBIHG.js";
|
|
8
|
-
import {
|
|
9
|
-
MODEL_TIER_GUIDANCE
|
|
10
|
-
} from "./chunk-HEVRQGGH.js";
|
|
11
|
-
import {
|
|
12
|
-
ownedAgentKey,
|
|
13
|
-
publicAgentKey
|
|
14
|
-
} from "./chunk-M2EJHDJP.js";
|
|
15
|
-
import {
|
|
16
|
-
isRecord
|
|
17
|
-
} from "./chunk-KUG52IAP.js";
|
|
18
|
-
import {
|
|
19
|
-
dialogIdFromKey,
|
|
20
|
-
isSupportedDialogId,
|
|
21
|
-
parseDialogPathIdentity,
|
|
22
|
-
splitDialogKeyIdentity
|
|
23
|
-
} from "./chunk-YZMNK53S.js";
|
|
24
|
-
import {
|
|
25
|
-
asNonEmptyStringArray
|
|
26
|
-
} from "./chunk-I42VC5KR.js";
|
|
27
|
-
import {
|
|
28
|
-
asOptionalFiniteNumber
|
|
29
|
-
} from "./chunk-WWC7I6TA.js";
|
|
30
|
-
import {
|
|
31
|
-
asOptionalTrimmedString
|
|
32
|
-
} from "./chunk-G3SUCT4W.js";
|
|
33
|
-
|
|
34
|
-
// packages/core/listAgentsKeys.ts
|
|
35
|
-
var MAX_LIST_AGENTS_KEYS = 20;
|
|
36
|
-
var LIST_AGENTS_KEYS_SCHEMA = {
|
|
37
|
-
type: "array",
|
|
38
|
-
items: { type: "string" },
|
|
39
|
-
maxItems: MAX_LIST_AGENTS_KEYS,
|
|
40
|
-
description: "Exact agentKeys for rechecking known candidates only (deduplicated; a nonempty list must contain a non-blank key). Not a first full-pool scan: poolComplete is false."
|
|
41
|
-
};
|
|
42
|
-
function normalizeListAgentsKeys(value) {
|
|
43
|
-
if (value === void 0) return [];
|
|
44
|
-
if (!Array.isArray(value)) throw new Error("agentKeys must be an array of strings.");
|
|
45
|
-
if (value.length > MAX_LIST_AGENTS_KEYS) throw new Error(`agentKeys supports at most ${MAX_LIST_AGENTS_KEYS} entries.`);
|
|
46
|
-
const keys = /* @__PURE__ */ new Set();
|
|
47
|
-
for (const key of value) {
|
|
48
|
-
if (typeof key !== "string") throw new Error("agentKeys must be an array of strings.");
|
|
49
|
-
if (key.trim()) keys.add(key);
|
|
50
|
-
}
|
|
51
|
-
if (value.length && !keys.size) throw new Error("agentKeys must include at least one non-blank key when provided as a nonempty array.");
|
|
52
|
-
return [...keys];
|
|
53
|
-
}
|
|
54
|
-
function createListAgentsKeyMatcher(keys) {
|
|
55
|
-
const exact = new Set(keys);
|
|
56
|
-
return (agent) => !exact.size || agent.agentKey !== void 0 && exact.has(agent.agentKey);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
// packages/agent-runtime/dialogReadProjection.ts
|
|
60
|
-
var DEFAULT_READ_DIALOG_MAX_RESPONSE_CHARS = 32e3;
|
|
61
|
-
var MIN_RESPONSE_BUDGET_CHARS = 1024;
|
|
62
|
-
var DEFAULT_MAX_MESSAGE_CHARS = 8e3;
|
|
63
|
-
var DEFAULT_MAX_FIELD_CHARS = 2e3;
|
|
64
|
-
var DEFAULT_MAX_META_CHARS = 6e3;
|
|
65
|
-
var MAX_TOOL_CALLS_PER_PROJECTED_MESSAGE = 20;
|
|
66
|
-
var MAX_CONTENT_PARTS_PER_PROJECTED_MESSAGE = 40;
|
|
67
|
-
var ESTIMATE_MAX_DEPTH = 12;
|
|
68
|
-
var HARD_CAP_MAX_ITERATIONS = 64;
|
|
69
|
-
var FIELD_TRUNCATION_MARKER = "\u2026[truncated";
|
|
70
|
-
function resolveBudget(options) {
|
|
71
|
-
const positive = (value, fallback) => typeof value === "number" && Number.isFinite(value) && value > 0 ? Math.floor(value) : fallback;
|
|
72
|
-
const maxResponseChars = Math.max(
|
|
73
|
-
MIN_RESPONSE_BUDGET_CHARS,
|
|
74
|
-
positive(options?.maxResponseChars, DEFAULT_READ_DIALOG_MAX_RESPONSE_CHARS)
|
|
75
|
-
);
|
|
76
|
-
return {
|
|
77
|
-
maxResponseChars,
|
|
78
|
-
maxMessageChars: Math.min(
|
|
79
|
-
positive(options?.maxMessageChars, DEFAULT_MAX_MESSAGE_CHARS),
|
|
80
|
-
maxResponseChars
|
|
81
|
-
),
|
|
82
|
-
maxFieldChars: positive(options?.maxFieldChars, DEFAULT_MAX_FIELD_CHARS),
|
|
83
|
-
maxMetaChars: positive(options?.maxMetaChars, DEFAULT_MAX_META_CHARS),
|
|
84
|
-
maxMessages: options?.maxMessages
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
function estimateJsonChars(value, depth = 0) {
|
|
88
|
-
if (value === null || value === void 0) return 4;
|
|
89
|
-
const type = typeof value;
|
|
90
|
-
if (type === "string") return value.length + 2;
|
|
91
|
-
if (type === "number") {
|
|
92
|
-
const text = String(value);
|
|
93
|
-
return text.length > 0 ? text.length : 1;
|
|
94
|
-
}
|
|
95
|
-
if (type === "boolean") return value ? 4 : 5;
|
|
96
|
-
if (type !== "object") return 8;
|
|
97
|
-
if (depth >= ESTIMATE_MAX_DEPTH) return 16;
|
|
98
|
-
if (Array.isArray(value)) {
|
|
99
|
-
let total2 = 2;
|
|
100
|
-
for (const item of value) total2 += estimateJsonChars(item, depth + 1) + 1;
|
|
101
|
-
return total2;
|
|
102
|
-
}
|
|
103
|
-
let total = 2;
|
|
104
|
-
for (const [key, item] of Object.entries(value)) {
|
|
105
|
-
total += key.length + 4 + estimateJsonChars(item, depth + 1);
|
|
106
|
-
}
|
|
107
|
-
return total;
|
|
108
|
-
}
|
|
109
|
-
function truncateHead(text, maxChars) {
|
|
110
|
-
if (text.length <= maxChars) return text;
|
|
111
|
-
return `${text.slice(0, Math.max(1, maxChars))}${FIELD_TRUNCATION_MARKER} +${text.length - maxChars} chars]`;
|
|
112
|
-
}
|
|
113
|
-
function boundValueDeep(value, maxFieldChars, depth = 0) {
|
|
114
|
-
if (typeof value === "string") return truncateHead(value, maxFieldChars);
|
|
115
|
-
if (value === null || value === void 0) return value;
|
|
116
|
-
if (typeof value !== "object") return value;
|
|
117
|
-
if (depth >= ESTIMATE_MAX_DEPTH) return FIELD_TRUNCATION_MARKER + " depth]";
|
|
118
|
-
if (Array.isArray(value)) {
|
|
119
|
-
return value.map((item) => boundValueDeep(item, maxFieldChars, depth + 1));
|
|
120
|
-
}
|
|
121
|
-
const out = {};
|
|
122
|
-
for (const [key, item] of Object.entries(value)) {
|
|
123
|
-
out[key] = boundValueDeep(item, maxFieldChars, depth + 1);
|
|
124
|
-
}
|
|
125
|
-
return out;
|
|
126
|
-
}
|
|
127
|
-
function projectMeta(meta, maxMetaChars) {
|
|
128
|
-
const originalChars = estimateJsonChars(meta);
|
|
129
|
-
if (originalChars <= maxMetaChars) {
|
|
130
|
-
return { meta, truncated: false, originalChars, returnedChars: originalChars };
|
|
131
|
-
}
|
|
132
|
-
const bounded = boundValueDeep(meta, Math.min(DEFAULT_MAX_FIELD_CHARS, maxMetaChars));
|
|
133
|
-
const returnedChars = estimateJsonChars(bounded);
|
|
134
|
-
if (returnedChars <= maxMetaChars) {
|
|
135
|
-
return { meta: bounded, truncated: true, originalChars, returnedChars };
|
|
136
|
-
}
|
|
137
|
-
return {
|
|
138
|
-
meta: { projectionTruncated: true, estimatedOriginalChars: originalChars },
|
|
139
|
-
truncated: true,
|
|
140
|
-
originalChars,
|
|
141
|
-
returnedChars: estimateJsonChars({ projectionTruncated: true, estimatedOriginalChars: originalChars })
|
|
142
|
-
};
|
|
143
|
-
}
|
|
144
|
-
function projectDialogMetaForAgent(meta, options) {
|
|
145
|
-
const budget = resolveBudget(options);
|
|
146
|
-
const maxMetaChars = Math.min(budget.maxMetaChars, Math.floor(budget.maxResponseChars / 2));
|
|
147
|
-
const projected = projectMeta(meta, maxMetaChars);
|
|
148
|
-
return { meta: projected.meta, truncated: projected.truncated };
|
|
149
|
-
}
|
|
150
|
-
function asRecord(message) {
|
|
151
|
-
return message && typeof message === "object" ? { ...message } : { value: message };
|
|
152
|
-
}
|
|
153
|
-
function buildEnvelopeStub(src, originalChars) {
|
|
154
|
-
return {
|
|
155
|
-
role: src.role ?? src.authorRole ?? null,
|
|
156
|
-
...typeof src.id === "string" ? { id: src.id } : {},
|
|
157
|
-
...typeof src.createdAt === "string" ? { createdAt: src.createdAt } : {},
|
|
158
|
-
projectionTruncated: true,
|
|
159
|
-
estimatedOriginalChars: originalChars
|
|
160
|
-
};
|
|
161
|
-
}
|
|
162
|
-
function projectDialogMessage(message, budget) {
|
|
163
|
-
const originalChars = estimateJsonChars(message);
|
|
164
|
-
if (originalChars <= budget.maxMessageChars) {
|
|
165
|
-
return { message, originalChars, returnedChars: originalChars, projected: false };
|
|
166
|
-
}
|
|
167
|
-
const out = asRecord(message);
|
|
168
|
-
const src = message && typeof message === "object" ? message : out;
|
|
169
|
-
let projected = false;
|
|
170
|
-
let contentPartsTotal;
|
|
171
|
-
let contentPartsReturned;
|
|
172
|
-
let toolCallsTotal;
|
|
173
|
-
let toolCallsReturned;
|
|
174
|
-
if (typeof src.content === "string") {
|
|
175
|
-
const bounded = truncateHead(src.content, budget.maxFieldChars);
|
|
176
|
-
if (bounded !== src.content) {
|
|
177
|
-
out.content = bounded;
|
|
178
|
-
projected = true;
|
|
179
|
-
}
|
|
180
|
-
} else if (Array.isArray(src.content)) {
|
|
181
|
-
const total = src.content.length;
|
|
182
|
-
if (total > MAX_CONTENT_PARTS_PER_PROJECTED_MESSAGE) {
|
|
183
|
-
out.content = [
|
|
184
|
-
...src.content.slice(0, MAX_CONTENT_PARTS_PER_PROJECTED_MESSAGE).map((part) => boundValueDeep(part, budget.maxFieldChars)),
|
|
185
|
-
// 合法 typed text part:不得向 content 数组混入裸字符串标记。
|
|
186
|
-
{ type: "text", text: `${FIELD_TRUNCATION_MARKER} +${total - MAX_CONTENT_PARTS_PER_PROJECTED_MESSAGE} content parts]` }
|
|
187
|
-
];
|
|
188
|
-
contentPartsTotal = total;
|
|
189
|
-
contentPartsReturned = MAX_CONTENT_PARTS_PER_PROJECTED_MESSAGE;
|
|
190
|
-
projected = true;
|
|
191
|
-
} else {
|
|
192
|
-
const boundedParts = src.content.map((part) => boundValueDeep(part, budget.maxFieldChars));
|
|
193
|
-
if (estimateJsonChars(boundedParts) < estimateJsonChars(src.content)) {
|
|
194
|
-
out.content = boundedParts;
|
|
195
|
-
projected = true;
|
|
196
|
-
contentPartsTotal = total;
|
|
197
|
-
contentPartsReturned = total;
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
if (typeof src.reasoning_content === "string") {
|
|
202
|
-
const bounded = truncateHead(src.reasoning_content, budget.maxFieldChars);
|
|
203
|
-
if (bounded !== src.reasoning_content) {
|
|
204
|
-
out.reasoning_content = bounded;
|
|
205
|
-
projected = true;
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
if (Array.isArray(src.tool_calls)) {
|
|
209
|
-
const total = src.tool_calls.length;
|
|
210
|
-
let calls = src.tool_calls;
|
|
211
|
-
if (total > MAX_TOOL_CALLS_PER_PROJECTED_MESSAGE) {
|
|
212
|
-
calls = calls.slice(0, MAX_TOOL_CALLS_PER_PROJECTED_MESSAGE);
|
|
213
|
-
toolCallsTotal = total;
|
|
214
|
-
toolCallsReturned = MAX_TOOL_CALLS_PER_PROJECTED_MESSAGE;
|
|
215
|
-
projected = true;
|
|
216
|
-
}
|
|
217
|
-
const boundedCalls = calls.map((call) => {
|
|
218
|
-
if (!call || typeof call !== "object" || Array.isArray(call)) {
|
|
219
|
-
return call;
|
|
220
|
-
}
|
|
221
|
-
const next = { ...call };
|
|
222
|
-
if (next.function && typeof next.function === "object" && !Array.isArray(next.function)) {
|
|
223
|
-
next.function = { ...next.function };
|
|
224
|
-
if (typeof next.function.arguments === "string") {
|
|
225
|
-
next.function.arguments = truncateHead(
|
|
226
|
-
next.function.arguments,
|
|
227
|
-
budget.maxFieldChars
|
|
228
|
-
);
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
return next;
|
|
232
|
-
});
|
|
233
|
-
if (estimateJsonChars(boundedCalls) < estimateJsonChars(src.tool_calls)) {
|
|
234
|
-
out.tool_calls = boundedCalls;
|
|
235
|
-
projected = true;
|
|
236
|
-
if (toolCallsReturned === void 0) {
|
|
237
|
-
toolCallsTotal = total;
|
|
238
|
-
toolCallsReturned = total;
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
for (const key of ["tool_result_metadata", "metadata"]) {
|
|
243
|
-
const value = src[key];
|
|
244
|
-
if (value && typeof value === "object") {
|
|
245
|
-
const bounded = boundValueDeep(value, budget.maxFieldChars);
|
|
246
|
-
if (estimateJsonChars(bounded) < estimateJsonChars(value)) {
|
|
247
|
-
out[key] = bounded;
|
|
248
|
-
projected = true;
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
let returnedChars = estimateJsonChars(out);
|
|
253
|
-
const stubThreshold = Math.max(
|
|
254
|
-
Math.floor(budget.maxMessageChars * 1.15),
|
|
255
|
-
budget.maxFieldChars
|
|
256
|
-
);
|
|
257
|
-
if (returnedChars > stubThreshold) {
|
|
258
|
-
const stub = buildEnvelopeStub(src, originalChars);
|
|
259
|
-
const stubChars = estimateJsonChars(stub);
|
|
260
|
-
if (stubChars < returnedChars) {
|
|
261
|
-
return {
|
|
262
|
-
message: stub,
|
|
263
|
-
originalChars,
|
|
264
|
-
returnedChars: stubChars,
|
|
265
|
-
projected: true
|
|
266
|
-
};
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
if (projected) {
|
|
270
|
-
out.projection = {
|
|
271
|
-
truncated: true,
|
|
272
|
-
originalChars,
|
|
273
|
-
returnedChars,
|
|
274
|
-
...contentPartsTotal !== void 0 ? { contentPartsTotal, contentPartsReturned } : {},
|
|
275
|
-
...toolCallsTotal !== void 0 ? { toolCallsTotal, toolCallsReturned } : {}
|
|
276
|
-
};
|
|
277
|
-
returnedChars = estimateJsonChars(out);
|
|
278
|
-
}
|
|
279
|
-
return { message: out, originalChars, returnedChars, projected };
|
|
280
|
-
}
|
|
281
|
-
var CONTINUATION_HINT = 'To continue safely: re-run readDialog with a smaller limit, or use mode="status" for meta + runtimeCheckpoint only. Oversized messages keep head slices of content/reasoning_content/tool_calls with per-message projection stats.';
|
|
282
|
-
function buildStats(args) {
|
|
283
|
-
return {
|
|
284
|
-
truncated: args.truncated,
|
|
285
|
-
messagesTotal: args.total,
|
|
286
|
-
messagesTotalKnown: args.totalKnown ?? true,
|
|
287
|
-
messagesReturned: args.returned,
|
|
288
|
-
estimatedOriginalChars: args.estimatedOriginalChars,
|
|
289
|
-
estimatedReturnedChars: args.estimatedReturnedChars,
|
|
290
|
-
omittedChars: Math.max(0, args.estimatedOriginalChars - args.estimatedReturnedChars),
|
|
291
|
-
continuation: args.truncated ? CONTINUATION_HINT : ""
|
|
292
|
-
};
|
|
293
|
-
}
|
|
294
|
-
function projectDialogReadForAgent(args) {
|
|
295
|
-
const budget = resolveBudget(args.options);
|
|
296
|
-
const messages = Array.isArray(args.messages) ? args.messages : [];
|
|
297
|
-
const maxMetaChars = Math.min(budget.maxMetaChars, Math.floor(budget.maxResponseChars / 2));
|
|
298
|
-
const metaProjection = projectMeta(args.meta, maxMetaChars);
|
|
299
|
-
const messagesOverhead = 64;
|
|
300
|
-
const envelopeOverhead = Math.min(1024, Math.max(256, Math.floor(budget.maxResponseChars / 8)));
|
|
301
|
-
const statsOverhead = estimateJsonChars({
|
|
302
|
-
truncated: true,
|
|
303
|
-
messagesTotal: messages.length,
|
|
304
|
-
messagesReturned: messages.length,
|
|
305
|
-
estimatedOriginalChars: 88888888,
|
|
306
|
-
estimatedReturnedChars: 88888888,
|
|
307
|
-
omittedChars: 88888888,
|
|
308
|
-
continuation: CONTINUATION_HINT
|
|
309
|
-
});
|
|
310
|
-
const budgetForMessages = Math.max(
|
|
311
|
-
budget.maxResponseChars - metaProjection.returnedChars - messagesOverhead - statsOverhead - envelopeOverhead,
|
|
312
|
-
128
|
|
313
|
-
);
|
|
314
|
-
const kept = [];
|
|
315
|
-
let estimatedOriginalChars = metaProjection.originalChars;
|
|
316
|
-
let returnedChars = metaProjection.returnedChars + messagesOverhead;
|
|
317
|
-
let anyProjected = false;
|
|
318
|
-
let index = messages.length;
|
|
319
|
-
while (index > 0) {
|
|
320
|
-
const message = messages[index - 1];
|
|
321
|
-
const projectedMessage = projectDialogMessage(message, budget);
|
|
322
|
-
estimatedOriginalChars += projectedMessage.originalChars + 1;
|
|
323
|
-
if (returnedChars + projectedMessage.returnedChars <= budgetForMessages) {
|
|
324
|
-
kept.push(projectedMessage);
|
|
325
|
-
returnedChars += projectedMessage.returnedChars + 1;
|
|
326
|
-
anyProjected = anyProjected || projectedMessage.projected;
|
|
327
|
-
index -= 1;
|
|
328
|
-
continue;
|
|
329
|
-
}
|
|
330
|
-
index -= 1;
|
|
331
|
-
while (index > 0) {
|
|
332
|
-
index -= 1;
|
|
333
|
-
estimatedOriginalChars += estimateJsonChars(messages[index]) + 1;
|
|
334
|
-
}
|
|
335
|
-
break;
|
|
336
|
-
}
|
|
337
|
-
while (index > 1) {
|
|
338
|
-
index -= 1;
|
|
339
|
-
estimatedOriginalChars += estimateJsonChars(messages[index - 1]) + 1;
|
|
340
|
-
}
|
|
341
|
-
if (kept.length === 0 && messages.length > 0) {
|
|
342
|
-
const newest = messages[messages.length - 1];
|
|
343
|
-
let projectedMessage = projectDialogMessage(newest, budget);
|
|
344
|
-
if (projectedMessage.returnedChars + returnedChars > budgetForMessages) {
|
|
345
|
-
const stub = buildEnvelopeStub(
|
|
346
|
-
newest && typeof newest === "object" ? newest : { value: newest },
|
|
347
|
-
projectedMessage.originalChars
|
|
348
|
-
);
|
|
349
|
-
projectedMessage = {
|
|
350
|
-
message: stub,
|
|
351
|
-
originalChars: projectedMessage.originalChars,
|
|
352
|
-
returnedChars: estimateJsonChars(stub),
|
|
353
|
-
projected: true
|
|
354
|
-
};
|
|
355
|
-
}
|
|
356
|
-
kept.push(projectedMessage);
|
|
357
|
-
returnedChars += projectedMessage.returnedChars + 1;
|
|
358
|
-
anyProjected = true;
|
|
359
|
-
}
|
|
360
|
-
kept.reverse();
|
|
361
|
-
const truncated = metaProjection.truncated || anyProjected || kept.length < messages.length;
|
|
362
|
-
let stats = buildStats({
|
|
363
|
-
truncated,
|
|
364
|
-
total: messages.length,
|
|
365
|
-
returned: kept.length,
|
|
366
|
-
estimatedOriginalChars,
|
|
367
|
-
estimatedReturnedChars: returnedChars + estimateJsonChars({
|
|
368
|
-
truncated,
|
|
369
|
-
messagesTotal: messages.length,
|
|
370
|
-
messagesReturned: kept.length,
|
|
371
|
-
estimatedOriginalChars,
|
|
372
|
-
estimatedReturnedChars: returnedChars,
|
|
373
|
-
omittedChars: Math.max(0, estimatedOriginalChars - returnedChars),
|
|
374
|
-
continuation: truncated ? CONTINUATION_HINT : ""
|
|
375
|
-
})
|
|
376
|
-
});
|
|
377
|
-
let result = { meta: metaProjection.meta, messages: kept.map((e) => e.message), stats };
|
|
378
|
-
let guard = HARD_CAP_MAX_ITERATIONS;
|
|
379
|
-
while (JSON.stringify(result).length > budget.maxResponseChars && kept.length > 0 && guard-- > 0) {
|
|
380
|
-
kept.shift();
|
|
381
|
-
stats = buildStats({
|
|
382
|
-
truncated: true,
|
|
383
|
-
total: messages.length,
|
|
384
|
-
returned: kept.length,
|
|
385
|
-
estimatedOriginalChars,
|
|
386
|
-
estimatedReturnedChars: returnedChars
|
|
387
|
-
});
|
|
388
|
-
result = { meta: metaProjection.meta, messages: kept.map((e) => e.message), stats };
|
|
389
|
-
}
|
|
390
|
-
if (JSON.stringify(result).length > budget.maxResponseChars) {
|
|
391
|
-
const miniMeta = metaProjection.truncated ? metaProjection.meta : { projectionTruncated: true, estimatedOriginalChars: metaProjection.originalChars };
|
|
392
|
-
result = {
|
|
393
|
-
meta: miniMeta,
|
|
394
|
-
messages: [],
|
|
395
|
-
stats: { ...stats, continuation: "", messagesReturned: 0 }
|
|
396
|
-
};
|
|
397
|
-
if (JSON.stringify(result).length > budget.maxResponseChars) {
|
|
398
|
-
result = {
|
|
399
|
-
meta: { projectionTruncated: true },
|
|
400
|
-
messages: [],
|
|
401
|
-
stats: { ...stats, continuation: "", messagesReturned: 0 }
|
|
402
|
-
};
|
|
403
|
-
}
|
|
404
|
-
}
|
|
405
|
-
return result;
|
|
406
|
-
}
|
|
407
|
-
function createStreamingDialogReadProjector(options) {
|
|
408
|
-
const budget = resolveBudget(options);
|
|
409
|
-
const maxMetaChars = Math.min(budget.maxMetaChars, Math.floor(budget.maxResponseChars / 2));
|
|
410
|
-
const limit = typeof budget.maxMessages === "number" && budget.maxMessages > 0 ? Math.floor(budget.maxMessages) : void 0;
|
|
411
|
-
const kept = [];
|
|
412
|
-
let totalSeen = 0;
|
|
413
|
-
let totalOriginalChars = 0;
|
|
414
|
-
let keptChars = 0;
|
|
415
|
-
let anyProjected = false;
|
|
416
|
-
const evictOldest = () => {
|
|
417
|
-
const evicted = kept.shift();
|
|
418
|
-
if (evicted) keptChars -= evicted.returnedChars + 1;
|
|
419
|
-
};
|
|
420
|
-
return {
|
|
421
|
-
addMessage(message) {
|
|
422
|
-
totalSeen += 1;
|
|
423
|
-
const projectedMessage = projectDialogMessage(message, budget);
|
|
424
|
-
totalOriginalChars += projectedMessage.originalChars + 1;
|
|
425
|
-
kept.push({
|
|
426
|
-
message: projectedMessage.message,
|
|
427
|
-
returnedChars: projectedMessage.returnedChars,
|
|
428
|
-
originalChars: projectedMessage.originalChars,
|
|
429
|
-
projected: projectedMessage.projected
|
|
430
|
-
});
|
|
431
|
-
keptChars += projectedMessage.returnedChars + 1;
|
|
432
|
-
anyProjected = anyProjected || projectedMessage.projected;
|
|
433
|
-
while (limit !== void 0 && kept.length > limit) evictOldest();
|
|
434
|
-
const messagesBudget = budget.maxResponseChars - Math.floor(budget.maxResponseChars / 4);
|
|
435
|
-
while (keptChars > messagesBudget && kept.length > 1) evictOldest();
|
|
436
|
-
if (keptChars > messagesBudget && kept.length === 1) {
|
|
437
|
-
const only = kept[0];
|
|
438
|
-
const stubSource = only.message && typeof only.message === "object" ? only.message : { value: only.message };
|
|
439
|
-
const stub = buildEnvelopeStub(stubSource, only.originalChars);
|
|
440
|
-
const stubChars = estimateJsonChars(stub);
|
|
441
|
-
if (stubChars < only.returnedChars) {
|
|
442
|
-
keptChars -= only.returnedChars;
|
|
443
|
-
kept[0] = { message: stub, returnedChars: stubChars, originalChars: only.originalChars, projected: true };
|
|
444
|
-
keptChars += stubChars;
|
|
445
|
-
anyProjected = true;
|
|
446
|
-
}
|
|
447
|
-
}
|
|
448
|
-
},
|
|
449
|
-
finish(meta) {
|
|
450
|
-
const metaProjection = projectMeta(meta, maxMetaChars);
|
|
451
|
-
const estimatedOriginalChars = metaProjection.originalChars + totalOriginalChars;
|
|
452
|
-
const keptProjected = anyProjected || kept.some((entry) => entry.projected);
|
|
453
|
-
const truncated = metaProjection.truncated || keptProjected || totalSeen > kept.length;
|
|
454
|
-
const estimatedReturnedChars = metaProjection.returnedChars + keptChars + 64;
|
|
455
|
-
let stats = buildStats({
|
|
456
|
-
truncated,
|
|
457
|
-
total: totalSeen,
|
|
458
|
-
returned: kept.length,
|
|
459
|
-
estimatedOriginalChars,
|
|
460
|
-
estimatedReturnedChars
|
|
461
|
-
});
|
|
462
|
-
let result = { meta: metaProjection.meta, messages: kept.map((e) => e.message), stats };
|
|
463
|
-
let guard = HARD_CAP_MAX_ITERATIONS;
|
|
464
|
-
while (JSON.stringify(result).length > budget.maxResponseChars && kept.length > 0 && guard-- > 0) {
|
|
465
|
-
const evicted = kept.shift();
|
|
466
|
-
if (evicted) keptChars -= evicted.returnedChars + 1;
|
|
467
|
-
stats = buildStats({
|
|
468
|
-
truncated: true,
|
|
469
|
-
total: totalSeen,
|
|
470
|
-
returned: kept.length,
|
|
471
|
-
estimatedOriginalChars,
|
|
472
|
-
estimatedReturnedChars: metaProjection.returnedChars + keptChars + 64
|
|
473
|
-
});
|
|
474
|
-
result = { meta: metaProjection.meta, messages: kept.map((e) => e.message), stats };
|
|
475
|
-
}
|
|
476
|
-
if (JSON.stringify(result).length > budget.maxResponseChars) {
|
|
477
|
-
result = {
|
|
478
|
-
meta: metaProjection.truncated ? metaProjection.meta : { projectionTruncated: true, estimatedOriginalChars: metaProjection.originalChars },
|
|
479
|
-
messages: [],
|
|
480
|
-
stats: { ...stats, continuation: "", messagesReturned: 0 }
|
|
481
|
-
};
|
|
482
|
-
if (JSON.stringify(result).length > budget.maxResponseChars) {
|
|
483
|
-
result = {
|
|
484
|
-
meta: { projectionTruncated: true },
|
|
485
|
-
messages: [],
|
|
486
|
-
stats: { ...stats, continuation: "", messagesReturned: 0 }
|
|
487
|
-
};
|
|
488
|
-
}
|
|
489
|
-
}
|
|
490
|
-
return result;
|
|
491
|
-
}
|
|
492
|
-
};
|
|
493
|
-
}
|
|
494
|
-
function boundSummaryText(text, maxChars = 200) {
|
|
495
|
-
return truncateHead(text, maxChars);
|
|
496
|
-
}
|
|
497
|
-
function buildDialogReadEnvelope(args) {
|
|
498
|
-
const budget = resolveBudget(args.options);
|
|
499
|
-
let meta;
|
|
500
|
-
let messages;
|
|
501
|
-
let stats;
|
|
502
|
-
if (args.stats) {
|
|
503
|
-
meta = projectDialogMetaForAgent(args.meta, args.options).meta;
|
|
504
|
-
messages = Array.isArray(args.messages) ? args.messages : [];
|
|
505
|
-
stats = { ...args.stats };
|
|
506
|
-
} else {
|
|
507
|
-
const projected = projectDialogReadForAgent({
|
|
508
|
-
meta: args.meta,
|
|
509
|
-
messages: args.messages,
|
|
510
|
-
options: args.options
|
|
511
|
-
});
|
|
512
|
-
meta = projected.meta;
|
|
513
|
-
messages = projected.messages;
|
|
514
|
-
stats = projected.stats;
|
|
515
|
-
}
|
|
516
|
-
let extras = { ...args.envelope ?? {} };
|
|
517
|
-
let summary = { ...args.summary ?? {} };
|
|
518
|
-
let summaryDropped = false;
|
|
519
|
-
let hintDropped = false;
|
|
520
|
-
let metaStubbed = false;
|
|
521
|
-
let extrasDropped = false;
|
|
522
|
-
const assemble = () => {
|
|
523
|
-
stats = { ...stats, messagesReturned: messages.length };
|
|
524
|
-
if (Object.prototype.hasOwnProperty.call(extras, "messagesCount")) {
|
|
525
|
-
extras = { ...extras, messagesCount: messages.length };
|
|
526
|
-
}
|
|
527
|
-
const env = { ...extras, ...stats, meta, messages };
|
|
528
|
-
if (Object.keys(summary).length > 0) env.summary = summary;
|
|
529
|
-
return env;
|
|
530
|
-
};
|
|
531
|
-
let envelope = assemble();
|
|
532
|
-
let serialized = JSON.stringify(envelope);
|
|
533
|
-
for (; ; ) {
|
|
534
|
-
if (serialized.length <= budget.maxResponseChars) break;
|
|
535
|
-
if (!summaryDropped && Object.keys(summary).length > 0) {
|
|
536
|
-
summary = {};
|
|
537
|
-
summaryDropped = true;
|
|
538
|
-
} else if (!hintDropped && stats.continuation) {
|
|
539
|
-
stats = { ...stats, continuation: "" };
|
|
540
|
-
hintDropped = true;
|
|
541
|
-
} else if (messages.length > 0) {
|
|
542
|
-
messages = messages.slice(1);
|
|
543
|
-
stats = { ...stats, messagesReturned: messages.length, truncated: true };
|
|
544
|
-
} else if (!metaStubbed) {
|
|
545
|
-
meta = { projectionTruncated: true };
|
|
546
|
-
metaStubbed = true;
|
|
547
|
-
} else if (!extrasDropped) {
|
|
548
|
-
extrasDropped = true;
|
|
549
|
-
const minimalExtras = {};
|
|
550
|
-
for (const key of ["source", "dialogId", "dialogKey"]) {
|
|
551
|
-
if (extras[key] !== void 0) minimalExtras[key] = extras[key];
|
|
552
|
-
}
|
|
553
|
-
extras = minimalExtras;
|
|
554
|
-
} else {
|
|
555
|
-
envelope = { projectionTruncated: true, messages: [] };
|
|
556
|
-
serialized = JSON.stringify(envelope);
|
|
557
|
-
break;
|
|
558
|
-
}
|
|
559
|
-
envelope = assemble();
|
|
560
|
-
serialized = JSON.stringify(envelope);
|
|
561
|
-
}
|
|
562
|
-
return {
|
|
563
|
-
envelope,
|
|
564
|
-
serialized,
|
|
565
|
-
maxResponseChars: budget.maxResponseChars,
|
|
566
|
-
withinBudget: serialized.length <= budget.maxResponseChars
|
|
567
|
-
};
|
|
568
|
-
}
|
|
569
|
-
var BRIDGE_STREAM_MAX_CHARS = 262144;
|
|
570
|
-
async function readTextStreamUpToChars(stream, maxChars) {
|
|
571
|
-
if (!stream) return { text: "", truncated: false };
|
|
572
|
-
const reader = stream.getReader();
|
|
573
|
-
const decoder = new TextDecoder();
|
|
574
|
-
let text = "";
|
|
575
|
-
let truncated = false;
|
|
576
|
-
for (; ; ) {
|
|
577
|
-
const { done, value } = await reader.read();
|
|
578
|
-
if (done) break;
|
|
579
|
-
if (value) text += decoder.decode(value, { stream: true });
|
|
580
|
-
if (text.length >= maxChars) {
|
|
581
|
-
truncated = true;
|
|
582
|
-
try {
|
|
583
|
-
await reader.cancel();
|
|
584
|
-
} catch {
|
|
585
|
-
}
|
|
586
|
-
break;
|
|
587
|
-
}
|
|
588
|
-
}
|
|
589
|
-
text += decoder.decode();
|
|
590
|
-
if (truncated) {
|
|
591
|
-
text += `
|
|
592
|
-
|
|
593
|
-
[bridged output truncated at ${maxChars} chars; narrow the request or use readDialog mode="status"]`;
|
|
594
|
-
}
|
|
595
|
-
return { text, truncated };
|
|
596
|
-
}
|
|
597
|
-
|
|
598
|
-
// packages/agent-runtime/agentRecordKeys.ts
|
|
599
|
-
function buildAgentRuntimeAgentLookupKeys(args) {
|
|
600
|
-
if (/^agent(-pub)?-/.test(args.agentRef)) {
|
|
601
|
-
return [args.agentRef];
|
|
602
|
-
}
|
|
603
|
-
return [
|
|
604
|
-
ownedAgentKey(args.userId, args.agentRef),
|
|
605
|
-
publicAgentKey(args.agentRef)
|
|
606
|
-
];
|
|
607
|
-
}
|
|
608
|
-
function shouldFetchAgentRuntimeRecordRemotely(dbKey) {
|
|
609
|
-
return /^agent(-pub)?-/.test(dbKey);
|
|
610
|
-
}
|
|
611
|
-
|
|
612
|
-
// packages/ai/agent/agentSelectionPriority.ts
|
|
613
|
-
function parseAgentTimestamp(value) {
|
|
614
|
-
if (typeof value === "number" && Number.isFinite(value)) return value;
|
|
615
|
-
if (typeof value === "string") {
|
|
616
|
-
const parsed = Date.parse(value);
|
|
617
|
-
if (Number.isFinite(parsed)) return parsed;
|
|
618
|
-
}
|
|
619
|
-
return 0;
|
|
620
|
-
}
|
|
621
|
-
function isUserConfiguredAgent(agent) {
|
|
622
|
-
return agent.isOAuth === true || agent.isOwned === true && agent.apiSource === "custom";
|
|
623
|
-
}
|
|
624
|
-
var AGENT_SELECTION_PRIORITY_GROUPS = [
|
|
625
|
-
{
|
|
626
|
-
description: "\u6536\u85CF\u7684 OAuth / \u81EA\u5B9A\u4E49 Agent\uFF08isFavorite=true \u4E14 (isOAuth=true \u6216 (isOwned=true \u4E14 apiSource=custom))\uFF09",
|
|
627
|
-
matches: (agent) => agent.isFavorite === true && isUserConfiguredAgent(agent)
|
|
628
|
-
},
|
|
629
|
-
{ description: "\u5176\u4ED6\u6536\u85CF Agent\uFF08isFavorite=true\uFF09", matches: (agent) => agent.isFavorite === true },
|
|
630
|
-
{
|
|
631
|
-
description: "\u672A\u6536\u85CF\u7684 OAuth / \u81EA\u5B9A\u4E49 Agent\uFF08isOAuth=true \u6216 (isOwned=true \u4E14 apiSource=custom)\uFF09",
|
|
632
|
-
matches: isUserConfiguredAgent
|
|
633
|
-
},
|
|
634
|
-
{ description: "\u5176\u4ED6\u81EA\u5EFA Agent\uFF08isOwned=true\uFF09", matches: (agent) => agent.isOwned === true },
|
|
635
|
-
{ description: "\u516C\u5F00 / \u5E73\u53F0 Agent\uFF08\u5176\u4F59\u5019\u9009\uFF1B\u4E0D\u662F\u8D39\u7528\u5224\u636E\uFF09", matches: () => true }
|
|
636
|
-
];
|
|
637
|
-
function resolveAgentSelectionPriority(agent) {
|
|
638
|
-
return AGENT_SELECTION_PRIORITY_GROUPS.findIndex((group) => group.matches(agent));
|
|
639
|
-
}
|
|
640
|
-
function compareAgentSelection(left, right) {
|
|
641
|
-
const priorityDiff = resolveAgentSelectionPriority(left) - resolveAgentSelectionPriority(right);
|
|
642
|
-
if (priorityDiff !== 0) return priorityDiff;
|
|
643
|
-
const leftFav = left.isFavorite === true;
|
|
644
|
-
const rightFav = right.isFavorite === true;
|
|
645
|
-
if (leftFav && rightFav) {
|
|
646
|
-
const leftFavAt = parseAgentTimestamp(left.favoritedAt);
|
|
647
|
-
const rightFavAt = parseAgentTimestamp(right.favoritedAt);
|
|
648
|
-
if (leftFavAt !== rightFavAt) return rightFavAt - leftFavAt;
|
|
649
|
-
}
|
|
650
|
-
const leftUpdated = parseAgentTimestamp(left.updatedAt ?? left.createdAt);
|
|
651
|
-
const rightUpdated = parseAgentTimestamp(right.updatedAt ?? right.createdAt);
|
|
652
|
-
return rightUpdated - leftUpdated;
|
|
653
|
-
}
|
|
654
|
-
var AGENT_SELECTION_PRIORITY_INSTRUCTIONS = ` - \u4F18\u5148\u7EA7\u5951\u7EA6\uFF1A\u9009\u4EBA\u5951\u7EA6\uFF08listAgents \u9ED8\u8BA4 scope="all"\uFF09\uFF1A
|
|
655
|
-
1. \u5019\u9009\u53D1\u73B0\uFF1A\u9ED8\u8BA4\u8C03\u7528 listAgents()\uFF08\u9ED8\u8BA4 scope="all"\uFF09\uFF0C\u4E00\u6B21\u626B\u63CF\u8986\u76D6\u6536\u85CF\u3001\u81EA\u6709\u3001OAuth \u8BA2\u9605\u3001\u81EA\u5B9A\u4E49 API\u3001\u672C\u5730\u4E0E\u516C\u5F00 Agent\u3002
|
|
656
|
-
2. \u8D39\u7528\u5F52\u5C5E\u4E0E\u6388\u6743\u89C1\u540C\u6CE8\u5165\u7684\u300C\u5E73\u53F0 Agent / \u5E73\u53F0\u79EF\u5206\u6263\u8D39\u786E\u8BA4\u786C\u95F8\u95E8\u300D\uFF1B\u4E0D\u4EE5\u5F52\u5C5E\u6807\u7B7E\u6539\u53D8\u4E0B\u9762\u7684\u5206\u7EC4\u3002
|
|
657
|
-
3. \u4F18\u5148\u7EA7\u6392\u5E8F\uFF08\u6309\u4EE5\u4E0B\u8C13\u8BCD\u9996\u6B21\u547D\u4E2D\u5206\u7EC4\uFF0C\u4E0E\u5217\u8868\u540C\u6E90\uFF09\uFF1A
|
|
658
|
-
${AGENT_SELECTION_PRIORITY_GROUPS.map((group, index) => ` (${index + 1}) ${group.description}`).join("\n")}
|
|
659
|
-
\u6B64\u6392\u5E8F\u662F\u5019\u9009\u4F18\u5148\u7EA7\u5206\u7EC4\uFF08\u4E0D\u662F\u6A21\u578B\u80FD\u529B tier\uFF09\uFF0C\u4E0D\u4EE3\u8868\u300C\u6392\u7B2C\u4E00\u7684\u5C31\u8BE5\u9009\u300D\uFF1B\u7ED3\u5408\u4E0B\u8FF0\u9886\u57DF\u5339\u914D\u3001\u6863\u4F4D\u53C2\u8003\u4E0E\u5F53\u6B21\u53EF\u7528\u6027\u6311\u9009\uFF08reviewer \u89C1\u300Creviewer \u9009\u4EBA\u300D\uFF09\u3002
|
|
660
|
-
- \u6536\u85CF\u4F18\u5148\u786C\u95E8\uFF08\u8986\u76D6\u9AD8\u590D\u6742\u5EA6\u6863\u6210\u672C\u95E8\uFF09\uFF1A\u5B58\u5728\u53EF\u7528\u4E14\u9002\u5408\u4EFB\u52A1\u3001requiresPaidApproval=false \u7684\u6536\u85CF\u5019\u9009\u65F6\uFF0C\u4E0D\u6539\u6D3E\u9700\u5E73\u53F0\u8D39\u7528\u786E\u8BA4\u7684\u5019\u9009\uFF1B\u53EA\u6709\u6536\u85CF Agent \u786E\u8BA4\u4E0D\u53EF\u7528\u540E\u624D\u5141\u8BB8\u6D3E\u5E73\u53F0 Agent\uFF0C\u4E14\u5F53\u6B21\u8BF4\u660E\u5E76\u83B7\u8D39\u7528\u6388\u6743\u3002favorite + platform_credits \u53EA\u8868\u793A\u504F\u597D\uFF0C\u4E0D\u4EE3\u8868\u514D\u8D39\u6216\u5DF2\u6388\u6743\uFF1B\u8D39\u7528\u5224\u636E\u89C1\u4E0A\u3002\u6BCF\u6B21 startAgentRun \u90FD\u521B\u5EFA\u72EC\u7ACB\u7684 run/dialog\uFF0C\u5E76\u884C\u7528\u5404\u81EA runId\u3001\u540C\u4E00 batchId\u3002
|
|
661
|
-
- \u5339\u914D\u53C2\u8003\uFF1A\u6309\u4EFB\u52A1\u6240\u9700\u80FD\u529B\u7B5B tools \u5B57\u6BB5\uFF1B\u540C\u6863\u5019\u9009\u4F18\u5148\u6210\u672C\u4F4E\uFF08\u4F4E inputPrice\uFF09\u6216\u8D70\u7528\u6237\u79C1\u6709\u51ED\u636E\u7684\u901A\u9053\u3002tools \u5B57\u6BB5\u53EA\u53CD\u6620\u989D\u5916\u80FD\u529B\uFF0C\u4E0D\u53CD\u6620 coding \u80FD\u529B\u2014\u2014\u4EE3\u7801\u5DE5\u5177\u7531 host \u81EA\u52A8\u6CE8\u5165\uFF0Ctools=[] \u4E0D\u4EE3\u8868\u4E0D\u80FD\u5199\u4EE3\u7801\uFF0C\u4E0D\u8981\u636E\u6B64\u6392\u9664\u5019\u9009\u3002
|
|
662
|
-
- reset-aware economics\uFF1A\u4F18\u5148\u53C2\u8003 listAgents \u6309\u8BA2\u9605\u91CD\u7F6E\u7A97\u53E3\u6216\u6309\u91CF\u5355\u4EF7\u8BA1\u7B97\u7684 tierHints\uFF0C\u4EC5\u4F5C\u540C\u6863\u3001\u53EF\u7528\u4E14\u65E0\u9700\u6263\u8D39\u786E\u8BA4\u7684\u7ECF\u6D4E\u504F\u597D\uFF1B\u4E0D\u8986\u76D6\u6536\u85CF\u786C\u95E8\u3001\u9886\u57DF\u80DC\u4EFB\u6216\u6263\u8D39\u6388\u6743\u3002
|
|
663
|
-
- isOwned=true\u3001isOAuth=true \u6216 apiSource="custom" \u4E0D\u8BC1\u660E\u8D39\u7528\u6388\u6743\u3002
|
|
664
|
-
- \u514D\u8BE2\u95EE\u8FB9\u754C\uFF08\u6307\u9488\uFF09\uFF1A\u6392\u5E8F\u540E\u4E0D\u4E3A\u300C\u9009\u8C01\u300D\u518D\u95EE\u7528\u6237\uFF1B\u4EC5\u5728 requiresPaidApproval=false \u7684\u5019\u9009\u95F4\u9759\u9ED8\u6362\u4EE3\uFF08\u4E0D\u5F97\u56E0\u6B64\u9759\u9ED8\u6539\u6D3E platform_credits \u5F52\u5C5E\u4E14\u9700\u786E\u8BA4\u7684\u901A\u9053\uFF09\u3002\u5E73\u53F0\u8D39\u7528\u6388\u6743\u3001429 \u6539\u6D3E\u544A\u77E5\u4E0E\u672A\u77E5\u8D39\u7528\u5148\u95EE\u7167\u65E7\uFF0C\u89C1\u540C\u6CE8\u5165\u5B89\u5168\u95E8\u3002
|
|
665
|
-
- \u89C4\u5212\u5373\u9009\u4EBA\uFF1A\u8DE8\u6863\u5199\u5177\u4F53 selectionReason\uFF08\u7528\u6237\u6307\u5B9A/\u9886\u57DF\u4F18\u52BF/\u771F\u5B9E\u901A\u9053\u5931\u8D25/\u65E0\u5408\u9002\u5019\u9009\u7B49\uFF09\uFF0C\u4FDD\u7559\u771F\u5B9E\u96BE\u5EA6\u3001\u4E0D\u6539\u5199 difficulty \u53BB\u8FC1\u5C31\u73B0\u6210\u901A\u9053\uFF1B\u53EA\u6821\u9A8C\u7406\u7531\u5B58\u5728\u3001\u4E0D\u4F2A\u79F0\u5DF2\u6838\u5B9E\u4E8B\u5B9E\uFF0C\u4E0D\u987B\u5148\u5236\u9020\u4F4E\u6863\u5931\u8D25\uFF0C\u4E5F\u4E0D\u4F5C\u4E3A\u963B\u65AD\u6216\u81EA\u52A8\u53D6\u6D88\u6D3E\u53D1\u7684\u6761\u4EF6\u3002
|
|
666
|
-
- \u9009\u4EBA\uFF08\u9886\u57DF\u5339\u914D\u4F18\u5148\u4E8E\u6863\u4F4D\uFF0C\u7528\u6237\u53EF\u8986\u76D6\uFF09\uFF1Adimension \u4E3A general\uFF08\u901A\u7528\uFF09/ design_frontend\uFF08\u8BBE\u8BA1\u524D\u7AEF\uFF09/ writing\uFF08\u5199\u4F5C\uFF09\uFF0C\u4E0D\u540C LLM \u5728\u4E0D\u540C\u9886\u57DF\u5404\u6709\u5F3A\u5F31\uFF0C\u4E0D\u662F\u5355\u7EAF\u5927\u5C0F\u6392\u5E8F\u3002\u5F53\u6B21\u7528\u6237\u70B9\u540D > \u7528\u6237\u8BB0\u5FC6\u4E2D\u7684\u5206\u5DE5/\u7981\u5FCC > \u8FD1\u671F\u540C\u7C7B\u4EFB\u52A1\u5931\u8D25\u8BC1\u636E\uFF1B\u660E\u786E\u4E0D\u9002\u914D\u624D\u6392\u9664\uFF0C\u7F3A\u8BC1\u636E\u4E0D\u7B49\u4E8E\u5F31\u3002
|
|
667
|
-
\u96BE\u5EA6\u6863\u5B9A\u4E49\u3001\u5224\u6863\u987A\u5E8F\u4E0E\u5347\u6863\u8FB9\u754C\u89C1\u540C\u6CE8\u5165\u7684\u300C\u5148\u5224\u6863\u518D\u9009\u6A21\u578B\u300D\uFF1Bdifficulty \u662F\u4EFB\u52A1\u96BE\u5EA6\uFF0C\u4E0D\u662F\u5019\u9009\u8D44\u683C\u786C\u95E8\u3002
|
|
668
|
-
\u80FD\u529B\u6863\u6620\u5C04\uFF08\u5171\u4EAB\u4EBA\u5DE5\u6620\u5C04\uFF0C\u552F\u4E00\u771F\u6E90 dispatchSelectionPolicy.ts\uFF09\uFF1A
|
|
669
|
-
${MODEL_TIER_GUIDANCE}
|
|
670
|
-
\u56FE\u50CF\u6A21\u578B\u53EA\u7528\u4E8E\u56FE\u50CF\u4EFB\u52A1\uFF0C\u4E0D\u7528\u4E8E\u4EE3\u7801 / \u6587\u672C\u4EFB\u52A1\u3002
|
|
671
|
-
\u6A21\u578B\u6863\u4F4D\u53EA\u53D6\u5171\u4EAB\u4EBA\u5DE5\u6620\u5C04\uFF1B\u672A\u77E5\u6A21\u578B\u4FDD\u6301 unknown \u4E14\u4ECD\u53EF\u7528\uFF0C\u4E0D\u7531 LLM \u81EA\u5C01\u6863\u4F4D\uFF0C\u4E0D\u9ED8\u8BA4\u9876\u6863\u3001\u4E0D\u5411\u7528\u6237\u7D22\u8981\u5B9A\u6863\u3002
|
|
672
|
-
\u9886\u57DF\u5177\u4F53\u504F\u597D\u4EC5\u9002\u7528\u4E8E\u5BF9\u5E94 dimension\uFF1Adesign_frontend\uFF08\u8BBE\u8BA1 / \u524D\u7AEF\uFF09\u9886\u57DF\u5185\u9ED8\u8BA4\u6A21\u578B\u5BB6\u65CF\u504F\u597D\u4E3A Claude \u2192 Gemini \u2192 GPT\uFF1B\u6309\u4EFB\u52A1 difficulty \u4E0E\u5171\u4EAB\u4EBA\u5DE5\u6A21\u578B\u6863\u4F4D\u6620\u5C04\uFF0C\u5728\u504F\u597D\u5BB6\u65CF\u4E2D\u9009\u80DC\u4EFB\u7684\u5408\u9002\u6863\u4F4D\uFF0C\u5BB6\u65CF\u987A\u5E8F\u4E0D\u4EE3\u8868\u667A\u80FD\u6863\u4F4D\u6392\u540D\u3002general\uFF08\u901A\u7528\uFF09\u4E0D\u9002\u7528\u6B64\u5BB6\u65CF\u987A\u5E8F\uFF1Bwriting\uFF08\u5199\u4F5C\uFF09\u4ECD\u4E3A Gemini \u4F18\u5148\u4E8E\u5176\u4ED6\u6A21\u578B\u3002\u672A\u77E5\u6863\u4F4D\u4FDD\u6301 unknown\uFF0C\u4E0D\u63A8\u5B9A\u5BB6\u65CF\u5185\u80FD\u529B\u6392\u540D\u3002\u5176\u4F59\u6A21\u578B\u5728\u5BF9\u5E94\u7EF4\u5EA6\u672A\u77E5\uFF0C\u4E0D\u63A8\u5B9A\u5B8C\u6574\u6392\u540D\u3002
|
|
673
|
-
\u540C\u6863\u53EF\u7528\u4E14\u65E0\u9700\u5E73\u53F0\u6263\u8D39\u65F6\uFF1A\u6DF1\u5EA6\u8BA1\u7B97\u673A\u7CFB\u7EDF/\u5B58\u50A8/\u5E76\u53D1/\u534F\u8BAE\u67B6\u6784\u8BF7\u6559\u4E0E\u65B9\u6848\u8FA8\u6790\u3001\u72EC\u7ACB\u5BA1\u67E5/\u5B89\u5168\u5951\u7EA6\u6311\u523A\u504F\u4E25\u82DB GPT\uFF1B\u524D\u7AEF\u8BBE\u8BA1/\u7CBE\u7EC6\u91CD\u6784\u504F Claude\uFF1B\u5168\u5C40\u7EDF\u7B79/\u957F\u4E0A\u4E0B\u6587\u4E32\u8054\u504F Gemini\u3002
|
|
674
|
-
\u9886\u57DF\u504F\u597D\u53EF\u4F5C\u4E3A\u8DE8\u6863\u9009\u62E9\u7406\u7531\uFF0C\u4E0D\u8868\u793A\u4E0D\u80FD\u6362\u6863\uFF1B\u504F\u597D\u4E0D\u8986\u76D6\u771F\u5B9E\u80FD\u529B\u9650\u5236\u3001\u8D39\u7528\u6388\u6743\u3001\u4F5C\u8005\u56DE\u907F\u4E0E\u5F53\u6B21\u53EF\u7528\u6027\uFF08\u9047\u963B\u8BF7\u6559\u4ECD\u4F18\u5148\u7EED\u539F\u89C4\u5212\u8005\uFF09\uFF0C\u4E0D\u5F97\u56E0\u4E3A\u300C\u8BBE\u8BA1\u4EFB\u52A1\u504F\u597D Opus\u300D\u5C31\u81EA\u52A8\u6D88\u8017\u5E73\u53F0\u79EF\u5206\u3002
|
|
675
|
-
\u5DE5\u5177\u4EC5\u5347 \u22652 \u6863\u987B\u5148\u6709 selectionReason\uFF0C\u5176\u4F59\u4E0D\u7B26\u53EA\u63D0\u9192\u3001\u7167\u5E38\u542F\u52A8\uFF0C\u4E0D\u5F3A\u5236\u9009\u4EBA\u3001\u4E0D\u81EA\u52A8\u53D6\u6D88\u91CD\u6D3E\uFF1B\u6D3E\u53D1 Agent \u81EA\u884C\u7ED3\u5408\u9886\u57DF\u4F18\u52BF\u3001\u771F\u5B9E\u989D\u5EA6/\u7F51\u7EDC\u4E0E\u5019\u9009\u53EF\u7528\u6027\u3001\u7528\u6237\u6307\u5B9A\u4F5C\u5224\u65AD\u3002\u901F\u5EA6\u89C4\u5219\u7EDF\u4E00\u89C1\u5E38\u9A7B\u300C\u6D3E\u53D1\u9009\u4EBA \xB7 \u53EF\u7528\u6027\u4E0E\u901F\u5EA6\u300D\uFF0C\u4E0D\u5F97\u636E\u901F\u5EA6\u63A8\u5BFC\u6A21\u578B\u6863\u4F4D\u3002
|
|
676
|
-
- \u53EF\u7528\u6027\u8BC1\u636E\uFF1A\u533A\u5206\u5F53\u6B21\u771F\u5B9E\u5931\u8D25\u3001\u9002\u7528\u4E14\u4ECD\u6709\u6548\u7684 quota\u3001\u8FC7\u671F\u53C2\u8003\u548C\u672A\u77E5\u3002\u89C4\u5212\u5217\u8868\u4E0E\u63A8\u8350\u4E0D\u6309\u51B7\u5374\u786C\u8FC7\u6EE4\uFF1B\u901A\u7528\u6267\u884C\u53EF\u7528\u4E0A\u9762\u7684\u6709\u6548 quota \u89C4\u5219\uFF1Breview \u81EA\u8EAB\u515C\u5E95\u4ECD\u987B\u5176\u4ED6\u5408\u89C4\u5019\u9009\u7684\u5F53\u6B21\u9519\u8BEF\u8BC1\u636E\uFF0C\u4E0D\u7528 quota \u6807\u6CE8\u66FF\u4EE3\u3002
|
|
677
|
-
- 429 \u9650\u6D41\u4E0E\u77E5\u60C5\u6743\u5951\u7EA6\uFF1A\u4EFB\u4F55\u7528\u6237\u79C1\u6709\u51ED\u636E\u4E0E\u81EA\u5EFA Agent\uFF08billingSource \u4E3A user_subscription / owner_subscription / user_api / local\uFF0C\u6216 isOwned=true\uFF09\u5728 listAgents \u7684 agents[].availabilityStatus \u4E3A rate_limited \u6216 quota_exhausted \u65F6\uFF0C\u7981\u6B62\u9759\u9ED8\u8DF3\u8FC7\uFF1B\u6539\u6D3E\u5E73\u53F0 Agent\uFF08\u6D88\u8017\u5E73\u53F0\u79EF\u5206\uFF09\u524D\u5FC5\u987B\u5728\u56DE\u590D\u4E2D\u544A\u77E5\u7528\u6237\uFF1A\u54EA\u4E2A\u8BA2\u9605/\u81EA\u5EFA agent \u9650\u6D41\u3001\u9884\u8BA1\u4F55\u65F6\u6062\u590D\uFF08nextAvailableAt\uFF09\u3001\u672C\u6B21\u5C06\u6263\u5E73\u53F0\u79EF\u5206\uFF1BavailabilityStatus \u4E0E nextAvailableAt \u4EC5\u662F\u53C2\u8003\u4FE1\u606F\uFF0C\u4E0D\u62E6\u6D3E\u53D1\uFF0C\u4E0D\u5F97\u4EC5\u51ED\u51B7\u5374\u6807\u6CE8\u6392\u9664\u5019\u9009\uFF1B\u7528\u6237\u4ECD\u53EF\u7167\u5E38\u6D3E\u53D1\u5E76\u83B7\u5F97\u4E0A\u6E38\u771F\u5B9E\u7ED3\u679C\u3002`;
|
|
678
|
-
|
|
679
|
-
// packages/core/listAgentsFragment.ts
|
|
680
|
-
function isEmptyListAgentsFragmentRequest(args) {
|
|
681
|
-
return (args.fragmentOffset === void 0 || args.fragmentOffset === 0) && (args.fragmentAgentKey === void 0 || args.fragmentAgentKey === "") && (args.fragmentDigest === void 0 || args.fragmentDigest === "");
|
|
682
|
-
}
|
|
683
|
-
|
|
684
|
-
// packages/agent-runtime/noloWorkspaceTools.ts
|
|
685
|
-
var NOLO_WORKSPACE_TOOL_NAMES = [
|
|
686
|
-
"listMcpConnections",
|
|
687
|
-
"listMcpTools",
|
|
688
|
-
"callMcpTool",
|
|
689
|
-
"listDialogs",
|
|
690
|
-
"readDialog",
|
|
691
|
-
"queryDialogsBySubjectRef",
|
|
692
|
-
"deleteDialogs",
|
|
693
|
-
"listAgents",
|
|
694
|
-
"readAgent",
|
|
695
|
-
"listSpaces",
|
|
696
|
-
"readSpace",
|
|
697
|
-
"readDoc",
|
|
698
|
-
"readSkillDoc",
|
|
699
|
-
"loadSkill",
|
|
700
|
-
"listTables",
|
|
701
|
-
"agentResource",
|
|
702
|
-
"queryTableRows",
|
|
703
|
-
"cliWhoami",
|
|
704
|
-
"cliDoctor",
|
|
705
|
-
"list_cloud_resources",
|
|
706
|
-
"cloud_probe",
|
|
707
|
-
"cloud_exec"
|
|
708
|
-
];
|
|
709
|
-
var SERVER_ONLY_NOLO_WORKSPACE_TOOL_NAMES = [
|
|
710
|
-
"list_cloud_resources",
|
|
711
|
-
"cloud_probe",
|
|
712
|
-
"cloud_exec"
|
|
713
|
-
];
|
|
714
|
-
var SERVER_ONLY_NOLO_WORKSPACE_TOOL_NAME_SET = new Set(SERVER_ONLY_NOLO_WORKSPACE_TOOL_NAMES);
|
|
715
|
-
function isServerOnlyNoloWorkspaceTool(name) {
|
|
716
|
-
return SERVER_ONLY_NOLO_WORKSPACE_TOOL_NAME_SET.has(name);
|
|
717
|
-
}
|
|
718
|
-
var CLI_NOLO_WORKSPACE_TOOL_NAMES = NOLO_WORKSPACE_TOOL_NAMES.filter(
|
|
719
|
-
(name) => !isServerOnlyNoloWorkspaceTool(name)
|
|
720
|
-
);
|
|
721
|
-
function filterClientNoloWorkspaceToolNames(toolNames) {
|
|
722
|
-
if (!toolNames) return CLI_NOLO_WORKSPACE_TOOL_NAMES.filter((name) => !["listMcpConnections", "listMcpTools", "callMcpTool"].includes(name));
|
|
723
|
-
return toolNames.filter((name) => !isServerOnlyNoloWorkspaceTool(name));
|
|
724
|
-
}
|
|
725
|
-
var NOLO_WORKSPACE_TOOL_NAME_SET = new Set(NOLO_WORKSPACE_TOOL_NAMES);
|
|
726
|
-
var CLOSED_OBJECT_SCHEMA_TOOL_NAMES = /* @__PURE__ */ new Set([
|
|
727
|
-
"list_cloud_resources",
|
|
728
|
-
"cloud_probe",
|
|
729
|
-
"cloud_exec"
|
|
730
|
-
]);
|
|
731
|
-
function stringToolParam(description) {
|
|
732
|
-
return { type: "string", description };
|
|
733
|
-
}
|
|
734
|
-
var READ_DIALOG_TOOL_DESCRIPTION = `Read a persisted dialog (meta + messages) by full dbKey (dialog-<userId>-<id>) or dialog URL; use listDialogs when unclear. A bare id only resolves for the currently logged-in user \u2014 pass user/server. For runs, do not poll a running dialog's full transcript: prefer controlAgentRun, else mode="status" for a compact snapshot; read the transcript only after done/failed/cancelled. Responses are budgeted: reasoning_content, tool_calls, tool results and metadata are head-truncated (truncated, messagesTotal/messagesReturned, omittedChars). For review or verification take diffs from the worktree instead of the full transcript.`;
|
|
735
|
-
var LIST_AGENTS_TOOL_DESCRIPTION = "Default scope='all': dedupe own/favorites + marketplace. scope='public': shared/marketplace only; check billingSource for credits. Copy runnable agentKey verbatim into startAgentRun, never infer from display name. planningRecommendation incl. requiresPaidApproval advises, never authorizes. availabilityStatus/availabilityReason/nextAvailableAt advisory, not gates (unavailableCount). Same-batch unknown-credential fan-out is guarded; sharing a credential alone is not a dependency. allowUnknownCredential only if credentials are confirmed independent. Use agentKeys only to recheck known candidates; never instead of the initial full-pool scan.";
|
|
736
|
-
function buildNoloWorkspaceOpenAiTools(args) {
|
|
737
|
-
const toolNames = new Set(args.toolNames ?? []);
|
|
738
|
-
const tools = [];
|
|
739
|
-
function add(name, description, properties, required = []) {
|
|
740
|
-
if (!toolNames.has(name)) return;
|
|
741
|
-
tools.push({
|
|
742
|
-
type: "function",
|
|
743
|
-
function: {
|
|
744
|
-
name,
|
|
745
|
-
description,
|
|
746
|
-
// Responses otherwise normalizes optional selectors into required fields.
|
|
747
|
-
...name === "loadSkill" ? { strict: false } : {},
|
|
748
|
-
parameters: {
|
|
749
|
-
type: "object",
|
|
750
|
-
properties,
|
|
751
|
-
...CLOSED_OBJECT_SCHEMA_TOOL_NAMES.has(name) ? { additionalProperties: false } : {},
|
|
752
|
-
...required.length ? { required } : {}
|
|
753
|
-
}
|
|
754
|
-
}
|
|
755
|
-
});
|
|
756
|
-
}
|
|
757
|
-
add("listDialogs", "List the current user's dialogs in the Nolo workspace.", {
|
|
758
|
-
limit: { type: "integer", description: "Maximum dialogs to return." },
|
|
759
|
-
space: stringToolParam("Optional space id or URL.")
|
|
760
|
-
});
|
|
761
|
-
add("readDialog", READ_DIALOG_TOOL_DESCRIPTION, {
|
|
762
|
-
dialog: stringToolParam("Dialog dbKey (dialog-<userId>-<id>), dialog URL, or bare id (resolved against user/current account)."),
|
|
763
|
-
mode: {
|
|
764
|
-
type: "string",
|
|
765
|
-
enum: ["full", "status"],
|
|
766
|
-
description: "full (default) returns meta + messages; status returns a compact run snapshot (status/checkpoint/tools/files/error) without the transcript \u2014 prefer it when you only need to know whether an agent run is still active or how it ended."
|
|
767
|
-
},
|
|
768
|
-
limit: { type: "integer", description: "Max messages to return in mode=full, newest first. Omit for the complete transcript; a small limit can hide earlier tool calls. Ignored in mode=status." },
|
|
769
|
-
user: stringToolParam("Owner userId for a bare dialog id (e.g. a child run started by another account). Ignored when dialog is a dbKey or URL."),
|
|
770
|
-
server: stringToolParam("Optional server base URL to read from, e.g. when the dialog lives on another machine's nolo server.")
|
|
771
|
-
}, ["dialog"]);
|
|
772
|
-
add("queryDialogsBySubjectRef", "Query persisted dialog evidence by a generic dialog.subjectRefs target.", {
|
|
773
|
-
rowDbKey: stringToolParam("Optional alias for subjectKind=table-row, subjectId=<rowDbKey>, subjectRole=task."),
|
|
774
|
-
subjectKind: stringToolParam("Subject ref kind (e.g. table-row, page, file, commit, artifact)."),
|
|
775
|
-
subjectId: stringToolParam("Subject ref id."),
|
|
776
|
-
subjectRole: stringToolParam("Optional subject ref role."),
|
|
777
|
-
limit: { type: "integer", description: "Maximum matching dialog summaries to return." },
|
|
778
|
-
status: stringToolParam("Optional dialog status filter (running, done, failed)."),
|
|
779
|
-
checkpointStatus: stringToolParam("Optional runtimeCheckpoint.status filter."),
|
|
780
|
-
hasArtifacts: { type: "boolean", description: "When true, only return dialogs with artifact evidence." },
|
|
781
|
-
excludeDialogId: stringToolParam("Optional dialog id to exclude from results.")
|
|
782
|
-
});
|
|
783
|
-
add("deleteDialogs", "Find and delete dialogs by title/id/dbKey. Preview matches and wait for user confirmation before deleting.", {
|
|
784
|
-
query: stringToolParam("Dialog title/id/dbKey search text."),
|
|
785
|
-
matchMode: {
|
|
786
|
-
type: "string",
|
|
787
|
-
enum: ["contains", "exact", "prefix", "dialogId"],
|
|
788
|
-
description: "Matching mode. Default contains."
|
|
789
|
-
},
|
|
790
|
-
confirmedDialogIds: {
|
|
791
|
-
type: "array",
|
|
792
|
-
items: { type: "string" },
|
|
793
|
-
description: "Confirmed dialog ids or dbKeys to delete."
|
|
794
|
-
}
|
|
795
|
-
}, ["query"]);
|
|
796
|
-
add("listAgents", LIST_AGENTS_TOOL_DESCRIPTION, {
|
|
797
|
-
query: stringToolParam("Case-insensitive substring: name/model/provider/handle/agentKey."),
|
|
798
|
-
agentKeys: LIST_AGENTS_KEYS_SCHEMA,
|
|
799
|
-
scope: { type: "string", enum: ["all", "public"], description: "all (default) or public only." },
|
|
800
|
-
publicOnly: { type: "boolean", description: "Deprecated alias for scope='public'." },
|
|
801
|
-
showUnavailable: { type: "boolean", description: "Deprecated no-op; cooldown agents remain listed." },
|
|
802
|
-
verbose: { type: "boolean", description: "Full safe-summary details when supported." },
|
|
803
|
-
compact: { type: "boolean", description: "Compact selection/admission fields; omit verbose text." },
|
|
804
|
-
limit: { type: "number", description: "Page size." },
|
|
805
|
-
offset: { type: "number", description: "Candidate offset." },
|
|
806
|
-
fragmentOffset: { type: "integer", description: "Oversized: 0 then nextFragmentOffset; same offset, filters, fragmentAgentKey and returned fragmentDigest." },
|
|
807
|
-
fragmentAgentKey: stringToolParam("Exact oversized response agentKey."),
|
|
808
|
-
fragmentDigest: stringToolParam("First-fragment SHA-256; required later to detect changes."),
|
|
809
|
-
space: stringToolParam("Space ID or URL.")
|
|
810
|
-
});
|
|
811
|
-
add("readAgent", "Read one agent's full config by exact agentKey returned by listAgents (agent-<userId>-<id> or agent-pub-<id>); do not use the display name.", {
|
|
812
|
-
agent: stringToolParam("Exact agentKey from listAgents (preferred; copy verbatim; plain id or URL are compatibility fallbacks).")
|
|
813
|
-
}, ["agent"]);
|
|
814
|
-
add("listSpaces", "List joined spaces in the Nolo workspace.", {});
|
|
815
|
-
add("readSpace", "Read one space in the Nolo workspace.", {
|
|
816
|
-
space: stringToolParam("Space id or URL."),
|
|
817
|
-
contentKey: stringToolParam("Optional content key inside the space."),
|
|
818
|
-
brief: { type: "boolean", description: "Return brief output when supported." }
|
|
819
|
-
}, ["space"]);
|
|
820
|
-
add("readDoc", "Read one normal doc/page in the Nolo workspace.", {
|
|
821
|
-
doc: stringToolParam("Doc/page key.")
|
|
822
|
-
}, ["doc"]);
|
|
823
|
-
add("readSkillDoc", "Read one skill doc in the Nolo workspace.", {
|
|
824
|
-
doc: stringToolParam("Skill doc/page key.")
|
|
825
|
-
}, ["doc"]);
|
|
826
|
-
add("loadSkill", "Return full skill instructions inline. Use legacy name alone (lists skills if missing), or one exact source without name: space+dbKey, builtin+slug, project+projectBinding+relativePath. Do not mix selectors. Server: space/builtin; CLI/desktop: builtin/project.", {
|
|
827
|
-
name: stringToolParam("Legacy discovery name only."),
|
|
828
|
-
source: {
|
|
829
|
-
type: "string",
|
|
830
|
-
enum: ["space", "builtin", "project"],
|
|
831
|
-
description: "Exact source; omit name."
|
|
832
|
-
},
|
|
833
|
-
dbKey: stringToolParam("Space skill document dbKey."),
|
|
834
|
-
slug: stringToolParam("Builtin skill slug."),
|
|
835
|
-
projectBinding: stringToolParam("Project: authorized absolute root matching executor cwd."),
|
|
836
|
-
relativePath: stringToolParam("Project-relative SKILL.md under .agents/skills/.")
|
|
837
|
-
});
|
|
838
|
-
add("listTables", "List tables in the current user scope or an optional space scope.", {
|
|
839
|
-
limit: { type: "integer", description: "Maximum tables to return." },
|
|
840
|
-
space: stringToolParam("Optional space id or URL."),
|
|
841
|
-
titleQuery: stringToolParam("Optional case-insensitive title substring."),
|
|
842
|
-
purpose: stringToolParam("Optional purpose value such as agent_eval_workbench.")
|
|
843
|
-
});
|
|
844
|
-
add("agentResource", "Access an authorized Table, Page or Attachment in this server. Updates require a revision and mutation ID. A reference never grants access.", {
|
|
845
|
-
ref: { type: "object", properties: {
|
|
846
|
-
kind: { type: "string", enum: ["table", "table_row", "page", "attachment"] },
|
|
847
|
-
id: { type: "string" },
|
|
848
|
-
tenantId: { type: "string" },
|
|
849
|
-
tableId: { type: "string" },
|
|
850
|
-
spaceId: { type: "string" },
|
|
851
|
-
authorityServer: { type: "string" },
|
|
852
|
-
authorityEpoch: { type: "string" }
|
|
853
|
-
}, required: ["kind", "id"], additionalProperties: false },
|
|
854
|
-
operation: { type: "string", enum: ["describe", "get", "query", "insert", "update", "upsert", "read", "append", "replace"] },
|
|
855
|
-
input: { type: "object", description: "Operation arguments (e.g. expectedRevision, mutationId, changes, or markdown)." }
|
|
856
|
-
}, ["ref", "operation"]);
|
|
857
|
-
add("queryTableRows", "Query rows from a Nolo table.", {
|
|
858
|
-
table: stringToolParam("Table id or meta key."),
|
|
859
|
-
limit: { type: "integer", description: "Optional row limit." },
|
|
860
|
-
row: stringToolParam("Optional row id or row db key."),
|
|
861
|
-
output: stringToolParam("Optional output format such as json, jsonl, or items.")
|
|
862
|
-
}, ["table"]);
|
|
863
|
-
add("cliWhoami", "Show the current Nolo CLI login state.", {});
|
|
864
|
-
add("cliDoctor", "Show Nolo CLI doctor diagnostics.", {});
|
|
865
|
-
add("list_cloud_resources", "List cloud resources you may use (your own connections plus any shared with you). Never outputs credentials.", {
|
|
866
|
-
ownerKind: {
|
|
867
|
-
type: "string",
|
|
868
|
-
enum: ["user", "space"],
|
|
869
|
-
description: "Scope selector. user (default) = everything you may use; space = only connections in one Space you belong to."
|
|
870
|
-
},
|
|
871
|
-
spaceId: stringToolParam("Required when ownerKind is space."),
|
|
872
|
-
platformId: stringToolParam("Optional cloud platform filter (e.g. docker, cloudflare, gcp).")
|
|
873
|
-
});
|
|
874
|
-
add("cloud_probe", "Probe read-only connectivity and readiness of a cloud resource. Never accepts credential parameters.", {
|
|
875
|
-
resourceId: stringToolParam("Target cloud resource ID to probe.")
|
|
876
|
-
}, ["resourceId"]);
|
|
877
|
-
add("cloud_exec", 'Execute a shell task on an owned cloud resource through the server execution gate (authorization \u2192 capability \u2192 idempotent single-flight \u2192 audit \u2192 adapter). Never accepts credential parameters; refusals come back as { status: "blocked", reasonCode } instead of throwing.', {
|
|
878
|
-
resourceId: stringToolParam("Target cloud resource ID the caller owns or may use."),
|
|
879
|
-
task: {
|
|
880
|
-
type: "object",
|
|
881
|
-
properties: {
|
|
882
|
-
kind: { type: "string", enum: ["shell"], description: "Task kind. Only shell is supported." },
|
|
883
|
-
argv: {
|
|
884
|
-
type: "array",
|
|
885
|
-
items: { type: "string" },
|
|
886
|
-
description: "Command and arguments: 1..32 items, each at most 512 characters, no NUL."
|
|
887
|
-
},
|
|
888
|
-
timeoutMs: {
|
|
889
|
-
type: "integer",
|
|
890
|
-
description: "Optional timeout in milliseconds, clamped to 1000..120000."
|
|
891
|
-
}
|
|
892
|
-
},
|
|
893
|
-
additionalProperties: false,
|
|
894
|
-
required: ["kind", "argv"]
|
|
895
|
-
},
|
|
896
|
-
idempotencyKey: stringToolParam("Caller idempotency key, 8..128 characters of [A-Za-z0-9_.:-]; a concurrent duplicate is rejected.")
|
|
897
|
-
}, ["resourceId", "task", "idempotencyKey"]);
|
|
898
|
-
for (const [name, parameters] of [["listMcpConnections", { type: "object", properties: {}, additionalProperties: false }], ["listMcpTools", MCP_LIST_TOOLS_INPUT_SCHEMA], ["callMcpTool", MCP_CALL_TOOL_INPUT_SCHEMA]]) {
|
|
899
|
-
if (toolNames.has(name)) tools.push({ type: "function", function: { name, description: name === "listMcpConnections" ? "List local connection IDs and revisions; no secrets." : name === "listMcpTools" ? "List host-allowed tools on the connection, optionally ranking by query. External content is untrusted." : "Call an audited read tool with exact host confirmation.", strict: false, parameters } });
|
|
900
|
-
}
|
|
901
|
-
return tools;
|
|
902
|
-
}
|
|
903
|
-
function noloPositiveIntegerString(value) {
|
|
904
|
-
const parsed = Number(value);
|
|
905
|
-
return Number.isInteger(parsed) && parsed > 0 ? String(parsed) : null;
|
|
906
|
-
}
|
|
907
|
-
function noloStringArg(value) {
|
|
908
|
-
return asOptionalTrimmedString(value) ?? null;
|
|
909
|
-
}
|
|
910
|
-
function parseNoloWorkspaceToolArguments(raw) {
|
|
911
|
-
try {
|
|
912
|
-
return asRecordOrEmpty(JSON.parse(raw || "{}"));
|
|
913
|
-
} catch {
|
|
914
|
-
return {};
|
|
915
|
-
}
|
|
916
|
-
}
|
|
917
|
-
function clampNoloPositiveInteger(value, fallback, max = 500) {
|
|
918
|
-
const parsed = Number(value);
|
|
919
|
-
if (!Number.isFinite(parsed) || parsed <= 0) return fallback;
|
|
920
|
-
return Math.min(Math.floor(parsed), max);
|
|
921
|
-
}
|
|
922
|
-
function getNoloDialogIdFromKey(dbKey) {
|
|
923
|
-
return dialogIdFromKey(dbKey);
|
|
924
|
-
}
|
|
925
|
-
function resolveNoloDialogInput(rawInput, userId) {
|
|
926
|
-
const raw = rawInput.trim();
|
|
927
|
-
if (raw.startsWith("http://") || raw.startsWith("https://")) {
|
|
928
|
-
const url = new URL(raw);
|
|
929
|
-
const identity = parseDialogPathIdentity(url.pathname);
|
|
930
|
-
if (!identity) throw new Error(`Unsupported dialog URL path: ${url.pathname}`);
|
|
931
|
-
return {
|
|
932
|
-
dbKey: `dialog-${identity.ownerId}-${identity.dialogId}`,
|
|
933
|
-
dialogId: identity.dialogId,
|
|
934
|
-
ownerId: identity.ownerId,
|
|
935
|
-
spaceId: identity.spaceId
|
|
936
|
-
};
|
|
937
|
-
}
|
|
938
|
-
if (raw.startsWith("dialog-")) {
|
|
939
|
-
const identity = splitDialogKeyIdentity(raw);
|
|
940
|
-
if (!identity) throw new Error(`Unsupported dialog key: ${raw}`);
|
|
941
|
-
return {
|
|
942
|
-
dbKey: raw,
|
|
943
|
-
dialogId: identity.dialogId,
|
|
944
|
-
ownerId: identity.userId,
|
|
945
|
-
spaceId: null
|
|
946
|
-
};
|
|
947
|
-
}
|
|
948
|
-
if (!isSupportedDialogId(raw)) {
|
|
949
|
-
throw new Error(`Unsupported dialog id: ${raw}`);
|
|
950
|
-
}
|
|
951
|
-
return {
|
|
952
|
-
dbKey: `dialog-${userId}-${raw}`,
|
|
953
|
-
dialogId: raw,
|
|
954
|
-
ownerId: userId,
|
|
955
|
-
spaceId: null
|
|
956
|
-
};
|
|
957
|
-
}
|
|
958
|
-
function normalizeNoloSpaceInput(raw) {
|
|
959
|
-
const value = raw.trim();
|
|
960
|
-
if (!value) return "";
|
|
961
|
-
if (value.startsWith("http://") || value.startsWith("https://")) {
|
|
962
|
-
const match = new URL(value).pathname.match(/^\/space\/([^/]+)/);
|
|
963
|
-
return match?.[1] ? decodeURIComponent(match[1]).replace(/^space-/, "") : "";
|
|
964
|
-
}
|
|
965
|
-
return value.replace(/^space-/, "");
|
|
966
|
-
}
|
|
967
|
-
function getNoloComparableUpdatedAt(record) {
|
|
968
|
-
const raw = record?.updatedAt ?? record?.updated_at ?? record?.createdAt ?? record?.created;
|
|
969
|
-
const asNumber = asOptionalFiniteNumber(raw);
|
|
970
|
-
if (asNumber !== void 0) return asNumber;
|
|
971
|
-
if (typeof raw === "string") return Date.parse(raw) || 0;
|
|
972
|
-
return 0;
|
|
973
|
-
}
|
|
974
|
-
function normalizeNoloSubjectKind(kind) {
|
|
975
|
-
return kind === "tableRow" ? "table-row" : kind;
|
|
976
|
-
}
|
|
977
|
-
function normalizeNoloSubjectRef(value) {
|
|
978
|
-
if (!isRecord(value)) return null;
|
|
979
|
-
const kindRaw = asOptionalTrimmedString(value.kind);
|
|
980
|
-
const kind = kindRaw ? normalizeNoloSubjectKind(kindRaw) : "";
|
|
981
|
-
const id = asOptionalTrimmedString(value.id) ?? "";
|
|
982
|
-
if (!kind || !id) return null;
|
|
983
|
-
const role = asOptionalTrimmedString(value.role) ?? "";
|
|
984
|
-
return {
|
|
985
|
-
kind,
|
|
986
|
-
id,
|
|
987
|
-
...role ? { role } : {}
|
|
988
|
-
};
|
|
989
|
-
}
|
|
990
|
-
function buildNoloSubjectRefQueryTarget(args) {
|
|
991
|
-
const rowDbKey = noloStringArg(args.rowDbKey ?? args.row ?? args.taskRowDbKey);
|
|
992
|
-
const subjectKind = noloStringArg(args.subjectKind ?? args.kind) ?? (rowDbKey ? "table-row" : null);
|
|
993
|
-
const subjectId = noloStringArg(args.subjectId ?? args.id) ?? rowDbKey;
|
|
994
|
-
const subjectRole = noloStringArg(args.subjectRole ?? args.role) ?? (rowDbKey ? "task" : null);
|
|
995
|
-
if (!subjectKind || !subjectId) return null;
|
|
996
|
-
return {
|
|
997
|
-
kind: normalizeNoloSubjectKind(subjectKind),
|
|
998
|
-
id: subjectId,
|
|
999
|
-
...subjectRole ? { role: subjectRole } : {}
|
|
1000
|
-
};
|
|
1001
|
-
}
|
|
1002
|
-
function extractNoloDialogSubjectRefs(dialog) {
|
|
1003
|
-
if (!isRecord(dialog) || !Array.isArray(dialog.subjectRefs)) return [];
|
|
1004
|
-
return dialog.subjectRefs.map(normalizeNoloSubjectRef).filter((ref) => Boolean(ref));
|
|
1005
|
-
}
|
|
1006
|
-
function noloDialogMatchesSubjectRef(dialog, target) {
|
|
1007
|
-
const normalizedTarget = normalizeNoloSubjectRef(target);
|
|
1008
|
-
if (!normalizedTarget) return false;
|
|
1009
|
-
return extractNoloDialogSubjectRefs(dialog).some(
|
|
1010
|
-
(ref) => ref.kind === normalizedTarget.kind && ref.id === normalizedTarget.id
|
|
1011
|
-
);
|
|
1012
|
-
}
|
|
1013
|
-
function noloArtifactCount(value) {
|
|
1014
|
-
if (Array.isArray(value)) return value.length;
|
|
1015
|
-
if (isRecord(value)) return Object.keys(value).length > 0 ? 1 : 0;
|
|
1016
|
-
return value ? 1 : 0;
|
|
1017
|
-
}
|
|
1018
|
-
function summarizeNoloDialogSubjectRefEvidence(dialog, target) {
|
|
1019
|
-
const dialogKey = asOptionalTrimmedString(dialog?.dbKey) ?? "";
|
|
1020
|
-
const checkpoint = asRecordOrEmpty(dialog?.runtimeCheckpoint);
|
|
1021
|
-
const matchedSubjectRefs = extractNoloDialogSubjectRefs(dialog).filter(
|
|
1022
|
-
(ref) => ref.kind === normalizeNoloSubjectKind(target.kind) && ref.id === target.id
|
|
1023
|
-
);
|
|
1024
|
-
const lastToolNames = asNonEmptyStringArray(checkpoint.lastToolNames);
|
|
1025
|
-
const artifactCount = noloArtifactCount(dialog?.artifacts);
|
|
1026
|
-
return {
|
|
1027
|
-
dialogId: asOptionalTrimmedString(dialog?.dialogId) ?? asOptionalTrimmedString(dialog?.id) ?? (dialogKey ? getNoloDialogIdFromKey(dialogKey) : null),
|
|
1028
|
-
dialogKey: dialogKey || null,
|
|
1029
|
-
title: asOptionalTrimmedString(dialog?.title) ?? null,
|
|
1030
|
-
status: asOptionalTrimmedString(dialog?.status) ?? null,
|
|
1031
|
-
checkpointStatus: asOptionalTrimmedString(checkpoint.status) ?? null,
|
|
1032
|
-
updatedAt: typeof dialog?.updatedAt === "string" || typeof dialog?.updatedAt === "number" ? dialog.updatedAt : null,
|
|
1033
|
-
hasArtifacts: artifactCount > 0,
|
|
1034
|
-
artifactCount,
|
|
1035
|
-
subjectRefs: matchedSubjectRefs,
|
|
1036
|
-
lastToolNames
|
|
1037
|
-
};
|
|
1038
|
-
}
|
|
1039
|
-
function normalizeNoloExcludeDialogIds(value) {
|
|
1040
|
-
const rawValues = Array.isArray(value) ? value : [value];
|
|
1041
|
-
const ids = /* @__PURE__ */ new Set();
|
|
1042
|
-
for (const rawValue of rawValues) {
|
|
1043
|
-
if (typeof rawValue !== "string") continue;
|
|
1044
|
-
const trimmed = rawValue.trim();
|
|
1045
|
-
if (!trimmed) continue;
|
|
1046
|
-
ids.add(trimmed);
|
|
1047
|
-
if (trimmed.startsWith("dialog-")) {
|
|
1048
|
-
ids.add(getNoloDialogIdFromKey(trimmed));
|
|
1049
|
-
}
|
|
1050
|
-
}
|
|
1051
|
-
return [...ids];
|
|
1052
|
-
}
|
|
1053
|
-
function getNoloDialogIdentityValues(dialog) {
|
|
1054
|
-
if (!isRecord(dialog)) return [];
|
|
1055
|
-
const values = /* @__PURE__ */ new Set();
|
|
1056
|
-
for (const rawValue of [dialog.dialogId, dialog.id, dialog.dbKey]) {
|
|
1057
|
-
if (typeof rawValue !== "string") continue;
|
|
1058
|
-
const trimmed = rawValue.trim();
|
|
1059
|
-
if (!trimmed) continue;
|
|
1060
|
-
values.add(trimmed);
|
|
1061
|
-
if (trimmed.startsWith("dialog-")) {
|
|
1062
|
-
values.add(getNoloDialogIdFromKey(trimmed));
|
|
1063
|
-
}
|
|
1064
|
-
}
|
|
1065
|
-
return [...values];
|
|
1066
|
-
}
|
|
1067
|
-
function filterNoloDialogsByExcludedIds(dialogs, excludeDialogIds) {
|
|
1068
|
-
const excluded = new Set(normalizeNoloExcludeDialogIds(excludeDialogIds));
|
|
1069
|
-
if (excluded.size === 0) return dialogs;
|
|
1070
|
-
return dialogs.filter(
|
|
1071
|
-
(dialog) => getNoloDialogIdentityValues(dialog).every((value) => !excluded.has(value))
|
|
1072
|
-
);
|
|
1073
|
-
}
|
|
1074
|
-
function filterNoloDialogSubjectRefEvidence(args) {
|
|
1075
|
-
const matched = [];
|
|
1076
|
-
for (const dialog of filterNoloDialogsByExcludedIds(args.dialogs, args.excludeDialogIds)) {
|
|
1077
|
-
if (noloDialogMatchesSubjectRef(dialog, args.target)) {
|
|
1078
|
-
matched.push(dialog);
|
|
1079
|
-
}
|
|
1080
|
-
}
|
|
1081
|
-
matched.sort((left, right) => getNoloComparableUpdatedAt(right) - getNoloComparableUpdatedAt(left));
|
|
1082
|
-
const evidence = [];
|
|
1083
|
-
for (const dialog of matched) {
|
|
1084
|
-
const entry = summarizeNoloDialogSubjectRefEvidence(dialog, args.target);
|
|
1085
|
-
if (args.status && entry.status !== args.status) continue;
|
|
1086
|
-
if (args.checkpointStatus && entry.checkpointStatus !== args.checkpointStatus) continue;
|
|
1087
|
-
if (args.hasArtifacts != null && entry.hasArtifacts !== args.hasArtifacts) continue;
|
|
1088
|
-
evidence.push(entry);
|
|
1089
|
-
}
|
|
1090
|
-
return evidence.slice(0, args.limit);
|
|
1091
|
-
}
|
|
1092
|
-
function verifyNoloDialogSubjectRefQuery(dialogs, target, options = {}) {
|
|
1093
|
-
const checkedDialogs = filterNoloDialogsByExcludedIds(dialogs, options.excludeDialogIds);
|
|
1094
|
-
const unmatchedDialogs = [];
|
|
1095
|
-
for (const dialog of checkedDialogs) {
|
|
1096
|
-
if (noloDialogMatchesSubjectRef(dialog, target)) continue;
|
|
1097
|
-
unmatchedDialogs.push({
|
|
1098
|
-
dialogId: asOptionalTrimmedString(dialog?.dialogId) ?? asOptionalTrimmedString(dialog?.id) ?? (typeof dialog?.dbKey === "string" ? getNoloDialogIdFromKey(dialog.dbKey) : null),
|
|
1099
|
-
dialogKey: asOptionalTrimmedString(dialog?.dbKey) ?? null,
|
|
1100
|
-
subjectRefs: extractNoloDialogSubjectRefs(dialog)
|
|
1101
|
-
});
|
|
1102
|
-
}
|
|
1103
|
-
const reason = unmatchedDialogs.length > 0 ? "unmatched_results" : "ok";
|
|
1104
|
-
return {
|
|
1105
|
-
ok: reason === "ok",
|
|
1106
|
-
reason,
|
|
1107
|
-
target,
|
|
1108
|
-
returnedCount: checkedDialogs.length,
|
|
1109
|
-
matchedCount: checkedDialogs.length - unmatchedDialogs.length,
|
|
1110
|
-
unmatchedCount: unmatchedDialogs.length,
|
|
1111
|
-
unmatchedDialogs
|
|
1112
|
-
};
|
|
1113
|
-
}
|
|
1114
|
-
function buildNoloTableQueryRequest(args, currentUserId) {
|
|
1115
|
-
const tableInput = noloStringArg(args.table ?? args.metaKey);
|
|
1116
|
-
if (!tableInput) return null;
|
|
1117
|
-
const tableMetaParts = tableInput.startsWith("meta-") ? tableInput.split("-") : [];
|
|
1118
|
-
const tenantId = args.tenantId ?? (tableMetaParts.length >= 3 ? tableMetaParts[1] : currentUserId);
|
|
1119
|
-
const tableId = args.tableId ?? (tableMetaParts.length >= 3 ? tableMetaParts.slice(2).join("-") : tableInput);
|
|
1120
|
-
const filters = {
|
|
1121
|
-
...asRecordOrEmpty(args.filters)
|
|
1122
|
-
};
|
|
1123
|
-
const row = noloStringArg(args.row ?? args.rowId);
|
|
1124
|
-
if (row) {
|
|
1125
|
-
if (row.startsWith("row-")) filters.dbKey = row;
|
|
1126
|
-
else filters.rowId = row;
|
|
1127
|
-
}
|
|
1128
|
-
return {
|
|
1129
|
-
tenantId,
|
|
1130
|
-
tableId,
|
|
1131
|
-
filters,
|
|
1132
|
-
columns: args.columns,
|
|
1133
|
-
limit: args.limit ?? (row ? 1 : 20),
|
|
1134
|
-
offset: args.offset,
|
|
1135
|
-
includeBaseFields: args.includeBaseFields,
|
|
1136
|
-
sortBy: args.sortBy ?? "updatedAt",
|
|
1137
|
-
sortOrder: args.sortOrder === "asc" ? "asc" : "desc"
|
|
1138
|
-
};
|
|
1139
|
-
}
|
|
1140
|
-
function buildNoloWorkspaceCommandArgs(call) {
|
|
1141
|
-
const args = parseNoloWorkspaceToolArguments(call.arguments);
|
|
1142
|
-
switch (call.name) {
|
|
1143
|
-
case "listDialogs": {
|
|
1144
|
-
const cliArgs = ["dialog", "list"];
|
|
1145
|
-
const limit = noloPositiveIntegerString(args.limit);
|
|
1146
|
-
const space = noloStringArg(args.space);
|
|
1147
|
-
if (limit) cliArgs.push("--limit", limit);
|
|
1148
|
-
if (space) cliArgs.push("--space", space);
|
|
1149
|
-
return cliArgs;
|
|
1150
|
-
}
|
|
1151
|
-
case "readDialog": {
|
|
1152
|
-
const dialog = noloStringArg(args.dialog ?? args.dialogId ?? args.id);
|
|
1153
|
-
if (!dialog) throw new Error("readDialog requires dialog.");
|
|
1154
|
-
const mode = noloStringArg(args.mode);
|
|
1155
|
-
if (mode && mode !== "full" && mode !== "status") {
|
|
1156
|
-
throw new Error(`readDialog mode must be "full" or "status", got "${mode}".`);
|
|
1157
|
-
}
|
|
1158
|
-
const statusMode = mode === "status";
|
|
1159
|
-
const cliArgs = ["dialog", statusMode ? "status" : "read", dialog];
|
|
1160
|
-
const limit = statusMode ? null : noloPositiveIntegerString(args.limit);
|
|
1161
|
-
if (limit) cliArgs.push(limit);
|
|
1162
|
-
if (!statusMode) {
|
|
1163
|
-
cliArgs.push("--max-response-chars", String(DEFAULT_READ_DIALOG_MAX_RESPONSE_CHARS));
|
|
1164
|
-
}
|
|
1165
|
-
const user = noloStringArg(args.user ?? args.userId ?? args.owner);
|
|
1166
|
-
if (user) cliArgs.push("--user", user);
|
|
1167
|
-
const server = noloStringArg(args.server ?? args.serverBase ?? args.serverUrl);
|
|
1168
|
-
if (server) cliArgs.push("--server", server);
|
|
1169
|
-
return cliArgs;
|
|
1170
|
-
}
|
|
1171
|
-
case "queryDialogsBySubjectRef": {
|
|
1172
|
-
const target = buildNoloSubjectRefQueryTarget(args);
|
|
1173
|
-
if (!target) throw new Error("queryDialogsBySubjectRef requires rowDbKey or subjectKind plus subjectId.");
|
|
1174
|
-
const cliArgs = ["dialog", "query"];
|
|
1175
|
-
const rowDbKey = noloStringArg(args.rowDbKey ?? args.row ?? args.taskRowDbKey);
|
|
1176
|
-
if (rowDbKey && target.kind === "table-row" && target.id === rowDbKey) {
|
|
1177
|
-
cliArgs.push("--row-dbkey", rowDbKey);
|
|
1178
|
-
} else {
|
|
1179
|
-
cliArgs.push("--subject-kind", target.kind, "--subject-id", target.id);
|
|
1180
|
-
if (target.role) cliArgs.push("--subject-role", target.role);
|
|
1181
|
-
}
|
|
1182
|
-
const limit = noloPositiveIntegerString(args.limit);
|
|
1183
|
-
if (limit) cliArgs.push("--limit", limit);
|
|
1184
|
-
const excludeDialogId = noloStringArg(args.excludeDialogId ?? args.excludeDialog);
|
|
1185
|
-
if (excludeDialogId) cliArgs.push("--exclude-dialog", excludeDialogId);
|
|
1186
|
-
cliArgs.push("--json");
|
|
1187
|
-
return cliArgs;
|
|
1188
|
-
}
|
|
1189
|
-
case "listAgents": {
|
|
1190
|
-
const cliArgs = ["agent", "list"];
|
|
1191
|
-
const keys = normalizeListAgentsKeys(args.agentKeys);
|
|
1192
|
-
if (keys.length) cliArgs.push("--agent-keys", JSON.stringify(keys));
|
|
1193
|
-
const query = noloStringArg(args.query);
|
|
1194
|
-
if (query) cliArgs.push("--query", query);
|
|
1195
|
-
const space = noloStringArg(args.space);
|
|
1196
|
-
if (space) cliArgs.push("--space", space);
|
|
1197
|
-
const scope = noloStringArg(args.scope);
|
|
1198
|
-
if (scope) cliArgs.push("--scope", scope);
|
|
1199
|
-
if (args.publicOnly === true) cliArgs.push("--public-only");
|
|
1200
|
-
if (args.verbose === true) cliArgs.push("--verbose");
|
|
1201
|
-
if (args.compact === true) cliArgs.push("--compact");
|
|
1202
|
-
const limitVal = args.limit;
|
|
1203
|
-
if (limitVal !== void 0 && limitVal !== null && limitVal !== "") {
|
|
1204
|
-
if (typeof limitVal === "boolean") {
|
|
1205
|
-
throw new Error(`Invalid limit '${limitVal}': must be a positive integer.`);
|
|
1206
|
-
}
|
|
1207
|
-
const parsed = Number(limitVal);
|
|
1208
|
-
if (!Number.isInteger(parsed) || parsed <= 0) {
|
|
1209
|
-
throw new Error(`Invalid limit '${limitVal}': must be a positive integer.`);
|
|
1210
|
-
}
|
|
1211
|
-
cliArgs.push("--limit", String(parsed));
|
|
1212
|
-
}
|
|
1213
|
-
const offsetVal = args.offset;
|
|
1214
|
-
if (offsetVal !== void 0 && offsetVal !== null && offsetVal !== "") {
|
|
1215
|
-
if (typeof offsetVal === "boolean") {
|
|
1216
|
-
throw new Error(`Invalid offset '${offsetVal}': must be a non-negative integer.`);
|
|
1217
|
-
}
|
|
1218
|
-
const parsed = Number(offsetVal);
|
|
1219
|
-
if (!Number.isInteger(parsed) || parsed < 0) {
|
|
1220
|
-
throw new Error(`Invalid offset '${offsetVal}': must be a non-negative integer.`);
|
|
1221
|
-
}
|
|
1222
|
-
cliArgs.push("--offset", String(parsed));
|
|
1223
|
-
}
|
|
1224
|
-
if (!isEmptyListAgentsFragmentRequest(args)) {
|
|
1225
|
-
if (args.fragmentOffset !== void 0) {
|
|
1226
|
-
if (!Number.isSafeInteger(args.fragmentOffset) || args.fragmentOffset < 0) throw new Error("Invalid fragmentOffset");
|
|
1227
|
-
cliArgs.push("--fragment-offset", String(args.fragmentOffset));
|
|
1228
|
-
}
|
|
1229
|
-
if (args.fragmentAgentKey !== void 0) {
|
|
1230
|
-
if (typeof args.fragmentAgentKey !== "string" || !args.fragmentAgentKey.trim()) throw new Error("Invalid fragmentAgentKey");
|
|
1231
|
-
cliArgs.push("--fragment-agent-key", args.fragmentAgentKey);
|
|
1232
|
-
}
|
|
1233
|
-
if (args.fragmentDigest !== void 0) {
|
|
1234
|
-
if (typeof args.fragmentDigest !== "string" || !/^[a-f0-9]{64}$/.test(args.fragmentDigest)) throw new Error("Invalid fragmentDigest");
|
|
1235
|
-
cliArgs.push("--fragment-digest", args.fragmentDigest);
|
|
1236
|
-
}
|
|
1237
|
-
}
|
|
1238
|
-
cliArgs.push("--json", "--safe");
|
|
1239
|
-
return cliArgs;
|
|
1240
|
-
}
|
|
1241
|
-
case "readAgent": {
|
|
1242
|
-
const agent = noloStringArg(args.agent ?? args.agentKey ?? args.id);
|
|
1243
|
-
if (!agent) throw new Error("readAgent requires agent.");
|
|
1244
|
-
return ["agent", "read", agent];
|
|
1245
|
-
}
|
|
1246
|
-
case "listSpaces":
|
|
1247
|
-
return ["space", "list"];
|
|
1248
|
-
case "readSpace": {
|
|
1249
|
-
const space = noloStringArg(args.space ?? args.spaceId ?? args.id);
|
|
1250
|
-
if (!space) throw new Error("readSpace requires space.");
|
|
1251
|
-
const cliArgs = ["space", "read", space];
|
|
1252
|
-
const contentKey = noloStringArg(args.contentKey);
|
|
1253
|
-
if (contentKey) cliArgs.push("--content-key", contentKey);
|
|
1254
|
-
if (args.brief === true) cliArgs.push("--brief");
|
|
1255
|
-
return cliArgs;
|
|
1256
|
-
}
|
|
1257
|
-
case "readDoc": {
|
|
1258
|
-
const doc = noloStringArg(args.doc ?? args.docKey ?? args.pageKey ?? args.key);
|
|
1259
|
-
if (!doc) throw new Error("readDoc requires doc.");
|
|
1260
|
-
return doc.startsWith("page-") ? ["doc", "read", "--key", doc] : ["doc", "read", "--id", doc];
|
|
1261
|
-
}
|
|
1262
|
-
case "readSkillDoc": {
|
|
1263
|
-
const doc = noloStringArg(args.doc ?? args.docKey ?? args.pageKey ?? args.key);
|
|
1264
|
-
if (!doc) throw new Error("readSkillDoc requires doc.");
|
|
1265
|
-
return doc.startsWith("page-") ? ["skill-doc", "read", "--key", doc] : ["skill-doc", "read", "--id", doc];
|
|
1266
|
-
}
|
|
1267
|
-
case "loadSkill":
|
|
1268
|
-
throw new Error("loadSkill is a local-fs tool and has no CLI mapping; wire buildLoadSkillExecutor instead.");
|
|
1269
|
-
case "listTables": {
|
|
1270
|
-
const cliArgs = ["table", "list"];
|
|
1271
|
-
const limit = noloPositiveIntegerString(args.limit);
|
|
1272
|
-
const space = noloStringArg(args.space ?? args.spaceId);
|
|
1273
|
-
const titleQuery = noloStringArg(args.titleQuery);
|
|
1274
|
-
const purpose = noloStringArg(args.purpose);
|
|
1275
|
-
if (limit) cliArgs.push("--limit", limit);
|
|
1276
|
-
if (space) cliArgs.push("--space", space);
|
|
1277
|
-
if (titleQuery) cliArgs.push("--title-query", titleQuery);
|
|
1278
|
-
if (purpose) cliArgs.push("--purpose", purpose);
|
|
1279
|
-
return cliArgs;
|
|
1280
|
-
}
|
|
1281
|
-
case "queryTableRows": {
|
|
1282
|
-
const table = noloStringArg(args.table ?? args.tableId ?? args.metaKey);
|
|
1283
|
-
if (!table) throw new Error("queryTableRows requires table.");
|
|
1284
|
-
const cliArgs = ["table", "query", "--table", table];
|
|
1285
|
-
const limit = noloPositiveIntegerString(args.limit);
|
|
1286
|
-
const row = noloStringArg(args.row ?? args.rowId);
|
|
1287
|
-
const output = noloStringArg(args.output);
|
|
1288
|
-
if (limit) cliArgs.push("--limit", limit);
|
|
1289
|
-
if (row) cliArgs.push("--row", row);
|
|
1290
|
-
if (output) cliArgs.push("--output", output);
|
|
1291
|
-
return cliArgs;
|
|
1292
|
-
}
|
|
1293
|
-
case "cliWhoami":
|
|
1294
|
-
return ["whoami"];
|
|
1295
|
-
case "cliDoctor":
|
|
1296
|
-
return ["doctor"];
|
|
1297
|
-
default:
|
|
1298
|
-
throw new Error(`Unsupported Nolo workspace tool: ${call.name}`);
|
|
1299
|
-
}
|
|
1300
|
-
}
|
|
1301
|
-
|
|
1302
|
-
// packages/agent-runtime/agentThread.ts
|
|
1303
|
-
var AGENT_THREAD_ACTIVE_STATUSES = ["pending", "running"];
|
|
1304
|
-
var AGENT_THREAD_TERMINAL_STATUSES = ["done", "failed", "cancelled", "orphaned"];
|
|
1305
|
-
|
|
1306
|
-
export {
|
|
1307
|
-
LIST_AGENTS_KEYS_SCHEMA,
|
|
1308
|
-
normalizeListAgentsKeys,
|
|
1309
|
-
createListAgentsKeyMatcher,
|
|
1310
|
-
resolveAgentSelectionPriority,
|
|
1311
|
-
compareAgentSelection,
|
|
1312
|
-
AGENT_SELECTION_PRIORITY_INSTRUCTIONS,
|
|
1313
|
-
isEmptyListAgentsFragmentRequest,
|
|
1314
|
-
DEFAULT_READ_DIALOG_MAX_RESPONSE_CHARS,
|
|
1315
|
-
projectDialogReadForAgent,
|
|
1316
|
-
createStreamingDialogReadProjector,
|
|
1317
|
-
boundSummaryText,
|
|
1318
|
-
buildDialogReadEnvelope,
|
|
1319
|
-
BRIDGE_STREAM_MAX_CHARS,
|
|
1320
|
-
readTextStreamUpToChars,
|
|
1321
|
-
NOLO_WORKSPACE_TOOL_NAMES,
|
|
1322
|
-
CLI_NOLO_WORKSPACE_TOOL_NAMES,
|
|
1323
|
-
filterClientNoloWorkspaceToolNames,
|
|
1324
|
-
buildNoloWorkspaceOpenAiTools,
|
|
1325
|
-
noloPositiveIntegerString,
|
|
1326
|
-
noloStringArg,
|
|
1327
|
-
parseNoloWorkspaceToolArguments,
|
|
1328
|
-
clampNoloPositiveInteger,
|
|
1329
|
-
getNoloDialogIdFromKey,
|
|
1330
|
-
resolveNoloDialogInput,
|
|
1331
|
-
normalizeNoloSpaceInput,
|
|
1332
|
-
getNoloComparableUpdatedAt,
|
|
1333
|
-
buildNoloSubjectRefQueryTarget,
|
|
1334
|
-
normalizeNoloExcludeDialogIds,
|
|
1335
|
-
filterNoloDialogSubjectRefEvidence,
|
|
1336
|
-
verifyNoloDialogSubjectRefQuery,
|
|
1337
|
-
buildNoloTableQueryRequest,
|
|
1338
|
-
buildNoloWorkspaceCommandArgs,
|
|
1339
|
-
buildAgentRuntimeAgentLookupKeys,
|
|
1340
|
-
shouldFetchAgentRuntimeRecordRemotely,
|
|
1341
|
-
AGENT_THREAD_ACTIVE_STATUSES,
|
|
1342
|
-
AGENT_THREAD_TERMINAL_STATUSES
|
|
1343
|
-
};
|