nolo-cli 0.231.0-alpha.1 → 0.240.0-alpha.3

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 (190) hide show
  1. package/{_executeModel-7V3NSK4W.js → _executeModel-5NA4USGG.js} +56 -51
  2. package/{action-GDZDXPMB.js → action-X75O3XPH.js} +7 -4
  3. package/{addContentAction-7RO4AMRI.js → addContentAction-GVC77QSN.js} +9 -8
  4. package/{addDialogAgentAction-EVYBGTXB.js → addDialogAgentAction-KKDVAMW3.js} +12 -11
  5. package/{agentDeleteCommand-MD76OMLN.js → agentDeleteCommand-2RFGKFAB.js} +77 -69
  6. package/{agentEmailCommands-T4TW4IBX.js → agentEmailCommands-GQCQKKOR.js} +84 -72
  7. package/{agentListCommands-4WLG32IW.js → agentListCommands-HSGLDPDQ.js} +40 -47
  8. package/{agentMachineCommands-LSDGA5WR.js → agentMachineCommands-BISF6PVV.js} +26 -22
  9. package/{agentProviderCommands-STI3DQ6A.js → agentProviderCommands-O3Q25PKU.js} +2 -2
  10. package/{agentPullCommand-KHV4EELF.js → agentPullCommand-G6U2LHMW.js} +1 -1
  11. package/{agentRecordCommands-7TEX2B7Y.js → agentRecordCommands-AOXPGYAJ.js} +79 -67
  12. package/{agentRunCommand-23SMDVDW.js → agentRunCommand-AFAIP7U7.js} +85 -72
  13. package/{agentRunControl-MBG4U6SL.js → agentRunControl-VBL7UFSG.js} +1 -1
  14. package/{agentRuntimeLocal-HOXKWCYO.js → agentRuntimeLocal-T7BX2WGL.js} +24 -19
  15. package/{agentSlice-AATYVDP6.js → agentSlice-XJNKE3PG.js} +10 -9
  16. package/{appDeleteCommands-WWCC6WA5.js → appDeleteCommands-LURUSPY7.js} +27 -23
  17. package/{appDeployCommands-AU4IUN33.js → appDeployCommands-SMEW4AK2.js} +27 -23
  18. package/{appDeployStatusCommands-STUW7WXL.js → appDeployStatusCommands-VYPJTBJK.js} +27 -23
  19. package/{appGetCommands-BGTLIQ4K.js → appGetCommands-N4NI5GGJ.js} +27 -23
  20. package/{appListCommands-CUCPRUXW.js → appListCommands-5C6ONN3Z.js} +27 -23
  21. package/{authCommand-3SUYUNQV.js → authCommand-4CVBDADE.js} +15 -13
  22. package/{authCommands-BLE7ETZH.js → authCommands-EHU2BHOX.js} +7 -5
  23. package/{builtinSkillRegistry-BAE2LDXF.js → builtinSkillRegistry-AYWYQVA4.js} +3 -3
  24. package/{chromeOpsCommands-WAA45NCS.js → chromeOpsCommands-CSDG2HYN.js} +1 -1
  25. package/{chunk-HHFGE2WF.js → chunk-2574ANSV.js} +1 -1
  26. package/chunk-2SXN7LAY.js +15 -0
  27. package/{chunk-S6FDXXZV.js → chunk-3EMIEC27.js} +1 -1
  28. package/{chunk-EXNV7CCV.js → chunk-3FBAVU2Y.js} +11 -9
  29. package/{chunk-ZH3KXFHS.js → chunk-4FIO2S7Z.js} +1 -1
  30. package/{chunk-U4FF7LRY.js → chunk-4IQVE43Z.js} +30 -26
  31. package/{chunk-VQ5N5GSV.js → chunk-4Q6HQORG.js} +1 -1
  32. package/{chunk-P2ZLUIW2.js → chunk-4X5AVCM7.js} +94 -4
  33. package/chunk-4ZCTKB27.js +31 -0
  34. package/{chunk-42OKN2LI.js → chunk-5HUO7SEX.js} +9 -107
  35. package/{chunk-QYB23WUH.js → chunk-5QZSEQSK.js} +1 -1
  36. package/{chunk-7JGMNKKG.js → chunk-6CKUO32A.js} +8 -0
  37. package/chunk-6D25V6CB.js +133 -0
  38. package/{chunk-LHN7NIQZ.js → chunk-6WOLPIPY.js} +93 -90
  39. package/{chunk-6QHKRARD.js → chunk-6WZVM33D.js} +9 -4
  40. package/{chunk-NVEYEKN3.js → chunk-7AJRJGSQ.js} +254 -359
  41. package/chunk-7NIBQ4HY.js +138 -0
  42. package/{chunk-7Z6EW7AH.js → chunk-7TTMMOKH.js} +13 -6
  43. package/{chunk-GXZ5LB7H.js → chunk-A3LUWRQK.js} +4 -4
  44. package/{chunk-4ZGPHFLE.js → chunk-A5EVA6HU.js} +2 -2
  45. package/{chunk-57TLKTVZ.js → chunk-A74QP4FI.js} +566 -104
  46. package/{chunk-3ING4D5X.js → chunk-AEQMKYZN.js} +4 -4
  47. package/{chunk-FFSPUVL5.js → chunk-AH5R7BYW.js} +6 -166
  48. package/{chunk-7FEP5USX.js → chunk-ANJRDS6U.js} +3 -3
  49. package/{chunk-YFLVRVYK.js → chunk-AVJDELEA.js} +1 -1
  50. package/{chunk-HYLRQDEE.js → chunk-B5SV4H3J.js} +6 -6
  51. package/{chunk-KUOMUZH6.js → chunk-B7DE5XJW.js} +137 -290
  52. package/chunk-BEM6LPD2.js +734 -0
  53. package/{chunk-DUUDXSLX.js → chunk-BGGAY6OK.js} +27 -3
  54. package/{chunk-YCFP57LH.js → chunk-BGGV6B5O.js} +408 -230
  55. package/{chunk-BP5ZJ6B4.js → chunk-BIABIPGW.js} +1 -1
  56. package/{chunk-TQEKUOTI.js → chunk-BXSMFPTG.js} +4 -4
  57. package/{chunk-RG2DGNL6.js → chunk-CKZPMJNU.js} +3 -3
  58. package/{chunk-WU443D7A.js → chunk-CVJRVBJL.js} +2 -2
  59. package/{chunk-BIWI5M4E.js → chunk-D374I563.js} +1 -1
  60. package/{chunk-QRGDJA4B.js → chunk-DNZ4JJ7C.js} +1 -1
  61. package/chunk-DVYAFH2Q.js +103 -0
  62. package/{chunk-FTMFO6LI.js → chunk-DXW5WDHZ.js} +4 -4
  63. package/{chunk-ZTR65O4L.js → chunk-E5KJOZWY.js} +3 -3
  64. package/{chunk-G7IUT2V3.js → chunk-EBKHA63G.js} +103 -12
  65. package/{chunk-DGYCDA6W.js → chunk-F3XI6WQP.js} +17 -10
  66. package/{chunk-M3OZRQNH.js → chunk-F6YWDVIB.js} +1 -1
  67. package/{chunk-PR2LAQAC.js → chunk-FFYE5ATM.js} +4 -4
  68. package/{chunk-6NNDUDAZ.js → chunk-FZKA3XFA.js} +11 -11
  69. package/{chunk-MNEZUL5S.js → chunk-G22P367E.js} +31 -14
  70. package/{chunk-6OQMSPB7.js → chunk-GDUC4VS2.js} +7 -7
  71. package/{chunk-R6Z5S5GA.js → chunk-GXXY2NL3.js} +16 -14
  72. package/{chunk-U2HBB7RS.js → chunk-H7ZYKHAZ.js} +27 -7
  73. package/{chunk-3U44JB3O.js → chunk-HCNOO374.js} +1 -1
  74. package/{chunk-HSSBDZLD.js → chunk-HOM6LTEW.js} +1 -1
  75. package/{chunk-S2NTVGA2.js → chunk-I2OYPD3Y.js} +1 -1
  76. package/{chunk-TPG2DPN2.js → chunk-IJTXNLQE.js} +9 -9
  77. package/{chunk-ALAES342.js → chunk-IUMS6F53.js} +2 -2
  78. package/{chunk-547ENH5T.js → chunk-IUTUWIKE.js} +2 -2
  79. package/{chunk-S6K5F3KP.js → chunk-JBWXPACD.js} +1 -1
  80. package/{chunk-XAG3FWBE.js → chunk-KZPEGO6D.js} +1 -1
  81. package/{chunk-RBPUNSG5.js → chunk-LYDEFPQP.js} +18 -108
  82. package/{chunk-OWKNSIXL.js → chunk-MECDGHLK.js} +271 -66
  83. package/{chunk-FJSNBZXR.js → chunk-MM73SP4K.js} +1 -1
  84. package/{chunk-XSW4EXQV.js → chunk-MYOSN6BT.js} +2 -2
  85. package/{chunk-ZEVQHCLM.js → chunk-MYPKBJJO.js} +2 -2
  86. package/{chunk-DBUR22G5.js → chunk-N2JROHD3.js} +4 -4
  87. package/{chunk-ATEKLSLR.js → chunk-O6IPRAVV.js} +14 -9
  88. package/{chunk-PPJYZRSQ.js → chunk-OX6GNNVT.js} +6 -1
  89. package/{chunk-WFVASLQT.js → chunk-P3IZUMIC.js} +1 -1
  90. package/{chunk-FPBJM2BW.js → chunk-PGKA77TZ.js} +26 -20
  91. package/{chunk-IONGMVPY.js → chunk-PRMEU7BT.js} +229 -7
  92. package/{chunk-OJ45MEEI.js → chunk-PROOOQZ3.js} +1 -1
  93. package/{chunk-4I2MXV5Q.js → chunk-PVFYPUIM.js} +2 -0
  94. package/{chunk-5FUN7EG4.js → chunk-RD3QLZQV.js} +83 -47
  95. package/chunk-RETQOQ4D.js +33394 -0
  96. package/{chunk-CMMI3DAT.js → chunk-RM4UMFY4.js} +33 -26
  97. package/{chunk-262R3XNN.js → chunk-S2MHR4PU.js} +151 -5
  98. package/{chunk-DEA37IUY.js → chunk-T6VROBY7.js} +2 -2
  99. package/{chunk-M4SFKP5L.js → chunk-TEMLHVGX.js} +1 -1
  100. package/{chunk-3QIYD3VM.js → chunk-TRHJ4NJB.js} +61 -792
  101. package/{chunk-OBIC6EG7.js → chunk-TWTJV35S.js} +1 -1
  102. package/{chunk-TCZ2VJZQ.js → chunk-U3G7RRXJ.js} +5 -5
  103. package/{chunk-F6Z6ZCUV.js → chunk-UFC4J7OY.js} +3 -3
  104. package/{chunk-5YMA6DDZ.js → chunk-UHW6SCVK.js} +1 -1
  105. package/{chunk-4N6G2CKP.js → chunk-ULLHVDTZ.js} +46 -1
  106. package/{chunk-XFXFPUO7.js → chunk-VM72HKW2.js} +7 -7
  107. package/{chunk-MHHLABT3.js → chunk-VREG6ANQ.js} +102 -99
  108. package/chunk-VSRISJXZ.js +107 -0
  109. package/chunk-WDWZPASX.js +29 -0
  110. package/{chunk-ILHQ2AXT.js → chunk-WRKMXMU7.js} +2 -0
  111. package/chunk-X7IA2B7R.js +166 -0
  112. package/{chunk-5ZMIIR23.js → chunk-XBAEM4RI.js} +7 -0
  113. package/{chunk-4JVNURX4.js → chunk-XS5A3EKX.js} +1 -23
  114. package/{chunk-N5Z2V73W.js → chunk-Y2MF4DCJ.js} +1 -1
  115. package/{chunk-KUDCKVYQ.js → chunk-Y5OWZQMJ.js} +28 -19
  116. package/{chunk-TI2EPRHE.js → chunk-YGCOJNFZ.js} +3 -3
  117. package/{chunk-JQZRSXS5.js → chunk-YGDYYFRX.js} +9 -13
  118. package/{chunk-X7QAIY5B.js → chunk-Z2WZAE4P.js} +128 -150
  119. package/chunk-Z6YTCDU4.js +24 -0
  120. package/{chunk-RRDRQOEC.js → chunk-ZEKUFJLW.js} +81 -66
  121. package/{chunk-EVGU5P4U.js → chunk-ZVOL2MAJ.js} +1 -1
  122. package/{cliAgentConfigHelpers-BTRHMPW2.js → cliAgentConfigHelpers-U5OAVAKQ.js} +2 -2
  123. package/{cliAuthorityBrokerClient-XHH7MH2P.js → cliAuthorityBrokerClient-S42VMGB6.js} +1 -1
  124. package/{cliLocalAgentRecordReader-H3HYQRRR.js → cliLocalAgentRecordReader-HVZAQCUD.js} +29 -25
  125. package/{commandRegistry-35EMLPIZ.js → commandRegistry-TME7INFU.js} +89 -85
  126. package/{contentThunks-BCNMGA5J.js → contentThunks-U6OC4R2N.js} +23 -22
  127. package/{cooldownCommands-YB5H5BBK.js → cooldownCommands-U7XSRVJP.js} +1 -1
  128. package/{createAgentAutomationAction-HEU4KOYF.js → createAgentAutomationAction-IP4LFN3W.js} +23 -22
  129. package/{createDialogAction-5DSL5ESZ.js → createDialogAction-IAGQJ3LH.js} +24 -23
  130. package/{createPageAction-BBZ25AFI.js → createPageAction-AZ3UIFKA.js} +24 -23
  131. package/{dbSlice-XRUZOGSU.js → dbSlice-DKKMJJYY.js} +8 -7
  132. package/{deleteFile-6URDHYRB.js → deleteFile-TQSONMVU.js} +7 -4
  133. package/{dialogCommands-6SZD4TYP.js → dialogCommands-PCDRMBWG.js} +30 -26
  134. package/dialogMessageRecord-OAV77LT7.js +7 -0
  135. package/{dialogNotifyCommand-SHGPCU22.js → dialogNotifyCommand-O35MWMOS.js} +3 -3
  136. package/{dialogSlice-QJ5PQOM3.js → dialogSlice-QAKYN4DE.js} +22 -21
  137. package/{dialogUsageCommand-W2WCSGKF.js → dialogUsageCommand-2SSLTXKO.js} +2 -2
  138. package/{docCreateCommands-25E6PGN3.js → docCreateCommands-CFQFZOAD.js} +26 -22
  139. package/{docDeleteCommands-F7ZVGEHW.js → docDeleteCommands-5CPNTIIS.js} +27 -23
  140. package/{docReadCommands-JY2E5XEN.js → docReadCommands-XQILYSAJ.js} +26 -22
  141. package/{docStore-XJ4UMU3C.js → docStore-GIVRT7TQ.js} +10 -9
  142. package/{docUpdateCommands-OZ4CUSIQ.js → docUpdateCommands-VETKSUDD.js} +26 -22
  143. package/{handleSendMessageAction-YHAOXARI.js → handleSendMessageAction-HKIW4ZNO.js} +48 -45
  144. package/{hostCredentialCreate-62AWCBQC.js → hostCredentialCreate-6VDJFNDO.js} +81 -68
  145. package/index.js +8 -8
  146. package/{lib-OT5OTXRU.js → lib-62SWPXNF.js} +3 -7
  147. package/{localRuntimeAdapter-KNQNNHUM.js → localRuntimeAdapter-BQ4F5PZV.js} +81 -69
  148. package/{localRuntimeAuthority-IBJAT62G.js → localRuntimeAuthority-WCNA4A3G.js} +4 -2
  149. package/{localRuntimeDb-N7KHDXS2.js → localRuntimeDb-CRNIBOOM.js} +1 -1
  150. package/{machineCommands-X2FMPSV4.js → machineCommands-K6XIGOAD.js} +77 -65
  151. package/{machineWsRunDispatch-XHTPOYVJ.js → machineWsRunDispatch-4OO7Z6UM.js} +77 -65
  152. package/mcpLocalAuthorizeCommand-ZP6ESAGE.js +106 -0
  153. package/{memberThunks-7Y3OYSJQ.js → memberThunks-PBJPZ2JU.js} +15 -10
  154. package/{overlay-BBQZXGYI.js → overlay-JA3SPVUS.js} +5 -3
  155. package/package.json +1 -1
  156. package/{projectArchive-NPQ3YOAV.js → projectArchive-G7AOQPRW.js} +24 -23
  157. package/{providerPresetApply-WHAMP2D5.js → providerPresetApply-OPBCAONX.js} +1 -1
  158. package/{providerRegistry-ZI2KORJ7.js → providerRegistry-J2HCVTHE.js} +1 -1
  159. package/{read-TYMBGEXO.js → read-JEGPITEW.js} +6 -5
  160. package/{readDocTool-SKQVHBLO.js → readDocTool-TE3XIU4Y.js} +1 -1
  161. package/{readlineWorkspace-77PILYDH.js → readlineWorkspace-SOW5QUGZ.js} +2935 -2376
  162. package/{removeDialogAgentAction-F5QE2O2B.js → removeDialogAgentAction-CX3OAH4Y.js} +14 -13
  163. package/{runAgentClientLoop-XNKAXUKU.js → runAgentClientLoop-HQJPDFGQ.js} +65 -45
  164. package/{runtimeDoctorCommands-RRKPBGVO.js → runtimeDoctorCommands-GUH2YGMH.js} +3 -3
  165. package/{secretCommands-KZWBZIYS.js → secretCommands-NJXFVHZU.js} +2 -2
  166. package/{setDialogExtraReferencesAction-72L27ERM.js → setDialogExtraReferencesAction-CGM67EEQ.js} +11 -10
  167. package/{setPrimaryDialogAgentAction-GJJDUSGJ.js → setPrimaryDialogAgentAction-3ABWPPXR.js} +14 -13
  168. package/{settingThunks-ZRGWVGZD.js → settingThunks-AY76OHYX.js} +176 -57
  169. package/{skillDiscovery-BHHPCUHZ.js → skillDiscovery-MDDKPTW3.js} +4 -3
  170. package/{spaceCommands-TOGSGCPS.js → spaceCommands-G63QGYQO.js} +25 -21
  171. package/{streamAgentChatTurn-IARUEZPU.js → streamAgentChatTurn-E3XH2KFD.js} +127 -85
  172. package/{switchDialogAgentAction-IIJBPND3.js → switchDialogAgentAction-G6EZRKCQ.js} +12 -11
  173. package/{tableCommands-FTAOCBTX.js → tableCommands-JI75ZHDI.js} +4 -1
  174. package/{toolApiClient-OGQEBQVX.js → toolApiClient-62UUPDUA.js} +3 -5
  175. package/{tools-5UWS65PB.js → tools-7RSX22FT.js} +41 -37
  176. package/{tuiRestart-2IL37YIB.js → tuiRestart-KAAA7TND.js} +2 -2
  177. package/{tuiSummaryLlmCaller-R4H3ZZ52.js → tuiSummaryLlmCaller-BVNHMWLR.js} +5 -5
  178. package/{updateCommands-CPATDG6J.js → updateCommands-ASK5XYPH.js} +3 -3
  179. package/{updateDialogTitleAction-G6C6XVNV.js → updateDialogTitleAction-SEWV252V.js} +23 -22
  180. package/{usageCommand-2BF74MKF.js → usageCommand-JVT5J3DC.js} +2 -2
  181. package/{usageRebuildCommand-UHB55BQM.js → usageRebuildCommand-IZYYUTEW.js} +3 -3
  182. package/webapi-24RZDIIQ.js +2488 -0
  183. package/{windowsSelfUpdate-ZFD6J5HF.js → windowsSelfUpdate-BSDIS2J5.js} +2 -2
  184. package/workContext-MM3P5GP5.js +13 -0
  185. package/workContextAccess-UZHDLBUR.js +11 -0
  186. package/workContextWriteNotice-YCSSMHN4.js +7 -0
  187. package/chunk-ZXF6D3I6.js +0 -359
  188. package/{accountResolver-QETKNC7T.js → accountResolver-EK2S4PWF.js} +3 -3
  189. package/{localDialogRead-CCOCVGAP.js → localDialogRead-AV2VKKPG.js} +0 -0
  190. package/{workloadLifecycle-HFJIN5IZ.js → workloadLifecycle-YIZ7KLUP.js} +5 -5
