nolo-cli 0.95.0-alpha.6 → 0.95.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 (181) hide show
  1. package/README.md +1 -1
  2. package/{_executeModel-AUQRMRWL.js → _executeModel-2A5AFVBG.js} +67 -63
  3. package/{action-YVYQEAAV.js → action-GI44T4DR.js} +10 -10
  4. package/{addContentAction-O7R66HEX.js → addContentAction-B2DRF7P6.js} +9 -9
  5. package/{addDialogAgentAction-74OA7KYP.js → addDialogAgentAction-T3I7IXPK.js} +15 -17
  6. package/{agentDeleteCommand-4BAHJRU3.js → agentDeleteCommand-QYCCUQ35.js} +47 -43
  7. package/{agentEmailCommands-QISOY7Y6.js → agentEmailCommands-IX6COKHS.js} +89 -82
  8. package/{agentListCommands-U46ODMQU.js → agentListCommands-JDU7V3M5.js} +77 -82
  9. package/{agentMachineCommands-EHV2KM2C.js → agentMachineCommands-W36VFO5M.js} +42 -38
  10. package/{agentProviderCommands-GNPTL5XR.js → agentProviderCommands-YK2BIIXZ.js} +1 -1
  11. package/{agentPullCommand-O5MPVJ5E.js → agentPullCommand-HF4A42D4.js} +1 -1
  12. package/agentRecordCommands-JGOTOBTW.js +135 -0
  13. package/{agentRunCommand-K4CLMA6B.js → agentRunCommand-LJBG6YF2.js} +89 -80
  14. package/{agentRunControl-XLGD3UZ5.js → agentRunControl-5T64LM2M.js} +2 -2
  15. package/{agentRuntimeLocal-O4HPUJA4.js → agentRuntimeLocal-SYLNOKCT.js} +44 -36
  16. package/{agentSlice-ZYT2OUR3.js → agentSlice-FZ7GGQM2.js} +11 -11
  17. package/{appDeleteCommands-R5BBTKQK.js → appDeleteCommands-IP22BHZE.js} +42 -38
  18. package/{appDeployCommands-ZJIXOJWD.js → appDeployCommands-5ZTQL6UL.js} +42 -38
  19. package/{appDeployStatusCommands-B3R2ZTBF.js → appDeployStatusCommands-G6EMAT75.js} +42 -38
  20. package/{appGetCommands-2AQSOV2A.js → appGetCommands-UXBDAYEM.js} +42 -38
  21. package/{appListCommands-HCIJGZFY.js → appListCommands-J274GTVP.js} +42 -38
  22. package/{authCommand-F4EFRRX6.js → authCommand-2YPMMIJN.js} +117 -23
  23. package/{authCommands-RGOGCPP6.js → authCommands-FFDS4FVX.js} +7 -5
  24. package/{builtinSkillRegistry-FUAVTRVZ.js → builtinSkillRegistry-ZMF6YGNO.js} +6 -5
  25. package/{chatQueueReduxAdapter-Q5V4YJVI.js → chatQueueReduxAdapter-PRP4YQP7.js} +30 -29
  26. package/{chromeCommands-FZYAU75D.js → chromeCommands-K27J4OVZ.js} +124 -28
  27. package/{chromeOpsCommands-62P2Q2YB.js → chromeOpsCommands-IXRLN57H.js} +4 -3
  28. package/{chunk-6OZ36FXI.js → chunk-27ONFIEY.js} +22 -4
  29. package/chunk-2QZTQEW4.js +13349 -0
  30. package/{chunk-JEDZAO7L.js → chunk-2SYTUTLI.js} +257 -37
  31. package/{chunk-OIVSQH2O.js → chunk-3BXNTXYI.js} +299 -5
  32. package/{chunk-ZLR5JN3E.js → chunk-4B4DAAFV.js} +7 -7
  33. package/{chunk-EYAQT56M.js → chunk-4DPP773Q.js} +2 -2
  34. package/chunk-4LCOCOR5.js +50 -0
  35. package/{chunk-BZWBEHGD.js → chunk-4MPGAOXS.js} +66 -38
  36. package/{chunk-JOHSKZQX.js → chunk-4RTK7EHT.js} +865 -207
  37. package/{chunk-2GRGFCF6.js → chunk-4VJAC32I.js} +2 -1
  38. package/{chunk-MC4XLIJ7.js → chunk-523DITKR.js} +1 -1
  39. package/{chunk-IAO6JBYW.js → chunk-5B7XS6UO.js} +164 -14
  40. package/{chunk-E4MARS3Q.js → chunk-5GVBDNTO.js} +1 -1
  41. package/chunk-5J3PYNUP.js +255 -0
  42. package/chunk-5MMAK75Q.js +15 -0
  43. package/{chunk-JPGCXHNM.js → chunk-5OA5HMTL.js} +1 -1
  44. package/{chunk-42V6BK2E.js → chunk-62IL3KQV.js} +4 -34
  45. package/{chunk-YQTQQX2H.js → chunk-67HHBCFJ.js} +1 -1
  46. package/{chunk-SNPMM7H3.js → chunk-67T7O467.js} +13 -13
  47. package/{chunk-6YTOJY35.js → chunk-6D2JFXLY.js} +35 -0
  48. package/{chunk-4MY4GLIW.js → chunk-6IHBIRPK.js} +969 -1090
  49. package/{chunk-3BMYXEUW.js → chunk-6O4IK4V2.js} +1 -1
  50. package/{chunk-XOVEWFLK.js → chunk-6RDFAKG7.js} +100 -100
  51. package/{chunk-DHDMC6FO.js → chunk-6TPOEJMQ.js} +9 -4
  52. package/{chunk-WADCY6G6.js → chunk-6ZWMH6TJ.js} +111 -41
  53. package/{chunk-ABQYVJBJ.js → chunk-7CHC4W22.js} +1 -1
  54. package/{chunk-GQBOR3G6.js → chunk-7KVZ5LDQ.js} +2 -2
  55. package/{chunk-OA6Q2A4I.js → chunk-A7RSPKU6.js} +98 -22
  56. package/{chunk-KQ4ONNQD.js → chunk-ALFH24P3.js} +56 -7
  57. package/{chunk-Q554LLSI.js → chunk-AUDNYVRC.js} +1 -1
  58. package/{chunk-GPCZ7UXG.js → chunk-AZRHIN5B.js} +1 -1
  59. package/{chunk-JRQFUXY7.js → chunk-B2XUQXQX.js} +96 -19
  60. package/{chunk-EGSKXKR5.js → chunk-BJJL5DZF.js} +1 -1
  61. package/chunk-BMQ2MJUK.js +153 -0
  62. package/{chunk-XRWZB6CF.js → chunk-BVWTQJAA.js} +23 -76
  63. package/{chunk-3IIEFNGY.js → chunk-C53ZG23R.js} +2 -2
  64. package/chunk-CHOZJMJS.js +78 -0
  65. package/{chunk-HJUYAD4A.js → chunk-CPUFH46E.js} +8 -8
  66. package/{chunk-LS2ZANRJ.js → chunk-CTUQJVQM.js} +1 -1
  67. package/{chunk-BP4XNZRM.js → chunk-CU3QB4HW.js} +3 -3
  68. package/{chunk-ACTMNVHM.js → chunk-CYSYR67N.js} +1 -1
  69. package/{chunk-VLTIYV3X.js → chunk-DCLMZ5TX.js} +4 -4
  70. package/{chunk-UKZDAFYT.js → chunk-DSSTTEKI.js} +6 -10
  71. package/{chunk-HVURBGF3.js → chunk-ESRMFY7G.js} +2 -2
  72. package/{chunk-TRV2MIDW.js → chunk-EXAJ6DCR.js} +1 -0
  73. package/chunk-GMZLP5DV.js +82 -0
  74. package/{chunk-FDTR4QJ6.js → chunk-H6A6X4EK.js} +32 -1
  75. package/{chunk-DVINR3PL.js → chunk-HDLLCBRF.js} +1 -1
  76. package/{chunk-ONXOABJR.js → chunk-HNGRBWYF.js} +3 -0
  77. package/{chunk-H62HCIUP.js → chunk-HYZIYH2H.js} +11 -10
  78. package/{chunk-MMPXJXHT.js → chunk-HZH7RULB.js} +582 -478
  79. package/{chunk-NTW5GWDM.js → chunk-I3QNET24.js} +32 -17
  80. package/{chunk-WV42OMV7.js → chunk-IAESIMK7.js} +4 -4
  81. package/{chunk-QIAVMDHY.js → chunk-IUVCUGQR.js} +4 -4
  82. package/{chunk-AFDS2CVM.js → chunk-K5UOP7AI.js} +15 -20
  83. package/{chunk-IIVGDG4I.js → chunk-LNPYTNMG.js} +8 -4
  84. package/{chunk-BLJWCTRL.js → chunk-LVITW736.js} +1 -1
  85. package/chunk-LYS4T7MY.js +7600 -0
  86. package/{chunk-76WEAXJB.js → chunk-M3LRSBOX.js} +18 -15
  87. package/{chunk-7S4YWN7P.js → chunk-MX574M24.js} +1 -1
  88. package/{chunk-FZGV4FGK.js → chunk-NUHHBEJC.js} +378 -187
  89. package/{chunk-53HEEOTT.js → chunk-O26PCYLS.js} +80 -13
  90. package/{chunk-3DII57IT.js → chunk-O2OWEFII.js} +1 -1
  91. package/chunk-OCZKATRC.js +129 -0
  92. package/{chunk-6D6VBVEW.js → chunk-OTEMQQZI.js} +80 -14
  93. package/chunk-P6GMCCAT.js +870 -0
  94. package/{chunk-CPH3W5A7.js → chunk-Q4GP72HX.js} +94 -3
  95. package/{chunk-A6G32FNX.js → chunk-QYFBT4CV.js} +13 -13
  96. package/{chunk-Z77CRGTW.js → chunk-R4SQ3LGW.js} +1 -1
  97. package/{chunk-DEUUPHOO.js → chunk-RKGKDQGJ.js} +74 -17
  98. package/{chunk-ZXKVPF4K.js → chunk-RQNHAVSR.js} +236 -36
  99. package/{chunk-LLT642J4.js → chunk-RS4XOX6Y.js} +24 -5
  100. package/{chunk-V4MJDUSR.js → chunk-RSEEDUMS.js} +2 -2
  101. package/{chunk-UZGQNTVW.js → chunk-S5XGT6GB.js} +5 -3
  102. package/{chunk-AFUORTY4.js → chunk-SONWNI3L.js} +21 -21
  103. package/{chunk-BYMV6QZG.js → chunk-TNIX77YM.js} +4 -0
  104. package/{chunk-OF7AQZUG.js → chunk-TU5NE4U3.js} +9 -84
  105. package/chunk-TY3TIUJK.js +89 -0
  106. package/chunk-UNYJU5L6.js +780 -0
  107. package/{chunk-J4MOO56S.js → chunk-UQNS32WZ.js} +10 -2
  108. package/chunk-VIWDGTDA.js +8 -0
  109. package/chunk-VJVNU77E.js +83 -0
  110. package/{chunk-JAXOVNM4.js → chunk-WILHZY7K.js} +45 -45
  111. package/{chunk-BGSLKVCP.js → chunk-WIU4KIBL.js} +6 -7
  112. package/{chunk-UKWGR5SS.js → chunk-WIWM4FE3.js} +187 -398
  113. package/{chunk-O6OSWFZQ.js → chunk-XUWRURDF.js} +6 -0
  114. package/{chunk-Q67DOFOO.js → chunk-Y3PMXGLH.js} +2 -0
  115. package/{chunk-SH43IESU.js → chunk-YUNJN43V.js} +44 -9
  116. package/{chunk-TOP2VXOR.js → chunk-Z4CSIXYP.js} +2 -2
  117. package/{chunk-2F7RJC6L.js → chunk-ZOVKKMF6.js} +1 -1
  118. package/chunk-ZRAU6T47.js +56 -0
  119. package/commandRegistry-ESFYIRF4.js +833 -0
  120. package/{contentThunks-PT23JWJX.js → contentThunks-ECQ6KK3I.js} +32 -30
  121. package/{cooldownCommands-REAWYVTY.js → cooldownCommands-ZLEPIB4A.js} +2 -2
  122. package/{createAgentAutomationAction-N27SYTLU.js → createAgentAutomationAction-6EES5YQO.js} +32 -30
  123. package/{createDialogAction-XZPLHD5G.js → createDialogAction-JTKMM4VG.js} +36 -33
  124. package/{createPageAction-KHVJQ3CS.js → createPageAction-WQZTMGAG.js} +38 -36
  125. package/{chunk-3SJQXXGY.js → cursorProvider-YGGNMVWX.js} +2560 -9879
  126. package/{dbSlice-XVWBAGYN.js → dbSlice-DQ32LYTJ.js} +8 -8
  127. package/{deleteFile-YG6QMJLU.js → deleteFile-NX6QHCWZ.js} +3 -3
  128. package/{dialogCommands-ZUWW5UT6.js → dialogCommands-XXZH5K6U.js} +45 -41
  129. package/{dialogSlice-3YH242HS.js → dialogSlice-I6GN3I5B.js} +36 -29
  130. package/{dist-VODFSGNG.js → dist-NJC2W7I4.js} +61 -54
  131. package/{docCreateCommands-Q6FADDSJ.js → docCreateCommands-FLNUDWG6.js} +44 -40
  132. package/{docDeleteCommands-ZKIH54PZ.js → docDeleteCommands-74OURFAB.js} +44 -40
  133. package/{docReadCommands-7BZT2QTW.js → docReadCommands-QENWDQVH.js} +43 -39
  134. package/{docStore-YSZRNUUD.js → docStore-B2ZM4PCR.js} +11 -10
  135. package/{docUpdateCommands-WJXWTRL7.js → docUpdateCommands-J4HWJ5JO.js} +44 -40
  136. package/{fetchMessages-EIU7UFFK.js → fetchMessages-67MEFPZR.js} +2 -2
  137. package/{getPricing-LUSEABA6.js → getPricing-NMMFT3YI.js} +3 -3
  138. package/{handleSendMessageAction-KJO2QDBM.js → handleSendMessageAction-BAUWHASB.js} +91 -83
  139. package/index.js +87 -884
  140. package/{localDialogRead-BTFJ4V2I.js → localDialogRead-EBRS242U.js} +2 -2
  141. package/{localRuntimeAuthority-6IR6BBXE.js → localRuntimeAuthority-5W6IJRAD.js} +6 -6
  142. package/{localRuntimeDb-SYQGUF4U.js → localRuntimeDb-3LRMNLCM.js} +1 -1
  143. package/{machineCommands-QC4TD7GJ.js → machineCommands-SG3QGVOP.js} +84 -77
  144. package/{machineWsRunDispatch-XUOIAXO7.js → machineWsRunDispatch-RTFT3ZDL.js} +81 -74
  145. package/{memberThunks-QGFLFVCI.js → memberThunks-5ZXPR63F.js} +9 -9
  146. package/{models-T3SG6MJ5.js → models-ZPU5EDF4.js} +2 -2
  147. package/oauthTokenStore-ITEB663N.js +23 -0
  148. package/package.json +1 -1
  149. package/pdf-U6KSUEZZ.js +26435 -0
  150. package/processSpawn-SOAV3FEV.js +11 -0
  151. package/profileConfig-ZGOFORWV.js +43 -0
  152. package/{providerPresetApply-FG6NZ57W.js → providerPresetApply-DD6NGWW6.js} +7 -7
  153. package/{providerRegistry-757OWH3O.js → providerRegistry-XDRLMYGJ.js} +7 -7
  154. package/{read-COE3ZYR6.js → read-EPTJRAEF.js} +5 -5
  155. package/{readDocTool-5USN4A6V.js → readDocTool-W4NDXNEX.js} +5 -3
  156. package/{readlineWorkspace-74TXXSLO.js → readlineWorkspace-MCNBLA56.js} +2449 -2022
  157. package/{removeDialogAgentAction-IX3MN2ZO.js → removeDialogAgentAction-BVAWQKXE.js} +17 -19
  158. package/{runAgentClientLoop-37BXJD62.js → runAgentClientLoop-XDPBFXV2.js} +61 -58
  159. package/{runtimeDoctorCommands-X6WDBEQX.js → runtimeDoctorCommands-3USD722U.js} +3 -3
  160. package/runtimeModeArgs-2Y7BALTO.js +31 -0
  161. package/{setDialogExtraReferencesAction-X4HCPNZL.js → setDialogExtraReferencesAction-LYY45IAD.js} +12 -11
  162. package/{setPrimaryDialogAgentAction-4GMIQLOD.js → setPrimaryDialogAgentAction-73IL7DLU.js} +18 -20
  163. package/{settingSlice-ZQZVUPKK.js → settingSlice-Q6EKL7EQ.js} +9 -9
  164. package/{skillDiscovery-CYUCJMAG.js → skillDiscovery-ZBU76COE.js} +3 -3
  165. package/{spaceCommands-P3ONT6LL.js → spaceCommands-BYDGOMW7.js} +44 -40
  166. package/{streamAgentChatTurn-FGXQXALU.js → streamAgentChatTurn-BBH3QDEZ.js} +183 -91
  167. package/{switchDialogAgentAction-N52LRPA3.js → switchDialogAgentAction-UUXDSQ6X.js} +15 -17
  168. package/{tableCommands-O6NWHFKV.js → tableCommands-G7RV3RU3.js} +4 -4
  169. package/{toolApiClient-QVJ6HDNN.js → toolApiClient-INIQCPGY.js} +3 -3
  170. package/{tools-R5UF2KZO.js → tools-OQWSBQJA.js} +54 -51
  171. package/{tuiSummaryLlmCaller-T2SHYMDZ.js → tuiSummaryLlmCaller-74NRRLVW.js} +18 -16
  172. package/{updateCommands-2M74UL7P.js → updateCommands-4EHDLF5J.js} +3 -3
  173. package/{updateDialogTitleAction-RTADGV7A.js → updateDialogTitleAction-E25IG3J3.js} +81 -43
  174. package/agentRecordCommands-SIPURU2S.js +0 -128
  175. package/chunk-FOWEGIMF.js +0 -18881
  176. package/chunk-M76ECQRD.js +0 -13658
  177. package/chunk-Q5FJJ6XI.js +0 -103
  178. package/chunk-S7Z2HMCN.js +0 -25
  179. package/{chunk-VMFTFOWF.js → chunk-3AH7LNUB.js} +7 -7
  180. package/{chunk-X7HHHIOZ.js → chunk-Y6ROFCZO.js} +0 -0
  181. package/{db-WK5MDZVN.js → db-VQSAOWAO.js} +1 -1
