@anuma/sdk 3.12.1 → 3.13.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.
@@ -4507,14 +4507,23 @@ declare class VaultMemory extends Model {
4507
4507
  /** When true, the user has manually set this memory's topics; auto-extraction
4508
4508
  * leaves its entity links alone. Null on legacy rows (treated as false). */
4509
4509
  topicsUserManaged: boolean | null;
4510
+ /** The durable, synced record of this memory's topics — JSON `StoredTopic[]`.
4511
+ * `entity` / `memory_entity` are a device-local index over it. Null = pre-v42
4512
+ * (backfilled from the row's current links by the sweep). */
4513
+ topics: string | null;
4514
+ /** Unix ms of the last `topics` write. Separate from `updated_at`, which every
4515
+ * topic writer pins on purpose (recall recency) — see the schema note. */
4516
+ topicsUpdatedAt: number | null;
4510
4517
  /** Unix ms of the last LLM topic-extraction pass. Null = never extracted
4511
- * standalone (linked legacy rows are grandfathered as extracted). */
4518
+ * standalone (linked legacy rows are grandfathered as extracted).
4519
+ * DEPRECATED (v42) — subsumed by `topics_updated_at`; see the schema note. */
4512
4520
  topicsExtractedAt: number | null;
4513
4521
  /** A2 supersession: newer memory id that replaced this one, or null if live. */
4514
4522
  supersededBy: string | null;
4515
4523
  supersededAt: number | null;
4516
4524
  /** Extraction-logic version this memory was last stamped under. Null (pre-v38)
4517
- * reads as 0, so a TOPICS_EXTRACTION_VERSION bump re-extracts stale rows. */
4525
+ * reads as 0, so a TOPICS_EXTRACTION_VERSION bump re-extracts stale rows.
4526
+ * DEPRECATED (v42) — subsumed by `topics_updated_at`; see the schema note. */
4518
4527
  topicsExtractedVersion: number | null;
4519
4528
  /** C3 re-observation watermark: Unix ms of the last retain() merge, or null. */
4520
4529
  lastObservedAt: number | null;
@@ -4583,6 +4592,33 @@ declare class MemoryEntity extends Model {
4583
4592
  declare const ENTITY_KINDS: readonly ["person", "organization", "place", "event", "product", "thing", "concept", "other"];
4584
4593
  /** @public */
4585
4594
  type EntityKind = (typeof ENTITY_KINDS)[number];
4595
+ /**
4596
+ * Who put a topic on a memory. Written to `memory_vault.topics` but not yet
4597
+ * READ anywhere — it exists so a later improvement can refresh the `auto`
4598
+ * entries of a curated memory while leaving `user` entries alone (today
4599
+ * `topics_user_managed` is all-or-nothing per memory) without needing a second
4600
+ * migration or backfill. Don't build that behavior off it yet.
4601
+ *
4602
+ * When you do: a value written by the v42 backfill is NOT ground truth. Pre-v42
4603
+ * rows carry no per-topic provenance, so `backfillMemoryTopicsOp` derives it
4604
+ * from the per-memory `topics_user_managed` flag and stamps a curated legacy
4605
+ * row's every topic `user` — see the note at that derivation.
4606
+ * @public
4607
+ */
4608
+ type TopicSource = "user" | "auto";
4609
+ /**
4610
+ * One entry in `memory_vault.topics` — the durable, synced record of a memory's
4611
+ * topics. `name` carries the CALLER's display casing, unlike
4612
+ * {@link StoredEntity.canonicalName}, which {@link normalizeEntityName}
4613
+ * lowercases and which has no display column: preserving casing here is the
4614
+ * point of storing names on the memory row.
4615
+ * @public
4616
+ */
4617
+ interface StoredTopic {
4618
+ name: string;
4619
+ kind?: string;
4620
+ source: TopicSource;
4621
+ }
4586
4622
 
4587
4623
  interface EntityOperationsContext {
4588
4624
  database: Database;
@@ -5783,9 +5819,17 @@ interface StoredVaultMemory {
5783
5819
  /** When true, the user has manually set this memory's topics (entity links);
5784
5820
  * auto-extraction leaves them alone. False on legacy/auto rows. */
5785
5821
  topicsUserManaged: boolean;
5822
+ /** The memory's topics as the DURABLE, synced record — `entity` /
5823
+ * `memory_entity` are a device-local index over it. Null = pre-v42, no record
5824
+ * yet; `[]` = a record of "no topics". */
5825
+ topics: StoredTopic[] | null;
5826
+ /** Unix ms of the last `topics` write, or null if never written. Separate from
5827
+ * `updatedAt`, which topic writes deliberately pin (recall recency). */
5828
+ topicsUpdatedAt: number | null;
5786
5829
  /** Unix ms of the last LLM topic-extraction pass over this memory's content.
5787
5830
  * Null = never extracted standalone; rows that already carry entity links
5788
- * are grandfathered as extracted (see getMemoriesNeedingTopicExtractionOp). */
5831
+ * are grandfathered as extracted (see getMemoriesNeedingTopicExtractionOp).
5832
+ * DEPRECATED (v42) — subsumed by `topicsUpdatedAt`; see the schema note. */
5789
5833
  topicsExtractedAt: number | null;
5790
5834
  /** Write-time supersession (A2): id of the newer memory that replaced this
5791
5835
  * one (incompatible-value update, e.g. "Lives in Portland" → "Lives in SF").
@@ -5795,7 +5839,8 @@ interface StoredVaultMemory {
5795
5839
  /** Unix ms when this memory was superseded. Null when live. */
5796
5840
  supersededAt: number | null;
5797
5841
  /** Extraction-logic version this memory was last stamped under. Null (pre-v38)
5798
- * reads as 0, so a TOPICS_EXTRACTION_VERSION bump re-extracts stale rows. */
5842
+ * reads as 0, so a TOPICS_EXTRACTION_VERSION bump re-extracts stale rows.
5843
+ * DEPRECATED (v42) — subsumed by `topicsUpdatedAt`; see the schema note. */
5799
5844
  topicsExtractedVersion: number | null;
5800
5845
  /** C3 re-observation watermark: Unix ms of the last retain() merge into this
5801
5846
  * fact. Distinct from `updatedAt` (which merges preserve). Null = never
@@ -6064,20 +6109,54 @@ interface MemoriesNeedingTopicExtraction {
6064
6109
  * grandfather backlog is drained across sweeps rather than in one spike.
6065
6110
  */
6066
6111
  linkedUnstamped: string[];
6112
+ /**
6113
+ * IDs whose `topics` record disagrees with their `memory_entity` links — the
6114
+ * restored-device case, where the synced record arrived but the device-local
6115
+ * index (which can never sync) did not. Rebuild with
6116
+ * {@link relinkMemoryTopicsOp}: no LLM call, and no `memory_vault` write, so a
6117
+ * restore doesn't re-upload the vault.
6118
+ *
6119
+ * INCLUDES user-managed rows. A curated memory's index needs rebuilding just
6120
+ * like an auto one, and the flag it arrives with is what keeps the autotagger
6121
+ * off it — so unlike {@link pending} / {@link linkedUnstamped}, this bucket is
6122
+ * not filtered by ownership. Bounded by `limit`.
6123
+ */
6124
+ topicsToRelink: string[];
6125
+ /**
6126
+ * IDs that have links but no `topics` record at all — rows predating v42,
6127
+ * whose topics would otherwise never reach the server. Fill with
6128
+ * {@link backfillMemoryTopicsOp} (no LLM call), which derives the record from
6129
+ * the links already there.
6130
+ *
6131
+ * Also includes user-managed rows, for the same reason: a curated memory's
6132
+ * topics are exactly the ones worth preserving across a migration. Bounded by
6133
+ * `limit` because filling `topics` bumps `topics_updated_at` and so re-uploads
6134
+ * the row (embedding included) — uncapped, the first sweep after upgrade would
6135
+ * re-upload the entire vault at once. Rows already in {@link pending} are
6136
+ * excluded: their imminent LLM pass writes `topics` anyway.
6137
+ */
6138
+ topicsBackfill: string[];
6067
6139
  }
6068
6140
  /**
6069
- * Sweep query for the background topic-extraction worker: partition the
6070
- * user's non-deleted, non-user-managed memories by what the worker should do
6071
- * with them (see {@link MemoriesNeedingTopicExtraction}). User-managed rows
6072
- * are never returned — the user owns their topics, including an intentionally
6073
- * empty set. Requires `ctx.entityCtx` for the entity-links check.
6141
+ * Sweep query for the background topic-extraction worker: partition the user's
6142
+ * non-deleted memories by what the worker should do with them (see
6143
+ * {@link MemoriesNeedingTopicExtraction}). Requires `ctx.entityCtx` for the
6144
+ * entity-links check.
6145
+ *
6146
+ * User-managed rows are excluded from the two LLM-facing buckets — the user owns
6147
+ * their topics, including an intentionally empty set — but NOT from
6148
+ * `topicsToRelink` / `topicsBackfill`, which only move a curated row's topics
6149
+ * between the record and the index and never re-derive them. That's why the
6150
+ * ownership filter lives in the partition below rather than in the query: a
6151
+ * restored curated memory is exactly the row whose index must be rebuilt.
6074
6152
  */
6075
6153
  declare function getMemoriesNeedingTopicExtractionOp(ctx: VaultMemoryOperationsContext, options?: {
6076
6154
  limit?: number;
6077
6155
  }): Promise<MemoriesNeedingTopicExtraction>;
6078
6156
  /**
6079
6157
  * Stamp `topics_extracted_at` (and `topics_extracted_version`) on the given
6080
- * memories — the topic worker calls this after a successful extraction pass
6158
+ * memories — both DEPRECATED (v42), subsumed by `topics_updated_at`; see the
6159
+ * schema note. The topic worker calls this after a successful extraction pass
6081
6160
  * (including zero-entity results, so quiet memories aren't re-asked every sweep)
6082
6161
  * and to grandfather `linkedUnstamped` rows without an LLM call. `version`
6083
6162
  * defaults to {@link TOPICS_EXTRACTION_VERSION}: stamping at the current version
@@ -6101,6 +6180,37 @@ declare function getMemoriesNeedingTopicExtractionOp(ctx: VaultMemoryOperationsC
6101
6180
  * needed to `prepareUpdate` stays bounded and never spikes the RecordCache.
6102
6181
  */
6103
6182
  declare function stampTopicsExtractedAtOp(ctx: VaultMemoryOperationsContext, memoryIds: readonly string[], extractedAt: number, version?: number): Promise<string[]>;
6183
+ /**
6184
+ * Rebuild the `memory_entity` index for the sweep's `topicsToRelink` rows from
6185
+ * each row's `topics` record — the restored-device repair. No LLM call: every
6186
+ * name already lives on the row.
6187
+ *
6188
+ * Writes NOTHING to `memory_vault`, deliberately. Restored rows are written
6189
+ * `_status: 'synced'`, so touching them would mark the whole vault dirty and
6190
+ * re-upload it (embeddings included) after every migration — the index is
6191
+ * device-local state and rebuilding it is not a change to the memory.
6192
+ * `topics_user_managed` in particular is left exactly as it arrived, so the
6193
+ * autotagger stays off a curated memory whose links this just restored.
6194
+ *
6195
+ * Skips deleted, foreign-user, and record-less rows. Returns the ids relinked.
6196
+ */
6197
+ declare function relinkMemoryTopicsOp(ctx: VaultMemoryOperationsContext, memoryIds: readonly string[]): Promise<string[]>;
6198
+ /**
6199
+ * Fill `topics` for the sweep's `topicsBackfill` rows from the links they
6200
+ * already carry — the one-time migration of pre-v42 rows, whose topics exist
6201
+ * only in the device-local index and so never reach the server. No LLM call.
6202
+ *
6203
+ * Bumps `topics_updated_at` (that's the point — it's what makes the row
6204
+ * upload) while pinning `updated_at`, like every other topic writer. Callers
6205
+ * must pass a `limit`-bounded list: each row's upload carries its embedding, so
6206
+ * an unbounded pass re-uploads the entire vault at once.
6207
+ *
6208
+ * `source` is derived from `topics_user_managed`, the only provenance a legacy
6209
+ * row has: a curated memory's topics are recorded as `user`, everything else as
6210
+ * `auto`. Skips deleted, foreign-user, unlinked rows, and rows that already have
6211
+ * a record. Returns the ids filled.
6212
+ */
6213
+ declare function backfillMemoryTopicsOp(ctx: VaultMemoryOperationsContext, memoryIds: readonly string[]): Promise<string[]>;
6104
6214
  declare function deleteAllVaultMemoriesForUserOp(ctx: VaultMemoryOperationsContext, userId: string): Promise<number>;
6105
6215
  /**
6106
6216
  * The minimal plaintext shape the decay sweep needs — mirrors the `DecayInput`
@@ -6632,7 +6742,11 @@ interface AutoExtractor {
6632
6742
  processTurn(messages: AutoExtractMessage[], conversationId?: string): boolean;
6633
6743
  /** True while a turn's extraction is in flight. */
6634
6744
  isProcessing(): boolean;
6635
- /** Stop accepting new turns. In-flight work continues to completion. */
6745
+ /**
6746
+ * Stop accepting new turns. In-flight work continues to completion, and any
6747
+ * turn already queued (coalesced while an extraction was in flight) is still
6748
+ * flushed — never dropped — so a turn sent right before unmount isn't lost.
6749
+ */
6636
6750
  dispose(): void;
6637
6751
  }
6638
6752
  /**
@@ -8480,8 +8594,17 @@ declare function useChatStorage(options: UseChatStorageOptions): UseChatStorageR
8480
8594
  * is TWO-tier (`private | public`); null — and any unrecognised value —
8481
8595
  * reads as 'private', so nothing pre-existing is ever published without an
8482
8596
  * explicit visibility write
8483
- */
8484
- declare const SDK_SCHEMA_VERSION = 41;
8597
+ * - v42: Added topics, topics_updated_at columns to memory_vault so a memory's
8598
+ * topics become the DURABLE record and `entity` / `memory_entity` become a
8599
+ * device-local index over it. Those two tables never sync (entity ids are
8600
+ * locally generated), so a restored device used to receive "curated" /
8601
+ * "already extracted" flags on memories with zero topic links and the graph
8602
+ * recall lane stayed dead. `topics` carries the names across devices;
8603
+ * `topics_updated_at` is a SECOND timestamp because every topic writer pins
8604
+ * `updated_at` on purpose (recall's recency multiplier) and both sync paths
8605
+ * key on `updated_at`, so a topic-only change would neither upload nor merge
8606
+ */
8607
+ declare const SDK_SCHEMA_VERSION = 42;
8485
8608
  /**
8486
8609
  * Combined WatermelonDB schema for all SDK storage modules.
8487
8610
  *
@@ -8567,6 +8690,7 @@ declare const sdkSchema: Readonly<{
8567
8690
  * - v38 → v39: Added `last_observed_at` column to memory_vault (C3 re-observation watermark; stamped on retain merge, distinct from updated_at)
8568
8691
  * - v39 → v40: Added `fact_type`, `archived_at`, `trust_tier` columns to memory_vault for typed memory + decay + Tier-0 security (all nullable + plaintext, NULL backfill)
8569
8692
  * - v40 → v41: Added `visibility`, `twin_opt_in`, `published_at`, `geohash` columns to memory_vault for the People Nearby cross-user visibility axis (two-tier `private | public`; null/unknown grandfathered as 'private')
8693
+ * - v41 → v42: Added `topics` + `topics_updated_at` columns to memory_vault, making a memory's topics the durable synced record and `entity`/`memory_entity` a device-local index over it (null `topics` = pre-v42, backfilled from the row's current links by the sweep)
8570
8694
  */
8571
8695
  declare const sdkMigrations: Readonly<{
8572
8696
  validated: true;
@@ -9088,4 +9212,4 @@ declare function refreshNotionAccessToken(params: NotionRefreshTokenParams): Pro
9088
9212
  */
9089
9213
  declare function createNotionTools(getAccessToken: () => string | null, requestNotionAccess: () => Promise<string>): ToolConfig[];
9090
9214
 
9091
- export { type AutoExtractMessage, type AutoExtractor, type Budget, type CachedChunkVectors, type CachedServerTools, Conversation as ChatConversation, Message as ChatMessage, type ChatRole, type ChunkVectorCache, type ChunkingOptions, 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, ENTITY_FANOUT, type EmbeddedWalletSignerFn, type ExtractFactsOptions, type ExtractOutcome, type ExtractedCandidate, type ExtractedEntity, type ExtractionCursorStore, type FactType, type FileMetadata, 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 Logger, LoggerProvider, type LoggerProviderProps, MAX_HOPS, MEDIUM_TTL_MS, type MemoriesNeedingTopicExtraction, type EmbeddingOptions as MemoryEngineEmbeddingOptions, type MemoryEngineResult, type MemoryEngineSearchOptions, type MemoryExtractedEvent, type MemoryKind, type MemoryQuarantinedEvent, type MemoryVaultSearchOptions, type MemoryVaultToolOptions, type MessageRedactionResult, type MessageSkeleton, NEVER_TTL_MS, NODE_BUDGET, NOTION_OAUTH_CONFIG, type NeighborRefiner, type NotionAuthUrlParams, type NotionClientRegistration, type NotionExchangeCodeParams, type NotionOAuthEndpoints, type NotionPKCEChallenge, type NotionRefreshTokenParams, type NotionTokenResponse, type NowSource, type ObservationTrend, type ObservationTrendInput, PAST_EVENT_GRACE_MS, PII_PATTERNS, PROFILE_DOC_VERSION, type PiiCategory, type PiiMatch, type PiiPattern, PiiRedactor, type PiiRedactorOptions, type PlatformStorage, type PortalLlmAuth, type ProfileConfigFingerprint, type ProfileDoc, type ProfileFacet, type ProfileFacetKey, type ProfileSalienceInput, type ProfileSection, type PromptPreProcessor, type PromptPreProcessorContext, type QuantizedEmbedding, type QuarantinedMemoryInfo, QueueManager, type QueueStatus, RECALL_MAX_LIMIT, RECALL_TOOL_NAME, type RankedMemory, type RankedProfileCandidate, type RecallContext, type RecallDegradation, type RecallDiagnostics, type RecallOptions, type RecallResult, type RecallToolCallbacks, type RecallToolOptions, type RecencyOptions, type RedactionResult, type ReflectOptions, type ReflectResult, RerankerUnavailableError, 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 SynthesizeProfileOptions, TOPICS_EXTRACTION_VERSION, TOPIC_EXTRACTION_BATCH_SIZE, TREND_RECENT_WINDOW_DAYS, TREND_STALE_WINDOW_DAYS, type TextChunk, type TopicExtractOptions, type TopicExtractionInput, type TopicExtractionRunResult, type TurnCompleteEvent, type TurnSkippedEvent, type UpdateVaultFolderOptions, type UpdateVaultMemoryOptions, type UseChatStorageOptions, type UseChatStorageResult, type UseCreditsOptions, type UseCreditsResult, type UseModelsOptions, type UseModelsResult, VAULT_SIZE_HOP_CAP, type VaultEmbeddingCache, type VaultFolderOperationsContext, type VaultMemoryOperationsContext, type VaultMemoryVisibility, type VaultSaveOperation, type VaultSearchResult, WalletPoller, type WeatherClassification, type WeatherPreProcessorOptions, type WebSearchClassification, type WebSearchPreProcessorOptions, addConversationMemoriesOp, archiveVaultMemoryOp, 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, createLlmDecayClassifier, createLlmNeighborRefiner, createMemoryEngineTool, createMemoryVaultSearchTool, createMemoryVaultTool, createNotionTools, createPlatformCursorStore, createRecallTool, createStockPricePreProcessor, createStreamingDeAnonymizer, createVaultEmbeddingCache, createVaultFolderOp, createVaultMemoriesBatchOp, createVaultMemoryOp, createWeatherPreProcessor, createWebSearchPreProcessor, decryptConversationTitle, deleteAllVaultMemoriesForUserOp, deleteVaultFolderOp, deleteVaultMemoryOp, dequantizeEmbedding, discoverNotionOAuthEndpoints, eagerEmbedContent, embedAllMessages, embedMessage, ensureDefaultFoldersOp, exchangeNotionCode, extractAndLinkEntitiesForMemoriesOp, extractAndRetain, extractEntitiesForMemories, extractFacts, generateConversationId, generateEmbedding, generateEmbeddings, generateNotionPKCE, getAllVaultFoldersOp, getAllVaultMemoriesOp, getAllVaultMemoryContentsOp, getCachedServerTools, getConversationMemoriesOp, getConversationsByProjectLazyOp, getConversationsLazyOp, getConversationsPageOp, getDecayCandidatesRawOp, getLogger, getMemoriesNeedingTopicExtractionOp, getServerTools, getUnfiledVaultMemoriesOp, getVaultFolderMemoryCountOp, getVaultMemoryOp, hardDeleteDecayedOp, hasEncryptionKey, injectionSignatureCatalog, isPiiRedactor, isRerankerAvailable, moveMemoriesToFolderOp, noopLogger, onKeyAvailable, preEmbedVaultMemories, quantizeEmbedding, queueManager, rankProfileCandidates, recall, reflect, refreshNotionAccessToken, registerNotionClient, requestEncryptionKey, resolvePiiRedactor, restoreVaultMemoryOp, resumeStream, retain, scoreProfileSalience, screenCandidatesForInjection, sdkMigrations, sdkModelClasses, sdkSchema, searchVaultMemories, setLogger, setMemoryVisibilityOp, shouldChunkMessage, stampTopicsExtractedAtOp, streamCancelPath, streamReplayPath, summarizeObservationTrends, supersedeVaultMemoryOp, synthesizeProfile, traverseGraphLane, ttlForType, updateVaultFolderContextOp, updateVaultFolderOp, updateVaultMemoryEmbeddingOp, updateVaultMemoryOp, upsertMessageOp, useChat, useChatStorage, useCredits, useEncryption, useModels, xhrTransport };
9215
+ export { type AutoExtractMessage, type AutoExtractor, type Budget, type CachedChunkVectors, type CachedServerTools, Conversation as ChatConversation, Message as ChatMessage, type ChatRole, type ChunkVectorCache, type ChunkingOptions, 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, ENTITY_FANOUT, type EmbeddedWalletSignerFn, type ExtractFactsOptions, type ExtractOutcome, type ExtractedCandidate, type ExtractedEntity, type ExtractionCursorStore, type FactType, type FileMetadata, 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 Logger, LoggerProvider, type LoggerProviderProps, MAX_HOPS, MEDIUM_TTL_MS, type MemoriesNeedingTopicExtraction, type EmbeddingOptions as MemoryEngineEmbeddingOptions, type MemoryEngineResult, type MemoryEngineSearchOptions, type MemoryExtractedEvent, type MemoryKind, type MemoryQuarantinedEvent, type MemoryVaultSearchOptions, type MemoryVaultToolOptions, type MessageRedactionResult, type MessageSkeleton, NEVER_TTL_MS, NODE_BUDGET, NOTION_OAUTH_CONFIG, type NeighborRefiner, type NotionAuthUrlParams, type NotionClientRegistration, type NotionExchangeCodeParams, type NotionOAuthEndpoints, type NotionPKCEChallenge, type NotionRefreshTokenParams, type NotionTokenResponse, type NowSource, type ObservationTrend, type ObservationTrendInput, PAST_EVENT_GRACE_MS, PII_PATTERNS, PROFILE_DOC_VERSION, type PiiCategory, type PiiMatch, type PiiPattern, PiiRedactor, type PiiRedactorOptions, type PlatformStorage, type PortalLlmAuth, type ProfileConfigFingerprint, type ProfileDoc, type ProfileFacet, type ProfileFacetKey, type ProfileSalienceInput, type ProfileSection, type PromptPreProcessor, type PromptPreProcessorContext, type QuantizedEmbedding, type QuarantinedMemoryInfo, QueueManager, type QueueStatus, RECALL_MAX_LIMIT, RECALL_TOOL_NAME, type RankedMemory, type RankedProfileCandidate, type RecallContext, type RecallDegradation, type RecallDiagnostics, type RecallOptions, type RecallResult, type RecallToolCallbacks, type RecallToolOptions, type RecencyOptions, type RedactionResult, type ReflectOptions, type ReflectResult, RerankerUnavailableError, 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 SynthesizeProfileOptions, TOPICS_EXTRACTION_VERSION, TOPIC_EXTRACTION_BATCH_SIZE, TREND_RECENT_WINDOW_DAYS, TREND_STALE_WINDOW_DAYS, type TextChunk, type TopicExtractOptions, type TopicExtractionInput, type TopicExtractionRunResult, type TurnCompleteEvent, type TurnSkippedEvent, type UpdateVaultFolderOptions, type UpdateVaultMemoryOptions, type UseChatStorageOptions, type UseChatStorageResult, type UseCreditsOptions, type UseCreditsResult, type UseModelsOptions, type UseModelsResult, VAULT_SIZE_HOP_CAP, type VaultEmbeddingCache, type VaultFolderOperationsContext, type VaultMemoryOperationsContext, type VaultMemoryVisibility, type VaultSaveOperation, type VaultSearchResult, WalletPoller, type WeatherClassification, type WeatherPreProcessorOptions, type WebSearchClassification, type WebSearchPreProcessorOptions, addConversationMemoriesOp, archiveVaultMemoryOp, backfillMemoryTopicsOp, 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, createLlmDecayClassifier, createLlmNeighborRefiner, createMemoryEngineTool, createMemoryVaultSearchTool, createMemoryVaultTool, createNotionTools, createPlatformCursorStore, createRecallTool, createStockPricePreProcessor, createStreamingDeAnonymizer, createVaultEmbeddingCache, createVaultFolderOp, createVaultMemoriesBatchOp, createVaultMemoryOp, createWeatherPreProcessor, createWebSearchPreProcessor, decryptConversationTitle, deleteAllVaultMemoriesForUserOp, deleteVaultFolderOp, deleteVaultMemoryOp, dequantizeEmbedding, discoverNotionOAuthEndpoints, eagerEmbedContent, embedAllMessages, embedMessage, ensureDefaultFoldersOp, exchangeNotionCode, extractAndLinkEntitiesForMemoriesOp, extractAndRetain, extractEntitiesForMemories, extractFacts, generateConversationId, generateEmbedding, generateEmbeddings, generateNotionPKCE, getAllVaultFoldersOp, getAllVaultMemoriesOp, getAllVaultMemoryContentsOp, getCachedServerTools, getConversationMemoriesOp, getConversationsByProjectLazyOp, getConversationsLazyOp, getConversationsPageOp, getDecayCandidatesRawOp, getLogger, getMemoriesNeedingTopicExtractionOp, getServerTools, getUnfiledVaultMemoriesOp, getVaultFolderMemoryCountOp, getVaultMemoryOp, hardDeleteDecayedOp, hasEncryptionKey, injectionSignatureCatalog, isPiiRedactor, isRerankerAvailable, moveMemoriesToFolderOp, noopLogger, onKeyAvailable, preEmbedVaultMemories, quantizeEmbedding, queueManager, rankProfileCandidates, recall, reflect, refreshNotionAccessToken, registerNotionClient, relinkMemoryTopicsOp, requestEncryptionKey, resolvePiiRedactor, restoreVaultMemoryOp, resumeStream, retain, scoreProfileSalience, screenCandidatesForInjection, sdkMigrations, sdkModelClasses, sdkSchema, searchVaultMemories, setLogger, setMemoryVisibilityOp, shouldChunkMessage, stampTopicsExtractedAtOp, streamCancelPath, streamReplayPath, summarizeObservationTrends, supersedeVaultMemoryOp, synthesizeProfile, traverseGraphLane, ttlForType, updateVaultFolderContextOp, updateVaultFolderOp, updateVaultMemoryEmbeddingOp, updateVaultMemoryOp, upsertMessageOp, useChat, useChatStorage, useCredits, useEncryption, useModels, xhrTransport };
@@ -4507,14 +4507,23 @@ declare class VaultMemory extends Model {
4507
4507
  /** When true, the user has manually set this memory's topics; auto-extraction
4508
4508
  * leaves its entity links alone. Null on legacy rows (treated as false). */
4509
4509
  topicsUserManaged: boolean | null;
4510
+ /** The durable, synced record of this memory's topics — JSON `StoredTopic[]`.
4511
+ * `entity` / `memory_entity` are a device-local index over it. Null = pre-v42
4512
+ * (backfilled from the row's current links by the sweep). */
4513
+ topics: string | null;
4514
+ /** Unix ms of the last `topics` write. Separate from `updated_at`, which every
4515
+ * topic writer pins on purpose (recall recency) — see the schema note. */
4516
+ topicsUpdatedAt: number | null;
4510
4517
  /** Unix ms of the last LLM topic-extraction pass. Null = never extracted
4511
- * standalone (linked legacy rows are grandfathered as extracted). */
4518
+ * standalone (linked legacy rows are grandfathered as extracted).
4519
+ * DEPRECATED (v42) — subsumed by `topics_updated_at`; see the schema note. */
4512
4520
  topicsExtractedAt: number | null;
4513
4521
  /** A2 supersession: newer memory id that replaced this one, or null if live. */
4514
4522
  supersededBy: string | null;
4515
4523
  supersededAt: number | null;
4516
4524
  /** Extraction-logic version this memory was last stamped under. Null (pre-v38)
4517
- * reads as 0, so a TOPICS_EXTRACTION_VERSION bump re-extracts stale rows. */
4525
+ * reads as 0, so a TOPICS_EXTRACTION_VERSION bump re-extracts stale rows.
4526
+ * DEPRECATED (v42) — subsumed by `topics_updated_at`; see the schema note. */
4518
4527
  topicsExtractedVersion: number | null;
4519
4528
  /** C3 re-observation watermark: Unix ms of the last retain() merge, or null. */
4520
4529
  lastObservedAt: number | null;
@@ -4583,6 +4592,33 @@ declare class MemoryEntity extends Model {
4583
4592
  declare const ENTITY_KINDS: readonly ["person", "organization", "place", "event", "product", "thing", "concept", "other"];
4584
4593
  /** @public */
4585
4594
  type EntityKind = (typeof ENTITY_KINDS)[number];
4595
+ /**
4596
+ * Who put a topic on a memory. Written to `memory_vault.topics` but not yet
4597
+ * READ anywhere — it exists so a later improvement can refresh the `auto`
4598
+ * entries of a curated memory while leaving `user` entries alone (today
4599
+ * `topics_user_managed` is all-or-nothing per memory) without needing a second
4600
+ * migration or backfill. Don't build that behavior off it yet.
4601
+ *
4602
+ * When you do: a value written by the v42 backfill is NOT ground truth. Pre-v42
4603
+ * rows carry no per-topic provenance, so `backfillMemoryTopicsOp` derives it
4604
+ * from the per-memory `topics_user_managed` flag and stamps a curated legacy
4605
+ * row's every topic `user` — see the note at that derivation.
4606
+ * @public
4607
+ */
4608
+ type TopicSource = "user" | "auto";
4609
+ /**
4610
+ * One entry in `memory_vault.topics` — the durable, synced record of a memory's
4611
+ * topics. `name` carries the CALLER's display casing, unlike
4612
+ * {@link StoredEntity.canonicalName}, which {@link normalizeEntityName}
4613
+ * lowercases and which has no display column: preserving casing here is the
4614
+ * point of storing names on the memory row.
4615
+ * @public
4616
+ */
4617
+ interface StoredTopic {
4618
+ name: string;
4619
+ kind?: string;
4620
+ source: TopicSource;
4621
+ }
4586
4622
 
4587
4623
  interface EntityOperationsContext {
4588
4624
  database: Database;
@@ -5783,9 +5819,17 @@ interface StoredVaultMemory {
5783
5819
  /** When true, the user has manually set this memory's topics (entity links);
5784
5820
  * auto-extraction leaves them alone. False on legacy/auto rows. */
5785
5821
  topicsUserManaged: boolean;
5822
+ /** The memory's topics as the DURABLE, synced record — `entity` /
5823
+ * `memory_entity` are a device-local index over it. Null = pre-v42, no record
5824
+ * yet; `[]` = a record of "no topics". */
5825
+ topics: StoredTopic[] | null;
5826
+ /** Unix ms of the last `topics` write, or null if never written. Separate from
5827
+ * `updatedAt`, which topic writes deliberately pin (recall recency). */
5828
+ topicsUpdatedAt: number | null;
5786
5829
  /** Unix ms of the last LLM topic-extraction pass over this memory's content.
5787
5830
  * Null = never extracted standalone; rows that already carry entity links
5788
- * are grandfathered as extracted (see getMemoriesNeedingTopicExtractionOp). */
5831
+ * are grandfathered as extracted (see getMemoriesNeedingTopicExtractionOp).
5832
+ * DEPRECATED (v42) — subsumed by `topicsUpdatedAt`; see the schema note. */
5789
5833
  topicsExtractedAt: number | null;
5790
5834
  /** Write-time supersession (A2): id of the newer memory that replaced this
5791
5835
  * one (incompatible-value update, e.g. "Lives in Portland" → "Lives in SF").
@@ -5795,7 +5839,8 @@ interface StoredVaultMemory {
5795
5839
  /** Unix ms when this memory was superseded. Null when live. */
5796
5840
  supersededAt: number | null;
5797
5841
  /** Extraction-logic version this memory was last stamped under. Null (pre-v38)
5798
- * reads as 0, so a TOPICS_EXTRACTION_VERSION bump re-extracts stale rows. */
5842
+ * reads as 0, so a TOPICS_EXTRACTION_VERSION bump re-extracts stale rows.
5843
+ * DEPRECATED (v42) — subsumed by `topicsUpdatedAt`; see the schema note. */
5799
5844
  topicsExtractedVersion: number | null;
5800
5845
  /** C3 re-observation watermark: Unix ms of the last retain() merge into this
5801
5846
  * fact. Distinct from `updatedAt` (which merges preserve). Null = never
@@ -6064,20 +6109,54 @@ interface MemoriesNeedingTopicExtraction {
6064
6109
  * grandfather backlog is drained across sweeps rather than in one spike.
6065
6110
  */
6066
6111
  linkedUnstamped: string[];
6112
+ /**
6113
+ * IDs whose `topics` record disagrees with their `memory_entity` links — the
6114
+ * restored-device case, where the synced record arrived but the device-local
6115
+ * index (which can never sync) did not. Rebuild with
6116
+ * {@link relinkMemoryTopicsOp}: no LLM call, and no `memory_vault` write, so a
6117
+ * restore doesn't re-upload the vault.
6118
+ *
6119
+ * INCLUDES user-managed rows. A curated memory's index needs rebuilding just
6120
+ * like an auto one, and the flag it arrives with is what keeps the autotagger
6121
+ * off it — so unlike {@link pending} / {@link linkedUnstamped}, this bucket is
6122
+ * not filtered by ownership. Bounded by `limit`.
6123
+ */
6124
+ topicsToRelink: string[];
6125
+ /**
6126
+ * IDs that have links but no `topics` record at all — rows predating v42,
6127
+ * whose topics would otherwise never reach the server. Fill with
6128
+ * {@link backfillMemoryTopicsOp} (no LLM call), which derives the record from
6129
+ * the links already there.
6130
+ *
6131
+ * Also includes user-managed rows, for the same reason: a curated memory's
6132
+ * topics are exactly the ones worth preserving across a migration. Bounded by
6133
+ * `limit` because filling `topics` bumps `topics_updated_at` and so re-uploads
6134
+ * the row (embedding included) — uncapped, the first sweep after upgrade would
6135
+ * re-upload the entire vault at once. Rows already in {@link pending} are
6136
+ * excluded: their imminent LLM pass writes `topics` anyway.
6137
+ */
6138
+ topicsBackfill: string[];
6067
6139
  }
6068
6140
  /**
6069
- * Sweep query for the background topic-extraction worker: partition the
6070
- * user's non-deleted, non-user-managed memories by what the worker should do
6071
- * with them (see {@link MemoriesNeedingTopicExtraction}). User-managed rows
6072
- * are never returned — the user owns their topics, including an intentionally
6073
- * empty set. Requires `ctx.entityCtx` for the entity-links check.
6141
+ * Sweep query for the background topic-extraction worker: partition the user's
6142
+ * non-deleted memories by what the worker should do with them (see
6143
+ * {@link MemoriesNeedingTopicExtraction}). Requires `ctx.entityCtx` for the
6144
+ * entity-links check.
6145
+ *
6146
+ * User-managed rows are excluded from the two LLM-facing buckets — the user owns
6147
+ * their topics, including an intentionally empty set — but NOT from
6148
+ * `topicsToRelink` / `topicsBackfill`, which only move a curated row's topics
6149
+ * between the record and the index and never re-derive them. That's why the
6150
+ * ownership filter lives in the partition below rather than in the query: a
6151
+ * restored curated memory is exactly the row whose index must be rebuilt.
6074
6152
  */
6075
6153
  declare function getMemoriesNeedingTopicExtractionOp(ctx: VaultMemoryOperationsContext, options?: {
6076
6154
  limit?: number;
6077
6155
  }): Promise<MemoriesNeedingTopicExtraction>;
6078
6156
  /**
6079
6157
  * Stamp `topics_extracted_at` (and `topics_extracted_version`) on the given
6080
- * memories — the topic worker calls this after a successful extraction pass
6158
+ * memories — both DEPRECATED (v42), subsumed by `topics_updated_at`; see the
6159
+ * schema note. The topic worker calls this after a successful extraction pass
6081
6160
  * (including zero-entity results, so quiet memories aren't re-asked every sweep)
6082
6161
  * and to grandfather `linkedUnstamped` rows without an LLM call. `version`
6083
6162
  * defaults to {@link TOPICS_EXTRACTION_VERSION}: stamping at the current version
@@ -6101,6 +6180,37 @@ declare function getMemoriesNeedingTopicExtractionOp(ctx: VaultMemoryOperationsC
6101
6180
  * needed to `prepareUpdate` stays bounded and never spikes the RecordCache.
6102
6181
  */
6103
6182
  declare function stampTopicsExtractedAtOp(ctx: VaultMemoryOperationsContext, memoryIds: readonly string[], extractedAt: number, version?: number): Promise<string[]>;
6183
+ /**
6184
+ * Rebuild the `memory_entity` index for the sweep's `topicsToRelink` rows from
6185
+ * each row's `topics` record — the restored-device repair. No LLM call: every
6186
+ * name already lives on the row.
6187
+ *
6188
+ * Writes NOTHING to `memory_vault`, deliberately. Restored rows are written
6189
+ * `_status: 'synced'`, so touching them would mark the whole vault dirty and
6190
+ * re-upload it (embeddings included) after every migration — the index is
6191
+ * device-local state and rebuilding it is not a change to the memory.
6192
+ * `topics_user_managed` in particular is left exactly as it arrived, so the
6193
+ * autotagger stays off a curated memory whose links this just restored.
6194
+ *
6195
+ * Skips deleted, foreign-user, and record-less rows. Returns the ids relinked.
6196
+ */
6197
+ declare function relinkMemoryTopicsOp(ctx: VaultMemoryOperationsContext, memoryIds: readonly string[]): Promise<string[]>;
6198
+ /**
6199
+ * Fill `topics` for the sweep's `topicsBackfill` rows from the links they
6200
+ * already carry — the one-time migration of pre-v42 rows, whose topics exist
6201
+ * only in the device-local index and so never reach the server. No LLM call.
6202
+ *
6203
+ * Bumps `topics_updated_at` (that's the point — it's what makes the row
6204
+ * upload) while pinning `updated_at`, like every other topic writer. Callers
6205
+ * must pass a `limit`-bounded list: each row's upload carries its embedding, so
6206
+ * an unbounded pass re-uploads the entire vault at once.
6207
+ *
6208
+ * `source` is derived from `topics_user_managed`, the only provenance a legacy
6209
+ * row has: a curated memory's topics are recorded as `user`, everything else as
6210
+ * `auto`. Skips deleted, foreign-user, unlinked rows, and rows that already have
6211
+ * a record. Returns the ids filled.
6212
+ */
6213
+ declare function backfillMemoryTopicsOp(ctx: VaultMemoryOperationsContext, memoryIds: readonly string[]): Promise<string[]>;
6104
6214
  declare function deleteAllVaultMemoriesForUserOp(ctx: VaultMemoryOperationsContext, userId: string): Promise<number>;
6105
6215
  /**
6106
6216
  * The minimal plaintext shape the decay sweep needs — mirrors the `DecayInput`
@@ -6632,7 +6742,11 @@ interface AutoExtractor {
6632
6742
  processTurn(messages: AutoExtractMessage[], conversationId?: string): boolean;
6633
6743
  /** True while a turn's extraction is in flight. */
6634
6744
  isProcessing(): boolean;
6635
- /** Stop accepting new turns. In-flight work continues to completion. */
6745
+ /**
6746
+ * Stop accepting new turns. In-flight work continues to completion, and any
6747
+ * turn already queued (coalesced while an extraction was in flight) is still
6748
+ * flushed — never dropped — so a turn sent right before unmount isn't lost.
6749
+ */
6636
6750
  dispose(): void;
6637
6751
  }
6638
6752
  /**
@@ -8480,8 +8594,17 @@ declare function useChatStorage(options: UseChatStorageOptions): UseChatStorageR
8480
8594
  * is TWO-tier (`private | public`); null — and any unrecognised value —
8481
8595
  * reads as 'private', so nothing pre-existing is ever published without an
8482
8596
  * explicit visibility write
8483
- */
8484
- declare const SDK_SCHEMA_VERSION = 41;
8597
+ * - v42: Added topics, topics_updated_at columns to memory_vault so a memory's
8598
+ * topics become the DURABLE record and `entity` / `memory_entity` become a
8599
+ * device-local index over it. Those two tables never sync (entity ids are
8600
+ * locally generated), so a restored device used to receive "curated" /
8601
+ * "already extracted" flags on memories with zero topic links and the graph
8602
+ * recall lane stayed dead. `topics` carries the names across devices;
8603
+ * `topics_updated_at` is a SECOND timestamp because every topic writer pins
8604
+ * `updated_at` on purpose (recall's recency multiplier) and both sync paths
8605
+ * key on `updated_at`, so a topic-only change would neither upload nor merge
8606
+ */
8607
+ declare const SDK_SCHEMA_VERSION = 42;
8485
8608
  /**
8486
8609
  * Combined WatermelonDB schema for all SDK storage modules.
8487
8610
  *
@@ -8567,6 +8690,7 @@ declare const sdkSchema: Readonly<{
8567
8690
  * - v38 → v39: Added `last_observed_at` column to memory_vault (C3 re-observation watermark; stamped on retain merge, distinct from updated_at)
8568
8691
  * - v39 → v40: Added `fact_type`, `archived_at`, `trust_tier` columns to memory_vault for typed memory + decay + Tier-0 security (all nullable + plaintext, NULL backfill)
8569
8692
  * - v40 → v41: Added `visibility`, `twin_opt_in`, `published_at`, `geohash` columns to memory_vault for the People Nearby cross-user visibility axis (two-tier `private | public`; null/unknown grandfathered as 'private')
8693
+ * - v41 → v42: Added `topics` + `topics_updated_at` columns to memory_vault, making a memory's topics the durable synced record and `entity`/`memory_entity` a device-local index over it (null `topics` = pre-v42, backfilled from the row's current links by the sweep)
8570
8694
  */
8571
8695
  declare const sdkMigrations: Readonly<{
8572
8696
  validated: true;
@@ -9088,4 +9212,4 @@ declare function refreshNotionAccessToken(params: NotionRefreshTokenParams): Pro
9088
9212
  */
9089
9213
  declare function createNotionTools(getAccessToken: () => string | null, requestNotionAccess: () => Promise<string>): ToolConfig[];
9090
9214
 
9091
- export { type AutoExtractMessage, type AutoExtractor, type Budget, type CachedChunkVectors, type CachedServerTools, Conversation as ChatConversation, Message as ChatMessage, type ChatRole, type ChunkVectorCache, type ChunkingOptions, 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, ENTITY_FANOUT, type EmbeddedWalletSignerFn, type ExtractFactsOptions, type ExtractOutcome, type ExtractedCandidate, type ExtractedEntity, type ExtractionCursorStore, type FactType, type FileMetadata, 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 Logger, LoggerProvider, type LoggerProviderProps, MAX_HOPS, MEDIUM_TTL_MS, type MemoriesNeedingTopicExtraction, type EmbeddingOptions as MemoryEngineEmbeddingOptions, type MemoryEngineResult, type MemoryEngineSearchOptions, type MemoryExtractedEvent, type MemoryKind, type MemoryQuarantinedEvent, type MemoryVaultSearchOptions, type MemoryVaultToolOptions, type MessageRedactionResult, type MessageSkeleton, NEVER_TTL_MS, NODE_BUDGET, NOTION_OAUTH_CONFIG, type NeighborRefiner, type NotionAuthUrlParams, type NotionClientRegistration, type NotionExchangeCodeParams, type NotionOAuthEndpoints, type NotionPKCEChallenge, type NotionRefreshTokenParams, type NotionTokenResponse, type NowSource, type ObservationTrend, type ObservationTrendInput, PAST_EVENT_GRACE_MS, PII_PATTERNS, PROFILE_DOC_VERSION, type PiiCategory, type PiiMatch, type PiiPattern, PiiRedactor, type PiiRedactorOptions, type PlatformStorage, type PortalLlmAuth, type ProfileConfigFingerprint, type ProfileDoc, type ProfileFacet, type ProfileFacetKey, type ProfileSalienceInput, type ProfileSection, type PromptPreProcessor, type PromptPreProcessorContext, type QuantizedEmbedding, type QuarantinedMemoryInfo, QueueManager, type QueueStatus, RECALL_MAX_LIMIT, RECALL_TOOL_NAME, type RankedMemory, type RankedProfileCandidate, type RecallContext, type RecallDegradation, type RecallDiagnostics, type RecallOptions, type RecallResult, type RecallToolCallbacks, type RecallToolOptions, type RecencyOptions, type RedactionResult, type ReflectOptions, type ReflectResult, RerankerUnavailableError, 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 SynthesizeProfileOptions, TOPICS_EXTRACTION_VERSION, TOPIC_EXTRACTION_BATCH_SIZE, TREND_RECENT_WINDOW_DAYS, TREND_STALE_WINDOW_DAYS, type TextChunk, type TopicExtractOptions, type TopicExtractionInput, type TopicExtractionRunResult, type TurnCompleteEvent, type TurnSkippedEvent, type UpdateVaultFolderOptions, type UpdateVaultMemoryOptions, type UseChatStorageOptions, type UseChatStorageResult, type UseCreditsOptions, type UseCreditsResult, type UseModelsOptions, type UseModelsResult, VAULT_SIZE_HOP_CAP, type VaultEmbeddingCache, type VaultFolderOperationsContext, type VaultMemoryOperationsContext, type VaultMemoryVisibility, type VaultSaveOperation, type VaultSearchResult, WalletPoller, type WeatherClassification, type WeatherPreProcessorOptions, type WebSearchClassification, type WebSearchPreProcessorOptions, addConversationMemoriesOp, archiveVaultMemoryOp, 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, createLlmDecayClassifier, createLlmNeighborRefiner, createMemoryEngineTool, createMemoryVaultSearchTool, createMemoryVaultTool, createNotionTools, createPlatformCursorStore, createRecallTool, createStockPricePreProcessor, createStreamingDeAnonymizer, createVaultEmbeddingCache, createVaultFolderOp, createVaultMemoriesBatchOp, createVaultMemoryOp, createWeatherPreProcessor, createWebSearchPreProcessor, decryptConversationTitle, deleteAllVaultMemoriesForUserOp, deleteVaultFolderOp, deleteVaultMemoryOp, dequantizeEmbedding, discoverNotionOAuthEndpoints, eagerEmbedContent, embedAllMessages, embedMessage, ensureDefaultFoldersOp, exchangeNotionCode, extractAndLinkEntitiesForMemoriesOp, extractAndRetain, extractEntitiesForMemories, extractFacts, generateConversationId, generateEmbedding, generateEmbeddings, generateNotionPKCE, getAllVaultFoldersOp, getAllVaultMemoriesOp, getAllVaultMemoryContentsOp, getCachedServerTools, getConversationMemoriesOp, getConversationsByProjectLazyOp, getConversationsLazyOp, getConversationsPageOp, getDecayCandidatesRawOp, getLogger, getMemoriesNeedingTopicExtractionOp, getServerTools, getUnfiledVaultMemoriesOp, getVaultFolderMemoryCountOp, getVaultMemoryOp, hardDeleteDecayedOp, hasEncryptionKey, injectionSignatureCatalog, isPiiRedactor, isRerankerAvailable, moveMemoriesToFolderOp, noopLogger, onKeyAvailable, preEmbedVaultMemories, quantizeEmbedding, queueManager, rankProfileCandidates, recall, reflect, refreshNotionAccessToken, registerNotionClient, requestEncryptionKey, resolvePiiRedactor, restoreVaultMemoryOp, resumeStream, retain, scoreProfileSalience, screenCandidatesForInjection, sdkMigrations, sdkModelClasses, sdkSchema, searchVaultMemories, setLogger, setMemoryVisibilityOp, shouldChunkMessage, stampTopicsExtractedAtOp, streamCancelPath, streamReplayPath, summarizeObservationTrends, supersedeVaultMemoryOp, synthesizeProfile, traverseGraphLane, ttlForType, updateVaultFolderContextOp, updateVaultFolderOp, updateVaultMemoryEmbeddingOp, updateVaultMemoryOp, upsertMessageOp, useChat, useChatStorage, useCredits, useEncryption, useModels, xhrTransport };
9215
+ export { type AutoExtractMessage, type AutoExtractor, type Budget, type CachedChunkVectors, type CachedServerTools, Conversation as ChatConversation, Message as ChatMessage, type ChatRole, type ChunkVectorCache, type ChunkingOptions, 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, ENTITY_FANOUT, type EmbeddedWalletSignerFn, type ExtractFactsOptions, type ExtractOutcome, type ExtractedCandidate, type ExtractedEntity, type ExtractionCursorStore, type FactType, type FileMetadata, 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 Logger, LoggerProvider, type LoggerProviderProps, MAX_HOPS, MEDIUM_TTL_MS, type MemoriesNeedingTopicExtraction, type EmbeddingOptions as MemoryEngineEmbeddingOptions, type MemoryEngineResult, type MemoryEngineSearchOptions, type MemoryExtractedEvent, type MemoryKind, type MemoryQuarantinedEvent, type MemoryVaultSearchOptions, type MemoryVaultToolOptions, type MessageRedactionResult, type MessageSkeleton, NEVER_TTL_MS, NODE_BUDGET, NOTION_OAUTH_CONFIG, type NeighborRefiner, type NotionAuthUrlParams, type NotionClientRegistration, type NotionExchangeCodeParams, type NotionOAuthEndpoints, type NotionPKCEChallenge, type NotionRefreshTokenParams, type NotionTokenResponse, type NowSource, type ObservationTrend, type ObservationTrendInput, PAST_EVENT_GRACE_MS, PII_PATTERNS, PROFILE_DOC_VERSION, type PiiCategory, type PiiMatch, type PiiPattern, PiiRedactor, type PiiRedactorOptions, type PlatformStorage, type PortalLlmAuth, type ProfileConfigFingerprint, type ProfileDoc, type ProfileFacet, type ProfileFacetKey, type ProfileSalienceInput, type ProfileSection, type PromptPreProcessor, type PromptPreProcessorContext, type QuantizedEmbedding, type QuarantinedMemoryInfo, QueueManager, type QueueStatus, RECALL_MAX_LIMIT, RECALL_TOOL_NAME, type RankedMemory, type RankedProfileCandidate, type RecallContext, type RecallDegradation, type RecallDiagnostics, type RecallOptions, type RecallResult, type RecallToolCallbacks, type RecallToolOptions, type RecencyOptions, type RedactionResult, type ReflectOptions, type ReflectResult, RerankerUnavailableError, 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 SynthesizeProfileOptions, TOPICS_EXTRACTION_VERSION, TOPIC_EXTRACTION_BATCH_SIZE, TREND_RECENT_WINDOW_DAYS, TREND_STALE_WINDOW_DAYS, type TextChunk, type TopicExtractOptions, type TopicExtractionInput, type TopicExtractionRunResult, type TurnCompleteEvent, type TurnSkippedEvent, type UpdateVaultFolderOptions, type UpdateVaultMemoryOptions, type UseChatStorageOptions, type UseChatStorageResult, type UseCreditsOptions, type UseCreditsResult, type UseModelsOptions, type UseModelsResult, VAULT_SIZE_HOP_CAP, type VaultEmbeddingCache, type VaultFolderOperationsContext, type VaultMemoryOperationsContext, type VaultMemoryVisibility, type VaultSaveOperation, type VaultSearchResult, WalletPoller, type WeatherClassification, type WeatherPreProcessorOptions, type WebSearchClassification, type WebSearchPreProcessorOptions, addConversationMemoriesOp, archiveVaultMemoryOp, backfillMemoryTopicsOp, 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, createLlmDecayClassifier, createLlmNeighborRefiner, createMemoryEngineTool, createMemoryVaultSearchTool, createMemoryVaultTool, createNotionTools, createPlatformCursorStore, createRecallTool, createStockPricePreProcessor, createStreamingDeAnonymizer, createVaultEmbeddingCache, createVaultFolderOp, createVaultMemoriesBatchOp, createVaultMemoryOp, createWeatherPreProcessor, createWebSearchPreProcessor, decryptConversationTitle, deleteAllVaultMemoriesForUserOp, deleteVaultFolderOp, deleteVaultMemoryOp, dequantizeEmbedding, discoverNotionOAuthEndpoints, eagerEmbedContent, embedAllMessages, embedMessage, ensureDefaultFoldersOp, exchangeNotionCode, extractAndLinkEntitiesForMemoriesOp, extractAndRetain, extractEntitiesForMemories, extractFacts, generateConversationId, generateEmbedding, generateEmbeddings, generateNotionPKCE, getAllVaultFoldersOp, getAllVaultMemoriesOp, getAllVaultMemoryContentsOp, getCachedServerTools, getConversationMemoriesOp, getConversationsByProjectLazyOp, getConversationsLazyOp, getConversationsPageOp, getDecayCandidatesRawOp, getLogger, getMemoriesNeedingTopicExtractionOp, getServerTools, getUnfiledVaultMemoriesOp, getVaultFolderMemoryCountOp, getVaultMemoryOp, hardDeleteDecayedOp, hasEncryptionKey, injectionSignatureCatalog, isPiiRedactor, isRerankerAvailable, moveMemoriesToFolderOp, noopLogger, onKeyAvailable, preEmbedVaultMemories, quantizeEmbedding, queueManager, rankProfileCandidates, recall, reflect, refreshNotionAccessToken, registerNotionClient, relinkMemoryTopicsOp, requestEncryptionKey, resolvePiiRedactor, restoreVaultMemoryOp, resumeStream, retain, scoreProfileSalience, screenCandidatesForInjection, sdkMigrations, sdkModelClasses, sdkSchema, searchVaultMemories, setLogger, setMemoryVisibilityOp, shouldChunkMessage, stampTopicsExtractedAtOp, streamCancelPath, streamReplayPath, summarizeObservationTrends, supersedeVaultMemoryOp, synthesizeProfile, traverseGraphLane, ttlForType, updateVaultFolderContextOp, updateVaultFolderOp, updateVaultMemoryEmbeddingOp, updateVaultMemoryOp, upsertMessageOp, useChat, useChatStorage, useCredits, useEncryption, useModels, xhrTransport };