@@ -5,7 +5,7 @@ import {
5
5
  ANTIGRAVITY_CLOUD_CODE_BASE_URL,
6
6
  isAntigravityCloudCodeBaseUrl,
7
7
  isAntigravityOAuthAgent
8
- } from "./chunk-7JGMNKKG.js";
8
+ } from "./chunk-6CKUO32A.js";
9
9
  import {
10
10
  isOpenAiResponsesModel,
11
11
  resolvePlatformChatCompletionsEndpoint,
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  applyPublicAgentCatalogOverride
3
- } from "./chunk-DBUR22G5.js";
3
+ } from "./chunk-N2JROHD3.js";
4
4
  import {
5
5
  applyBuiltinAgentRuntimeOverride,
6
6
  resolveBuiltinPlatformAgentConfig
7
- } from "./chunk-S6K5F3KP.js";
7
+ } from "./chunk-JBWXPACD.js";
8
8
  import {
9
9
  buildLocalAgentLookupKeys
10
- } from "./chunk-OJ45MEEI.js";
10
+ } from "./chunk-PROOOQZ3.js";
11
11
  import {
12
12
  LOCAL_CODEX_AGENT_ID,
13
13
  LOCAL_CODEX_AGENT_KEY
@@ -15,10 +15,10 @@ import {
15
15
  import {
16
16
  localDialogMessageRecordToRuntimeMessage,
17
17
  orderDialogHistory
18
- } from "./chunk-3QIYD3VM.js";
18
+ } from "./chunk-TRHJ4NJB.js";
19
19
  import {
20
20
  resolveAgentRuntimeConfigFromRecord
21
- } from "./chunk-XAG3FWBE.js";
21
+ } from "./chunk-KZPEGO6D.js";
22
22
  import {
23
23
  dialogMessagePrefix,
24
24
  dialogMessageRange
@@ -36,7 +36,7 @@ import {
36
36
  } from "./chunk-YNIYE47Z.js";
37
37
  import {
38
38
  getDefaultCliLocalRuntimeDb
39
- } from "./chunk-N5Z2V73W.js";
39
+ } from "./chunk-Y2MF4DCJ.js";
40
40
  import {
41
41
  createTokenStatsKey
42
42
  } from "./chunk-SYTHYBMI.js";
