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.
- package/README.md +1 -1
- package/{_executeModel-AUQRMRWL.js → _executeModel-2A5AFVBG.js} +67 -63
- package/{action-YVYQEAAV.js → action-GI44T4DR.js} +10 -10
- package/{addContentAction-O7R66HEX.js → addContentAction-B2DRF7P6.js} +9 -9
- package/{addDialogAgentAction-74OA7KYP.js → addDialogAgentAction-T3I7IXPK.js} +15 -17
- package/{agentDeleteCommand-4BAHJRU3.js → agentDeleteCommand-QYCCUQ35.js} +47 -43
- package/{agentEmailCommands-QISOY7Y6.js → agentEmailCommands-IX6COKHS.js} +89 -82
- package/{agentListCommands-U46ODMQU.js → agentListCommands-JDU7V3M5.js} +77 -82
- package/{agentMachineCommands-EHV2KM2C.js → agentMachineCommands-W36VFO5M.js} +42 -38
- package/{agentProviderCommands-GNPTL5XR.js → agentProviderCommands-YK2BIIXZ.js} +1 -1
- package/{agentPullCommand-O5MPVJ5E.js → agentPullCommand-HF4A42D4.js} +1 -1
- package/agentRecordCommands-JGOTOBTW.js +135 -0
- package/{agentRunCommand-K4CLMA6B.js → agentRunCommand-LJBG6YF2.js} +89 -80
- package/{agentRunControl-XLGD3UZ5.js → agentRunControl-5T64LM2M.js} +2 -2
- package/{agentRuntimeLocal-O4HPUJA4.js → agentRuntimeLocal-SYLNOKCT.js} +44 -36
- package/{agentSlice-ZYT2OUR3.js → agentSlice-FZ7GGQM2.js} +11 -11
- package/{appDeleteCommands-R5BBTKQK.js → appDeleteCommands-IP22BHZE.js} +42 -38
- package/{appDeployCommands-ZJIXOJWD.js → appDeployCommands-5ZTQL6UL.js} +42 -38
- package/{appDeployStatusCommands-B3R2ZTBF.js → appDeployStatusCommands-G6EMAT75.js} +42 -38
- package/{appGetCommands-2AQSOV2A.js → appGetCommands-UXBDAYEM.js} +42 -38
- package/{appListCommands-HCIJGZFY.js → appListCommands-J274GTVP.js} +42 -38
- package/{authCommand-F4EFRRX6.js → authCommand-2YPMMIJN.js} +117 -23
- package/{authCommands-RGOGCPP6.js → authCommands-FFDS4FVX.js} +7 -5
- package/{builtinSkillRegistry-FUAVTRVZ.js → builtinSkillRegistry-ZMF6YGNO.js} +6 -5
- package/{chatQueueReduxAdapter-Q5V4YJVI.js → chatQueueReduxAdapter-PRP4YQP7.js} +30 -29
- package/{chromeCommands-FZYAU75D.js → chromeCommands-K27J4OVZ.js} +124 -28
- package/{chromeOpsCommands-62P2Q2YB.js → chromeOpsCommands-IXRLN57H.js} +4 -3
- package/{chunk-6OZ36FXI.js → chunk-27ONFIEY.js} +22 -4
- package/chunk-2QZTQEW4.js +13349 -0
- package/{chunk-JEDZAO7L.js → chunk-2SYTUTLI.js} +257 -37
- package/{chunk-OIVSQH2O.js → chunk-3BXNTXYI.js} +299 -5
- package/{chunk-ZLR5JN3E.js → chunk-4B4DAAFV.js} +7 -7
- package/{chunk-EYAQT56M.js → chunk-4DPP773Q.js} +2 -2
- package/chunk-4LCOCOR5.js +50 -0
- package/{chunk-BZWBEHGD.js → chunk-4MPGAOXS.js} +66 -38
- package/{chunk-JOHSKZQX.js → chunk-4RTK7EHT.js} +865 -207
- package/{chunk-2GRGFCF6.js → chunk-4VJAC32I.js} +2 -1
- package/{chunk-MC4XLIJ7.js → chunk-523DITKR.js} +1 -1
- package/{chunk-IAO6JBYW.js → chunk-5B7XS6UO.js} +164 -14
- package/{chunk-E4MARS3Q.js → chunk-5GVBDNTO.js} +1 -1
- package/chunk-5J3PYNUP.js +255 -0
- package/chunk-5MMAK75Q.js +15 -0
- package/{chunk-JPGCXHNM.js → chunk-5OA5HMTL.js} +1 -1
- package/{chunk-42V6BK2E.js → chunk-62IL3KQV.js} +4 -34
- package/{chunk-YQTQQX2H.js → chunk-67HHBCFJ.js} +1 -1
- package/{chunk-SNPMM7H3.js → chunk-67T7O467.js} +13 -13
- package/{chunk-6YTOJY35.js → chunk-6D2JFXLY.js} +35 -0
- package/{chunk-4MY4GLIW.js → chunk-6IHBIRPK.js} +969 -1090
- package/{chunk-3BMYXEUW.js → chunk-6O4IK4V2.js} +1 -1
- package/{chunk-XOVEWFLK.js → chunk-6RDFAKG7.js} +100 -100
- package/{chunk-DHDMC6FO.js → chunk-6TPOEJMQ.js} +9 -4
- package/{chunk-WADCY6G6.js → chunk-6ZWMH6TJ.js} +111 -41
- package/{chunk-ABQYVJBJ.js → chunk-7CHC4W22.js} +1 -1
- package/{chunk-GQBOR3G6.js → chunk-7KVZ5LDQ.js} +2 -2
- package/{chunk-OA6Q2A4I.js → chunk-A7RSPKU6.js} +98 -22
- package/{chunk-KQ4ONNQD.js → chunk-ALFH24P3.js} +56 -7
- package/{chunk-Q554LLSI.js → chunk-AUDNYVRC.js} +1 -1
- package/{chunk-GPCZ7UXG.js → chunk-AZRHIN5B.js} +1 -1
- package/{chunk-JRQFUXY7.js → chunk-B2XUQXQX.js} +96 -19
- package/{chunk-EGSKXKR5.js → chunk-BJJL5DZF.js} +1 -1
- package/chunk-BMQ2MJUK.js +153 -0
- package/{chunk-XRWZB6CF.js → chunk-BVWTQJAA.js} +23 -76
- package/{chunk-3IIEFNGY.js → chunk-C53ZG23R.js} +2 -2
- package/chunk-CHOZJMJS.js +78 -0
- package/{chunk-HJUYAD4A.js → chunk-CPUFH46E.js} +8 -8
- package/{chunk-LS2ZANRJ.js → chunk-CTUQJVQM.js} +1 -1
- package/{chunk-BP4XNZRM.js → chunk-CU3QB4HW.js} +3 -3
- package/{chunk-ACTMNVHM.js → chunk-CYSYR67N.js} +1 -1
- package/{chunk-VLTIYV3X.js → chunk-DCLMZ5TX.js} +4 -4
- package/{chunk-UKZDAFYT.js → chunk-DSSTTEKI.js} +6 -10
- package/{chunk-HVURBGF3.js → chunk-ESRMFY7G.js} +2 -2
- package/{chunk-TRV2MIDW.js → chunk-EXAJ6DCR.js} +1 -0
- package/chunk-GMZLP5DV.js +82 -0
- package/{chunk-FDTR4QJ6.js → chunk-H6A6X4EK.js} +32 -1
- package/{chunk-DVINR3PL.js → chunk-HDLLCBRF.js} +1 -1
- package/{chunk-ONXOABJR.js → chunk-HNGRBWYF.js} +3 -0
- package/{chunk-H62HCIUP.js → chunk-HYZIYH2H.js} +11 -10
- package/{chunk-MMPXJXHT.js → chunk-HZH7RULB.js} +582 -478
- package/{chunk-NTW5GWDM.js → chunk-I3QNET24.js} +32 -17
- package/{chunk-WV42OMV7.js → chunk-IAESIMK7.js} +4 -4
- package/{chunk-QIAVMDHY.js → chunk-IUVCUGQR.js} +4 -4
- package/{chunk-AFDS2CVM.js → chunk-K5UOP7AI.js} +15 -20
- package/{chunk-IIVGDG4I.js → chunk-LNPYTNMG.js} +8 -4
- package/{chunk-BLJWCTRL.js → chunk-LVITW736.js} +1 -1
- package/chunk-LYS4T7MY.js +7600 -0
- package/{chunk-76WEAXJB.js → chunk-M3LRSBOX.js} +18 -15
- package/{chunk-7S4YWN7P.js → chunk-MX574M24.js} +1 -1
- package/{chunk-FZGV4FGK.js → chunk-NUHHBEJC.js} +378 -187
- package/{chunk-53HEEOTT.js → chunk-O26PCYLS.js} +80 -13
- package/{chunk-3DII57IT.js → chunk-O2OWEFII.js} +1 -1
- package/chunk-OCZKATRC.js +129 -0
- package/{chunk-6D6VBVEW.js → chunk-OTEMQQZI.js} +80 -14
- package/chunk-P6GMCCAT.js +870 -0
- package/{chunk-CPH3W5A7.js → chunk-Q4GP72HX.js} +94 -3
- package/{chunk-A6G32FNX.js → chunk-QYFBT4CV.js} +13 -13
- package/{chunk-Z77CRGTW.js → chunk-R4SQ3LGW.js} +1 -1
- package/{chunk-DEUUPHOO.js → chunk-RKGKDQGJ.js} +74 -17
- package/{chunk-ZXKVPF4K.js → chunk-RQNHAVSR.js} +236 -36
- package/{chunk-LLT642J4.js → chunk-RS4XOX6Y.js} +24 -5
- package/{chunk-V4MJDUSR.js → chunk-RSEEDUMS.js} +2 -2
- package/{chunk-UZGQNTVW.js → chunk-S5XGT6GB.js} +5 -3
- package/{chunk-AFUORTY4.js → chunk-SONWNI3L.js} +21 -21
- package/{chunk-BYMV6QZG.js → chunk-TNIX77YM.js} +4 -0
- package/{chunk-OF7AQZUG.js → chunk-TU5NE4U3.js} +9 -84
- package/chunk-TY3TIUJK.js +89 -0
- package/chunk-UNYJU5L6.js +780 -0
- package/{chunk-J4MOO56S.js → chunk-UQNS32WZ.js} +10 -2
- package/chunk-VIWDGTDA.js +8 -0
- package/chunk-VJVNU77E.js +83 -0
- package/{chunk-JAXOVNM4.js → chunk-WILHZY7K.js} +45 -45
- package/{chunk-BGSLKVCP.js → chunk-WIU4KIBL.js} +6 -7
- package/{chunk-UKWGR5SS.js → chunk-WIWM4FE3.js} +187 -398
- package/{chunk-O6OSWFZQ.js → chunk-XUWRURDF.js} +6 -0
- package/{chunk-Q67DOFOO.js → chunk-Y3PMXGLH.js} +2 -0
- package/{chunk-SH43IESU.js → chunk-YUNJN43V.js} +44 -9
- package/{chunk-TOP2VXOR.js → chunk-Z4CSIXYP.js} +2 -2
- package/{chunk-2F7RJC6L.js → chunk-ZOVKKMF6.js} +1 -1
- package/chunk-ZRAU6T47.js +56 -0
- package/commandRegistry-ESFYIRF4.js +833 -0
- package/{contentThunks-PT23JWJX.js → contentThunks-ECQ6KK3I.js} +32 -30
- package/{cooldownCommands-REAWYVTY.js → cooldownCommands-ZLEPIB4A.js} +2 -2
- package/{createAgentAutomationAction-N27SYTLU.js → createAgentAutomationAction-6EES5YQO.js} +32 -30
- package/{createDialogAction-XZPLHD5G.js → createDialogAction-JTKMM4VG.js} +36 -33
- package/{createPageAction-KHVJQ3CS.js → createPageAction-WQZTMGAG.js} +38 -36
- package/{chunk-3SJQXXGY.js → cursorProvider-YGGNMVWX.js} +2560 -9879
- package/{dbSlice-XVWBAGYN.js → dbSlice-DQ32LYTJ.js} +8 -8
- package/{deleteFile-YG6QMJLU.js → deleteFile-NX6QHCWZ.js} +3 -3
- package/{dialogCommands-ZUWW5UT6.js → dialogCommands-XXZH5K6U.js} +45 -41
- package/{dialogSlice-3YH242HS.js → dialogSlice-I6GN3I5B.js} +36 -29
- package/{dist-VODFSGNG.js → dist-NJC2W7I4.js} +61 -54
- package/{docCreateCommands-Q6FADDSJ.js → docCreateCommands-FLNUDWG6.js} +44 -40
- package/{docDeleteCommands-ZKIH54PZ.js → docDeleteCommands-74OURFAB.js} +44 -40
- package/{docReadCommands-7BZT2QTW.js → docReadCommands-QENWDQVH.js} +43 -39
- package/{docStore-YSZRNUUD.js → docStore-B2ZM4PCR.js} +11 -10
- package/{docUpdateCommands-WJXWTRL7.js → docUpdateCommands-J4HWJ5JO.js} +44 -40
- package/{fetchMessages-EIU7UFFK.js → fetchMessages-67MEFPZR.js} +2 -2
- package/{getPricing-LUSEABA6.js → getPricing-NMMFT3YI.js} +3 -3
- package/{handleSendMessageAction-KJO2QDBM.js → handleSendMessageAction-BAUWHASB.js} +91 -83
- package/index.js +87 -884
- package/{localDialogRead-BTFJ4V2I.js → localDialogRead-EBRS242U.js} +2 -2
- package/{localRuntimeAuthority-6IR6BBXE.js → localRuntimeAuthority-5W6IJRAD.js} +6 -6
- package/{localRuntimeDb-SYQGUF4U.js → localRuntimeDb-3LRMNLCM.js} +1 -1
- package/{machineCommands-QC4TD7GJ.js → machineCommands-SG3QGVOP.js} +84 -77
- package/{machineWsRunDispatch-XUOIAXO7.js → machineWsRunDispatch-RTFT3ZDL.js} +81 -74
- package/{memberThunks-QGFLFVCI.js → memberThunks-5ZXPR63F.js} +9 -9
- package/{models-T3SG6MJ5.js → models-ZPU5EDF4.js} +2 -2
- package/oauthTokenStore-ITEB663N.js +23 -0
- package/package.json +1 -1
- package/pdf-U6KSUEZZ.js +26435 -0
- package/processSpawn-SOAV3FEV.js +11 -0
- package/profileConfig-ZGOFORWV.js +43 -0
- package/{providerPresetApply-FG6NZ57W.js → providerPresetApply-DD6NGWW6.js} +7 -7
- package/{providerRegistry-757OWH3O.js → providerRegistry-XDRLMYGJ.js} +7 -7
- package/{read-COE3ZYR6.js → read-EPTJRAEF.js} +5 -5
- package/{readDocTool-5USN4A6V.js → readDocTool-W4NDXNEX.js} +5 -3
- package/{readlineWorkspace-74TXXSLO.js → readlineWorkspace-MCNBLA56.js} +2449 -2022
- package/{removeDialogAgentAction-IX3MN2ZO.js → removeDialogAgentAction-BVAWQKXE.js} +17 -19
- package/{runAgentClientLoop-37BXJD62.js → runAgentClientLoop-XDPBFXV2.js} +61 -58
- package/{runtimeDoctorCommands-X6WDBEQX.js → runtimeDoctorCommands-3USD722U.js} +3 -3
- package/runtimeModeArgs-2Y7BALTO.js +31 -0
- package/{setDialogExtraReferencesAction-X4HCPNZL.js → setDialogExtraReferencesAction-LYY45IAD.js} +12 -11
- package/{setPrimaryDialogAgentAction-4GMIQLOD.js → setPrimaryDialogAgentAction-73IL7DLU.js} +18 -20
- package/{settingSlice-ZQZVUPKK.js → settingSlice-Q6EKL7EQ.js} +9 -9
- package/{skillDiscovery-CYUCJMAG.js → skillDiscovery-ZBU76COE.js} +3 -3
- package/{spaceCommands-P3ONT6LL.js → spaceCommands-BYDGOMW7.js} +44 -40
- package/{streamAgentChatTurn-FGXQXALU.js → streamAgentChatTurn-BBH3QDEZ.js} +183 -91
- package/{switchDialogAgentAction-N52LRPA3.js → switchDialogAgentAction-UUXDSQ6X.js} +15 -17
- package/{tableCommands-O6NWHFKV.js → tableCommands-G7RV3RU3.js} +4 -4
- package/{toolApiClient-QVJ6HDNN.js → toolApiClient-INIQCPGY.js} +3 -3
- package/{tools-R5UF2KZO.js → tools-OQWSBQJA.js} +54 -51
- package/{tuiSummaryLlmCaller-T2SHYMDZ.js → tuiSummaryLlmCaller-74NRRLVW.js} +18 -16
- package/{updateCommands-2M74UL7P.js → updateCommands-4EHDLF5J.js} +3 -3
- package/{updateDialogTitleAction-RTADGV7A.js → updateDialogTitleAction-E25IG3J3.js} +81 -43
- package/agentRecordCommands-SIPURU2S.js +0 -128
- package/chunk-FOWEGIMF.js +0 -18881
- package/chunk-M76ECQRD.js +0 -13658
- package/chunk-Q5FJJ6XI.js +0 -103
- package/chunk-S7Z2HMCN.js +0 -25
- package/{chunk-VMFTFOWF.js → chunk-3AH7LNUB.js} +7 -7
- package/{chunk-X7HHHIOZ.js → chunk-Y6ROFCZO.js} +0 -0
- 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-
|
|
41
|
+
} from "./chunk-27ONFIEY.js";
|
|
39
42
|
import {
|
|
40
|
-
clipCompactText,
|
|
41
43
|
isMeaningfulChatCompletionOutput,
|
|
42
44
|
isMeaningfulResponsesOutput
|
|
43
|
-
} from "./chunk-
|
|
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-
|
|
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
|
+
};
|