nolo-cli 0.226.0-alpha.1 → 0.226.0

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 (259) hide show
  1. package/README.md +3 -5
  2. package/{_executeModel-UE2NJPZD.js → _executeModel-IZ2MCXHO.js} +89 -83
  3. package/{action-CK64LS6S.js → action-VDEW6WLI.js} +9 -6
  4. package/{addContentAction-EQXMFNPR.js → addContentAction-7YVXHIPQ.js} +15 -14
  5. package/{addDialogAgentAction-RSDZDASD.js → addDialogAgentAction-BX7B47HF.js} +18 -17
  6. package/{agentDeleteCommand-SOI25WK7.js → agentDeleteCommand-N7ELXPLD.js} +145 -138
  7. package/{agentEmailCommands-UGWQQNKM.js → agentEmailCommands-OFS477PV.js} +144 -133
  8. package/{agentFavoriteCommands-2LKGKSUD.js → agentFavoriteCommands-7LOP3HUD.js} +5 -5
  9. package/{agentGrantCommands-QQV4N4JW.js → agentGrantCommands-L6O2HVJI.js} +5 -5
  10. package/agentListCommands-IQQHJSXP.js +644 -0
  11. package/{agentMachineCommands-M6IKO7XE.js → agentMachineCommands-NS65BEW7.js} +75 -66
  12. package/{agentProviderCommands-7BSJH7TO.js → agentProviderCommands-SS6M6VGY.js} +6 -6
  13. package/{agentPullCommand-XN6ZPBUW.js → agentPullCommand-QQQZSC6S.js} +6 -6
  14. package/agentRecordCommands-4VE7CNLC.js +188 -0
  15. package/agentRunCommand-2MUXHKNW.js +223 -0
  16. package/{agentRunControl-DFEEOFC7.js → agentRunControl-55GL6Q3M.js} +23 -15
  17. package/{agentRuntimeLocal-GSTYFEX4.js → agentRuntimeLocal-5DB2P4MU.js} +63 -49
  18. package/{agentSlice-7PTNWEED.js → agentSlice-5VTAFG43.js} +19 -18
  19. package/{appDeleteCommands-L7HL4AWF.js → appDeleteCommands-EDKUPHJM.js} +67 -58
  20. package/{appDeployCommands-SGSUNFZR.js → appDeployCommands-JO74GW4L.js} +67 -58
  21. package/{appDeployStatusCommands-AAA3XD54.js → appDeployStatusCommands-U77ZUHX7.js} +67 -58
  22. package/{appGetCommands-LN72GAOA.js → appGetCommands-QCMHBYPX.js} +67 -58
  23. package/{appListCommands-IJQQ3VND.js → appListCommands-ZQJYEXI6.js} +67 -58
  24. package/{authCommand-7JXW54U4.js → authCommand-W4KXRZLI.js} +33 -28
  25. package/{authCommands-YDNAIDEY.js → authCommands-6AUYO65N.js} +15 -10
  26. package/{builtinSkillRegistry-PXH7EGQB.js → builtinSkillRegistry-GHE3RD3V.js} +8 -8
  27. package/{chromeCommands-G5UDKVSV.js → chromeCommands-S7AW3AOD.js} +383 -6
  28. package/{chromeOpsCommands-YKX2QX3A.js → chromeOpsCommands-TBPM6MR4.js} +6 -6
  29. package/{chunk-7Z6EW7AH.js → chunk-247AAJRK.js} +13 -6
  30. package/{chunk-P2ZLUIW2.js → chunk-2BSLGODA.js} +350 -25
  31. package/{chunk-4HFTBHBF.js → chunk-2N4UBHUU.js} +8 -8
  32. package/chunk-2SXN7LAY.js +15 -0
  33. package/{chunk-GSAS72AN.js → chunk-2T5BHLID.js} +2871 -1565
  34. package/{chunk-XI2BWJM5.js → chunk-324FWHUA.js} +20 -3
  35. package/{chunk-VFBVA3U2.js → chunk-3OQFXODL.js} +131 -40
  36. package/{chunk-BGGHA5DV.js → chunk-3ORFJP2Z.js} +1 -1
  37. package/{chunk-OWH2BLNU.js → chunk-3UNAGTBW.js} +32 -95
  38. package/{chunk-LM2PS3YS.js → chunk-4F7SWSWO.js} +26 -13
  39. package/{chunk-SBVTHMEG.js → chunk-4FE3IWRE.js} +1 -1
  40. package/{chunk-GOAPXKQU.js → chunk-4UK6UBXF.js} +4 -4
  41. package/{chunk-4JVNURX4.js → chunk-4YFC3DWW.js} +68 -16
  42. package/chunk-4ZCTKB27.js +31 -0
  43. package/chunk-53W5BXLN.js +340 -0
  44. package/{chunk-TD6QCQ5G.js → chunk-5GRWWUB4.js} +4 -4
  45. package/{chunk-JWXITTQB.js → chunk-5HUO7SEX.js} +9 -107
  46. package/{chunk-ZH6MUQEO.js → chunk-6326DRQY.js} +1 -1
  47. package/{chunk-AVHRSJUH.js → chunk-6MQWGA5F.js} +31 -24
  48. package/{chunk-67BE44IS.js → chunk-6MX6S6TE.js} +3 -3
  49. package/chunk-6RSNVJGO.js +279 -0
  50. package/{chunk-BRW24CTE.js → chunk-6S6CZUXK.js} +42 -33
  51. package/{chunk-PDCV7P5W.js → chunk-6XIE5ZGI.js} +1 -1
  52. package/{chunk-CVS5IMJ5.js → chunk-6XLWUNZB.js} +25 -25
  53. package/{chunk-YGMBIXCF.js → chunk-6XRPBZRS.js} +4 -2
  54. package/{chunk-62HXNQVV.js → chunk-776CXKMX.js} +1 -1
  55. package/{chunk-6J4TTPS2.js → chunk-7AWKDRXG.js} +5 -5
  56. package/{chunk-3KNEE64G.js → chunk-7GTXPS3D.js} +16 -16
  57. package/{chunk-FS3RA7D2.js → chunk-7HUHOCIY.js} +147 -162
  58. package/{chunk-PWTNI4N7.js → chunk-ANUP75N2.js} +22 -0
  59. package/chunk-BEM6LPD2.js +734 -0
  60. package/{chunk-AGP3YSEC.js → chunk-BH7CEVOH.js} +46 -1
  61. package/chunk-BIDSIRTS.js +307 -0
  62. package/{chunk-VTW7VKZX.js → chunk-C4KX626C.js} +15 -15
  63. package/chunk-C5A54QS7.js +108 -0
  64. package/{chunk-4PMZVBDU.js → chunk-CHYYSFFM.js} +6 -6
  65. package/{chunk-VREDDN25.js → chunk-CJTB3OYB.js} +14 -9
  66. package/{chunk-YFLVRVYK.js → chunk-DLT2DN4M.js} +1 -1
  67. package/{chunk-LKA64WH4.js → chunk-DMPZMYH4.js} +37 -1
  68. package/{chunk-EOWLBDY6.js → chunk-DOK7GDRU.js} +1 -1
  69. package/{chunk-5NC6A2RZ.js → chunk-DPAIQLAL.js} +105 -102
  70. package/{chunk-KFHREHUQ.js → chunk-DXWGFL2Z.js} +89 -1
  71. package/{chunk-XN23AUVU.js → chunk-EKXPHL7M.js} +8 -5
  72. package/{chunk-DISQCYPE.js → chunk-ENYTIRIO.js} +6 -6
  73. package/{chunk-2TIQO6TC.js → chunk-ER3P6MBT.js} +206 -308
  74. package/{chunk-M3JEW6N6.js → chunk-F26GAEH3.js} +10 -0
  75. package/{chunk-JM5C4EUA.js → chunk-F4MCAOWN.js} +6 -6
  76. package/chunk-FDZ2GBWO.js +166 -0
  77. package/{chunk-PMDVQBGA.js → chunk-GAHJLSDO.js} +14 -7
  78. package/{chunk-N5PQJKCY.js → chunk-GES5GIAU.js} +14 -13
  79. package/{chunk-HYHIAM6T.js → chunk-HQVNO7FH.js} +66 -35
  80. package/chunk-HSWEFHFS.js +103 -0
  81. package/{chunk-S2NTVGA2.js → chunk-I2OYPD3Y.js} +1 -1
  82. package/{chunk-F7DU25CE.js → chunk-IIG3TT73.js} +460 -123
  83. package/{chunk-AK5O76CC.js → chunk-IZJFTY4R.js} +3 -3
  84. package/{chunk-2VA6TU4I.js → chunk-J25ESVUW.js} +22 -19
  85. package/{chunk-TUIWP2LF.js → chunk-J2XZZXIH.js} +4 -4
  86. package/{chunk-JVRQ6YVK.js → chunk-JBWXPACD.js} +1 -1
  87. package/{chunk-D726I5AZ.js → chunk-JVJ53XCH.js} +2 -2
  88. package/{chunk-TXGQ4O5S.js → chunk-KC2QVCI7.js} +20 -174
  89. package/{chunk-UKS7D2NL.js → chunk-KF2DWSAH.js} +113 -28
  90. package/chunk-KK3FCYZM.js +647 -0
  91. package/{chunk-ZZ4M2I3R.js → chunk-KLD7K5FD.js} +349 -16
  92. package/{chunk-JIADJPUV.js → chunk-KMW5CRRM.js} +1564 -2955
  93. package/{chunk-N5Z2V73W.js → chunk-LELADM5Q.js} +1 -1
  94. package/{chunk-4NA3YTBC.js → chunk-LMFMV5UC.js} +8 -8
  95. package/{chunk-KZU52OJ5.js → chunk-LZOOUQAZ.js} +6 -6
  96. package/{chunk-VV7TXWOC.js → chunk-M5EA44QU.js} +6 -6
  97. package/{chunk-UYOICCYG.js → chunk-MEDPR36J.js} +64 -89
  98. package/chunk-MFXJY44K.js +133 -0
  99. package/chunk-MVOZ22RZ.js +26 -0
  100. package/{chunk-3QFLXA24.js → chunk-N6EN3HK3.js} +3 -3
  101. package/{chunk-SOF4OWDM.js → chunk-NEG5LYK5.js} +1 -3
  102. package/{chunk-HJAO2NAL.js → chunk-ODGSLWLO.js} +593 -370
  103. package/{chunk-OB6DVWPF.js → chunk-OGZE6BZG.js} +331 -99
  104. package/{chunk-KYH7XW3K.js → chunk-OJRTTERA.js} +77 -2
  105. package/{chunk-2VUZSVAS.js → chunk-OKPC4QNX.js} +57 -20
  106. package/{chunk-SOG7OEXX.js → chunk-ONFFUQYM.js} +1 -1
  107. package/{chunk-KNIIRXHF.js → chunk-P244EH4W.js} +46 -8
  108. package/chunk-P27E22MA.js +203 -0
  109. package/{chunk-YDBMZ7FV.js → chunk-PK7VT4ZU.js} +3 -3
  110. package/{chunk-EUCFKKDM.js → chunk-PVFYPUIM.js} +40 -10
  111. package/{chunk-HOCHUZQ7.js → chunk-QJTZ76CP.js} +24 -6
  112. package/{chunk-5RKUPJYL.js → chunk-QLUYDJST.js} +11 -3
  113. package/{chunk-EVPIBQ5I.js → chunk-QUJKDFZW.js} +17 -17
  114. package/{chunk-C4VAR65S.js → chunk-QXUVCIPB.js} +204 -124
  115. package/{chunk-X4OVEYPX.js → chunk-QYNABNNQ.js} +13 -13
  116. package/{chunk-MK2Q7ZJD.js → chunk-R7XWZDOH.js} +58 -24
  117. package/{chunk-5FUN7EG4.js → chunk-RD3QLZQV.js} +83 -47
  118. package/{chunk-KC4SCKXO.js → chunk-RGUWOMXU.js} +1234 -1451
  119. package/{chunk-IZIN2UNJ.js → chunk-RH44TIHX.js} +206 -27
  120. package/{chunk-GNHMRBYZ.js → chunk-RIMFTQMC.js} +282 -58
  121. package/{chunk-VQUWV3YR.js → chunk-S25VJYXV.js} +9 -3
  122. package/{chunk-X7YC2OHB.js → chunk-SBRJOYND.js} +723 -355
  123. package/{chunk-UEKXWO7A.js → chunk-SBRSXY67.js} +18 -7
  124. package/chunk-SR4FE5VD.js +9 -0
  125. package/{chunk-4WVJLODK.js → chunk-T23G6PXQ.js} +8 -3
  126. package/chunk-T3WSFTBS.js +62 -0
  127. package/{chunk-KEN3N2TN.js → chunk-TB5KTLNB.js} +15 -12
  128. package/{chunk-VP3BINY7.js → chunk-TOK555CQ.js} +31 -1
  129. package/{chunk-OBSEKCVK.js → chunk-U4VSBDO5.js} +88 -0
  130. package/{chunk-PPJYZRSQ.js → chunk-U5LOKQ2R.js} +30 -14
  131. package/{chunk-GGKNJ42M.js → chunk-UDT4SI37.js} +18 -108
  132. package/{chunk-CKT6QUE2.js → chunk-UHW6SCVK.js} +1 -1
  133. package/{chunk-GVGOEMNV.js → chunk-UQXOORR3.js} +5 -5
  134. package/{chunk-GS4OTYCH.js → chunk-UR7555FE.js} +9 -9
  135. package/{chunk-QLFCTYRH.js → chunk-UWOCASVL.js} +20 -13
  136. package/{chunk-C4WTX5TU.js → chunk-V2V5Q6DU.js} +2 -2
  137. package/{chunk-2ZKFCIJJ.js → chunk-VCU5GV42.js} +1 -1
  138. package/{chunk-FTQWYWUI.js → chunk-VMWY7TUA.js} +1 -1
  139. package/chunk-VNALJT32.js +33394 -0
  140. package/{chunk-HGDKT2D6.js → chunk-VTHWBTRE.js} +177 -1
  141. package/chunk-WBSJAIZP.js +170 -0
  142. package/chunk-WDWZPASX.js +29 -0
  143. package/chunk-WFGNWWJI.js +326 -0
  144. package/{chunk-UJKTI5PG.js → chunk-WRKMXMU7.js} +2 -1
  145. package/chunk-WVOZ35E4.js +1438 -0
  146. package/{chunk-FIYSMXHY.js → chunk-WWTSEBDF.js} +1 -1
  147. package/{chunk-E2BESSAW.js → chunk-X4O7FJF5.js} +2 -0
  148. package/{chunk-GIABSSWQ.js → chunk-XDNXKFWF.js} +6 -6
  149. package/{chunk-GBZ4YKEO.js → chunk-XLN2GD6Z.js} +7 -7
  150. package/{chunk-45LZIYXB.js → chunk-XNEDFWT4.js} +2 -2
  151. package/{chunk-EWPDMS4N.js → chunk-Y22P6ASC.js} +32 -17
  152. package/{chunk-LJSNEV7M.js → chunk-Y3DOUQQQ.js} +8 -8
  153. package/{chunk-KOXKKHFE.js → chunk-Y5EBOURK.js} +10 -5
  154. package/{chunk-L5I543VB.js → chunk-YGDYYFRX.js} +20 -24
  155. package/{chunk-6OVNSQHN.js → chunk-YLAHYLDQ.js} +5 -0
  156. package/{chunk-PVZY6P3S.js → chunk-YTEY27GN.js} +2 -2
  157. package/chunk-YUZ2DAIH.js +34 -0
  158. package/chunk-Z6YTCDU4.js +24 -0
  159. package/{chunk-MOMR7NMG.js → chunk-ZCVBIIUE.js} +4 -4
  160. package/{chunk-AZQZ5XPM.js → chunk-ZCZLTJEW.js} +98 -57
  161. package/{chunk-KN3HEZIQ.js → chunk-ZVOL2MAJ.js} +1 -1
  162. package/{cliAgentConfigHelpers-KICKKNYQ.js → cliAgentConfigHelpers-6OFDHJFT.js} +13 -13
  163. package/{cliAuthorityBrokerClient-XHH7MH2P.js → cliAuthorityBrokerClient-SFPC3WVK.js} +1 -1
  164. package/{cliEnvHelpers-VPSJ4XWC.js → cliEnvHelpers-CNMP3RDX.js} +1 -1
  165. package/{cliExecutor-4MAX3PZL.js → cliExecutor-K6FDZTQ2.js} +3 -1
  166. package/cliLocalAgentRecordReader-FHIMCBUK.js +102 -0
  167. package/{commandRegistry-XSMTI5PG.js → commandRegistry-OKIWAJIS.js} +113 -101
  168. package/{contentThunks-S4NNC7R2.js → contentThunks-VF2DCU46.js} +41 -38
  169. package/{cooldownCommands-X7P5M2V5.js → cooldownCommands-QL6DWGVU.js} +4 -4
  170. package/{createAgentAutomationAction-TH7ZEACJ.js → createAgentAutomationAction-BGET7Q6K.js} +41 -38
  171. package/{createDialogAction-SYZAYIIQ.js → createDialogAction-XYDQZETK.js} +42 -40
  172. package/{createPageAction-7Y4U6TXO.js → createPageAction-74S5RO7U.js} +46 -43
  173. package/{db-CS4ZJQKV.js → db-6NRZLEW2.js} +10 -7
  174. package/{dbSlice-ZJPDIFER.js → dbSlice-FI7VNDR5.js} +14 -13
  175. package/{deleteFile-Q3YDB4ML.js → deleteFile-GD62MPZW.js} +10 -7
  176. package/{dialogCommands-V5IYEOQP.js → dialogCommands-Y6DHZUAM.js} +71 -64
  177. package/dialogMessageRecord-OAV77LT7.js +7 -0
  178. package/{dialogNotifyCommand-77B57PL6.js → dialogNotifyCommand-MKXL4NGL.js} +15 -15
  179. package/{dialogSlice-O3RHDAWK.js → dialogSlice-XAUKSWZ4.js} +41 -38
  180. package/{dialogUsageCommand-HTVPR2CX.js → dialogUsageCommand-BZPKR3DW.js} +6 -6
  181. package/{docCreateCommands-36WS33BK.js → docCreateCommands-PHDFOQBM.js} +66 -57
  182. package/{docDeleteCommands-C4CS4XLF.js → docDeleteCommands-OSHJM67Y.js} +69 -60
  183. package/{docReadCommands-QZMSFMPN.js → docReadCommands-E6QYCFMS.js} +66 -57
  184. package/{docStore-PYNEODAH.js → docStore-ZZT2BEBU.js} +16 -15
  185. package/{docUpdateCommands-BYI64HVV.js → docUpdateCommands-DHIOPK2C.js} +66 -57
  186. package/fetchMessages-TQEUZD7H.js +2 -2
  187. package/{getPricing-VNGFM4PN.js → getPricing-RNRITFOP.js} +6 -6
  188. package/{handleSendMessageAction-Z43FP2E2.js → handleSendMessageAction-ARUU6CNF.js} +83 -78
  189. package/{hostCredentialCreate-Y7YIGKP4.js → hostCredentialCreate-SNQT73H4.js} +131 -119
  190. package/index.js +56 -18
  191. package/keys-RWF7UCB4.js +1 -1
  192. package/{lib-OT5OTXRU.js → lib-62SWPXNF.js} +3 -7
  193. package/{localDialogRead-SVTPA5GY.js → localDialogRead-3T2KMCRC.js} +1 -1
  194. package/{localRuntimeAdapter-ZLJONQZS.js → localRuntimeAdapter-MHI6Y2IZ.js} +143 -130
  195. package/{localRuntimeAuthority-IBJAT62G.js → localRuntimeAuthority-7DKIT7UH.js} +4 -2
  196. package/{localRuntimeDb-N7KHDXS2.js → localRuntimeDb-5WZ4RJJO.js} +1 -1
  197. package/{machineCommands-4ZLMRIA3.js → machineCommands-3O6Y27R4.js} +283 -348
  198. package/machineWsRunDispatch-5PFLR5XC.js +203 -0
  199. package/markdownToSlate-KIYM7B3P.js +8 -0
  200. package/mcpLocalAuthorizeCommand-BQCQ2KRJ.js +106 -0
  201. package/{memberThunks-JRYNONYV.js → memberThunks-TU6A6OBV.js} +24 -19
  202. package/{memoryCommands-5WC3T66U.js → memoryCommands-BC6REPQB.js} +4 -4
  203. package/{models-H5NNZRLH.js → models-CINY5UZR.js} +2 -2
  204. package/{overlay-THLKYIWY.js → overlay-JA3SPVUS.js} +7 -3
  205. package/package.json +1 -1
  206. package/{projectArchive-JBX6HNK6.js → projectArchive-X2EVXU3N.js} +47 -44
  207. package/{providerPresetApply-J3WMRPD2.js → providerPresetApply-HUWNV2NI.js} +7 -7
  208. package/{providerRegistry-KJGB5XWS.js → providerRegistry-7FWKDKZJ.js} +7 -7
  209. package/{read-Q7GOHGNP.js → read-QAHEQID5.js} +9 -8
  210. package/{readDocTool-Z5OQ6422.js → readDocTool-KG5DP6EM.js} +1 -1
  211. package/{readlineWorkspace-WFPIAAAT.js → readlineWorkspace-SO3APHVP.js} +8125 -6196
  212. package/rememberExplicit-CPAPONSI.js +15 -0
  213. package/{removeDialogAgentAction-U3F2MNAY.js → removeDialogAgentAction-QZCCVK2G.js} +20 -19
  214. package/{runAgentClientLoop-STI5TKDJ.js → runAgentClientLoop-FLHHCOVH.js} +106 -81
  215. package/{runtimeDoctorCommands-UXKXYBW6.js → runtimeDoctorCommands-DN3I52C6.js} +17 -17
  216. package/{secretCommands-LJXOOYA7.js → secretCommands-36BCE3UE.js} +4 -4
  217. package/{setDialogExtraReferencesAction-G3WSJ7EM.js → setDialogExtraReferencesAction-PDPTYSEW.js} +17 -16
  218. package/{setPrimaryDialogAgentAction-6FHAHZBB.js → setPrimaryDialogAgentAction-DOUIPR66.js} +20 -19
  219. package/{settingThunks-AXTBX3Q5.js → settingThunks-MHGGP6UE.js} +186 -67
  220. package/{skillDiscovery-B5V23AXP.js → skillDiscovery-MDDKPTW3.js} +4 -3
  221. package/{spaceCommands-GUKMDRWN.js → spaceCommands-JH7UYE3K.js} +70 -61
  222. package/{store-JRVN62NM.js → store-Z53ICFL3.js} +3 -1
  223. package/{streamAgentChatTurn-A2WL5OOF.js → streamAgentChatTurn-VDDA2TX6.js} +200 -195
  224. package/{switchDialogAgentAction-UOFIAGPL.js → switchDialogAgentAction-7USK3DAP.js} +18 -17
  225. package/{tableCommands-HITDSLHS.js → tableCommands-UONBFC7L.js} +15 -12
  226. package/{toolApiClient-OGQEBQVX.js → toolApiClient-53YMJ2G6.js} +8 -6
  227. package/{tools-6NU5E6BN.js → tools-MIOCXKMG.js} +72 -68
  228. package/tuiRestart-ET3QISZ5.js +41 -0
  229. package/{tuiSummaryLlmCaller-7WLUKNP2.js → tuiSummaryLlmCaller-MSINBP3M.js} +21 -20
  230. package/{updateCommands-RJVCRSBP.js → updateCommands-5OYND6EF.js} +8 -6
  231. package/{updateDialogTitleAction-VMKU2Y67.js → updateDialogTitleAction-2L4CC4YO.js} +43 -40
  232. package/{usageCommand-YPJ2ZI2F.js → usageCommand-JTKDAG6I.js} +3 -3
  233. package/{usageRebuildCommand-FERQO74C.js → usageRebuildCommand-4TFZCKXM.js} +4 -4
  234. package/webapi-24RZDIIQ.js +2488 -0
  235. package/{windowsSelfUpdate-KERHIAB4.js → windowsSelfUpdate-HIYNL3VR.js} +2 -2
  236. package/workContext-Y3ADAPZU.js +14 -0
  237. package/workContextAccess-UZHDLBUR.js +11 -0
  238. package/workContextWriteNotice-YCSSMHN4.js +7 -0
  239. package/{workloadLifecycle-O2I3NZ2Q.js → workloadLifecycle-ZCSQCHG3.js} +9 -9
  240. package/agentListCommands-YBNOQ5T3.js +0 -991
  241. package/agentRecordCommands-3HL7Z4X6.js +0 -177
  242. package/agentRunCommand-C64A6MPL.js +0 -208
  243. package/chunk-2THCNKE4.js +0 -147
  244. package/chunk-2WZXXAQD.js +0 -57
  245. package/chunk-5ZMIIR23.js +0 -265
  246. package/chunk-652XYZGP.js +0 -352
  247. package/chunk-BJF2MHJ3.js +0 -118
  248. package/chunk-KEPOVMF4.js +0 -91
  249. package/chunk-QVBXJNZ2.js +0 -81
  250. package/chunk-QZI44GWV.js +0 -776
  251. package/cliLocalAgentRecordReader-6FXGFBI3.js +0 -90
  252. package/machineWsRunDispatch-L7Z3ULDF.js +0 -192
  253. package/{accountResolver-EK2S4PWF.js → accountResolver-QETKNC7T.js} +3 -3
  254. package/{chunk-W6RFEDN4.js → chunk-AETZ7AD6.js} +3 -3
  255. package/{chunk-BLVSFYQ3.js → chunk-LISC7BD4.js} +3 -3
  256. package/{chunk-SNBZZPYH.js → chunk-OQHIVPG4.js} +3 -3
  257. package/{chunk-47ITIXO7.js → chunk-USGHJSGO.js} +3 -3
  258. package/{chunk-FJ23FZXF.js → chunk-VIYVRPMJ.js} +0 -0
  259. package/{offlineMarxistsAgentCommand-4IC3Y4C6.js → offlineMarxistsAgentCommand-XVXUE6G5.js} +3 -3