@@ -1,3 +1,6 @@
1
+ import {
2
+ readSseFrames
3
+ } from "./chunk-GMZLP5DV.js";
1
4
  import {
2
5
  sanitizeForOutbound
3
6
  } from "./chunk-CQ3WA2NE.js";
@@ -35,16 +38,18 @@ import {
35
38
  resolvePlatformAuthToken,
36
39
  resolvePlatformServerUrl,
37
40
  resolveProviderTransportDecision
38
- } from "./chunk-6OZ36FXI.js";
41
+ } from "./chunk-27ONFIEY.js";
39
42
  import {
40
- clipCompactText,
41
43
  isMeaningfulChatCompletionOutput,
42
44
  isMeaningfulResponsesOutput
43
- } from "./chunk-WADCY6G6.js";
45
+ } from "./chunk-6ZWMH6TJ.js";
46
+ import {
47
+ clipCompactText
48
+ } from "./chunk-5MMAK75Q.js";
44
49
  import {
45
50
  NOLO_CLIENT_VERSION_HEADER,
46
51
  isPlatformMimoProviderModel
47
- } from "./chunk-Q67DOFOO.js";
52
+ } from "./chunk-Y3PMXGLH.js";
48
53
  import {
49
54
  isRecord
50
55
  } from "./chunk-KUG52IAP.js";
