nolo-cli 0.259.0-alpha.1 → 0.261.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.
Files changed (320) hide show
  1. package/README.md +1 -1
  2. package/{_executeModel-MTM4BJK3.js → _executeModel-PODMRXJJ.js} +97 -83
  3. package/accountResolver-NGICIMEE.js +1 -1
  4. package/{action-C6IQAKN4.js → action-NJTYNXXR.js} +12 -10
  5. package/{addContentAction-53364YDW.js → addContentAction-RUPXLROG.js} +14 -13
  6. package/{addDialogAgentAction-U5DD5EN5.js → addDialogAgentAction-57EJ2UBC.js} +20 -24
  7. package/{agentDeleteCommand-53NN3VSK.js → agentDeleteCommand-DRFCOTYP.js} +185 -147
  8. package/{agentEmailCommands-KOGGIT6I.js → agentEmailCommands-FHENHUBF.js} +143 -127
  9. package/{agentGrantCommands-L6O2HVJI.js → agentGrantCommands-BMVKNYIY.js} +9 -6
  10. package/{agentListCommands-62UYUQDI.js → agentListCommands-W66W5K3V.js} +88 -69
  11. package/{agentMachineCommands-W6TNJXEA.js → agentMachineCommands-C3BUBCXU.js} +69 -60
  12. package/{agentProviderCommands-QLTABYR7.js → agentProviderCommands-VIWKP7DM.js} +11 -8
  13. package/{agentPullCommand-2EYJ5ENC.js → agentPullCommand-5SNSXOY7.js} +10 -7
  14. package/agentRecordCommands-DYMHWTID.js +210 -0
  15. package/agentRun-QVFG3CI4.js +250 -0
  16. package/agentRunCommand-YV4V5HSL.js +248 -0
  17. package/{agentRunControl-LXMADX3N.js → agentRunControl-RGBHKPKJ.js} +19 -12
  18. package/{agentRuntimeLocal-YGNJMQW3.js → agentRuntimeLocal-LVEMOYS2.js} +62 -49
  19. package/{agentSlice-3HHYUQLM.js → agentSlice-OJCM7OUX.js} +15 -18
  20. package/appConfigCommands-ZUXQLE7L.js +417 -0
  21. package/{appDeleteCommands-5COJ6CSG.js → appDeleteCommands-L5UKUMXY.js} +68 -58
  22. package/{appDeployCommands-3JPAT3XO.js → appDeployCommands-KX2BRQUW.js} +74 -59
  23. package/{appDeployStatusCommands-RHZKF3G4.js → appDeployStatusCommands-7LHRSWW7.js} +68 -58
  24. package/{appGetCommands-73DXOAQW.js → appGetCommands-F7SDFCUK.js} +74 -58
  25. package/{appListCommands-HD5LOQ3G.js → appListCommands-U4NJKSMZ.js} +74 -58
  26. package/appMigrateCommands-JAPOLYSW.js +230 -0
  27. package/appSourceCommands-TLXPWXUH.js +279 -0
  28. package/authCommand-AU3GZBZ2.js +65 -0
  29. package/{authCommands-T5FODCEG.js → authCommands-JKBWMUQ4.js} +20 -17
  30. package/{builtinSkillRegistry-EDHD2UHU.js → builtinSkillRegistry-6XUWMAV5.js} +8 -6
  31. package/{chromeOpsCommands-3SSTDFRF.js → chromeOpsCommands-F47WYQWF.js} +68 -18
  32. package/{chunk-5YS6QHGT.js → chunk-2FGFY72B.js} +9 -9
  33. package/{chunk-MJBLXJMP.js → chunk-2I4R6ZRV.js} +12 -9
  34. package/{chunk-FXEPZKNJ.js → chunk-2MIZHEND.js} +506 -64
  35. package/{chunk-TLE77UJ5.js → chunk-2OROOEOQ.js} +0 -1
  36. package/{chunk-6RSNVJGO.js → chunk-2ZBPWX7N.js} +4 -4
  37. package/chunk-35JIFLIG.js +30 -0
  38. package/{chunk-7OVOZRZF.js → chunk-3B7OTHDW.js} +23 -379
  39. package/{chunk-DNNPARJK.js → chunk-3QMN3T6L.js} +50 -37
  40. package/{chunk-DMPZMYH4.js → chunk-3R4AYHJR.js} +13 -1
  41. package/{chunk-XNNBXUEM.js → chunk-3TII7WCF.js} +5 -5
  42. package/{chunk-223KZUJ6.js → chunk-4HZCBA4Q.js} +18 -15
  43. package/{chunk-C5A54QS7.js → chunk-4INJGWE3.js} +18 -5
  44. package/chunk-4IVMDQBA.js +261 -0
  45. package/chunk-4Y6CZ2N4.js +82 -0
  46. package/{chunk-KZ4A7EIV.js → chunk-56OAS5RZ.js} +1 -1
  47. package/{chunk-KQHEGELM.js → chunk-63G7JWEA.js} +16 -6
  48. package/{chunk-4EACJPZI.js → chunk-6BBXJGIQ.js} +51 -42
  49. package/chunk-72VWN4VK.js +51 -0
  50. package/chunk-7LR2IFUH.js +100 -0
  51. package/{chunk-S73EPYNC.js → chunk-7LS5ATRP.js} +20 -6
  52. package/{chunk-XPETQ4MR.js → chunk-7X4BFUJV.js} +24 -10
  53. package/{chunk-KHYSFS3W.js → chunk-A454UXB6.js} +148 -73
  54. package/chunk-A4O76A6V.js +432 -0
  55. package/chunk-AMNZPQCY.js +635 -0
  56. package/{chunk-4MXYCQBS.js → chunk-AQNWWJLH.js} +2 -56
  57. package/{chunk-LHCGKAFO.js → chunk-BKP325XS.js} +184 -112
  58. package/{chunk-PENRYZ4D.js → chunk-BPB3T5EU.js} +4 -7
  59. package/{chunk-U6QNVOR5.js → chunk-BUGLH2A7.js} +130 -6
  60. package/{chunk-2JHGUL5K.js → chunk-BVYHE6QD.js} +2 -2
  61. package/{chunk-KXOPLLFP.js → chunk-CA7LGAHV.js} +69 -9
  62. package/{chunk-2FZVXOFX.js → chunk-CEIWXKHP.js} +112 -200
  63. package/{chunk-Y2TCTNUD.js → chunk-CK2LMTYO.js} +4 -4
  64. package/{chunk-AIFQKNPP.js → chunk-CL33RFD7.js} +1 -1
  65. package/{chunk-57V4PADY.js → chunk-CNYPQYXT.js} +781 -449
  66. package/{chunk-P4R5KXU7.js → chunk-CW6LRDSF.js} +5 -5
  67. package/chunk-D3ONA3FP.js +762 -0
  68. package/{chunk-PIVTQRX6.js → chunk-DDKA6V6X.js} +111 -12
  69. package/chunk-DLXL4NSL.js +1179 -0
  70. package/{chunk-EJQE5HB7.js → chunk-DSBRIUX5.js} +4 -2
  71. package/{chunk-XRGBJHZX.js → chunk-E36V7MPY.js} +9 -5
  72. package/{chunk-4YPH5KRA.js → chunk-EDKMRDET.js} +1 -1
  73. package/{chunk-DBJODIZ6.js → chunk-EQOWWSNQ.js} +19 -27
  74. package/chunk-ER6NTALN.js +34 -0
  75. package/{chunk-L4XST72F.js → chunk-ERCSHBUD.js} +16027 -17392
  76. package/chunk-EUHMI5KG.js +101 -0
  77. package/{chunk-YQLAFJRQ.js → chunk-FBNVJ2TO.js} +1 -1
  78. package/{chunk-Q2EERN52.js → chunk-FF5ZRKW7.js} +12 -7
  79. package/{chunk-6XIE5ZGI.js → chunk-FGFJUFPS.js} +5 -6
  80. package/chunk-FI4DPLR7.js +902 -0
  81. package/{chunk-HDKMVYNJ.js → chunk-FNLT7NKG.js} +7 -11
  82. package/{chunk-JCQ3WCQ3.js → chunk-FOC4TORM.js} +69 -3
  83. package/chunk-FP46RAJQ.js +58 -0
  84. package/{chunk-JPXACKSW.js → chunk-G22P2J7O.js} +30 -81
  85. package/{chunk-7WHCIA5V.js → chunk-G5IAIGGD.js} +3 -8
  86. package/{chunk-FZENZCIA.js → chunk-GEC4CHS2.js} +19 -12
  87. package/chunk-GF4LYNNZ.js +25 -0
  88. package/{chunk-IYLUK67R.js → chunk-GH6SS2DZ.js} +25 -8
  89. package/chunk-HAZ6UVH4.js +368 -0
  90. package/{chunk-OKAXQFON.js → chunk-HB4J5HA6.js} +4 -4
  91. package/{chunk-324FWHUA.js → chunk-HHXF57CL.js} +12 -3
  92. package/chunk-HJTI7RZV.js +94 -0
  93. package/{chunk-HQUGB2HM.js → chunk-HMFKYZKP.js} +62 -50
  94. package/{chunk-Q2MPKE4B.js → chunk-HVRG27HI.js} +76 -26
  95. package/{chunk-46FETNLF.js → chunk-IN4B6Z2D.js} +7 -6
  96. package/chunk-IV6VUVLJ.js +88 -0
  97. package/{chunk-LLUBUHNT.js → chunk-IWWJSSST.js} +5 -9
  98. package/{chunk-7BIJFGKS.js → chunk-J22PFCQN.js} +106 -52
  99. package/chunk-J42X32PV.js +472 -0
  100. package/{chunk-LCBAMY2M.js → chunk-JKVOKKMQ.js} +0 -7
  101. package/{chunk-KT7S7ANZ.js → chunk-JPYOHIHX.js} +9 -9
  102. package/{chunk-R7XWZDOH.js → chunk-JUMQJSQF.js} +1423 -282
  103. package/{chunk-KVMLM5VD.js → chunk-KAHYBAEN.js} +211 -472
  104. package/{chunk-KLMBM6P6.js → chunk-KALCFXQO.js} +2454 -1115
  105. package/chunk-KDDXC2IH.js +148 -0
  106. package/chunk-KGKTN2NX.js +25 -0
  107. package/chunk-KGWE224L.js +246 -0
  108. package/{chunk-OYUMJMC5.js → chunk-KSV6T4AH.js} +6 -1
  109. package/{chunk-P27E22MA.js → chunk-L43DGEPZ.js} +1 -1
  110. package/{chunk-5BIDJVNX.js → chunk-L45P4JTE.js} +180 -31
  111. package/chunk-LHCIIUCX.js +222 -0
  112. package/{chunk-CBIGMWMI.js → chunk-LHJB4BXJ.js} +1 -1
  113. package/{chunk-TRRXYFTR.js → chunk-LOFRSJX2.js} +1 -0
  114. package/{chunk-SQL7YNED.js → chunk-LPXBBC32.js} +71 -5
  115. package/{chunk-BIDSIRTS.js → chunk-LTCZOOAM.js} +11 -17
  116. package/chunk-LUTSMSIL.js +425 -0
  117. package/chunk-LXP53WGF.js +168 -0
  118. package/{chunk-2CT2J3O6.js → chunk-M7VNNPVX.js} +2493 -4055
  119. package/chunk-MDAYRIP7.js +1889 -0
  120. package/{chunk-6B2OBX5B.js → chunk-MMXHIHJZ.js} +15 -47
  121. package/{chunk-HPDLPEUG.js → chunk-MPWQI36J.js} +267 -234
  122. package/chunk-MRACVEPZ.js +7 -0
  123. package/{chunk-ZYPXOQS2.js → chunk-MSFKHPA6.js} +1 -1
  124. package/chunk-NHLLXINQ.js +8 -0
  125. package/{chunk-QXTEEEIN.js → chunk-NJCTPWJU.js} +8 -8
  126. package/chunk-NLS7F5DW.js +1697 -0
  127. package/{chunk-FP37ELBT.js → chunk-NTBTVKKB.js} +17 -25
  128. package/{chunk-JLZJL3WC.js → chunk-O77F26YB.js} +370 -39
  129. package/{chunk-LVZVSLKO.js → chunk-O7ZY6SUK.js} +5 -22
  130. package/{chunk-YN23INFZ.js → chunk-OIOMBPCA.js} +23 -2
  131. package/{chunk-CJOOF4L5.js → chunk-OSZNERNW.js} +17 -14
  132. package/{chunk-JZO7KUF3.js → chunk-P4I55ASV.js} +313 -275
  133. package/{chunk-2C5VN7NH.js → chunk-P4XAHM4B.js} +1 -1
  134. package/chunk-PL5RKESU.js +40 -0
  135. package/chunk-Q5FJJ6XI.js +103 -0
  136. package/{chunk-WS36XPJD.js → chunk-Q5IXZF3S.js} +82 -6
  137. package/{createAgentAutomationAction-GRZ6XY7Q.js → chunk-QKM55LP2.js} +3 -160
  138. package/{chunk-WSLL7VV4.js → chunk-QXWXRBOL.js} +9 -9
  139. package/{chunk-MXA54TQM.js → chunk-QZYQ3Y3G.js} +1 -1
  140. package/{chunk-FE7G6DSP.js → chunk-R72QWIFO.js} +14 -4
  141. package/{chunk-5RGU3J7P.js → chunk-REAE2SZK.js} +0 -1
  142. package/chunk-RF576RYE.js +117 -0
  143. package/chunk-RI7SXDJW.js +1317 -0
  144. package/{chunk-FEIVARWR.js → chunk-RIOAPUGV.js} +238 -25
  145. package/{chunk-BZLGPM5B.js → chunk-RNLKWUVY.js} +7 -12
  146. package/{chunk-J7JRCOIW.js → chunk-RWXHGPWJ.js} +1 -1
  147. package/{chunk-J55F3IEZ.js → chunk-SARJZIGR.js} +1 -1
  148. package/chunk-SJFL32RD.js +356 -0
  149. package/{chunk-6SOWMEAY.js → chunk-SR57FDTX.js} +2 -258
  150. package/{chunk-MPGR4ZNR.js → chunk-SRVLHMES.js} +46 -42
  151. package/{chunk-CEKRIR22.js → chunk-SU4NCTW4.js} +1 -1
  152. package/{chunk-RD3QLZQV.js → chunk-SWJRX4M5.js} +324 -2
  153. package/{chunk-R3TUHCSJ.js → chunk-T3Y2NA4H.js} +8 -3
  154. package/{chunk-53W5BXLN.js → chunk-TCOHWKDM.js} +54 -55
  155. package/{chunk-KWNVPY6M.js → chunk-TJXO66M2.js} +8 -5
  156. package/{chunk-QIGQFON2.js → chunk-TXMFSGRY.js} +1 -1
  157. package/{chunk-ADYWV732.js → chunk-U5PSCTMR.js} +264 -177
  158. package/{chunk-UUCYUN6Y.js → chunk-UB7NV7NN.js} +1 -1
  159. package/{chunk-QGFLVQ6E.js → chunk-UBOTXA3Z.js} +4 -14
  160. package/{chunk-6YX2RAQN.js → chunk-UEZL3RBG.js} +89 -164
  161. package/{chunk-NCFKHYDM.js → chunk-UJL23HBL.js} +774 -119
  162. package/chunk-ULPU4C43.js +1710 -0
  163. package/{chunk-UA3QTA2S.js → chunk-VC3MAT33.js} +4442 -2570
  164. package/{chunk-VNHZJEQN.js → chunk-VCESLFF4.js} +3 -3
  165. package/chunk-VOO3YQQP.js +17157 -0
  166. package/{chunk-Y2GWUBNS.js → chunk-VZDSNDUD.js} +279 -149
  167. package/{chunk-6BMTKYAO.js → chunk-W2Z5E2R7.js} +126 -698
  168. package/{chunk-4ZCTKB27.js → chunk-W5GKF5ZW.js} +1 -0
  169. package/chunk-WEEB2JKA.js +443 -0
  170. package/{chunk-NUHQO3RB.js → chunk-WIVVNJUS.js} +1 -1
  171. package/chunk-WMBJDXMY.js +408 -0
  172. package/chunk-WSQLCWLQ.js +201 -0
  173. package/{chunk-OOVOAG4Q.js → chunk-WY6DMHMG.js} +1 -1
  174. package/{chunk-6K32PBRY.js → chunk-XJW6SLBZ.js} +3 -3
  175. package/{chunk-MNFUKRRU.js → chunk-XKNDVHF5.js} +7 -7
  176. package/{chunk-MHKPUGPD.js → chunk-XREMPMNK.js} +20 -4
  177. package/chunk-XT6C2QZW.js +46 -0
  178. package/chunk-XUDXQT7R.js +790 -0
  179. package/{chunk-ZEZC7IIM.js → chunk-YFSM2366.js} +35 -35
  180. package/{chunk-RIWKZT7E.js → chunk-YRPIUIEQ.js} +11 -9
  181. package/{chunk-U35UUM5K.js → chunk-YVOUSIIA.js} +1 -1
  182. package/{chunk-6VEO7Z3Y.js → chunk-Z27AH6A5.js} +6 -6
  183. package/chunk-Z3KTXWWB.js +76 -0
  184. package/{chunk-UWWOWTW2.js → chunk-Z7EP5HDL.js} +1 -1
  185. package/{chunk-YFEK7ACQ.js → chunk-ZB2E724W.js} +4 -4
  186. package/{chunk-YLAHYLDQ.js → chunk-ZC3CMUKU.js} +2 -89
  187. package/{chunk-5P3PPQVP.js → chunk-ZQAADXSF.js} +1 -1
  188. package/{cliAgentConfigHelpers-BXHQ3PXP.js → cliAgentConfigHelpers-BJJEXHSZ.js} +20 -14
  189. package/{cliAuthorityBrokerClient-TFNXJLXL.js → cliAuthorityBrokerClient-3SKOA7OZ.js} +3 -1
  190. package/cliAuthorityBrokerProcess-VIJEKQSX.js +34 -0
  191. package/{cliEnvHelpers-CNMP3RDX.js → cliEnvHelpers-NDMKN4X2.js} +6 -3
  192. package/{cliExecutor-K6FDZTQ2.js → cliExecutor-Z62UBJ5S.js} +12 -6
  193. package/cliLocalAgentRecordReader-KCZS2MZU.js +113 -0
  194. package/cloudAutomationCommands-2WQUGQSW.js +310 -0
  195. package/{commandRegistry-IFYQLPGM.js → commandRegistry-C64JBZJ3.js} +288 -121
  196. package/{contentThunks-QCFCD2X3.js → contentThunks-G3HEIRXC.js} +45 -43
  197. package/{cooldownCommands-WDOI5VD7.js → cooldownCommands-FPAFS7XG.js} +1 -1
  198. package/createAgentAutomationAction-DSBL3X3A.js +172 -0
  199. package/createDialogAction-OHFUHC53.js +86 -0
  200. package/{createPageAction-QCVBMP4C.js → createPageAction-E6JZSZLU.js} +49 -45
  201. package/{db-VR74ADGC.js → db-KTQ3LL2Q.js} +3 -3
  202. package/{dbSlice-RWPSVHBC.js → dbSlice-U3GPLEL3.js} +21 -16
  203. package/deleteDbKey-DRXKWJX5.js +86 -0
  204. package/{dialogCommands-4IEQUALS.js → dialogCommands-4EX2OTIC.js} +80 -66
  205. package/{dialogMessageRecord-OAV77LT7.js → dialogMessageRecord-2HJTEXQX.js} +1 -1
  206. package/dialogNotifyCommand-4SCE2Z2R.js +44 -0
  207. package/dialogPortabilityCommands-ZSFFHRX4.js +3036 -0
  208. package/{dialogSlice-XFYID6KE.js → dialogSlice-PRZCIJCH.js} +43 -42
  209. package/{dialogTraceCommand-Y67NRFCV.js → dialogTraceCommand-RKB76OVX.js} +84 -70
  210. package/{dialogUsageCommand-WJ3U6KZU.js → dialogUsageCommand-BP7HMRYP.js} +7 -4
  211. package/{docCreateCommands-QLRIWRQE.js → docCreateCommands-JGPNGIZ7.js} +68 -59
  212. package/{docDeleteCommands-XPRYA532.js → docDeleteCommands-XRJTNRDH.js} +68 -59
  213. package/{docReadCommands-EXQI7ETH.js → docReadCommands-6GFO4ARS.js} +67 -58
  214. package/{docStore-MWFUKZL2.js → docStore-QRLIWFTU.js} +16 -17
  215. package/{docUpdateCommands-EFBFQV77.js → docUpdateCommands-W2GXMUXW.js} +68 -59
  216. package/{ebookDownloaderAgentCommand-DYSKF5ZY.js → ebookDownloaderAgentCommand-2DHPGEOQ.js} +14 -17
  217. package/{fetchMessages-TQEUZD7H.js → fetchMessages-RGPIYEPZ.js} +2 -2
  218. package/{getPricing-5BLZRPTM.js → getPricing-BK6CUBAE.js} +8 -4
  219. package/{handleSendMessageAction-GG3TR62X.js → handleSendMessageAction-DHGWURJZ.js} +265 -119
  220. package/{hostCredentialCreate-26S6DDJ5.js → hostCredentialCreate-FPUZ7RMI.js} +138 -122
  221. package/index.js +36 -22
  222. package/{keys-RWF7UCB4.js → keys-FXEGMKSG.js} +2 -2
  223. package/localAutomationCommands-ZMU22RQJ.js +198 -0
  224. package/localAutomationRuntime-MU5FGJ3V.js +60 -0
  225. package/{localDialogRead-BJJT3TF5.js → localDialogRead-W2EVXISA.js} +2 -2
  226. package/{localRuntimeAdapter-VREWZWPC.js → localRuntimeAdapter-YBXQBV4G.js} +136 -119
  227. package/localRuntimeAuthority-LDXMEDO5.js +44 -0
  228. package/{localRuntimeDb-ZJFGNHML.js → localRuntimeDb-6TQZDLNU.js} +1 -1
  229. package/{machineCommands-CL5XK5UC.js → machineCommands-57RTUYRV.js} +251 -357
  230. package/{machineInfo-LWHTEBHJ.js → machineInfo-BJIU3WQ5.js} +4 -2
  231. package/machineWsRunDispatch-VBKV3FFE.js +227 -0
  232. package/{mcpLocalAuthorizeCommand-RBXJDE6J.js → mcpLocalAuthorizeCommand-J76SOJVZ.js} +40 -22
  233. package/mcpLocalManageCommands-USETIMHB.js +212 -0
  234. package/{memberThunks-43B7UYC5.js → memberThunks-7UERUEMI.js} +102 -22
  235. package/{memoryCommands-BC6REPQB.js → memoryCommands-N7NHEE55.js} +25 -34
  236. package/{models-ZX2BYIMB.js → models-TOXYINNM.js} +3 -2
  237. package/{offlineMarxistsAgentCommand-XVXUE6G5.js → offlineMarxistsAgentCommand-WZBJBCPZ.js} +16 -22
  238. package/package.json +3 -3
  239. package/parityCommands-LYDLWSLK.js +613 -0
  240. package/{projectArchive-OC63TWTD.js → projectArchive-KCNQDVWJ.js} +49 -45
  241. package/{providerPresetApply-NTJUINI6.js → providerPresetApply-IRJ56XIZ.js} +12 -16
  242. package/{providerRegistry-W45SLUV6.js → providerRegistry-26PAUYH2.js} +3 -13
  243. package/{read-KG6INYUT.js → read-SPSQ6NLR.js} +11 -10
  244. package/{readDocTool-N3GA52JR.js → readDocTool-ENUL2GNL.js} +5 -1
  245. package/{readlineWorkspace-2NO6D6IZ.js → readlineWorkspace-MKS7TAEF.js} +927 -573
  246. package/{rememberExplicit-CPAPONSI.js → rememberExplicit-7KX4HXQC.js} +4 -4
  247. package/remove-TNNDO635.js +32 -0
  248. package/{removeDialogAgentAction-EEVSOQOJ.js → removeDialogAgentAction-POPUZ3WU.js} +22 -26
  249. package/{runAgentClientLoop-U7V32UTD.js → runAgentClientLoop-KVILXQNI.js} +117 -82
  250. package/{runtimeDoctorCommands-V3M3JTUV.js → runtimeDoctorCommands-4J2DP4LZ.js} +23 -16
  251. package/{secretCommands-KVVZS7A6.js → secretCommands-CSTQYB6T.js} +2 -2
  252. package/{setDialogExtraReferencesAction-DNO5POHA.js → setDialogExtraReferencesAction-35THMVBP.js} +16 -17
  253. package/{setPrimaryDialogAgentAction-QABBEO4C.js → setPrimaryDialogAgentAction-WLXBNIG7.js} +23 -27
  254. package/{settingThunks-DVKG4X4S.js → settingThunks-6Y5U5M5N.js} +170 -497
  255. package/{skillDiscovery-5GEGWJ6N.js → skillDiscovery-IUEZZG2B.js} +3 -3
  256. package/{spaceCommands-7QKXKBDQ.js → spaceCommands-LXNJBO2U.js} +293 -58
  257. package/spacePruneCommand-2ITUFYBM.js +233 -0
  258. package/{store-Z53ICFL3.js → store-WSAVTR32.js} +3 -1
  259. package/{streamAgentChatTurn-UAGFOXNJ.js → streamAgentChatTurn-EY6MFKCA.js} +225 -137
  260. package/{switchDialogAgentAction-KYWJSGOO.js → switchDialogAgentAction-TG6BQRDA.js} +19 -23
  261. package/{tableCommands-EFA754RE.js → tableCommands-35G34R4B.js} +28 -49
  262. package/{toolApiClient-N5PYW2R3.js → toolApiClient-MPQIFYXP.js} +15 -4
  263. package/{tools-2Q2LBDUC.js → tools-CSLTRRUR.js} +73 -63
  264. package/{tuiRestart-4QDWLHYZ.js → tuiRestart-ALR4Q3JM.js} +20 -13
  265. package/tuiSummaryLlmCaller-3Y3JEXJK.js +52 -0
  266. package/{updateCommands-GJGRS6JK.js → updateCommands-GHQVP6Z5.js} +13 -8
  267. package/{updateDialogTitleAction-GGNTTI5L.js → updateDialogTitleAction-LFAWF5EW.js} +57 -58
  268. package/{usageCommand-WI6SQOPB.js → usageCommand-5VKW6T4C.js} +6 -8
  269. package/{usageRebuildCommand-WQRLLZAT.js → usageRebuildCommand-VUQETFMW.js} +11 -15
  270. package/{windowsSelfUpdate-C7LGVWYX.js → windowsSelfUpdate-SXSVXK4X.js} +2 -2
  271. package/workContext-ZAW6VXT7.js +18 -0
  272. package/workContextQueryProjection-CACY5VFE.js +23 -0
  273. package/{workloadLifecycle-DYX5ZMAT.js → workloadLifecycle-P2SJVV3S.js} +1 -1
  274. package/agentFavoriteCommands-7LOP3HUD.js +0 -186
  275. package/agentRecordCommands-TPE7NSZ6.js +0 -194
  276. package/agentRunCommand-DMVGBPLI.js +0 -232
  277. package/authCommand-V6EOMZX6.js +0 -79
  278. package/chunk-2MBTWINN.js +0 -89
  279. package/chunk-523DITKR.js +0 -32
  280. package/chunk-BUDVRYES.js +0 -2213
  281. package/chunk-BZMDWGQQ.js +0 -47
  282. package/chunk-GAHJLSDO.js +0 -107
  283. package/chunk-GYX6XTAI.js +0 -84
  284. package/chunk-HNUWUO75.js +0 -93
  285. package/chunk-HSBHS6KT.js +0 -33401
  286. package/chunk-KG27JIG4.js +0 -136
  287. package/chunk-OB4FBZXJ.js +0 -364
  288. package/chunk-OKH74FML.js +0 -3746
  289. package/chunk-OLZBQWZU.js +0 -6
  290. package/chunk-OOV5JN25.js +0 -1317
  291. package/chunk-OQFOE4SJ.js +0 -405
  292. package/chunk-PXYBUFDB.js +0 -53
  293. package/chunk-R3FZHW4Q.js +0 -103
  294. package/chunk-R3MV2GII.js +0 -106
  295. package/chunk-SCAC3NM5.js +0 -11751
  296. package/chunk-SR4FE5VD.js +0 -9
  297. package/chunk-SYTHYBMI.js +0 -3558
  298. package/chunk-UKZX3NHN.js +0 -48
  299. package/chunk-UVLYNWIE.js +0 -74
  300. package/chunk-VQX5JJNI.js +0 -861
  301. package/chunk-X4O7FJF5.js +0 -160
  302. package/chunk-YJPK35HB.js +0 -175
  303. package/chunk-YNIYE47Z.js +0 -105
  304. package/chunk-Z4PCXPUE.js +0 -127
  305. package/chunk-ZR5IVL4N.js +0 -862
  306. package/chunk-ZTHAJU3O.js +0 -2537
  307. package/cliAuthorityBrokerProcess-5ZFBTHLB.js +0 -22
  308. package/cliLocalAgentRecordReader-34UKRBLY.js +0 -104
  309. package/createDialogAction-ZAJERW62.js +0 -82
  310. package/deleteFile-ECU6FU5C.js +0 -55
  311. package/dialogNotifyCommand-IASQGEMW.js +0 -36
  312. package/localRuntimeAuthority-UF2DAQ3F.js +0 -28
  313. package/machineWsRunDispatch-TBVOYOAH.js +0 -209
  314. package/markdownToSlate-PXYAIBVL.js +0 -8
  315. package/tuiSummaryLlmCaller-HROLGN4F.js +0 -45
  316. package/webapi-QVV65DQF.js +0 -2487
  317. package/workContext-Y3ADAPZU.js +0 -14
  318. package/{chunk-USGHJSGO.js → chunk-GX2MFKF3.js} +3 -3
  319. package/{chunk-PHREU2KZ.js → chunk-WX266G2C.js} +0 -0
  320. package/{chunk-DXWGFL2Z.js → chunk-YY7IGJMN.js} +3 -3
@@ -0,0 +1,1179 @@
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
+ };