@anuma/sdk 6.37.0 → 6.38.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.
@@ -3356,7 +3356,7 @@ function extractUserMessageFromMessages(messages) {
3356
3356
  }
3357
3357
 
3358
3358
  // src/lib/db/chat/operations.ts
3359
- function messageToStoredRaw(message, projection) {
3359
+ function messageToStoredRaw(message, projection2) {
3360
3360
  const convId = String(message._getRaw("conversation_id"));
3361
3361
  const parseJsonField = (rawValue) => {
3362
3362
  if (!rawValue) return void 0;
@@ -3370,7 +3370,7 @@ function messageToStoredRaw(message, projection) {
3370
3370
  }
3371
3371
  return rawValue;
3372
3372
  };
3373
- const skipEmbeddings = projection?.skipEmbeddings === true;
3373
+ const skipEmbeddings = projection2?.skipEmbeddings === true;
3374
3374
  const sourcesRaw = message._getRaw("sources");
3375
3375
  const vectorRaw = skipEmbeddings ? null : message._getRaw("vector");
3376
3376
  const chunksRaw = skipEmbeddings ? null : message._getRaw("chunks");
@@ -3404,8 +3404,8 @@ function messageToStoredRaw(message, projection) {
3404
3404
  origin: message.origin
3405
3405
  };
3406
3406
  }
3407
- async function messageToStored(message, walletAddress, signMessage, embeddedWalletSigner, projection) {
3408
- const baseMessage = messageToStoredRaw(message, projection);
3407
+ async function messageToStored(message, walletAddress, signMessage, embeddedWalletSigner, projection2) {
3408
+ const baseMessage = messageToStoredRaw(message, projection2);
3409
3409
  if (walletAddress) {
3410
3410
  return await decryptMessageFields(
3411
3411
  baseMessage,
@@ -3419,7 +3419,7 @@ async function messageToStored(message, walletAddress, signMessage, embeddedWall
3419
3419
  function rawDate(value) {
3420
3420
  return new Date(typeof value === "number" ? value : 0);
3421
3421
  }
3422
- function messageRawToStoredRaw(raw, projection) {
3422
+ function messageRawToStoredRaw(raw, projection2) {
3423
3423
  const parseJsonField = (rawValue) => {
3424
3424
  if (!rawValue) return void 0;
3425
3425
  if (typeof rawValue === "string") {
@@ -3432,7 +3432,7 @@ function messageRawToStoredRaw(raw, projection) {
3432
3432
  }
3433
3433
  return rawValue;
3434
3434
  };
3435
- const skipEmbeddings = projection?.skipEmbeddings === true;
3435
+ const skipEmbeddings = projection2?.skipEmbeddings === true;
3436
3436
  const vectorRaw = skipEmbeddings ? null : raw.vector;
3437
3437
  const chunksRaw = skipEmbeddings ? null : raw.chunks;
3438
3438
  return {
@@ -3463,8 +3463,8 @@ function messageRawToStoredRaw(raw, projection) {
3463
3463
  origin: raw.origin
3464
3464
  };
3465
3465
  }
3466
- async function messageRawToStored(raw, walletAddress, signMessage, embeddedWalletSigner, projection) {
3467
- const baseMessage = messageRawToStoredRaw(raw, projection);
3466
+ async function messageRawToStored(raw, walletAddress, signMessage, embeddedWalletSigner, projection2) {
3467
+ const baseMessage = messageRawToStoredRaw(raw, projection2);
3468
3468
  if (walletAddress) {
3469
3469
  return await decryptMessageFields(
3470
3470
  baseMessage,
@@ -12997,22 +12997,35 @@ async function vaultMemoryRawToStored(raw, walletAddress, signMessage, embeddedW
12997
12997
  return stored2;
12998
12998
  }
12999
12999
  async function getAllVaultMemoriesOp(ctx, options) {
13000
- const conditions = [
13000
+ const results = await ctx.vaultMemoryCollection.query(...vaultListConditions(ctx, options), ...vaultListOrder(options)).unsafeFetchRaw();
13001
+ return mapInBatches(
13002
+ results,
13003
+ (raw) => vaultMemoryRawToStored(raw, ctx.walletAddress, ctx.signMessage, ctx.embeddedWalletSigner)
13004
+ );
13005
+ }
13006
+ function vaultListConditions(ctx, options) {
13007
+ return [
13001
13008
  ...baseVaultConditions(ctx, options),
13002
13009
  ...options?.scopes?.length ? [import_watermelondb20.Q.where("scope", import_watermelondb20.Q.oneOf(options.scopes))] : [],
13003
13010
  ...visibilityConditions(options?.visibility),
13004
13011
  ...levelConditions(options?.levels),
13005
13012
  ...options?.kinds?.length ? [import_watermelondb20.Q.where("kind", import_watermelondb20.Q.oneOf(options.kinds))] : [],
13006
13013
  ...options?.folderId !== void 0 ? [import_watermelondb20.Q.where("folder_id", options.folderId)] : [],
13007
- ...options?.factTypes?.length ? [import_watermelondb20.Q.where("fact_type", import_watermelondb20.Q.oneOf(options.factTypes))] : [],
13014
+ ...options?.factTypes?.length ? [import_watermelondb20.Q.where("fact_type", import_watermelondb20.Q.oneOf(options.factTypes))] : []
13015
+ ];
13016
+ }
13017
+ function vaultListOrder(options) {
13018
+ return [
13008
13019
  import_watermelondb20.Q.sortBy(options?.since ? "updated_at" : "created_at", import_watermelondb20.Q.desc),
13009
13020
  ...options?.limit !== null && options?.limit !== void 0 && options.limit > 0 ? [import_watermelondb20.Q.take(options.limit)] : []
13010
13021
  ];
13011
- const results = await ctx.vaultMemoryCollection.query(...conditions).unsafeFetchRaw();
13012
- return mapInBatches(
13013
- results,
13014
- (raw) => vaultMemoryRawToStored(raw, ctx.walletAddress, ctx.signMessage, ctx.embeddedWalletSigner)
13015
- );
13022
+ }
13023
+ async function getVaultMemoryProjectionsOp(ctx, options) {
13024
+ const results = await ctx.vaultMemoryCollection.query(...vaultListConditions(ctx, options), ...vaultListOrder(options)).unsafeFetchRaw();
13025
+ return results.map((raw) => ({
13026
+ ...vaultMemoryRawToRankable(raw),
13027
+ topicsUserManaged: raw.topics_user_managed === true || raw.topics_user_managed === 1
13028
+ }));
13016
13029
  }
13017
13030
  function vaultMemoryRawToRankable(raw) {
13018
13031
  return {
@@ -19693,6 +19706,7 @@ function createLocalMemoryStore(options) {
19693
19706
  };
19694
19707
  const vaultCache = options.vaultCache ?? createVaultEmbeddingCache();
19695
19708
  const ownedBy = userId !== void 0 ? [import_watermelondb23.Q.where("user_id", userId)] : [];
19709
+ const linksOwnedBy = userId === void 0 ? [] : options.allowUnscopedRows ? [import_watermelondb23.Q.or(import_watermelondb23.Q.where("user_id", userId), import_watermelondb23.Q.where("user_id", null))] : [import_watermelondb23.Q.where("user_id", userId)];
19696
19710
  const watchedColumns = [
19697
19711
  "content",
19698
19712
  "scope",
@@ -19735,6 +19749,29 @@ function createLocalMemoryStore(options) {
19735
19749
  },
19736
19750
  memoriesByTopics: (names) => getMemoriesByEntityNamesOp(entityCtx, names),
19737
19751
  topicsByMemories: (memoryIds) => getEntitiesByMemoryIdsOp(entityCtx, memoryIds),
19752
+ listTopics: async () => {
19753
+ const links = await entityCtx.memoryEntityCollection.query(...linksOwnedBy).fetch();
19754
+ const members = /* @__PURE__ */ new Map();
19755
+ for (const link of links) {
19756
+ const entityId = String(link.entityId);
19757
+ const set = members.get(entityId) ?? /* @__PURE__ */ new Set();
19758
+ set.add(String(link.memoryId));
19759
+ members.set(entityId, set);
19760
+ }
19761
+ const entities = userId === void 0 ? await entityCtx.entityCollection.query().fetch() : members.size ? await entityCtx.entityCollection.query(import_watermelondb23.Q.where("id", import_watermelondb23.Q.oneOf([...members.keys()]))).fetch() : [];
19762
+ const byName = /* @__PURE__ */ new Map();
19763
+ for (const entity of entities) {
19764
+ const count2 = members.get(entity.id)?.size ?? 0;
19765
+ const existing = byName.get(entity.canonicalName);
19766
+ byName.set(entity.canonicalName, {
19767
+ name: entity.canonicalName,
19768
+ kind: existing?.kind ?? entity.kind ?? null,
19769
+ memoryCount: (existing?.memoryCount ?? 0) + count2
19770
+ });
19771
+ }
19772
+ return [...byName.values()].sort((a, b) => a.name.localeCompare(b.name));
19773
+ },
19774
+ listProjections: (listOptions) => getVaultMemoryProjectionsOp(vaultCtx, listOptions),
19738
19775
  create: async (input) => {
19739
19776
  const created = await createVaultMemoryOp(vaultCtx, input);
19740
19777
  if (input.embedding === void 0) embedInBackground(created);
@@ -19796,7 +19833,6 @@ function createLocalMemoryStore(options) {
19796
19833
  );
19797
19834
  const subscriptions = [memories.subscribe(afterFirst())];
19798
19835
  if (subscribeOptions?.topics) {
19799
- const linksOwnedBy = userId === void 0 ? [] : options.allowUnscopedRows ? [import_watermelondb23.Q.or(import_watermelondb23.Q.where("user_id", userId), import_watermelondb23.Q.where("user_id", null))] : [import_watermelondb23.Q.where("user_id", userId)];
19800
19836
  subscriptions.push(
19801
19837
  entityCtx.memoryEntityCollection.query(...linksOwnedBy).observe().subscribe(afterFirst())
19802
19838
  );
@@ -20206,6 +20242,31 @@ async function createRemoteMemoryPersistence(options) {
20206
20242
  throw new Error("Invalid nearby candidate response");
20207
20243
  return result;
20208
20244
  };
20245
+ const fetchQueryPage = async (queryOptions) => {
20246
+ const { signal, ...query } = queryOptions;
20247
+ if (query.limit !== void 0 && (!Number.isInteger(query.limit) || query.limit < 1 || query.limit > 200))
20248
+ throw new Error("Page limit must be 1\u2013200");
20249
+ for (const [key, max] of queryListLimits) {
20250
+ const values = query[key];
20251
+ if (values && values.length > max)
20252
+ throw new Error(`Query ${key} accepts at most ${max} entries (got ${values.length})`);
20253
+ }
20254
+ const page = await request(
20255
+ "/memories/query",
20256
+ {
20257
+ method: "POST",
20258
+ body: JSON.stringify(
20259
+ Object.fromEntries(
20260
+ queryFields.filter((key) => query[key] !== void 0).map((key) => [key, query[key]])
20261
+ )
20262
+ )
20263
+ },
20264
+ signal
20265
+ );
20266
+ if (!record(page) || !Array.isArray(page.items) || page.next_cursor !== void 0 && typeof page.next_cursor !== "string" || page.changes_cursor !== void 0 && typeof page.changes_cursor !== "string")
20267
+ throw new Error("Invalid nearby private-memory page");
20268
+ return page;
20269
+ };
20209
20270
  const candidateSet = async (embedding, candidateOptions = {}) => {
20210
20271
  const result = await fetchCandidates(embedding, candidateOptions, true);
20211
20272
  if (!Number.isSafeInteger(result.total_count) || result.total_count < 0 || !Number.isSafeInteger(result.unavailable_count) || result.unavailable_count < 0)
@@ -20284,34 +20345,27 @@ async function createRemoteMemoryPersistence(options) {
20284
20345
  return Promise.all(result.items.map((item, i) => decodeCommitted(item, prepared[i])));
20285
20346
  },
20286
20347
  query: async (queryOptions = {}) => {
20287
- const { signal, ...query } = queryOptions;
20288
- if (query.limit !== void 0 && (!Number.isInteger(query.limit) || query.limit < 1 || query.limit > 200))
20289
- throw new Error("Page limit must be 1\u2013200");
20290
- for (const [key, max] of queryListLimits) {
20291
- const values = query[key];
20292
- if (values && values.length > max)
20293
- throw new Error(`Query ${key} accepts at most ${max} entries (got ${values.length})`);
20294
- }
20295
- const page = await request(
20296
- "/memories/query",
20297
- {
20298
- method: "POST",
20299
- body: JSON.stringify(
20300
- Object.fromEntries(
20301
- queryFields.filter((key) => query[key] !== void 0).map((key) => [key, query[key]])
20302
- )
20303
- )
20304
- },
20305
- signal
20306
- );
20307
- if (!record(page) || !Array.isArray(page.items) || page.next_cursor !== void 0 && typeof page.next_cursor !== "string" || page.changes_cursor !== void 0 && typeof page.changes_cursor !== "string")
20308
- throw new Error("Invalid nearby private-memory page");
20348
+ const page = await fetchQueryPage(queryOptions);
20309
20349
  return {
20310
20350
  ...await decodeAll(page.items),
20311
20351
  ...page.next_cursor !== void 0 && { next_cursor: page.next_cursor },
20312
20352
  ...page.changes_cursor !== void 0 && { changes_cursor: page.changes_cursor }
20313
20353
  };
20314
20354
  },
20355
+ queryMetadata: async (queryOptions = {}) => {
20356
+ const page = await fetchQueryPage(queryOptions);
20357
+ return {
20358
+ items: page.items.map((item) => {
20359
+ const {
20360
+ memory: { content: _content, kind_value: _kindValue, ...memory },
20361
+ version,
20362
+ server_updated_at
20363
+ } = memoryRecord(item);
20364
+ return { memory, version, server_updated_at };
20365
+ }),
20366
+ ...page.next_cursor !== void 0 && { next_cursor: page.next_cursor }
20367
+ };
20368
+ },
20315
20369
  candidateSet,
20316
20370
  candidates: async (embedding, candidateOptions = {}) => decodeAll((await fetchCandidates(embedding, candidateOptions, false)).items)
20317
20371
  };
@@ -20704,6 +20758,19 @@ function createRemoteMemoryPipeline(options) {
20704
20758
  // src/lib/memory/store/remoteStore.ts
20705
20759
  var import_uuid5 = require("uuid");
20706
20760
  init_logger();
20761
+ function projection({ memory }) {
20762
+ return {
20763
+ uniqueId: memory.memory_id,
20764
+ scope: memory.scope,
20765
+ folderId: memory.folder_id ?? null,
20766
+ embedding: memory.embedding?.length ? JSON.stringify(memory.embedding) : null,
20767
+ embeddingModel: memory.embedding_model ?? null,
20768
+ createdAt: new Date(memory.created_at),
20769
+ updatedAt: new Date(memory.updated_at),
20770
+ lastObservedAt: memory.last_observed_at ?? null,
20771
+ topicsUserManaged: memory.topics_user_managed ?? false
20772
+ };
20773
+ }
20707
20774
  function relevant(change, options) {
20708
20775
  return options.includeDeleted ? change === "membership" : change !== "embedding" || !!options.embeddings;
20709
20776
  }
@@ -20738,6 +20805,9 @@ function bounded(filters, key) {
20738
20805
  if (!values || values.length <= MAX_QUERY_FILTER) return [filters];
20739
20806
  return chunks(values, MAX_QUERY_FILTER).map((chunk) => ({ ...filters, [key]: chunk }));
20740
20807
  }
20808
+ function maxOf(options) {
20809
+ return options.limit && options.limit > 0 ? options.limit : Infinity;
20810
+ }
20741
20811
  function chunks(values, size) {
20742
20812
  const out = [];
20743
20813
  for (let i = 0; i < values.length; i += size) out.push(values.slice(i, i + size));
@@ -20809,26 +20879,49 @@ function createRemoteMemoryStore(options) {
20809
20879
  for (const subscriber of [...subscribers])
20810
20880
  if (relevant(change, subscriber.options)) safely(subscriber.onChange);
20811
20881
  };
20812
- const enumerate = async (filters, max = Infinity) => {
20882
+ const pages = async (read, filters, max = Infinity) => {
20813
20883
  const records = [];
20814
20884
  let cursor2;
20815
20885
  do {
20816
- const page = await persistence.query({
20886
+ const page = await read({
20817
20887
  ...filters,
20818
20888
  limit: Math.min(200, Math.max(1, max - records.length)),
20819
20889
  ...cursor2 && { cursor: cursor2 }
20820
20890
  });
20821
- warnFailed(page.failed);
20891
+ if (page.failed) warnFailed(page.failed);
20822
20892
  records.push(...page.items);
20823
20893
  cursor2 = page.next_cursor;
20824
20894
  } while (cursor2 && records.length < max);
20825
20895
  return records.slice(0, max);
20826
20896
  };
20827
- const enumerateIds = async (ids, filters) => (await Promise.all(
20897
+ const decrypted = (options2) => persistence.query(options2);
20898
+ const metadata = (options2) => persistence.queryMetadata(options2);
20899
+ const enumerate = (filters, max = Infinity) => pages(decrypted, filters, max);
20900
+ const enumerateIds = async (read, ids, filters) => (await Promise.all(
20828
20901
  chunks([...new Set(ids)], MAX_QUERY_IDS).map(
20829
- (memory_ids) => enumerate({ ...filters, memory_ids })
20902
+ (memory_ids) => pages(read, { ...filters, memory_ids })
20830
20903
  )
20831
20904
  )).flat();
20905
+ const listFilters = (listOptions) => ({
20906
+ ...stateFilters(listOptions),
20907
+ include_embeddings: true,
20908
+ order: listOptions.since ? "updated" : "created",
20909
+ ...listOptions.scopes?.length && { scopes: listOptions.scopes },
20910
+ ...listOptions.factTypes?.length && { fact_types: listOptions.factTypes },
20911
+ ...listOptions.visibility?.length && { visibility: listOptions.visibility },
20912
+ ...listOptions.since && { updated_after: listOptions.since.getTime() }
20913
+ });
20914
+ const listRows = async (read, listOptions, filters, max) => {
20915
+ const variants = bounded(filters, "scopes").flatMap((f) => bounded(f, "fact_types"));
20916
+ if (!listOptions.memoryIds && variants.length === 1) return pages(read, filters, max);
20917
+ const fetched = await Promise.all(
20918
+ variants.map(
20919
+ (variant) => listOptions.memoryIds ? enumerateIds(read, listOptions.memoryIds, variant) : pages(read, variant, max)
20920
+ )
20921
+ );
20922
+ const time = (row) => filters.order === "updated" ? row.memory.updated_at : row.memory.created_at;
20923
+ return [...new Map(fetched.flat().map((r) => [r.memory.memory_id, r])).values()].sort((a, b) => time(b) - time(a) || (a.memory.memory_id < b.memory.memory_id ? 1 : -1)).slice(0, max);
20924
+ };
20832
20925
  const queues = /* @__PURE__ */ new Map();
20833
20926
  const serialized = (id, task) => {
20834
20927
  const run = (queues.get(id) ?? Promise.resolve()).then(task, task);
@@ -20870,12 +20963,15 @@ function createRemoteMemoryStore(options) {
20870
20963
  };
20871
20964
  const newRow = (input) => {
20872
20965
  const now = Date.now();
20873
- const scope = input.scope ?? "private";
20966
+ const { level, scope } = resolveCreateLevel(input);
20967
+ assertValidKindLevel(input.kind, level);
20874
20968
  return {
20875
20969
  memory_id: (0, import_uuid5.v7)(),
20876
20970
  content: input.content,
20877
20971
  scope,
20878
- level: levelFromScope(scope),
20972
+ level,
20973
+ ...input.kind !== void 0 && input.kind !== null && { kind: input.kind },
20974
+ ...typeof input.kindValue === "string" && { kind_value: input.kindValue },
20879
20975
  created_at: now,
20880
20976
  updated_at: now,
20881
20977
  is_deleted: false,
@@ -20904,6 +21000,30 @@ function createRemoteMemoryStore(options) {
20904
21000
  return records.map((record2) => stored(record2.memory));
20905
21001
  };
20906
21002
  const asStored = (record2) => record2 ? stored(record2.memory) : null;
21003
+ const withKnownKinds = async (topics) => {
21004
+ const unkinded = [
21005
+ ...new Set(topics.filter((t) => !t.kind).map((t) => normalizeEntityName(t.name)))
21006
+ ];
21007
+ if (unkinded.length === 0) return topics;
21008
+ const kinds = /* @__PURE__ */ new Map();
21009
+ for (const names of chunks(unkinded, MAX_QUERY_TOPICS)) {
21010
+ for (const { memory } of await pages(metadata, {
21011
+ topics: names,
21012
+ include_archived: true,
21013
+ include_quarantined: true,
21014
+ include_superseded: true
21015
+ })) {
21016
+ for (const topic of parseTopics(memory.topics) ?? []) {
21017
+ const name = normalizeEntityName(topic.name);
21018
+ if (topic.kind && !kinds.has(name)) kinds.set(name, topic.kind);
21019
+ }
21020
+ }
21021
+ }
21022
+ return topics.map((topic) => {
21023
+ const kind = topic.kind ?? kinds.get(normalizeEntityName(topic.name));
21024
+ return kind ? { ...topic, kind } : topic;
21025
+ });
21026
+ };
20907
21027
  const everyState = {
20908
21028
  include_deleted: true,
20909
21029
  include_archived: true,
@@ -20980,30 +21100,34 @@ function createRemoteMemoryStore(options) {
20980
21100
  });
20981
21101
  };
20982
21102
  return {
20983
- list: async (listOptions = {}) => {
20984
- const order = listOptions.since ? "updated" : "created";
20985
- const filters = {
20986
- ...stateFilters(listOptions),
20987
- include_embeddings: true,
20988
- order,
20989
- ...listOptions.scopes?.length && { scopes: listOptions.scopes },
20990
- ...listOptions.factTypes?.length && { fact_types: listOptions.factTypes },
20991
- ...listOptions.visibility?.length && { visibility: listOptions.visibility },
20992
- ...listOptions.since && { updated_after: listOptions.since.getTime() }
20993
- };
20994
- const max = listOptions.limit && listOptions.limit > 0 ? listOptions.limit : Infinity;
20995
- const variants = bounded(filters, "scopes").flatMap((f) => bounded(f, "fact_types"));
20996
- if (!listOptions.memoryIds && variants.length === 1)
20997
- return (await enumerate(filters, max)).map((r) => stored(r.memory));
20998
- const fetched = await Promise.all(
20999
- variants.map(
21000
- (variant) => listOptions.memoryIds ? enumerateIds(listOptions.memoryIds, variant) : enumerate(variant, max)
21001
- )
21002
- );
21003
- const rows = [...new Map(fetched.flat().map((r) => [r.memory.memory_id, r])).values()].map((record2) => stored(record2.memory)).sort(
21004
- (a, b) => order === "updated" ? b.updatedAt.getTime() - a.updatedAt.getTime() || (a.uniqueId < b.uniqueId ? 1 : -1) : b.createdAt.getTime() - a.createdAt.getTime() || (a.uniqueId < b.uniqueId ? 1 : -1)
21005
- );
21006
- return rows.slice(0, max);
21103
+ list: async (listOptions = {}) => (await listRows(decrypted, listOptions, listFilters(listOptions), maxOf(listOptions))).map(
21104
+ (r) => stored(r.memory)
21105
+ ),
21106
+ listProjections: async (listOptions = {}) => (await listRows(metadata, listOptions, listFilters(listOptions), maxOf(listOptions))).map(
21107
+ projection
21108
+ ),
21109
+ listTopics: async () => {
21110
+ const topics = /* @__PURE__ */ new Map();
21111
+ for (const { memory } of await pages(metadata, {
21112
+ include_archived: true,
21113
+ include_quarantined: true,
21114
+ include_superseded: true
21115
+ })) {
21116
+ for (const topic of parseTopics(memory.topics) ?? []) {
21117
+ const name = normalizeEntityName(topic.name);
21118
+ if (!name) continue;
21119
+ const entry = topics.get(name) ?? {
21120
+ name,
21121
+ kind: null,
21122
+ memoryCount: 0,
21123
+ members: /* @__PURE__ */ new Set()
21124
+ };
21125
+ entry.kind ?? (entry.kind = topic.kind ?? null);
21126
+ entry.members.add(memory.memory_id);
21127
+ topics.set(name, entry);
21128
+ }
21129
+ }
21130
+ return [...topics.values()].map(({ members, ...topic }) => ({ ...topic, memoryCount: members.size })).sort((a, b) => a.name.localeCompare(b.name));
21007
21131
  },
21008
21132
  get: async (id) => asStored(await live(id)),
21009
21133
  listArchived: async () => (await enumerate({ archived_only: true, order: "archived", include_embeddings: true })).map(
@@ -21012,10 +21136,10 @@ function createRemoteMemoryStore(options) {
21012
21136
  memoriesByTopics: async (names) => {
21013
21137
  const wanted = new Set(names.map(normalizeEntityName).filter(Boolean));
21014
21138
  const out = /* @__PURE__ */ new Map();
21015
- const pages = await Promise.all(
21139
+ const pages2 = await Promise.all(
21016
21140
  chunks([...wanted], MAX_QUERY_TOPICS).map((topics) => enumerate({ topics }))
21017
21141
  );
21018
- for (const { memory } of pages.flat()) {
21142
+ for (const { memory } of pages2.flat()) {
21019
21143
  const matched = [...canonicalTopics(memory)].filter((name) => wanted.has(name));
21020
21144
  if (matched.length) out.set(memory.memory_id, new Set(matched));
21021
21145
  }
@@ -21023,7 +21147,7 @@ function createRemoteMemoryStore(options) {
21023
21147
  },
21024
21148
  topicsByMemories: async (memoryIds) => {
21025
21149
  const out = /* @__PURE__ */ new Map();
21026
- for (const { memory } of await enumerateIds(memoryIds, {
21150
+ for (const { memory } of await enumerateIds(decrypted, memoryIds, {
21027
21151
  include_archived: true,
21028
21152
  include_superseded: true,
21029
21153
  include_quarantined: true
@@ -21056,15 +21180,26 @@ function createRemoteMemoryStore(options) {
21056
21180
  update: async (id, patch) => {
21057
21181
  const saved = await mutate(id, "edit", (memory) => {
21058
21182
  if (memory.superseded_by) return null;
21183
+ const level = patch.level !== void 0 ? patch.level : patch.scope !== void 0 ? levelForScopeChange({ level: memory.level, scope: memory.scope }, patch.scope) : resolveMemoryLevel(memory.level, memory.scope);
21184
+ const kind = patch.kind !== void 0 ? patch.kind : memory.kind;
21185
+ assertValidKindLevel(kind, level);
21059
21186
  memory.content = patch.content;
21060
21187
  memory.updated_at = Date.now();
21061
- if (patch.scope !== void 0) {
21062
- memory.level = levelForScopeChange(
21063
- { level: memory.level, scope: memory.scope },
21064
- patch.scope
21065
- );
21188
+ if (patch.level !== void 0) {
21189
+ memory.level = level;
21190
+ memory.scope = scopeForLevel(level);
21191
+ } else if (patch.scope !== void 0) {
21192
+ memory.level = level;
21066
21193
  memory.scope = patch.scope;
21067
21194
  }
21195
+ if (patch.kind !== void 0) {
21196
+ if (patch.kind === null) delete memory.kind;
21197
+ else memory.kind = patch.kind;
21198
+ }
21199
+ if (patch.kindValue !== void 0) {
21200
+ if (patch.kindValue === null) delete memory.kind_value;
21201
+ else memory.kind_value = patch.kindValue;
21202
+ }
21068
21203
  if (patch.factType !== void 0) memory.fact_type = patch.factType ?? void 0;
21069
21204
  if (patch.eventTime !== void 0) {
21070
21205
  memory.event_time_start = patch.eventTime?.start ?? void 0;
@@ -21119,16 +21254,19 @@ function createRemoteMemoryStore(options) {
21119
21254
  notify("edit", [await persistence.put(memory, record2)]);
21120
21255
  return true;
21121
21256
  }),
21122
- setTopics: async (memoryId, topics) => asStored(
21123
- await mutate(memoryId, "edit", (memory) => ({
21124
- ...memory,
21125
- topics: serializeTopics(mergeTopics([], topicInputs(topics, "user"))),
21126
- topics_user_managed: true,
21127
- topics_updated_at: Date.now()
21128
- }))
21129
- ),
21257
+ setTopics: async (memoryId, topics) => {
21258
+ const chosen = await withKnownKinds(topicInputs(topics, "user"));
21259
+ return asStored(
21260
+ await mutate(memoryId, "edit", (memory) => ({
21261
+ ...memory,
21262
+ topics: serializeTopics(mergeTopics([], chosen)),
21263
+ topics_user_managed: true,
21264
+ topics_updated_at: Date.now()
21265
+ }))
21266
+ );
21267
+ },
21130
21268
  addTopics: async (memoryId, topics) => {
21131
- const added = topicInputs(topics, "auto");
21269
+ const added = await withKnownKinds(topicInputs(topics, "auto"));
21132
21270
  const saved = await mutate(memoryId, "edit", (memory) => ({
21133
21271
  ...memory,
21134
21272
  topics: serializeTopics(mergeTopics(parseTopics(memory.topics) ?? [], added)),
@@ -7065,6 +7065,10 @@ interface RankableVaultMemory {
7065
7065
  * required. `vaultMemoryRawToRankable` still always sets it. */
7066
7066
  lastObservedAt?: number | null;
7067
7067
  }
7068
+ /** @public */
7069
+ interface VaultMemoryProjection extends RankableVaultMemory {
7070
+ topicsUserManaged: boolean;
7071
+ }
7068
7072
  /**
7069
7073
  * A photo a server-extracted memory came from, as
7070
7074
  * GET /api/memories/published returns it in `media[]`.
@@ -9090,7 +9094,7 @@ interface MemoryListOptions {
9090
9094
  * passing provenance, trust or publication metadata through manual creation.
9091
9095
  * @public
9092
9096
  */
9093
- type MemoryCreate = Pick<CreateVaultMemoryOptions, "content" | "scope" | "factType" | "eventTime" | "embedding" | "embeddingModel" | "geohash">;
9097
+ type MemoryCreate = Pick<CreateVaultMemoryOptions, "content" | "scope" | "factType" | "eventTime" | "embedding" | "embeddingModel" | "geohash" | "kind" | "kindValue" | "level">;
9094
9098
  /**
9095
9099
  * The edits an app makes to an existing memory. Deliberately narrower than
9096
9100
  * {@link UpdateVaultMemoryOptions}: the re-observation knobs (`proofCountIncrement`,
@@ -9106,7 +9110,7 @@ type MemoryCreate = Pick<CreateVaultMemoryOptions, "content" | "scope" | "factTy
9106
9110
  * `embedding` (with `embeddingModel`) only when you already have the new one.
9107
9111
  * @public
9108
9112
  */
9109
- type MemoryUpdate = Pick<UpdateVaultMemoryOptions, "content" | "scope" | "factType" | "eventTime" | "embedding" | "embeddingModel">;
9113
+ type MemoryUpdate = Pick<UpdateVaultMemoryOptions, "content" | "scope" | "factType" | "eventTime" | "embedding" | "embeddingModel" | "kind" | "kindValue" | "level">;
9110
9114
  /**
9111
9115
  * Fact-only recall. Conversation chunks are message storage, not memory, so
9112
9116
  * the chunk-lane knobs are not part of this surface; nor is `folderId` (see
@@ -9132,6 +9136,15 @@ type MemoryRecallOptions = Omit<RecallOptions, "types" | "includeChunks" | "conv
9132
9136
  * @public
9133
9137
  */
9134
9138
  type MemoryRetainOptions = Omit<RetainOptions, "folderId">;
9139
+ /**
9140
+ * A topic and how many memories link to it.
9141
+ * @public
9142
+ */
9143
+ interface MemoryTopic {
9144
+ name: string;
9145
+ kind: string | null;
9146
+ memoryCount: number;
9147
+ }
9135
9148
  /** @public */
9136
9149
  interface MemorySubscribeOptions {
9137
9150
  /**
@@ -9213,6 +9226,10 @@ interface MemoryStore {
9213
9226
  memoriesByTopics(names: readonly string[]): Promise<Map<string, Set<string>>>;
9214
9227
  /** Memory id → its canonical (lowercased) topic names. Unlinked ids are absent. */
9215
9228
  topicsByMemories(memoryIds: readonly string[]): Promise<Map<string, Set<string>>>;
9229
+ /** Every topic by canonical name, with its kind and linked-memory count. */
9230
+ listTopics(): Promise<MemoryTopic[]>;
9231
+ /** The memories {@link MemoryStore.list} would return, without decrypting content. */
9232
+ listProjections(options?: MemoryListOptions): Promise<VaultMemoryProjection[]>;
9216
9233
  /** Manual save; missing embeddings are filled in the background. */
9217
9234
  create(input: MemoryCreate): Promise<StoredVaultMemory>;
9218
9235
  /** One write for a batch of manual saves; migration/restore uses lower-level operations. */
@@ -9400,6 +9417,15 @@ interface RemoteMemoryQueryOptions extends RemoteMemoryReadFilters {
9400
9417
  interface RemoteMemoryQueryPage extends RemoteMemoryPage {
9401
9418
  changes_cursor?: string;
9402
9419
  }
9420
+ interface RemoteMemoryMetadataRecord {
9421
+ memory: Omit<RemoteMemoryRow, "content" | "kind_value">;
9422
+ version: number;
9423
+ server_updated_at: string;
9424
+ }
9425
+ interface RemoteMemoryMetadataPage {
9426
+ items: RemoteMemoryMetadataRecord[];
9427
+ next_cursor?: string;
9428
+ }
9403
9429
  interface RemoteMemoryCandidateOptions extends RemoteMemoryReadFilters {
9404
9430
  scopes?: string[];
9405
9431
  memory_ids?: string[];
@@ -9444,6 +9470,10 @@ interface RemoteMemoryPersistence {
9444
9470
  /** One stable memory-id page; follow next_cursor to enumerate. Embeddings are opt-in. */
9445
9471
  list(options?: RemoteMemoryListOptions): Promise<RemoteMemoryPage>;
9446
9472
  query(options?: RemoteMemoryQueryOptions): Promise<RemoteMemoryQueryPage>;
9473
+ /** Same page as `query`, with content and kind_value dropped instead of decrypted. */
9474
+ queryMetadata(options?: Omit<RemoteMemoryQueryOptions, "order"> & {
9475
+ order?: "created" | "updated" | "archived";
9476
+ }): Promise<RemoteMemoryMetadataPage>;
9447
9477
  /** Whole-row write. Pass a returned snapshot to avoid GET; a number retains the read-before-write path. Version 0 creates. is_deleted writes a tombstone. */
9448
9478
  put(memory: RemoteMemoryRow, expectedVersion: number | RemoteMemoryRecord, signal?: AbortSignal): Promise<RemoteMemoryRecord>;
9449
9479
  /** 1–50 writes in one server transaction; never split or replay a batch. */
@@ -11108,4 +11138,4 @@ interface UseChatStorageResult extends BaseUseChatStorageResult {
11108
11138
  */
11109
11139
  declare function useChatStorage(options: UseChatStorageOptions): UseChatStorageResult;
11110
11140
 
11111
- export { type AutoExtractMessage, type AutoExtractor, type Budget, CHUNKS_DISCARDED_ORIGIN, type CachedChunkVectors, type CachedServerTools, Conversation as ChatConversation, Message as ChatMessage, type ChatRole, type ChunkVectorCache, type ChunkingOptions, type ConsolidationAction, type ConsolidationFallbackReason, type ConversationMemoryInput, ConversationMemory as ConversationMemoryModel, type ConversationMemoryOperationsContext, type CreateAutoExtractorOptions, type CreateConversationOptions, type CreateDecaySweeperOptions, type CreateMessageOptions, type CreateVaultFolderOptions, type CreateVaultMemoryOptions, 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, EncryptionKeyMissingError, type ExtractFactsOptions, type ExtractOutcome, type ExtractedCandidate, type ExtractedEntity, type ExtractionCursorStore, type ExtractionFunnel, 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 MemoryCreate, type EmbeddingOptions as MemoryEngineEmbeddingOptions, type MemoryEngineResult, type MemoryEngineSearchOptions, type MemoryExtractedEvent, MemoryKeyError, type MemoryKeyRing, type MemoryKind, type MemoryLevel, MemoryLevelError, type MemoryListOptions, type MemoryMaintenance, type MemoryQuarantinedEvent, type MemoryRecallOptions, type MemoryRetainOptions, type MemoryStore, type MemorySubscribeOptions, type MemoryToVerify, 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 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 RecallToolCallbacks, type RecallToolOptions, type RecencyOptions, type RedactionResult, type ReflectOptions, type ReflectResult, type RemoteMemoryCandidateOptions, type RemoteMemoryDecodeFailure, RemoteMemoryError, type RemoteMemoryListOptions, type RemoteMemoryPage, RemoteMemoryPartialCreateError, type RemoteMemoryPersistence, type RemoteMemoryPersistenceOptions, type RemoteMemoryPipeline, type RemoteMemoryPipelineOptions, type RemoteMemoryQueryOptions, type RemoteMemoryQueryPage, type RemoteMemoryReadFilters, type RemoteMemoryRecord, type RemoteMemoryRow, type RemoteMemoryStoreOptions, type RequestEncryptionKeyOptions, RerankerUnavailableError, type ReservationReceipt, type ResumeStreamOptions, type ResumeStreamResult, type ResumeStreamWithStorageResult, type RetainAction, type RetainContext, type RetainOptions, type RetainResult, type RetainSource, SDK_SCHEMA_VERSION, SHORT_TTL_MS, STREAM_RESUMABLE_HEADER, type ScoreBreakdown, type ScoreProfileSalienceOptions, type ScreenResult, type ScreenedCandidate, type SearchSource, 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 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, TREND_RECENT_WINDOW_DAYS, TREND_STALE_WINDOW_DAYS, type TextChunk, type TopicExtractOptions, type TopicExtractionInput, type TopicExtractionRunResult, 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 VaultEmbeddingCache, type VaultEmbeddingExpectation, type VaultFolderOperationsContext, type VaultMemoryKind, type VaultMemoryOperationsContext, type VaultMemoryVisibility, type VaultMemoryWriter, type VaultSaveOperation, type VaultSearchResult, type VaultWriteAction, type VaultWriteInput, type VaultWriteOutcome, type VerificationSources, type VerifyMemoriesForPublishOptions, WalletPoller, type WeatherClassification, type WeatherPreProcessorOptions, type WebSearchClassification, type WebSearchPreProcessorOptions, 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, clearServerToolsCache, consoleLogger, conversationMemoryToStored, cosineInt8, createAutoExtractor, createChunkVectorCache, createCryptoPricePreProcessor, createDecaySweeper, createDurableAutoExtractor, createLlmDecayClassifier, createLlmNeighborRefiner, createLocalMemoryStore, createMemoryEngineTool, createMemoryVaultSearchTool, createMemoryVaultTool, createMessageSourceResolver, createNotionProxyTools, createNotionTools, createPlatformCursorStore, createRecallTool, createRemoteMemoryPersistence, createRemoteMemoryPipeline, createRemoteMemoryStore, createStockPricePreProcessor, createStreamingDeAnonymizer, createVaultEmbeddingCache, createVaultFolderOp, createVaultMemoriesBatchOp, createVaultMemoryOp, createWeatherPreProcessor, createWebSearchPreProcessor, decodeChunkVector, decryptConversationTitle, deleteAllVaultMemoriesForUserOp, deleteMessageOp, deleteVaultFolderOp, deleteVaultMemoryOp, dequantizeEmbedding, deriveKeyFromSignatureBytes, deriveMemoryKeyRing, discoverNotionOAuthEndpoints, eagerEmbedContent, embedAllMessages, embedMessage, encodeChunkVector, 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, maskScopedEmbeddingCache, memoryCipher, moveMemoriesToFolderOp, noopLogger, onKeyAvailable, parseMedia, preEmbedVaultMemories, quantizeEmbedding, queueManager, rankProfileCandidates, recall, reencryptMemoryField, reflect, refreshEncryptionKeyIfMatches, refreshNotionAccessToken, registerNotionClient, relinkMemoryTopicsOp, requestEncryptionKey, resolvePiiRedactor, restoreVaultMemoryOp, resumeStream, retain, scoreProfileSalience, screenCandidatesForInjection, sdkMigrations, sdkModelClasses, sdkSchema, searchVaultMemories, seedEncryptionKeys, setLogger, setMemoryVisibilityOp, shouldChunkMessage, shouldRecallMemory, stampTopicsExtractedAtOp, streamCancelPath, streamReplayPath, stripLegacyChunkTextOp, summarizeObservationTrends, supersedeVaultMemoryOp, synthesizeProfile, traverseGraphLane, ttlForType, updateVaultFolderContextOp, updateVaultFolderOp, updateVaultMemoryEmbeddingOp, updateVaultMemoryOp, upsertMessageOp, useChat, useChatStorage, useCredits, useEncryption, useModels, verifyMemoriesForPublish, xhrTransport };
11141
+ export { type AutoExtractMessage, type AutoExtractor, type Budget, CHUNKS_DISCARDED_ORIGIN, type CachedChunkVectors, type CachedServerTools, Conversation as ChatConversation, Message as ChatMessage, type ChatRole, type ChunkVectorCache, type ChunkingOptions, type ConsolidationAction, type ConsolidationFallbackReason, type ConversationMemoryInput, ConversationMemory as ConversationMemoryModel, type ConversationMemoryOperationsContext, type CreateAutoExtractorOptions, type CreateConversationOptions, type CreateDecaySweeperOptions, type CreateMessageOptions, type CreateVaultFolderOptions, type CreateVaultMemoryOptions, 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, EncryptionKeyMissingError, type ExtractFactsOptions, type ExtractOutcome, type ExtractedCandidate, type ExtractedEntity, type ExtractionCursorStore, type ExtractionFunnel, 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 MemoryCreate, type EmbeddingOptions as MemoryEngineEmbeddingOptions, type MemoryEngineResult, type MemoryEngineSearchOptions, type MemoryExtractedEvent, MemoryKeyError, type MemoryKeyRing, type MemoryKind, type MemoryLevel, MemoryLevelError, type MemoryListOptions, type MemoryMaintenance, type MemoryQuarantinedEvent, type MemoryRecallOptions, type MemoryRetainOptions, type MemoryStore, type MemorySubscribeOptions, type MemoryToVerify, type MemoryTopic, 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 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 RecallToolCallbacks, type RecallToolOptions, type RecencyOptions, type RedactionResult, type ReflectOptions, type ReflectResult, 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 RequestEncryptionKeyOptions, RerankerUnavailableError, type ReservationReceipt, type ResumeStreamOptions, type ResumeStreamResult, type ResumeStreamWithStorageResult, type RetainAction, type RetainContext, type RetainOptions, type RetainResult, type RetainSource, SDK_SCHEMA_VERSION, SHORT_TTL_MS, STREAM_RESUMABLE_HEADER, type ScoreBreakdown, type ScoreProfileSalienceOptions, type ScreenResult, type ScreenedCandidate, type SearchSource, 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 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, TREND_RECENT_WINDOW_DAYS, TREND_STALE_WINDOW_DAYS, type TextChunk, type TopicExtractOptions, type TopicExtractionInput, type TopicExtractionRunResult, 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 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, WalletPoller, type WeatherClassification, type WeatherPreProcessorOptions, type WebSearchClassification, type WebSearchPreProcessorOptions, 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, clearServerToolsCache, consoleLogger, conversationMemoryToStored, cosineInt8, createAutoExtractor, createChunkVectorCache, createCryptoPricePreProcessor, createDecaySweeper, createDurableAutoExtractor, createLlmDecayClassifier, createLlmNeighborRefiner, createLocalMemoryStore, createMemoryEngineTool, createMemoryVaultSearchTool, createMemoryVaultTool, createMessageSourceResolver, createNotionProxyTools, createNotionTools, createPlatformCursorStore, createRecallTool, createRemoteMemoryPersistence, createRemoteMemoryPipeline, createRemoteMemoryStore, createStockPricePreProcessor, createStreamingDeAnonymizer, createVaultEmbeddingCache, createVaultFolderOp, createVaultMemoriesBatchOp, createVaultMemoryOp, createWeatherPreProcessor, createWebSearchPreProcessor, decodeChunkVector, decryptConversationTitle, deleteAllVaultMemoriesForUserOp, deleteMessageOp, deleteVaultFolderOp, deleteVaultMemoryOp, dequantizeEmbedding, deriveKeyFromSignatureBytes, deriveMemoryKeyRing, discoverNotionOAuthEndpoints, eagerEmbedContent, embedAllMessages, embedMessage, encodeChunkVector, 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, maskScopedEmbeddingCache, memoryCipher, moveMemoriesToFolderOp, noopLogger, onKeyAvailable, parseMedia, preEmbedVaultMemories, quantizeEmbedding, queueManager, rankProfileCandidates, recall, reencryptMemoryField, reflect, refreshEncryptionKeyIfMatches, refreshNotionAccessToken, registerNotionClient, relinkMemoryTopicsOp, requestEncryptionKey, resolvePiiRedactor, restoreVaultMemoryOp, resumeStream, retain, scoreProfileSalience, screenCandidatesForInjection, sdkMigrations, sdkModelClasses, sdkSchema, searchVaultMemories, seedEncryptionKeys, setLogger, setMemoryVisibilityOp, shouldChunkMessage, shouldRecallMemory, stampTopicsExtractedAtOp, streamCancelPath, streamReplayPath, stripLegacyChunkTextOp, summarizeObservationTrends, supersedeVaultMemoryOp, synthesizeProfile, traverseGraphLane, ttlForType, updateVaultFolderContextOp, updateVaultFolderOp, updateVaultMemoryEmbeddingOp, updateVaultMemoryOp, upsertMessageOp, useChat, useChatStorage, useCredits, useEncryption, useModels, verifyMemoriesForPublish, xhrTransport };