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-DLXL4NSL.js
DELETED
|
@@ -1,1179 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ulid
|
|
3
|
-
} from "./chunk-OJKUU3LP.js";
|
|
4
|
-
import {
|
|
5
|
-
asNonEmptyStringArray
|
|
6
|
-
} from "./chunk-I42VC5KR.js";
|
|
7
|
-
import {
|
|
8
|
-
asTrimmedString
|
|
9
|
-
} from "./chunk-3EUW3WEO.js";
|
|
10
|
-
import {
|
|
11
|
-
asOptionalFiniteNumber
|
|
12
|
-
} from "./chunk-WWC7I6TA.js";
|
|
13
|
-
import {
|
|
14
|
-
asOptionalTrimmedString
|
|
15
|
-
} from "./chunk-G3SUCT4W.js";
|
|
16
|
-
|
|
17
|
-
// packages/core/toTrimmedString.ts
|
|
18
|
-
function toTrimmedString(value) {
|
|
19
|
-
return typeof value === "string" ? value.trim() : value == null ? "" : String(value).trim();
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
// packages/core/userId.ts
|
|
23
|
-
function normalizeUserId(value) {
|
|
24
|
-
const text = asTrimmedString(value);
|
|
25
|
-
return text.startsWith("user:") ? text.slice("user:".length) : text;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
// packages/share/helpers.ts
|
|
29
|
-
var toSafeString = (value) => asTrimmedString(value);
|
|
30
|
-
var toNonEmptyString = (value) => {
|
|
31
|
-
const text = toSafeString(value);
|
|
32
|
-
return text || void 0;
|
|
33
|
-
};
|
|
34
|
-
var toSafeAgentKey = (value) => {
|
|
35
|
-
const text = toSafeString(value);
|
|
36
|
-
return text && isAgentKey(text) ? text : "";
|
|
37
|
-
};
|
|
38
|
-
var SHARE_TIME_FORMATTER = new Intl.DateTimeFormat("zh-CN", {
|
|
39
|
-
timeZone: "Asia/Shanghai",
|
|
40
|
-
year: "numeric",
|
|
41
|
-
month: "2-digit",
|
|
42
|
-
day: "2-digit",
|
|
43
|
-
hour: "2-digit",
|
|
44
|
-
minute: "2-digit",
|
|
45
|
-
second: "2-digit",
|
|
46
|
-
hour12: false
|
|
47
|
-
});
|
|
48
|
-
var findAgentKeyInMessages = (messages) => {
|
|
49
|
-
for (const raw of messages) {
|
|
50
|
-
if (!raw || typeof raw !== "object") continue;
|
|
51
|
-
const key = toSafeAgentKey(raw.cybotKey);
|
|
52
|
-
if (key) return key;
|
|
53
|
-
}
|
|
54
|
-
return "";
|
|
55
|
-
};
|
|
56
|
-
var findAgentKeyInArray = (items) => {
|
|
57
|
-
for (const raw of items) {
|
|
58
|
-
const direct = toSafeAgentKey(raw);
|
|
59
|
-
if (direct) return direct;
|
|
60
|
-
if (!raw || typeof raw !== "object") continue;
|
|
61
|
-
const item = raw;
|
|
62
|
-
const key = toSafeAgentKey(item.dbKey) || toSafeAgentKey(item.id);
|
|
63
|
-
if (key) return key;
|
|
64
|
-
}
|
|
65
|
-
return "";
|
|
66
|
-
};
|
|
67
|
-
var findAgentNameInMessages = (messages) => {
|
|
68
|
-
for (const raw of messages) {
|
|
69
|
-
if (!raw || typeof raw !== "object") continue;
|
|
70
|
-
const msg = raw;
|
|
71
|
-
const name = toSafeString(msg.agentName) || toSafeString(msg.cybotName) || toSafeString(msg.sourceAgentName);
|
|
72
|
-
if (name) return name;
|
|
73
|
-
}
|
|
74
|
-
return "";
|
|
75
|
-
};
|
|
76
|
-
var findAgentNameInArray = (items) => {
|
|
77
|
-
for (const raw of items) {
|
|
78
|
-
if (!raw || typeof raw !== "object") continue;
|
|
79
|
-
const item = raw;
|
|
80
|
-
const name = toSafeString(item.name) || toSafeString(item.agentName) || toSafeString(item.cybotName) || toSafeString(item.sourceAgentName);
|
|
81
|
-
if (name) return name;
|
|
82
|
-
}
|
|
83
|
-
return "";
|
|
84
|
-
};
|
|
85
|
-
var extractAgentInfo = (type, data) => {
|
|
86
|
-
const meta = data.meta;
|
|
87
|
-
const keyCandidates = [
|
|
88
|
-
meta?.sourceAgentKey,
|
|
89
|
-
meta?.agentKey,
|
|
90
|
-
data.sourceAgentKey,
|
|
91
|
-
data.agentKey,
|
|
92
|
-
data.cybotKey,
|
|
93
|
-
type === "cybot" ? data.dbKey ?? data.id : void 0
|
|
94
|
-
];
|
|
95
|
-
let agentKey = "";
|
|
96
|
-
for (const candidate of keyCandidates) {
|
|
97
|
-
agentKey = toSafeAgentKey(candidate);
|
|
98
|
-
if (agentKey) break;
|
|
99
|
-
}
|
|
100
|
-
if (!agentKey && Array.isArray(data.cybots)) {
|
|
101
|
-
agentKey = findAgentKeyInArray(data.cybots);
|
|
102
|
-
}
|
|
103
|
-
if (!agentKey && Array.isArray(data.messages)) {
|
|
104
|
-
agentKey = findAgentKeyInMessages(data.messages);
|
|
105
|
-
}
|
|
106
|
-
if (!agentKey && Array.isArray(data.history)) {
|
|
107
|
-
agentKey = findAgentKeyInMessages(data.history);
|
|
108
|
-
}
|
|
109
|
-
const nameCandidates = [
|
|
110
|
-
meta?.sourceAgentName,
|
|
111
|
-
meta?.agentName,
|
|
112
|
-
meta?.cybotName,
|
|
113
|
-
data.sourceAgentName,
|
|
114
|
-
data.agentName,
|
|
115
|
-
data.cybotName,
|
|
116
|
-
type === "cybot" ? data.name : void 0
|
|
117
|
-
];
|
|
118
|
-
let agentName = "";
|
|
119
|
-
for (const candidate of nameCandidates) {
|
|
120
|
-
agentName = toSafeString(candidate);
|
|
121
|
-
if (agentName) break;
|
|
122
|
-
}
|
|
123
|
-
if (!agentName && Array.isArray(data.cybots)) {
|
|
124
|
-
agentName = findAgentNameInArray(data.cybots);
|
|
125
|
-
}
|
|
126
|
-
if (!agentName && Array.isArray(data.messages)) {
|
|
127
|
-
agentName = findAgentNameInMessages(data.messages);
|
|
128
|
-
}
|
|
129
|
-
if (!agentName && Array.isArray(data.history)) {
|
|
130
|
-
agentName = findAgentNameInMessages(data.history);
|
|
131
|
-
}
|
|
132
|
-
return {
|
|
133
|
-
...agentKey ? { sourceAgentKey: agentKey } : {},
|
|
134
|
-
...agentName ? { sourceAgentName: agentName } : {}
|
|
135
|
-
};
|
|
136
|
-
};
|
|
137
|
-
var extractImageFromContent = (content) => {
|
|
138
|
-
if (Array.isArray(content)) {
|
|
139
|
-
const part = content.find(
|
|
140
|
-
(p) => p?.type === "image_url" && typeof p?.image_url?.url === "string"
|
|
141
|
-
);
|
|
142
|
-
if (part?.image_url?.url) return part.image_url.url;
|
|
143
|
-
}
|
|
144
|
-
if (typeof content === "string") {
|
|
145
|
-
const match = content.match(/!\[.*?\]\((.*?)\)/);
|
|
146
|
-
if (match?.[1]) return match[1];
|
|
147
|
-
}
|
|
148
|
-
return void 0;
|
|
149
|
-
};
|
|
150
|
-
var extractCoverImage = (type, data) => {
|
|
151
|
-
if (type === "image" /* IMAGE */) {
|
|
152
|
-
return toNonEmptyString(data.url);
|
|
153
|
-
}
|
|
154
|
-
if (type === "app" /* APP */) {
|
|
155
|
-
return toNonEmptyString(data.coverImage);
|
|
156
|
-
}
|
|
157
|
-
if (type !== "dialog" /* DIALOG */) return void 0;
|
|
158
|
-
const messages = Array.isArray(data.messages) ? data.messages : Array.isArray(data.history) ? data.history : [];
|
|
159
|
-
for (const msg of messages) {
|
|
160
|
-
const fromContent = extractImageFromContent(msg.content);
|
|
161
|
-
if (fromContent) return fromContent;
|
|
162
|
-
const image = toNonEmptyString(msg.image);
|
|
163
|
-
if (image) return image;
|
|
164
|
-
if (Array.isArray(msg.images)) {
|
|
165
|
-
const first = asNonEmptyStringArray(msg.images)[0];
|
|
166
|
-
if (first) return first;
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
return void 0;
|
|
170
|
-
};
|
|
171
|
-
var resolveShareAuthorIdentity = (args) => {
|
|
172
|
-
const authorName = toNonEmptyString(args.profile?.nickname) ?? toNonEmptyString(args.user?.name) ?? toNonEmptyString(args.user?.nickname) ?? toNonEmptyString(args.user?.username) ?? toNonEmptyString(args.fallbackName);
|
|
173
|
-
const authorAvatar = toNonEmptyString(args.profile?.avatar) ?? toNonEmptyString(args.user?.avatar) ?? toNonEmptyString(args.fallbackAvatar);
|
|
174
|
-
return {
|
|
175
|
-
...authorName ? { authorName } : {},
|
|
176
|
-
...authorAvatar ? { authorAvatar } : {}
|
|
177
|
-
};
|
|
178
|
-
};
|
|
179
|
-
var SENSITIVE_FIELDS = ["apiKey", "secret", "password"];
|
|
180
|
-
var sanitizeShareData = (data) => {
|
|
181
|
-
const snapshot = { ...data };
|
|
182
|
-
for (const field of SENSITIVE_FIELDS) {
|
|
183
|
-
delete snapshot[field];
|
|
184
|
-
}
|
|
185
|
-
return snapshot;
|
|
186
|
-
};
|
|
187
|
-
|
|
188
|
-
// packages/share/keys.ts
|
|
189
|
-
var SHARE_PREFIX = "share";
|
|
190
|
-
var SHARE_INDEX_PREFIX = "shareidx";
|
|
191
|
-
var TIMESTAMP_MAX = 9999999999999;
|
|
192
|
-
var normalizeToken = (value) => toTrimmedString(value);
|
|
193
|
-
var normalizeCreatedAt = (value) => {
|
|
194
|
-
const parsed = Math.floor(Number(value));
|
|
195
|
-
if (!Number.isFinite(parsed) || parsed < 0) return 0;
|
|
196
|
-
return Math.min(parsed, TIMESTAMP_MAX);
|
|
197
|
-
};
|
|
198
|
-
var toInvertedTimestamp = (value) => String(TIMESTAMP_MAX - normalizeCreatedAt(value)).padStart(13, "0");
|
|
199
|
-
var normalizeDimensionValue = (dim, raw) => dim === "creator" ? normalizeUserId(raw) : toSafeAgentKey(raw);
|
|
200
|
-
var createCommunityIndex = (dim, rawValue, createdAt, token) => {
|
|
201
|
-
const value = normalizeDimensionValue(dim, rawValue);
|
|
202
|
-
const normalizedToken = normalizeToken(token);
|
|
203
|
-
if (!value || !normalizedToken) return "";
|
|
204
|
-
return createKey(SHARE_INDEX_PREFIX, "community", dim, value, toInvertedTimestamp(createdAt), normalizedToken);
|
|
205
|
-
};
|
|
206
|
-
var createCommunityRange = (dim, rawValue) => {
|
|
207
|
-
const value = normalizeDimensionValue(dim, rawValue);
|
|
208
|
-
if (!value) return { start: "", end: "" };
|
|
209
|
-
const start = createKey(SHARE_INDEX_PREFIX, "community", dim, value, "");
|
|
210
|
-
return { start, end: start + "\uFFFF" };
|
|
211
|
-
};
|
|
212
|
-
var createCommunityAllIndex = (createdAt, token) => {
|
|
213
|
-
const normalizedToken = normalizeToken(token);
|
|
214
|
-
if (!normalizedToken) return "";
|
|
215
|
-
return createKey(SHARE_INDEX_PREFIX, "community", "all", toInvertedTimestamp(createdAt), normalizedToken);
|
|
216
|
-
};
|
|
217
|
-
var createCommunityAllRange = () => {
|
|
218
|
-
const start = createKey(SHARE_INDEX_PREFIX, "community", "all", "");
|
|
219
|
-
return { start, end: start + "\uFFFF" };
|
|
220
|
-
};
|
|
221
|
-
var createOwnerIndex = (rawUserId, createdAt, token) => {
|
|
222
|
-
const userId = normalizeUserId(rawUserId);
|
|
223
|
-
const normalizedToken = normalizeToken(token);
|
|
224
|
-
if (!userId || !normalizedToken) return "";
|
|
225
|
-
return createKey(SHARE_INDEX_PREFIX, "owner", userId, toInvertedTimestamp(createdAt), normalizedToken);
|
|
226
|
-
};
|
|
227
|
-
var createOwnerRange = (rawUserId) => {
|
|
228
|
-
const userId = normalizeUserId(rawUserId);
|
|
229
|
-
if (!userId) return { start: "", end: "" };
|
|
230
|
-
const start = createKey(SHARE_INDEX_PREFIX, "owner", userId, "");
|
|
231
|
-
return { start, end: start + "\uFFFF" };
|
|
232
|
-
};
|
|
233
|
-
var findAgentKeyInArray2 = (arr) => {
|
|
234
|
-
for (const item of arr) {
|
|
235
|
-
const key = toSafeAgentKey(item);
|
|
236
|
-
if (key) return key;
|
|
237
|
-
}
|
|
238
|
-
return "";
|
|
239
|
-
};
|
|
240
|
-
var findAgentKeyInMessages2 = (messages) => {
|
|
241
|
-
for (const raw of messages) {
|
|
242
|
-
if (!raw || typeof raw !== "object") continue;
|
|
243
|
-
const key = toSafeAgentKey(raw.cybotKey);
|
|
244
|
-
if (key) return key;
|
|
245
|
-
}
|
|
246
|
-
return "";
|
|
247
|
-
};
|
|
248
|
-
var resolveAgentKeyFromPayload = (data) => {
|
|
249
|
-
if (!data || typeof data !== "object") return "";
|
|
250
|
-
const meta = data?.meta;
|
|
251
|
-
const payload = data?.data;
|
|
252
|
-
const directCandidates = [
|
|
253
|
-
meta?.sourceAgentKey,
|
|
254
|
-
meta?.agentKey,
|
|
255
|
-
data?.sourceAgentKey,
|
|
256
|
-
data?.agentKey,
|
|
257
|
-
data?.cybotKey,
|
|
258
|
-
data?.type === "cybot" ? data?.dbKey ?? data?.id : ""
|
|
259
|
-
];
|
|
260
|
-
for (const c of directCandidates) {
|
|
261
|
-
const key = toSafeAgentKey(c);
|
|
262
|
-
if (key) return key;
|
|
263
|
-
}
|
|
264
|
-
if (payload && typeof payload === "object") {
|
|
265
|
-
const payloadCandidates = [
|
|
266
|
-
payload?.sourceAgentKey,
|
|
267
|
-
payload?.agentKey,
|
|
268
|
-
payload?.cybotKey,
|
|
269
|
-
payload?.meta?.sourceAgentKey,
|
|
270
|
-
payload?.meta?.agentKey,
|
|
271
|
-
data?.type === "cybot" ? payload?.dbKey ?? payload?.id : ""
|
|
272
|
-
];
|
|
273
|
-
for (const c of payloadCandidates) {
|
|
274
|
-
const key = toSafeAgentKey(c);
|
|
275
|
-
if (key) return key;
|
|
276
|
-
}
|
|
277
|
-
if (Array.isArray(payload?.cybots)) {
|
|
278
|
-
const key = findAgentKeyInArray2(payload.cybots);
|
|
279
|
-
if (key) return key;
|
|
280
|
-
}
|
|
281
|
-
if (Array.isArray(payload?.messages)) {
|
|
282
|
-
const key = findAgentKeyInMessages2(payload.messages);
|
|
283
|
-
if (key) return key;
|
|
284
|
-
}
|
|
285
|
-
if (Array.isArray(payload?.history)) {
|
|
286
|
-
const key = findAgentKeyInMessages2(payload.history);
|
|
287
|
-
if (key) return key;
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
return "";
|
|
291
|
-
};
|
|
292
|
-
var shareKey = {
|
|
293
|
-
create: (token) => createKey(SHARE_PREFIX, token),
|
|
294
|
-
range: () => {
|
|
295
|
-
const start = createKey(SHARE_PREFIX, "");
|
|
296
|
-
return { start, end: start + "\uFFFF" };
|
|
297
|
-
},
|
|
298
|
-
isShareKey: (key) => {
|
|
299
|
-
const parts = splitKey(key);
|
|
300
|
-
return parts.length >= 2 && parts[0] === SHARE_PREFIX;
|
|
301
|
-
},
|
|
302
|
-
tokenFromKey: (key) => {
|
|
303
|
-
if (!shareKey.isShareKey(key)) return "";
|
|
304
|
-
return key.slice(`${SHARE_PREFIX}-`.length).trim();
|
|
305
|
-
},
|
|
306
|
-
// Creator dimension
|
|
307
|
-
communityCreatorIndex: (authorId, createdAt, token) => createCommunityIndex("creator", authorId, createdAt, token),
|
|
308
|
-
communityCreatorRange: (authorId) => createCommunityRange("creator", authorId),
|
|
309
|
-
// Agent dimension
|
|
310
|
-
communityAgentIndex: (agentKey, createdAt, token) => createCommunityIndex("agent", agentKey, createdAt, token),
|
|
311
|
-
communityAgentRange: (agentKey) => createCommunityRange("agent", agentKey),
|
|
312
|
-
// Owner dimension (all shares, for "My Shares")
|
|
313
|
-
ownerIndex: (userId, createdAt, token) => createOwnerIndex(userId, createdAt, token),
|
|
314
|
-
ownerRange: (userId) => createOwnerRange(userId),
|
|
315
|
-
// Global community feed (all community shares, time-ordered)
|
|
316
|
-
communityAllIndex: (createdAt, token) => createCommunityAllIndex(createdAt, token),
|
|
317
|
-
communityAllRange: () => createCommunityAllRange(),
|
|
318
|
-
// From existing share data → index keys
|
|
319
|
-
communityCreatorIndexFromShare: (dbKey, data) => {
|
|
320
|
-
if (!shareKey.isShareKey(dbKey)) return "";
|
|
321
|
-
if (data?.meta?.visibility !== "community") return "";
|
|
322
|
-
const token = shareKey.tokenFromKey(dbKey);
|
|
323
|
-
return shareKey.communityCreatorIndex(data?.meta?.authorId, data?.meta?.createdAt, token);
|
|
324
|
-
},
|
|
325
|
-
communityAgentIndexFromShare: (dbKey, data) => {
|
|
326
|
-
if (!shareKey.isShareKey(dbKey)) return "";
|
|
327
|
-
if (data?.meta?.visibility !== "community") return "";
|
|
328
|
-
const token = shareKey.tokenFromKey(dbKey);
|
|
329
|
-
const agentKey = resolveAgentKeyFromPayload(data);
|
|
330
|
-
return shareKey.communityAgentIndex(agentKey, data?.meta?.createdAt, token);
|
|
331
|
-
},
|
|
332
|
-
ownerIndexFromShare: (dbKey, data) => {
|
|
333
|
-
if (!shareKey.isShareKey(dbKey)) return "";
|
|
334
|
-
const token = shareKey.tokenFromKey(dbKey);
|
|
335
|
-
return shareKey.ownerIndex(data?.meta?.authorId, data?.meta?.createdAt, token);
|
|
336
|
-
},
|
|
337
|
-
communityAllIndexFromShare: (dbKey, data) => {
|
|
338
|
-
if (!shareKey.isShareKey(dbKey)) return "";
|
|
339
|
-
if (data?.meta?.visibility !== "community") return "";
|
|
340
|
-
const token = shareKey.tokenFromKey(dbKey);
|
|
341
|
-
return shareKey.communityAllIndex(data?.meta?.createdAt, token);
|
|
342
|
-
},
|
|
343
|
-
communityIndexKeysFromShare: (dbKey, data) => {
|
|
344
|
-
const all = shareKey.communityAllIndexFromShare(dbKey, data);
|
|
345
|
-
const creator = shareKey.communityCreatorIndexFromShare(dbKey, data);
|
|
346
|
-
const agent = shareKey.communityAgentIndexFromShare(dbKey, data);
|
|
347
|
-
return Array.from(new Set([all, creator, agent].filter(Boolean)));
|
|
348
|
-
},
|
|
349
|
-
allIndexKeysFromShare: (dbKey, data) => {
|
|
350
|
-
const owner = shareKey.ownerIndexFromShare(dbKey, data);
|
|
351
|
-
const community = shareKey.communityIndexKeysFromShare(dbKey, data);
|
|
352
|
-
return Array.from(new Set([owner, ...community].filter(Boolean)));
|
|
353
|
-
}
|
|
354
|
-
};
|
|
355
|
-
|
|
356
|
-
// packages/database/keys.ts
|
|
357
|
-
function curry2(fn) {
|
|
358
|
-
function curried(a, b) {
|
|
359
|
-
return arguments.length >= 2 ? fn(a, b) : (b2) => fn(a, b2);
|
|
360
|
-
}
|
|
361
|
-
return curried;
|
|
362
|
-
}
|
|
363
|
-
var SEPARATOR = "-";
|
|
364
|
-
var createKey = (...parts) => parts.join(SEPARATOR);
|
|
365
|
-
var splitKey = (key) => key.split(SEPARATOR);
|
|
366
|
-
var TYPE_STORAGE_PREFIXES = {
|
|
367
|
-
["app" /* APP */]: ["app"],
|
|
368
|
-
["page" /* DOC */]: ["page"],
|
|
369
|
-
["dialog" /* DIALOG */]: ["dialog"],
|
|
370
|
-
["image" /* IMAGE */]: ["image"],
|
|
371
|
-
["file" /* FILE */]: ["file"],
|
|
372
|
-
["table" /* TABLE */]: ["meta", "table"],
|
|
373
|
-
["agent" /* AGENT */]: ["agent"]
|
|
374
|
-
};
|
|
375
|
-
var _PREFIX_TO_TYPE = (() => {
|
|
376
|
-
const map = /* @__PURE__ */ new Map();
|
|
377
|
-
for (const [type, prefixes] of Object.entries(TYPE_STORAGE_PREFIXES)) {
|
|
378
|
-
for (const prefix of prefixes) {
|
|
379
|
-
if (!map.has(prefix)) map.set(prefix, type);
|
|
380
|
-
}
|
|
381
|
-
}
|
|
382
|
-
return map;
|
|
383
|
-
})();
|
|
384
|
-
function inferTypeFromDbKey(dbKey) {
|
|
385
|
-
if (!dbKey) return null;
|
|
386
|
-
const firstSep = dbKey.indexOf(SEPARATOR);
|
|
387
|
-
if (firstSep < 0) return null;
|
|
388
|
-
const prefix = dbKey.slice(0, firstSep);
|
|
389
|
-
return _PREFIX_TO_TYPE.get(prefix) ?? null;
|
|
390
|
-
}
|
|
391
|
-
var isTableMetaKey = (key) => {
|
|
392
|
-
const parts = splitKey(key);
|
|
393
|
-
return parts.length >= 3 && parts[0] === "meta";
|
|
394
|
-
};
|
|
395
|
-
var isPageKey = (key) => {
|
|
396
|
-
const parts = splitKey(key);
|
|
397
|
-
return parts.length >= 3 && parts[0] === "page" /* DOC */;
|
|
398
|
-
};
|
|
399
|
-
var isTaskKey = (key) => {
|
|
400
|
-
const parts = splitKey(key);
|
|
401
|
-
return parts.length >= 3 && parts[0] === "task" /* TASK */;
|
|
402
|
-
};
|
|
403
|
-
var isAgentAutomationKey = (key) => {
|
|
404
|
-
return key.startsWith(`${"agent-automation" /* AGENT_AUTOMATION */}-`);
|
|
405
|
-
};
|
|
406
|
-
var isFileKey = (key) => {
|
|
407
|
-
const parts = splitKey(key);
|
|
408
|
-
return parts.length >= 3 && (parts[0] === "file" /* FILE */ || parts[0] === "image" /* IMAGE */);
|
|
409
|
-
};
|
|
410
|
-
var isAgentKey = (key) => {
|
|
411
|
-
const parts = splitKey(key);
|
|
412
|
-
return parts.length >= 3 && parts[0] === "agent" /* AGENT */;
|
|
413
|
-
};
|
|
414
|
-
var isAppKey = (key) => {
|
|
415
|
-
const parts = splitKey(key);
|
|
416
|
-
return parts.length >= 2 && parts[0] === "app" /* APP */;
|
|
417
|
-
};
|
|
418
|
-
var isEmailKey = (key) => {
|
|
419
|
-
const parts = splitKey(key);
|
|
420
|
-
return parts.length >= 3 && parts[0] === "email" /* EMAIL */;
|
|
421
|
-
};
|
|
422
|
-
var rowKey = {
|
|
423
|
-
/** 生成新行主键 + rowId */
|
|
424
|
-
create: (tenantId, tableId) => {
|
|
425
|
-
const rowId = ulid();
|
|
426
|
-
return { dbKey: createKey("row", tenantId, tableId, rowId), rowId };
|
|
427
|
-
},
|
|
428
|
-
/** 单行键 */
|
|
429
|
-
single: (tenantId, tableId, rowId) => createKey("row", tenantId, tableId, rowId),
|
|
430
|
-
/** 整张表的范围(gte / lte)—— 供批量操作使用 */
|
|
431
|
-
range: (tenantId, tableId) => {
|
|
432
|
-
const start = createKey("row", tenantId, tableId, "");
|
|
433
|
-
return {
|
|
434
|
-
gte: start,
|
|
435
|
-
lte: start + "\uFFFF"
|
|
436
|
-
};
|
|
437
|
-
},
|
|
438
|
-
/** 旧接口(start / end)—— 与早期代码兼容 */
|
|
439
|
-
rangeOfTable: (tenantId, tableId) => {
|
|
440
|
-
const start = createKey("row", tenantId, tableId, "");
|
|
441
|
-
return {
|
|
442
|
-
start,
|
|
443
|
-
end: start + "\uFFFF"
|
|
444
|
-
};
|
|
445
|
-
},
|
|
446
|
-
/** 某个租户的所有行范围 */
|
|
447
|
-
rangeOfTenant: (tenantId) => {
|
|
448
|
-
const start = createKey("row", tenantId, "");
|
|
449
|
-
return {
|
|
450
|
-
start,
|
|
451
|
-
end: start + "\uFFFF"
|
|
452
|
-
};
|
|
453
|
-
}
|
|
454
|
-
};
|
|
455
|
-
var idxKey = {
|
|
456
|
-
/** 写入单条索引 */
|
|
457
|
-
put: (tenantId, tableId, indexName, indexKey, rowId) => createKey("idx", tenantId, tableId, indexName, indexKey, rowId),
|
|
458
|
-
/** 某一索引名前缀的范围(start / end)—— 供前缀扫描 */
|
|
459
|
-
range: (tenantId, tableId, indexName, indexKeyPrefix = "") => {
|
|
460
|
-
const start = createKey(
|
|
461
|
-
"idx",
|
|
462
|
-
tenantId,
|
|
463
|
-
tableId,
|
|
464
|
-
indexName,
|
|
465
|
-
indexKeyPrefix
|
|
466
|
-
);
|
|
467
|
-
return { start, end: start + "\uFFFF" };
|
|
468
|
-
},
|
|
469
|
-
/** 整张表所有索引的范围(gte / lte)—— 供整表删除 */
|
|
470
|
-
prefix: (tenantId, tableId) => {
|
|
471
|
-
const start = createKey("idx", tenantId, tableId, "");
|
|
472
|
-
return {
|
|
473
|
-
gte: start,
|
|
474
|
-
lte: start + "\uFFFF"
|
|
475
|
-
};
|
|
476
|
-
},
|
|
477
|
-
/** 某个租户的所有索引范围 */
|
|
478
|
-
rangeOfTenant: (tenantId) => {
|
|
479
|
-
const start = createKey("idx", tenantId, "");
|
|
480
|
-
return {
|
|
481
|
-
start,
|
|
482
|
-
end: start + "\uFFFF"
|
|
483
|
-
};
|
|
484
|
-
}
|
|
485
|
-
};
|
|
486
|
-
var metaKey = Object.assign(
|
|
487
|
-
(tenantId, tableId) => createKey("meta", tenantId, tableId),
|
|
488
|
-
{
|
|
489
|
-
/** 某个租户的所有表定义范围 */
|
|
490
|
-
rangeOfTenant: (tenantId) => {
|
|
491
|
-
const start = createKey("meta", tenantId, "");
|
|
492
|
-
return {
|
|
493
|
-
start,
|
|
494
|
-
end: start + "\uFFFF"
|
|
495
|
-
};
|
|
496
|
-
}
|
|
497
|
-
}
|
|
498
|
-
);
|
|
499
|
-
var viewKey = {
|
|
500
|
-
/** 创建一个新视图 key + viewId(由调用方生成或传入) */
|
|
501
|
-
create: (tenantId, tableId, viewId) => {
|
|
502
|
-
const id = viewId || ulid();
|
|
503
|
-
const dbKey = createKey("view", tenantId, tableId, id);
|
|
504
|
-
return { dbKey, id };
|
|
505
|
-
},
|
|
506
|
-
/** 某一视图的单键 */
|
|
507
|
-
single: (tenantId, tableId, viewId) => createKey("view", tenantId, tableId, viewId),
|
|
508
|
-
/** 某张表下面的所有视图范围 */
|
|
509
|
-
rangeOfTable: (tenantId, tableId) => {
|
|
510
|
-
const start = createKey("view", tenantId, tableId, "");
|
|
511
|
-
return {
|
|
512
|
-
start,
|
|
513
|
-
end: start + "\uFFFF"
|
|
514
|
-
};
|
|
515
|
-
},
|
|
516
|
-
/** 某个租户的所有视图范围 */
|
|
517
|
-
rangeOfTenant: (tenantId) => {
|
|
518
|
-
const start = createKey("view", tenantId, "");
|
|
519
|
-
return {
|
|
520
|
-
start,
|
|
521
|
-
end: start + "\uFFFF"
|
|
522
|
-
};
|
|
523
|
-
}
|
|
524
|
-
};
|
|
525
|
-
var DB_PREFIX = {
|
|
526
|
-
USER: "user:"
|
|
527
|
-
};
|
|
528
|
-
var createOAuthCredentialKey = (userId, provider) => createKey("oauth", userId, provider);
|
|
529
|
-
var oauthCredentialUserRange = (userId) => ({
|
|
530
|
-
start: createKey("oauth", userId, ""),
|
|
531
|
-
end: createKey("oauth", userId, "\uFFFF")
|
|
532
|
-
});
|
|
533
|
-
var USER_SETTINGS_KEY_SUFFIX = `${SEPARATOR}settings`;
|
|
534
|
-
var createUserKey = {
|
|
535
|
-
settings: (userId) => `${userId}${USER_SETTINGS_KEY_SUFFIX}`,
|
|
536
|
-
profile: (userId) => createKey(userId, "profile")
|
|
537
|
-
};
|
|
538
|
-
var createUserPreferenceKey = {
|
|
539
|
-
single: (userId, preferenceName) => createKey("user", "pref", userId, preferenceName),
|
|
540
|
-
authorityHome: (userId) => createKey("user", "pref", userId, "authority_home"),
|
|
541
|
-
defaultAgent: (userId) => createKey("user", "pref", userId, "agent_default"),
|
|
542
|
-
rangeOfUser: (userId) => ({
|
|
543
|
-
start: createKey("user", "pref", userId, ""),
|
|
544
|
-
end: createKey("user", "pref", userId, "\uFFFF")
|
|
545
|
-
})
|
|
546
|
-
};
|
|
547
|
-
var createMemoryKey = (ownerType, ownerId, memoryId) => createKey("mem", ownerType, ownerId, memoryId);
|
|
548
|
-
var createMemoryOwnerIndexKey = (ownerType, ownerId, createdAt, memoryId) => createKey("memidx", "owner", ownerType, ownerId, createdAt, memoryId);
|
|
549
|
-
var createMemorySubjectKindIndexKey = (subjectType, subjectId, kind, createdAt, memoryId) => createKey(
|
|
550
|
-
"memidx",
|
|
551
|
-
"subject",
|
|
552
|
-
subjectType,
|
|
553
|
-
subjectId,
|
|
554
|
-
kind,
|
|
555
|
-
createdAt,
|
|
556
|
-
memoryId
|
|
557
|
-
);
|
|
558
|
-
var isMemoryKey = (key) => {
|
|
559
|
-
const parts = splitKey(key);
|
|
560
|
-
return parts.length >= 4 && parts[0] === "mem";
|
|
561
|
-
};
|
|
562
|
-
var memoryOwnerRange = (ownerType, ownerId) => ({
|
|
563
|
-
start: createKey("memidx", "owner", ownerType, ownerId, ""),
|
|
564
|
-
end: createKey("memidx", "owner", ownerType, ownerId, "\uFFFF")
|
|
565
|
-
});
|
|
566
|
-
var memorySubjectKindRange = (subjectType, subjectId, kind) => ({
|
|
567
|
-
start: createKey("memidx", "subject", subjectType, subjectId, kind, ""),
|
|
568
|
-
end: createKey("memidx", "subject", subjectType, subjectId, kind, "\uFFFF")
|
|
569
|
-
});
|
|
570
|
-
var createTransactionKey = {
|
|
571
|
-
record: curry2(
|
|
572
|
-
(userId, txId) => createKey("tx", userId, txId)
|
|
573
|
-
),
|
|
574
|
-
index: (txId) => createKey("tx", "index", txId),
|
|
575
|
-
range: (userId) => ({
|
|
576
|
-
start: createKey("tx", userId, ""),
|
|
577
|
-
end: createKey("tx", userId, "\uFFFF")
|
|
578
|
-
})
|
|
579
|
-
};
|
|
580
|
-
var createTokenKey = {
|
|
581
|
-
record: curry2(
|
|
582
|
-
(userId, timestamp) => createKey("token", userId, timestamp.toString())
|
|
583
|
-
),
|
|
584
|
-
/**
|
|
585
|
-
* 单次计费记录:`token/<user>/<timestamp>/<chargeId>`。
|
|
586
|
-
*
|
|
587
|
-
* 与 `record` 的唯一区别是把「本次计费自己的唯一 id」作为额外一段拼在末尾
|
|
588
|
-
* —— 同一用户同一毫秒内的两笔合法计费因此各占一个 key,不再互相覆盖,
|
|
589
|
-
* 也不会共用同一个账本 txId / 幂等键(`token-<tokenKey>` / `token:<tokenKey>`)
|
|
590
|
-
* 而被账本判为 duplicate 静默漏扣。
|
|
591
|
-
*
|
|
592
|
-
* 兼容性:timestamp 仍是第二段且保持首位排序,因此
|
|
593
|
-
* - `rangeOfUser(userId)`(usage/统计等读取路径用的全前缀范围)照常覆盖;
|
|
594
|
-
* - `range(userId, ts)` 的 `token/<user>/<ts>` … `token/<user>/<ts+1d>`
|
|
595
|
-
* 区间同样覆盖新 key(`<ts>-xxx` > `<ts>` 且 < `<ts+1>`),历史数据
|
|
596
|
-
* 与新数据可以在同一区间里混扫。
|
|
597
|
-
* 幂等键的稳定性由调用方决定:需要「重试同一笔」时传稳定的 chargeId。
|
|
598
|
-
*/
|
|
599
|
-
recordForCharge: (userId, timestamp, chargeId) => createKey("token", userId, timestamp.toString(), encodeURIComponent(chargeId)),
|
|
600
|
-
/** Server provider-call record: retry-stable even when the retry clock changes. */
|
|
601
|
-
recordForStableCall: (userId, callId) => createKey("token", userId, "call", encodeURIComponent(callId)),
|
|
602
|
-
/** Server provider-call failure audit record: preserved separately from retry success in a collision-free namespace. */
|
|
603
|
-
recordForFailedStableCall: (userId, callId) => createKey("token", userId, "failed-call", encodeURIComponent(callId)),
|
|
604
|
-
range: (userId, timestamp) => ({
|
|
605
|
-
start: createKey("token", userId, timestamp.toString()),
|
|
606
|
-
end: createKey("token", userId, (timestamp + 864e5).toString())
|
|
607
|
-
}),
|
|
608
|
-
/** 某个用户的所有 Token 记录范围 */
|
|
609
|
-
rangeOfUser: (userId) => ({
|
|
610
|
-
start: createKey("token", userId, ""),
|
|
611
|
-
end: createKey("token", userId, "\uFFFF")
|
|
612
|
-
})
|
|
613
|
-
};
|
|
614
|
-
var TOKEN_DIALOG_INDEX_PREFIX = "idx-token-dialog";
|
|
615
|
-
var encodeTokenIndexSegment = (segment) => {
|
|
616
|
-
let out = "";
|
|
617
|
-
for (const ch of segment) {
|
|
618
|
-
if (/[A-Za-z0-9]/.test(ch)) {
|
|
619
|
-
out += ch;
|
|
620
|
-
continue;
|
|
621
|
-
}
|
|
622
|
-
for (const byte of new TextEncoder().encode(ch)) {
|
|
623
|
-
out += `%${byte.toString(16).toUpperCase().padStart(2, "0")}`;
|
|
624
|
-
}
|
|
625
|
-
}
|
|
626
|
-
return out;
|
|
627
|
-
};
|
|
628
|
-
var createTokenDialogIndexKey = Object.assign(
|
|
629
|
-
(userId, dialogId, callId) => createKey(
|
|
630
|
-
TOKEN_DIALOG_INDEX_PREFIX,
|
|
631
|
-
encodeTokenIndexSegment(userId),
|
|
632
|
-
encodeTokenIndexSegment(dialogId),
|
|
633
|
-
encodeTokenIndexSegment(callId)
|
|
634
|
-
),
|
|
635
|
-
{
|
|
636
|
-
/** 某个用户在某个对话下的全部索引项范围(范围扫描用) */
|
|
637
|
-
rangeOfDialog: (userId, dialogId) => ({
|
|
638
|
-
start: createKey(
|
|
639
|
-
TOKEN_DIALOG_INDEX_PREFIX,
|
|
640
|
-
encodeTokenIndexSegment(userId),
|
|
641
|
-
encodeTokenIndexSegment(dialogId),
|
|
642
|
-
""
|
|
643
|
-
),
|
|
644
|
-
end: createKey(
|
|
645
|
-
TOKEN_DIALOG_INDEX_PREFIX,
|
|
646
|
-
encodeTokenIndexSegment(userId),
|
|
647
|
-
encodeTokenIndexSegment(dialogId),
|
|
648
|
-
"\uFFFF"
|
|
649
|
-
)
|
|
650
|
-
})
|
|
651
|
-
}
|
|
652
|
-
);
|
|
653
|
-
var TOKEN_DIALOG_INDEX_FORMAT = "v2";
|
|
654
|
-
var createTokenDialogBackfillKey = (userId) => createKey("idx-tokendlg-backfill", encodeTokenIndexSegment(userId));
|
|
655
|
-
var createTokenStatsKey = Object.assign(
|
|
656
|
-
(userId, dateKey) => createKey("token", "stats", "day", "user", userId, dateKey),
|
|
657
|
-
{
|
|
658
|
-
/** 某个用户的所有统计记录范围 */
|
|
659
|
-
rangeOfUser: (userId) => ({
|
|
660
|
-
start: createKey("token", "stats", "day", "user", userId, ""),
|
|
661
|
-
end: createKey("token", "stats", "day", "user", userId, "\uFFFF")
|
|
662
|
-
})
|
|
663
|
-
}
|
|
664
|
-
);
|
|
665
|
-
var createTokenStatsAppliedKey = Object.assign(
|
|
666
|
-
(userId, chargeKey) => createKey("token", "charge-stats", userId, encodeURIComponent(chargeKey)),
|
|
667
|
-
{
|
|
668
|
-
/** 某个用户的全部计费幂等标记范围:token-charge-stats-<userId>-* */
|
|
669
|
-
rangeOfUser: (userId) => ({
|
|
670
|
-
start: createKey("token", "charge-stats", userId, ""),
|
|
671
|
-
end: createKey("token", "charge-stats", userId, "\uFFFF")
|
|
672
|
-
})
|
|
673
|
-
}
|
|
674
|
-
);
|
|
675
|
-
var createUsageBackupKey = Object.assign(
|
|
676
|
-
(userId, dateKey, nowMs) => createKey("usage", "backup", userId, dateKey, nowMs),
|
|
677
|
-
{
|
|
678
|
-
/** 某个用户的全部日聚合备份范围:usage-backup-<userId>-* */
|
|
679
|
-
rangeOfUser: (userId) => ({
|
|
680
|
-
start: createKey("usage", "backup", userId, ""),
|
|
681
|
-
end: createKey("usage", "backup", userId, "\uFFFF")
|
|
682
|
-
})
|
|
683
|
-
}
|
|
684
|
-
);
|
|
685
|
-
var isTokenStatsKey = (key) => {
|
|
686
|
-
const parts = splitKey(key);
|
|
687
|
-
return parts.length >= 2 && parts[0] === "token" && parts[1] === "stats";
|
|
688
|
-
};
|
|
689
|
-
var DIALOG_AGENT_LIST_INDEX_PREFIX = "dialogidx";
|
|
690
|
-
var DIALOG_LIST_TIMESTAMP_MAX = 9999999999999;
|
|
691
|
-
function parseDialogUpdatedAtMs(value) {
|
|
692
|
-
const finite = asOptionalFiniteNumber(value);
|
|
693
|
-
if (finite !== void 0) {
|
|
694
|
-
return Math.max(0, Math.floor(finite));
|
|
695
|
-
}
|
|
696
|
-
if (typeof value === "string" && value) {
|
|
697
|
-
const asNumber = Number(value);
|
|
698
|
-
if (Number.isFinite(asNumber) && /^\d+(\.\d+)?$/.test(value.trim())) {
|
|
699
|
-
return Math.max(0, Math.floor(asNumber));
|
|
700
|
-
}
|
|
701
|
-
const parsed = Date.parse(value);
|
|
702
|
-
return Number.isFinite(parsed) ? Math.max(0, Math.floor(parsed)) : 0;
|
|
703
|
-
}
|
|
704
|
-
return 0;
|
|
705
|
-
}
|
|
706
|
-
function toDialogListInvertedTimestamp(updatedAt) {
|
|
707
|
-
const ms = Math.min(
|
|
708
|
-
DIALOG_LIST_TIMESTAMP_MAX,
|
|
709
|
-
parseDialogUpdatedAtMs(updatedAt)
|
|
710
|
-
);
|
|
711
|
-
return String(DIALOG_LIST_TIMESTAMP_MAX - ms).padStart(13, "0");
|
|
712
|
-
}
|
|
713
|
-
function createDialogAgentListIndexKey(args) {
|
|
714
|
-
const userId = args.userId.trim();
|
|
715
|
-
const agentKey = args.agentKey.trim();
|
|
716
|
-
const dialogId = args.dialogId.trim();
|
|
717
|
-
if (!userId || !agentKey || !dialogId) return "";
|
|
718
|
-
return createKey(
|
|
719
|
-
DIALOG_AGENT_LIST_INDEX_PREFIX,
|
|
720
|
-
"agent",
|
|
721
|
-
userId,
|
|
722
|
-
agentKey,
|
|
723
|
-
toDialogListInvertedTimestamp(args.updatedAt),
|
|
724
|
-
dialogId
|
|
725
|
-
);
|
|
726
|
-
}
|
|
727
|
-
function createDialogAgentListIndexRange(userId, agentKey) {
|
|
728
|
-
const normalizedUserId = userId.trim();
|
|
729
|
-
const normalizedAgentKey = agentKey.trim();
|
|
730
|
-
if (!normalizedUserId || !normalizedAgentKey) {
|
|
731
|
-
return { start: "", end: "" };
|
|
732
|
-
}
|
|
733
|
-
const start = createKey(
|
|
734
|
-
DIALOG_AGENT_LIST_INDEX_PREFIX,
|
|
735
|
-
"agent",
|
|
736
|
-
normalizedUserId,
|
|
737
|
-
normalizedAgentKey,
|
|
738
|
-
""
|
|
739
|
-
);
|
|
740
|
-
return { start, end: `${start}\uFFFF` };
|
|
741
|
-
}
|
|
742
|
-
function expandDialogAgentListIndexAliases(agentKey) {
|
|
743
|
-
const key = agentKey.trim();
|
|
744
|
-
if (!key) return [];
|
|
745
|
-
return [key];
|
|
746
|
-
}
|
|
747
|
-
function collectDialogAgentListIndexAgentKeys(record) {
|
|
748
|
-
const keys = /* @__PURE__ */ new Set();
|
|
749
|
-
const add = (raw) => {
|
|
750
|
-
if (typeof raw !== "string") return;
|
|
751
|
-
const trimmed = raw.trim();
|
|
752
|
-
if (!trimmed) return;
|
|
753
|
-
for (const alias of expandDialogAgentListIndexAliases(trimmed)) {
|
|
754
|
-
keys.add(alias);
|
|
755
|
-
}
|
|
756
|
-
};
|
|
757
|
-
add(record.primaryAgentKey);
|
|
758
|
-
if (Array.isArray(record.cybots)) {
|
|
759
|
-
for (const item of record.cybots) add(item);
|
|
760
|
-
}
|
|
761
|
-
return Array.from(keys);
|
|
762
|
-
}
|
|
763
|
-
function isDialogAgentListIndexable(record) {
|
|
764
|
-
if (!record || typeof record !== "object") return false;
|
|
765
|
-
if (record.triggerType === "automation_run" || record.triggerType === "scheduled_run") {
|
|
766
|
-
return false;
|
|
767
|
-
}
|
|
768
|
-
if (record.parentAutomationKey) return false;
|
|
769
|
-
if (record.parentTaskKey) return false;
|
|
770
|
-
return true;
|
|
771
|
-
}
|
|
772
|
-
function resolveDialogIdForIndex(dialogKey, dialogId, record) {
|
|
773
|
-
const fromDialogId = asOptionalTrimmedString(dialogId);
|
|
774
|
-
if (fromDialogId) return fromDialogId;
|
|
775
|
-
const fromRecordId = asOptionalTrimmedString(record?.id);
|
|
776
|
-
if (fromRecordId) return fromRecordId;
|
|
777
|
-
const parts = splitKey(dialogKey);
|
|
778
|
-
if (parts.length >= 3 && parts[0] === "dialog" /* DIALOG */ && !dialogKey.includes("-msg-")) {
|
|
779
|
-
return parts[parts.length - 1] ?? "";
|
|
780
|
-
}
|
|
781
|
-
return "";
|
|
782
|
-
}
|
|
783
|
-
function buildDialogAgentListIndexKeySet(args) {
|
|
784
|
-
const map = /* @__PURE__ */ new Map();
|
|
785
|
-
if (!args.userId.trim() || !args.dialogKey.trim() || !args.dialogId.trim()) {
|
|
786
|
-
return map;
|
|
787
|
-
}
|
|
788
|
-
if (!isDialogAgentListIndexable(args.record)) return map;
|
|
789
|
-
const updatedAtMs = parseDialogUpdatedAtMs(args.record.updatedAt);
|
|
790
|
-
const value = {
|
|
791
|
-
dialogKey: args.dialogKey,
|
|
792
|
-
dialogId: args.dialogId,
|
|
793
|
-
updatedAtMs
|
|
794
|
-
};
|
|
795
|
-
for (const agentKey of collectDialogAgentListIndexAgentKeys(args.record)) {
|
|
796
|
-
const key = createDialogAgentListIndexKey({
|
|
797
|
-
userId: args.userId,
|
|
798
|
-
agentKey,
|
|
799
|
-
updatedAt: updatedAtMs,
|
|
800
|
-
dialogId: args.dialogId
|
|
801
|
-
});
|
|
802
|
-
if (key) map.set(key, value);
|
|
803
|
-
}
|
|
804
|
-
return map;
|
|
805
|
-
}
|
|
806
|
-
function buildDialogAgentListIndexDeleteOps(args) {
|
|
807
|
-
return buildDialogAgentListIndexOps({
|
|
808
|
-
userId: args.userId,
|
|
809
|
-
dialogKey: args.dialogKey,
|
|
810
|
-
dialogId: args.dialogId,
|
|
811
|
-
nextRecord: null,
|
|
812
|
-
previousRecord: args.previousRecord
|
|
813
|
-
}).filter((op) => op.type === "del");
|
|
814
|
-
}
|
|
815
|
-
function buildDialogAgentListIndexOps(args) {
|
|
816
|
-
const userId = asTrimmedString(args.userId);
|
|
817
|
-
const dialogKey = args.dialogKey.trim();
|
|
818
|
-
if (!userId || !dialogKey) return [];
|
|
819
|
-
const dialogId = resolveDialogIdForIndex(
|
|
820
|
-
dialogKey,
|
|
821
|
-
args.dialogId,
|
|
822
|
-
args.nextRecord ?? args.previousRecord ?? null
|
|
823
|
-
);
|
|
824
|
-
if (!dialogId) return [];
|
|
825
|
-
const previousMap = args.previousRecord && typeof args.previousRecord === "object" ? buildDialogAgentListIndexKeySet({
|
|
826
|
-
userId,
|
|
827
|
-
dialogKey,
|
|
828
|
-
dialogId: resolveDialogIdForIndex(
|
|
829
|
-
dialogKey,
|
|
830
|
-
args.dialogId,
|
|
831
|
-
args.previousRecord
|
|
832
|
-
) || dialogId,
|
|
833
|
-
record: args.previousRecord
|
|
834
|
-
}) : /* @__PURE__ */ new Map();
|
|
835
|
-
const nextMap = args.nextRecord && typeof args.nextRecord === "object" ? buildDialogAgentListIndexKeySet({
|
|
836
|
-
userId,
|
|
837
|
-
dialogKey,
|
|
838
|
-
dialogId,
|
|
839
|
-
record: args.nextRecord
|
|
840
|
-
}) : /* @__PURE__ */ new Map();
|
|
841
|
-
const ops = [];
|
|
842
|
-
for (const key of previousMap.keys()) {
|
|
843
|
-
if (!nextMap.has(key)) {
|
|
844
|
-
ops.push({ type: "del", key });
|
|
845
|
-
}
|
|
846
|
-
}
|
|
847
|
-
for (const [key, value] of nextMap) {
|
|
848
|
-
ops.push({ type: "put", key, value });
|
|
849
|
-
}
|
|
850
|
-
return ops;
|
|
851
|
-
}
|
|
852
|
-
var createTaskKey = Object.assign(
|
|
853
|
-
(userId) => createKey("task" /* TASK */, userId, ulid()),
|
|
854
|
-
{
|
|
855
|
-
rangeOfUser: (userId) => ({
|
|
856
|
-
start: createKey("task" /* TASK */, userId, ""),
|
|
857
|
-
end: createKey("task" /* TASK */, userId, "\uFFFF")
|
|
858
|
-
})
|
|
859
|
-
}
|
|
860
|
-
);
|
|
861
|
-
var createAgentAutomationKey = Object.assign(
|
|
862
|
-
(userId) => createKey("agent-automation" /* AGENT_AUTOMATION */, userId, ulid()),
|
|
863
|
-
{
|
|
864
|
-
rangeOfUser: (userId) => ({
|
|
865
|
-
start: createKey("agent-automation" /* AGENT_AUTOMATION */, userId, ""),
|
|
866
|
-
end: createKey("agent-automation" /* AGENT_AUTOMATION */, userId, "\uFFFF")
|
|
867
|
-
})
|
|
868
|
-
}
|
|
869
|
-
);
|
|
870
|
-
var agentAutomationKey = createAgentAutomationKey;
|
|
871
|
-
var AGENT_AUTOMATION_OWNER_INDEX_PREFIX = "agent-automation-owner-idx";
|
|
872
|
-
var createAgentAutomationOwnerIndexKey = Object.assign(
|
|
873
|
-
(userId, ownerAgentKey, automationId) => createKey(
|
|
874
|
-
AGENT_AUTOMATION_OWNER_INDEX_PREFIX,
|
|
875
|
-
userId,
|
|
876
|
-
ownerAgentKey,
|
|
877
|
-
automationId
|
|
878
|
-
),
|
|
879
|
-
{
|
|
880
|
-
rangeOfAgent: (userId, ownerAgentKey) => {
|
|
881
|
-
const start = createKey(
|
|
882
|
-
AGENT_AUTOMATION_OWNER_INDEX_PREFIX,
|
|
883
|
-
userId,
|
|
884
|
-
ownerAgentKey,
|
|
885
|
-
""
|
|
886
|
-
);
|
|
887
|
-
return { start, end: `${start}\uFFFF` };
|
|
888
|
-
}
|
|
889
|
-
}
|
|
890
|
-
);
|
|
891
|
-
function buildAgentAutomationOwnerIndexValue(args) {
|
|
892
|
-
return {
|
|
893
|
-
automationKey: args.automationKey,
|
|
894
|
-
automationId: args.automationId,
|
|
895
|
-
userId: args.userId,
|
|
896
|
-
ownerAgentKey: args.ownerAgentKey
|
|
897
|
-
};
|
|
898
|
-
}
|
|
899
|
-
function isAgentAutomationOwnerIndexKey(key) {
|
|
900
|
-
return key.startsWith(`${AGENT_AUTOMATION_OWNER_INDEX_PREFIX}-`);
|
|
901
|
-
}
|
|
902
|
-
function parseAgentAutomationIdFromKey(key) {
|
|
903
|
-
if (typeof key !== "string") return "";
|
|
904
|
-
const trimmed = key.trim();
|
|
905
|
-
if (!trimmed || !isAgentAutomationKey(trimmed)) return "";
|
|
906
|
-
const withoutPrefix = trimmed.slice(`${"agent-automation" /* AGENT_AUTOMATION */}-`.length);
|
|
907
|
-
const lastDash = withoutPrefix.lastIndexOf("-");
|
|
908
|
-
return lastDash >= 0 ? withoutPrefix.slice(lastDash + 1) : "";
|
|
909
|
-
}
|
|
910
|
-
function buildAgentAutomationOwnerIndexDeleteOps(args) {
|
|
911
|
-
const automationKey = args.automationKey.trim();
|
|
912
|
-
if (!automationKey || !isAgentAutomationKey(automationKey)) return [];
|
|
913
|
-
const userIdFromRecord = asTrimmedString(args.record?.createdBy);
|
|
914
|
-
const userIdFromArg = asTrimmedString(args.userId);
|
|
915
|
-
const withoutPrefix = automationKey.startsWith(`${"agent-automation" /* AGENT_AUTOMATION */}-`) ? automationKey.slice(`${"agent-automation" /* AGENT_AUTOMATION */}-`.length) : "";
|
|
916
|
-
const lastDash = withoutPrefix.lastIndexOf("-");
|
|
917
|
-
const userIdFromKey = lastDash > 0 ? withoutPrefix.slice(0, lastDash) : "";
|
|
918
|
-
const automationIdFromKey = lastDash > 0 ? withoutPrefix.slice(lastDash + 1) : "";
|
|
919
|
-
const userId = userIdFromArg || userIdFromRecord || userIdFromKey;
|
|
920
|
-
const automationId = asOptionalTrimmedString(args.record?.id) || automationIdFromKey;
|
|
921
|
-
const ownerAgentKey = asTrimmedString(args.record?.ownerAgentKey);
|
|
922
|
-
if (!userId || !automationId || !ownerAgentKey) return [];
|
|
923
|
-
return [
|
|
924
|
-
{
|
|
925
|
-
type: "del",
|
|
926
|
-
key: createAgentAutomationOwnerIndexKey(userId, ownerAgentKey, automationId)
|
|
927
|
-
}
|
|
928
|
-
];
|
|
929
|
-
}
|
|
930
|
-
var createBudgetKey = (userId) => createKey("budget", userId, "monthly");
|
|
931
|
-
var createNotificationKey = {
|
|
932
|
-
single: (userId, notificationId) => createKey("notification" /* NOTIFICATION */, userId, notificationId),
|
|
933
|
-
rangeOfUser: (userId) => ({
|
|
934
|
-
start: createKey("notification" /* NOTIFICATION */, userId, ""),
|
|
935
|
-
end: createKey("notification" /* NOTIFICATION */, userId, "\uFFFF")
|
|
936
|
-
})
|
|
937
|
-
};
|
|
938
|
-
var emailKey = {
|
|
939
|
-
create: (ownerId) => {
|
|
940
|
-
const emailId = ulid();
|
|
941
|
-
return { dbKey: createKey("email" /* EMAIL */, ownerId, emailId), emailId };
|
|
942
|
-
},
|
|
943
|
-
single: (ownerId, emailId) => createKey("email" /* EMAIL */, ownerId, emailId),
|
|
944
|
-
rangeOfOwner: (ownerId) => ({
|
|
945
|
-
start: createKey("email" /* EMAIL */, ownerId, ""),
|
|
946
|
-
end: createKey("email" /* EMAIL */, ownerId, "\uFFFF")
|
|
947
|
-
})
|
|
948
|
-
};
|
|
949
|
-
var createPageKey = {
|
|
950
|
-
create: (userId) => {
|
|
951
|
-
const id = ulid();
|
|
952
|
-
return { dbKey: createKey("page" /* DOC */, userId, id), id };
|
|
953
|
-
},
|
|
954
|
-
rangeOfUser: (userId) => ({
|
|
955
|
-
start: createKey("page" /* DOC */, userId, ""),
|
|
956
|
-
end: createKey("page" /* DOC */, userId, "\uFFFF")
|
|
957
|
-
})
|
|
958
|
-
};
|
|
959
|
-
var createAgentKey = {
|
|
960
|
-
private: curry2(
|
|
961
|
-
(userId, agentId) => createKey("agent" /* AGENT */, userId, agentId)
|
|
962
|
-
),
|
|
963
|
-
public: (agentId) => createKey("agent" /* AGENT */, "pub", agentId),
|
|
964
|
-
rangeOfUser: (userId) => ({
|
|
965
|
-
start: createKey("agent" /* AGENT */, userId, ""),
|
|
966
|
-
end: createKey("agent" /* AGENT */, userId, "\uFFFF")
|
|
967
|
-
})
|
|
968
|
-
};
|
|
969
|
-
var pubAgentKeys = {
|
|
970
|
-
single: (agentId) => createAgentKey.public(agentId),
|
|
971
|
-
list: () => ({
|
|
972
|
-
start: createKey("agent" /* AGENT */, "pub", ""),
|
|
973
|
-
end: createKey("agent" /* AGENT */, "pub", "\uFFFF")
|
|
974
|
-
}),
|
|
975
|
-
allPublicRanges: () => [
|
|
976
|
-
{
|
|
977
|
-
start: createKey("agent" /* AGENT */, "pub", ""),
|
|
978
|
-
end: createKey("agent" /* AGENT */, "pub", "\uFFFF")
|
|
979
|
-
}
|
|
980
|
-
]
|
|
981
|
-
};
|
|
982
|
-
var createAgentGrantKey = {
|
|
983
|
-
single: (ownerUserId, agentId, granteeUserId) => createKey("grant", "agent", ownerUserId, agentId, granteeUserId),
|
|
984
|
-
rangeOfAgent: (ownerUserId, agentId) => ({
|
|
985
|
-
start: createKey("grant", "agent", ownerUserId, agentId, ""),
|
|
986
|
-
end: createKey("grant", "agent", ownerUserId, agentId, "\uFFFF")
|
|
987
|
-
})
|
|
988
|
-
};
|
|
989
|
-
var FAV_PREFIX = "fav";
|
|
990
|
-
var createFavoriteKey = {
|
|
991
|
-
/* ---------- Agent 收藏(按 agentKey 存,当前使用) ---------- */
|
|
992
|
-
/**
|
|
993
|
-
* 某个用户收藏了某个 Agent 实例(用完整的 agentKey/dbKey)
|
|
994
|
-
* key: fav-agent-key-{userId}-{agentKey}
|
|
995
|
-
*/
|
|
996
|
-
agentByKey: (userId, agentKey) => createKey(FAV_PREFIX, "agent", "key", userId, agentKey),
|
|
997
|
-
/**
|
|
998
|
-
* 查询某用户收藏的所有 Agent(基于 agentKey 版本)
|
|
999
|
-
* 范围: [fav-agent-key-{userId}-, fav-agent-key-{userId}-\uffff]
|
|
1000
|
-
*/
|
|
1001
|
-
agentKeyRangeOfUser: (userId) => ({
|
|
1002
|
-
start: createKey(FAV_PREFIX, "agent", "key", userId, ""),
|
|
1003
|
-
end: createKey(FAV_PREFIX, "agent", "key", userId, "\uFFFF")
|
|
1004
|
-
}),
|
|
1005
|
-
userRangeOfAgentKey: (agentKey) => ({
|
|
1006
|
-
start: createKey(FAV_PREFIX, "agent", "key", "by-agent", agentKey, ""),
|
|
1007
|
-
end: createKey(FAV_PREFIX, "agent", "key", "by-agent", agentKey, "\uFFFF")
|
|
1008
|
-
}),
|
|
1009
|
-
agentByKeyReverse: (agentKey, userId) => createKey(FAV_PREFIX, "agent", "key", "by-agent", agentKey, userId),
|
|
1010
|
-
/* ---------- Agent 收藏(按 agentId 存,预留,将来可用) ---------- */
|
|
1011
|
-
/**
|
|
1012
|
-
* 某个用户收藏了某个逻辑 AgentId(当前未使用,预留)
|
|
1013
|
-
* key: fav-agent-id-{userId}-{agentId}
|
|
1014
|
-
*/
|
|
1015
|
-
agentById: (userId, agentId) => createKey(FAV_PREFIX, "agent", "id", userId, agentId),
|
|
1016
|
-
/** 查询某用户收藏的所有 AgentId(预留) */
|
|
1017
|
-
agentIdRangeOfUser: (userId) => ({
|
|
1018
|
-
start: createKey(FAV_PREFIX, "agent", "id", userId, ""),
|
|
1019
|
-
end: createKey(FAV_PREFIX, "agent", "id", userId, "\uFFFF")
|
|
1020
|
-
}),
|
|
1021
|
-
userRangeOfAgentId: (agentId) => ({
|
|
1022
|
-
start: createKey(FAV_PREFIX, "agent", "id", "by-agent", agentId, ""),
|
|
1023
|
-
end: createKey(FAV_PREFIX, "agent", "id", "by-agent", agentId, "\uFFFF")
|
|
1024
|
-
}),
|
|
1025
|
-
agentByIdReverse: (agentId, userId) => createKey(FAV_PREFIX, "agent", "id", "by-agent", agentId, userId),
|
|
1026
|
-
/* ---------- Page 收藏(同样区分 key / id,当前可以只用 byKey) ---------- */
|
|
1027
|
-
// Page byKey: fav-page-key-{userId}-{pageKey}
|
|
1028
|
-
pageByKey: (userId, pageKey) => createKey(FAV_PREFIX, "page", "key", userId, pageKey),
|
|
1029
|
-
pageKeyRangeOfUser: (userId) => ({
|
|
1030
|
-
start: createKey(FAV_PREFIX, "page", "key", userId, ""),
|
|
1031
|
-
end: createKey(FAV_PREFIX, "page", "key", userId, "\uFFFF")
|
|
1032
|
-
}),
|
|
1033
|
-
userRangeOfPageKey: (pageKey) => ({
|
|
1034
|
-
start: createKey(FAV_PREFIX, "page", "key", "by-page", pageKey, ""),
|
|
1035
|
-
end: createKey(FAV_PREFIX, "page", "key", "by-page", pageKey, "\uFFFF")
|
|
1036
|
-
}),
|
|
1037
|
-
pageByKeyReverse: (pageKey, userId) => createKey(FAV_PREFIX, "page", "key", "by-page", pageKey, userId),
|
|
1038
|
-
// Page byId(预留)
|
|
1039
|
-
pageById: (userId, pageId) => createKey(FAV_PREFIX, "page", "id", userId, pageId),
|
|
1040
|
-
pageIdRangeOfUser: (userId) => ({
|
|
1041
|
-
start: createKey(FAV_PREFIX, "page", "id", userId, ""),
|
|
1042
|
-
end: createKey(FAV_PREFIX, "page", "id", userId, "\uFFFF")
|
|
1043
|
-
}),
|
|
1044
|
-
userRangeOfPageId: (pageId) => ({
|
|
1045
|
-
start: createKey(FAV_PREFIX, "page", "id", "by-page", pageId, ""),
|
|
1046
|
-
end: createKey(FAV_PREFIX, "page", "id", "by-page", pageId, "\uFFFF")
|
|
1047
|
-
}),
|
|
1048
|
-
pageByIdReverse: (pageId, userId) => createKey(FAV_PREFIX, "page", "id", "by-page", pageId, userId),
|
|
1049
|
-
/** 从 dbKey 中解析出目标标识符 (agentKey/agentId/pageKey/pageId) */
|
|
1050
|
-
getIdentifierFromKey: (key) => {
|
|
1051
|
-
const parts = key.split(SEPARATOR);
|
|
1052
|
-
return parts.slice(4).join(SEPARATOR);
|
|
1053
|
-
}
|
|
1054
|
-
};
|
|
1055
|
-
var createFavoriteStatsKey = {
|
|
1056
|
-
// 被多少人收藏的 Agent(按 agentKey 统计,当前实际使用)
|
|
1057
|
-
agentByKey: (agentKey) => createKey(FAV_PREFIX, "agent-count", "key", agentKey),
|
|
1058
|
-
// 预留:按逻辑 AgentId 统计
|
|
1059
|
-
agentById: (agentId) => createKey(FAV_PREFIX, "agent-count", "id", agentId),
|
|
1060
|
-
// Page:按 pageKey 统计(预留)
|
|
1061
|
-
pageByKey: (pageKey) => createKey(FAV_PREFIX, "page-count", "key", pageKey),
|
|
1062
|
-
pageById: (pageId) => createKey(FAV_PREFIX, "page-count", "id", pageId)
|
|
1063
|
-
};
|
|
1064
|
-
var jobKey = {
|
|
1065
|
-
create: (tenantId, jobId) => {
|
|
1066
|
-
const id = jobId || ulid();
|
|
1067
|
-
const dbKey = createKey("job", tenantId, id);
|
|
1068
|
-
return { dbKey, id };
|
|
1069
|
-
},
|
|
1070
|
-
single: (tenantId, jobId) => createKey("job", tenantId, jobId),
|
|
1071
|
-
rangeOfTenant: (tenantId) => {
|
|
1072
|
-
const start = createKey("job", tenantId, "");
|
|
1073
|
-
return { start, end: start + "\uFFFF" };
|
|
1074
|
-
}
|
|
1075
|
-
};
|
|
1076
|
-
var blobKey = (sha256) => createKey("blob", sha256);
|
|
1077
|
-
var fileKey = {
|
|
1078
|
-
single: (tenantId, fileId) => createKey("file", tenantId, fileId),
|
|
1079
|
-
rangeOfTenant: (tenantId) => {
|
|
1080
|
-
const start = createKey("file", tenantId, "");
|
|
1081
|
-
return {
|
|
1082
|
-
start,
|
|
1083
|
-
end: start + "\uFFFF"
|
|
1084
|
-
};
|
|
1085
|
-
}
|
|
1086
|
-
};
|
|
1087
|
-
var fileIdIndexKey = (fileId) => createKey("file", "id", fileId);
|
|
1088
|
-
var getFileIdFromKey = (key) => {
|
|
1089
|
-
const parts = key.split(SEPARATOR);
|
|
1090
|
-
return parts[2];
|
|
1091
|
-
};
|
|
1092
|
-
var fileStatKey = {
|
|
1093
|
-
tenantPerDay: (tenantId, dateKey) => createKey("file", "stat", "tenant", tenantId, dateKey),
|
|
1094
|
-
modelPerDay: (modelName, dateKey) => createKey("file", "stat", "model", modelName, dateKey)
|
|
1095
|
-
};
|
|
1096
|
-
|
|
1097
|
-
export {
|
|
1098
|
-
toTrimmedString,
|
|
1099
|
-
toNonEmptyString,
|
|
1100
|
-
extractAgentInfo,
|
|
1101
|
-
extractCoverImage,
|
|
1102
|
-
resolveShareAuthorIdentity,
|
|
1103
|
-
sanitizeShareData,
|
|
1104
|
-
shareKey,
|
|
1105
|
-
SEPARATOR,
|
|
1106
|
-
createKey,
|
|
1107
|
-
splitKey,
|
|
1108
|
-
TYPE_STORAGE_PREFIXES,
|
|
1109
|
-
inferTypeFromDbKey,
|
|
1110
|
-
isTableMetaKey,
|
|
1111
|
-
isPageKey,
|
|
1112
|
-
isTaskKey,
|
|
1113
|
-
isAgentAutomationKey,
|
|
1114
|
-
isFileKey,
|
|
1115
|
-
isAgentKey,
|
|
1116
|
-
isAppKey,
|
|
1117
|
-
isEmailKey,
|
|
1118
|
-
rowKey,
|
|
1119
|
-
idxKey,
|
|
1120
|
-
metaKey,
|
|
1121
|
-
viewKey,
|
|
1122
|
-
DB_PREFIX,
|
|
1123
|
-
createOAuthCredentialKey,
|
|
1124
|
-
oauthCredentialUserRange,
|
|
1125
|
-
USER_SETTINGS_KEY_SUFFIX,
|
|
1126
|
-
createUserKey,
|
|
1127
|
-
createUserPreferenceKey,
|
|
1128
|
-
createMemoryKey,
|
|
1129
|
-
createMemoryOwnerIndexKey,
|
|
1130
|
-
createMemorySubjectKindIndexKey,
|
|
1131
|
-
isMemoryKey,
|
|
1132
|
-
memoryOwnerRange,
|
|
1133
|
-
memorySubjectKindRange,
|
|
1134
|
-
createTransactionKey,
|
|
1135
|
-
createTokenKey,
|
|
1136
|
-
TOKEN_DIALOG_INDEX_PREFIX,
|
|
1137
|
-
encodeTokenIndexSegment,
|
|
1138
|
-
createTokenDialogIndexKey,
|
|
1139
|
-
TOKEN_DIALOG_INDEX_FORMAT,
|
|
1140
|
-
createTokenDialogBackfillKey,
|
|
1141
|
-
createTokenStatsKey,
|
|
1142
|
-
createTokenStatsAppliedKey,
|
|
1143
|
-
createUsageBackupKey,
|
|
1144
|
-
isTokenStatsKey,
|
|
1145
|
-
DIALOG_AGENT_LIST_INDEX_PREFIX,
|
|
1146
|
-
parseDialogUpdatedAtMs,
|
|
1147
|
-
toDialogListInvertedTimestamp,
|
|
1148
|
-
createDialogAgentListIndexKey,
|
|
1149
|
-
createDialogAgentListIndexRange,
|
|
1150
|
-
expandDialogAgentListIndexAliases,
|
|
1151
|
-
collectDialogAgentListIndexAgentKeys,
|
|
1152
|
-
isDialogAgentListIndexable,
|
|
1153
|
-
buildDialogAgentListIndexDeleteOps,
|
|
1154
|
-
buildDialogAgentListIndexOps,
|
|
1155
|
-
createTaskKey,
|
|
1156
|
-
createAgentAutomationKey,
|
|
1157
|
-
agentAutomationKey,
|
|
1158
|
-
AGENT_AUTOMATION_OWNER_INDEX_PREFIX,
|
|
1159
|
-
createAgentAutomationOwnerIndexKey,
|
|
1160
|
-
buildAgentAutomationOwnerIndexValue,
|
|
1161
|
-
isAgentAutomationOwnerIndexKey,
|
|
1162
|
-
parseAgentAutomationIdFromKey,
|
|
1163
|
-
buildAgentAutomationOwnerIndexDeleteOps,
|
|
1164
|
-
createBudgetKey,
|
|
1165
|
-
createNotificationKey,
|
|
1166
|
-
emailKey,
|
|
1167
|
-
createPageKey,
|
|
1168
|
-
createAgentKey,
|
|
1169
|
-
pubAgentKeys,
|
|
1170
|
-
createAgentGrantKey,
|
|
1171
|
-
createFavoriteKey,
|
|
1172
|
-
createFavoriteStatsKey,
|
|
1173
|
-
jobKey,
|
|
1174
|
-
blobKey,
|
|
1175
|
-
fileKey,
|
|
1176
|
-
fileIdIndexKey,
|
|
1177
|
-
getFileIdFromKey,
|
|
1178
|
-
fileStatKey
|
|
1179
|
-
};
|