@anuma/sdk 2.4.2 → 2.5.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.
@@ -16864,6 +16864,7 @@ function isOwnedByCtxUser(ctx, record) {
16864
16864
  function baseVaultConditions(ctx, options) {
16865
16865
  return [
16866
16866
  ...options?.includeDeleted ? [] : [import_watermelondb17.Q.where("is_deleted", false)],
16867
+ ...options?.includeSuperseded ? [] : [import_watermelondb17.Q.where("superseded_by", null)],
16867
16868
  ...ctx.userId !== void 0 ? [import_watermelondb17.Q.where("user_id", ctx.userId)] : [],
16868
16869
  ...options?.since ? [import_watermelondb17.Q.where("updated_at", import_watermelondb17.Q.gt(options.since.getTime()))] : []
16869
16870
  ];
@@ -16904,6 +16905,8 @@ function vaultMemoryToStoredRaw(memory) {
16904
16905
  eventTimeKind: memory.eventTimeKind ?? null,
16905
16906
  topicsUserManaged: memory.topicsUserManaged ?? false,
16906
16907
  topicsExtractedAt: memory.topicsExtractedAt ?? null,
16908
+ supersededBy: memory.supersededBy ?? null,
16909
+ supersededAt: memory.supersededAt ?? null,
16907
16910
  createdAt: memory.createdAt,
16908
16911
  updatedAt: memory.updatedAt,
16909
16912
  isDeleted: memory.isDeleted
@@ -16949,6 +16952,59 @@ async function createVaultMemoryOp(ctx, opts) {
16949
16952
  });
16950
16953
  return vaultMemoryToStored(created, ctx.walletAddress, ctx.signMessage, ctx.embeddedWalletSigner);
16951
16954
  }
16955
+ async function createSupersedingMemoryOp(ctx, opts, targetId) {
16956
+ if (!targetId) return { created: null, retired: false };
16957
+ const scope = opts.scope ?? "private";
16958
+ const encryptedContent = ctx.walletAddress && ctx.signMessage ? await encryptVaultMemoryContent(
16959
+ opts.content,
16960
+ ctx.walletAddress,
16961
+ ctx.signMessage,
16962
+ ctx.embeddedWalletSigner
16963
+ ) : opts.content;
16964
+ let createdRecord = null;
16965
+ await ctx.database.write(async () => {
16966
+ let target;
16967
+ try {
16968
+ target = await ctx.vaultMemoryCollection.find(targetId);
16969
+ } catch {
16970
+ return;
16971
+ }
16972
+ if (target.isDeleted || target.supersededBy || !isOwnedByCtxUser(ctx, target)) return;
16973
+ createdRecord = await ctx.vaultMemoryCollection.create((record) => {
16974
+ record._setRaw("content", encryptedContent);
16975
+ record._setRaw("scope", scope);
16976
+ record._setRaw("folder_id", opts.folderId ?? null);
16977
+ record._setRaw("user_id", ctx.userId ?? null);
16978
+ record._setRaw("is_deleted", false);
16979
+ if (opts.embedding !== void 0) {
16980
+ record._setRaw("embedding", opts.embedding);
16981
+ record._setRaw("embedding_model", opts.embeddingModel ?? null);
16982
+ }
16983
+ if (opts.sourceChunkIds !== void 0) {
16984
+ record._setRaw("source_chunk_ids", JSON.stringify(opts.sourceChunkIds));
16985
+ }
16986
+ record._setRaw("proof_count", opts.proofCount ?? 1);
16987
+ record._setRaw("source", opts.source ?? "manual");
16988
+ if (opts.eventTime) {
16989
+ record._setRaw("event_time_start", opts.eventTime.start ?? null);
16990
+ record._setRaw("event_time_end", opts.eventTime.end ?? null);
16991
+ record._setRaw("event_time_kind", opts.eventTime.kind ?? null);
16992
+ }
16993
+ });
16994
+ await target.update((r) => {
16995
+ r._setRaw("superseded_by", createdRecord.id);
16996
+ r._setRaw("superseded_at", Date.now());
16997
+ });
16998
+ });
16999
+ if (!createdRecord) return { created: null, retired: false };
17000
+ const created = await vaultMemoryToStored(
17001
+ createdRecord,
17002
+ ctx.walletAddress,
17003
+ ctx.signMessage,
17004
+ ctx.embeddedWalletSigner
17005
+ );
17006
+ return { created, retired: true };
17007
+ }
16952
17008
  async function getMemoriesByEventTimeOp(ctx, windowStart, windowEnd) {
16953
17009
  const records = await ctx.vaultMemoryCollection.query(
16954
17010
  ...baseVaultConditions(ctx),
@@ -17088,6 +17144,8 @@ function vaultMemoryRawToStoredRaw(raw) {
17088
17144
  // SQLite stores booleans as 0/1, LokiJS as true/false — coerce both.
17089
17145
  topicsUserManaged: raw.topics_user_managed === true || raw.topics_user_managed === 1,
17090
17146
  topicsExtractedAt: raw.topics_extracted_at ?? null,
17147
+ supersededBy: raw.superseded_by ?? null,
17148
+ supersededAt: raw.superseded_at ?? null,
17091
17149
  createdAt: new Date(raw.created_at),
17092
17150
  updatedAt: new Date(raw.updated_at),
17093
17151
  isDeleted: raw.is_deleted === true || raw.is_deleted === 1
@@ -17129,7 +17187,7 @@ async function getAllVaultMemoryContentsOp(ctx, options) {
17129
17187
  async function updateVaultMemoryOp(ctx, id, opts) {
17130
17188
  try {
17131
17189
  const probe = await ctx.vaultMemoryCollection.find(id);
17132
- if (probe.isDeleted || !isOwnedByCtxUser(ctx, probe)) return null;
17190
+ if (probe.isDeleted || probe.supersededBy || !isOwnedByCtxUser(ctx, probe)) return null;
17133
17191
  const encryptedContent = ctx.walletAddress && ctx.signMessage ? await encryptVaultMemoryContent(
17134
17192
  opts.content,
17135
17193
  ctx.walletAddress,
@@ -17140,7 +17198,7 @@ async function updateVaultMemoryOp(ctx, id, opts) {
17140
17198
  const record = probe;
17141
17199
  const originalUpdatedAt = record.updatedAt.getTime();
17142
17200
  await ctx.database.write(async () => {
17143
- if (record.isDeleted || !isOwnedByCtxUser(ctx, record)) {
17201
+ if (record.isDeleted || record.supersededBy || !isOwnedByCtxUser(ctx, record)) {
17144
17202
  stale = true;
17145
17203
  return;
17146
17204
  }
@@ -17218,6 +17276,40 @@ async function deleteVaultMemoryOp(ctx, id) {
17218
17276
  return false;
17219
17277
  }
17220
17278
  }
17279
+ async function supersedeVaultMemoryOp(ctx, id, supersededById) {
17280
+ if (id === supersededById) return false;
17281
+ try {
17282
+ const record = await ctx.vaultMemoryCollection.find(id);
17283
+ if (record.isDeleted || record.supersededBy || !isOwnedByCtxUser(ctx, record)) return false;
17284
+ let successor;
17285
+ try {
17286
+ successor = await ctx.vaultMemoryCollection.find(supersededById);
17287
+ } catch {
17288
+ return false;
17289
+ }
17290
+ if (successor.isDeleted || successor.supersededBy || !isOwnedByCtxUser(ctx, successor)) {
17291
+ return false;
17292
+ }
17293
+ let stale = false;
17294
+ await ctx.database.write(async () => {
17295
+ if (record.isDeleted || record.supersededBy || !isOwnedByCtxUser(ctx, record)) {
17296
+ stale = true;
17297
+ return;
17298
+ }
17299
+ if (successor.isDeleted || successor.supersededBy || !isOwnedByCtxUser(ctx, successor)) {
17300
+ stale = true;
17301
+ return;
17302
+ }
17303
+ await record.update((r) => {
17304
+ r._setRaw("superseded_by", supersededById);
17305
+ r._setRaw("superseded_at", Date.now());
17306
+ });
17307
+ });
17308
+ return !stale;
17309
+ } catch {
17310
+ return false;
17311
+ }
17312
+ }
17221
17313
  async function getUnfiledVaultMemoriesOp(ctx) {
17222
17314
  const conditions = [
17223
17315
  import_watermelondb17.Q.where("folder_id", null),
@@ -21688,7 +21780,9 @@ function validate2(parsed, newContent, validIds) {
21688
21780
  if (typeof parsed !== "object" || parsed === null) return null;
21689
21781
  const obj = parsed;
21690
21782
  const action = obj.action;
21691
- if (action !== "create" && action !== "update" && action !== "noop") return null;
21783
+ if (action !== "create" && action !== "update" && action !== "noop" && action !== "supersede") {
21784
+ return null;
21785
+ }
21692
21786
  if (action === "create") {
21693
21787
  const c2 = typeof obj.content === "string" ? obj.content.trim() : "";
21694
21788
  return { action: "create", content: c2.length > 0 ? c2 : newContent };
@@ -21700,7 +21794,7 @@ function validate2(parsed, newContent, validIds) {
21700
21794
  }
21701
21795
  const c = typeof obj.content === "string" ? obj.content.trim() : "";
21702
21796
  if (c.length === 0) return null;
21703
- return { action: "update", targetId, content: c };
21797
+ return { action, targetId, content: c };
21704
21798
  }
21705
21799
  var DEFAULT_MODEL2, DEFAULT_CONSOLIDATE_ATTEMPTS, DEFAULT_CONSOLIDATE_TOTAL_TIMEOUT_MS, SYSTEM_PROMPT2;
21706
21800
  var init_consolidate = __esm({
@@ -21716,10 +21810,11 @@ var init_consolidate = __esm({
21716
21810
 
21717
21811
  A "memory" is a self-contained natural-language fact about the user. Multiple memories about the same EXACT FACET (the same dimension of the same subject) should never coexist \u2014 they should be merged into one. Different facets on the same subject (e.g. user's dog's name vs user's dog's age) are SEPARATE memories.
21718
21812
 
21719
- Decide one of three actions:
21813
+ Decide one of four actions:
21720
21814
 
21721
21815
  - "create": the new memory describes a distinct fact not covered by any existing memory. Write it as new.
21722
- - "update": the new memory describes the SAME FACET as exactly one existing memory. Either it adds detail, corrects a value, or rephrases the same fact. Return targetId of that existing memory + the consolidated content (richest version of the two).
21816
+ - "update": the new memory describes the SAME FACET as exactly one existing memory and is COMPATIBLE with it \u2014 it adds detail, fixes an incomplete value, or rephrases the same still-true fact. Return targetId of that existing memory + the consolidated content (richest version of the two).
21817
+ - "supersede": the new memory REPLACES a standing fact whose value has CHANGED and is now INCOMPATIBLE with an existing memory \u2014 the old fact was true before but is false now (a state change). Return targetId of the STALE existing memory to retire + content = the NEW fact. The old memory is kept as history, not overwritten or deleted; do not re-state it.
21723
21818
  - "noop": the new memory is already fully captured by an existing memory \u2014 same facet, no new information. Skip the write.
21724
21819
 
21725
21820
  RULES (carry these strictly):
@@ -21727,18 +21822,21 @@ RULES (carry these strictly):
21727
21822
  1. ONE OBSERVATION PER DISTINCT FACET. If the new memory is about "user's aunt's twins" and an existing memory is also about "user's aunt's twins", they are the same facet \u2192 update, never create.
21728
21823
  2. MATCH BY FACET, NOT TOPIC. Two memories both mentioning "Zara" is not enough to merge \u2014 only merge if they describe the same property (e.g. both about "user's pending Zara boot exchange"). Two memories about Zara on different topics (e.g. "user shops at Zara" + "user returned a sweater to Zara last week") are separate facets.
21729
21824
  3. NO COMPUTATION. Do not sum counts, decrement quantities, or derive new facts from existing ones. If the new memory says "user spent $200 today" and an existing memory says "user spent $150 yesterday", these are TWO SEPARATE EVENTS \u2014 create.
21730
- 4. Events with different occurredAt dates are different memories even if the same activity ("user went to gym Monday" vs "user went to gym Friday" \u2014 separate events).
21731
- 5. When in doubt between create and update, choose create. Over-merging loses information; under-merging is recoverable.
21825
+ 4. EVENTS vs STANDING STATE.
21826
+ - Distinct EVENTS (episodic \u2014 something that happened on a date) are separate memories, even if the same activity: "user went to gym Monday" vs "user went to gym Friday" \u2192 create; keep both.
21827
+ - A STANDING ATTRIBUTE (an ongoing state: where the user lives/works, relationship status, current role) has ONE current value. When the new memory changes that value ("Lives in Portland" \u2192 "Lives in San Francisco"; "Works at Google" \u2192 "Works at Riverbend"; "Engaged" \u2192 "Broke up"), the old value is no longer true \u2192 supersede (retire the old, record the new). Do NOT create (that leaves a stale contradiction) and do NOT update (that erases the history that the old value was once true).
21828
+ 5. When in doubt between create and update, choose create \u2014 EXCEPT when the new memory directly contradicts the current value of a standing attribute in an existing memory; then choose supersede. Over-merging loses information; a live contradiction is worse than either.
21732
21829
 
21733
21830
  OUTPUT \u2014 strict JSON, no prose:
21734
21831
  {
21735
- "action": "create" | "update" | "noop",
21736
- "targetId": "<existing memory id, required for update/noop, omit for create>",
21737
- "content": "<consolidated content, required for create/update, omit for noop>"
21832
+ "action": "create" | "update" | "supersede" | "noop",
21833
+ "targetId": "<existing memory id \u2014 required for update/supersede/noop, omit for create>",
21834
+ "content": "<content \u2014 required for create/update/supersede, omit for noop>"
21738
21835
  }
21739
21836
 
21740
21837
  For "create": content is the new memory verbatim (or a slight refinement).
21741
21838
  For "update": content is the merged richest-version, \u226480 words.
21839
+ For "supersede": content is the NEW fact only (\u226480 words); targetId is the stale memory being retired.
21742
21840
  For "noop": no content (existing memory is already correct).`;
21743
21841
  }
21744
21842
  });
@@ -21975,6 +22073,7 @@ __export(index_exports, {
21975
22073
  streamCancelPath: () => streamCancelPath,
21976
22074
  streamReplayPath: () => streamReplayPath,
21977
22075
  summaryToSystemMessage: () => summaryToSystemMessage,
22076
+ supersedeVaultMemoryOp: () => supersedeVaultMemoryOp,
21978
22077
  toolSetSystemPrompts: () => toolSetSystemPrompts,
21979
22078
  updateConversationProjectOp: () => updateConversationProjectOp,
21980
22079
  updateConversationTitleOp: () => updateConversationTitleOp,
@@ -22329,6 +22428,12 @@ __decorateClass([
22329
22428
  __decorateClass([
22330
22429
  (0, import_decorators6.field)("topics_extracted_at")
22331
22430
  ], VaultMemory.prototype, "topicsExtractedAt", 2);
22431
+ __decorateClass([
22432
+ (0, import_decorators6.field)("superseded_by")
22433
+ ], VaultMemory.prototype, "supersededBy", 2);
22434
+ __decorateClass([
22435
+ (0, import_decorators6.field)("superseded_at")
22436
+ ], VaultMemory.prototype, "supersededAt", 2);
22332
22437
  __decorateClass([
22333
22438
  import_decorators6.readonly,
22334
22439
  (0, import_decorators6.date)("created_at")
@@ -22476,7 +22581,7 @@ __decorateClass([
22476
22581
  ], VaultFolder.prototype, "context", 2);
22477
22582
 
22478
22583
  // src/lib/db/schema.ts
22479
- var SDK_SCHEMA_VERSION = 36;
22584
+ var SDK_SCHEMA_VERSION = 37;
22480
22585
  var sdkSchema = (0, import_watermelondb12.appSchema)({
22481
22586
  version: SDK_SCHEMA_VERSION,
22482
22587
  tables: [
@@ -22601,7 +22706,16 @@ var sdkSchema = (0, import_watermelondb12.appSchema)({
22601
22706
  // Unix ms of the last LLM topic-extraction pass over this memory's
22602
22707
  // content. Null = never extracted standalone (legacy rows with entity
22603
22708
  // links are grandfathered — see getMemoriesNeedingTopicExtractionOp).
22604
- { name: "topics_extracted_at", type: "number", isOptional: true }
22709
+ { name: "topics_extracted_at", type: "number", isOptional: true },
22710
+ // Write-time supersession (A2). When set, this fact was replaced by a
22711
+ // newer, incompatible-value fact (e.g. "Lives in Portland" superseded by
22712
+ // "Lives in SF"); `superseded_by` points at the newer memory's id and
22713
+ // `superseded_at` is the Unix ms it happened. Superseded rows stay in
22714
+ // the table (history / read-time fallback) but are excluded from recall
22715
+ // and dedup by default. Null = live (not superseded). Indexed so the
22716
+ // recall filter stays cheap.
22717
+ { name: "superseded_by", type: "string", isOptional: true, isIndexed: true },
22718
+ { name: "superseded_at", type: "number", isOptional: true }
22605
22719
  ]
22606
22720
  }),
22607
22721
  // Entity table — canonical names extracted from auto-extraction (W5).
@@ -23212,6 +23326,21 @@ var sdkMigrations = (0, import_migrations.schemaMigrations)({
23212
23326
  columns: [{ name: "topics_extracted_at", type: "number", isOptional: true }]
23213
23327
  })
23214
23328
  ]
23329
+ },
23330
+ // v36 -> v37: write-time supersession columns on memory_vault. Existing rows
23331
+ // keep both NULL (= live / not superseded), so no backfill — legacy
23332
+ // contradictory rows are handled by the read-time supersession fallback.
23333
+ {
23334
+ toVersion: 37,
23335
+ steps: [
23336
+ (0, import_migrations.addColumns)({
23337
+ table: "memory_vault",
23338
+ columns: [
23339
+ { name: "superseded_by", type: "string", isOptional: true, isIndexed: true },
23340
+ { name: "superseded_at", type: "number", isOptional: true }
23341
+ ]
23342
+ })
23343
+ ]
23215
23344
  }
23216
23345
  ]
23217
23346
  });
@@ -25950,53 +26079,62 @@ async function retain(content, ctx, options = {}) {
25950
26079
  const enableAutoMerge = options.enableAutoMerge ?? true;
25951
26080
  const threshold = options.autoMergeThreshold ?? DEFAULT_AUTO_MERGE_THRESHOLD;
25952
26081
  const resolvedScope = options.scope ?? DEFAULT_SCOPE;
26082
+ let supersedeTargetId;
26083
+ let supersedeContent;
25953
26084
  if (enableAutoMerge) {
25954
26085
  if (options.consolidateOptions) {
25955
- const consolidationResult = await tryConsolidate(trimmed, ctx, options);
25956
- if (consolidationResult) return consolidationResult;
25957
- }
25958
- const matches = await searchVaultMemories(
25959
- trimmed,
25960
- ctx.vaultCtx,
25961
- ctx.embeddingOptions,
25962
- ctx.vaultCache,
25963
- {
25964
- limit: 1,
25965
- minSimilarity: threshold,
25966
- useFusion: false,
25967
- scopes: [resolvedScope],
25968
- ...options.folderId !== void 0 && { folderId: options.folderId }
25969
- }
25970
- );
25971
- if (matches.length > 0) {
25972
- const targetId = matches[0].uniqueId;
25973
- const existing = await getVaultMemoryOp(ctx.vaultCtx, targetId);
25974
- if (existing) {
25975
- const mergedSourceIds = unionStrings(
25976
- existing.sourceChunkIds ?? [],
25977
- options.sourceChunkIds ?? []
25978
- );
25979
- const eventTimeUpdate = pickEventTimeUpdate(existing, options.eventTime);
25980
- const updated = await updateVaultMemoryOp(ctx.vaultCtx, targetId, {
25981
- content: existing.content,
25982
- proofCountIncrement: 1,
25983
- sourceChunkIds: mergedSourceIds,
25984
- preserveUpdatedAt: true,
25985
- ...eventTimeUpdate && { eventTime: eventTimeUpdate }
25986
- });
25987
- if (updated) {
25988
- return {
25989
- action: "merge",
25990
- memoryId: targetId,
25991
- targetId,
25992
- proofCount: updated.proofCount ?? (existing.proofCount ?? 1) + 1
25993
- };
26086
+ const outcome = await tryConsolidate(trimmed, ctx, options);
26087
+ if (outcome) {
26088
+ if ("done" in outcome) return outcome.done;
26089
+ supersedeTargetId = outcome.supersede;
26090
+ supersedeContent = outcome.content;
26091
+ }
26092
+ }
26093
+ if (!supersedeTargetId) {
26094
+ const matches = await searchVaultMemories(
26095
+ trimmed,
26096
+ ctx.vaultCtx,
26097
+ ctx.embeddingOptions,
26098
+ ctx.vaultCache,
26099
+ {
26100
+ limit: 1,
26101
+ minSimilarity: threshold,
26102
+ useFusion: false,
26103
+ scopes: [resolvedScope],
26104
+ ...options.folderId !== void 0 && { folderId: options.folderId }
26105
+ }
26106
+ );
26107
+ if (matches.length > 0) {
26108
+ const targetId = matches[0].uniqueId;
26109
+ const existing = await getVaultMemoryOp(ctx.vaultCtx, targetId);
26110
+ if (existing && !existing.supersededBy) {
26111
+ const mergedSourceIds = unionStrings(
26112
+ existing.sourceChunkIds ?? [],
26113
+ options.sourceChunkIds ?? []
26114
+ );
26115
+ const eventTimeUpdate = pickEventTimeUpdate(existing, options.eventTime);
26116
+ const updated = await updateVaultMemoryOp(ctx.vaultCtx, targetId, {
26117
+ content: existing.content,
26118
+ proofCountIncrement: 1,
26119
+ sourceChunkIds: mergedSourceIds,
26120
+ preserveUpdatedAt: true,
26121
+ ...eventTimeUpdate && { eventTime: eventTimeUpdate }
26122
+ });
26123
+ if (updated) {
26124
+ return {
26125
+ action: "merge",
26126
+ memoryId: targetId,
26127
+ targetId,
26128
+ proofCount: updated.proofCount ?? (existing.proofCount ?? 1) + 1
26129
+ };
26130
+ }
26131
+ await assertMergeTargetGoneOrThrow(ctx, targetId);
25994
26132
  }
25995
- await assertMergeTargetGoneOrThrow(ctx, targetId);
25996
26133
  }
25997
26134
  }
25998
26135
  }
25999
- const embedding = await generateEmbedding(trimmed, ctx.embeddingOptions);
26136
+ const contentToWrite = supersedeContent ?? trimmed;
26137
+ const embedding = await generateEmbedding(contentToWrite, ctx.embeddingOptions);
26000
26138
  const embeddingModel = ctx.embeddingOptions.model ?? DEFAULT_API_EMBEDDING_MODEL;
26001
26139
  if (options.respectTombstones) {
26002
26140
  const tombstoneId = await findTombstoneMatch(embedding, embeddingModel, resolvedScope, ctx, {
@@ -26007,8 +26145,8 @@ async function retain(content, ctx, options = {}) {
26007
26145
  return { action: "suppressed", memoryId: tombstoneId, tombstoneId, proofCount: 0 };
26008
26146
  }
26009
26147
  }
26010
- const created = await createVaultMemoryOp(ctx.vaultCtx, {
26011
- content: trimmed,
26148
+ const createOpts = {
26149
+ content: contentToWrite,
26012
26150
  scope: resolvedScope,
26013
26151
  ...options.folderId !== void 0 && { folderId: options.folderId },
26014
26152
  embedding: JSON.stringify(embedding),
@@ -26025,7 +26163,24 @@ async function retain(content, ctx, options = {}) {
26025
26163
  kind: options.eventTime.kind
26026
26164
  }
26027
26165
  }
26028
- });
26166
+ };
26167
+ if (supersedeTargetId) {
26168
+ const { created: created2, retired } = await createSupersedingMemoryOp(
26169
+ ctx.vaultCtx,
26170
+ createOpts,
26171
+ supersedeTargetId
26172
+ );
26173
+ if (created2 && retired) {
26174
+ ctx.vaultCache.set(created2.uniqueId, Float32Array.from(embedding));
26175
+ return {
26176
+ action: "supersede",
26177
+ memoryId: created2.uniqueId,
26178
+ targetId: supersedeTargetId,
26179
+ proofCount: 1
26180
+ };
26181
+ }
26182
+ }
26183
+ const created = await createVaultMemoryOp(ctx.vaultCtx, createOpts);
26029
26184
  ctx.vaultCache.set(created.uniqueId, Float32Array.from(embedding));
26030
26185
  return {
26031
26186
  action: "create",
@@ -26095,9 +26250,14 @@ async function tryConsolidate(trimmed, ctx, options) {
26095
26250
  const { consolidateMemory: doConsolidate } = await Promise.resolve().then(() => (init_consolidate(), consolidate_exports));
26096
26251
  const decision = await doConsolidate(trimmed, candidates, consolidateOptions);
26097
26252
  if (decision.action === "create") return null;
26253
+ if (decision.action === "supersede" && decision.targetId && decision.content) {
26254
+ const existing = await getVaultMemoryOp(ctx.vaultCtx, decision.targetId);
26255
+ if (!existing || existing.supersededBy) return null;
26256
+ return { supersede: decision.targetId, content: decision.content };
26257
+ }
26098
26258
  if (decision.action === "noop" && decision.targetId) {
26099
26259
  const existing = await getVaultMemoryOp(ctx.vaultCtx, decision.targetId);
26100
- if (!existing) return null;
26260
+ if (!existing || existing.supersededBy) return null;
26101
26261
  const mergedSourceIds = unionStrings(
26102
26262
  existing.sourceChunkIds ?? [],
26103
26263
  options.sourceChunkIds ?? []
@@ -26115,15 +26275,17 @@ async function tryConsolidate(trimmed, ctx, options) {
26115
26275
  return null;
26116
26276
  }
26117
26277
  return {
26118
- action: "merge",
26119
- memoryId: decision.targetId,
26120
- targetId: decision.targetId,
26121
- proofCount: updated.proofCount ?? (existing.proofCount ?? 1) + 1
26278
+ done: {
26279
+ action: "merge",
26280
+ memoryId: decision.targetId,
26281
+ targetId: decision.targetId,
26282
+ proofCount: updated.proofCount ?? (existing.proofCount ?? 1) + 1
26283
+ }
26122
26284
  };
26123
26285
  }
26124
26286
  if (decision.action === "update" && decision.targetId && decision.content) {
26125
26287
  const existing = await getVaultMemoryOp(ctx.vaultCtx, decision.targetId);
26126
- if (!existing) return null;
26288
+ if (!existing || existing.supersededBy) return null;
26127
26289
  const mergedSourceIds = unionStrings(
26128
26290
  existing.sourceChunkIds ?? [],
26129
26291
  options.sourceChunkIds ?? []
@@ -26150,10 +26312,12 @@ async function tryConsolidate(trimmed, ctx, options) {
26150
26312
  }
26151
26313
  ctx.vaultCache.set(decision.targetId, Float32Array.from(newEmbedding));
26152
26314
  return {
26153
- action: "update",
26154
- memoryId: decision.targetId,
26155
- targetId: decision.targetId,
26156
- proofCount: updated.proofCount ?? (existing.proofCount ?? 1) + 1
26315
+ done: {
26316
+ action: "update",
26317
+ memoryId: decision.targetId,
26318
+ targetId: decision.targetId,
26319
+ proofCount: updated.proofCount ?? (existing.proofCount ?? 1) + 1
26320
+ }
26157
26321
  };
26158
26322
  }
26159
26323
  return null;
@@ -32888,6 +33052,7 @@ function buildSystemPrompt(ctx, options) {
32888
33052
  streamCancelPath,
32889
33053
  streamReplayPath,
32890
33054
  summaryToSystemMessage,
33055
+ supersedeVaultMemoryOp,
32891
33056
  toolSetSystemPrompts,
32892
33057
  updateConversationProjectOp,
32893
33058
  updateConversationTitleOp,
@@ -53,8 +53,12 @@ import { ResultCallback } from '@nozbe/watermelondb/utils/fp/Result';
53
53
  * LLM topic-extraction pass, so the background topic worker re-extracts only
54
54
  * memories edited since (updated_at > topics_extracted_at) instead of
55
55
  * re-running the whole vault
56
+ * - v37: Added superseded_by + superseded_at columns to memory_vault for
57
+ * write-time supersession — a changed fact retires the stale one (points at
58
+ * the newer memory) instead of both surviving; superseded rows are excluded
59
+ * from recall/dedup by default
56
60
  */
57
- declare const SDK_SCHEMA_VERSION = 36;
61
+ declare const SDK_SCHEMA_VERSION = 37;
58
62
  /**
59
63
  * Combined WatermelonDB schema for all SDK storage modules.
60
64
  *
@@ -134,6 +138,7 @@ declare const sdkSchema: Readonly<{
134
138
  * - v32 → v33: Added `embedding_model` column to memory_vault (null grandfathered as current-model-compatible)
135
139
  * - v34 → v35: Added `conversation_memory` table (conversation ↔ recalled memory ids)
136
140
  * - v35 → v36: Added `topics_extracted_at` column to memory_vault (watermark for the background topic-extraction worker; null + existing links grandfathered as extracted)
141
+ * - v36 → v37: Added `superseded_by` + `superseded_at` columns to memory_vault (write-time supersession; null = live, excluded from recall/dedup when set)
137
142
  */
138
143
  declare const sdkMigrations: Readonly<{
139
144
  validated: true;
@@ -4142,6 +4147,9 @@ declare class VaultMemory extends Model$1 {
4142
4147
  /** Unix ms of the last LLM topic-extraction pass. Null = never extracted
4143
4148
  * standalone (linked legacy rows are grandfathered as extracted). */
4144
4149
  topicsExtractedAt: number | null;
4150
+ /** A2 supersession: newer memory id that replaced this one, or null if live. */
4151
+ supersededBy: string | null;
4152
+ supersededAt: number | null;
4145
4153
  createdAt: Date;
4146
4154
  updatedAt: Date;
4147
4155
  isDeleted: boolean;
@@ -4249,6 +4257,13 @@ interface StoredVaultMemory {
4249
4257
  * Null = never extracted standalone; rows that already carry entity links
4250
4258
  * are grandfathered as extracted (see getMemoriesNeedingTopicExtractionOp). */
4251
4259
  topicsExtractedAt: number | null;
4260
+ /** Write-time supersession (A2): id of the newer memory that replaced this
4261
+ * one (incompatible-value update, e.g. "Lives in Portland" → "Lives in SF").
4262
+ * Null = live. Superseded rows are excluded from recall/dedup by default but
4263
+ * kept for history + the read-time fallback. */
4264
+ supersededBy: string | null;
4265
+ /** Unix ms when this memory was superseded. Null when live. */
4266
+ supersededAt: number | null;
4252
4267
  createdAt: Date;
4253
4268
  updatedAt: Date;
4254
4269
  isDeleted: boolean;
@@ -4357,12 +4372,30 @@ declare function getAllVaultMemoriesOp(ctx: VaultMemoryOperationsContext, option
4357
4372
  * render "forgotten" nodes; ordinary consumers should leave this off.
4358
4373
  */
4359
4374
  includeDeleted?: boolean;
4375
+ /**
4376
+ * Include A2-superseded memories (each carries `supersededBy`). Default
4377
+ * `false` — superseded rows are excluded, as they are from recall/dedup.
4378
+ * Used by a "memory history" view to render retired facts.
4379
+ */
4380
+ includeSuperseded?: boolean;
4360
4381
  }): Promise<StoredVaultMemory[]>;
4361
4382
  declare function getAllVaultMemoryContentsOp(ctx: VaultMemoryOperationsContext, options?: {
4362
4383
  since?: Date;
4363
4384
  }): Promise<string[]>;
4364
4385
  declare function updateVaultMemoryOp(ctx: VaultMemoryOperationsContext, id: string, opts: UpdateVaultMemoryOptions): Promise<StoredVaultMemory | null>;
4365
4386
  declare function deleteVaultMemoryOp(ctx: VaultMemoryOperationsContext, id: string): Promise<boolean>;
4387
+ /**
4388
+ * Mark a memory as superseded by a newer one (A2 write-time supersession).
4389
+ * The row stays in the table (history + read-time fallback) but is excluded
4390
+ * from recall/dedup by default via `superseded_by`. Idempotent-ish: no-op if
4391
+ * the row is missing, not owned, deleted, or already superseded. Does NOT
4392
+ * preserve `updated_at` — superseded rows are hidden from recall, so their
4393
+ * recency is irrelevant.
4394
+ *
4395
+ * @param id - the memory being retired (e.g. "Lives in Portland")
4396
+ * @param supersededById - the newer memory that replaced it (e.g. "Lives in SF")
4397
+ */
4398
+ declare function supersedeVaultMemoryOp(ctx: VaultMemoryOperationsContext, id: string, supersededById: string): Promise<boolean>;
4366
4399
  /**
4367
4400
  * Get all non-deleted, unfiled vault memories (folder_id is null).
4368
4401
  */
@@ -5853,7 +5886,7 @@ interface RecallDiagnostics {
5853
5886
  /** Soft-degradation signals that fired this call (empty when clean). */
5854
5887
  degraded: RecallDegradation[];
5855
5888
  }
5856
- type RetainAction = "create" | "merge" | "update" | "skip" | "suppressed";
5889
+ type RetainAction = "create" | "merge" | "update" | "skip" | "suppressed" | "supersede";
5857
5890
  type RetainSource = "manual" | "auto-extracted" | "capsule";
5858
5891
  /** Why the consolidator fell back to "create" instead of a real decision. */
5859
5892
  type ConsolidationFallbackReason = "llm_error" | "invalid_response";
@@ -5919,7 +5952,8 @@ interface RetainOptions {
5919
5952
  interface RetainResult {
5920
5953
  action: RetainAction;
5921
5954
  memoryId: string;
5922
- /** When action is 'merge' or 'update', the prior memory's id. */
5955
+ /** When action is 'merge' or 'update', the prior memory's id. When action is
5956
+ * 'supersede', the stale memory that was retired (`memoryId` is the new one). */
5923
5957
  targetId?: string;
5924
5958
  /**
5925
5959
  * When action is 'suppressed', the id of the soft-deleted memory that blocked
@@ -6141,9 +6175,12 @@ declare function extractFacts(messages: AutoExtractMessage[], options: ExtractFa
6141
6175
  type ExtractOutcome = "extracted" | "no-facts" | "empty-after-retry" | "dropped-after-redaction";
6142
6176
  /**
6143
6177
  * Stage 2 — for each extracted candidate, call retain() with auto-merge
6144
- * enabled. The resolver path (decide create/merge/update via a second LLM
6145
- * call against the existing vault) is deferred — the auto-merge inside
6146
- * retain() handles dedup at the cosine-similarity level for hackathon.
6178
+ * enabled. When `consolidateOptions` are wired, retain()'s consolidation pass
6179
+ * is the "resolver": a second LLM call against the top-K existing vault
6180
+ * memories that decides create/update/noop/supersede — including retiring a
6181
+ * stale value on a state change (the supersession the extraction prompt above
6182
+ * promises). Without consolidation, retain() still dedups at the cosine-merge
6183
+ * level, and the read-time supersession heuristic remains the fallback.
6147
6184
  *
6148
6185
  * Returns the candidates that survived validation along with the retain
6149
6186
  * result for each (which captures whether the fact was created, merged,
@@ -7731,4 +7768,4 @@ declare function sanitizeQuotes(s: string): string;
7731
7768
  declare function renderTemplate(value: string | null | undefined, template: string): string | null;
7732
7769
  declare function buildSystemPrompt(ctx: PromptContext, options?: BuildPromptOptions): BuildPromptResult;
7733
7770
 
7734
- export { type AnalyzeStyleOptions, type AnalyzeStyleResult, type ApiResponse, type ApiType, type AutoExecutedToolResult, type AutoExtractMessage, type AutoExtractor, type Budget, type BuildPromptOptions, type BuildPromptResult, type CachedChunkVectors, type CachedServerTools, type ChatCompletionUsage, type ChatRole, type ChunkSearchResult, type ChunkVectorCache, type ChunkingOptions, type ConnectorGuidance, type ConnectorGuidanceInput, type ConsolidationFallbackReason, Conversation, ConversationSummary, type CreateAutoExtractorOptions, type CreateConversationOptions, type CreateMediaOptions, type CreateMessageOptions, type CreateModelPreferenceOptions, type CreateProjectOptions, type CreateUserPreferenceOptions, type CreateVaultFolderOptions, type CreateVaultMemoryOptions, type CryptoPriceClassification, type CryptoPricePreProcessorOptions, DEFAULT_ANALYSIS_PROMPT, DEFAULT_ANALYZE_AFTER_MESSAGES, DEFAULT_CACHE_EXPIRATION_MS, DEFAULT_CHUNK_CACHE_SIZE, DEFAULT_CHUNK_OVERLAP, DEFAULT_CHUNK_SIZE, DEFAULT_DOCUMENT_PATTERN, DEFAULT_EXCLUDED_SERVER_TOOLS, DEFAULT_MAX_INPUT_MESSAGES, DEFAULT_MAX_PROFILE_LENGTH, DEFAULT_MIN_CHUNK_SIZE, DEFAULT_MIN_MESSAGES, DEFAULT_PERSONALITY_SETTINGS, DEFAULT_PROMPT_TEMPLATES, DEFAULT_REFRESH_EVERY_MESSAGES, DEFAULT_SERVER_TOOLS_MATCH_OPTIONS, DEFAULT_SUMMARY_MIN_WINDOW_MESSAGES, DEFAULT_SUMMARY_MODEL, DEFAULT_SUMMARY_TOKEN_THRESHOLD, DEFAULT_VAULT_CACHE_SIZE, DatabaseManager, type DatabaseManagerLogger, type DatabaseManagerOptions, type EmbeddedWalletSignerFn, ExcelProcessor, type ExtractFactsOptions, type ExtractOutcome, type ExtractedCandidate, type ExtractedEntity, type ExtractionCursorStore, type FactType, type FileMetadata, type FileProcessor, type FileTypeQuery, type FileWithData, type FlushResult, INFERENCE_ID_HEADER, type LazyStoredConversation, type LlmTokenUsage, MAX_MESSAGES_PER_SUMMARIZATION, Media, type MediaDimensions, type MediaFilterOptions, type MediaMetadata, type MediaOperationsContext, type MediaRole, type MediaType, type MemoriesNeedingTopicExtraction, type EmbeddingOptions as MemoryEngineEmbeddingOptions, type MemoryEngineResult, type MemoryEngineSearchOptions, type MemoryExtractedEvent, type MemoryKind, type MemoryVaultSearchOptions, type MemoryVaultToolOptions, Message, type MessageChunk, type MessageFeedback, type ModelCallEndEvent, type ModelCallStartEvent, ModelPreference, type OperationExecutor, type ParsedServerToolsResponse, PdfProcessor, type PersonalitySettings, type PersonalitySliders, type PersonalityStyle, type PgClientLike, type PgPoolLike, type PlatformStorage, type PortalLlmAuth, PostgreSQLAdapter, type PostgreSQLAdapterOptions, type PreprocessingOptions, type PreprocessingResult, type ProcessedFileResult, ProcessorRegistry, type ProfileUpdate, Project, type ProjectOperationsContext, type PromptContext, type PromptPreProcessor, type PromptPreProcessorContext, type PromptSection, type PromptTemplates, type QueueEncryptionContext, QueueManager, type QueueStatus, type QueuedOperation, type QueuedOperationType, RECALL_MAX_LIMIT, RECALL_TOOL_NAME, type RankedMemory, type RecallContext, type RecallDegradation, type RecallDiagnostics, type RecallOptions, type RecallResult, type RecallToolCallbacks, type RecallToolOptions, type RecencyOptions, type ReflectOptions, type ReflectResult, RerankerUnavailableError, type ResumeStreamOptions, type ResumeStreamResult, type RetainAction, type RetainContext, type RetainOptions, type RetainResult, type RetainSource, type RunEndEvent, type RunErrorEvent, type RunHooks, type RunStartEvent, type RunToolLoopOptions, type RunToolLoopResult, SDK_SCHEMA_VERSION, SERVER_TOOL_DEPENDENCY_SETS, SLIDER_CONFIG, STREAM_RESUMABLE_HEADER, type ScoreBreakdown, type SearchSource, type SelectServerToolsForPromptOptions, type ServerTool, type ServerToolCallEvent, type ServerToolsFilterFunction, type ServerToolsOptions, type ServerToolsResponse, type SettingsStorageOperationsContext, type SignMessageFn, type StepFinishEvent, type StockPriceClassification, type StockPricePreProcessorOptions, type StorageOperationsContext, type StoredConversation, type StoredConversationSummary, type StoredFileWithContext, type StoredMedia, type StoredMessage, type StoredMessageWithSimilarity, type StoredModelPreference, type StoredProject, type StoredUserPreference, type StoredVaultFolder, type StoredVaultMemory, StreamExpiredError, type StreamMetaEvent, type StreamResumeHandle, type StreamSmoothingConfig, type StreamingTransport, type StreamingTransportOptions, type StreamingTransportResult, type StyleAnalysisSchedule, TOOL_CATALOG, TOPIC_EXTRACTION_BATCH_SIZE, type TextChunk, TextProcessor, type ToolConfig, type ToolExecutor, type ToolMatchOptions, type ToolMatchResult, type ToolSet, type ToolUseEndEvent, type ToolUseStartEvent, type TopicExtractOptions, type TopicExtractionInput, type TopicExtractionRunResult, type TurnCompleteEvent, type TurnSkippedEvent, type UpdateMediaOptions, type UpdateModelPreferenceOptions, type UpdateProjectOptions, type UpdateUserPreferenceOptions, type UpdateVaultFolderOptions, type UpdateVaultMemoryOptions, UserPreference, type UserPreferencesStorageOperationsContext, type VaultEmbeddingCache, VaultFolder, type VaultFolderOperationsContext, VaultMemory, type VaultMemoryOperationsContext, type VaultSaveOperation, type VaultSearchResult, WalletPoller, type WeatherClassification, type WeatherPreProcessorOptions, type WebSearchClassification, type WebSearchPreProcessorOptions, WordProcessor, ZipProcessor, type ZipProcessorOptions, activatedToolSetNames, analyzeStyle, buildConnectorGuidance, buildDeniedToolsRider, buildSystemPrompt, chunkAndEmbedAllMessages, chunkAndEmbedMessage, chunkText, classifyCryptoPrice, classifyCryptoPriceBatch, classifyStockPrice, classifyStockPriceBatch, classifyWeather, classifyWeatherBatch, classifyWebSearch, classifyWebSearchBatch, cleanupConversationSummary, clearAllEncryptionKeys, clearAllEncryptionState, clearAllKeyPairs, clearEncryptionKey, clearKeyPair, clearLazyTitleCache, clearMessagesOp, clearServerToolsCache, composeHooks, createAutoExtractor, createChunkVectorCache, createConversationOp, createCryptoPricePreProcessor, createMediaBatchOp, createMediaOp, createMemoryEngineTool, createMemoryVaultSearchTool, createMemoryVaultTool, createMessageOp, createPlatformCursorStore, createProjectOp, createRecallTool, createServerToolsFilter, createStockPricePreProcessor, createSummaryContext, createVaultEmbeddingCache, createVaultFolderOp, createVaultMemoriesBatchOp, createVaultMemoryOp, createWeatherPreProcessor, createWebSearchPreProcessor, decryptConversationTitle, decryptData, decryptDataBatch, decryptDataBytes, decryptDataWithKey, defaultServerToolsFilter, deleteAllVaultMemoriesForUserOp, deleteConversationOp, deleteConversationSummaryOp, deleteMediaByConversationOp, deleteMediaByMessageOp, deleteMediaOp, deleteModelPreferenceOp, deleteProjectOp, deleteUserPreferenceOp, deleteVaultFolderOp, deleteVaultMemoryOp, eagerEmbedContent, embedAllMessages, embedMessage, encryptData, encryptDataBatch, encryptDataWithKey, ensureDefaultFoldersOp, estimateMessagesTokens, estimateTokens, exportPublicKey, extractAndLinkEntitiesForMemoriesOp, extractAndRetain, extractEntitiesForMemories, extractFacts, findMatchingTools, generateConversationId, generateEmbedding, generateEmbeddings, generateMediaId, generateProjectId, getAIGeneratedMediaOp, getAllFilesOp, getAllVaultFoldersOp, getAllVaultMemoriesOp, getAllVaultMemoryContentsOp, getAudioOp, getCachedServerTools, getConversationOp, getConversationSummaryOp, getConversationsByProjectLazyOp, getConversationsByProjectOp, getConversationsLazyOp, getConversationsOp, getDocumentsOp, getEncryptionKey, getImagesOp, getMediaByConversationOp, getMediaByIdOp, getMediaByIdsOp, getMediaByMessageOp, getMediaByModelOp, getMediaByRoleOp, getMediaBySourceUrlOp, getMediaByTypeOp, getMediaCountOp, getMediaCountsByTypeOp, getMediaOp, getMediaTypeFromMime, getMemoriesNeedingTopicExtractionOp, getMessagesOp, getModelPreferenceOp, getProjectConversationCountOp, getProjectConversationsOp, getProjectOp, getProjectsOp, getRecentMediaOp, getServerTools, getSupportedFileTypes, getToolsChecksum, getUnfiledVaultMemoriesOp, getUserPreferenceOp, getUserUploadedMediaOp, getVaultFolderMemoryCountOp, getVaultMemoryOp, getVideosOp, hardDeleteMediaOp, hasEncryptionKey, hasKeyPair, isRerankerAvailable, isSupportedFile, isSupportedMediaType, makeSyntheticStoredConversation, makeSyntheticStoredMessage, maybeSummarizeHistory, mediaToStored, migrateFromModelPreferencesOp, moveMemoriesToFolderOp, onKeyAvailable, preEmbedVaultMemories, preprocessFiles, progressiveSummarize, projectToStored, queueManager, recall, reflect, relinkMisclassifiedVideosOp, renderTemplate, requestEncryptionKey, requestKeyPair, resumeStream, retain, runToolLoop, sanitizeQuotes, schemaToCreateSQL, sdkMigrations, sdkModelClasses, sdkSchema, searchChunksOp, searchMediaOp, searchMessagesOp, searchVaultMemories, selectServerToolsForPrompt, serverPlatformStorage, setModelPreferenceOp, setUserPreferenceOp, shouldAnalyzeStyle, shouldChunkMessage, shouldRefreshTools, splitMessagesAtThreshold, stampTopicsExtractedAtOp, streamCancelPath, streamReplayPath, summaryToSystemMessage, toolSetSystemPrompts, updateConversationProjectOp, updateConversationTitleOp, updateMediaMessageIdBatchOp, updateMediaOp, updateMessageChunksOp, updateMessageEmbeddingOp, updateMessageErrorOp, updateMessageFeedbackOp, updateModelsOp, updatePersonalityOp, updateProfileOp, updateProjectNameOp, updateProjectOp, updateVaultFolderContextOp, updateVaultFolderOp, updateVaultMemoryEmbeddingOp, updateVaultMemoryOp, upsertConversationSummaryOp, upsertMessageOp };
7771
+ export { type AnalyzeStyleOptions, type AnalyzeStyleResult, type ApiResponse, type ApiType, type AutoExecutedToolResult, type AutoExtractMessage, type AutoExtractor, type Budget, type BuildPromptOptions, type BuildPromptResult, type CachedChunkVectors, type CachedServerTools, type ChatCompletionUsage, type ChatRole, type ChunkSearchResult, type ChunkVectorCache, type ChunkingOptions, type ConnectorGuidance, type ConnectorGuidanceInput, type ConsolidationFallbackReason, Conversation, ConversationSummary, type CreateAutoExtractorOptions, type CreateConversationOptions, type CreateMediaOptions, type CreateMessageOptions, type CreateModelPreferenceOptions, type CreateProjectOptions, type CreateUserPreferenceOptions, type CreateVaultFolderOptions, type CreateVaultMemoryOptions, type CryptoPriceClassification, type CryptoPricePreProcessorOptions, DEFAULT_ANALYSIS_PROMPT, DEFAULT_ANALYZE_AFTER_MESSAGES, DEFAULT_CACHE_EXPIRATION_MS, DEFAULT_CHUNK_CACHE_SIZE, DEFAULT_CHUNK_OVERLAP, DEFAULT_CHUNK_SIZE, DEFAULT_DOCUMENT_PATTERN, DEFAULT_EXCLUDED_SERVER_TOOLS, DEFAULT_MAX_INPUT_MESSAGES, DEFAULT_MAX_PROFILE_LENGTH, DEFAULT_MIN_CHUNK_SIZE, DEFAULT_MIN_MESSAGES, DEFAULT_PERSONALITY_SETTINGS, DEFAULT_PROMPT_TEMPLATES, DEFAULT_REFRESH_EVERY_MESSAGES, DEFAULT_SERVER_TOOLS_MATCH_OPTIONS, DEFAULT_SUMMARY_MIN_WINDOW_MESSAGES, DEFAULT_SUMMARY_MODEL, DEFAULT_SUMMARY_TOKEN_THRESHOLD, DEFAULT_VAULT_CACHE_SIZE, DatabaseManager, type DatabaseManagerLogger, type DatabaseManagerOptions, type EmbeddedWalletSignerFn, ExcelProcessor, type ExtractFactsOptions, type ExtractOutcome, type ExtractedCandidate, type ExtractedEntity, type ExtractionCursorStore, type FactType, type FileMetadata, type FileProcessor, type FileTypeQuery, type FileWithData, type FlushResult, INFERENCE_ID_HEADER, type LazyStoredConversation, type LlmTokenUsage, MAX_MESSAGES_PER_SUMMARIZATION, Media, type MediaDimensions, type MediaFilterOptions, type MediaMetadata, type MediaOperationsContext, type MediaRole, type MediaType, type MemoriesNeedingTopicExtraction, type EmbeddingOptions as MemoryEngineEmbeddingOptions, type MemoryEngineResult, type MemoryEngineSearchOptions, type MemoryExtractedEvent, type MemoryKind, type MemoryVaultSearchOptions, type MemoryVaultToolOptions, Message, type MessageChunk, type MessageFeedback, type ModelCallEndEvent, type ModelCallStartEvent, ModelPreference, type OperationExecutor, type ParsedServerToolsResponse, PdfProcessor, type PersonalitySettings, type PersonalitySliders, type PersonalityStyle, type PgClientLike, type PgPoolLike, type PlatformStorage, type PortalLlmAuth, PostgreSQLAdapter, type PostgreSQLAdapterOptions, type PreprocessingOptions, type PreprocessingResult, type ProcessedFileResult, ProcessorRegistry, type ProfileUpdate, Project, type ProjectOperationsContext, type PromptContext, type PromptPreProcessor, type PromptPreProcessorContext, type PromptSection, type PromptTemplates, type QueueEncryptionContext, QueueManager, type QueueStatus, type QueuedOperation, type QueuedOperationType, RECALL_MAX_LIMIT, RECALL_TOOL_NAME, type RankedMemory, type RecallContext, type RecallDegradation, type RecallDiagnostics, type RecallOptions, type RecallResult, type RecallToolCallbacks, type RecallToolOptions, type RecencyOptions, type ReflectOptions, type ReflectResult, RerankerUnavailableError, type ResumeStreamOptions, type ResumeStreamResult, type RetainAction, type RetainContext, type RetainOptions, type RetainResult, type RetainSource, type RunEndEvent, type RunErrorEvent, type RunHooks, type RunStartEvent, type RunToolLoopOptions, type RunToolLoopResult, SDK_SCHEMA_VERSION, SERVER_TOOL_DEPENDENCY_SETS, SLIDER_CONFIG, STREAM_RESUMABLE_HEADER, type ScoreBreakdown, type SearchSource, type SelectServerToolsForPromptOptions, type ServerTool, type ServerToolCallEvent, type ServerToolsFilterFunction, type ServerToolsOptions, type ServerToolsResponse, type SettingsStorageOperationsContext, type SignMessageFn, type StepFinishEvent, type StockPriceClassification, type StockPricePreProcessorOptions, type StorageOperationsContext, type StoredConversation, type StoredConversationSummary, type StoredFileWithContext, type StoredMedia, type StoredMessage, type StoredMessageWithSimilarity, type StoredModelPreference, type StoredProject, type StoredUserPreference, type StoredVaultFolder, type StoredVaultMemory, StreamExpiredError, type StreamMetaEvent, type StreamResumeHandle, type StreamSmoothingConfig, type StreamingTransport, type StreamingTransportOptions, type StreamingTransportResult, type StyleAnalysisSchedule, TOOL_CATALOG, TOPIC_EXTRACTION_BATCH_SIZE, type TextChunk, TextProcessor, type ToolConfig, type ToolExecutor, type ToolMatchOptions, type ToolMatchResult, type ToolSet, type ToolUseEndEvent, type ToolUseStartEvent, type TopicExtractOptions, type TopicExtractionInput, type TopicExtractionRunResult, type TurnCompleteEvent, type TurnSkippedEvent, type UpdateMediaOptions, type UpdateModelPreferenceOptions, type UpdateProjectOptions, type UpdateUserPreferenceOptions, type UpdateVaultFolderOptions, type UpdateVaultMemoryOptions, UserPreference, type UserPreferencesStorageOperationsContext, type VaultEmbeddingCache, VaultFolder, type VaultFolderOperationsContext, VaultMemory, type VaultMemoryOperationsContext, type VaultSaveOperation, type VaultSearchResult, WalletPoller, type WeatherClassification, type WeatherPreProcessorOptions, type WebSearchClassification, type WebSearchPreProcessorOptions, WordProcessor, ZipProcessor, type ZipProcessorOptions, activatedToolSetNames, analyzeStyle, buildConnectorGuidance, buildDeniedToolsRider, buildSystemPrompt, chunkAndEmbedAllMessages, chunkAndEmbedMessage, chunkText, classifyCryptoPrice, classifyCryptoPriceBatch, classifyStockPrice, classifyStockPriceBatch, classifyWeather, classifyWeatherBatch, classifyWebSearch, classifyWebSearchBatch, cleanupConversationSummary, clearAllEncryptionKeys, clearAllEncryptionState, clearAllKeyPairs, clearEncryptionKey, clearKeyPair, clearLazyTitleCache, clearMessagesOp, clearServerToolsCache, composeHooks, createAutoExtractor, createChunkVectorCache, createConversationOp, createCryptoPricePreProcessor, createMediaBatchOp, createMediaOp, createMemoryEngineTool, createMemoryVaultSearchTool, createMemoryVaultTool, createMessageOp, createPlatformCursorStore, createProjectOp, createRecallTool, createServerToolsFilter, createStockPricePreProcessor, createSummaryContext, createVaultEmbeddingCache, createVaultFolderOp, createVaultMemoriesBatchOp, createVaultMemoryOp, createWeatherPreProcessor, createWebSearchPreProcessor, decryptConversationTitle, decryptData, decryptDataBatch, decryptDataBytes, decryptDataWithKey, defaultServerToolsFilter, deleteAllVaultMemoriesForUserOp, deleteConversationOp, deleteConversationSummaryOp, deleteMediaByConversationOp, deleteMediaByMessageOp, deleteMediaOp, deleteModelPreferenceOp, deleteProjectOp, deleteUserPreferenceOp, deleteVaultFolderOp, deleteVaultMemoryOp, eagerEmbedContent, embedAllMessages, embedMessage, encryptData, encryptDataBatch, encryptDataWithKey, ensureDefaultFoldersOp, estimateMessagesTokens, estimateTokens, exportPublicKey, extractAndLinkEntitiesForMemoriesOp, extractAndRetain, extractEntitiesForMemories, extractFacts, findMatchingTools, generateConversationId, generateEmbedding, generateEmbeddings, generateMediaId, generateProjectId, getAIGeneratedMediaOp, getAllFilesOp, getAllVaultFoldersOp, getAllVaultMemoriesOp, getAllVaultMemoryContentsOp, getAudioOp, getCachedServerTools, getConversationOp, getConversationSummaryOp, getConversationsByProjectLazyOp, getConversationsByProjectOp, getConversationsLazyOp, getConversationsOp, getDocumentsOp, getEncryptionKey, getImagesOp, getMediaByConversationOp, getMediaByIdOp, getMediaByIdsOp, getMediaByMessageOp, getMediaByModelOp, getMediaByRoleOp, getMediaBySourceUrlOp, getMediaByTypeOp, getMediaCountOp, getMediaCountsByTypeOp, getMediaOp, getMediaTypeFromMime, getMemoriesNeedingTopicExtractionOp, getMessagesOp, getModelPreferenceOp, getProjectConversationCountOp, getProjectConversationsOp, getProjectOp, getProjectsOp, getRecentMediaOp, getServerTools, getSupportedFileTypes, getToolsChecksum, getUnfiledVaultMemoriesOp, getUserPreferenceOp, getUserUploadedMediaOp, getVaultFolderMemoryCountOp, getVaultMemoryOp, getVideosOp, hardDeleteMediaOp, hasEncryptionKey, hasKeyPair, isRerankerAvailable, isSupportedFile, isSupportedMediaType, makeSyntheticStoredConversation, makeSyntheticStoredMessage, maybeSummarizeHistory, mediaToStored, migrateFromModelPreferencesOp, moveMemoriesToFolderOp, onKeyAvailable, preEmbedVaultMemories, preprocessFiles, progressiveSummarize, projectToStored, queueManager, recall, reflect, relinkMisclassifiedVideosOp, renderTemplate, requestEncryptionKey, requestKeyPair, resumeStream, retain, runToolLoop, sanitizeQuotes, schemaToCreateSQL, sdkMigrations, sdkModelClasses, sdkSchema, searchChunksOp, searchMediaOp, searchMessagesOp, searchVaultMemories, selectServerToolsForPrompt, serverPlatformStorage, setModelPreferenceOp, setUserPreferenceOp, shouldAnalyzeStyle, shouldChunkMessage, shouldRefreshTools, splitMessagesAtThreshold, stampTopicsExtractedAtOp, streamCancelPath, streamReplayPath, summaryToSystemMessage, supersedeVaultMemoryOp, toolSetSystemPrompts, updateConversationProjectOp, updateConversationTitleOp, updateMediaMessageIdBatchOp, updateMediaOp, updateMessageChunksOp, updateMessageEmbeddingOp, updateMessageErrorOp, updateMessageFeedbackOp, updateModelsOp, updatePersonalityOp, updateProfileOp, updateProjectNameOp, updateProjectOp, updateVaultFolderContextOp, updateVaultFolderOp, updateVaultMemoryEmbeddingOp, updateVaultMemoryOp, upsertConversationSummaryOp, upsertMessageOp };