@@ -347,83 +352,6 @@ function flushChatCompletionStream(state) {
347
352
  }
348
353
  }
349
354
 
350
- // packages/agent-runtime/sseFrames.ts
351
- async function* readSseFrames(response) {
352
- const reader = response.body?.getReader();
353
- if (!reader) {
354
- throw new Error("SSE response did not include a readable body.");
355
- }
356
- const decoder = new TextDecoder();
357
- let buffer = "";
358
- while (true) {
359
- const { done, value } = await reader.read();
360
- if (done) break;
361
- buffer += decoder.decode(value, { stream: true });
362
- let boundary = findSseFrameBoundary(buffer);
363
- while (boundary) {
364
- yield buffer.slice(0, boundary.index);
365
- buffer = buffer.slice(boundary.index + boundary.separatorLength);
366
- boundary = findSseFrameBoundary(buffer);
367
- }
368
- }
369
- const remaining = decoder.decode();
370
- if (remaining) {
371
- buffer += remaining;
372
- let boundary = findSseFrameBoundary(buffer);
373
- while (boundary) {
374
- yield buffer.slice(0, boundary.index);
375
- buffer = buffer.slice(boundary.index + boundary.separatorLength);
376
- boundary = findSseFrameBoundary(buffer);
377
- }
378
- }
379
- if (buffer.trim()) yield buffer;
380
- }
381
- function findSseFrameBoundary(buffer) {
382
- const lfLf = buffer.indexOf("\n\n");
383
- const crLfCrLf = buffer.indexOf("\r\n\r\n");
384
- if (lfLf === -1 && crLfCrLf === -1) return null;
385
- const useLf = lfLf !== -1 && (crLfCrLf === -1 || lfLf < crLfCrLf);
386
- return useLf ? { index: lfLf, separatorLength: 2 } : { index: crLfCrLf, separatorLength: 4 };
387
- }
388
- async function* streamSseDataValues(response, parse) {
389
- const reader = response.body?.getReader();
390
- if (!reader) return;
391
- const decoder = new TextDecoder();
392
- let buffer = "";
393
- while (true) {
394
- const { done, value } = await reader.read();
395
- if (done) break;
396
- buffer += decoder.decode(value, { stream: true });
397
- const lines = buffer.split("\n");
398
- buffer = lines.pop() ?? "";
399
- for (const line of lines) {
400
- const parsed = parse(line);
401
- if (parsed) yield parsed;
402
- }
403
- }
404
- const remaining = decoder.decode();
405
- if (remaining) {
406
- buffer += remaining;
407
- const lines = buffer.split("\n");
408
- buffer = lines.pop() ?? "";
409
- for (const line of lines) {
410
- const parsed = parse(line);
411
- if (parsed) yield parsed;
412
- }
413
- }
414
- if (buffer.trim()) {
415
- const parsed = parse(buffer);
416
- if (parsed) yield parsed;
417
- }
418
- }
419
- async function readSseDataValues(response, parse) {
420
- const values = [];
421
- for await (const value of streamSseDataValues(response, parse)) {
422
- values.push(value);
423
- }
424
- return values;
425
- }
426
-
427
355
  // packages/agent-runtime/platformChatProvider.ts
