@anuma/sdk 6.33.2 → 6.35.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.
@@ -18315,7 +18315,7 @@ async function embedOne(text12, options, outer) {
18315
18315
  }
18316
18316
  var DEFAULT_EMBEDDING_BATCH_SIZE = 100;
18317
18317
  var DEFAULT_EMBEDDING_BATCH_CONCURRENCY = 3;
18318
- async function generateEmbeddingsBatch(texts, headers, baseUrl, model, onUsage, maskInput, timeoutMs) {
18318
+ async function generateEmbeddingsBatch(texts, headers, baseUrl, model, onUsage, maskInput, timeoutMs, outer) {
18319
18319
  const response = await withEmbeddingRetry(
18320
18320
  () => withDeadline(
18321
18321
  (signal) => postApiV1Embeddings({
@@ -18325,8 +18325,10 @@ async function generateEmbeddingsBatch(texts, headers, baseUrl, model, onUsage,
18325
18325
  ...signal && { signal }
18326
18326
  }),
18327
18327
  timeoutMs,
18328
- "embedding batch request"
18329
- )
18328
+ "embedding batch request",
18329
+ outer
18330
+ ),
18331
+ outer
18330
18332
  );
18331
18333
  if (response.error) {
18332
18334
  throw embeddingErrorFrom(response);
@@ -18344,6 +18346,11 @@ async function generateEmbeddingsBatch(texts, headers, baseUrl, model, onUsage,
18344
18346
  }
18345
18347
  async function generateEmbeddings(texts, options) {
18346
18348
  if (texts.length === 0) return [];
18349
+ const total = options.totalTimeoutMs;
18350
+ if (total === void 0) return embedMany(texts, options, void 0);
18351
+ return withDeadline((signal) => embedMany(texts, options, signal), total, "embedding batch");
18352
+ }
18353
+ async function embedMany(texts, options, outer) {
18347
18354
  const { baseUrl = BASE_URL, model, batchSize, cache } = options;
18348
18355
  const timeoutMs = options.timeoutMs ?? DEFAULT_EMBEDDING_REQUEST_TIMEOUT_MS;
18349
18356
  const chunkSize = batchSize ?? DEFAULT_EMBEDDING_BATCH_SIZE;
@@ -18364,7 +18371,8 @@ async function generateEmbeddings(texts, options) {
18364
18371
  if (uncachedTexts.length === 0) {
18365
18372
  return results;
18366
18373
  }
18367
- const headers = await resolveAuthHeaders(options);
18374
+ const headers = await resolveAuthHeaders(options, outer);
18375
+ if (outer?.aborted) throw outer.reason;
18368
18376
  const embeddingModel = model ?? DEFAULT_API_EMBEDDING_MODEL;
18369
18377
  let newEmbeddings;
18370
18378
  if (uncachedTexts.length <= chunkSize) {
@@ -18375,7 +18383,8 @@ async function generateEmbeddings(texts, options) {
18375
18383
  embeddingModel,
18376
18384
  options.onUsage,
18377
18385
  options.maskInput,
18378
- timeoutMs
18386
+ timeoutMs,
18387
+ outer
18379
18388
  );
18380
18389
  } else {
18381
18390
  const chunks = [];
@@ -18386,6 +18395,7 @@ async function generateEmbeddings(texts, options) {
18386
18395
  let nextIndex = 0;
18387
18396
  const worker = async () => {
18388
18397
  while (nextIndex < chunks.length) {
18398
+ if (outer?.aborted) throw outer.reason;
18389
18399
  const idx = nextIndex++;
18390
18400
  allEmbeddings[idx] = await generateEmbeddingsBatch(
18391
18401
  chunks[idx],
@@ -18394,7 +18404,8 @@ async function generateEmbeddings(texts, options) {
18394
18404
  embeddingModel,
18395
18405
  options.onUsage,
18396
18406
  options.maskInput,
18397
- timeoutMs
18407
+ timeoutMs,
18408
+ outer
18398
18409
  );
18399
18410
  }
18400
18411
  };
@@ -18405,6 +18416,7 @@ async function generateEmbeddings(texts, options) {
18405
18416
  await Promise.all(workers);
18406
18417
  newEmbeddings = allEmbeddings.flat();
18407
18418
  }
18419
+ if (outer?.aborted) throw outer.reason;
18408
18420
  for (let i = 0; i < uncachedIndices.length; i++) {
18409
18421
  const f32Embedding = Float32Array.from(newEmbeddings[i]);
18410
18422
  results[uncachedIndices[i]] = Array.from(f32Embedding);
@@ -23721,6 +23733,15 @@ __decorateClass([
23721
23733
  __decorateClass([
23722
23734
  (0, import_decorators6.text)("scope")
23723
23735
  ], VaultMemory.prototype, "scope", 2);
23736
+ __decorateClass([
23737
+ (0, import_decorators6.field)("kind")
23738
+ ], VaultMemory.prototype, "kind", 2);
23739
+ __decorateClass([
23740
+ (0, import_decorators6.field)("kind_value")
23741
+ ], VaultMemory.prototype, "kindValue", 2);
23742
+ __decorateClass([
23743
+ (0, import_decorators6.field)("level")
23744
+ ], VaultMemory.prototype, "level", 2);
23724
23745
  __decorateClass([
23725
23746
  (0, import_decorators6.field)("folder_id")
23726
23747
  ], VaultMemory.prototype, "folderId", 2);
@@ -23946,7 +23967,7 @@ __decorateClass([
23946
23967
  ], VaultFolder.prototype, "context", 2);
23947
23968
 
23948
23969
  // src/lib/db/schema.ts
23949
- var SDK_SCHEMA_VERSION = 47;
23970
+ var SDK_SCHEMA_VERSION = 48;
23950
23971
  var sdkSchema = (0, import_watermelondb15.appSchema)({
23951
23972
  version: SDK_SCHEMA_VERSION,
23952
23973
  tables: [
@@ -24041,6 +24062,9 @@ var sdkSchema = (0, import_watermelondb15.appSchema)({
24041
24062
  columns: [
24042
24063
  { name: "content", type: "string" },
24043
24064
  { name: "scope", type: "string", isIndexed: true },
24065
+ { name: "kind", type: "string", isOptional: true, isIndexed: true },
24066
+ { name: "kind_value", type: "string", isOptional: true },
24067
+ { name: "level", type: "string", isOptional: true, isIndexed: true },
24044
24068
  { name: "folder_id", type: "string", isOptional: true, isIndexed: true },
24045
24069
  { name: "created_at", type: "number", isIndexed: true },
24046
24070
  { name: "updated_at", type: "number", isIndexed: true },
@@ -24717,6 +24741,22 @@ var sdkMigrations = (0, import_migrations.schemaMigrations)({
24717
24741
  ]
24718
24742
  })
24719
24743
  ]
24744
+ },
24745
+ {
24746
+ toVersion: 48,
24747
+ steps: [
24748
+ (0, import_migrations.addColumns)({
24749
+ table: "memory_vault",
24750
+ columns: [
24751
+ { name: "kind", type: "string", isOptional: true, isIndexed: true },
24752
+ { name: "kind_value", type: "string", isOptional: true },
24753
+ { name: "level", type: "string", isOptional: true, isIndexed: true }
24754
+ ]
24755
+ }),
24756
+ (0, import_migrations.unsafeExecuteSql)(
24757
+ "UPDATE memory_vault SET level = CASE WHEN scope IN ('shared', 'public') THEN 'matching' ELSE 'private' END WHERE level IS NULL;"
24758
+ )
24759
+ ]
24720
24760
  }
24721
24761
  ]
24722
24762
  });
@@ -25868,13 +25908,54 @@ async function decryptVaultMemoryFields(memory, address, signMessage, embeddedWa
25868
25908
  }
25869
25909
  }
25870
25910
  const decryptedContent = await decryptField(memory.content, address);
25911
+ const decryptedKindValue = typeof memory.kindValue === "string" ? await decryptField(memory.kindValue, address) : memory.kindValue;
25871
25912
  return {
25872
25913
  ...memory,
25873
- content: decryptedContent
25914
+ content: decryptedContent,
25915
+ ...decryptedKindValue !== void 0 && { kindValue: decryptedKindValue }
25874
25916
  };
25875
25917
  }
25876
25918
 
25877
25919
  // src/lib/db/memoryVault/types.ts
25920
+ var MEMORY_KINDS = [
25921
+ "display_name",
25922
+ "birth_date",
25923
+ "bio",
25924
+ "occupation",
25925
+ "interest",
25926
+ "gender",
25927
+ "height_cm",
25928
+ "looking_for",
25929
+ "politics",
25930
+ "religion",
25931
+ "ethnicity",
25932
+ "smoking",
25933
+ "drinking",
25934
+ "exercise",
25935
+ "sexuality",
25936
+ "prompt"
25937
+ ];
25938
+ var MEMORY_LEVELS = ["private", "matching", "profile"];
25939
+ var MemoryLevelError = class extends Error {
25940
+ constructor(message) {
25941
+ super(message);
25942
+ this.name = "MemoryLevelError";
25943
+ }
25944
+ };
25945
+ var PUBLISHED_SCOPES = /* @__PURE__ */ new Set(["shared", "public"]);
25946
+ function levelFromScope(scope) {
25947
+ return typeof scope === "string" && PUBLISHED_SCOPES.has(scope) ? "matching" : "private";
25948
+ }
25949
+ function scopeForLevel(level) {
25950
+ return level === "private" ? "private" : "shared";
25951
+ }
25952
+ function resolveMemoryLevel(level, scope) {
25953
+ return typeof level === "string" && MEMORY_LEVELS.includes(level) ? level : levelFromScope(scope);
25954
+ }
25955
+ function levelForScopeChange(current, nextScope) {
25956
+ const implied = levelFromScope(nextScope);
25957
+ return implied === "matching" && resolveMemoryLevel(current.level, current.scope) === "profile" ? "profile" : implied;
25958
+ }
25878
25959
  function parseMedia(value) {
25879
25960
  if (typeof value !== "string" || value === "") return null;
25880
25961
  try {
@@ -25904,6 +25985,56 @@ function visibilityConditions(requested) {
25904
25985
  if (excluded.length === 0) return [];
25905
25986
  return [import_watermelondb19.Q.or(import_watermelondb19.Q.where("visibility", null), import_watermelondb19.Q.where("visibility", import_watermelondb19.Q.notIn(excluded)))];
25906
25987
  }
25988
+ function isKinded(record) {
25989
+ return record.kind !== null && record.kind !== void 0;
25990
+ }
25991
+ function assertValidKindLevel(kind, level) {
25992
+ const hasKind = kind !== null && kind !== void 0;
25993
+ if (hasKind && !MEMORY_KINDS.includes(kind)) {
25994
+ throw new MemoryLevelError(`Unknown memory kind: ${kind}`);
25995
+ }
25996
+ if (level !== void 0 && !MEMORY_LEVELS.includes(level)) {
25997
+ throw new MemoryLevelError(`Unknown memory level: ${level}`);
25998
+ }
25999
+ if (level === "profile" && !hasKind) {
26000
+ throw new MemoryLevelError("Only a memory with a kind can be at level 'profile'");
26001
+ }
26002
+ }
26003
+ function resolveCreateLevel(opts) {
26004
+ if (opts.level !== void 0) return { level: opts.level, scope: scopeForLevel(opts.level) };
26005
+ if (opts.scope !== void 0) return { level: levelFromScope(opts.scope), scope: opts.scope };
26006
+ return { level: "private", scope: "private" };
26007
+ }
26008
+ async function encryptKindValue(ctx, value) {
26009
+ if (typeof value !== "string" || !ctx.walletAddress || !ctx.signMessage) return value;
26010
+ return encryptVaultMemoryContent(
26011
+ value,
26012
+ ctx.walletAddress,
26013
+ ctx.signMessage,
26014
+ ctx.embeddedWalletSigner
26015
+ );
26016
+ }
26017
+ function levelConditions(requested) {
26018
+ if (!requested?.length) return [];
26019
+ const published = ["shared", "public"];
26020
+ const wantsMatching = requested.includes("matching");
26021
+ const wantsPrivate = requested.includes("private");
26022
+ const unresolved = import_watermelondb19.Q.or(import_watermelondb19.Q.where("level", null), import_watermelondb19.Q.where("level", import_watermelondb19.Q.notIn([...MEMORY_LEVELS])));
26023
+ const byLevel = import_watermelondb19.Q.where("level", import_watermelondb19.Q.oneOf([...requested]));
26024
+ if (wantsMatching && wantsPrivate) return [import_watermelondb19.Q.or(byLevel, unresolved)];
26025
+ if (wantsMatching) {
26026
+ return [import_watermelondb19.Q.or(byLevel, import_watermelondb19.Q.and(unresolved, import_watermelondb19.Q.where("scope", import_watermelondb19.Q.oneOf(published))))];
26027
+ }
26028
+ if (wantsPrivate) {
26029
+ return [
26030
+ import_watermelondb19.Q.or(
26031
+ byLevel,
26032
+ import_watermelondb19.Q.and(unresolved, import_watermelondb19.Q.or(import_watermelondb19.Q.where("scope", null), import_watermelondb19.Q.where("scope", import_watermelondb19.Q.notIn(published))))
26033
+ )
26034
+ ];
26035
+ }
26036
+ return [byLevel];
26037
+ }
25907
26038
  function isOwnedByCtxUser(ctx, record) {
25908
26039
  return ctx.userId === void 0 || record.userId === ctx.userId;
25909
26040
  }
@@ -25947,6 +26078,9 @@ function vaultMemoryToStoredRaw(memory) {
25947
26078
  uniqueId: memory.id,
25948
26079
  content: memory.content,
25949
26080
  scope: memory.scope,
26081
+ kind: memory.kind ?? null,
26082
+ kindValue: memory.kindValue ?? null,
26083
+ level: resolveMemoryLevel(memory.level, memory.scope),
25950
26084
  folderId: memory.folderId ?? null,
25951
26085
  userId: memory.userId ?? null,
25952
26086
  embedding: memory.embedding ?? null,
@@ -25985,9 +26119,13 @@ async function vaultMemoryToStored(memory, walletAddress, signMessage, embeddedW
25985
26119
  }
25986
26120
  return raw;
25987
26121
  }
25988
- function populateNewVaultMemory(record, ctx, opts, encryptedContent) {
26122
+ function populateNewVaultMemory(record, ctx, opts, encryptedContent, encryptedKindValue) {
26123
+ const { level, scope } = resolveCreateLevel(opts);
25989
26124
  record._setRaw("content", encryptedContent);
25990
- record._setRaw("scope", opts.scope ?? "private");
26125
+ record._setRaw("scope", scope);
26126
+ record._setRaw("level", level);
26127
+ record._setRaw("kind", opts.kind ?? null);
26128
+ record._setRaw("kind_value", encryptedKindValue ?? null);
25991
26129
  record._setRaw("folder_id", opts.folderId ?? null);
25992
26130
  record._setRaw("user_id", ctx.userId ?? null);
25993
26131
  record._setRaw("is_deleted", false);
@@ -26021,6 +26159,8 @@ function populateNewVaultMemory(record, ctx, opts, encryptedContent) {
26021
26159
  }
26022
26160
  }
26023
26161
  async function createVaultMemoryOp(ctx, opts) {
26162
+ assertValidKindLevel(opts.kind, resolveCreateLevel(opts).level);
26163
+ const encryptedKindValue = await encryptKindValue(ctx, opts.kindValue);
26024
26164
  const encryptedContent = ctx.walletAddress && ctx.signMessage ? await encryptVaultMemoryContent(
26025
26165
  opts.content,
26026
26166
  ctx.walletAddress,
@@ -26031,13 +26171,15 @@ async function createVaultMemoryOp(ctx, opts) {
26031
26171
  if (ctx.canWrite && !await ctx.canWrite())
26032
26172
  throw new Error("Memory source is no longer eligible");
26033
26173
  return ctx.vaultMemoryCollection.create(
26034
- (record) => populateNewVaultMemory(record, ctx, opts, encryptedContent)
26174
+ (record) => populateNewVaultMemory(record, ctx, opts, encryptedContent, encryptedKindValue)
26035
26175
  );
26036
26176
  });
26037
26177
  return vaultMemoryToStored(created, ctx.walletAddress, ctx.signMessage, ctx.embeddedWalletSigner);
26038
26178
  }
26039
26179
  async function createSupersedingMemoryOp(ctx, opts, targetId) {
26040
26180
  if (!targetId) return { created: null, retired: false };
26181
+ assertValidKindLevel(opts.kind, resolveCreateLevel(opts).level);
26182
+ const encryptedKindValue = await encryptKindValue(ctx, opts.kindValue);
26041
26183
  const encryptedContent = ctx.walletAddress && ctx.signMessage ? await encryptVaultMemoryContent(
26042
26184
  opts.content,
26043
26185
  ctx.walletAddress,
@@ -26054,9 +26196,10 @@ async function createSupersedingMemoryOp(ctx, opts, targetId) {
26054
26196
  } catch {
26055
26197
  return;
26056
26198
  }
26057
- if (target.isDeleted || target.supersededBy || !isOwnedByCtxUser(ctx, target)) return;
26199
+ if (target.isDeleted || target.supersededBy || isKinded(target) || !isOwnedByCtxUser(ctx, target))
26200
+ return;
26058
26201
  createdRecord = await ctx.vaultMemoryCollection.create(
26059
- (record) => populateNewVaultMemory(record, ctx, opts, encryptedContent)
26202
+ (record) => populateNewVaultMemory(record, ctx, opts, encryptedContent, encryptedKindValue)
26060
26203
  );
26061
26204
  await target.update((r) => {
26062
26205
  r._setRaw("superseded_by", createdRecord.id);
@@ -26120,6 +26263,10 @@ async function getMemoriesByEventTimeOp(ctx, windowStart, windowEnd) {
26120
26263
  }
26121
26264
  async function createVaultMemoriesBatchOp(ctx, optionsArray) {
26122
26265
  if (optionsArray.length === 0) return [];
26266
+ for (const opts of optionsArray) assertValidKindLevel(opts.kind, resolveCreateLevel(opts).level);
26267
+ const encryptedKindValues = await Promise.all(
26268
+ optionsArray.map((opts) => encryptKindValue(ctx, opts.kindValue))
26269
+ );
26123
26270
  const encryptedContents = await Promise.all(
26124
26271
  optionsArray.map(async (opts) => {
26125
26272
  if (ctx.walletAddress && ctx.signMessage) {
@@ -26138,7 +26285,7 @@ async function createVaultMemoriesBatchOp(ctx, optionsArray) {
26138
26285
  throw new Error("Memory source is no longer eligible");
26139
26286
  const prepared = optionsArray.map(
26140
26287
  (opts, i) => ctx.vaultMemoryCollection.prepareCreate(
26141
- (record) => populateNewVaultMemory(record, ctx, opts, encryptedContents[i])
26288
+ (record) => populateNewVaultMemory(record, ctx, opts, encryptedContents[i], encryptedKindValues[i])
26142
26289
  )
26143
26290
  );
26144
26291
  await ctx.database.batch(...prepared);
@@ -26181,6 +26328,9 @@ function vaultMemoryRawToStoredRaw(raw) {
26181
26328
  uniqueId: raw.id,
26182
26329
  content: raw.content ?? "",
26183
26330
  scope: raw.scope ?? "",
26331
+ kind: raw.kind ?? null,
26332
+ kindValue: raw.kind_value ?? null,
26333
+ level: resolveMemoryLevel(raw.level, raw.scope),
26184
26334
  folderId: raw.folder_id ?? null,
26185
26335
  userId: raw.user_id ?? null,
26186
26336
  embedding: raw.embedding ?? null,
@@ -26224,6 +26374,8 @@ async function getAllVaultMemoriesOp(ctx, options) {
26224
26374
  ...baseVaultConditions(ctx, options),
26225
26375
  ...options?.scopes?.length ? [import_watermelondb19.Q.where("scope", import_watermelondb19.Q.oneOf(options.scopes))] : [],
26226
26376
  ...visibilityConditions(options?.visibility),
26377
+ ...levelConditions(options?.levels),
26378
+ ...options?.kinds?.length ? [import_watermelondb19.Q.where("kind", import_watermelondb19.Q.oneOf(options.kinds))] : [],
26227
26379
  ...options?.folderId !== void 0 ? [import_watermelondb19.Q.where("folder_id", options.folderId)] : [],
26228
26380
  ...options?.factTypes?.length ? [import_watermelondb19.Q.where("fact_type", import_watermelondb19.Q.oneOf(options.factTypes))] : [],
26229
26381
  import_watermelondb19.Q.sortBy(options?.since ? "updated_at" : "created_at", import_watermelondb19.Q.desc),
@@ -26390,6 +26542,14 @@ async function updateVaultMemoryOp(ctx, id, opts) {
26390
26542
  try {
26391
26543
  const probe = await ctx.vaultMemoryCollection.find(id);
26392
26544
  if (probe.isDeleted || probe.supersededBy || !isOwnedByCtxUser(ctx, probe)) return null;
26545
+ if (opts.freeFormOnly && isKinded(probe)) return null;
26546
+ const levelAfter = (current) => {
26547
+ if (opts.level !== void 0) return opts.level;
26548
+ if (opts.scope === void 0) return resolveMemoryLevel(current.level, current.scope);
26549
+ return levelForScopeChange(current, opts.scope);
26550
+ };
26551
+ assertValidKindLevel(opts.kind !== void 0 ? opts.kind : probe.kind, levelAfter(probe));
26552
+ const encryptedKindValue = await encryptKindValue(ctx, opts.kindValue);
26393
26553
  const encryptedContent = ctx.walletAddress && ctx.signMessage ? await encryptVaultMemoryContent(
26394
26554
  opts.content,
26395
26555
  ctx.walletAddress,
@@ -26402,10 +26562,13 @@ async function updateVaultMemoryOp(ctx, id, opts) {
26402
26562
  await ctx.database.write(async () => {
26403
26563
  if (ctx.canWrite && !await ctx.canWrite())
26404
26564
  throw new Error("Memory source is no longer eligible");
26405
- if (record.isDeleted || record.supersededBy || !isOwnedByCtxUser(ctx, record)) {
26565
+ if (record.isDeleted || record.supersededBy || !isOwnedByCtxUser(ctx, record) || opts.freeFormOnly && isKinded(record)) {
26406
26566
  stale = true;
26407
26567
  return;
26408
26568
  }
26569
+ const nextKind = opts.kind !== void 0 ? opts.kind : record.kind;
26570
+ const nextLevel = levelAfter(record);
26571
+ assertValidKindLevel(nextKind, nextLevel);
26409
26572
  let observedSources = [];
26410
26573
  let replayedObservation = false;
26411
26574
  if (opts.observationSourceIds?.length) {
@@ -26419,8 +26582,18 @@ async function updateVaultMemoryOp(ctx, id, opts) {
26419
26582
  }
26420
26583
  await record.update((r) => {
26421
26584
  r._setRaw("content", encryptedContent);
26422
- if (opts.scope !== void 0) {
26585
+ if (opts.level !== void 0) {
26586
+ r._setRaw("level", nextLevel);
26587
+ r._setRaw("scope", scopeForLevel(nextLevel));
26588
+ } else if (opts.scope !== void 0) {
26423
26589
  r._setRaw("scope", opts.scope);
26590
+ r._setRaw("level", nextLevel);
26591
+ }
26592
+ if (opts.kind !== void 0) {
26593
+ r._setRaw("kind", opts.kind);
26594
+ }
26595
+ if (encryptedKindValue !== void 0) {
26596
+ r._setRaw("kind_value", encryptedKindValue);
26424
26597
  }
26425
26598
  if (opts.folderId !== void 0) {
26426
26599
  r._setRaw("folder_id", opts.folderId);
@@ -26479,7 +26652,8 @@ async function updateVaultMemoryOp(ctx, id, opts) {
26479
26652
  ctx.signMessage,
26480
26653
  ctx.embeddedWalletSigner
26481
26654
  );
26482
- } catch {
26655
+ } catch (err) {
26656
+ if (err instanceof MemoryLevelError) throw err;
26483
26657
  return null;
26484
26658
  }
26485
26659
  }
@@ -26615,6 +26789,7 @@ async function supersedeVaultMemoryOp(ctx, id, supersededById) {
26615
26789
  try {
26616
26790
  const record = await ctx.vaultMemoryCollection.find(id);
26617
26791
  if (record.isDeleted || record.supersededBy || !isOwnedByCtxUser(ctx, record)) return false;
26792
+ if (isKinded(record)) return false;
26618
26793
  let successor;
26619
26794
  try {
26620
26795
  successor = await ctx.vaultMemoryCollection.find(supersededById);
@@ -26915,7 +27090,10 @@ function assertVaultScopeForSweep(ctx) {
26915
27090
  }
26916
27091
  async function getDecayCandidatesRawOp(ctx) {
26917
27092
  assertVaultScopeForSweep(ctx);
26918
- const results = await ctx.vaultMemoryCollection.query(...baseVaultConditions(ctx, { includeArchived: true, includeQuarantined: true })).unsafeFetchRaw();
27093
+ const results = await ctx.vaultMemoryCollection.query(
27094
+ ...baseVaultConditions(ctx, { includeArchived: true, includeQuarantined: true }),
27095
+ import_watermelondb19.Q.where("kind", null)
27096
+ ).unsafeFetchRaw();
26919
27097
  return results.map((raw) => ({
26920
27098
  uniqueId: raw.id,
26921
27099
  factType: raw.fact_type ?? null,
@@ -27175,6 +27353,7 @@ async function ingestPublishedPhotoMemoriesOp(ctx, rows) {
27175
27353
  record._raw.id = row.memoryId;
27176
27354
  record._setRaw("content", content);
27177
27355
  record._setRaw("scope", "shared");
27356
+ record._setRaw("level", "matching");
27178
27357
  record._setRaw("folder_id", null);
27179
27358
  record._setRaw("user_id", ctx.userId ?? null);
27180
27359
  record._setRaw("is_deleted", false);
@@ -29876,7 +30055,7 @@ async function rankPreparedVaultCandidates(query, prepared, embeddingOptions, se
29876
30055
  if (useFusion && !embeddingsUnavailable && facetQueries) {
29877
30056
  let subEmbeddings;
29878
30057
  try {
29879
- subEmbeddings = await generateEmbeddings(facetQueries, embeddingOptions);
30058
+ subEmbeddings = prepared.facetEmbeddings ?? await generateEmbeddings(facetQueries, embeddingOptions);
29880
30059
  } catch (err) {
29881
30060
  getLogger().warn(
29882
30061
  "memoryVault: sub-query embedding failed \u2014 falling back to single-query ranking: " + (err instanceof Error ? err.message : String(err))
@@ -30061,6 +30240,35 @@ var DEFAULT_SCOPE = "private";
30061
30240
  var DEFAULT_CONSOLIDATE_THRESHOLD = 0.55;
30062
30241
  var DEFAULT_CONSOLIDATE_TOP_K = 20;
30063
30242
  async function retain(content, ctx, options = {}) {
30243
+ return retainWithPersistence(
30244
+ content,
30245
+ {
30246
+ embeddingOptions: ctx.embeddingOptions,
30247
+ vaultCache: ctx.vaultCache,
30248
+ persistence: {
30249
+ prepare: (query, searchOptions) => prepareVaultCandidates(
30250
+ query,
30251
+ ctx.vaultCtx,
30252
+ ctx.embeddingOptions,
30253
+ ctx.vaultCache,
30254
+ searchOptions
30255
+ ),
30256
+ get: (id) => getVaultMemoryOp(ctx.vaultCtx, id),
30257
+ tombstones: (_embedding, _model, scope, folderId) => getAllVaultMemoriesOp(ctx.vaultCtx, {
30258
+ includeDeleted: true,
30259
+ scopes: [scope],
30260
+ ...folderId !== void 0 && { folderId }
30261
+ }),
30262
+ create: (input) => createVaultMemoryOp(ctx.vaultCtx, input),
30263
+ update: (id, patch) => updateVaultMemoryOp(ctx.vaultCtx, id, patch),
30264
+ supersede: (id, successor) => supersedeVaultMemoryOp(ctx.vaultCtx, id, successor),
30265
+ createSuperseding: (input, target) => createSupersedingMemoryOp(ctx.vaultCtx, input, target)
30266
+ }
30267
+ },
30268
+ options
30269
+ );
30270
+ }
30271
+ async function retainWithPersistence(content, ctx, options = {}) {
30064
30272
  const trimmed = content.trim();
30065
30273
  if (trimmed.length === 0) {
30066
30274
  throw new Error("retain: content cannot be empty");
@@ -30073,19 +30281,14 @@ async function retain(content, ctx, options = {}) {
30073
30281
  let supersedeContent;
30074
30282
  let prepared;
30075
30283
  if (enableAutoMerge) {
30076
- prepared = await prepareVaultCandidates(
30077
- trimmed,
30078
- ctx.vaultCtx,
30079
- ctx.embeddingOptions,
30080
- ctx.vaultCache,
30081
- {
30082
- limit: Math.max(options.consolidateTopK ?? DEFAULT_CONSOLIDATE_TOP_K, 1),
30083
- useFusion: false,
30084
- scopes: [resolvedScope],
30085
- includeArchived: true,
30086
- ...options.folderId !== void 0 && { folderId: options.folderId }
30087
- }
30088
- );
30284
+ prepared = await ctx.persistence.prepare(trimmed, {
30285
+ limit: Math.max(options.consolidateTopK ?? DEFAULT_CONSOLIDATE_TOP_K, 1),
30286
+ useFusion: false,
30287
+ scopes: [resolvedScope],
30288
+ includeArchived: true,
30289
+ ...options.folderId !== void 0 && { folderId: options.folderId }
30290
+ });
30291
+ prepared = withoutKindedRows(prepared);
30089
30292
  if (prepared.embeddingFailure || prepared.embeddingsUnavailable) {
30090
30293
  throw new Error(
30091
30294
  "retain: embeddings unavailable \u2014 refusing to auto-merge against an inert cosine lane, which would create a duplicate instead of merging into the existing memory. Retry when embeddings recover, or pass enableAutoMerge: false to force a create."
@@ -30116,7 +30319,7 @@ async function retain(content, ctx, options = {}) {
30116
30319
  );
30117
30320
  if (matches.length > 0) {
30118
30321
  const targetId = matches[0].uniqueId;
30119
- const existing = await getVaultMemoryOp(ctx.vaultCtx, targetId);
30322
+ const existing = await ctx.persistence.get(targetId);
30120
30323
  if (existing && !existing.supersededBy) {
30121
30324
  const mergedSourceIds = unionStrings(
30122
30325
  existing.sourceChunkIds ?? [],
@@ -30125,8 +30328,9 @@ async function retain(content, ctx, options = {}) {
30125
30328
  const eventTimeUpdate = pickEventTimeUpdate(existing, options.eventTime);
30126
30329
  const factTypeUpdate = pickFactTypeUpdate(existing, options.factType);
30127
30330
  const resurrect = resurrectFields(existing);
30128
- const updated = await updateVaultMemoryOp(ctx.vaultCtx, targetId, {
30331
+ const updated = await ctx.persistence.update(targetId, {
30129
30332
  content: existing.content,
30333
+ freeFormOnly: true,
30130
30334
  proofCountIncrement: 1,
30131
30335
  observationSourceIds: options.sourceChunkIds,
30132
30336
  sourceChunkIds: mergedSourceIds,
@@ -30152,7 +30356,8 @@ async function retain(content, ctx, options = {}) {
30152
30356
  }
30153
30357
  const contentToWrite = supersedeContent ?? trimmed;
30154
30358
  const reusableQueryEmbedding = supersedeContent === void 0 && prepared && prepared.queryEmbedding.length > 0 ? prepared.queryEmbedding : void 0;
30155
- const embedding = reusableQueryEmbedding ?? await generateEmbedding(contentToWrite, ctx.embeddingOptions);
30359
+ const generatedEmbedding = reusableQueryEmbedding ?? await generateEmbedding(contentToWrite, ctx.embeddingOptions);
30360
+ const embedding = ctx.normalizeEmbedding?.(generatedEmbedding) ?? generatedEmbedding;
30156
30361
  const embeddingModel = ctx.embeddingOptions.model ?? DEFAULT_API_EMBEDDING_MODEL;
30157
30362
  if (options.respectTombstones) {
30158
30363
  const tombstone = await findTombstoneMatch(embedding, embeddingModel, resolvedScope, ctx, {
@@ -30192,8 +30397,7 @@ async function retain(content, ctx, options = {}) {
30192
30397
  };
30193
30398
  if (supersedeTargetIds.length > 0) {
30194
30399
  const [primaryTargetId, ...restTargetIds] = supersedeTargetIds;
30195
- const { created: created2, retired } = await createSupersedingMemoryOp(
30196
- ctx.vaultCtx,
30400
+ const { created: created2, retired } = await ctx.persistence.createSuperseding(
30197
30401
  createOpts,
30198
30402
  primaryTargetId
30199
30403
  );
@@ -30209,11 +30413,11 @@ async function retain(content, ctx, options = {}) {
30209
30413
  for (const staleId of restTargetIds) {
30210
30414
  let ok = false;
30211
30415
  try {
30212
- ok = await supersedeVaultMemoryOp(ctx.vaultCtx, staleId, created2.uniqueId) === true;
30416
+ ok = await ctx.persistence.supersede(staleId, created2.uniqueId) === true;
30213
30417
  } catch {
30214
30418
  }
30215
30419
  if (ok) continue;
30216
- const stillLive = await getVaultMemoryOp(ctx.vaultCtx, staleId).catch(() => null);
30420
+ const stillLive = await (ctx.persistence.getFresh ? ctx.persistence.getFresh(staleId) : ctx.persistence.get(staleId)).catch(() => null);
30217
30421
  if (stillLive && !stillLive.supersededBy) liveLeftovers.push(staleId);
30218
30422
  }
30219
30423
  if (liveLeftovers.length > 0) {
@@ -30240,7 +30444,7 @@ async function retain(content, ctx, options = {}) {
30240
30444
  `supersede: primary target ${primaryTargetId} retired or deleted inside the atomic write`
30241
30445
  );
30242
30446
  }
30243
- const created = await createVaultMemoryOp(ctx.vaultCtx, createOpts);
30447
+ const created = await ctx.persistence.create(createOpts);
30244
30448
  cacheRowVector(
30245
30449
  ctx.vaultCache,
30246
30450
  created.uniqueId,
@@ -30255,15 +30459,22 @@ async function retain(content, ctx, options = {}) {
30255
30459
  ...consolidationDecidedCreate && { consolidation: "create" }
30256
30460
  };
30257
30461
  }
30462
+ function withoutKindedRows(prepared) {
30463
+ const kinded = new Set(
30464
+ prepared.memories.filter((m) => m.kind !== null && m.kind !== void 0).map((m) => m.uniqueId)
30465
+ );
30466
+ if (kinded.size === 0) return prepared;
30467
+ return {
30468
+ ...prepared,
30469
+ memories: prepared.memories.filter((m) => !kinded.has(m.uniqueId)),
30470
+ embeddedItems: prepared.embeddedItems.filter((item) => !kinded.has(item.id))
30471
+ };
30472
+ }
30258
30473
  function unionStrings(a, b) {
30259
30474
  return [.../* @__PURE__ */ new Set([...a, ...b])];
30260
30475
  }
30261
30476
  async function findTombstoneMatch(embedding, embeddingModel, scope, ctx, opts) {
30262
- const rows = await getAllVaultMemoriesOp(ctx.vaultCtx, {
30263
- includeDeleted: true,
30264
- scopes: [scope],
30265
- ...opts.folderId !== void 0 && { folderId: opts.folderId }
30266
- });
30477
+ const rows = await ctx.persistence.tombstones(embedding, embeddingModel, scope, opts.folderId);
30267
30478
  let bestId = null;
30268
30479
  let bestSim = opts.threshold;
30269
30480
  for (const row of rows) {
@@ -30330,7 +30541,7 @@ async function tryConsolidate(trimmed, ctx, options, prepared) {
30330
30541
  if (requestedIds.length === 0) return null;
30331
30542
  const valid = [];
30332
30543
  for (const id of requestedIds) {
30333
- const existing = await getVaultMemoryOp(ctx.vaultCtx, id);
30544
+ const existing = await ctx.persistence.get(id);
30334
30545
  if (existing && !existing.supersededBy) valid.push(id);
30335
30546
  }
30336
30547
  if (valid.length === 0) {
@@ -30342,7 +30553,7 @@ async function tryConsolidate(trimmed, ctx, options, prepared) {
30342
30553
  return { supersede: valid, content: decision.content };
30343
30554
  }
30344
30555
  if (decision.action === "noop" && decision.targetId) {
30345
- const existing = await getVaultMemoryOp(ctx.vaultCtx, decision.targetId);
30556
+ const existing = await ctx.persistence.get(decision.targetId);
30346
30557
  if (!existing || existing.supersededBy) {
30347
30558
  return abandonToRace(
30348
30559
  options,
@@ -30356,8 +30567,9 @@ async function tryConsolidate(trimmed, ctx, options, prepared) {
30356
30567
  const eventTimeUpdate = pickEventTimeUpdate(existing, options.eventTime);
30357
30568
  const factTypeUpdate = pickFactTypeUpdate(existing, options.factType);
30358
30569
  const resurrect = resurrectFields(existing);
30359
- const updated = await updateVaultMemoryOp(ctx.vaultCtx, decision.targetId, {
30570
+ const updated = await ctx.persistence.update(decision.targetId, {
30360
30571
  content: existing.content,
30572
+ freeFormOnly: true,
30361
30573
  proofCountIncrement: 1,
30362
30574
  observationSourceIds: options.sourceChunkIds,
30363
30575
  sourceChunkIds: mergedSourceIds,
@@ -30384,7 +30596,7 @@ async function tryConsolidate(trimmed, ctx, options, prepared) {
30384
30596
  };
30385
30597
  }
30386
30598
  if (decision.action === "update" && decision.targetId && decision.content) {
30387
- const existing = await getVaultMemoryOp(ctx.vaultCtx, decision.targetId);
30599
+ const existing = await ctx.persistence.get(decision.targetId);
30388
30600
  if (!existing || existing.supersededBy) {
30389
30601
  return abandonToRace(
30390
30602
  options,
@@ -30395,13 +30607,15 @@ async function tryConsolidate(trimmed, ctx, options, prepared) {
30395
30607
  existing.sourceChunkIds ?? [],
30396
30608
  options.sourceChunkIds ?? []
30397
30609
  );
30398
- const newEmbedding = await generateEmbedding(decision.content, ctx.embeddingOptions);
30610
+ const generatedEmbedding = await generateEmbedding(decision.content, ctx.embeddingOptions);
30611
+ const newEmbedding = ctx.normalizeEmbedding?.(generatedEmbedding) ?? generatedEmbedding;
30399
30612
  const consolidatedModel = ctx.embeddingOptions.model ?? DEFAULT_API_EMBEDDING_MODEL;
30400
30613
  const eventTimeUpdate = pickEventTimeUpdate(existing, options.eventTime);
30401
30614
  const factTypeUpdate = pickFactTypeUpdate(existing, options.factType);
30402
30615
  const resurrect = resurrectFields(existing);
30403
- const updated = await updateVaultMemoryOp(ctx.vaultCtx, decision.targetId, {
30616
+ const updated = await ctx.persistence.update(decision.targetId, {
30404
30617
  content: decision.content,
30618
+ freeFormOnly: true,
30405
30619
  proofCountIncrement: 1,
30406
30620
  observationSourceIds: options.sourceChunkIds,
30407
30621
  sourceChunkIds: mergedSourceIds,
@@ -30444,8 +30658,8 @@ async function tryConsolidate(trimmed, ctx, options, prepared) {
30444
30658
  return null;
30445
30659
  }
30446
30660
  async function assertMergeTargetGoneOrThrow(ctx, targetId) {
30447
- const stillExists = await getVaultMemoryOp(ctx.vaultCtx, targetId);
30448
- if (stillExists) {
30661
+ const stillExists = await (ctx.persistence.getFresh ? ctx.persistence.getFresh(targetId) : ctx.persistence.get(targetId));
30662
+ if (stillExists && (stillExists.kind === null || stillExists.kind === void 0)) {
30449
30663
  throw new Error(`retain: merge into memory ${targetId} failed to persist`);
30450
30664
  }
30451
30665
  }
@@ -31930,7 +32144,7 @@ async function recall(query, ctx, options = {}) {
31930
32144
  if (graphLaneFailed) degraded.push("graph-lane-failed");
31931
32145
  if (temporalLaneFailed) degraded.push("temporal-lane-failed");
31932
32146
  if (chunksScopeRestricted) degraded.push("chunks-scope-restricted");
31933
- const laneRan = types.includes("fact") && !!ctx.vaultCtx && !!ctx.vaultCache || types.includes("chunk") && !!ctx.storageCtx || chunksScopeRestricted && !!ctx.storageCtx;
32147
+ const laneRan = types.includes("fact") && (!!ctx.factSource || !!ctx.vaultCtx && !!ctx.vaultCache) || types.includes("chunk") && !!ctx.storageCtx || chunksScopeRestricted && !!ctx.storageCtx;
31934
32148
  const scores = admitted.map((m) => m.score);
31935
32149
  const minScoreApplied = factResults.length > 0 ? factFloor : chunkResults.length > 0 ? chunkFloor : factFloor >= 0 ? factFloor : chunkFloor;
31936
32150
  const diagnostics = {
@@ -31972,7 +32186,7 @@ async function recall(query, ctx, options = {}) {
31972
32186
  return { memories: [], usedBudget, reranked: false, candidateCount: 0 };
31973
32187
  }
31974
32188
  const needsChunkEmbedding = types.includes("chunk") && ctx.storageCtx;
31975
- const wantsTemporal = types.includes("fact") && ctx.vaultCtx;
32189
+ const wantsTemporal = types.includes("fact") && (ctx.factSource || ctx.vaultCtx);
31976
32190
  const graphRefiner = flags.traverse && options.graphRefine && options.decomposeOptions ? createLlmNeighborRefiner(options.decomposeOptions) : void 0;
31977
32191
  const queryEmbedTotalTimeoutMs = options.queryEmbedTotalTimeoutMs ?? DEFAULT_QUERY_EMBED_TOTAL_TIMEOUT_MS;
31978
32192
  const prepStart = nowMs2();
@@ -32002,7 +32216,7 @@ async function recall(query, ctx, options = {}) {
32002
32216
  safeLane(
32003
32217
  "graph",
32004
32218
  () => graphLaneFailed = true,
32005
- () => buildGraphLaneRanking(query, ctx, flags.traverse, {
32219
+ () => ctx.factSource ? ctx.factSource.graphRanking(query, flags.traverse, options) : buildGraphLaneRanking(query, ctx, flags.traverse, {
32006
32220
  ...options.maxHops !== void 0 && { maxHops: options.maxHops },
32007
32221
  ...options.entityFanout !== void 0 && { entityFanout: options.entityFanout },
32008
32222
  ...options.nodeBudget !== void 0 && { nodeBudget: options.nodeBudget },
@@ -32013,13 +32227,13 @@ async function recall(query, ctx, options = {}) {
32013
32227
  wantsTemporal ? safeLane(
32014
32228
  "temporal",
32015
32229
  () => temporalLaneFailed = true,
32016
- () => buildTemporalLaneRanking(query, ctx.vaultCtx, options.now)
32230
+ () => ctx.factSource ? ctx.factSource.temporalRanking(query, options.now) : buildTemporalLaneRanking(query, ctx.vaultCtx, options.now)
32017
32231
  ) : Promise.resolve([])
32018
32232
  ]);
32019
32233
  prepMs = nowMs2() - prepStart;
32020
32234
  graphLaneCount = entityRanking.length;
32021
32235
  temporalLaneCount = temporalRanking.length;
32022
- if (types.includes("fact") && ctx.vaultCtx && ctx.vaultCache) {
32236
+ if (types.includes("fact") && (ctx.factSource || ctx.vaultCtx && ctx.vaultCache)) {
32023
32237
  const factStart = nowMs2();
32024
32238
  const vaultMinScore = options.minScore ?? DEFAULT_FACT_MIN_SCORE;
32025
32239
  factFloor = vaultMinScore;
@@ -32035,50 +32249,50 @@ async function recall(query, ctx, options = {}) {
32035
32249
  rankedOnCosine: factRankedOnCosine,
32036
32250
  decryptLast: factDecryptLast,
32037
32251
  rowsDecrypted: factRowsDecrypted
32038
- } = await searchVaultMemoriesWithSize(
32039
- query,
32252
+ } = await (ctx.factSource?.search.bind(ctx.factSource) ?? ((searchQuery, searchOptions) => searchVaultMemoriesWithSize(
32253
+ searchQuery,
32040
32254
  ctx.vaultCtx,
32041
32255
  ctx.embeddingOptions,
32042
32256
  ctx.vaultCache,
32043
- {
32044
- limit: types.includes("chunk") ? Math.max(limit * 2, 16) : limit,
32045
- minSimilarity: vaultMinScore,
32046
- useFusion: true,
32047
- rerank: flags.rerank,
32048
- ...options.rerankTopN !== void 0 && { rerankTopN: options.rerankTopN },
32049
- ...options.ceWeight !== void 0 && { ceWeight: options.ceWeight },
32050
- ...options.rerankLoadTimeoutMs !== void 0 && {
32051
- rerankLoadTimeoutMs: options.rerankLoadTimeoutMs
32052
- },
32053
- ...options.recencyAlpha !== void 0 && { recencyAlpha: options.recencyAlpha },
32054
- ...options.recency && { recency: options.recency },
32055
- ...options.mmr !== void 0 && { mmr: options.mmr },
32056
- ...options.supersessionBoost !== void 0 && {
32057
- supersessionBoost: options.supersessionBoost
32058
- },
32059
- ...options.supersessionWindow !== void 0 && {
32060
- supersessionWindow: options.supersessionWindow
32061
- },
32062
- ...options.proofCountAlpha !== void 0 && {
32063
- proofCountAlpha: options.proofCountAlpha
32064
- },
32065
- ...options.bm25AdmissionDivisor !== void 0 && {
32066
- bm25AdmissionDivisor: options.bm25AdmissionDivisor
32067
- },
32068
- ...options.rrfK !== void 0 && { rrfK: options.rrfK },
32069
- ...options.decryptLast !== void 0 && { decryptLast: options.decryptLast },
32070
- ...subQueries && { subQueries },
32071
- ...options.scopes && { scopes: options.scopes },
32072
- ...options.folderId !== void 0 && { folderId: options.folderId },
32073
- ...options.factTypes?.length && { factTypes: options.factTypes },
32074
- ...options.memoryIds !== void 0 && { memoryIds: options.memoryIds },
32075
- ...options.factTypeWeights && { factTypeWeights: options.factTypeWeights },
32076
- ...entityRanking.length > 0 && { entityRanking },
32077
- ...temporalRanking.length > 0 && { temporalRanking },
32078
- ...needsChunkEmbedding && { queryEmbedding: queryEmbedding ?? [] },
32079
- queryEmbedTotalTimeoutMs
32080
- }
32081
- );
32257
+ searchOptions
32258
+ )))(query, {
32259
+ limit: types.includes("chunk") ? Math.max(limit * 2, 16) : limit,
32260
+ minSimilarity: vaultMinScore,
32261
+ useFusion: true,
32262
+ rerank: flags.rerank,
32263
+ ...options.rerankTopN !== void 0 && { rerankTopN: options.rerankTopN },
32264
+ ...options.ceWeight !== void 0 && { ceWeight: options.ceWeight },
32265
+ ...options.rerankLoadTimeoutMs !== void 0 && {
32266
+ rerankLoadTimeoutMs: options.rerankLoadTimeoutMs
32267
+ },
32268
+ ...options.recencyAlpha !== void 0 && { recencyAlpha: options.recencyAlpha },
32269
+ ...options.recency && { recency: options.recency },
32270
+ ...options.mmr !== void 0 && { mmr: options.mmr },
32271
+ ...options.supersessionBoost !== void 0 && {
32272
+ supersessionBoost: options.supersessionBoost
32273
+ },
32274
+ ...options.supersessionWindow !== void 0 && {
32275
+ supersessionWindow: options.supersessionWindow
32276
+ },
32277
+ ...options.proofCountAlpha !== void 0 && {
32278
+ proofCountAlpha: options.proofCountAlpha
32279
+ },
32280
+ ...options.bm25AdmissionDivisor !== void 0 && {
32281
+ bm25AdmissionDivisor: options.bm25AdmissionDivisor
32282
+ },
32283
+ ...options.rrfK !== void 0 && { rrfK: options.rrfK },
32284
+ ...options.decryptLast !== void 0 && { decryptLast: options.decryptLast },
32285
+ ...subQueries && { subQueries },
32286
+ ...options.scopes && { scopes: options.scopes },
32287
+ ...options.folderId !== void 0 && { folderId: options.folderId },
32288
+ ...options.factTypes?.length && { factTypes: options.factTypes },
32289
+ ...options.memoryIds !== void 0 && { memoryIds: options.memoryIds },
32290
+ ...options.factTypeWeights && { factTypeWeights: options.factTypeWeights },
32291
+ ...entityRanking.length > 0 && { entityRanking },
32292
+ ...temporalRanking.length > 0 && { temporalRanking },
32293
+ ...needsChunkEmbedding && { queryEmbedding: queryEmbedding ?? [] },
32294
+ queryEmbedTotalTimeoutMs
32295
+ });
32082
32296
  factResults.push(
32083
32297
  ...dedupeBy(
32084
32298
  results,
@@ -36811,7 +37025,10 @@ export {
36811
37025
  MAX_HOPS,
36812
37026
  MAX_MESSAGES_PER_SUMMARIZATION,
36813
37027
  MEDIUM_TTL_MS,
37028
+ MEMORY_KINDS,
37029
+ MEMORY_LEVELS,
36814
37030
  Media,
37031
+ MemoryLevelError,
36815
37032
  Message,
36816
37033
  ModelPreference,
36817
37034
  NEVER_TTL_MS,