@@ -1,7 +1,9 @@
1
1
  import {
2
- MEMORY_USE_GUIDANCE,
2
+ MEMORY_USE_GUIDANCE
3
+ } from "./chunk-YGDYYFRX.js";
4
+ import {
3
5
  wrapHistoricalSummaryWithReplayGuard
4
- } from "./chunk-L5I543VB.js";
6
+ } from "./chunk-2SXN7LAY.js";
5
7
 
6
8
  // packages/agent-runtime/skillCatalog.ts
7
9
  var SKILL_CATALOG_PRIORITY = Object.freeze([
@@ -190,79 +192,8 @@ function resolveSkillCatalogSync(sources, query = {}, budget = DEFAULT_SKILL_CAT
190
192
  }
191
193
 
192
194
  // packages/agent-runtime/turnContext.ts
193
- var DEFAULT_RECENT_CONTENT_LIMIT = 10;
194
195
  var asTrimmed = (value) => typeof value === "string" ? value.trim() : "";
195
- var asFiniteNumber = (value) => typeof value === "number" && Number.isFinite(value) ? value : 0;
196
- var spaceRecordKey = (spaceId) => spaceId.startsWith("space-") ? spaceId : `space-${spaceId}`;
197
196
  var makeLayer = (id, content, cacheScope = "turn") => ({ id, owner: "runtime", cacheScope, content });
198
- var renderSpaceStructure = (spaceRecord, recentLimit) => {
199
- const categories = spaceRecord.categories ?? {};
200
- const validCategories = Object.entries(categories).filter((entry) => entry[1] !== null).sort(
201
- (a, b) => asFiniteNumber(a[1].order) - asFiniteNumber(b[1].order)
202
- );
203
- const categoryNameById = /* @__PURE__ */ new Map();
204
- let struct = "Directory Structure (Categories):\n";
205
- if (validCategories.length === 0) struct += "(No categories defined)\n";
206
- validCategories.forEach(([id, category]) => {
207
- const name = asTrimmed(category.name) || id;
208
- categoryNameById.set(id, name);
209
- struct += `- ${name} (ID: ${id})
210
- `;
211
- });
212
- const contents = spaceRecord.contents ?? {};
213
- const recentContents = recentLimit > 0 ? Object.values(contents).filter((content) => content !== null).sort(
214
- (a, b) => asFiniteNumber(b.updatedAt) - asFiniteNumber(a.updatedAt)
215
- ).slice(0, recentLimit) : [];
216
- if (recentContents.length > 0) {
217
- struct += `
218
- Recent Contents (Top ${recentLimit}):
219
- `;
220
- recentContents.forEach((content) => {
221
- const categoryId = asTrimmed(content.categoryId);
222
- const categoryName = categoryId ? categoryNameById.get(categoryId) || "Unknown" : "Uncategorized";
223
- struct += `- [${asTrimmed(content.type) || "content"}] ${asTrimmed(content.title)} (Category: ${categoryName}, dbKey: ${asTrimmed(content.contentKey)})
224
- `;
225
- });
226
- }
227
- return struct;
228
- };
229
- var buildSpaceContextLayer = async (args) => {
230
- const spaceId = asTrimmed(args.spaceId);
231
- if (!spaceId) return null;
232
- const recentLimit = args.recentContentLimit ?? DEFAULT_RECENT_CONTENT_LIMIT;
233
- let spaceRecord = null;
234
- let readError = null;
235
- try {
236
- spaceRecord = await args.source.readRecord(spaceRecordKey(spaceId));
237
- } catch (error) {
238
- readError = error instanceof Error ? error.message : String(error);
239
- }
240
- if (!spaceRecord) {
241
- return makeLayer(
242
- "space-context",
243
- [
244
- "--- \u5F53\u524D\u7A7A\u95F4\uFF08Space\uFF09---",
245
- `\u672C\u5BF9\u8BDD\u8BB0\u5F55\u58F0\u660E\u5C5E\u4E8E Space ${spaceId}\uFF0C\u4F46\u5F53\u524D\u65E0\u6CD5\u8BFB\u53D6\u8BE5 Space \u7684\u6570\u636E${readError ? `\uFF08${readError}\uFF09` : "\uFF08\u8BB0\u5F55\u4E0D\u5B58\u5728\u6216\u4E0D\u53EF\u8FBE\uFF09"}\u3002`,
246
- "\u5982\u88AB\u95EE\u53CA\uFF0C\u8BF7\u5982\u5B9E\u8BF4\u660E\u300C\u5BF9\u8BDD\u5C5E\u4E8E\u8BE5 Space \u4F46\u6682\u65F6\u8BFB\u4E0D\u5230\u7A7A\u95F4\u8BE6\u60C5\u300D\uFF0C\u4E0D\u8981\u58F0\u79F0\u5BF9\u8BDD\u4E0D\u5C5E\u4E8E\u4EFB\u4F55\u7A7A\u95F4\u3002"
247
- ].join("\n")
248
- );
249
- }
250
- const name = asTrimmed(spaceRecord.name);
251
- const description = asTrimmed(spaceRecord.description);
252
- const structure = renderSpaceStructure(spaceRecord, recentLimit);
253
- return makeLayer(
254
- "space-context",
255
- [
256
- "--- \u5F53\u524D\u7A7A\u95F4\uFF08Space\uFF09---",
257
- "\u672C\u5BF9\u8BDD\u5C5E\u4E8E\u4EE5\u4E0B Space\uFF1A",
258
- `Space Title: ${name || spaceId}`,
259
- `Space ID: ${spaceId}`,
260
- `Description: ${description || "N/A"}`,
261
- "",
262
- structure.trimEnd()
263
- ].join("\n")
264
- );
265
- };
266
197
  var buildSkillDiscoveryCatalogLayer = (catalog) => {
267
198
  if (catalog.entries.length === 0) return null;
268
199
  const sources = catalog.entries.map((entry) => entry.source).filter((source, index, all) => all.indexOf(source) === index);
@@ -311,37 +242,6 @@ var buildAgentsMdLayer = (content, fileName = "AGENTS.md") => {
311
242
  "session"
312
243
  );
313
244
  };
314
- var buildLinkedSpacesSection = async (args) => {
315
- const ids = (args.linkedSpaceIds ?? []).filter(
316
- (id) => typeof id === "string" && id.trim() !== ""
317
- );
318
- if (ids.length === 0) return null;
319
- const lines = [];
320
- for (const rawId of ids) {
321
- const spaceId = asTrimmed(rawId);
322
- let spaceData = null;
323
- try {
324
- spaceData = await args.source.readRecord(spaceRecordKey(spaceId));
325
- } catch {
326
- spaceData = null;
327
- }
328
- if (spaceData) {
329
- const name = asTrimmed(spaceData.name) || spaceId;
330
- const desc = asTrimmed(spaceData.description);
331
- lines.push(`- ${name} (ID: ${spaceId})${desc ? `: ${desc}` : ""}`);
332
- } else {
333
- lines.push(`- [\u65E0\u6CD5\u8BBF\u95EE] ${spaceId}`);
334
- }
335
- }
336
- if (lines.length === 0) return null;
337
- return [
338
- "--- \u5173\u8054\u7A7A\u95F4 (Linked Spaces) ---",
339
- "\u4EE5\u4E0B\u662F Agent \u53EF\u8BBF\u95EE\u7684\u5176\u4ED6\u5DE5\u4F5C\u7A7A\u95F4\uFF08\u7C97\u7565\u4E0A\u4E0B\u6587\uFF09\uFF1A",
340
- lines.join("\n"),
341
- "",
342
- "\u63D0\u793A\uFF1A\u5982\u9700\u67E5\u8BE2\u8FD9\u4E9B\u7A7A\u95F4\u7684\u8BE6\u7EC6\u5185\u5BB9\uFF0C\u53EF\u4F7F\u7528 read \u5DE5\u5177\u914D\u5408\u5BF9\u5E94\u7684 dbKey\u3002"
343
- ].join("\n");
344
- };
345
245
  var renderTurnContextBlocksWithScope = (layers) => layers.filter((layer) => Boolean(layer?.content?.trim())).map((layer) => ({
346
246
  content: layer.content.trim(),
347
247
  cacheScope: layer.cacheScope
@@ -358,6 +258,9 @@ var buildDialogSummaryLayer = (args) => {
358
258
  return makeLayer("dialog-summary", `--- \u5386\u53F2\u5BF9\u8BDD\u6458\u8981 ---
359
259
  ${historical}`);
360
260
  };
261
+ var hasMemoryTools = (toolNames) => Array.isArray(toolNames) ? toolNames.some(
262
+ (name) => typeof name === "string" && /memory/i.test(name)
263
+ ) : false;
361
264
  var buildMemoryOverlayLayer = (args) => {
362
265
  const promptBlock = asTrimmed(args.promptBlock);
363
266
  if (!promptBlock) return null;
@@ -365,7 +268,7 @@ var buildMemoryOverlayLayer = (args) => {
365
268
  };
366
269
  var buildMemoryUseGuidanceLayer = (args) => {
367
270
  const promptBlock = asTrimmed(args.promptBlock);
368
- if (!promptBlock) return null;
271
+ if (!promptBlock && args.hasMemoryTools !== true) return null;
369
272
  return makeLayer(
370
273
  "memory-use-guidance",
371
274
  MEMORY_USE_GUIDANCE,
@@ -379,14 +282,13 @@ export {
379
282
  mapDiscoveredSkillsToCatalogEntries,
380
283
  resolveSkillCatalog,
381
284
  resolveSkillCatalogSync,
382
- buildSpaceContextLayer,
383
285
  buildSkillDiscoveryCatalogLayer,
384
286
  buildAgentsMdLayerHeader,
385
287
  buildAgentsMdLayer,
386
- buildLinkedSpacesSection,
387
288
  renderTurnContextBlocksWithScope,
388
289
  partitionScopedBlocks,
389
290
  buildDialogSummaryLayer,
291
+ hasMemoryTools,
390
292
  buildMemoryOverlayLayer,
391
293
  buildMemoryUseGuidanceLayer
392
294
  };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  generatePkcePair,
3
3
  startCallbackServer
4
- } from "./chunk-UKS7D2NL.js";
4
+ } from "./chunk-KF2DWSAH.js";
5
5
  import {
6
6
  toErrorMessage
7
7
  } from "./chunk-HNMXYYJR.js";
@@ -6,12 +6,12 @@ import {
6
6
  loadFileFromIndexedDb,
7
7
  removeAction,
8
8
  saveFileToIndexedDb
9
- } from "./chunk-C4WTX5TU.js";
9
+ } from "./chunk-V2V5Q6DU.js";
10
10
  import {
11
11
  readAction,
12
12
  readRequestManager,
13
13
  resolveAgentReadServers
14
- } from "./chunk-QLFCTYRH.js";
14
+ } from "./chunk-UWOCASVL.js";
15
15
  import {
16
16
  beginWriteAck,
17
17
  compareRemoteRecordsByComparableTime,
@@ -29,19 +29,22 @@ import {
29
29
  shouldReplaceLocalWithRemoteRecord,
30
30
  shouldReplicateLocalRecord,
31
31
  uploadToCurrentServer
32
- } from "./chunk-2VUZSVAS.js";
32
+ } from "./chunk-OKPC4QNX.js";
33
33
  import {
34
34
  asyncThunkCreator,
35
35
  buildCreateSlice,
36
36
  createEntityAdapter,
37
37
  noloDeleteRequest
38
- } from "./chunk-7Z6EW7AH.js";
38
+ } from "./chunk-247AAJRK.js";
39
39
  import {
40
40
  fetchFromClientDb,
41
41
  fetchFromServer,
42
+ googleSessionRequestToken,
43
+ googleSessionServer,
42
44
  logger,
43
- normalizeTimeFields
44
- } from "./chunk-AGP3YSEC.js";
45
+ normalizeTimeFields,
46
+ scopeGoogleSessionServers
47
+ } from "./chunk-BH7CEVOH.js";
45
48
  import {
46
49
  isTombstoneRecord
47
50
  } from "./chunk-BV3FLP2L.js";
@@ -53,11 +56,14 @@ import {
53
56
  ulid
54
57
  } from "./chunk-OJKUU3LP.js";
55
58
  import {
56
- isRecord
57
- } from "./chunk-KUG52IAP.js";
59
+ isPublicBuiltinPlatformAgentKey
60
+ } from "./chunk-WRKMXMU7.js";
58
61
  import {
59
62
  API_ENDPOINTS
60
63
  } from "./chunk-LCBAMY2M.js";
64
+ import {
65
+ isRecord
66
+ } from "./chunk-KUG52IAP.js";
61
67
 
62
68
  // packages/database/protectedRecordProtocol.ts
63
69
  var PROTECTED_RECORD_PROTOCOL_VERSION = 1;
@@ -643,14 +649,14 @@ async function getPageReadBaseline(db, actorId, dbKey) {
643
649
  async function readProtectedPage(options) {
644
650
  const { db, actorId, dbKey } = options;
645
651
  const assertAccess = (origin) => {
646
- const access = options.getCurrentAccess?.() ?? options;
647
- if (access.actorId !== actorId || !access.token?.trim()) {
652
+ const access2 = options.getCurrentAccess?.() ?? options;
653
+ if (access2.actorId !== actorId || !access2.token?.trim()) {
648
654
  throw Error("\u6587\u6863\u8BFB\u53D6\u8EAB\u4EFD\u5DF2\u53D8\u5316\u6216\u8BA4\u8BC1\u5DF2\u64A4\u9500\uFF0C\u5DF2\u505C\u6B62\u8BFB\u53D6");
649
655
  }
650
- if (origin && !access.servers.some((server) => originOf(server) === origin)) {
656
+ if (origin && !access2.servers.some((server) => originOf(server) === origin)) {
651
657
  throw Error("\u6587\u6863\u5F52\u5C5E\u670D\u52A1\u5668\u4E0D\u5728\u5DF2\u914D\u7F6E\u670D\u52A1\u5668\u4E2D\u6216\u5DF2\u79FB\u9664\uFF0C\u672A\u53D1\u9001\u8BA4\u8BC1\u4FE1\u606F\uFF0C\u672A\u8F6C\u53D1\u8BA4\u8BC1\u4FE1\u606F");
652
658
  }
653
- return access.token;
659
+ return origin ? googleSessionRequestToken(access2.token, origin) : access2.token;
654
660
  };
655
661
  assertAccess();
656
662
  const sync = options.sync ?? createProtectedRecordSync({ db });
@@ -664,13 +670,10 @@ async function readProtectedPage(options) {
664
670
  sync,
665
671
  fetch: options.fetch,
666
672
  isAuthorityAllowed: (origin) => {
667
- const access = options.getCurrentAccess();
668
- return access.actorId === actorId && access.servers.some((server) => originOf(server) === origin);
673
+ const access2 = options.getCurrentAccess();
674
+ return access2.actorId === actorId && access2.servers.some((server) => originOf(server) === origin);
669
675
  },
670
- getToken: async () => {
671
- const access = options.getCurrentAccess();
672
- return access.actorId === actorId ? access.token ?? null : null;
673
- }
676
+ getToken: async ({ authorityServer }) => assertAccess(authorityServer)
674
677
  });
675
678
  for (let count = 0; count < state.outbox.length; count++) {
676
679
  if ((await transport.sendNext({ actorId, dbKey })).outcome !== "acked") break;
@@ -683,7 +686,9 @@ async function readProtectedPage(options) {
683
686
  return state.workingCopy.data;
684
687
  }
685
688
  }
686
- const servers = saved ? [saved.authorityServer] : options.servers;
689
+ const access = options.getCurrentAccess?.() ?? options;
690
+ const googleAuthority = googleSessionServer(access.token);
691
+ const servers = saved ? [saved.authorityServer] : options.servers.filter((server) => access.servers.some((candidate) => originOf(candidate) === originOf(server)) && (!googleAuthority || originOf(server) === googleAuthority));
687
692
  for (const server of servers) {
688
693
  const origin = originOf(server);
689
694
  if (!origin) continue;
@@ -832,6 +837,7 @@ var readAndWaitAction = async (payload, thunkApi) => {
832
837
  userAuthorityRegistry
833
838
  } = getRuntimeServerContext(state, preferredServerOrigin);
834
839
  const allServers = resolveAgentReadServers({ dbKey, configuredServers });
840
+ const fetchScopedFromServer = (server, key, token, signal) => signal === void 0 ? fetchFromServer(server, key, googleSessionRequestToken(token, server, isPublicBuiltinPlatformAgentKey(key))) : fetchFromServer(server, key, googleSessionRequestToken(token, server, isPublicBuiltinPlatformAgentKey(key)), signal);
835
841
  const isLoggedIn = !!currentToken;
836
842
  const executeReadAndWait = async () => {
837
843
  if (dbKey.startsWith("page-") && currentUserId && currentToken && typeof db.batch === "function") {
@@ -857,11 +863,12 @@ var readAndWaitAction = async (payload, thunkApi) => {
857
863
  currentServer,
858
864
  userAuthorityRegistry
859
865
  });
860
- const readServers = planAuthorityReadServers({
866
+ let readServers = planAuthorityReadServers({
861
867
  allServers,
862
868
  authorityServer: preferredServerOrigin ?? authority.authorityServer,
863
869
  serverOrigin: authority.serverOrigin
864
870
  });
871
+ if (!isPublicBuiltinPlatformAgentKey(dbKey)) readServers = scopeGoogleSessionServers(currentToken, currentServer, readServers);
865
872
  const hasPreferredAuthorityServer = !!preferredServerOrigin || !!authority.authorityServer;
866
873
  const preferredAuthorityServer = hasPreferredAuthorityServer ? readServers[0] : null;
867
874
  if (readServers.length === 0) {
@@ -874,7 +881,7 @@ var readAndWaitAction = async (payload, thunkApi) => {
874
881
  }
875
882
  if (preferredAuthorityServer) {
876
883
  try {
877
- const preferredRemoteData = await fetchFromServer(
884
+ const preferredRemoteData = await fetchScopedFromServer(
878
885
  preferredAuthorityServer,
879
886
  dbKey,
880
887
  isLoggedIn ? currentToken : void 0
@@ -888,7 +895,7 @@ var readAndWaitAction = async (payload, thunkApi) => {
888
895
  }
889
896
  const remainingReadServers = preferredAuthorityServer ? readServers.filter((server) => server !== preferredAuthorityServer) : readServers;
890
897
  const remotePromises = remainingReadServers.map(
891
- (server) => fetchFromServer(server, dbKey, isLoggedIn ? currentToken : void 0)
898
+ (server) => fetchScopedFromServer(server, dbKey, isLoggedIn ? currentToken : void 0)
892
899
  );
893
900
  const chosenData = await processRemoteData(
894
901
  db,
@@ -1487,7 +1494,7 @@ var dbSlice = createSliceWithThunks({
1487
1494
  // 动态 import 在调用期解析,避开 TDZ/求值顺序问题(同下方 share)。
1488
1495
  read: create.asyncThunk(
1489
1496
  async (payload, thunkApi) => {
1490
- const { readAction: readAction2 } = await import("./read-Q7GOHGNP.js");
1497
+ const { readAction: readAction2 } = await import("./read-QAHEQID5.js");
1491
1498
  return readAction2(payload, thunkApi);
1492
1499
  },
1493
1500
  {
@@ -1561,7 +1568,7 @@ var dbSlice = createSliceWithThunks({
1561
1568
  // 这里改成动态 import,运行期才解析,彻底断开这条边。
1562
1569
  share: create.asyncThunk(
1563
1570
  async (config, thunkApi) => {
1564
- const { shareResourceAction } = await import("./action-CK64LS6S.js");
1571
+ const { shareResourceAction } = await import("./action-VDEW6WLI.js");
1565
1572
  return shareResourceAction(config, thunkApi);
1566
1573
  }
1567
1574
  ),
@@ -1,6 +1,3 @@
1
- import {
2
- resolveLocalUserId
3
- } from "./chunk-KZU52OJ5.js";
4
1
  import {
5
2
  resolveNoloHome
6
3
  } from "./chunk-GLKOYSRU.js";
@@ -8,6 +5,9 @@ import {
8
5
  isSupportedDialogId,
9
6
  splitDialogKeyIdentity
10
7
  } from "./chunk-YZMNK53S.js";
8
+ import {
9
+ resolveLocalUserId
10
+ } from "./chunk-LZOOUQAZ.js";
11
11
  import {
12
12
  toErrorMessage
13
13
  } from "./chunk-HNMXYYJR.js";
@@ -0,0 +1,279 @@
1
+ import {
2
+ _appendEntityBatch,
3
+ _appendEvidenceBatch,
4
+ _appendRelationBatch,
5
+ _appendRetiredStateBatch,
6
+ _appendStateBatch,
7
+ getMemoryEntityVNext,
8
+ getMemoryEvidenceVNext,
9
+ getMemoryEvidenceVNextStrict,
10
+ getMemoryStateVNext,
11
+ listMemoryStatesForEntityVNext
12
+ } from "./chunk-324FWHUA.js";
13
+
14
+ // packages/ai/memory/vnext/applyMutation.ts
15
+ async function validateMutation(db, ownerId, mutation) {
16
+ const pending = {
17
+ evidenceIds: /* @__PURE__ */ new Set(),
18
+ entityIds: /* @__PURE__ */ new Set(),
19
+ stateIds: /* @__PURE__ */ new Set(),
20
+ relationIds: /* @__PURE__ */ new Set()
21
+ };
22
+ for (const ev of mutation.evidence ?? []) {
23
+ if (!ev.id || typeof ev.id !== "string") {
24
+ throw new Error("evidence id must be a non-empty string");
25
+ }
26
+ if (pending.evidenceIds.has(ev.id)) {
27
+ throw new Error(`duplicate evidence id in mutation: ${ev.id}`);
28
+ }
29
+ pending.evidenceIds.add(ev.id);
30
+ }
31
+ for (const ent of mutation.entities ?? []) {
32
+ if (!ent.id || typeof ent.id !== "string") {
33
+ throw new Error("entity id must be a non-empty string");
34
+ }
35
+ if (pending.entityIds.has(ent.id)) {
36
+ throw new Error(`duplicate entity id in mutation: ${ent.id}`);
37
+ }
38
+ pending.entityIds.add(ent.id);
39
+ }
40
+ for (const st of mutation.states ?? []) {
41
+ if (!st.id || typeof st.id !== "string") {
42
+ throw new Error("state id must be a non-empty string");
43
+ }
44
+ if (pending.stateIds.has(st.id)) {
45
+ throw new Error(`duplicate state id in mutation: ${st.id}`);
46
+ }
47
+ pending.stateIds.add(st.id);
48
+ }
49
+ for (const rel of mutation.relations ?? []) {
50
+ if (!rel.id || typeof rel.id !== "string") {
51
+ throw new Error("relation id must be a non-empty string");
52
+ }
53
+ if (pending.relationIds.has(rel.id)) {
54
+ throw new Error(`duplicate relation id in mutation: ${rel.id}`);
55
+ }
56
+ pending.relationIds.add(rel.id);
57
+ }
58
+ const supersededIds = /* @__PURE__ */ new Set();
59
+ for (const sid of mutation.supersededStateIds ?? []) {
60
+ if (supersededIds.has(sid)) {
61
+ throw new Error(`duplicate supersededStateId in mutation: ${sid}`);
62
+ }
63
+ supersededIds.add(sid);
64
+ }
65
+ for (const ev of mutation.evidence ?? []) {
66
+ if (ev.ownerId !== ownerId) {
67
+ throw new Error(
68
+ `evidence ${ev.id} has ownerId ${ev.ownerId}, expected ${ownerId}`
69
+ );
70
+ }
71
+ }
72
+ for (const ent of mutation.entities ?? []) {
73
+ if (ent.ownerId !== ownerId) {
74
+ throw new Error(
75
+ `entity ${ent.id} has ownerId ${ent.ownerId}, expected ${ownerId}`
76
+ );
77
+ }
78
+ }
79
+ for (const st of mutation.states ?? []) {
80
+ if (st.ownerId !== ownerId) {
81
+ throw new Error(
82
+ `state ${st.id} has ownerId ${st.ownerId}, expected ${ownerId}`
83
+ );
84
+ }
85
+ }
86
+ for (const rel of mutation.relations ?? []) {
87
+ if (rel.ownerId !== ownerId) {
88
+ throw new Error(
89
+ `relation ${rel.id} has ownerId ${rel.ownerId}, expected ${ownerId}`
90
+ );
91
+ }
92
+ }
93
+ for (const st of mutation.states ?? []) {
94
+ if (supersededIds.has(st.id)) {
95
+ throw new Error(
96
+ `state ${st.id} appears in both states and supersededStateIds; a record cannot be created and retired in the same mutation`
97
+ );
98
+ }
99
+ }
100
+ const facetSlots = /* @__PURE__ */ new Set();
101
+ for (const st of mutation.states ?? []) {
102
+ const slot = `${st.entityId} ${st.facet}`;
103
+ if (facetSlots.has(slot)) {
104
+ throw new Error(
105
+ `mutation writes parallel current states for entity ${st.entityId} facet ${st.facet}`
106
+ );
107
+ }
108
+ facetSlots.add(slot);
109
+ }
110
+ for (const ev of mutation.evidence ?? []) {
111
+ const existing = await getMemoryEvidenceVNext(db, ownerId, ev.id);
112
+ if (existing) {
113
+ throw new Error(
114
+ `evidence ${ev.id} already exists (owner ${ownerId}); use a unique id`
115
+ );
116
+ }
117
+ }
118
+ for (const ent of mutation.entities ?? []) {
119
+ const existing = await getMemoryEntityVNext(db, ownerId, ent.id);
120
+ if (existing) {
121
+ throw new Error(
122
+ `entity ${ent.id} already exists (owner ${ownerId}); use a unique id`
123
+ );
124
+ }
125
+ }
126
+ for (const st of mutation.states ?? []) {
127
+ if (!pending.entityIds.has(st.entityId)) {
128
+ const entity = await getMemoryEntityVNext(db, ownerId, st.entityId);
129
+ if (!entity) {
130
+ throw new Error(
131
+ `memory state ${st.id} references missing entity ${st.entityId} (owner ${ownerId})`
132
+ );
133
+ }
134
+ }
135
+ for (const evidenceId of st.evidenceIds) {
136
+ if (!pending.evidenceIds.has(evidenceId)) {
137
+ const ev = await getMemoryEvidenceVNext(db, ownerId, evidenceId);
138
+ if (!ev) {
139
+ throw new Error(
140
+ `memory state ${st.id} references missing evidence ${evidenceId} (owner ${ownerId})`
141
+ );
142
+ }
143
+ }
144
+ }
145
+ const existing = await getMemoryStateVNext(db, ownerId, st.id);
146
+ if (existing) {
147
+ if (existing.retiredAt) {
148
+ throw new Error(
149
+ `cannot update retired memory state ${st.id} (owner ${ownerId})`
150
+ );
151
+ }
152
+ if (existing.entityId !== st.entityId || existing.facet !== st.facet) {
153
+ throw new Error(
154
+ `state ${st.id} already exists with different entity/facet (${existing.entityId}/${existing.facet} vs ${st.entityId}/${st.facet}); use supersede instead`
155
+ );
156
+ }
157
+ }
158
+ if (!existing) {
159
+ const existingStates = await listMemoryStatesForEntityVNext(db, ownerId, st.entityId);
160
+ for (const es of existingStates) {
161
+ if (es.facet === st.facet && !es.retiredAt) {
162
+ if (!supersededIds.has(es.id)) {
163
+ throw new Error(
164
+ `entity ${st.entityId} facet ${st.facet} already has current state ${es.id}; supersede it or use a different facet`
165
+ );
166
+ }
167
+ }
168
+ }
169
+ }
170
+ }
171
+ for (const sid of mutation.supersededStateIds ?? []) {
172
+ const existing = await getMemoryStateVNext(db, ownerId, sid);
173
+ if (!existing) {
174
+ throw new Error(
175
+ `cannot supersede missing memory state: ${sid} (owner ${ownerId})`
176
+ );
177
+ }
178
+ if (existing.retiredAt) {
179
+ throw new Error(
180
+ `cannot supersede already retired memory state: ${sid} (owner ${ownerId})`
181
+ );
182
+ }
183
+ const replacement = (mutation.states ?? []).find(
184
+ (st) => st.entityId === existing.entityId && st.facet === existing.facet
185
+ );
186
+ if (!replacement) {
187
+ throw new Error(
188
+ `superseded state ${sid} (entity ${existing.entityId} facet ${existing.facet}) has no replacement in this mutation`
189
+ );
190
+ }
191
+ }
192
+ for (const rel of mutation.relations ?? []) {
193
+ for (const [side, ref] of [
194
+ ["from", rel.from],
195
+ ["to", rel.to]
196
+ ]) {
197
+ if (pending.entityIds.has(ref) || pending.stateIds.has(ref) || pending.evidenceIds.has(ref)) {
198
+ continue;
199
+ }
200
+ const resolved = await getMemoryEntityVNext(db, ownerId, ref) ?? await getMemoryStateVNext(db, ownerId, ref) ?? await getMemoryEvidenceVNext(db, ownerId, ref);
201
+ if (!resolved) {
202
+ throw new Error(
203
+ `memory relation ${rel.id} references missing ${side} ${ref} (owner ${ownerId})`
204
+ );
205
+ }
206
+ }
207
+ }
208
+ }
209
+ var applyMutationWithoutCoordination = async (db, ownerId, mutation) => {
210
+ await validateMutation(db, ownerId, mutation);
211
+ const completion = mutation.nativeCaptureCompletion;
212
+ if (completion) {
213
+ const prior = await getMemoryEvidenceVNextStrict(db, ownerId, completion.id);
214
+ const withoutOutcome = (ev) => ({
215
+ ...ev,
216
+ nativeCapture: ev.nativeCapture && { ...ev.nativeCapture, outcome: void 0 }
217
+ });
218
+ if (!prior?.nativeCapture || prior.nativeCapture.outcome || completion.ownerId !== ownerId || !["applied", "no_op"].includes(completion.nativeCapture?.outcome ?? "") || completion.nativeCapture?.outcome === "applied" && (["no_op", "ambiguous"].includes(mutation.action) || !mutation.states?.length || mutation.states.some((st) => !st.evidenceIds.includes(completion.id))) || completion.nativeCapture?.outcome === "no_op" && (mutation.action !== "no_op" || !!(mutation.entities?.length || mutation.states?.length || mutation.relations?.length || mutation.evidence?.length || mutation.supersededStateIds?.length)) || JSON.stringify(withoutOutcome(prior)) !== JSON.stringify(withoutOutcome(completion)) || mutation.evidence?.some((ev) => ev.id === completion.id)) {
219
+ throw new Error("invalid native capture completion");
220
+ }
221
+ }
222
+ const batch = db.batch();
223
+ if (completion) _appendEvidenceBatch(batch, completion);
224
+ for (const ev of mutation.evidence ?? []) {
225
+ _appendEvidenceBatch(batch, ev);
226
+ }
227
+ for (const ent of mutation.entities ?? []) {
228
+ _appendEntityBatch(batch, ent);
229
+ }
230
+ for (const st of mutation.states ?? []) {
231
+ _appendStateBatch(batch, st);
232
+ }
233
+ for (const sid of mutation.supersededStateIds ?? []) {
234
+ const existing = await getMemoryStateVNext(db, ownerId, sid);
235
+ if (!existing) {
236
+ throw new Error(
237
+ `cannot supersede missing memory state: ${sid} (owner ${ownerId})`
238
+ );
239
+ }
240
+ const replacement = (mutation.states ?? []).find(
241
+ (st) => st.entityId === existing.entityId && st.facet === existing.facet
242
+ );
243
+ const retired = {
244
+ ...existing,
245
+ retiredAt: replacement?.updatedAt ?? (/* @__PURE__ */ new Date()).toISOString()
246
+ };
247
+ _appendRetiredStateBatch(batch, retired);
248
+ }
249
+ for (const rel of mutation.relations ?? []) {
250
+ _appendRelationBatch(batch, rel);
251
+ }
252
+ await batch.write();
253
+ };
254
+ var pendingByDb = /* @__PURE__ */ new WeakMap();
255
+ var applyMemoryInterpreterMutation = async (db, ownerId, mutation) => {
256
+ let owners = pendingByDb.get(db);
257
+ if (!owners) {
258
+ owners = /* @__PURE__ */ new Map();
259
+ pendingByDb.set(db, owners);
260
+ }
261
+ const previous = owners.get(ownerId) ?? Promise.resolve();
262
+ const operation = previous.then(async () => {
263
+ const resolved = typeof mutation === "function" ? await mutation() : mutation;
264
+ await applyMutationWithoutCoordination(db, ownerId, resolved);
265
+ });
266
+ const settled = operation.then(() => {
267
+ }, () => {
268
+ });
269
+ owners.set(ownerId, settled);
270
+ try {
271
+ await operation;
272
+ } finally {
273
+ if (owners.get(ownerId) === settled) owners.delete(ownerId);
274
+ }
275
+ };
276
+
277
+ export {
278
+ applyMemoryInterpreterMutation
279
+ };