428
356
  var PlatformStreamInterruptedError = class extends Error {
429
357
  code = "PLATFORM_STREAM_INTERRUPTED";
@@ -926,9 +854,6 @@ export {
926
854
  applyChatCompletionDelta,
927
855
  flushChatCompletionStream,
928
856
  providerHttpFailure,
929
- readSseFrames,
930
- streamSseDataValues,
931
- readSseDataValues,
932
857
  createResponsesToolAccumulator,
933
858
  applyResponsesToolEvent,
934
859
  finalizeResponsesToolCalls,
@@ -0,0 +1,89 @@
1
+ import {
2
+ isLevelNotFoundError
3
+ } from "./chunk-OW765XBU.js";
4
+
5
+ // packages/ai/memory/vnext/store.ts
6
+ var enc = (value) => encodeURIComponent(value).replace(/-/g, "%2D");
7
+ var rangeOf = (prefix) => ({ gte: prefix, lte: `${prefix}\uFFFF` });
8
+ var entityKey = (ownerId, id) => `mem2-e-${enc(ownerId)}-${enc(id)}`;
9
+ var entityOwnerPrefix = (ownerId) => `mem2-e-${enc(ownerId)}-`;
10
+ var stateKey = (ownerId, id) => `mem2-s-${enc(ownerId)}-${enc(id)}`;
11
+ var stateEntityIndexKey = (ownerId, entityId, stateId) => `mem2-si-${enc(ownerId)}-${enc(entityId)}-${enc(stateId)}`;
12
+ var stateEntityIndexPrefix = (ownerId, entityId) => `mem2-si-${enc(ownerId)}-${enc(entityId)}-`;
13
+ var evidenceKey = (ownerId, id) => `mem2-v-${enc(ownerId)}-${enc(id)}`;
14
+ var relationKey = (ownerId, id) => `mem2-r-${enc(ownerId)}-${enc(id)}`;
15
+ var relationFromIndexKey = (ownerId, from, relationId) => `mem2-rf-${enc(ownerId)}-${enc(from)}-${enc(relationId)}`;
16
+ var relationToIndexKey = (ownerId, to, relationId) => `mem2-rt-${enc(ownerId)}-${enc(to)}-${enc(relationId)}`;
17
+ var readIndexed = async (db, prefix) => {
18
+ const refs = [];
19
+ for await (const [, value] of db.iterator({ ...rangeOf(prefix), reverse: false })) {
20
+ if (typeof value?.key === "string") refs.push(value.key);
21
+ }
22
+ const rows = await Promise.all(refs.map((key) => db.get(key).catch(() => null)));
23
+ return rows.filter((row) => !!row);
24
+ };
25
+ var getMemoryEntityVNext = async (db, ownerId, entityId) => db.get(entityKey(ownerId, entityId)).catch(() => null);
26
+ var listMemoryEntitiesVNext = async (db, ownerId) => {
27
+ const rows = [];
28
+ for await (const [, value] of db.iterator({
29
+ ...rangeOf(entityOwnerPrefix(ownerId)),
30
+ reverse: false
31
+ })) {
32
+ if (value) rows.push(value);
33
+ }
34
+ return rows;
35
+ };
36
+ var loadMemoryVNextCatalog = async (db, ownerId) => {
37
+ const entities = await listMemoryEntitiesVNext(db, ownerId);
38
+ const states = (await Promise.all(entities.map((entity) => listMemoryStatesForEntityVNext(db, ownerId, entity.id)))).flat();
39
+ return { entities, states };
40
+ };
41
+ var getMemoryStateVNext = async (db, ownerId, stateId) => db.get(stateKey(ownerId, stateId)).catch(() => null);
42
+ var listMemoryStatesForEntityVNext = (db, ownerId, entityId) => readIndexed(db, stateEntityIndexPrefix(ownerId, entityId));
43
+ var putMemoryEvidenceVNext = async (db, evidence) => {
44
+ await db.put(evidenceKey(evidence.ownerId, evidence.id), evidence);
45
+ };
46
+ var getMemoryEvidenceVNext = async (db, ownerId, evidenceId) => db.get(evidenceKey(ownerId, evidenceId)).catch(() => null);
47
+ var getMemoryEvidenceVNextStrict = async (db, ownerId, evidenceId) => {
48
+ try {
49
+ return await db.get(evidenceKey(ownerId, evidenceId));
50
+ } catch (error) {
51
+ if (isLevelNotFoundError(error)) return null;
52
+ throw error;
53
+ }
54
+ };
55
+ var _appendEntityBatch = (batch, entity) => {
56
+ batch.put(entityKey(entity.ownerId, entity.id), entity);
57
+ };
58
+ var _appendEvidenceBatch = (batch, evidence) => {
59
+ batch.put(evidenceKey(evidence.ownerId, evidence.id), evidence);
60
+ };
61
+ var _appendStateBatch = (batch, state) => {
62
+ const key = stateKey(state.ownerId, state.id);
63
+ batch.put(key, state);
64
+ batch.put(stateEntityIndexKey(state.ownerId, state.entityId, state.id), { key });
65
+ };
66
+ var _appendRetiredStateBatch = (batch, state) => {
67
+ batch.put(stateKey(state.ownerId, state.id), state);
68
+ };
69
+ var _appendRelationBatch = (batch, relation) => {
70
+ const key = relationKey(relation.ownerId, relation.id);
71
+ batch.put(key, relation);
72
+ batch.put(relationFromIndexKey(relation.ownerId, relation.from, relation.id), { key });
73
+ batch.put(relationToIndexKey(relation.ownerId, relation.to, relation.id), { key });
74
+ };
75
+
76
+ export {
77
+ getMemoryEntityVNext,
78
+ loadMemoryVNextCatalog,
79
+ getMemoryStateVNext,
80
+ listMemoryStatesForEntityVNext,
81
+ putMemoryEvidenceVNext,
82
+ getMemoryEvidenceVNext,
83
+ getMemoryEvidenceVNextStrict,
84
+ _appendEntityBatch,
85
+ _appendEvidenceBatch,
86
+ _appendStateBatch,
87
+ _appendRetiredStateBatch,
88
+ _appendRelationBatch
89
+ };