@anuma/sdk 10.2.5 → 10.3.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.
@@ -982,11 +982,11 @@ async function requestPortalJson(req, endpoint, controller, deadlineAt) {
982
982
  let value;
983
983
  try {
984
984
  value = JSON.parse(candidate);
985
- } catch (err) {
985
+ } catch {
986
986
  return {
987
987
  kind: "retryable",
988
988
  code: "invalid-json",
989
- reason: `completion was not valid JSON: ${err.message}`
989
+ reason: "invalid-json"
990
990
  };
991
991
  }
992
992
  if (value === null) {
@@ -4,7 +4,7 @@ import {
4
4
  notifyConsolidationFallback,
5
5
  requiresResponsesTransport,
6
6
  resolvePiiRedactor
7
- } from "./chunk-ZIN4E7MR.mjs";
7
+ } from "./chunk-4SOUKJD5.mjs";
8
8
  import "./chunk-GYKJOWEO.mjs";
9
9
 
10
10
  // src/lib/memory/consolidate.ts
@@ -1073,11 +1073,11 @@ async function requestPortalJson(req, endpoint, controller, deadlineAt) {
1073
1073
  let value;
1074
1074
  try {
1075
1075
  value = JSON.parse(candidate);
1076
- } catch (err) {
1076
+ } catch {
1077
1077
  return {
1078
1078
  kind: "retryable",
1079
1079
  code: "invalid-json",
1080
- reason: `completion was not valid JSON: ${err.message}`
1080
+ reason: "invalid-json"
1081
1081
  };
1082
1082
  }
1083
1083
  if (value === null) {
@@ -13524,6 +13524,25 @@ async function migrateChatsToRemote(options) {
13524
13524
  // src/lib/chatStore/vaultBackend.ts
13525
13525
  var import_uuid3 = require("uuid");
13526
13526
 
13527
+ // src/lib/chatStore/vaultCache.ts
13528
+ async function saveChatCache(storage, encrypt, snapshot) {
13529
+ await storage.set(snapshot.account, await encrypt(JSON.stringify({ schema: 1, ...snapshot })));
13530
+ }
13531
+ async function loadChatCache(storage, account, decrypt) {
13532
+ const sealed2 = await storage.get(account);
13533
+ if (!sealed2) return void 0;
13534
+ const parsed = JSON.parse(await decrypt(sealed2));
13535
+ if (parsed.schema !== 1 || parsed.account !== account || typeof parsed.cursor !== "string" || !Array.isArray(parsed.records) || !Array.isArray(parsed.threads) || !Array.isArray(parsed.absent))
13536
+ return void 0;
13537
+ return {
13538
+ account,
13539
+ cursor: parsed.cursor,
13540
+ records: parsed.records,
13541
+ threads: parsed.threads,
13542
+ absent: parsed.absent
13543
+ };
13544
+ }
13545
+
13527
13546
  // src/lib/chatStore/vaultOutbox.ts
13528
13547
  function patchKey(patch) {
13529
13548
  return `${patch.kind}/${patch.id}`;
@@ -13628,6 +13647,10 @@ async function loadOutbox(storage, slot, decrypt) {
13628
13647
 
13629
13648
  // src/lib/chatStore/vaultBackend.ts
13630
13649
  var terminalCodes = /* @__PURE__ */ new Set(["key_mismatch", "account_changed", "account_not_found"]);
13650
+ var cacheSaveDelayMs = 500;
13651
+ function cursorRejected(error) {
13652
+ return error instanceof ChatStoreError && (error.status === 400 || error.status === 410);
13653
+ }
13631
13654
  function key2(kind, id2) {
13632
13655
  return `${kind}/${id2}`;
13633
13656
  }
@@ -13672,7 +13695,7 @@ function defaultActivity() {
13672
13695
  };
13673
13696
  }
13674
13697
  function createVaultChatBackend(options) {
13675
- const { store } = options;
13698
+ const { cache } = options;
13676
13699
  const now = options.now ?? Date.now;
13677
13700
  const threadLimit = options.threadCacheSize ?? 30;
13678
13701
  const pollIntervalMs = options.pollIntervalMs ?? 6e4;
@@ -13699,6 +13722,13 @@ function createVaultChatBackend(options) {
13699
13722
  let persisting = Promise.resolve();
13700
13723
  let readyPromise = null;
13701
13724
  let adopting = null;
13725
+ let connected = typeof options.store === "function" ? void 0 : options.store;
13726
+ const complete = /* @__PURE__ */ new Set();
13727
+ let fromCache = false;
13728
+ let caching = false;
13729
+ let cacheOff = false;
13730
+ let cacheTimer;
13731
+ let saving = Promise.resolve();
13702
13732
  const slot = (0, import_uuid3.v7)();
13703
13733
  const locks = options.outbox?.locks ?? globalThis.navigator?.locks;
13704
13734
  let releaseSlot;
@@ -13735,13 +13765,55 @@ function createVaultChatBackend(options) {
13735
13765
  }
13736
13766
  return out;
13737
13767
  };
13768
+ const cacheSnapshot = () => {
13769
+ const kept = [...threads.keys()].filter((id2) => complete.has(id2) && confirmedLive(id2));
13770
+ const keep = new Set(kept);
13771
+ return {
13772
+ account: cache.account,
13773
+ cursor: cursor ?? "",
13774
+ records: [...confirmed.values()].filter(
13775
+ ({ record: record2 }) => record2.kind === "conversation" || record2.kind !== "project" && keep.has(record2.conversationId)
13776
+ ),
13777
+ threads: kept,
13778
+ absent: [...checked].filter((k) => {
13779
+ const [kind, ...rest] = k.split("/");
13780
+ return (kind === "summary" || kind === "memory_links") && !confirmed.has(k) && keep.has(rest.join("/"));
13781
+ })
13782
+ };
13783
+ };
13784
+ const saveCache = () => {
13785
+ if (!cache || !caching || cacheOff || closed || cacheTimer || cursor === void 0) return;
13786
+ cacheTimer = setTimeout(() => {
13787
+ cacheTimer = void 0;
13788
+ saving = saving.then(
13789
+ () => cacheOff || closed ? void 0 : saveChatCache(cache.storage, cache.seal.encrypt, cacheSnapshot())
13790
+ ).catch(() => void 0);
13791
+ }, cacheSaveDelayMs);
13792
+ };
13793
+ const clearCache = async () => {
13794
+ fromCache = false;
13795
+ cacheOff = true;
13796
+ clearTimeout(cacheTimer);
13797
+ cacheTimer = void 0;
13798
+ await saving;
13799
+ if (cache) await cache.storage.set(cache.account, null);
13800
+ };
13801
+ const wipeIfTerminal = (error) => {
13802
+ if (error instanceof ChatStoreError && terminalCodes.has(error.code ?? ""))
13803
+ void clearCache().catch(() => void 0);
13804
+ };
13738
13805
  const merge = (snapshot) => {
13739
13806
  const k = key2(snapshot.record.kind, snapshot.record.id);
13740
13807
  const known = confirmed.get(k);
13741
13808
  if (known && known.version >= snapshot.version) return false;
13742
13809
  confirmed.set(k, snapshot);
13810
+ saveCache();
13743
13811
  return true;
13744
13812
  };
13813
+ const remote = async () => {
13814
+ await ready();
13815
+ return connected;
13816
+ };
13745
13817
  const persist = () => {
13746
13818
  const storage = options.outbox;
13747
13819
  if (!storage) return Promise.resolve();
@@ -13796,7 +13868,7 @@ function createVaultChatBackend(options) {
13796
13868
  return { kind, id: rest.join("/") };
13797
13869
  });
13798
13870
  if (refs.length === 0) return;
13799
- const found = await store.getMany(refs);
13871
+ const found = await (await remote()).getMany(refs);
13800
13872
  const seen = new Set(found.map((s) => key2(s.record.kind, s.record.id)));
13801
13873
  for (const snapshot of found) merge(snapshot);
13802
13874
  for (const ref3 of refs) {
@@ -13804,6 +13876,7 @@ function createVaultChatBackend(options) {
13804
13876
  if (!seen.has(k)) confirmed.delete(k);
13805
13877
  checked.add(k);
13806
13878
  }
13879
+ saveCache();
13807
13880
  };
13808
13881
  const drop = (patch, reason) => {
13809
13882
  inflight.delete(patchKey(patch));
@@ -13858,7 +13931,7 @@ function createVaultChatBackend(options) {
13858
13931
  sent.push(patch);
13859
13932
  }
13860
13933
  if (writes.length === 0) return;
13861
- const results = await store.putMany(writes);
13934
+ const results = await (await remote()).putMany(writes);
13862
13935
  results.forEach((snapshot, i) => {
13863
13936
  merge(snapshot);
13864
13937
  checked.add(patchKey(sent[i]));
@@ -13892,6 +13965,7 @@ function createVaultChatBackend(options) {
13892
13965
  }
13893
13966
  if (terminalCodes.has(error.code ?? "")) {
13894
13967
  stopped = error.code;
13968
+ wipeIfTerminal(error);
13895
13969
  reportOutbox();
13896
13970
  return "stop";
13897
13971
  }
@@ -13958,6 +14032,7 @@ function createVaultChatBackend(options) {
13958
14032
  const forget = (k) => {
13959
14033
  confirmed.delete(k);
13960
14034
  checked.delete(k);
14035
+ saveCache();
13961
14036
  };
13962
14037
  const forgetConversation = (conversationId) => {
13963
14038
  threads.delete(conversationId);
@@ -13984,9 +14059,10 @@ function createVaultChatBackend(options) {
13984
14059
  }
13985
14060
  const loading = (async () => {
13986
14061
  if (!confirmedLive(conversationId)) return;
14062
+ const source = await remote();
13987
14063
  let page;
13988
14064
  do {
13989
- const result = await store.list({
14065
+ const result = await source.list({
13990
14066
  kind: "message",
13991
14067
  conversationId,
13992
14068
  limit: 200,
@@ -13996,7 +14072,15 @@ function createVaultChatBackend(options) {
13996
14072
  page = result.nextCursor;
13997
14073
  } while (page);
13998
14074
  })();
13999
- loading.catch(() => threads.delete(conversationId));
14075
+ void loading.then(
14076
+ () => {
14077
+ if (threads.get(conversationId) !== loading) return;
14078
+ complete.add(conversationId);
14079
+ saveCache();
14080
+ },
14081
+ () => threads.delete(conversationId)
14082
+ );
14083
+ complete.delete(conversationId);
14000
14084
  threads.set(conversationId, loading);
14001
14085
  evict();
14002
14086
  return loading;
@@ -14014,20 +14098,58 @@ function createVaultChatBackend(options) {
14014
14098
  const relevant2 = threads.has(record2.conversationId) || confirmed.has(k) || checked.has(k) && record2.kind !== "message";
14015
14099
  if (relevant2 && merge(snapshot)) announce([record2]);
14016
14100
  };
14101
+ const listIndex = async (source) => {
14102
+ const index = [];
14103
+ let page;
14104
+ do {
14105
+ const result = await source.list({
14106
+ kind: "conversation",
14107
+ limit: 200,
14108
+ ...page ? { cursor: page } : {}
14109
+ });
14110
+ index.push(...result.items);
14111
+ page = result.nextCursor;
14112
+ } while (page);
14113
+ return index;
14114
+ };
14115
+ const catchUp = async (source) => {
14116
+ let next = cursor ?? "";
14117
+ for (; ; ) {
14118
+ const page = await source.changes(next || void 0, { limit: 200 });
14119
+ page.items.forEach(applyRemote);
14120
+ next = page.nextCursor ?? page.changesCursor;
14121
+ if (!page.nextCursor) break;
14122
+ }
14123
+ cursor = next;
14124
+ };
14125
+ const refetch = async (source) => {
14126
+ const account = await source.account();
14127
+ const index = await listIndex(source);
14128
+ const reopened = [...threads.keys()];
14129
+ confirmed.clear();
14130
+ checked.clear();
14131
+ threads.clear();
14132
+ complete.clear();
14133
+ cursor = account.changesCursor ?? "";
14134
+ index.forEach(merge);
14135
+ emit({ type: "conversations", origin: "remote" });
14136
+ for (const conversationId of reopened)
14137
+ emit({ type: "messages", conversationId, origin: "remote" });
14138
+ };
14017
14139
  const poll = () => {
14018
14140
  polling ?? (polling = (async () => {
14019
- await ready();
14020
- let next = cursor ?? "";
14021
- for (; ; ) {
14022
- const page = await store.changes(next || void 0, { limit: 200 });
14023
- page.items.forEach(applyRemote);
14024
- next = page.nextCursor ?? page.changesCursor;
14025
- if (!page.nextCursor) break;
14026
- }
14027
- cursor = next;
14141
+ const source = await remote();
14142
+ try {
14143
+ await catchUp(source);
14144
+ } catch (error) {
14145
+ if (!cursorRejected(error)) throw error;
14146
+ await refetch(source);
14147
+ }
14028
14148
  pollFailures = 0;
14029
- })().catch(() => {
14149
+ saveCache();
14150
+ })().catch((error) => {
14030
14151
  pollFailures++;
14152
+ wipeIfTerminal(error);
14031
14153
  }).finally(() => {
14032
14154
  polling = null;
14033
14155
  schedulePoll();
@@ -14043,26 +14165,27 @@ function createVaultChatBackend(options) {
14043
14165
  };
14044
14166
  const ready = () => {
14045
14167
  readyPromise ?? (readyPromise = (async () => {
14046
- const account = await store.account();
14047
- cursor = account.changesCursor ?? "";
14048
- let page;
14049
- do {
14050
- const result = await store.list({
14051
- kind: "conversation",
14052
- limit: 200,
14053
- ...page ? { cursor: page } : {}
14054
- });
14055
- result.items.forEach(merge);
14056
- page = result.nextCursor;
14057
- } while (page);
14168
+ await seeding;
14169
+ if (!connected && typeof options.store === "function") connected = await options.store();
14170
+ const source = connected;
14171
+ const account = await source.account();
14172
+ if (!fromCache) {
14173
+ cursor = account.changesCursor ?? "";
14174
+ (await listIndex(source)).forEach(merge);
14175
+ }
14058
14176
  await adopt();
14059
14177
  schedulePoll();
14060
14178
  })());
14061
- readyPromise.catch(() => {
14179
+ readyPromise.catch((error) => {
14062
14180
  readyPromise = null;
14181
+ wipeIfTerminal(error);
14063
14182
  });
14064
14183
  return readyPromise;
14065
14184
  };
14185
+ const available2 = async () => {
14186
+ await seeding;
14187
+ if (!fromCache) await ready();
14188
+ };
14066
14189
  const adoptSlot = async (outbox, other) => {
14067
14190
  const patches = await loadOutbox(outbox.storage, other, outbox.seal.decrypt);
14068
14191
  for (const patch of patches) {
@@ -14107,20 +14230,20 @@ function createVaultChatBackend(options) {
14107
14230
  });
14108
14231
  if (channel) channel.onmessage = () => void poll();
14109
14232
  const conversation = async (conversationId) => {
14110
- await ready();
14233
+ await available2();
14111
14234
  const k = key2("conversation", conversationId);
14112
14235
  if (!view(k) && !checked.has(k)) {
14113
- const found = await store.get("conversation", conversationId);
14236
+ const found = await (await remote()).get("conversation", conversationId);
14114
14237
  checked.add(k);
14115
14238
  if (found) merge(found);
14116
14239
  }
14117
14240
  return view(k);
14118
14241
  };
14119
14242
  const message = async (uniqueId) => {
14120
- await ready();
14243
+ await available2();
14121
14244
  const k = key2("message", uniqueId);
14122
14245
  if (!view(k) && !checked.has(k)) {
14123
- const found = await store.get("message", uniqueId);
14246
+ const found = await (await remote()).get("message", uniqueId);
14124
14247
  checked.add(k);
14125
14248
  if (found) merge(found);
14126
14249
  }
@@ -14128,17 +14251,18 @@ function createVaultChatBackend(options) {
14128
14251
  return record2 && !record2.isDeleted && conversationLive(record2.conversationId) ? record2 : void 0;
14129
14252
  };
14130
14253
  const child = async (kind, conversationId) => {
14131
- await ready();
14254
+ await available2();
14132
14255
  const k = key2(kind, conversationId);
14133
14256
  if (!view(k) && !checked.has(k) && conversationLive(conversationId)) {
14134
- const found = await store.get(kind, conversationId);
14257
+ const found = await (await remote()).get(kind, conversationId);
14135
14258
  checked.add(k);
14136
14259
  if (found) merge(found);
14260
+ saveCache();
14137
14261
  }
14138
14262
  return view(k);
14139
14263
  };
14140
14264
  const thread = async (conversationId) => {
14141
- await ready();
14265
+ await available2();
14142
14266
  if (!conversationLive(conversationId)) return [];
14143
14267
  await loadThread(conversationId);
14144
14268
  return all("message", conversationId).sort(
@@ -14202,7 +14326,7 @@ function createVaultChatBackend(options) {
14202
14326
  return record2 && !record2.isDeleted ? toConversation(record2) : null;
14203
14327
  },
14204
14328
  async getConversations(query) {
14205
- await ready();
14329
+ await available2();
14206
14330
  return all("conversation").map(toConversation).filter(
14207
14331
  (c) => query?.projectId === void 0 || (query.projectId === null ? !c.projectId : c.projectId === query.projectId)
14208
14332
  ).sort((a, b) => b.createdAt.getTime() - a.createdAt.getTime());
@@ -14272,7 +14396,7 @@ function createVaultChatBackend(options) {
14272
14396
  return toSkeletons(await thread(conversationId));
14273
14397
  },
14274
14398
  async getMessagesByIds(uniqueIds) {
14275
- await ready();
14399
+ await available2();
14276
14400
  const ids = [...new Set(uniqueIds)];
14277
14401
  const unknown = ids.map((id2) => key2("message", id2)).filter((k) => !view(k) && !checked.has(k));
14278
14402
  await refresh(unknown);
@@ -14404,7 +14528,7 @@ function createVaultChatBackend(options) {
14404
14528
  );
14405
14529
  },
14406
14530
  async getAllFiles(query) {
14407
- await ready();
14531
+ await available2();
14408
14532
  if (query?.conversationId) await loadThread(query.conversationId);
14409
14533
  const files = [];
14410
14534
  for (const record2 of all("message", query?.conversationId)) {
@@ -14429,7 +14553,7 @@ function createVaultChatBackend(options) {
14429
14553
  const vector2 = acceptedVector(queryVector);
14430
14554
  if (!vector2) return [];
14431
14555
  await flush();
14432
- const hits = await store.search(vector2, {
14556
+ const hits = await (await remote()).search(vector2, {
14433
14557
  limit: Math.min(50, limit),
14434
14558
  kinds: ["message"],
14435
14559
  ...conversationId ? { conversationId } : {},
@@ -14536,8 +14660,9 @@ function createVaultChatBackend(options) {
14536
14660
  let messageCount = 0;
14537
14661
  try {
14538
14662
  for (const batch of batches(conversations))
14539
- conversationCount += await store.importRecords(batch);
14540
- for (const batch of batches(messages)) messageCount += await store.importRecords(batch);
14663
+ conversationCount += await connected.importRecords(batch);
14664
+ for (const batch of batches(messages))
14665
+ messageCount += await connected.importRecords(batch);
14541
14666
  } finally {
14542
14667
  for (const { record: record2 } of messages) checked.delete(key2("message", record2.id));
14543
14668
  await refresh(conversations.map(({ record: record2 }) => key2("conversation", record2.id))).catch(
@@ -14552,8 +14677,10 @@ function createVaultChatBackend(options) {
14552
14677
  return { conversations: conversationCount, messages: messageCount };
14553
14678
  },
14554
14679
  status: () => ({ pending: pending.size + inflight.size, ...stopped ? { stopped } : {} }),
14680
+ clearCache,
14555
14681
  close() {
14556
14682
  closed = true;
14683
+ clearTimeout(cacheTimer);
14557
14684
  clearTimeout(flushTimer);
14558
14685
  clearTimeout(retryTimer);
14559
14686
  clearTimeout(pollTimer);
@@ -14570,7 +14697,31 @@ function createVaultChatBackend(options) {
14570
14697
  emit({ type: "conversations", origin: "local" });
14571
14698
  return true;
14572
14699
  };
14700
+ const seed = async () => {
14701
+ if (!cache) return;
14702
+ try {
14703
+ const snapshot = await loadChatCache(cache.storage, cache.account, cache.seal.decrypt).catch(
14704
+ () => void 0
14705
+ );
14706
+ if (!snapshot || cacheOff) return;
14707
+ snapshot.records.forEach(merge);
14708
+ for (const conversationId of snapshot.threads) {
14709
+ if (!confirmedLive(conversationId)) continue;
14710
+ threads.set(conversationId, Promise.resolve());
14711
+ complete.add(conversationId);
14712
+ }
14713
+ evict();
14714
+ for (const k of snapshot.absent) checked.add(k);
14715
+ cursor = snapshot.cursor;
14716
+ fromCache = true;
14717
+ await adopt().catch(() => void 0);
14718
+ } finally {
14719
+ caching = true;
14720
+ }
14721
+ };
14722
+ const seeding = seed();
14573
14723
  void ready().catch(() => void 0);
14724
+ if (cache) void seeding.then(() => fromCache ? poll() : void 0);
14574
14725
  return backend;
14575
14726
  }
14576
14727
  function vaultChatBackend(backend) {
@@ -17756,7 +17907,7 @@ async function backfillMemoryTopicsOp(ctx, memoryIds) {
17756
17907
  const chunkIds = uniqueIds.slice(i, i + CHUNK);
17757
17908
  await ctx.database.write(async () => {
17758
17909
  await assertCanWrite2(ctx);
17759
- const writes = [];
17910
+ const records = [];
17760
17911
  for (const id2 of chunkIds) {
17761
17912
  let record2;
17762
17913
  try {
@@ -17766,13 +17917,40 @@ async function backfillMemoryTopicsOp(ctx, memoryIds) {
17766
17917
  }
17767
17918
  if (record2.isDeleted || !isOwnedByCtxUser(ctx, record2)) continue;
17768
17919
  if (parseTopics(record2.topics) !== null) continue;
17769
- const links2 = await entityCtx.memoryEntityCollection.query(import_watermelondb21.Q.where("memory_id", id2)).unsafeFetchRaw();
17770
- const entityIds = links2.map((l) => String(l.entity_id));
17771
- if (entityIds.length === 0) continue;
17772
- const entities = await entityCtx.entityCollection.query(import_watermelondb21.Q.where("id", import_watermelondb21.Q.oneOf(entityIds))).fetch();
17773
- if (entities.length === 0) continue;
17920
+ records.push(record2);
17921
+ }
17922
+ if (records.length === 0) return;
17923
+ const links2 = await entityCtx.memoryEntityCollection.query(import_watermelondb21.Q.where("memory_id", import_watermelondb21.Q.oneOf(records.map((record2) => record2.id)))).unsafeFetchRaw();
17924
+ const entityIds = Array.from(new Set(links2.map((link) => String(link.entity_id))));
17925
+ const entitiesById = /* @__PURE__ */ new Map();
17926
+ for (let j = 0; j < entityIds.length; j += CHUNK) {
17927
+ const entities = await entityCtx.entityCollection.query(import_watermelondb21.Q.where("id", import_watermelondb21.Q.oneOf(entityIds.slice(j, j + CHUNK)))).fetch();
17928
+ for (const entity of entities) entitiesById.set(entity.id, entity);
17929
+ }
17930
+ const entitiesByMemory = /* @__PURE__ */ new Map();
17931
+ for (const link of links2) {
17932
+ const entity = entitiesById.get(String(link.entity_id));
17933
+ if (!entity) continue;
17934
+ const memoryId = String(link.memory_id);
17935
+ let entities = entitiesByMemory.get(memoryId);
17936
+ if (!entities) {
17937
+ entities = /* @__PURE__ */ new Set();
17938
+ entitiesByMemory.set(memoryId, entities);
17939
+ }
17940
+ entities.add(entity);
17941
+ }
17942
+ const writes = [];
17943
+ for (const record2 of records) {
17944
+ const entities = entitiesByMemory.get(record2.id);
17945
+ if (!entities?.size) continue;
17774
17946
  const source = record2.topicsUserManaged ? "user" : "auto";
17775
- const write = await resolveMemoryTopicsWrite(entityCtx, id2, entities, [], source);
17947
+ const write = await resolveMemoryTopicsWrite(
17948
+ entityCtx,
17949
+ record2.id,
17950
+ Array.from(entities),
17951
+ [],
17952
+ source
17953
+ );
17776
17954
  if (write) writes.push(write);
17777
17955
  }
17778
17956
  if (writes.length === 0) return;
@@ -8452,6 +8452,12 @@ interface BaseUseChatStorageResult {
8452
8452
  }
8453
8453
  declare function generateConversationId(): string;
8454
8454
 
8455
+ /** Durable home for each account's sealed chat cache; `set(account, null)` deletes that account's entry. */
8456
+ interface ChatCacheStorage {
8457
+ get(account: string): Promise<string | null>;
8458
+ set(account: string, sealed: string | null): Promise<void>;
8459
+ }
8460
+
8455
8461
  /** Durable home for sealed outbox slots, one per running backend, so writes survive a reload while vault is unreachable. */
8456
8462
  interface ChatOutboxStorage {
8457
8463
  slots(): Promise<string[]>;
@@ -8498,7 +8504,8 @@ interface VaultChatActivity {
8498
8504
  subscribe(onChange: () => void): () => void;
8499
8505
  }
8500
8506
  interface VaultChatBackendOptions {
8501
- store: ChatStore;
8507
+ /** A connected store, or a function that connects one; with a seeded `cache`, reads serve cached chats until it resolves. */
8508
+ store: ChatStore | (() => Promise<ChatStore>);
8502
8509
  /** Persists unsent writes, sealed with `seal`, so they survive a reload; `locks` defaults to `navigator.locks`. */
8503
8510
  outbox?: {
8504
8511
  storage: ChatOutboxStorage;
@@ -8510,6 +8517,12 @@ interface VaultChatBackendOptions {
8510
8517
  pollIntervalMs?: number;
8511
8518
  /** BroadcastChannel name shared by this account's tabs, so one tab's writes prompt the others to poll. */
8512
8519
  channel?: string;
8520
+ /** Keeps `account`'s confirmed records and `/changes` cursor sealed with `seal`, so a cold start reads them before vault answers. */
8521
+ cache?: {
8522
+ storage: ChatCacheStorage;
8523
+ seal: Pick<SealingCipher, "encrypt" | "decrypt">;
8524
+ account: string;
8525
+ };
8513
8526
  threadCacheSize?: number;
8514
8527
  now?: () => number;
8515
8528
  }
@@ -8536,6 +8549,8 @@ interface VaultChatBackend extends ChatBackend {
8536
8549
  pending: number;
8537
8550
  stopped?: string;
8538
8551
  };
8552
+ /** Deletes this account's cached chats and stops caching; call it on logout or a wallet switch. */
8553
+ clearCache(): Promise<void>;
8539
8554
  close(): void;
8540
8555
  }
8541
8556
  /** Creates a vault chat backend for one account and key; build a new one after a wallet or key change. */
@@ -12201,4 +12216,4 @@ interface UseChatStorageResult extends BaseUseChatStorageResult {
12201
12216
  */
12202
12217
  declare function useChatStorage(options: UseChatStorageOptions): UseChatStorageResult;
12203
12218
 
12204
- export { type AutoExtractMessage, type AutoExtractor, type Budget, CHUNKS_DISCARDED_ORIGIN, type CachedChunkVectors, type CachedServerTools, type ChatAccount, type ChatAccountState, type ChatAttachment, type ChatAttachments, type ChatBackend, type ChatBackendFactory, type ChatBackendSigner, type ChatChanges, type ChatChunkSearchOptions, Conversation as ChatConversation, type ChatImport, type ChatJson, type ChatListOptions, Message as ChatMessage, type ChatMigrationOptions, type ChatMigrationProgress, type ChatMigrationResult, type ChatMigrationSkip, type ChatOutboxLocks, type ChatOutboxStorage, type ChatPage, type ChatPresignedUrl, type ChatRecord, type ChatRecordKind, type ChatRef, type ChatRevision, type ChatRole, type ChatSearchHit, type ChatSearchOptions, type ChatSnapshot, type ChatStore, ChatStoreError, type ChatWrite, type ChunkSearchStats, type ChunkVectorCache, type ChunkingOptions, type ConsolidationAction, type ConsolidationFallbackReason, type ConversationMemoryInput, ConversationMemory as ConversationMemoryModel, type ConversationMemoryOperationsContext, type CreateAutoExtractorOptions, type CreateConversationOptions, type CreateDecaySweeperOptions, type CreateMessageOptions, type CreateSelectPaymentWalletToolOptions, type CreateVaultFolderOptions, type CreateVaultMemoryOptions, type CreateWalletPaymentToolOptions, type CryptoPriceClassification, type CryptoPricePreProcessorOptions, DEFAULT_CACHE_EXPIRATION_MS, DEFAULT_CHUNK_CACHE_SIZE, DEFAULT_CHUNK_OVERLAP, DEFAULT_CHUNK_SIZE, DEFAULT_DECAY_POLICY, DEFAULT_MAX_CLASSIFIER_CALLS_PER_SWEEP, DEFAULT_MIN_CHUNK_SIZE, DEFAULT_PROFILE_FACETS, DEFAULT_PROFILE_FACT_TYPE_WEIGHTS, DEFAULT_PROFILE_PROOF_ALPHA, DEFAULT_PROFILE_TREND_MULTIPLIERS, DEFAULT_VAULT_CACHE_SIZE, DatabaseManager, type DatabaseManagerLogger, type DatabaseManagerOptions, type DecayCandidateRaw, type DecayClassifier, type DecayInput, type DecayPolicy, type DecaySweepResult, type DecaySweeper, type DecayVerdict, type DurableAutoExtractorOptions, ENTITY_FANOUT, type EmbeddedWalletSignerFn, type EmbeddingRepairOptions, type EmbeddingRepairResult, EncryptionKeyMissingError, type ExtractFactsOptions, type ExtractOutcome, type ExtractedCandidate, type ExtractedEntity, type ExtractionCursorStore, type ExtractionFunnel, type ExtractionMessageSource, type ExtractionSourceMessage, type ExtractionSourceStatus, type ExtractionTimings, type FactType, type FileMetadata, type FileProcessingReason, type FileProcessingStatus, type FlushResult, type GetConversationsPageOptions, type GetMessagesPageOptions, type GraphTraversalOptions, HARD_DELETE_WINDOW_MS, INFERENCE_ID_HEADER, type InjectionClassifierOptions, type InjectionReason, type LazyStoredConversation, type LlmDecayClassifierOptions, type LlmNeighborRefinerOptions, type LocalMemoryStoreOptions, type Logger, LoggerProvider, type LoggerProviderProps, MAX_HOPS, MEDIUM_TTL_MS, MEMORY_KINDS, MEMORY_LEVELS, type ManualFactType, type MemoriesNeedingTopicExtraction, type MemoryContextItem, type MemoryContextLane, type MemoryContextOptions, type MemoryContextResult, type MemoryCounts, type MemoryCreate, type MemoryDecay, type MemoryDecaySweeperOptions, type EmbeddingOptions as MemoryEngineEmbeddingOptions, type MemoryEngineResult, type MemoryEngineSearchOptions, type MemoryExtractedEvent, MemoryKeyError, type MemoryKeyRing, type MemoryKind, type MemoryLevel, MemoryLevelError, type MemoryListOptions, type MemoryMaintenance, type MemoryMigrationOptions, type MemoryMigrationProgress, type MemoryMigrationResult, type MemoryMigrationSkip, type MemoryQuarantinedEvent, type MemoryRecallOptions, type MemoryRetainOptions, type MemoryStore, type MemorySubscribeOptions, type MemoryToVerify, type MemoryTopic, type MemoryTopicBacklog, type MemoryTopicMaintenance, type MemoryUpdate, type MemoryVaultSearchOptions, type MemoryVaultToolOptions, type MemoryVerification, type MessageRedactionResult, type MessageSkeleton, NEVER_TTL_MS, NODE_BUDGET, NOTION_OAUTH_CONFIG, type NeighborRefiner, type NotionAuthUrlParams, type NotionClientRegistration, type NotionExchangeCodeParams, type NotionMcpCaller, type NotionOAuthEndpoints, type NotionPKCEChallenge, type NotionRefreshTokenParams, type NotionTokenResponse, type NowSource, type ObservationTrend, type ObservationTrendInput, PAST_EVENT_GRACE_MS, PII_PATTERNS, PROFILE_DOC_VERSION, type PaymentWallet, type PhotoIngestResult, type PhotoMediaRef, type PiiCategory, type PiiMatch, type PiiPattern, PiiRedactor, type PiiRedactorOptions, type PlatformStorage, type PortalLlmAuth, type PortalLlmFailure, type PortalLlmFailureReason, type ProfileConfigFingerprint, type ProfileDoc, type ProfileFacet, type ProfileFacetKey, type ProfileSalienceInput, type ProfileSection, type PromptPreProcessor, type PromptPreProcessorContext, type PublishedPhotoMemory, type QuantizedEmbedding, type QuarantinedMemoryInfo, QueueManager, type QueueStatus, RECALL_MAX_LIMIT, RECALL_TOOL_NAME, type RankableVaultMemory, type RankedMemory, type RankedProfileCandidate, type RecallContext, type RecallDegradation, type RecallDiagnostics, type RecallEmptyReason, type RecallOptions, type RecallResult, type RecallTelemetryCallbacks, type RecallToolCallbacks, type RecallToolOptions, type RecallTruncation, type RecencyOptions, type RedactionResult, type ReflectOptions, type ReflectResult, type RemoteChatStoreOptions, type RemoteMemoryCandidateOptions, type RemoteMemoryDecodeFailure, RemoteMemoryError, type RemoteMemoryListOptions, type RemoteMemoryMetadataPage, type RemoteMemoryMetadataRecord, type RemoteMemoryPage, RemoteMemoryPartialCreateError, type RemoteMemoryPersistence, type RemoteMemoryPersistenceOptions, type RemoteMemoryPipeline, type RemoteMemoryPipelineOptions, type RemoteMemoryQueryOptions, type RemoteMemoryQueryPage, type RemoteMemoryReadFilters, type RemoteMemoryRecord, type RemoteMemoryRow, type RemoteMemoryStoreOptions, type RemoteMemoryTopic, type RemoteMemoryWorkKind, type RemoteMemoryWorkLease, type RemoteMemoryWorkPersistence, type RemoteTopicPersistence, type RequestEncryptionKeyOptions, RerankerUnavailableError, type ReservationReceipt, type ResumeStreamOptions, type ResumeStreamResult, type ResumeStreamWithStorageResult, type RetainAction, type RetainContext, type RetainOptions, type RetainResult, type RetainSource, SDK_SCHEMA_VERSION, SELECT_PAYMENT_WALLET_TOOL_NAME, SHORT_TTL_MS, STREAM_RESUMABLE_HEADER, type ScoreBreakdown, type ScoreProfileSalienceOptions, type ScreenResult, type ScreenedCandidate, type SearchSource, type SelectPaymentWalletResult, type SendMessageWithStorageArgs, type SendMessageWithStorageDetachedResult, type SendMessageWithStorageResult, type ServerToolsOptions, type ServerToolsResponse, type SignMessageFn, type StockPriceClassification, type StockPricePreProcessorOptions, type ChatCompletionUsage as StoredChatCompletionUsage, type StoredConversation, type StoredConversationMemory, type StoredMessage, type StoredMessageWithSimilarity, type StoredTopic, type StoredVaultFolder, VaultFolder as StoredVaultFolderModel, type StoredVaultMemory, VaultMemory as StoredVaultMemoryModel, StreamExpiredError, type StreamMetaEvent, type StreamResumeHandle, type StreamSmoothingConfig, type SynthesizeProfileOptions, TOOL_RESULT_ORIGIN, TOPICS_EXTRACTION_VERSION, TOPIC_EXTRACTION_BATCH_SIZE, TOPIC_SALIENCE_WEIGHTS, TREND_RECENT_WINDOW_DAYS, TREND_STALE_WINDOW_DAYS, type TextChunk, type TopicExtractOptions, type TopicExtractionBatchDiagnostics, type TopicExtractionInput, type TopicExtractionRunResult, type TopicSalience, type TopicSkipReason, type TurnCompleteEvent, type TurnSkippedEvent, type UncheckedReason, type UnverifiableReason, type UpdateVaultFolderOptions, type UpdateVaultMemoryOptions, type UseChatStorageOptions, type UseChatStorageResult, type UseCreditsOptions, type UseCreditsResult, type UseModelsOptions, type UseModelsResult, VAULT_SIZE_HOP_CAP, type VaultChatActivity, type VaultChatBackend, type VaultChatBackendOptions, type VaultChatEvent, type VaultEmbeddingCache, type VaultEmbeddingExpectation, type VaultFolderOperationsContext, type VaultMemoryKind, type VaultMemoryOperationsContext, type VaultMemoryProjection, type VaultMemoryVisibility, type VaultMemoryWriter, type VaultSaveOperation, type VaultSearchResult, type VaultWriteAction, type VaultWriteInput, type VaultWriteOutcome, type VerificationSources, type VerifyMemoriesForPublishOptions, WALLET_PAYMENT_TOOL_NAME, type WalletPaymentOutcome, type WalletPaymentPassenger, type WalletPaymentRequest, type WalletPaymentResult, WalletPoller, type WeatherClassification, type WeatherPreProcessorOptions, type WebSearchClassification, type WebSearchPreProcessorOptions, type WriteFailureReason, addConversationMemoriesOp, archiveVaultMemoryOp, assembleMemoryContext, attachFileContextToLastUserMessage, backfillMemoryTopicsOp, buildAttachedFilesText, buildNotionAuthUrl, capHopsForDensity, chatStorageMigrations, chatStorageSchema, chunkAndEmbedAllMessages, chunkAndEmbedMessage, chunkText, classifyCryptoPrice, classifyCryptoPriceBatch, classifyDecay, classifyInjectionCandidates, classifyObservationTrend, classifyStockPrice, classifyStockPriceBatch, classifyWeather, classifyWeatherBatch, classifyWebSearch, classifyWebSearchBatch, clearAllEncryptionKeys, clearAllEncryptionState, clearConversationMemoriesOp, clearEncryptionKey, clearLazyTitleCache, clearModelsCache, clearServerToolsCache, consoleLogger, conversationMemoryToStored, cosineInt8, createAutoExtractor, createChunkVectorCache, createCryptoPricePreProcessor, createDecaySweeper, createDurableAutoExtractor, createLlmDecayClassifier, createLlmNeighborRefiner, createLocalMemoryStore, createMemoryEngineTool, createMemoryVaultSearchTool, createMemoryVaultTool, createMessageSourceResolver, createNotionProxyTools, createNotionTools, createPlatformCursorStore, createRecallTool, createRemoteChatStore, createRemoteMemoryPersistence, createRemoteMemoryPipeline, createRemoteMemoryStore, createSelectPaymentWalletTool, createStockPricePreProcessor, createStreamingDeAnonymizer, createVaultChatBackend, createVaultEmbeddingCache, createVaultFolderOp, createVaultMemoriesBatchOp, createVaultMemoryOp, createWalletPaymentTool, createWeatherPreProcessor, createWebSearchPreProcessor, decodeChunkVector, decryptConversationTitle, decryptMessageEmbeddingFields, deleteAllVaultMemoriesForUserOp, deleteMessageOp, deleteVaultFolderOp, deleteVaultMemoryOp, dequantizeEmbedding, deriveKeyFromSignatureBytes, deriveMemoryKeyRing, discoverNotionOAuthEndpoints, eagerEmbedContent, embedAllMessages, embedMessage, encodeChunkVector, encryptToolCallEventsOp, ensureDefaultFoldersOp, exchangeNotionCode, extractAndLinkEntitiesForMemoriesOp, extractAndRetain, extractEntitiesForMemories, extractFacts, extractReservationReceipts, formatFileProcessingNotes, generateConversationId, generateEmbedding, generateEmbeddings, generateNotionPKCE, getAllVaultFoldersOp, getAllVaultMemoriesOp, getAllVaultMemoryContentsOp, getCachedServerTools, getConversationMemoriesOp, getConversationsByProjectLazyOp, getConversationsLazyOp, getConversationsPageOp, getDecayCandidatesRawOp, getLogger, getMemoriesNeedingTopicExtractionOp, getServerTools, getUnfiledVaultMemoriesOp, getVaultFolderMemoryCountOp, getVaultMemoriesByIdsOp, getVaultMemoryOp, getVaultRankingProjectionsOp, hardDeleteDecayedOp, hasEncryptionKey, ingestPublishedPhotoMemoriesOp, injectionSignatureCatalog, isAttachedFilesText, isDegradedTopicSkip, isEncrypted, isPiiRedactor, isRerankerAvailable, localChatBackend, maskScopedEmbeddingCache, memoryCipher, migrateChatsToRemote, migrateMemoriesToRemote, moveMemoriesToFolderOp, noopLogger, onKeyAvailable, parseMedia, preEmbedVaultMemories, primaryTopic, quantizeEmbedding, queueManager, rankProfileCandidates, recall, reencryptMemoryField, reflect, refreshEncryptionKeyIfMatches, refreshNotionAccessToken, registerNotionClient, relinkMemoryTopicsOp, requestEncryptionKey, resolvePiiRedactor, restoreVaultMemoryOp, resumeStream, retain, scoreProfileSalience, screenCandidatesForInjection, sdkMigrations, sdkModelClasses, sdkSchema, sealLegacyMessageEmbeddingsOp, searchVaultMemories, seedEncryptionKeys, setLogger, setMemoryVisibilityOp, shouldChunkMessage, shouldRecallMemory, stampTopicsExtractedAtOp, streamCancelPath, streamReplayPath, stripLegacyChunkTextOp, summarizeObservationTrends, supersedeVaultMemoryOp, synthesizeProfile, topicWeight, traverseGraphLane, ttlForType, updateVaultFolderContextOp, updateVaultFolderOp, updateVaultMemoryEmbeddingOp, updateVaultMemoryOp, upsertMessageOp, useChat, useChatStorage, useCredits, useEncryption, useModels, vaultChatBackend, verifyMemoriesForPublish, xhrTransport };
12219
+ export { type AutoExtractMessage, type AutoExtractor, type Budget, CHUNKS_DISCARDED_ORIGIN, type CachedChunkVectors, type CachedServerTools, type ChatAccount, type ChatAccountState, type ChatAttachment, type ChatAttachments, type ChatBackend, type ChatBackendFactory, type ChatBackendSigner, type ChatCacheStorage, type ChatChanges, type ChatChunkSearchOptions, Conversation as ChatConversation, type ChatImport, type ChatJson, type ChatListOptions, Message as ChatMessage, type ChatMigrationOptions, type ChatMigrationProgress, type ChatMigrationResult, type ChatMigrationSkip, type ChatOutboxLocks, type ChatOutboxStorage, type ChatPage, type ChatPresignedUrl, type ChatRecord, type ChatRecordKind, type ChatRef, type ChatRevision, type ChatRole, type ChatSearchHit, type ChatSearchOptions, type ChatSnapshot, type ChatStore, ChatStoreError, type ChatWrite, type ChunkSearchStats, type ChunkVectorCache, type ChunkingOptions, type ConsolidationAction, type ConsolidationFallbackReason, type ConversationMemoryInput, ConversationMemory as ConversationMemoryModel, type ConversationMemoryOperationsContext, type CreateAutoExtractorOptions, type CreateConversationOptions, type CreateDecaySweeperOptions, type CreateMessageOptions, type CreateSelectPaymentWalletToolOptions, type CreateVaultFolderOptions, type CreateVaultMemoryOptions, type CreateWalletPaymentToolOptions, type CryptoPriceClassification, type CryptoPricePreProcessorOptions, DEFAULT_CACHE_EXPIRATION_MS, DEFAULT_CHUNK_CACHE_SIZE, DEFAULT_CHUNK_OVERLAP, DEFAULT_CHUNK_SIZE, DEFAULT_DECAY_POLICY, DEFAULT_MAX_CLASSIFIER_CALLS_PER_SWEEP, DEFAULT_MIN_CHUNK_SIZE, DEFAULT_PROFILE_FACETS, DEFAULT_PROFILE_FACT_TYPE_WEIGHTS, DEFAULT_PROFILE_PROOF_ALPHA, DEFAULT_PROFILE_TREND_MULTIPLIERS, DEFAULT_VAULT_CACHE_SIZE, DatabaseManager, type DatabaseManagerLogger, type DatabaseManagerOptions, type DecayCandidateRaw, type DecayClassifier, type DecayInput, type DecayPolicy, type DecaySweepResult, type DecaySweeper, type DecayVerdict, type DurableAutoExtractorOptions, ENTITY_FANOUT, type EmbeddedWalletSignerFn, type EmbeddingRepairOptions, type EmbeddingRepairResult, EncryptionKeyMissingError, type ExtractFactsOptions, type ExtractOutcome, type ExtractedCandidate, type ExtractedEntity, type ExtractionCursorStore, type ExtractionFunnel, type ExtractionMessageSource, type ExtractionSourceMessage, type ExtractionSourceStatus, type ExtractionTimings, type FactType, type FileMetadata, type FileProcessingReason, type FileProcessingStatus, type FlushResult, type GetConversationsPageOptions, type GetMessagesPageOptions, type GraphTraversalOptions, HARD_DELETE_WINDOW_MS, INFERENCE_ID_HEADER, type InjectionClassifierOptions, type InjectionReason, type LazyStoredConversation, type LlmDecayClassifierOptions, type LlmNeighborRefinerOptions, type LocalMemoryStoreOptions, type Logger, LoggerProvider, type LoggerProviderProps, MAX_HOPS, MEDIUM_TTL_MS, MEMORY_KINDS, MEMORY_LEVELS, type ManualFactType, type MemoriesNeedingTopicExtraction, type MemoryContextItem, type MemoryContextLane, type MemoryContextOptions, type MemoryContextResult, type MemoryCounts, type MemoryCreate, type MemoryDecay, type MemoryDecaySweeperOptions, type EmbeddingOptions as MemoryEngineEmbeddingOptions, type MemoryEngineResult, type MemoryEngineSearchOptions, type MemoryExtractedEvent, MemoryKeyError, type MemoryKeyRing, type MemoryKind, type MemoryLevel, MemoryLevelError, type MemoryListOptions, type MemoryMaintenance, type MemoryMigrationOptions, type MemoryMigrationProgress, type MemoryMigrationResult, type MemoryMigrationSkip, type MemoryQuarantinedEvent, type MemoryRecallOptions, type MemoryRetainOptions, type MemoryStore, type MemorySubscribeOptions, type MemoryToVerify, type MemoryTopic, type MemoryTopicBacklog, type MemoryTopicMaintenance, type MemoryUpdate, type MemoryVaultSearchOptions, type MemoryVaultToolOptions, type MemoryVerification, type MessageRedactionResult, type MessageSkeleton, NEVER_TTL_MS, NODE_BUDGET, NOTION_OAUTH_CONFIG, type NeighborRefiner, type NotionAuthUrlParams, type NotionClientRegistration, type NotionExchangeCodeParams, type NotionMcpCaller, type NotionOAuthEndpoints, type NotionPKCEChallenge, type NotionRefreshTokenParams, type NotionTokenResponse, type NowSource, type ObservationTrend, type ObservationTrendInput, PAST_EVENT_GRACE_MS, PII_PATTERNS, PROFILE_DOC_VERSION, type PaymentWallet, type PhotoIngestResult, type PhotoMediaRef, type PiiCategory, type PiiMatch, type PiiPattern, PiiRedactor, type PiiRedactorOptions, type PlatformStorage, type PortalLlmAuth, type PortalLlmFailure, type PortalLlmFailureReason, type ProfileConfigFingerprint, type ProfileDoc, type ProfileFacet, type ProfileFacetKey, type ProfileSalienceInput, type ProfileSection, type PromptPreProcessor, type PromptPreProcessorContext, type PublishedPhotoMemory, type QuantizedEmbedding, type QuarantinedMemoryInfo, QueueManager, type QueueStatus, RECALL_MAX_LIMIT, RECALL_TOOL_NAME, type RankableVaultMemory, type RankedMemory, type RankedProfileCandidate, type RecallContext, type RecallDegradation, type RecallDiagnostics, type RecallEmptyReason, type RecallOptions, type RecallResult, type RecallTelemetryCallbacks, type RecallToolCallbacks, type RecallToolOptions, type RecallTruncation, type RecencyOptions, type RedactionResult, type ReflectOptions, type ReflectResult, type RemoteChatStoreOptions, type RemoteMemoryCandidateOptions, type RemoteMemoryDecodeFailure, RemoteMemoryError, type RemoteMemoryListOptions, type RemoteMemoryMetadataPage, type RemoteMemoryMetadataRecord, type RemoteMemoryPage, RemoteMemoryPartialCreateError, type RemoteMemoryPersistence, type RemoteMemoryPersistenceOptions, type RemoteMemoryPipeline, type RemoteMemoryPipelineOptions, type RemoteMemoryQueryOptions, type RemoteMemoryQueryPage, type RemoteMemoryReadFilters, type RemoteMemoryRecord, type RemoteMemoryRow, type RemoteMemoryStoreOptions, type RemoteMemoryTopic, type RemoteMemoryWorkKind, type RemoteMemoryWorkLease, type RemoteMemoryWorkPersistence, type RemoteTopicPersistence, type RequestEncryptionKeyOptions, RerankerUnavailableError, type ReservationReceipt, type ResumeStreamOptions, type ResumeStreamResult, type ResumeStreamWithStorageResult, type RetainAction, type RetainContext, type RetainOptions, type RetainResult, type RetainSource, SDK_SCHEMA_VERSION, SELECT_PAYMENT_WALLET_TOOL_NAME, SHORT_TTL_MS, STREAM_RESUMABLE_HEADER, type ScoreBreakdown, type ScoreProfileSalienceOptions, type ScreenResult, type ScreenedCandidate, type SearchSource, type SelectPaymentWalletResult, type SendMessageWithStorageArgs, type SendMessageWithStorageDetachedResult, type SendMessageWithStorageResult, type ServerToolsOptions, type ServerToolsResponse, type SignMessageFn, type StockPriceClassification, type StockPricePreProcessorOptions, type ChatCompletionUsage as StoredChatCompletionUsage, type StoredConversation, type StoredConversationMemory, type StoredMessage, type StoredMessageWithSimilarity, type StoredTopic, type StoredVaultFolder, VaultFolder as StoredVaultFolderModel, type StoredVaultMemory, VaultMemory as StoredVaultMemoryModel, StreamExpiredError, type StreamMetaEvent, type StreamResumeHandle, type StreamSmoothingConfig, type SynthesizeProfileOptions, TOOL_RESULT_ORIGIN, TOPICS_EXTRACTION_VERSION, TOPIC_EXTRACTION_BATCH_SIZE, TOPIC_SALIENCE_WEIGHTS, TREND_RECENT_WINDOW_DAYS, TREND_STALE_WINDOW_DAYS, type TextChunk, type TopicExtractOptions, type TopicExtractionBatchDiagnostics, type TopicExtractionInput, type TopicExtractionRunResult, type TopicSalience, type TopicSkipReason, type TurnCompleteEvent, type TurnSkippedEvent, type UncheckedReason, type UnverifiableReason, type UpdateVaultFolderOptions, type UpdateVaultMemoryOptions, type UseChatStorageOptions, type UseChatStorageResult, type UseCreditsOptions, type UseCreditsResult, type UseModelsOptions, type UseModelsResult, VAULT_SIZE_HOP_CAP, type VaultChatActivity, type VaultChatBackend, type VaultChatBackendOptions, type VaultChatEvent, type VaultEmbeddingCache, type VaultEmbeddingExpectation, type VaultFolderOperationsContext, type VaultMemoryKind, type VaultMemoryOperationsContext, type VaultMemoryProjection, type VaultMemoryVisibility, type VaultMemoryWriter, type VaultSaveOperation, type VaultSearchResult, type VaultWriteAction, type VaultWriteInput, type VaultWriteOutcome, type VerificationSources, type VerifyMemoriesForPublishOptions, WALLET_PAYMENT_TOOL_NAME, type WalletPaymentOutcome, type WalletPaymentPassenger, type WalletPaymentRequest, type WalletPaymentResult, WalletPoller, type WeatherClassification, type WeatherPreProcessorOptions, type WebSearchClassification, type WebSearchPreProcessorOptions, type WriteFailureReason, addConversationMemoriesOp, archiveVaultMemoryOp, assembleMemoryContext, attachFileContextToLastUserMessage, backfillMemoryTopicsOp, buildAttachedFilesText, buildNotionAuthUrl, capHopsForDensity, chatStorageMigrations, chatStorageSchema, chunkAndEmbedAllMessages, chunkAndEmbedMessage, chunkText, classifyCryptoPrice, classifyCryptoPriceBatch, classifyDecay, classifyInjectionCandidates, classifyObservationTrend, classifyStockPrice, classifyStockPriceBatch, classifyWeather, classifyWeatherBatch, classifyWebSearch, classifyWebSearchBatch, clearAllEncryptionKeys, clearAllEncryptionState, clearConversationMemoriesOp, clearEncryptionKey, clearLazyTitleCache, clearModelsCache, clearServerToolsCache, consoleLogger, conversationMemoryToStored, cosineInt8, createAutoExtractor, createChunkVectorCache, createCryptoPricePreProcessor, createDecaySweeper, createDurableAutoExtractor, createLlmDecayClassifier, createLlmNeighborRefiner, createLocalMemoryStore, createMemoryEngineTool, createMemoryVaultSearchTool, createMemoryVaultTool, createMessageSourceResolver, createNotionProxyTools, createNotionTools, createPlatformCursorStore, createRecallTool, createRemoteChatStore, createRemoteMemoryPersistence, createRemoteMemoryPipeline, createRemoteMemoryStore, createSelectPaymentWalletTool, createStockPricePreProcessor, createStreamingDeAnonymizer, createVaultChatBackend, createVaultEmbeddingCache, createVaultFolderOp, createVaultMemoriesBatchOp, createVaultMemoryOp, createWalletPaymentTool, createWeatherPreProcessor, createWebSearchPreProcessor, decodeChunkVector, decryptConversationTitle, decryptMessageEmbeddingFields, deleteAllVaultMemoriesForUserOp, deleteMessageOp, deleteVaultFolderOp, deleteVaultMemoryOp, dequantizeEmbedding, deriveKeyFromSignatureBytes, deriveMemoryKeyRing, discoverNotionOAuthEndpoints, eagerEmbedContent, embedAllMessages, embedMessage, encodeChunkVector, encryptToolCallEventsOp, ensureDefaultFoldersOp, exchangeNotionCode, extractAndLinkEntitiesForMemoriesOp, extractAndRetain, extractEntitiesForMemories, extractFacts, extractReservationReceipts, formatFileProcessingNotes, generateConversationId, generateEmbedding, generateEmbeddings, generateNotionPKCE, getAllVaultFoldersOp, getAllVaultMemoriesOp, getAllVaultMemoryContentsOp, getCachedServerTools, getConversationMemoriesOp, getConversationsByProjectLazyOp, getConversationsLazyOp, getConversationsPageOp, getDecayCandidatesRawOp, getLogger, getMemoriesNeedingTopicExtractionOp, getServerTools, getUnfiledVaultMemoriesOp, getVaultFolderMemoryCountOp, getVaultMemoriesByIdsOp, getVaultMemoryOp, getVaultRankingProjectionsOp, hardDeleteDecayedOp, hasEncryptionKey, ingestPublishedPhotoMemoriesOp, injectionSignatureCatalog, isAttachedFilesText, isDegradedTopicSkip, isEncrypted, isPiiRedactor, isRerankerAvailable, localChatBackend, maskScopedEmbeddingCache, memoryCipher, migrateChatsToRemote, migrateMemoriesToRemote, moveMemoriesToFolderOp, noopLogger, onKeyAvailable, parseMedia, preEmbedVaultMemories, primaryTopic, quantizeEmbedding, queueManager, rankProfileCandidates, recall, reencryptMemoryField, reflect, refreshEncryptionKeyIfMatches, refreshNotionAccessToken, registerNotionClient, relinkMemoryTopicsOp, requestEncryptionKey, resolvePiiRedactor, restoreVaultMemoryOp, resumeStream, retain, scoreProfileSalience, screenCandidatesForInjection, sdkMigrations, sdkModelClasses, sdkSchema, sealLegacyMessageEmbeddingsOp, searchVaultMemories, seedEncryptionKeys, setLogger, setMemoryVisibilityOp, shouldChunkMessage, shouldRecallMemory, stampTopicsExtractedAtOp, streamCancelPath, streamReplayPath, stripLegacyChunkTextOp, summarizeObservationTrends, supersedeVaultMemoryOp, synthesizeProfile, topicWeight, traverseGraphLane, ttlForType, updateVaultFolderContextOp, updateVaultFolderOp, updateVaultMemoryEmbeddingOp, updateVaultMemoryOp, upsertMessageOp, useChat, useChatStorage, useCredits, useEncryption, useModels, vaultChatBackend, verifyMemoriesForPublish, xhrTransport };