@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.
@@ -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) {
@@ -14294,6 +14294,25 @@ async function migrateChatsToRemote(options) {
14294
14294
  // src/lib/chatStore/vaultBackend.ts
14295
14295
  var import_uuid3 = require("uuid");
14296
14296
 
14297
+ // src/lib/chatStore/vaultCache.ts
14298
+ async function saveChatCache(storage, encrypt, snapshot) {
14299
+ await storage.set(snapshot.account, await encrypt(JSON.stringify({ schema: 1, ...snapshot })));
14300
+ }
14301
+ async function loadChatCache(storage, account, decrypt) {
14302
+ const sealed2 = await storage.get(account);
14303
+ if (!sealed2) return void 0;
14304
+ const parsed = JSON.parse(await decrypt(sealed2));
14305
+ if (parsed.schema !== 1 || parsed.account !== account || typeof parsed.cursor !== "string" || !Array.isArray(parsed.records) || !Array.isArray(parsed.threads) || !Array.isArray(parsed.absent))
14306
+ return void 0;
14307
+ return {
14308
+ account,
14309
+ cursor: parsed.cursor,
14310
+ records: parsed.records,
14311
+ threads: parsed.threads,
14312
+ absent: parsed.absent
14313
+ };
14314
+ }
14315
+
14297
14316
  // src/lib/chatStore/vaultOutbox.ts
14298
14317
  function patchKey(patch) {
14299
14318
  return `${patch.kind}/${patch.id}`;
@@ -14398,6 +14417,10 @@ async function loadOutbox(storage, slot, decrypt) {
14398
14417
 
14399
14418
  // src/lib/chatStore/vaultBackend.ts
14400
14419
  var terminalCodes = /* @__PURE__ */ new Set(["key_mismatch", "account_changed", "account_not_found"]);
14420
+ var cacheSaveDelayMs = 500;
14421
+ function cursorRejected(error) {
14422
+ return error instanceof ChatStoreError && (error.status === 400 || error.status === 410);
14423
+ }
14401
14424
  function key2(kind, id2) {
14402
14425
  return `${kind}/${id2}`;
14403
14426
  }
@@ -14442,7 +14465,7 @@ function defaultActivity() {
14442
14465
  };
14443
14466
  }
14444
14467
  function createVaultChatBackend(options) {
14445
- const { store } = options;
14468
+ const { cache } = options;
14446
14469
  const now = options.now ?? Date.now;
14447
14470
  const threadLimit = options.threadCacheSize ?? 30;
14448
14471
  const pollIntervalMs = options.pollIntervalMs ?? 6e4;
@@ -14469,6 +14492,13 @@ function createVaultChatBackend(options) {
14469
14492
  let persisting = Promise.resolve();
14470
14493
  let readyPromise = null;
14471
14494
  let adopting = null;
14495
+ let connected = typeof options.store === "function" ? void 0 : options.store;
14496
+ const complete = /* @__PURE__ */ new Set();
14497
+ let fromCache = false;
14498
+ let caching = false;
14499
+ let cacheOff = false;
14500
+ let cacheTimer;
14501
+ let saving = Promise.resolve();
14472
14502
  const slot = (0, import_uuid3.v7)();
14473
14503
  const locks = options.outbox?.locks ?? globalThis.navigator?.locks;
14474
14504
  let releaseSlot;
@@ -14505,13 +14535,55 @@ function createVaultChatBackend(options) {
14505
14535
  }
14506
14536
  return out;
14507
14537
  };
14538
+ const cacheSnapshot = () => {
14539
+ const kept = [...threads.keys()].filter((id2) => complete.has(id2) && confirmedLive(id2));
14540
+ const keep = new Set(kept);
14541
+ return {
14542
+ account: cache.account,
14543
+ cursor: cursor ?? "",
14544
+ records: [...confirmed.values()].filter(
14545
+ ({ record: record2 }) => record2.kind === "conversation" || record2.kind !== "project" && keep.has(record2.conversationId)
14546
+ ),
14547
+ threads: kept,
14548
+ absent: [...checked].filter((k) => {
14549
+ const [kind, ...rest] = k.split("/");
14550
+ return (kind === "summary" || kind === "memory_links") && !confirmed.has(k) && keep.has(rest.join("/"));
14551
+ })
14552
+ };
14553
+ };
14554
+ const saveCache = () => {
14555
+ if (!cache || !caching || cacheOff || closed || cacheTimer || cursor === void 0) return;
14556
+ cacheTimer = setTimeout(() => {
14557
+ cacheTimer = void 0;
14558
+ saving = saving.then(
14559
+ () => cacheOff || closed ? void 0 : saveChatCache(cache.storage, cache.seal.encrypt, cacheSnapshot())
14560
+ ).catch(() => void 0);
14561
+ }, cacheSaveDelayMs);
14562
+ };
14563
+ const clearCache = async () => {
14564
+ fromCache = false;
14565
+ cacheOff = true;
14566
+ clearTimeout(cacheTimer);
14567
+ cacheTimer = void 0;
14568
+ await saving;
14569
+ if (cache) await cache.storage.set(cache.account, null);
14570
+ };
14571
+ const wipeIfTerminal = (error) => {
14572
+ if (error instanceof ChatStoreError && terminalCodes.has(error.code ?? ""))
14573
+ void clearCache().catch(() => void 0);
14574
+ };
14508
14575
  const merge = (snapshot) => {
14509
14576
  const k = key2(snapshot.record.kind, snapshot.record.id);
14510
14577
  const known = confirmed.get(k);
14511
14578
  if (known && known.version >= snapshot.version) return false;
14512
14579
  confirmed.set(k, snapshot);
14580
+ saveCache();
14513
14581
  return true;
14514
14582
  };
14583
+ const remote = async () => {
14584
+ await ready();
14585
+ return connected;
14586
+ };
14515
14587
  const persist = () => {
14516
14588
  const storage = options.outbox;
14517
14589
  if (!storage) return Promise.resolve();
@@ -14566,7 +14638,7 @@ function createVaultChatBackend(options) {
14566
14638
  return { kind, id: rest.join("/") };
14567
14639
  });
14568
14640
  if (refs.length === 0) return;
14569
- const found = await store.getMany(refs);
14641
+ const found = await (await remote()).getMany(refs);
14570
14642
  const seen = new Set(found.map((s) => key2(s.record.kind, s.record.id)));
14571
14643
  for (const snapshot of found) merge(snapshot);
14572
14644
  for (const ref3 of refs) {
@@ -14574,6 +14646,7 @@ function createVaultChatBackend(options) {
14574
14646
  if (!seen.has(k)) confirmed.delete(k);
14575
14647
  checked.add(k);
14576
14648
  }
14649
+ saveCache();
14577
14650
  };
14578
14651
  const drop = (patch, reason) => {
14579
14652
  inflight.delete(patchKey(patch));
@@ -14628,7 +14701,7 @@ function createVaultChatBackend(options) {
14628
14701
  sent.push(patch);
14629
14702
  }
14630
14703
  if (writes.length === 0) return;
14631
- const results = await store.putMany(writes);
14704
+ const results = await (await remote()).putMany(writes);
14632
14705
  results.forEach((snapshot, i) => {
14633
14706
  merge(snapshot);
14634
14707
  checked.add(patchKey(sent[i]));
@@ -14662,6 +14735,7 @@ function createVaultChatBackend(options) {
14662
14735
  }
14663
14736
  if (terminalCodes.has(error.code ?? "")) {
14664
14737
  stopped = error.code;
14738
+ wipeIfTerminal(error);
14665
14739
  reportOutbox();
14666
14740
  return "stop";
14667
14741
  }
@@ -14728,6 +14802,7 @@ function createVaultChatBackend(options) {
14728
14802
  const forget = (k) => {
14729
14803
  confirmed.delete(k);
14730
14804
  checked.delete(k);
14805
+ saveCache();
14731
14806
  };
14732
14807
  const forgetConversation = (conversationId) => {
14733
14808
  threads.delete(conversationId);
@@ -14754,9 +14829,10 @@ function createVaultChatBackend(options) {
14754
14829
  }
14755
14830
  const loading = (async () => {
14756
14831
  if (!confirmedLive(conversationId)) return;
14832
+ const source = await remote();
14757
14833
  let page;
14758
14834
  do {
14759
- const result = await store.list({
14835
+ const result = await source.list({
14760
14836
  kind: "message",
14761
14837
  conversationId,
14762
14838
  limit: 200,
@@ -14766,7 +14842,15 @@ function createVaultChatBackend(options) {
14766
14842
  page = result.nextCursor;
14767
14843
  } while (page);
14768
14844
  })();
14769
- loading.catch(() => threads.delete(conversationId));
14845
+ void loading.then(
14846
+ () => {
14847
+ if (threads.get(conversationId) !== loading) return;
14848
+ complete.add(conversationId);
14849
+ saveCache();
14850
+ },
14851
+ () => threads.delete(conversationId)
14852
+ );
14853
+ complete.delete(conversationId);
14770
14854
  threads.set(conversationId, loading);
14771
14855
  evict();
14772
14856
  return loading;
@@ -14784,20 +14868,58 @@ function createVaultChatBackend(options) {
14784
14868
  const relevant2 = threads.has(record2.conversationId) || confirmed.has(k) || checked.has(k) && record2.kind !== "message";
14785
14869
  if (relevant2 && merge(snapshot)) announce([record2]);
14786
14870
  };
14871
+ const listIndex = async (source) => {
14872
+ const index = [];
14873
+ let page;
14874
+ do {
14875
+ const result = await source.list({
14876
+ kind: "conversation",
14877
+ limit: 200,
14878
+ ...page ? { cursor: page } : {}
14879
+ });
14880
+ index.push(...result.items);
14881
+ page = result.nextCursor;
14882
+ } while (page);
14883
+ return index;
14884
+ };
14885
+ const catchUp = async (source) => {
14886
+ let next = cursor ?? "";
14887
+ for (; ; ) {
14888
+ const page = await source.changes(next || void 0, { limit: 200 });
14889
+ page.items.forEach(applyRemote);
14890
+ next = page.nextCursor ?? page.changesCursor;
14891
+ if (!page.nextCursor) break;
14892
+ }
14893
+ cursor = next;
14894
+ };
14895
+ const refetch = async (source) => {
14896
+ const account = await source.account();
14897
+ const index = await listIndex(source);
14898
+ const reopened = [...threads.keys()];
14899
+ confirmed.clear();
14900
+ checked.clear();
14901
+ threads.clear();
14902
+ complete.clear();
14903
+ cursor = account.changesCursor ?? "";
14904
+ index.forEach(merge);
14905
+ emit({ type: "conversations", origin: "remote" });
14906
+ for (const conversationId of reopened)
14907
+ emit({ type: "messages", conversationId, origin: "remote" });
14908
+ };
14787
14909
  const poll = () => {
14788
14910
  polling ?? (polling = (async () => {
14789
- await ready();
14790
- let next = cursor ?? "";
14791
- for (; ; ) {
14792
- const page = await store.changes(next || void 0, { limit: 200 });
14793
- page.items.forEach(applyRemote);
14794
- next = page.nextCursor ?? page.changesCursor;
14795
- if (!page.nextCursor) break;
14796
- }
14797
- cursor = next;
14911
+ const source = await remote();
14912
+ try {
14913
+ await catchUp(source);
14914
+ } catch (error) {
14915
+ if (!cursorRejected(error)) throw error;
14916
+ await refetch(source);
14917
+ }
14798
14918
  pollFailures = 0;
14799
- })().catch(() => {
14919
+ saveCache();
14920
+ })().catch((error) => {
14800
14921
  pollFailures++;
14922
+ wipeIfTerminal(error);
14801
14923
  }).finally(() => {
14802
14924
  polling = null;
14803
14925
  schedulePoll();
@@ -14813,26 +14935,27 @@ function createVaultChatBackend(options) {
14813
14935
  };
14814
14936
  const ready = () => {
14815
14937
  readyPromise ?? (readyPromise = (async () => {
14816
- const account = await store.account();
14817
- cursor = account.changesCursor ?? "";
14818
- let page;
14819
- do {
14820
- const result = await store.list({
14821
- kind: "conversation",
14822
- limit: 200,
14823
- ...page ? { cursor: page } : {}
14824
- });
14825
- result.items.forEach(merge);
14826
- page = result.nextCursor;
14827
- } while (page);
14938
+ await seeding;
14939
+ if (!connected && typeof options.store === "function") connected = await options.store();
14940
+ const source = connected;
14941
+ const account = await source.account();
14942
+ if (!fromCache) {
14943
+ cursor = account.changesCursor ?? "";
14944
+ (await listIndex(source)).forEach(merge);
14945
+ }
14828
14946
  await adopt();
14829
14947
  schedulePoll();
14830
14948
  })());
14831
- readyPromise.catch(() => {
14949
+ readyPromise.catch((error) => {
14832
14950
  readyPromise = null;
14951
+ wipeIfTerminal(error);
14833
14952
  });
14834
14953
  return readyPromise;
14835
14954
  };
14955
+ const available2 = async () => {
14956
+ await seeding;
14957
+ if (!fromCache) await ready();
14958
+ };
14836
14959
  const adoptSlot = async (outbox, other) => {
14837
14960
  const patches = await loadOutbox(outbox.storage, other, outbox.seal.decrypt);
14838
14961
  for (const patch of patches) {
@@ -14877,20 +15000,20 @@ function createVaultChatBackend(options) {
14877
15000
  });
14878
15001
  if (channel) channel.onmessage = () => void poll();
14879
15002
  const conversation = async (conversationId) => {
14880
- await ready();
15003
+ await available2();
14881
15004
  const k = key2("conversation", conversationId);
14882
15005
  if (!view(k) && !checked.has(k)) {
14883
- const found = await store.get("conversation", conversationId);
15006
+ const found = await (await remote()).get("conversation", conversationId);
14884
15007
  checked.add(k);
14885
15008
  if (found) merge(found);
14886
15009
  }
14887
15010
  return view(k);
14888
15011
  };
14889
15012
  const message = async (uniqueId) => {
14890
- await ready();
15013
+ await available2();
14891
15014
  const k = key2("message", uniqueId);
14892
15015
  if (!view(k) && !checked.has(k)) {
14893
- const found = await store.get("message", uniqueId);
15016
+ const found = await (await remote()).get("message", uniqueId);
14894
15017
  checked.add(k);
14895
15018
  if (found) merge(found);
14896
15019
  }
@@ -14898,17 +15021,18 @@ function createVaultChatBackend(options) {
14898
15021
  return record2 && !record2.isDeleted && conversationLive(record2.conversationId) ? record2 : void 0;
14899
15022
  };
14900
15023
  const child = async (kind, conversationId) => {
14901
- await ready();
15024
+ await available2();
14902
15025
  const k = key2(kind, conversationId);
14903
15026
  if (!view(k) && !checked.has(k) && conversationLive(conversationId)) {
14904
- const found = await store.get(kind, conversationId);
15027
+ const found = await (await remote()).get(kind, conversationId);
14905
15028
  checked.add(k);
14906
15029
  if (found) merge(found);
15030
+ saveCache();
14907
15031
  }
14908
15032
  return view(k);
14909
15033
  };
14910
15034
  const thread = async (conversationId) => {
14911
- await ready();
15035
+ await available2();
14912
15036
  if (!conversationLive(conversationId)) return [];
14913
15037
  await loadThread(conversationId);
14914
15038
  return all("message", conversationId).sort(
@@ -14972,7 +15096,7 @@ function createVaultChatBackend(options) {
14972
15096
  return record2 && !record2.isDeleted ? toConversation(record2) : null;
14973
15097
  },
14974
15098
  async getConversations(query) {
14975
- await ready();
15099
+ await available2();
14976
15100
  return all("conversation").map(toConversation).filter(
14977
15101
  (c) => query?.projectId === void 0 || (query.projectId === null ? !c.projectId : c.projectId === query.projectId)
14978
15102
  ).sort((a, b) => b.createdAt.getTime() - a.createdAt.getTime());
@@ -15042,7 +15166,7 @@ function createVaultChatBackend(options) {
15042
15166
  return toSkeletons(await thread(conversationId));
15043
15167
  },
15044
15168
  async getMessagesByIds(uniqueIds) {
15045
- await ready();
15169
+ await available2();
15046
15170
  const ids = [...new Set(uniqueIds)];
15047
15171
  const unknown = ids.map((id2) => key2("message", id2)).filter((k) => !view(k) && !checked.has(k));
15048
15172
  await refresh(unknown);
@@ -15174,7 +15298,7 @@ function createVaultChatBackend(options) {
15174
15298
  );
15175
15299
  },
15176
15300
  async getAllFiles(query) {
15177
- await ready();
15301
+ await available2();
15178
15302
  if (query?.conversationId) await loadThread(query.conversationId);
15179
15303
  const files = [];
15180
15304
  for (const record2 of all("message", query?.conversationId)) {
@@ -15199,7 +15323,7 @@ function createVaultChatBackend(options) {
15199
15323
  const vector2 = acceptedVector(queryVector);
15200
15324
  if (!vector2) return [];
15201
15325
  await flush();
15202
- const hits = await store.search(vector2, {
15326
+ const hits = await (await remote()).search(vector2, {
15203
15327
  limit: Math.min(50, limit),
15204
15328
  kinds: ["message"],
15205
15329
  ...conversationId ? { conversationId } : {},
@@ -15306,8 +15430,9 @@ function createVaultChatBackend(options) {
15306
15430
  let messageCount = 0;
15307
15431
  try {
15308
15432
  for (const batch of batches(conversations))
15309
- conversationCount += await store.importRecords(batch);
15310
- for (const batch of batches(messages)) messageCount += await store.importRecords(batch);
15433
+ conversationCount += await connected.importRecords(batch);
15434
+ for (const batch of batches(messages))
15435
+ messageCount += await connected.importRecords(batch);
15311
15436
  } finally {
15312
15437
  for (const { record: record2 } of messages) checked.delete(key2("message", record2.id));
15313
15438
  await refresh(conversations.map(({ record: record2 }) => key2("conversation", record2.id))).catch(
@@ -15322,8 +15447,10 @@ function createVaultChatBackend(options) {
15322
15447
  return { conversations: conversationCount, messages: messageCount };
15323
15448
  },
15324
15449
  status: () => ({ pending: pending.size + inflight.size, ...stopped ? { stopped } : {} }),
15450
+ clearCache,
15325
15451
  close() {
15326
15452
  closed = true;
15453
+ clearTimeout(cacheTimer);
15327
15454
  clearTimeout(flushTimer);
15328
15455
  clearTimeout(retryTimer);
15329
15456
  clearTimeout(pollTimer);
@@ -15340,7 +15467,31 @@ function createVaultChatBackend(options) {
15340
15467
  emit({ type: "conversations", origin: "local" });
15341
15468
  return true;
15342
15469
  };
15470
+ const seed = async () => {
15471
+ if (!cache) return;
15472
+ try {
15473
+ const snapshot = await loadChatCache(cache.storage, cache.account, cache.seal.decrypt).catch(
15474
+ () => void 0
15475
+ );
15476
+ if (!snapshot || cacheOff) return;
15477
+ snapshot.records.forEach(merge);
15478
+ for (const conversationId of snapshot.threads) {
15479
+ if (!confirmedLive(conversationId)) continue;
15480
+ threads.set(conversationId, Promise.resolve());
15481
+ complete.add(conversationId);
15482
+ }
15483
+ evict();
15484
+ for (const k of snapshot.absent) checked.add(k);
15485
+ cursor = snapshot.cursor;
15486
+ fromCache = true;
15487
+ await adopt().catch(() => void 0);
15488
+ } finally {
15489
+ caching = true;
15490
+ }
15491
+ };
15492
+ const seeding = seed();
15343
15493
  void ready().catch(() => void 0);
15494
+ if (cache) void seeding.then(() => fromCache ? poll() : void 0);
15344
15495
  return backend;
15345
15496
  }
15346
15497
  function vaultChatBackend(backend) {
@@ -19590,7 +19741,7 @@ async function backfillMemoryTopicsOp(ctx, memoryIds) {
19590
19741
  const chunkIds = uniqueIds.slice(i, i + CHUNK);
19591
19742
  await ctx.database.write(async () => {
19592
19743
  await assertCanWrite2(ctx);
19593
- const writes = [];
19744
+ const records = [];
19594
19745
  for (const id2 of chunkIds) {
19595
19746
  let record2;
19596
19747
  try {
@@ -19600,13 +19751,40 @@ async function backfillMemoryTopicsOp(ctx, memoryIds) {
19600
19751
  }
19601
19752
  if (record2.isDeleted || !isOwnedByCtxUser(ctx, record2)) continue;
19602
19753
  if (parseTopics(record2.topics) !== null) continue;
19603
- const links2 = await entityCtx.memoryEntityCollection.query(import_watermelondb24.Q.where("memory_id", id2)).unsafeFetchRaw();
19604
- const entityIds = links2.map((l) => String(l.entity_id));
19605
- if (entityIds.length === 0) continue;
19606
- const entities = await entityCtx.entityCollection.query(import_watermelondb24.Q.where("id", import_watermelondb24.Q.oneOf(entityIds))).fetch();
19607
- if (entities.length === 0) continue;
19754
+ records.push(record2);
19755
+ }
19756
+ if (records.length === 0) return;
19757
+ const links2 = await entityCtx.memoryEntityCollection.query(import_watermelondb24.Q.where("memory_id", import_watermelondb24.Q.oneOf(records.map((record2) => record2.id)))).unsafeFetchRaw();
19758
+ const entityIds = Array.from(new Set(links2.map((link) => String(link.entity_id))));
19759
+ const entitiesById = /* @__PURE__ */ new Map();
19760
+ for (let j = 0; j < entityIds.length; j += CHUNK) {
19761
+ const entities = await entityCtx.entityCollection.query(import_watermelondb24.Q.where("id", import_watermelondb24.Q.oneOf(entityIds.slice(j, j + CHUNK)))).fetch();
19762
+ for (const entity of entities) entitiesById.set(entity.id, entity);
19763
+ }
19764
+ const entitiesByMemory = /* @__PURE__ */ new Map();
19765
+ for (const link of links2) {
19766
+ const entity = entitiesById.get(String(link.entity_id));
19767
+ if (!entity) continue;
19768
+ const memoryId = String(link.memory_id);
19769
+ let entities = entitiesByMemory.get(memoryId);
19770
+ if (!entities) {
19771
+ entities = /* @__PURE__ */ new Set();
19772
+ entitiesByMemory.set(memoryId, entities);
19773
+ }
19774
+ entities.add(entity);
19775
+ }
19776
+ const writes = [];
19777
+ for (const record2 of records) {
19778
+ const entities = entitiesByMemory.get(record2.id);
19779
+ if (!entities?.size) continue;
19608
19780
  const source = record2.topicsUserManaged ? "user" : "auto";
19609
- const write = await resolveMemoryTopicsWrite(entityCtx, id2, entities, [], source);
19781
+ const write = await resolveMemoryTopicsWrite(
19782
+ entityCtx,
19783
+ record2.id,
19784
+ Array.from(entities),
19785
+ [],
19786
+ source
19787
+ );
19610
19788
  if (write) writes.push(write);
19611
19789
  }
19612
19790
  if (writes.length === 0) return;
@@ -9360,6 +9360,12 @@ interface BaseUseChatStorageResult {
9360
9360
  }
9361
9361
  declare function generateConversationId(): string;
9362
9362
 
9363
+ /** Durable home for each account's sealed chat cache; `set(account, null)` deletes that account's entry. */
9364
+ interface ChatCacheStorage {
9365
+ get(account: string): Promise<string | null>;
9366
+ set(account: string, sealed: string | null): Promise<void>;
9367
+ }
9368
+
9363
9369
  /** Durable home for sealed outbox slots, one per running backend, so writes survive a reload while vault is unreachable. */
9364
9370
  interface ChatOutboxStorage {
9365
9371
  slots(): Promise<string[]>;
@@ -9406,7 +9412,8 @@ interface VaultChatActivity {
9406
9412
  subscribe(onChange: () => void): () => void;
9407
9413
  }
9408
9414
  interface VaultChatBackendOptions {
9409
- store: ChatStore;
9415
+ /** A connected store, or a function that connects one; with a seeded `cache`, reads serve cached chats until it resolves. */
9416
+ store: ChatStore | (() => Promise<ChatStore>);
9410
9417
  /** Persists unsent writes, sealed with `seal`, so they survive a reload; `locks` defaults to `navigator.locks`. */
9411
9418
  outbox?: {
9412
9419
  storage: ChatOutboxStorage;
@@ -9418,6 +9425,12 @@ interface VaultChatBackendOptions {
9418
9425
  pollIntervalMs?: number;
9419
9426
  /** BroadcastChannel name shared by this account's tabs, so one tab's writes prompt the others to poll. */
9420
9427
  channel?: string;
9428
+ /** Keeps `account`'s confirmed records and `/changes` cursor sealed with `seal`, so a cold start reads them before vault answers. */
9429
+ cache?: {
9430
+ storage: ChatCacheStorage;
9431
+ seal: Pick<SealingCipher, "encrypt" | "decrypt">;
9432
+ account: string;
9433
+ };
9421
9434
  threadCacheSize?: number;
9422
9435
  now?: () => number;
9423
9436
  }
@@ -9444,6 +9457,8 @@ interface VaultChatBackend extends ChatBackend {
9444
9457
  pending: number;
9445
9458
  stopped?: string;
9446
9459
  };
9460
+ /** Deletes this account's cached chats and stops caching; call it on logout or a wallet switch. */
9461
+ clearCache(): Promise<void>;
9447
9462
  close(): void;
9448
9463
  }
9449
9464
  /** Creates a vault chat backend for one account and key; build a new one after a wallet or key change. */
@@ -16197,4 +16212,4 @@ type UseWalletBindingResult = {
16197
16212
  */
16198
16213
  declare function useWalletBinding(options?: UseWalletBindingOptions): UseWalletBindingResult;
16199
16214
 
16200
- export { Anuma, type AnumaChild, AnumaJsxError, type AnumaNode, AnumaShadowIsolationProvider, type AnumaShadowIsolationProviderProps, type AnumaTheme, AnumaThemeProvider, type AnumaThemeProviderProps, AppFile as AppFileModel, type AppFileOperationsContext, type AttrValue, type AutoExtractMessage, type AutoExtractor, DEFAULT_BACKUP_FOLDER as BACKUP_ICLOUD_FOLDER, BUILT_IN_TOOL_SETS, type BackupAuthContextValue, BackupAuthProvider, type BackupAuthProviderProps, type BackupOperationOptions, BlobUrlManager, type Budget, CHUNKS_DISCARDED_ORIGIN, type CachedChunkVectors, type CachedServerTools, ChartCard, type ChartCardProps, type ChartConfig, ChartContainer, ChartLegend, ChartLegendContent, ChartStyle, ChartTooltip, ChartTooltipContent, 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 ChatStorageAdapter, type ChatStorageObservable, type ChatStore, ChatStoreError, type ChatWrite, type ChunkSearchResult, type ChunkSearchStats, type ChunkVectorCache, type ChunkingOptions, type CircleProps, type ClientToolsFilterFn, type ConsolidationAction, type ConsolidationFallbackReason, type ConversationMemoryInput, ConversationMemory as ConversationMemoryModel, type ConversationMemoryOperationsContext, type ConversationQueryOptions, type CreateAutoExtractorOptions, type CreateConversationOptions, type CreateDecaySweeperOptions, type CreateEntityOptions, type CreateMediaOptions, type CreateMessageOptions, type CreateModelPreferenceOptions, type CreateProjectOptions, type CreateSavedToolOptions, type CreateSelectPaymentWalletToolOptions, type CreateServerToolsFilterOptions, type CreateUserPreferenceOptions, 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_EXCLUDED_SERVER_TOOLS, DEFAULT_BACKUP_FOLDER as DEFAULT_ICLOUD_BACKUP_FOLDER, DEFAULT_MAX_CLASSIFIER_CALLS_PER_SWEEP, DEFAULT_MIN_CHUNK_SIZE, DEFAULT_PERSONALITY_SETTINGS, DEFAULT_PROFILE_FACETS, DEFAULT_PROFILE_FACT_TYPE_WEIGHTS, DEFAULT_PROFILE_PROOF_ALPHA, DEFAULT_PROFILE_TREND_MULTIPLIERS, DEFAULT_SERVER_TOOLS_MATCH_OPTIONS, DEFAULT_VAULT_CACHE_SIZE, DatabaseManager, type DatabaseManagerLogger, type DatabaseManagerOptions, type DecayCandidateRaw, type DecayClassifier, type DecayInput, type DecayPolicy, type DecaySweepResult, type DecaySweeper, type DecayVerdict, type DeckProps, type DisplayToolMigrations, type DurableAutoExtractorOptions, ENTITY_FANOUT, ENTITY_KINDS, type EmbeddedWalletSignerFn, type EmbeddingRepairOptions, type EmbeddingRepairResult, EncryptionKeyMissingError, type EncryptionKeyVersion, type EntityInput, type EntityKind, Entity as EntityModel, type EntityOperationsContext, ExcelProcessor, type ExtractFactsOptions, type ExtractOutcome, type ExtractedCandidate, type ExtractedEntity, type ExtractionCursorStore, type ExtractionFunnel, type ExtractionMessageSource, type ExtractionSourceMessage, type ExtractionSourceStatus, type ExtractionTimings, FILE_PLACEHOLDER_PREFIX, FILE_PLACEHOLDER_REGEX, type FactType, type FileMetadata, type FileProcessingReason, type FileProcessingStatus, type FileProcessor, type FileTypeQuery, type FileWithData, type FlushResult, type GetConversationsPageOptions, type GetMessagesPageOptions, type GraphTraversalOptions, type GroupProps, HARD_DELETE_WINDOW_MS, type ICloudAuthContextValue, ICloudAuthProvider, type ICloudAuthProviderProps, type ICloudExportResult, type ICloudImportResult, INFERENCE_ID_HEADER, INTERNAL_FLOW_MARKER, type IconProps, type ImageProps, type InjectionClassifierOptions, type InjectionReason, type InteractionType, type KnownTag, type LazyStoredConversation, type LineProps, type LlmDecayClassifierOptions, type LlmNeighborRefinerOptions, type LocalMemoryStoreOptions, type Logger, LoggerProvider, type LoggerProviderProps, MAX_HOPS, MEDIUM_TTL_MS, MEMORY_KINDS, MEMORY_LEVELS, type ManualFactType, type MediaDimensions, type MediaFilterOptions, type MediaMetadata, type MediaOperationsContext, type MediaRole, type MediaType, 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, MemoryEntity as MemoryEntityModel, 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 MessageChunk, type MessageFeedback, type MessageOrigin, type MessageSkeleton, type ModelLoadProgress, NEVER_TTL_MS, NODE_BUDGET, type NeighborRefiner, type NowSource, type OCRFile, type ObservationTrend, type ObservationTrendInput, type OperationExecutor, PAST_EVENT_GRACE_MS, PROFILE_DOC_VERSION, type ParsedServerToolsResponse, type PaymentWallet, type PdfExportOptions, type PdfExportProgress, type PdfExportStage, type PdfFile, PdfProcessor, type PendingInteraction, type PersonalitySettings, type PersonalitySliders, type PersonalityStyle, type PhoneCallPollingOptions, type PhotoIngestResult, type PhotoMediaRef, type PlatformStorage, type PortalLlmAuth, type PortalLlmFailure, type PortalLlmFailureReason, type PreprocessingOptions, type PreprocessingResult, type ProcessedFileResult, ProcessorRegistry, type ProfileConfigFingerprint, type ProfileDoc, type ProfileFacet, type ProfileFacetKey, type ProfileSalienceInput, type ProfileSection, type ProfileUpdate, type ProgressCallback, Project, type ProjectOperationsContext, type PromptPreProcessor, type PromptPreProcessorContext, type ProviderAuthState, type ProviderBackupState, ProviderStreamError, type PublishedPhotoMemory, type QuantizedEmbedding, type QuarantinedMemoryInfo, type QueueEncryptionContext, QueueManager, type QueueStatus, type QueuedOperation, type QueuedOperationType, R2_DEFAULT_TTL_MS, 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 RectProps, 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 RetainAction, type RetainContext, type RetainOptions, type RetainResult, type RetainSource, SDK_SCHEMA_VERSION, SELECT_PAYMENT_WALLET_TOOL_NAME, SERVER_TOOL_DEPENDENCY_SETS, SHORT_TTL_MS, SLIDER_CONFIG, SLIDES_FILE_PATH, SLIDE_CANVAS_HEIGHT, SLIDE_CANVAS_WIDTH, STREAM_RESUMABLE_HEADER, SavedTool as SavedToolModel, type SavedToolOperationsContext, type SavedToolParameter, type ScoreBreakdown, type ScoreProfileSalienceOptions, type ScreenProps, type ScreenResult, type ScreenedCandidate, type SearchMessagesOptions, type SearchSource, type SelectPaymentWalletResult, type SelectServerToolsForPromptOptions, type SendMessageWithStorageArgs, type SendMessageWithStorageResult, type ServerTool, type ServerToolsFilter, type ServerToolsFilterFn, type ServerToolsFilterFunction, type ServerToolsOptions, type ServerToolsResponse, type SignMessageFn, type SignMessageOptions, type SlideProps, type StepFinishEvent, type StockPriceClassification, type StockPricePreProcessorOptions, type StorageOperationsContext, type StoredAppFile, type ChatCompletionUsage as StoredChatCompletionUsage, type StoredConversation, type StoredConversationMemory, type StoredEntity, type StoredFileWithContext, type StoredMedia, Media as StoredMediaModel, type StoredMessage, type StoredMessageWithSimilarity, type StoredModelPreference, ModelPreference as StoredModelPreferenceModel, type StoredProject, type StoredSavedTool, type StoredTopic, type StoredUserPreference, UserPreference as StoredUserPreferenceModel, type StoredVaultFolder, VaultFolder as StoredVaultFolderModel, type StoredVaultMemory, VaultMemory as StoredVaultMemoryModel, StreamExpiredError, type StreamMetaEvent, type StreamResumeHandle, type StreamSmoothingConfig, type SynthesizeProfileOptions, THEME_ATTRS, TOOL_RESULT_ORIGIN, TOPICS_EXTRACTION_VERSION, TOPIC_EXTRACTION_BATCH_SIZE, TOPIC_SALIENCE_WEIGHTS, TREND_RECENT_WINDOW_DAYS, TREND_STALE_WINDOW_DAYS, type TextChunk, TextProcessor, type TextProps, type ThemeAttr, type ToolCallArgumentsDeltaEvent, type ToolMatchOptions, type ToolMatchResult, type ToolSet, type TopicExtractOptions, type TopicExtractionBatchDiagnostics, type TopicExtractionInput, type TopicExtractionRunResult, type TopicSalience, type TopicSkipReason, type TopicSource, type TranscriptionResult, type TurnCompleteEvent, type TurnSkippedEvent, type UIInteractionContextValue, UIInteractionProvider, type UIInteractionProviderProps, type UncheckedReason, type UnverifiableReason, type UpdateMediaOptions, type UpdateModelPreferenceOptions, type UpdateProjectOptions, type UpdateSavedToolOptions, type UpdateUserPreferenceOptions, type UpdateVaultFolderOptions, type UpdateVaultMemoryOptions, type UseBackupOptions, type UseBackupResult, type UseChatStorageOptions, type UseChatStorageResult, type UseCreditsOptions, type UseCreditsResult, type UseEncryptionResult, type UseExportPdfResult, type UseFilesOptions, type UseFilesResult, type UseICloudBackupOptions, type UseICloudBackupResult, type UseModelsResult, type UseOCRResult, type UsePdfResult, type UsePhoneCallsOptions, type UsePhoneCallsResult, type UseProjectsOptions, type UseProjectsResult, type UseSettingsOptions, type UseSettingsResult, type UseSubscriptionOptions, type UseSubscriptionResult, type UseToolsOptions, type UseToolsResult, type UseVoiceOptions, type UseVoiceResult, type UseWalletBindingOptions, type UseWalletBindingResult, VAULT_SIZE_HOP_CAP, type VaultCandidateKey, 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, type VoiceRecording, WALLET_PAYMENT_TOOL_NAME, type WalletPaymentOutcome, type WalletPaymentPassenger, type WalletPaymentRequest, type WalletPaymentResult, WalletPoller, WatermelonChatStorageAdapter, type WatermelonChatStorageAdapterOptions, type WeatherClassification, type WeatherPreProcessorOptions, type WebSearchClassification, type WebSearchPreProcessorOptions, type WhisperModel, WordProcessor, type WriteFailureReason, ZipProcessor, type ZipProcessorOptions, addConversationMemoriesOp, appFileToStored, archiveVaultMemoryOp, assembleMemoryContext, attachFileContextToLastUserMessage, backfillMemoryEntityUserIdsOp, backfillMemoryTopicsOp, buildAttachedFilesText, capHopsForDensity, chatStorageMigrations, chatStorageSchema, chunkAndEmbedAllMessages, chunkAndEmbedMessage, chunkText, classifyCryptoPrice, classifyCryptoPriceBatch, classifyDecay, classifyInjectionCandidates, classifyObservationTrend, classifyStockPrice, classifyStockPriceBatch, classifyWeather, classifyWeatherBatch, classifyWebSearch, classifyWebSearchBatch, clearAllEncryptionKeys, clearAllEncryptionState, clearAllKeyPairs, clearConversationMemoriesOp, clearEncryptionKey, clearICloudAuth, clearKeyPair, clearLazyTitleCache, clearMemoryTopicsOverrideOp, clearModelsCache, clearNotionToken, clearServerToolsCache, consoleLogger, conversationMemoryToStored, cosineInt8, createAutoExtractor, createChunkVectorCache, createCryptoPricePreProcessor, createDecaySweeper, createDurableAutoExtractor, createGitHubTools, createLlmDecayClassifier, createLlmNeighborRefiner, createLocalMemoryStore, createMediaBatchOp, createMediaOp, createMemoryEngineTool, createMemoryVaultSearchTool, createMemoryVaultTool, createMessageSourceResolver, createPlatformCursorStore, createProjectOp, createRecallTool, createRemoteChatStore, createRemoteMemoryPersistence, createRemoteMemoryPipeline, createRemoteMemoryStore, createSavedToolOp, createSelectPaymentWalletTool, createServerToolsFilter, createStockPricePreProcessor, createVaultChatBackend, createVaultEmbeddingCache, createVaultFolderOp, createVaultMemoriesBatchOp, createVaultMemoryOp, createWalletPaymentTool, createWeatherPreProcessor, createWebSearchPreProcessor, decodeChunkVector, decryptConversationTitle, decryptData, decryptDataBatch, decryptDataBytes, decryptDataBytesFromBytes, decryptDataWithKey, decryptMessageEmbeddingFields, defaultServerToolsFilter, deleteAllAppFilesOp, deleteAllVaultMemoriesForUserOp, deleteAppFileOp, deleteEncryptedFile, deleteMediaByConversationOp, deleteMediaByMessageOp, deleteMediaOp, deleteMessageOp, deleteProjectOp, deleteSavedToolOp, deleteVaultFolderOp, deleteVaultMemoryOp, dequantizeEmbedding, deriveKeyFromSignatureBytes, deriveMemoryKeyRing, eagerEmbedContent, embedAllMessages, embedMessage, encodeChunkVector, encryptData, encryptDataBatch, encryptDataBytes, encryptDataWithKey, encryptToolCallEventsOp, ensureDefaultFoldersOp, expandToolSetsAdditive, exportElementToPdf, exportMarkdownToPdf, exportPublicKey, extractAndLinkEntitiesForMemoriesOp, extractAndRetain, extractEntitiesForMemories, extractFacts, extractFileIds, extractMCPImageUrls, extractReservationReceipts, fileExists, findById, findMatchingTools, findParentOfId, formatFileProcessingNotes, generateConversationId, generateEmbedding, generateEmbeddings, generateMediaId, generateProjectId, getAIGeneratedMediaOp, getAllSavedToolsOp, getAllVaultFoldersOp, getAllVaultMemoriesOp, getAllVaultMemoryContentsOp, getAndClearNotionPendingMessage, getAndClearNotionReturnUrl, getAppFileMapOp, getAppFileOp, getAppFilesOp, getAudioOp, getCachedServerTools, getConversationMemoriesOp, getConversationsByProjectLazyOp, getConversationsByProjectOp, getConversationsLazyOp, getConversationsPageOp, getDecayCandidatesRawOp, getDocumentsOp, getEncryptionKey, getEntitiesByMemoryIdsOp, getId, getImagesOp, getLogger, getMediaByConversationOp, getMediaByIdOp, getMediaByIdsOp, getMediaByMessageOp, getMediaByModelOp, getMediaByRoleOp, getMediaBySourceUrlOp, getMediaByTypeOp, getMediaCountOp, getMediaCountsByTypeOp, getMediaOp, getMediaTypeFromMime, getMemoriesByEntityNamesOp, getMemoriesNeedingTopicExtractionOp, getNotionAccessToken, getNotionMCPUrl, getNumberAttr, getProjectConversationCountOp, getProjectConversationsOp, getProjectOp, getProjectsOp, getRecentMediaOp, getSavedToolByIdOp, getServerTools, getStringAttr, getSupportedFileTypes, getToolsChecksum, getUnfiledVaultMemoriesOp, getUserUploadedMediaOp, getValidNotionToken, getVaultCandidateKeysOp, getVaultEmbeddingsByIdsOp, getVaultFolderMemoryCountOp, getVaultMemoriesByIdsOp, getVaultMemoryOp, getVaultRankingProjectionsOp, getVideosOp, handleNotionCallback, hardDeleteDecayedOp, hardDeleteMediaOp, hasEncryptionKey, hasICloudCredentials, hasKeyPair, hasNotionCredentials, ingestPublishedPhotoMemoriesOp, injectionSignatureCatalog, insertAfterId, insertChild, isAnumaTag, isAttachedFilesText, isDegradedTopicSkip, isEncrypted, isHtmlTag, isNotionCallback, isOPFSSupported, isR2UrlExpired, isRerankerAvailable, isSupportedFile, isSupportedMediaType, linkMemoryEntitiesOp, localChatBackend, maskScopedEmbeddingCache, mediaToStored, memoryCipher, migrateChatsToRemote, migrateDisplayResult, migrateMemoriesToRemote, migrateNotionClientRegistration, migrateNotionToken, moveMemoriesToFolderOp, noopLogger, onKeyAvailable, parseJsx, parseMedia, preEmbedVaultMemories, preprocessFiles, previewToolSelection, primaryTopic, projectToStored, putAppFileOp, quantizeEmbedding, queueManager, rankProfileCandidates, readEncryptedFile, recall, reencryptMemoryField, reflect, refreshEncryptionKeyIfMatches, refreshNotionToken, relinkMemoryTopicsOp, relinkMisclassifiedVideosOp, removeById, renderAnumaJsx, renderAnumaTree, renderElementToCanvas, replaceById, replaceMemoryEntitiesGuardedOp, requestEncryptionKey, requestKeyPair, resolveFilePlaceholders, resolveThemeColor, restoreVaultMemoryOp, resumeStream, retain, revokeNotionAccess, savedToolToStored, scoreProfileSalience, screenCandidatesForInjection, sdkMigrations, sdkModelClasses, sdkSchema, sealLegacyMessageEmbeddingsOp, searchChunksOp, searchMediaOp, searchMessagesOp, searchVaultMemories, seedEncryptionKeys, selectServerToolsForPrompt, serializeJsx, setLogger, setMemoryEntitiesOp, setMemoryVisibilityOp, settingsStorageSchema, shouldChunkMessage, shouldRecallMemory, shouldRefreshTools, stampTopicsExtractedAtOp, startNotionAuth, storeNotionPendingMessage, storeNotionReturnUrl, streamCancelPath, streamReplayPath, stripLegacyChunkTextOp, summarizeObservationTrends, supersedeVaultMemoryOp, synthesizeProfile, topicWeight, traverseGraphLane, ttlForType, updateAttrs, updateConversationProjectOp, updateMediaMessageIdBatchOp, updateMediaOp, updateMessageFeedbackOp, updateProjectNameOp, updateProjectOp, updateSavedToolOp, updateVaultFolderContextOp, updateVaultFolderOp, updateVaultMemoryEmbeddingOp, updateVaultMemoryOp, useAnumaTheme, useBackup, useBackupAuth, useChat, useChatStorage, useCredits, useDatabaseManager, useEncryption, useExportPdf, useFiles, useICloudAuth, useICloudBackup, useModels, useOCR, usePdf, usePhoneCalls, useProjects, useSettings, useSubscription, useTools, useUIInteraction, useVoice, useWalletBinding, userPreferencesStorageSchema, vaultChatBackend, verifyMemoriesForPublish, walk, webPlatformStorage, withActiveToolSetServerTools, withInternalFlowMarker, writeEncryptedFile };
16215
+ export { Anuma, type AnumaChild, AnumaJsxError, type AnumaNode, AnumaShadowIsolationProvider, type AnumaShadowIsolationProviderProps, type AnumaTheme, AnumaThemeProvider, type AnumaThemeProviderProps, AppFile as AppFileModel, type AppFileOperationsContext, type AttrValue, type AutoExtractMessage, type AutoExtractor, DEFAULT_BACKUP_FOLDER as BACKUP_ICLOUD_FOLDER, BUILT_IN_TOOL_SETS, type BackupAuthContextValue, BackupAuthProvider, type BackupAuthProviderProps, type BackupOperationOptions, BlobUrlManager, type Budget, CHUNKS_DISCARDED_ORIGIN, type CachedChunkVectors, type CachedServerTools, ChartCard, type ChartCardProps, type ChartConfig, ChartContainer, ChartLegend, ChartLegendContent, ChartStyle, ChartTooltip, ChartTooltipContent, 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 ChatStorageAdapter, type ChatStorageObservable, type ChatStore, ChatStoreError, type ChatWrite, type ChunkSearchResult, type ChunkSearchStats, type ChunkVectorCache, type ChunkingOptions, type CircleProps, type ClientToolsFilterFn, type ConsolidationAction, type ConsolidationFallbackReason, type ConversationMemoryInput, ConversationMemory as ConversationMemoryModel, type ConversationMemoryOperationsContext, type ConversationQueryOptions, type CreateAutoExtractorOptions, type CreateConversationOptions, type CreateDecaySweeperOptions, type CreateEntityOptions, type CreateMediaOptions, type CreateMessageOptions, type CreateModelPreferenceOptions, type CreateProjectOptions, type CreateSavedToolOptions, type CreateSelectPaymentWalletToolOptions, type CreateServerToolsFilterOptions, type CreateUserPreferenceOptions, 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_EXCLUDED_SERVER_TOOLS, DEFAULT_BACKUP_FOLDER as DEFAULT_ICLOUD_BACKUP_FOLDER, DEFAULT_MAX_CLASSIFIER_CALLS_PER_SWEEP, DEFAULT_MIN_CHUNK_SIZE, DEFAULT_PERSONALITY_SETTINGS, DEFAULT_PROFILE_FACETS, DEFAULT_PROFILE_FACT_TYPE_WEIGHTS, DEFAULT_PROFILE_PROOF_ALPHA, DEFAULT_PROFILE_TREND_MULTIPLIERS, DEFAULT_SERVER_TOOLS_MATCH_OPTIONS, DEFAULT_VAULT_CACHE_SIZE, DatabaseManager, type DatabaseManagerLogger, type DatabaseManagerOptions, type DecayCandidateRaw, type DecayClassifier, type DecayInput, type DecayPolicy, type DecaySweepResult, type DecaySweeper, type DecayVerdict, type DeckProps, type DisplayToolMigrations, type DurableAutoExtractorOptions, ENTITY_FANOUT, ENTITY_KINDS, type EmbeddedWalletSignerFn, type EmbeddingRepairOptions, type EmbeddingRepairResult, EncryptionKeyMissingError, type EncryptionKeyVersion, type EntityInput, type EntityKind, Entity as EntityModel, type EntityOperationsContext, ExcelProcessor, type ExtractFactsOptions, type ExtractOutcome, type ExtractedCandidate, type ExtractedEntity, type ExtractionCursorStore, type ExtractionFunnel, type ExtractionMessageSource, type ExtractionSourceMessage, type ExtractionSourceStatus, type ExtractionTimings, FILE_PLACEHOLDER_PREFIX, FILE_PLACEHOLDER_REGEX, type FactType, type FileMetadata, type FileProcessingReason, type FileProcessingStatus, type FileProcessor, type FileTypeQuery, type FileWithData, type FlushResult, type GetConversationsPageOptions, type GetMessagesPageOptions, type GraphTraversalOptions, type GroupProps, HARD_DELETE_WINDOW_MS, type ICloudAuthContextValue, ICloudAuthProvider, type ICloudAuthProviderProps, type ICloudExportResult, type ICloudImportResult, INFERENCE_ID_HEADER, INTERNAL_FLOW_MARKER, type IconProps, type ImageProps, type InjectionClassifierOptions, type InjectionReason, type InteractionType, type KnownTag, type LazyStoredConversation, type LineProps, type LlmDecayClassifierOptions, type LlmNeighborRefinerOptions, type LocalMemoryStoreOptions, type Logger, LoggerProvider, type LoggerProviderProps, MAX_HOPS, MEDIUM_TTL_MS, MEMORY_KINDS, MEMORY_LEVELS, type ManualFactType, type MediaDimensions, type MediaFilterOptions, type MediaMetadata, type MediaOperationsContext, type MediaRole, type MediaType, 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, MemoryEntity as MemoryEntityModel, 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 MessageChunk, type MessageFeedback, type MessageOrigin, type MessageSkeleton, type ModelLoadProgress, NEVER_TTL_MS, NODE_BUDGET, type NeighborRefiner, type NowSource, type OCRFile, type ObservationTrend, type ObservationTrendInput, type OperationExecutor, PAST_EVENT_GRACE_MS, PROFILE_DOC_VERSION, type ParsedServerToolsResponse, type PaymentWallet, type PdfExportOptions, type PdfExportProgress, type PdfExportStage, type PdfFile, PdfProcessor, type PendingInteraction, type PersonalitySettings, type PersonalitySliders, type PersonalityStyle, type PhoneCallPollingOptions, type PhotoIngestResult, type PhotoMediaRef, type PlatformStorage, type PortalLlmAuth, type PortalLlmFailure, type PortalLlmFailureReason, type PreprocessingOptions, type PreprocessingResult, type ProcessedFileResult, ProcessorRegistry, type ProfileConfigFingerprint, type ProfileDoc, type ProfileFacet, type ProfileFacetKey, type ProfileSalienceInput, type ProfileSection, type ProfileUpdate, type ProgressCallback, Project, type ProjectOperationsContext, type PromptPreProcessor, type PromptPreProcessorContext, type ProviderAuthState, type ProviderBackupState, ProviderStreamError, type PublishedPhotoMemory, type QuantizedEmbedding, type QuarantinedMemoryInfo, type QueueEncryptionContext, QueueManager, type QueueStatus, type QueuedOperation, type QueuedOperationType, R2_DEFAULT_TTL_MS, 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 RectProps, 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 RetainAction, type RetainContext, type RetainOptions, type RetainResult, type RetainSource, SDK_SCHEMA_VERSION, SELECT_PAYMENT_WALLET_TOOL_NAME, SERVER_TOOL_DEPENDENCY_SETS, SHORT_TTL_MS, SLIDER_CONFIG, SLIDES_FILE_PATH, SLIDE_CANVAS_HEIGHT, SLIDE_CANVAS_WIDTH, STREAM_RESUMABLE_HEADER, SavedTool as SavedToolModel, type SavedToolOperationsContext, type SavedToolParameter, type ScoreBreakdown, type ScoreProfileSalienceOptions, type ScreenProps, type ScreenResult, type ScreenedCandidate, type SearchMessagesOptions, type SearchSource, type SelectPaymentWalletResult, type SelectServerToolsForPromptOptions, type SendMessageWithStorageArgs, type SendMessageWithStorageResult, type ServerTool, type ServerToolsFilter, type ServerToolsFilterFn, type ServerToolsFilterFunction, type ServerToolsOptions, type ServerToolsResponse, type SignMessageFn, type SignMessageOptions, type SlideProps, type StepFinishEvent, type StockPriceClassification, type StockPricePreProcessorOptions, type StorageOperationsContext, type StoredAppFile, type ChatCompletionUsage as StoredChatCompletionUsage, type StoredConversation, type StoredConversationMemory, type StoredEntity, type StoredFileWithContext, type StoredMedia, Media as StoredMediaModel, type StoredMessage, type StoredMessageWithSimilarity, type StoredModelPreference, ModelPreference as StoredModelPreferenceModel, type StoredProject, type StoredSavedTool, type StoredTopic, type StoredUserPreference, UserPreference as StoredUserPreferenceModel, type StoredVaultFolder, VaultFolder as StoredVaultFolderModel, type StoredVaultMemory, VaultMemory as StoredVaultMemoryModel, StreamExpiredError, type StreamMetaEvent, type StreamResumeHandle, type StreamSmoothingConfig, type SynthesizeProfileOptions, THEME_ATTRS, TOOL_RESULT_ORIGIN, TOPICS_EXTRACTION_VERSION, TOPIC_EXTRACTION_BATCH_SIZE, TOPIC_SALIENCE_WEIGHTS, TREND_RECENT_WINDOW_DAYS, TREND_STALE_WINDOW_DAYS, type TextChunk, TextProcessor, type TextProps, type ThemeAttr, type ToolCallArgumentsDeltaEvent, type ToolMatchOptions, type ToolMatchResult, type ToolSet, type TopicExtractOptions, type TopicExtractionBatchDiagnostics, type TopicExtractionInput, type TopicExtractionRunResult, type TopicSalience, type TopicSkipReason, type TopicSource, type TranscriptionResult, type TurnCompleteEvent, type TurnSkippedEvent, type UIInteractionContextValue, UIInteractionProvider, type UIInteractionProviderProps, type UncheckedReason, type UnverifiableReason, type UpdateMediaOptions, type UpdateModelPreferenceOptions, type UpdateProjectOptions, type UpdateSavedToolOptions, type UpdateUserPreferenceOptions, type UpdateVaultFolderOptions, type UpdateVaultMemoryOptions, type UseBackupOptions, type UseBackupResult, type UseChatStorageOptions, type UseChatStorageResult, type UseCreditsOptions, type UseCreditsResult, type UseEncryptionResult, type UseExportPdfResult, type UseFilesOptions, type UseFilesResult, type UseICloudBackupOptions, type UseICloudBackupResult, type UseModelsResult, type UseOCRResult, type UsePdfResult, type UsePhoneCallsOptions, type UsePhoneCallsResult, type UseProjectsOptions, type UseProjectsResult, type UseSettingsOptions, type UseSettingsResult, type UseSubscriptionOptions, type UseSubscriptionResult, type UseToolsOptions, type UseToolsResult, type UseVoiceOptions, type UseVoiceResult, type UseWalletBindingOptions, type UseWalletBindingResult, VAULT_SIZE_HOP_CAP, type VaultCandidateKey, 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, type VoiceRecording, WALLET_PAYMENT_TOOL_NAME, type WalletPaymentOutcome, type WalletPaymentPassenger, type WalletPaymentRequest, type WalletPaymentResult, WalletPoller, WatermelonChatStorageAdapter, type WatermelonChatStorageAdapterOptions, type WeatherClassification, type WeatherPreProcessorOptions, type WebSearchClassification, type WebSearchPreProcessorOptions, type WhisperModel, WordProcessor, type WriteFailureReason, ZipProcessor, type ZipProcessorOptions, addConversationMemoriesOp, appFileToStored, archiveVaultMemoryOp, assembleMemoryContext, attachFileContextToLastUserMessage, backfillMemoryEntityUserIdsOp, backfillMemoryTopicsOp, buildAttachedFilesText, capHopsForDensity, chatStorageMigrations, chatStorageSchema, chunkAndEmbedAllMessages, chunkAndEmbedMessage, chunkText, classifyCryptoPrice, classifyCryptoPriceBatch, classifyDecay, classifyInjectionCandidates, classifyObservationTrend, classifyStockPrice, classifyStockPriceBatch, classifyWeather, classifyWeatherBatch, classifyWebSearch, classifyWebSearchBatch, clearAllEncryptionKeys, clearAllEncryptionState, clearAllKeyPairs, clearConversationMemoriesOp, clearEncryptionKey, clearICloudAuth, clearKeyPair, clearLazyTitleCache, clearMemoryTopicsOverrideOp, clearModelsCache, clearNotionToken, clearServerToolsCache, consoleLogger, conversationMemoryToStored, cosineInt8, createAutoExtractor, createChunkVectorCache, createCryptoPricePreProcessor, createDecaySweeper, createDurableAutoExtractor, createGitHubTools, createLlmDecayClassifier, createLlmNeighborRefiner, createLocalMemoryStore, createMediaBatchOp, createMediaOp, createMemoryEngineTool, createMemoryVaultSearchTool, createMemoryVaultTool, createMessageSourceResolver, createPlatformCursorStore, createProjectOp, createRecallTool, createRemoteChatStore, createRemoteMemoryPersistence, createRemoteMemoryPipeline, createRemoteMemoryStore, createSavedToolOp, createSelectPaymentWalletTool, createServerToolsFilter, createStockPricePreProcessor, createVaultChatBackend, createVaultEmbeddingCache, createVaultFolderOp, createVaultMemoriesBatchOp, createVaultMemoryOp, createWalletPaymentTool, createWeatherPreProcessor, createWebSearchPreProcessor, decodeChunkVector, decryptConversationTitle, decryptData, decryptDataBatch, decryptDataBytes, decryptDataBytesFromBytes, decryptDataWithKey, decryptMessageEmbeddingFields, defaultServerToolsFilter, deleteAllAppFilesOp, deleteAllVaultMemoriesForUserOp, deleteAppFileOp, deleteEncryptedFile, deleteMediaByConversationOp, deleteMediaByMessageOp, deleteMediaOp, deleteMessageOp, deleteProjectOp, deleteSavedToolOp, deleteVaultFolderOp, deleteVaultMemoryOp, dequantizeEmbedding, deriveKeyFromSignatureBytes, deriveMemoryKeyRing, eagerEmbedContent, embedAllMessages, embedMessage, encodeChunkVector, encryptData, encryptDataBatch, encryptDataBytes, encryptDataWithKey, encryptToolCallEventsOp, ensureDefaultFoldersOp, expandToolSetsAdditive, exportElementToPdf, exportMarkdownToPdf, exportPublicKey, extractAndLinkEntitiesForMemoriesOp, extractAndRetain, extractEntitiesForMemories, extractFacts, extractFileIds, extractMCPImageUrls, extractReservationReceipts, fileExists, findById, findMatchingTools, findParentOfId, formatFileProcessingNotes, generateConversationId, generateEmbedding, generateEmbeddings, generateMediaId, generateProjectId, getAIGeneratedMediaOp, getAllSavedToolsOp, getAllVaultFoldersOp, getAllVaultMemoriesOp, getAllVaultMemoryContentsOp, getAndClearNotionPendingMessage, getAndClearNotionReturnUrl, getAppFileMapOp, getAppFileOp, getAppFilesOp, getAudioOp, getCachedServerTools, getConversationMemoriesOp, getConversationsByProjectLazyOp, getConversationsByProjectOp, getConversationsLazyOp, getConversationsPageOp, getDecayCandidatesRawOp, getDocumentsOp, getEncryptionKey, getEntitiesByMemoryIdsOp, getId, getImagesOp, getLogger, getMediaByConversationOp, getMediaByIdOp, getMediaByIdsOp, getMediaByMessageOp, getMediaByModelOp, getMediaByRoleOp, getMediaBySourceUrlOp, getMediaByTypeOp, getMediaCountOp, getMediaCountsByTypeOp, getMediaOp, getMediaTypeFromMime, getMemoriesByEntityNamesOp, getMemoriesNeedingTopicExtractionOp, getNotionAccessToken, getNotionMCPUrl, getNumberAttr, getProjectConversationCountOp, getProjectConversationsOp, getProjectOp, getProjectsOp, getRecentMediaOp, getSavedToolByIdOp, getServerTools, getStringAttr, getSupportedFileTypes, getToolsChecksum, getUnfiledVaultMemoriesOp, getUserUploadedMediaOp, getValidNotionToken, getVaultCandidateKeysOp, getVaultEmbeddingsByIdsOp, getVaultFolderMemoryCountOp, getVaultMemoriesByIdsOp, getVaultMemoryOp, getVaultRankingProjectionsOp, getVideosOp, handleNotionCallback, hardDeleteDecayedOp, hardDeleteMediaOp, hasEncryptionKey, hasICloudCredentials, hasKeyPair, hasNotionCredentials, ingestPublishedPhotoMemoriesOp, injectionSignatureCatalog, insertAfterId, insertChild, isAnumaTag, isAttachedFilesText, isDegradedTopicSkip, isEncrypted, isHtmlTag, isNotionCallback, isOPFSSupported, isR2UrlExpired, isRerankerAvailable, isSupportedFile, isSupportedMediaType, linkMemoryEntitiesOp, localChatBackend, maskScopedEmbeddingCache, mediaToStored, memoryCipher, migrateChatsToRemote, migrateDisplayResult, migrateMemoriesToRemote, migrateNotionClientRegistration, migrateNotionToken, moveMemoriesToFolderOp, noopLogger, onKeyAvailable, parseJsx, parseMedia, preEmbedVaultMemories, preprocessFiles, previewToolSelection, primaryTopic, projectToStored, putAppFileOp, quantizeEmbedding, queueManager, rankProfileCandidates, readEncryptedFile, recall, reencryptMemoryField, reflect, refreshEncryptionKeyIfMatches, refreshNotionToken, relinkMemoryTopicsOp, relinkMisclassifiedVideosOp, removeById, renderAnumaJsx, renderAnumaTree, renderElementToCanvas, replaceById, replaceMemoryEntitiesGuardedOp, requestEncryptionKey, requestKeyPair, resolveFilePlaceholders, resolveThemeColor, restoreVaultMemoryOp, resumeStream, retain, revokeNotionAccess, savedToolToStored, scoreProfileSalience, screenCandidatesForInjection, sdkMigrations, sdkModelClasses, sdkSchema, sealLegacyMessageEmbeddingsOp, searchChunksOp, searchMediaOp, searchMessagesOp, searchVaultMemories, seedEncryptionKeys, selectServerToolsForPrompt, serializeJsx, setLogger, setMemoryEntitiesOp, setMemoryVisibilityOp, settingsStorageSchema, shouldChunkMessage, shouldRecallMemory, shouldRefreshTools, stampTopicsExtractedAtOp, startNotionAuth, storeNotionPendingMessage, storeNotionReturnUrl, streamCancelPath, streamReplayPath, stripLegacyChunkTextOp, summarizeObservationTrends, supersedeVaultMemoryOp, synthesizeProfile, topicWeight, traverseGraphLane, ttlForType, updateAttrs, updateConversationProjectOp, updateMediaMessageIdBatchOp, updateMediaOp, updateMessageFeedbackOp, updateProjectNameOp, updateProjectOp, updateSavedToolOp, updateVaultFolderContextOp, updateVaultFolderOp, updateVaultMemoryEmbeddingOp, updateVaultMemoryOp, useAnumaTheme, useBackup, useBackupAuth, useChat, useChatStorage, useCredits, useDatabaseManager, useEncryption, useExportPdf, useFiles, useICloudAuth, useICloudBackup, useModels, useOCR, usePdf, usePhoneCalls, useProjects, useSettings, useSubscription, useTools, useUIInteraction, useVoice, useWalletBinding, userPreferencesStorageSchema, vaultChatBackend, verifyMemoriesForPublish, walk, webPlatformStorage, withActiveToolSetServerTools, withInternalFlowMarker, writeEncryptedFile };