@@ -11658,7 +11658,7 @@ async function runUsageCommand(args, deps) {
11658
11658
  const output = deps.output ?? process.stdout;
11659
11659
  const errorOutput = deps.errorOutput ?? process.stderr;
11660
11660
  if (args[0] === "rebuild") {
11661
- const { runUsageRebuildCommand } = await import("./usageRebuildCommand-UHB55BQM.js");
11661
+ const { runUsageRebuildCommand } = await import("./usageRebuildCommand-IZYYUTEW.js");
11662
11662
  return runUsageRebuildCommand(args.slice(1), deps);
11663
11663
  }
11664
11664
  if (hasFlag(args, "-h") || hasFlag(args, "--help")) {
@@ -11729,7 +11729,7 @@ async function runUsageCommand(args, deps) {
11729
11729
  return 0;
11730
11730
  }
11731
11731
  async function resolveUsageUserId(env) {
11732
- const { resolveLocalUserId } = await import("./cliAgentConfigHelpers-BTRHMPW2.js");
11732
+ const { resolveLocalUserId } = await import("./cliAgentConfigHelpers-U5OAVAKQ.js");
11733
11733
  return resolveLocalUserId(env);
11734
11734
  }
11735
11735
  function isLocalDbMissingError(error) {
@@ -5,7 +5,7 @@ import {
5
5
  mapDiscoveredSkillsToCatalogEntries,
6
6
  resolveSkillCatalog,
7
7
  resolveSkillCatalogSync
8
- } from "./chunk-42OKN2LI.js";
8
+ } from "./chunk-5HUO7SEX.js";
9
9
  import {
10
10
  load
11
11
  } from "./chunk-KHCLMKZZ.js";
@@ -1,3 +1,6 @@
1
+ import {
2
+ gBase64
3
+ } from "./chunk-X7IA2B7R.js";
1
4
  import {
2
5
  createClientLogger
3
6
  } from "./chunk-QQ56R7KS.js";
@@ -7,6 +10,9 @@ import {
7
10
  import {
8
11
  isLevelNotFoundError
9
12
  } from "./chunk-OW765XBU.js";
13
+ import {
14
+ isPublicBuiltinPlatformAgentKey
15
+ } from "./chunk-WRKMXMU7.js";
10
16
  import {
11
17
  API_ENDPOINTS,
12
18
  NOLO_CLUSTER_SERVERS,
@@ -18,6 +24,39 @@ import {
18
24
  normalizeServerOrigin
19
25
  } from "./chunk-CF7PE763.js";
20
26
 
27
+ // packages/core/googleSessionScope.ts
28
+ function isGoogleAuthoritySession(token) {
29
+ if (typeof token !== "string") return false;
30
+ try {
31
+ return JSON.parse(gBase64.decode(token.split(".")[0])).authKind === "google-session-v1";
32
+ } catch {
33
+ return false;
34
+ }
35
+ }
36
+ function googleSessionServer(token, configuredServer) {
37
+ if (!isGoogleAuthoritySession(token)) return void 0;
38
+ const origin = typeof window !== "undefined" ? window.location?.origin : void 0;
39
+ if (typeof origin !== "string" || !/^https?:\/\//.test(origin)) return "";
40
+ return normalizeServerOrigin(origin);
41
+ }
42
+ function scopeGoogleSessionServers(token, configuredServer, servers) {
43
+ const server = googleSessionServer(token, configuredServer);
44
+ return server === void 0 ? servers : server ? [server] : [];
45
+ }
46
+ function googleSessionRequestToken(token, target, allowAnonymousPublic = false) {
47
+ if (!isGoogleAuthoritySession(token)) return token;
48
+ const authority = googleSessionServer(token);
49
+ let origin;
50
+ try {
51
+ origin = new URL(target).origin;
52
+ } catch {
53
+ throw new Error("google_session_origin_blocked");
54
+ }
55
+ if (authority && origin === authority) return token;
56
+ if (allowAnonymousPublic) return void 0;
57
+ throw new Error("google_session_origin_blocked");
58
+ }
59
+
21
60
  // packages/app/utils/env.ts
22
61
  var processEnv = typeof process !== "undefined" ? process.env : void 0;
23
62
  var reactNativeDev = typeof globalThis !== "undefined" && "__DEV__" in globalThis ? globalThis.__DEV__ : void 0;
@@ -124,6 +163,7 @@ var createReadTimeoutError = (server, dbKey) => {
124
163
  };
125
164
  var isReadTimeoutError = (error) => error instanceof Error && error.name === READ_TIMEOUT_ERROR_NAME;
126
165
  var fetchFromServer = async (server, dbKey, token, signal) => {
166
+ const requestToken = googleSessionRequestToken(token, server, isPublicBuiltinPlatformAgentKey(dbKey));
127
167
  if (signal?.aborted) {
128
168
  throw new DOMException("Aborted", "AbortError");
129
169
  }
@@ -140,9 +180,10 @@ var fetchFromServer = async (server, dbKey, token, signal) => {
140
180
  `${server}${buildReadUrl(dbKey)}`,
141
181
  {
142
182
  signal: controller.signal,
183
+ ...isGoogleAuthoritySession(token) || !token ? { credentials: "omit", redirect: "error" } : {},
143
184
  headers: {
144
185
  "Content-Type": "application/json",
145
- ...token && { Authorization: `Bearer ${token}` }
186
+ ...requestToken && { Authorization: `Bearer ${requestToken}` }
146
187
  }
147
188
  }
148
189
  );
@@ -173,6 +214,10 @@ var normalizeTimeFields = (data) => ({
173
214
  });
174
215
 
175
216
  export {
217
+ isGoogleAuthoritySession,
218
+ googleSessionServer,
219
+ scopeGoogleSessionServers,
220
+ googleSessionRequestToken,
176
221
  isDevelopment,
177
222
  getIsDesktopApp,
178
223
  logger,
@@ -7,7 +7,7 @@ import {
7
7
  listUserRecordsFromServers,
8
8
  readDbRecordFromServers,
9
9
  readLiveDbRecordAfterTombstoneMerge
10
- } from "./chunk-M3OZRQNH.js";
10
+ } from "./chunk-F6YWDVIB.js";
11
11
  import {
12
12
  parsePositiveFiniteNumberOrFallback
13
13
  } from "./chunk-Y5GCAMGP.js";
@@ -25,7 +25,7 @@ import {
25
25
  } from "./chunk-QQ56R7KS.js";
26
26
  import {
27
27
  getDefaultCliLocalRuntimeDb
28
- } from "./chunk-P2ZLUIW2.js";
28
+ } from "./chunk-4X5AVCM7.js";
29
29
  import {
30
30
  isLevelLockError
31
31
  } from "./chunk-ZYKJBRZ3.js";
@@ -36,12 +36,12 @@ import {
36
36
  } from "./chunk-GLKOYSRU.js";
37
37
  import {
38
38
  resolveRunsDir
39
- } from "./chunk-OWKNSIXL.js";
39
+ } from "./chunk-MECDGHLK.js";
40
40
  import {
41
41
  boundSummaryText,
42
42
  buildDialogReadEnvelope,
43
43
  projectDialogReadForAgent
44
- } from "./chunk-MNEZUL5S.js";
44
+ } from "./chunk-G22P367E.js";
45
45
  import {
46
46
  asRecordOrEmpty
47
47
  } from "./chunk-KX6YBIHG.js";
@@ -68,7 +68,7 @@ import {
68
68
  } from "./chunk-BIDSIRTS.js";
69
69
  import {
70
70
  t
71
- } from "./chunk-262R3XNN.js";
71
+ } from "./chunk-S2MHR4PU.js";
72
72
  import {
73
73
  toErrorMessage
74
74
  } from "./chunk-HNMXYYJR.js";
@@ -851,7 +851,7 @@ function isExplicitDialogIdMismatch(meta, dialogId) {
851
851
  return meta && typeof meta === "object" && "id" in meta && meta.id != null && String(meta.id) !== dialogId;
852
852
  }
853
853
  async function readDialogFromLocalDb(dialogKey, dialogId, limit, readLocalDialog) {
854
- const reader = readLocalDialog ?? (await import("./localDialogRead-CCOCVGAP.js")).readDialogFromLocalDb;
854
+ const reader = readLocalDialog ?? (await import("./localDialogRead-AV2VKKPG.js")).readDialogFromLocalDb;
855
855
  const result = await reader({ dialogKey, dialogId, limit });
856
856
  return {
857
857
  ...result,
@@ -866,7 +866,7 @@ async function readLocalDialogAtDbPathDefault(args) {
866
866
  );
867
867
  }
868
868
  const db = await getDefaultCliLocalRuntimeDb();
869
- const { readDialogFromLocalDb: reader } = await import("./localDialogRead-CCOCVGAP.js");
869
+ const { readDialogFromLocalDb: reader } = await import("./localDialogRead-AV2VKKPG.js");
870
870
  return reader({ ...args, db });
871
871
  }
872
872
  async function readDialogFromLocalDbWithFallback(args) {
@@ -1,57 +1,47 @@
1
- import {
2
- DEFAULT_AUTO_APPROVED_SELF_UPDATE_FIELDS,
3
- DEFAULT_USER_PREFERENCE_PROFILE,
4
- normalizeAgentUpdateFieldList,
5
- normalizePolicyLevelSetting,
6
- normalizeSystemBuiltinSkills,
7
- normalizeTonePresetSetting,
8
- resolveUserEnabledSkills
9
- } from "./chunk-RBPUNSG5.js";
10
1
  import {
11
2
  setDialogExtraReferencesAction
12
- } from "./chunk-HYLRQDEE.js";
3
+ } from "./chunk-B5SV4H3J.js";
13
4
  import {
14
5
  isSkillSummaryMarker
15
6
  } from "./chunk-VF4K2QE6.js";
16
7
  import {
17
8
  fetchAndCacheTableRows
18
- } from "./chunk-6NNDUDAZ.js";
9
+ } from "./chunk-FZKA3XFA.js";
19
10
  import {
20
- getActiveDialogKey
21
- } from "./chunk-S2NTVGA2.js";
11
+ resolveDialogRuntimeAgentKey
12
+ } from "./chunk-B7DE5XJW.js";
22
13
  import {
23
14
  require_react
24
- } from "./chunk-5FUN7EG4.js";
15
+ } from "./chunk-RD3QLZQV.js";
25
16
  import {
26
17
  createSpaceKey
27
18
  } from "./chunk-UAD2WT54.js";
28
19
  import {
29
20
  selectById
30
- } from "./chunk-CMMI3DAT.js";
21
+ } from "./chunk-RM4UMFY4.js";
31
22
  import {
32
23
  selectRuntimeSnapshot
33
- } from "./chunk-R6Z5S5GA.js";
24
+ } from "./chunk-GXXY2NL3.js";
34
25
  import {
35
- createAsyncThunk,
36
- createSelector
37
- } from "./chunk-7Z6EW7AH.js";
26
+ createAsyncThunk
27
+ } from "./chunk-7TTMMOKH.js";
38
28
  import {
39
29
  selectIdentityUserId
40
30
  } from "./chunk-PXYBUFDB.js";
41
31
  import {
42
32
  isAgentSkillDisabled
43
- } from "./chunk-FJSNBZXR.js";
33
+ } from "./chunk-MM73SP4K.js";
44
34
  import {
45
- DEFAULT_SYSTEM_AGENT_CAPABILITIES,
46
35
  listBuiltinSkills,
47
36
  resolveBuiltinSkillByName
48
- } from "./chunk-G7IUT2V3.js";
37
+ } from "./chunk-EBKHA63G.js";
49
38
  import {
50
39
  parseSkillDocProtocol
51
40
  } from "./chunk-W6RFEDN4.js";
52
41
  import {
53
- asTrimmedNonEmptyStringArray
54
- } from "./chunk-I42VC5KR.js";
42
+ isDialogRecordKeyForId,
43
+ parseDialogKey
44
+ } from "./chunk-OJKUU3LP.js";
55
45
  import {
56
46
  toErrorMessage
57
47
  } from "./chunk-HNMXYYJR.js";
@@ -150,46 +140,73 @@ function waitForAbortableDelay(ms, signal) {
150
140
  });
151
141
  }
152
142
 
153
- // packages/app/settings/fieldSelectors.ts
154
- var selectMaxExecutionTime = (state) => state.settings.maxExecutionTime;
155
- var selectGlobalPrompt = (state) => state.settings.globalPrompt;
156
- var selectEnabledSkills = createSelector(
157
- [
158
- (state) => Boolean(
159
- state.settings && Object.prototype.hasOwnProperty.call(state.settings, "enabledSkills")
160
- ),
161
- (state) => state.settings?.enabledSkills,
162
- (state) => state.settings?.enabledPromptSkills
163
- ],
164
- (hasOwnEnabledSkills, enabledSkills, enabledPromptSkills) => {
165
- const preferences = hasOwnEnabledSkills ? { enabledSkills, enabledPromptSkills } : { enabledPromptSkills };
166
- return resolveUserEnabledSkills(preferences);
143
+ // packages/ai/tools/memoryToolContext.ts
144
+ var trimmed = (value) => typeof value === "string" && value.trim() ? value.trim() : void 0;
145
+ function findLoadedDialogs(state, dialogId, exactKey) {
146
+ const entities = state?.db?.entities;
147
+ if (!entities || typeof entities !== "object") return [];
148
+ const matches = [];
149
+ for (const key of Object.keys(entities)) {
150
+ if (!isDialogRecordKeyForId(key, dialogId)) continue;
151
+ const record = entities[key];
152
+ if (!record || trimmed(record.id) !== dialogId) continue;
153
+ if (exactKey && key !== exactKey) continue;
154
+ matches.push({ key, record });
167
155
  }
168
- );
169
- var selectUserTonePreset = (state) => normalizeTonePresetSetting(state.settings.userTonePreset);
170
- var selectKnowledgeCaptureLevel = (state) => normalizePolicyLevelSetting(
171
- state.settings.knowledgeCaptureLevel,
172
- DEFAULT_USER_PREFERENCE_PROFILE.knowledgeCaptureLevel
173
- );
174
- var selectSpaceContextLevel = (state) => state.settings.enableReadCurrentSpace === false ? 1 : normalizePolicyLevelSetting(
175
- state.settings.spaceContextLevel,
176
- DEFAULT_USER_PREFERENCE_PROFILE.spaceContextLevel
177
- );
178
- var selectAutoApproveSelfUpdateFields = createSelector(
179
- [(state) => state.settings.autoApproveSelfUpdateFields],
180
- (fields) => normalizeAgentUpdateFieldList(
181
- fields,
182
- DEFAULT_AUTO_APPROVED_SELF_UPDATE_FIELDS
183
- )
184
- );
185
- var selectAiRecentContentLimit = (state) => state.settings.aiRecentContentLimit ?? 50;
186
- var selectSystemBuiltinSkills = createSelector(
187
- [(state) => state.settings.systemBuiltinSkills],
188
- (systemBuiltinSkills) => normalizeSystemBuiltinSkills(
189
- systemBuiltinSkills,
190
- DEFAULT_SYSTEM_AGENT_CAPABILITIES
191
- )
192
- );
156
+ return matches;
157
+ }
158
+ function resolveMemoryToolContext(state, context) {
159
+ return resolveToolAttributionContext(state, context);
160
+ }
161
+ function resolveToolAttributionContext(state, context, options) {
162
+ const UNRESOLVED = options?.errorLabel ?? "\u65E0\u6CD5\u786E\u5B9A\u8BB0\u5FC6\u5F52\u5C5E";
163
+ const agentKey = trimmed(context?.agentKey);
164
+ if (options?.requireAgentKey && !agentKey) {
165
+ throw new Error(`${UNRESOLVED}\uFF1A\u6267\u884C\u4E0A\u4E0B\u6587\u7F3A\u5C11 agentKey\uFF0C\u4E0D\u4F1A\u4ECE\u5F53\u524D\u5BF9\u8BDD\u63A8\u65AD\u3002`);
166
+ }
167
+ const contextDialogId = trimmed(context?.dialogId);
168
+ const contextDialogKey = trimmed(context?.dialogKey);
169
+ let keyIdentity = null;
170
+ if (contextDialogKey) {
171
+ keyIdentity = parseDialogKey(contextDialogKey);
172
+ if (!keyIdentity) {
173
+ throw new Error(
174
+ `${UNRESOLVED}\uFF1A\u6267\u884C\u4E0A\u4E0B\u6587\u91CC\u7684\u5BF9\u8BDD\u952E ${contextDialogKey} \u4E0D\u662F\u53EF\u89E3\u6790\u7684 dialog-<owner>-<id>\uFF0C\u4E0D\u4F1A\u6309 id \u731C\u5F52\u5C5E\u3002`
175
+ );
176
+ }
177
+ if (contextDialogId && keyIdentity.dialogId !== contextDialogId) {
178
+ throw new Error(
179
+ `${UNRESOLVED}\uFF1A\u6267\u884C\u4E0A\u4E0B\u6587\u81EA\u76F8\u77DB\u76FE\u2014\u2014\u5BF9\u8BDD\u952E ${contextDialogKey} \u6307\u5411 ${keyIdentity.dialogId}\uFF0C\u4F46 dialogId \u662F ${contextDialogId}\u3002`
180
+ );
181
+ }
182
+ }
183
+ const dialogId = keyIdentity?.dialogId ?? contextDialogId;
184
+ if (!dialogId) {
185
+ throw new Error(
186
+ `${UNRESOLVED}\uFF1A\u672C\u6B21\u5DE5\u5177\u8C03\u7528\u7F3A\u5C11\u6240\u5C5E\u5BF9\u8BDD\uFF08dialogId\uFF09\uFF0C\u4E0D\u4F1A\u6539\u7528\u5F53\u524D\u6253\u5F00\u7684\u5BF9\u8BDD\u6216\u89C6\u56FE Space\u3002`
187
+ );
188
+ }
189
+ const matches = findLoadedDialogs(state, dialogId, contextDialogKey);
190
+ if (matches.length === 0) {
191
+ throw new Error(
192
+ `${UNRESOLVED}\uFF1A\u5BF9\u8BDD ${dialogId} \u672A\u52A0\u8F7D\uFF0C\u65E0\u6CD5\u786E\u8BA4\u5B83\u7684 Space \u5F52\u5C5E\u3002`
193
+ );
194
+ }
195
+ if (matches.length > 1) {
196
+ throw new Error(
197
+ `${UNRESOLVED}\uFF1A\u52A0\u8F7D\u4E2D\u6709 ${matches.length} \u4E2A\u540C id \u7684\u5BF9\u8BDD\uFF08${matches.map((m) => m.key).join(" / ")}\uFF09\uFF0C\u4EC5\u51ED dialogId \u65E0\u6CD5\u786E\u5B9A\u5F52\u5C5E\uFF1B\u6267\u884C\u4E0A\u4E0B\u6587\u9700\u8981\u63D0\u4F9B\u5B8C\u6574\u5BF9\u8BDD\u952E\u3002`
198
+ );
199
+ }
200
+ const [dialog] = matches;
201
+ return {
202
+ dialogId,
203
+ agentKey: resolveDialogRuntimeAgentKey(
204
+ dialog.record,
205
+ agentKey
206
+ ),
207
+ spaceId: trimmed(dialog.record.spaceId)
208
+ };
209
+ }
193
210
 
194
211
  // packages/ai/tools/loadSkillTool.ts
195
212
  var loadSkillFunctionSchema = {
@@ -323,23 +340,7 @@ async function listSkillCandidates(thunkApi) {
323
340
  }
324
341
  return candidates;
325
342
  }
326
- var resolveCurrentAgentKeyForSkillGate = (thunkApi) => {
327
- try {
328
- const state = thunkApi?.getState?.();
329
- if (!state) return null;
330
- const currentDialogKey = getActiveDialogKey();
331
- if (!currentDialogKey) return null;
332
- const dialogConfig = selectById(
333
- state,
334
- currentDialogKey
335
- );
336
- return asTrimmedNonEmptyStringArray(dialogConfig?.cybots)[0] ?? null;
337
- } catch {
338
- return null;
339
- }
340
- };
341
- var readCurrentAgentSkillSource = async (thunkApi) => {
342
- const agentKey = resolveCurrentAgentKeyForSkillGate(thunkApi);
343
+ var readCurrentAgentSkillSource = async (thunkApi, agentKey) => {
343
344
  if (!agentKey) return null;
344
345
  const db = thunkApi?.extra?.db;
345
346
  if (!db) return null;
@@ -364,6 +365,14 @@ async function loadSkillFunc(args, thunkApi, context) {
364
365
  }
365
366
  let requestedName = asTrimmedString(exact ? source === "space" ? args.dbKey : args.slug : args?.name);
366
367
  if (!requestedName) throw new Error("loadSkill \u9700\u8981\u63D0\u4F9B name\u3002");
368
+ const state = thunkApi.getState();
369
+ const attribution = resolveToolAttributionContext(state, context, {
370
+ requireAgentKey: false,
371
+ errorLabel: "loadSkill: \u65E0\u6CD5\u786E\u5B9A\u5F52\u5C5E"
372
+ });
373
+ const dialogKey = context?.dialogKey?.trim() || Object.keys(state.db.entities).find(
374
+ (key) => isDialogRecordKeyForId(key, attribution.dialogId) && state.db.entities[key]?.id?.trim() === attribution.dialogId
375
+ );
367
376
  const candidates = await listSkillCandidates(thunkApi);
368
377
  let resolution;
369
378
  if (!exact) {
@@ -380,7 +389,7 @@ async function loadSkillFunc(args, thunkApi, context) {
380
389
  const builtinEntry = resolution?.kind === "builtin" ? resolution.entry : null;
381
390
  const resolvedSlug = builtinEntry?.slug ?? matched?.skillId ?? null;
382
391
  if (resolvedSlug) {
383
- const agentSkillSource = await readCurrentAgentSkillSource(thunkApi);
392
+ const agentSkillSource = await readCurrentAgentSkillSource(thunkApi, attribution.agentKey);
384
393
  if (agentSkillSource && isAgentSkillDisabled(agentSkillSource, resolvedSlug)) {
385
394
  return {
386
395
  rawData: {
@@ -397,7 +406,7 @@ async function loadSkillFunc(args, thunkApi, context) {
397
406
  const body2 = builtinEntry.content;
398
407
  const dbKey = builtinEntry.slug;
399
408
  if (context?.skipSkillReferencePersist !== true) {
400
- await persistLoadedSkillReference(thunkApi, dbKey, requestedName);
409
+ await persistLoadedSkillReference(thunkApi, dialogKey, dbKey, requestedName);
401
410
  }
402
411
  return {
403
412
  rawData: {
@@ -437,7 +446,7 @@ ${body2}`
437
446
  }
438
447
  const body = extractSkillBody(page);
439
448
  if (context?.skipSkillReferencePersist !== true) {
440
- await persistLoadedSkillReference(thunkApi, matched.dbKey, requestedName);
449
+ await persistLoadedSkillReference(thunkApi, dialogKey, matched.dbKey, requestedName);
441
450
  }
442
451
  return {
443
452
  rawData: {
@@ -451,10 +460,9 @@ ${body2}`
451
460
  ${body}`
452
461
  };
453
462
  }
454
- async function persistLoadedSkillReference(thunkApi, dbKey, name) {
463
+ async function persistLoadedSkillReference(thunkApi, currentDialogKey, dbKey, name) {
455
464
  try {
456
465
  const state = thunkApi?.getState?.();
457
- const currentDialogKey = getActiveDialogKey();
458
466
  if (!state || !currentDialogKey) return;
459
467
  const dialogConfig = selectById(
460
468
  state,
@@ -468,7 +476,7 @@ async function persistLoadedSkillReference(thunkApi, dbKey, name) {
468
476
  title: name,
469
477
  type: "instruction"
470
478
  };
471
- await setDialogExtraReferencesAction([...existing, newRef], thunkApi);
479
+ await setDialogExtraReferencesAction([...existing, newRef], thunkApi, currentDialogKey);
472
480
  } catch {
473
481
  }
474
482
  }
@@ -607,10 +615,10 @@ ${block.question.choices.map((item) => `- ${item.label}${item.detail ? ` \u2014
607
615
 
608
616
  // packages/core/clipMultilineText.ts
609
617
  function clipMultilineText(value, max) {
610
- const trimmed = value.trim();
611
- if (trimmed.length <= max) return trimmed;
612
- return `${trimmed.slice(0, max)}
613
- ...[truncated ${trimmed.length - max} chars]`;
618
+ const trimmed2 = value.trim();
619
+ if (trimmed2.length <= max) return trimmed2;
620
+ return `${trimmed2.slice(0, max)}
621
+ ...[truncated ${trimmed2.length - max} chars]`;
614
622
  }
615
623
 
616
624
  // packages/render/table/utils/tableSerialization.ts
@@ -783,7 +791,7 @@ var executeToolRun = createAsyncThunk(
783
791
  if (!executionInput) {
784
792
  throw new Error(`ToolRun ${id} has no input to execute with.`);
785
793
  }
786
- const { findToolExecutor } = await import("./tools-5UWS65PB.js");
794
+ const { findToolExecutor } = await import("./tools-7RSX22FT.js");
787
795
  const { executor } = findToolExecutor(run.toolName);
788
796
  toolRunStarted({
789
797
  id: run.id,
@@ -807,7 +815,7 @@ var executeToolRun = createAsyncThunk(
807
815
  const latestState = thunkApi.getState();
808
816
  const userId = selectIdentityUserId(latestState);
809
817
  if (userId) {
810
- const { fetchUserSpaceMemberships } = await import("./memberThunks-7Y3OYSJQ.js");
818
+ const { fetchUserSpaceMemberships } = await import("./memberThunks-PBJPZ2JU.js");
811
819
  await thunkApi.dispatch(fetchUserSpaceMemberships(userId));
812
820
  }
813
821
  }
@@ -837,13 +845,6 @@ export {
837
845
  waitForAbortableDelay,
838
846
  clipMultilineText,
839
847
  fetchAndSerializeTable,
840
- selectMaxExecutionTime,
841
- selectGlobalPrompt,
842
- selectUserTonePreset,
843
- selectKnowledgeCaptureLevel,
844
- selectSpaceContextLevel,
845
- selectAutoApproveSelfUpdateFields,
846
- selectAiRecentContentLimit,
847
848
  ToolResultError,
848
849
  getToolResultErrorData,
849
850
  createToolRunId,
@@ -853,6 +854,8 @@ export {
853
854
  toolRunUpdated,
854
855
  toolRunFailed,
855
856
  getAllToolRuns,
857
+ resolveMemoryToolContext,
858
+ resolveToolAttributionContext,
856
859
  loadSkillFunctionSchema,
857
860
  loadSkillFunc
858
861
  };
@@ -0,0 +1,107 @@
1
+ import {
2
+ recallMemoryVNextLocal
3
+ } from "./chunk-4D4QD7FT.js";
4
+ import {
5
+ DEFAULT_MEMORY_OVERLAY_TOKEN_BUDGET,
6
+ buildMemoryOverlay
7
+ } from "./chunk-PVFYPUIM.js";
8
+ import {
9
+ isWorkContextState
10
+ } from "./chunk-6WOLPIPY.js";
11
+ import {
12
+ loadMemoryVNextCatalog
13
+ } from "./chunk-324FWHUA.js";
14
+ import {
15
+ createMemoryKey
16
+ } from "./chunk-SYTHYBMI.js";
17
+
18
+ // packages/ai/memory/storeShared.ts
19
+ var retrievalCountOf = (item) => item.activationCount ?? 0;
20
+ var touchMemoryItemsInDb = async (db, items, now = (/* @__PURE__ */ new Date()).toISOString()) => {
21
+ if (items.length === 0) return;
22
+ const batch = db.batch();
23
+ for (const item of items) {
24
+ batch.put(createMemoryKey(item.ownerType, item.ownerId, item.id), {
25
+ ...item,
26
+ // retrieval bookkeeping on legacy storage names — see doc comment above
27
+ lastActivatedAt: now,
28
+ activationCount: retrievalCountOf(item) + 1
29
+ });
30
+ }
31
+ await batch.write();
32
+ };
33
+
34
+ // packages/ai/memory/remember.ts
35
+ var RESIDENT_MAX_CONTENT_CHARS = 240;
36
+
37
+ // packages/ai/memory/vnext/pureVNextRuntime.ts
38
+ function deriveStateResident(state, ownerType) {
39
+ if (ownerType !== "user") return false;
40
+ if (state.text.trim().length > RESIDENT_MAX_CONTENT_CHARS) return false;
41
+ return state.facet === "preference" || state.facet === "style";
42
+ }
43
+ var buildSynthesizedStateItem = (state, entity, ownerType, ownerId) => ({
44
+ id: `vnext-state-${state.id}`,
45
+ ownerType,
46
+ ownerId,
47
+ visibility: "private",
48
+ subjectType: "user",
49
+ subjectId: ownerId,
50
+ kind: "semantic",
51
+ content: state.text.trim(),
52
+ createdAt: state.createdAt,
53
+ lastActivatedAt: state.createdAt,
54
+ activationCount: 1,
55
+ importance: 0.9,
56
+ confidence: 0.9,
57
+ resident: deriveStateResident(state, ownerType)
58
+ });
59
+ async function resolvePureVNextRuntime(input) {
60
+ const { db, owners, userInput } = input;
61
+ if (owners.length === 0 || !userInput.trim()) {
62
+ return { selectedItems: [], promptBlock: buildMemoryOverlay([], { injectionEmit: input.injectionEmit }), recalledStateCount: 0 };
63
+ }
64
+ const ownerIds = owners.map((o) => `${o.ownerType}:${encodeURIComponent(o.ownerId)}`);
65
+ const catalogs = await Promise.all(
66
+ ownerIds.map((ownerId) => loadMemoryVNextCatalog(db, ownerId))
67
+ );
68
+ const selectedItems = [];
69
+ const seenStateKeys = /* @__PURE__ */ new Set();
70
+ for (let i = 0; i < owners.length; i++) {
71
+ const owner = owners[i];
72
+ const catalog = catalogs[i];
73
+ const currentStates = catalog.states.filter(
74
+ (s) => !s.retiredAt && s.text.trim() && !isWorkContextState(s)
75
+ );
76
+ const hits = recallMemoryVNextLocal({
77
+ query: userInput,
78
+ entities: catalog.entities,
79
+ states: currentStates
80
+ });
81
+ const entityById = new Map(catalog.entities.map((e) => [e.id, e]));
82
+ for (const hit of hits) {
83
+ const stateKey = `${hit.state.ownerId}\0${hit.state.id}`;
84
+ if (seenStateKeys.has(stateKey)) continue;
85
+ seenStateKeys.add(stateKey);
86
+ selectedItems.push(
87
+ buildSynthesizedStateItem(hit.state, entityById.get(hit.state.entityId), owner.ownerType, owner.ownerId)
88
+ );
89
+ }
90
+ }
91
+ const promptBlock = buildMemoryOverlay(selectedItems, {
92
+ sources: new Map(selectedItems.map((item) => [item, "vnext"])),
93
+ injectionEmit: input.injectionEmit,
94
+ maxTokens: input.maxTokens ?? DEFAULT_MEMORY_OVERLAY_TOKEN_BUDGET
95
+ });
96
+ return {
97
+ selectedItems,
98
+ promptBlock,
99
+ recalledStateCount: selectedItems.length
100
+ };
101
+ }
102
+
103
+ export {
104
+ touchMemoryItemsInDb,
105
+ deriveStateResident,
106
+ resolvePureVNextRuntime
107
+ };